Explore documentation

MedicationAdministration Tracking

Recording when medications are actually administered

Set up the SDK server client to run the examples using esus. The REST examples use a session token. To run them with the SDK’s API key, send X-API-Key instead of Authorization.

Purpose of MedicationAdministration

MedicationAdministration documents that a medication was administered to a patient. This is crucial for:

  • Hospital medication tracking
  • Verifying order compliance
  • Clinical documentation

Creating an Administration Record

REST
curl -X POST https://api.esus.health/fhir/MedicationAdministration \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "status": "completed",
    "medicationCodeableConcept": {
      "coding": [{
        "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
        "code": "308182",
        "display": "Ibuprofen 400mg"
      }]
    },
    "subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "requestId": "c1a2e3d4-5b6f-7890-abcd-ef1234567890",
    "effectiveDateTime": "2026-04-21T14:30:00Z",
    "performer": [{
      "actor": {
        "reference": "Practitioner/a7b1c2d3-e4f5-6789-abcd-ef0123456789"
      }
    }],
    "dosage": {
      "text": "400mg by mouth once",
      "dose": { "value": 400, "unit": "mg" }
    }
  }'
SDK
const created = await esus.fhir.create("MedicationAdministration", {
  "status": "completed",
  "medicationCodeableConcept": {
    "coding": [
      {
        "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
        "code": "308182",
        "display": "Ibuprofen 400mg"
      }
    ]
  },
  "subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "requestId": "c1a2e3d4-5b6f-7890-abcd-ef1234567890",
  "effectiveDateTime": "2026-04-21T14:30:00Z",
  "performer": [
    {
      "actor": {
        "reference": "Practitioner/a7b1c2d3-e4f5-6789-abcd-ef0123456789"
      }
    }
  ],
  "dosage": {
    "text": "400mg by mouth once",
    "dose": {
      "value": 400,
      "unit": "mg"
    }
  }
});

Notes:

  • subjectId (required) is the patient UUID; status defaults to completed.
  • requestId links the administration to the originating MedicationRequest (UUID); it comes back as request: { "reference": "MedicationRequest/<uuid>" } and is what the request search parameter matches.
  • The medication goes in medicationCodeableConcept or medicationReference and comes back in the same field it was sent in. The medication search matches either one.
  • Also accepted: encounterId, identifier[], reasonCode[], note[]. Other MedicationAdministration fields (partOf, statusReason, category, supportingInformation, effectivePeriod, reasonReference, device, eventHistory) are not part of the contract and are not stored.
  • performer[] uses the standard FHIR shape: { "actor": { "reference": "Type/<uuid>" } }.
  • In FHIR R4, dosage here is a single object (not an array) and the amount goes in dosage.dose.
  • MedicationAdministration has no intent field — it records an event, not an order.

Status Values

StatusMeaning
in-progressAdministration is under way
completedAdministered (default)
not-doneNot administered
on-holdPaused
stoppedStopped before completion
entered-in-errorRecorded in error
unknownStatus unknown

Any other value (for example cancelled) is rejected with 422. When a dose was not given (patient refused, medication unavailable), record it as not-done and explain why in note[].

Searching Administrations

Find all administrations for a patient on a given date:

REST
curl "https://api.esus.health/fhir/MedicationAdministration?patient=3fa85f64-5717-4562-b3fc-2c963f66afa6&effective-time=2026-04-21" \
  -H "Authorization: Bearer YOUR_TOKEN"
SDK
const { resources, total } = await esus.fhir.search("MedicationAdministration", {
  "patient": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "effective-time": "2026-04-21"
});
ParameterMatching
patient, encounterExact id
statusExact code
effective-timeDate (YYYY-MM-DD); without a prefix it matches the whole day. Supports gt, ge, lt, le and ne. Repeat it for a range (effective-time=ge2026-04-01&effective-time=lt2026-05-01)
medicationPartial text match on medicationCodeableConcept or medicationReference (code or display)
requestPartial match on the MedicationRequest reference (<uuid> or MedicationRequest/<uuid>)