Many brands in Bangladesh share one generic. A pharmacy screen or a price page often needs to list them side by side: every medicine with this generic, in this strength and form, with its maker and MRP. This guide shows how to build that list with the Oushodh API. It is a data guide: the list shows what the data holds, and says nothing about whether one medicine can take another’s place.
Is there a filter for one generic?
Yes. List medicines takes generic, which keeps the medicines whose whole generic_name is the one you send, in any case, and form, which does the same for dosage_form. It pages through every match. Strength has no filter, so your code keeps the strength it wants.
| Step | Call or check |
|---|---|
| Find every medicine of the generic, in the form | GET /v1/medicines?generic=…&form=…, with cursor until next is null |
| Keep the same strength | strength equal to the one you want |
Search is the wrong call here. It returns at most 50 medicines, best match first, and has no cursor, so a common generic would be cut short. List medicines answers up to 500 a page, with total and a next cursor.
What does the code look like?
import os
import requests
API = "https://api.oushodh.dev/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['OUSHODH_API_KEY']}"}
def same(a, b):
return (a or "").strip().lower() == (b or "").strip().lower()
def brands_of(generic, strength, form):
found, cursor = [], None
while True:
params = {"generic": generic, "form": form, "limit": 500}
if cursor:
params["cursor"] = cursor
r = requests.get(f"{API}/medicines", headers=HEADERS, params=params, timeout=30)
r.raise_for_status()
page = r.json()
found += [m for m in page["items"] if same(m["strength"], strength)]
cursor = page["next"]
if cursor is None:
return found
rows = brands_of("Paracetamol", "500 mg", "Tablet")
The generic filter matches the whole generic_name, not one word of it. A combination has its own generic name with every part in it, so Paracetamol lists no Paracetamol and Caffeine medicine. Send the combination’s full name to list those.
Each page is one request. Build the list when someone opens the screen, and do not keep the answers: the terms of use do not allow caching or storing API responses.
What should each row show?
The product_name, the manufacturer, a DGDA badge from dgda_listed, and the MRP from prices with its source. Show the medicine_type too when the list mixes systems.
Compare prices only like with like. Put a unit price beside a unit price and a strip beside a strip. A medicine whose source states only a strip price has null for the unit, and the row should say so rather than divide the strip. Sort by MRP only within one kind of price, and keep rows with no price at the end, not at zero. MRP in Bangladesh explains each kind of price.
Does the list say one brand can replace another?
No. It says that these medicines share a generic name, a strength and a dosage form in the data. It says nothing about whether one can be used in another’s place, and Oushodh never suggests a substitute. Label the screen as information, and leave the choice to a prescriber or a pharmacist.
Why the names line up at all is covered in how Oushodh matches one medicine across sources: on a medicine DGDA lists, the register writes the generic, so the same generic is spelled the same way across makers.
How do I count the makers of a generic?
From the same rows: count the distinct manufacturer.id values, which put a division under its company. Each manufacturer carries its DGDA name. That is a count of makers in the data for that generic, strength and form on the day you ask, not of what any shop has in stock. For counts across the whole catalogue, the pharmaceutical companies post has them.
A pharmacy that wants this list for its own shelves can join it to its mapping table, as in connecting your inventory, and mark the rows it stocks.