MedicationRequest is a FHIR Resource that describes an order or request for both supply of the medication and the instructions for administration of the medication to a patient.
Accessing a patient's medications can aid in workflows such as:
- Working with the patient to ensure adherence to the medication protocol
- Understanding a patient’s current medications to prevent drug-to-drug interactions
- Advising the patient switch to generic medications to reduce overall out-of-pocket cost
Medications are represented in patient access APIs as a FHIR Resource of type MedicationRequest. You can make HTTP
requests to to search for and find medications prescribed to a particular patient. Patients authorize your
app to access their medications via Flexpa API. At the end of that flow you'll have: Flexpa Link
- An access token that is required for all requests to Flexpa API
- A patient ID that is required to query FHIR resources directly related to the patient
Searching for a patient's medications
Searches on follow the RESTful style of the FHIR specification by submitting a GET HTTP request to the base URL of the resource.
To search for coverage belonging to a particular patient, you can use an API Flexpa APIwildcard parameter:
$PATIENT_ID. Flexpa swaps this out for the real patient ID before we send the request to the right FHIR API.
You can retrieve the patient ID by either:
curl "https://api.flexpa.com/fhir/MedicationRequest?patient=$PATIENT_ID" \
-H "Authorization: $ACCESS_TOKEN"
The return type of querying the medication request endpoint is a searchset
bundle. Technically, a searchset bundle may contain different types of resources
(e.g., Coverage, Patient) in the
entry field. When iterating through
entry it is best practice to inspect each
to ensure you are dealing with the expected resource.
A MedicationRequest response contains many fields. You can get an exhaustive list and explanation of each field here. Some notable fields:
entry - A collection of MedicationRequests (see response type on best practice of checking
meta.lastUpdated - An ISO8601 string representing the last time the bundle was modified
entry[i].resource.status - A string representing the status of the MedicationRequest, including:
completed. Medications currently prescribed have
entry[i].resource.medicationCodeableConcept - A coded representation of the medication that the patient was prescribed. Typically this is an NDC and textual name for the medication.
entry[i].resource.authoredOn - The date when the medication was prescribed to the patient
entry[i].resource.dosageInstruction - Information about how the medication should be taken