Dispenses
The pharmacy's dispensing ledger.
The record of medications actually handed to patients at the pharmacy — distinct from prescriptions (the order) and inventory (standing stock). A new dispense is written when the pharmacy dispenses a course from the dispensing queue, and the feed appears under Pharmacy → Recently dispensed.
| Method | Path | Permission |
|---|---|---|
GET | /api/dispenses | inventory:read |
POST | /api/dispenses | inventory:write |
DELETE | /api/dispenses/{id} | inventory:write |
Gated on the inventory statement (no new role): Pharmacy holds
inventory:read / inventory:write, as do full clinicians (owner / admin / doctor /
member). Reception and Lab have no access. Entries can be deleted to correct the
ledger (the medication itself isn't un-dispensed), but never updated.
The dispense object
| Field | Type | Notes |
|---|---|---|
id | string | Assigned by the server |
fileNumber | string | Patient's file number |
name | string | Required. Patient name |
initials | string | 1–4 characters |
medication | string | Required |
dose | string | e.g. "500 mg" |
quantity | number | Whole units dispensed; defaults to 0 |
unit | string | e.g. "tablets" |
prescriptionId | string | null | Links back to the source prescription |
dispensedBy | string | null | User id of the dispenser (set on the server) |
dispensedByName | string | Dispenser's display name (set on the server) |
dispensedAt | string | ISO timestamp; defaults to now |
notes | string | null | Free text |
The dispenser identity (dispensedBy / dispensedByName) and dispensedAt are filled
from the signed-in user on the server and ignored if sent by the client.
Example
curl -b cookies.txt -X POST http://localhost:4000/api/dispenses \
-H "Content-Type: application/json" \
-d '{
"fileNumber": "1042",
"name": "Hodan Warsame",
"initials": "HW",
"medication": "Amoxicillin",
"dose": "500 mg",
"prescriptionId": "…"
}'GET returns the ledger newest-first. Create returns 201 with the dispense and writes
to the activity log.
curl -b cookies.txt -X DELETE http://localhost:4000/api/dispenses/{id}DELETE returns 204; 404 if the id doesn't exist. Removing a ledger entry is a
correction, also written to the activity log.