Oushodh logooushodh
INTEGRATION

Pharmacies and chains

A pharmacy or a chain with a POS: map the stock list, sell at the counter, receive new stock and handle an MRP change, whichever kind of POS you run.

A cashier can find a medicine by a few letters of its brand, generic or maker, and each row is one brand in one strength and dosage form. The MRP comes with the source that states it, per unit, strip or pack. A POS vendor connects once for every shop it serves: each plan covers a number of end clients, from 1 on Developer to unlimited on Agency.

What you already have

An item table in the POS: a name, often a strength and a pack, your stock, your item codes or barcodes, and your selling price. All of it stays yours. Mapping adds one thing: the Oushodh uuid beside each item.

Diagram: three moments in a pharmacy. At the counter, search, pick the row, and the sale keeps the uuid. When new stock comes in, a new item is searched and mapped once. When an MRP changes, updated_since flags your item and a person checks it. The POS keeps selling from its own records, and the key stays off the shop screens.
Three moments at a pharmacy.

Map the stock list

Map each item as in the overview: search by brand, compare strength, form and maker, save the uuid only when exactly one medicine fits, and send the rest to a person. Where the uuid is kept depends on your POS: the four kinds are below.

Sell at the counter

The POS can keep searching its own item table. To let the cashier search by generic or maker too, send what they type to Search through your server, and show only the rows whose uuid is in your mapping, so the list holds what you stock. Wait for a pause in typing before each call: the POS search guide shows how.

The sale line keeps the item's uuid, the name as printed and the price you charged. The sale is your record, so it never changes.

Receive new stock

Items already mapped need nothing. An item you have not stocked before is searched and mapped once, before it goes on the shelf. One that search cannot settle waits for a person.

Handle an MRP change

Your change check flags the item when its medicine changes. A person compares the MRP in prices with the price on your item and decides your selling price. Past sales keep the price that was charged.

Four kinds of POS

  • You build or own itMAPPINGA uuid column in your item tableKEYYour backendCHANGESA check your backend runs
  • Cloud POS with an API, webhooks or pluginsMAPPINGA connector's table: item code to uuidKEYThe connector's serverCHANGESThe connector's check, flagged in the POS
  • Desktop or offline POS with a local databaseMAPPINGA uuid column or a mapping table in the local databaseKEYYour server, which the shop's connector callsCHANGESYour server's check, shown when the shop is online
  • Import and export of CSV or Excel onlyMAPPINGA column in the file you import backKEYThe machine that runs the scriptCHANGESThe script's check: a list of item codes
  • You build or own the POSCall Oushodh from your backend, never from the till. Add a uuid column to the item table, keep your sales as they are, read medicine details live, and run the change check on a schedule.
  • A cloud POS with its own APIA small connector service keeps the mapping, item code to uuid, and calls Oushodh live when the POS asks through a plugin or a webhook. The key stays in the connector's settings. It stores the mapping and nothing else from the API, and flags changed items through the POS's API or a report.
  • A desktop or offline POSA connector on the shop PC, or a small server in the shop, reads the item table and writes back only the uuid column or a mapping table. It calls your own server, which holds the key, so no till ever has it. When the internet is down, the POS keeps selling from its own records and lookups wait until it is back. An offline copy of Oushodh data needs the Custom licence.
  • CSV or Excel onlyExport the item list. A script searches each item, one call at a time within your plan's per-minute limit, and fills the uuid only when exactly one medicine fits; a person reviews the blanks. Then import the file back. There is no bulk-match endpoint, so it is one Search call per item. The key is in the script's environment, never in the spreadsheet.

What you may store

  • The uuid, and the id if staff see it, on each item.
  • Your stock, item codes, selling prices and every sale, with the name and price as sold.
  • Not: medicine details, prices or search results copied into the POS to read later.

A POS that must search every medicine with no internet needs a full copy, and so the Custom licence: Part 2.

Match a CSV exportPython
import csv, os, time, 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 makes(maker, name):
    # the company's DGDA name, or a division or spelling linked to it
    names = [maker["name"]] + [n["name"] for n in maker["names"]] if maker else []
    return any(same(n, name) for n in names)


def match(item):
    while True:
        r = requests.get(f"{API}/medicines/search", headers=HEADERS,
                         params={"q": item["brand"], "limit": 50}, timeout=30)
        if r.status_code == 429 and r.json()["error"]["code"] == "rate_limited":
            time.sleep(int(r.headers["Retry-After"]))
            continue
        r.raise_for_status()
        break
    fits = [m for m in r.json()["items"]
            if same(m["strength"], item["strength"])
            and same(m["dosage_form"], item["form"])
            and makes(m["manufacturer"], item["maker"])]
    # a blank uuid goes to a person
    return fits[0]["uuid"] if len(fits) == 1 else ""


with open("items.csv") as src, open("items-mapped.csv", "w", newline="") as out:
    rows = csv.DictReader(src)
    w = csv.DictWriter(out, fieldnames=rows.fieldnames + ["oushodh_uuid"])
    w.writeheader()
    for item in rows:
        w.writerow({**item, "oushodh_uuid": match(item)})