Medications
Understanding FHIR Medications
Learn how FHIR handles medication-related resources and workflows
Introduction
Medications are central to most healthcare encounters. FHIR provides several resources to represent different aspects of medication management, from ordering to administration tracking.
Key Medication Resources
| Resource | Purpose | Base path |
|---|---|---|
| Medication | Definition of a medication product (code, form, ingredients, batch) | /fhir/Medication |
| MedicationRequest | An order or prescription for a medication | /fhir/MedicationRequest |
| MedicationStatement | A record of medication a patient is taking or has taken | /fhir/MedicationStatement |
| MedicationAdministration | Documentation of medication administered to a patient | /fhir/MedicationAdministration |
| MedicationDispense | Medication prepared and handed out by a pharmacy | /fhir/MedicationDispense |
| MedicationKnowledge | Reference/catalog information about a medication | /fhir/MedicationKnowledge |
Every one of these resources exposes the same REST interactions:
| Method | Path | Result |
|---|---|---|
GET | /fhir/<Resource>?... | Search → 200 Bundle (_count + _offset, link.next) |
GET | /fhir/<Resource>/<id> | Read → 200 |
GET | /fhir/<Resource>/<id>/_history and /_history/<vid> | Version history / a specific version |
POST | /fhir/<Resource> | Create → 201 |
PUT | /fhir/<Resource>/<id> | Update (omitted fields are kept) → 200 + ETag: W/"n" |
PATCH | /fhir/<Resource>/<id> | Partial object, application/json-patch+json or application/merge-patch+json → 200 |
DELETE | /fhir/<Resource>/<id> | Delete → 204 |
PUT and PATCH honor If-Match: W/"n"; a stale version returns 412. _include / _revinclude are not supported: they are accepted and ignored, so fetch the referenced resources with their own search.
API Conventions for Medication Resources
Esus accepts the primary references of these resources as flat string id fields in the request body:
| Reference in FHIR | Body field in Esus | Used by |
|---|---|---|
subject: { reference: "Patient/<id>" } | subjectId: "<uuid>" (required) | MedicationRequest, MedicationStatement, MedicationAdministration, MedicationDispense |
encounter: { reference: "Encounter/<id>" } | encounterId: "<uuid>" | MedicationRequest, MedicationAdministration, MedicationDispense |
requester: { reference: "Practitioner/<id>" } | requesterId: "<uuid>" | MedicationRequest |
request: { reference: "MedicationRequest/<id>" } | requestId: "<uuid>" | MedicationAdministration |
location: { reference: "Location/<id>" } | locationId: "<uuid>" | MedicationDispense |
Responses serialize them back as standard FHIR references. Other references (performer[], authorizingPrescription[], informationSource, etc.) use the normal { "reference": "Type/<uuid>" } shape. If a flat id points to a Patient, Encounter, Practitioner or Location that does not exist in your organization, the API returns 400 with an OperationOutcome.
MedicationRequest Structure
The MedicationRequest is the most commonly used resource for prescribing:
{
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [{
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "197361",
"display": "Amoxicillin 500mg"
}]
},
"subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"requesterId": "a7b1c2d3-e4f5-6789-abcd-ef0123456789"
}
Important Fields
- intent (required): use a FHIR code —
proposal,plan,order,original-order,reflex-order,filler-order,instance-order,option. The API stores the value as given, so stick to these codes. - subjectId (required): the patient UUID.
- status (optional, defaults to
active):active,on-hold,completed,cancelled,stopped,draft,entered-in-error,unknown. - medicationCodeableConcept or medicationReference: the medication (RxNorm codes are a common choice).
- dosageInstruction: how and when to take the medication.
Next Steps
The next pages cover each medication resource in detail with end-to-end API examples.