Explore documentation

MedicationStatement and Patient Compliance

Recording what medications a patient is taking

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.

What is MedicationStatement?

While MedicationRequest represents an order, MedicationStatement records what a patient is actually taking or has taken. This is important for:

  • Patient-reported medication use
  • Reconciliation during admission or discharge
  • Compliance tracking

Creating a MedicationStatement

REST
curl -X POST https://api.esus.health/fhir/MedicationStatement \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "status": "active",
    "subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "effectiveDateTime": "2026-01-01",
    "dateAsserted": "2026-04-21",
    "informationSource": {
      "reference": "Patient/3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    "medicationCodeableConcept": {
      "coding": [{
        "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
        "code": "197361",
        "display": "Amoxicillin 500mg"
      }]
    },
    "dosage": [{
      "text": "Take 1 capsule 3 times a day",
      "timing": {
        "repeat": { "frequency": 3, "period": 1, "periodUnit": "d" }
      }
    }]
  }'
SDK
const created = await esus.fhir.create("MedicationStatement", {
  "status": "active",
  "subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "effectiveDateTime": "2026-01-01",
  "dateAsserted": "2026-04-21",
  "informationSource": {
    "reference": "Patient/3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "medicationCodeableConcept": {
    "coding": [
      {
        "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
        "code": "197361",
        "display": "Amoxicillin 500mg"
      }
    ]
  },
  "dosage": [
    {
      "text": "Take 1 capsule 3 times a day",
      "timing": {
        "repeat": {
          "frequency": 3,
          "period": 1,
          "periodUnit": "d"
        }
      }
    }
  ]
});
  • subjectId (the patient UUID) is the only required field; status defaults to active.
  • informationSource is a regular FHIR reference because it can point to different resource types (Patient, Practitioner, RelatedPerson, etc.).
  • Also accepted: medicationReference, reasonCode[], note[], and on create only identifier[], basedOn[] / partOf[] (an update ignores them).

The API responds 201 Created with the resource; subjectId comes back as subject: { "reference": "Patient/<uuid>" }.

Status Values

StatusMeaning
activeThe patient is currently taking this medication (default)
completedThe medication course has ended
intendedPlanned but not started
stoppedThe patient stopped taking the medication
on-holdTemporarily not taking
not-takenThe patient is not taking it
entered-in-errorThe record is incorrect
unknownStatus unknown

Medication Reconciliation

On admission, retrieve all active patient medications:

REST
curl "https://api.esus.health/fhir/MedicationStatement?patient=3fa85f64-5717-4562-b3fc-2c963f66afa6&status=active" \
  -H "Authorization: Bearer YOUR_TOKEN"
SDK
const { resources, total } = await esus.fhir.search("MedicationStatement", {
  "patient": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "status": "active"
});

MedicationStatement search supports only patient (exact id) and status (exact code); other parameters are ignored. To filter by medication, do it client-side over the returned Bundle.