Once your stock items point at Oushodh medicines, the data under them keeps moving. DGDA registers new medicines, a price changes, a maker’s name is corrected. Your software needs to notice the changes that touch the items you stock, without copying the data and without touching a sale you made last year. This guide shows a small scheduled job that does that.
What can change on a medicine you stock?
| What changes | Where you see it | What your job does |
|---|---|---|
| A new medicine is added | It is in the list of changes | Search your unmatched items again |
| A price | prices |
Flag the item for a person to check your price |
| A brand, maker or name spelling | brand, product_name, manufacturer |
Flag the item if you print the name |
| A DGDA registration is linked | dgda_listed turns true |
Nothing, unless you show the badge |
| The ID you stored is an old one | Get a medicine answers with the current id |
Save the new id; the uuid stays |
What does not change is as useful. Medicines are never deleted, and an ID never points to another medicine, so a uuid in your mapping table never goes stale. Oushodh also has no field that says a medicine is no longer made. Whether you keep selling one is your decision, from your own sales and suppliers.
How does the API say what changed?
GET /v1/medicines with updated_since answers only the medicines changed at or after that time, oldest change first. Each medicine’s last_updated says when any of its fields last changed, and a new medicine counts as a change. Pages hold up to 500 medicines, and you pass next back as cursor until it is null.
Before that, one call to GET /v1/meta tells you whether there is anything to read. Its last_import is the time of the last import. If it is the same as on your last run, nothing has changed, and the job can stop after one request.
What does the job look like?
It reads each change, keeps only the uuid and the time, and flags the stock items your mapping table links to that uuid:
import os
import requests
API = "https://api.oushodh.dev/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['OUSHODH_API_KEY']}"}
def changed_since(since):
cursor = None
while True:
params = {"updated_since": since, "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()
for m in page["items"]:
yield m["uuid"], m["last_updated"]
cursor = page["next"]
if cursor is None:
return
since = load_since() # the newest last_updated from your last run
mine = set(load_mapped_uuids()) # medicine_uuid from your mapping table
newest = since
for uuid, updated in changed_since(since):
newest = max(newest, updated)
if uuid in mine:
flag_for_review(uuid) # marks your stock items; stores no API data
save_since(newest)
load_since, load_mapped_uuids, flag_for_review and save_since are yours, on your own tables. The first run needs a starting time: use the time you finished the first match, in UTC and written like 2026-11-08T09:30:00Z, or the API answers 400 bad_request. “At or after” means the medicine that set the time comes back once on the next run, so make flagging an item twice harmless.
When the list holds new medicines, search your items with status set to none or review again, as in connecting your inventory. A new medicine can be the one an item was waiting for.
What does a person check on a flagged item?
The reviewer’s screen gets the medicine with GET /v1/medicines/{ref} when it opens, and shows it beside your stock item. The person decides whether your own selling price, your shelf label or your item name needs changing, and changes it in your system. The job never writes those for them.
That split matters for prices. prices holds each MRP a source states, per unit, per strip or per pack, and names the source. Your item’s price is what you charge, which you set. MRP in Bangladesh explains each price the API gives.
Why must past sales never change?
Because a sale is a record of what happened. A sale line keeps the medicine’s uuid and id, the name printed on the invoice, the quantity and the price you charged. The terms let you keep data that has become part of your own records, such as an order or an invoice, so that line stays as it was, whatever the medicine’s price is today.
So never show an old sale by joining it to the current medicine for its price or name. Show what the sale line holds. Join on the uuid only to open the medicine as it is now.
How often should the job run?
Each run costs one request when nothing changed, and one more for each page of up to 500 changes when something did. Once a day is a sensible start. Running more often costs little, since a run with nothing new stops after the /v1/meta check.
The job never keeps a copy of the medicines, and that is deliberate. The terms of use do not allow storing API responses or building a database from them. If your software has to work from a full copy of the data, for example with no internet, that needs a separate written licence on a Custom plan. Talk to us about it. The integration overview sets out what every plan allows and what a Custom licence adds.