Oushodh logooushodh

How to list every brand of a generic in Bangladesh

By Al Amin Ahamed · Published · Updated · 6 min read

Short answer

Page through GET /v1/medicines with generic and form set, and keep the medicines whose strength equals the one you want. Show each with its maker and MRP, comparing only like prices. The list shows what the data holds; it does not say one brand can replace another.

Key facts

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.

Flowchart: 1, list the medicines of the generic and form with the generic and form filters, to the last page. 2, keep the medicines whose strength equals yours. 3, show each brand with its maker and MRP; a price no source states stays empty. A shared generic is a fact of the data, not advice to switch.
Three steps from a generic to its list of brands.

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.

Share this post

FAQ

  • Does the API have a filter for one generic?

    Yes. List medicines takes generic and form, which match the whole generic_name and dosage_form in any case. Strength has no filter, so your code keeps the strength you want.

  • Why not use Search for this list?

    Search returns at most 50 medicines and has no cursor. List medicines pages through every match, up to 500 a page.

  • Does a shared generic mean one brand can replace another?

    No. The list shows that medicines share a generic, a strength and a form in the data. It is not advice, and the choice is for a prescriber or a pharmacist.

  • How do combinations show up?

    A combination has its own generic_name, with each part in it. The generic filter matches the whole name, so it keeps combinations apart from single-generic medicines.

Sources

Choosing a data source

List brands by generic and form