Examples

Search for a patient's medications

This example demonstrates how to find all medications for a specific patient.
  1. Generate an access token by following the OAuth2 walkthrough
    1. The example below assumes you have been granted an access token of: aaaaa-bbbbb
  2. Confirm the Patient reference of the patient
    1. The example below assumes a reference of: Patient/3d8afd18-0844-459a-b3c2-355d02e54c0a
  3. Make the call as detailed below, replacing the access token and search parameters with your own values
  4. The matching MedicationStatement resources will be returned

Example Request

This example is written for sandbox.patientsknowbest.com; replace the URL as needed if you are connecting to a different environment.

ExampleDetails
Absolute URLhttps://sandbox.patientsknowbest.com/fhir/MedicationStatement?patient=Patient/3d8afd18-0844-459a-b3c2-355d02e54c0a
curlcurl -X GET --header "Accept: application/fhir+json" --header "Authorization: Bearer aaaaa-bbbbb" "https://sandbox.patientsknowbest.com/fhir/MedicationStatement?patient=Patient/3d8afd18-0844-459a-b3c2-355d02e54c0a"

Example Response

Note: whilst every effort has been made to ensure that the examples are correct and useful, they do not form part of the official specification.

{
  "resourceType": "Bundle",
  "id": "1ae6cfdd-652b-4110-8979-8de5c468e4c4",
  "meta": {
    "lastUpdated": "2019-08-27T10:48:35.114+00:00"
  },
  "type": "searchset",
  "total": 1,
  "link": [
    {
      "relation": "self",
      "url": "/MedicationStatement?patient=Patient/3d8afd18-0844-459a-b3c2-355d02e54c0a"
    }
  ],
  "entry": [
    {
      "fullUrl": "https://sandbox.patientsknowbest.com/fhir/MedicationStatement/5b771297-5478-4e00-b845-32c96480b6e6",
      "resource": {
        "resourceType": "MedicationStatement",
        "id": "5b771297-5478-4e00-b845-32c96480b6e6",
        "meta": {
          "lastUpdated": "2019-06-08T19:21:59.797Z",
          "security": [
            {
              "system": "http://fhir.patientsknowbest.com/codesystem/privacy-label",
              "code": "GENERAL_HEALTH"
            }
          ]
        },
        "contained": [
          {
            "resourceType": "Medication",
            "id": "medication-1",
            "code": {
              "coding": [
                {
                  "system": "http://snomed.info/sct",
                  "code": "21109511000001106",
                  "display": "Aspirin 100mg capsules (product)"
                }
              ]
            }
          }
        ],
        "_status": {
            "extension": [
              {
                "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
                "valueCode": "unknown"
              }
            ]
        },
        "medicationReference": {
          "reference": "#medication-1"
        },
        "effectivePeriod": {
            "start": "2019-04-08T00:00:00.000Z",
            "end": "2019-07-08T00:00:00.000Z"
        },
        "subject": {
            "reference": "Patient/3d8afd18-0844-459a-b3c2-355d02e54c0a",
            "display": "Mr Test Patient"
        },
        "taken": "y",
        "dosage": [
          {
            "timing": {
              "repeat": {
                "frequency": 1,
                "period": 12,
                "periodUnit": "h"
              }
            },
            "doseQuantity": {
              "value": 2,
              "unit": "tablet(s)"
            }
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    }
  ]
}
Comments