MedicationRequest Resource

Introduction

Populating the FHIR MedicationRequest Resource 

Shown below is how attributes of the FHIR MedicationRequest Resource map to the attributes of the OpenMRS Drug Order object. The left side of the relationship indicates the OpenMRS attribute; the right indicates the FHIR MedicationRequest resource mapping.

DrugOrder
Double dose :: MedicationRequest.dosageInstruction.dosage[0].dose
Concept doseUnits :: MedicationRequest.dosageInstruction.dosage[0].doseUnits
OrderFrequency frequency :: MedicationRequest.dosageInstruction.dosage[0].timing
Boolean asNeeded  :: not mapped
Double quantity :: MedicationRequest.dispenseRequest.quantity
Concept quantityUnits :: MedicationRequest.dispenseRequest.quantityUnits
Drug drug :: MedicationRequest.medication
String asNeededCondition  :: not mapped
Class<? extends DosingInstructions> dosingType  :: not mapped
private Integer numRefills  :: not mapped
String dosingInstructions :: MedicationRequest.dosageInstruction.dosage[0].text
Integer duration :: MedicationRequest.dispenseRequest.duration
Concept durationUnits :: MedicationRequest.dispenseRequest.durationUnits
Concept route ::  MedicationRequest.dosageInstruction.dosage[0].route
String brandName  :: not mapped
Boolean dispenseAsWritten  :: not mapped
String drugNonCoded  :: not mapped
Integer orderId  :: not mapped
Patient patient	:: MedicationRequest.subject
OrderType orderType  :: not mapped
Concept concept :: not mapped
String instructions :: not mapped
Date dateActivated :: MedicationRequest.authoredOn
Date autoExpireDate  :: not mapped
Encounter encounter :: MedicationRequest.context
Provider orderer :: MedicationRequest.requester
Date dateStopped  :: not mapped
Concept orderReason  :: not mapped
String accessionNumber  :: not mapped
String orderReasonNonCoded  :: not mapped
Urgency urgency :: MedicationRequest.priority
String orderNumber  :: not mapped
String commentToFulfiller  :: not mapped
CareSetting careSetting  :: not mapped
Date scheduledDate  :: not mapped

Example FHIR MedicationRequest Resource

Shown below is a fleshed out FHIR MedicationRequest Resource.

FHIR MedicationRequest Resource
{  
   "resourceType":"MedicationRequest",
   "id":"56b9196c-bcac-4c2f-b3a2–123464a96439",
   "status":"stopped",
   "intent":"order",
   "priority":"routine",
   "medicationCodeableConcept":{  
      "id":"865fceb1-ad0c-4102-aead-26ca25c77b09",
      "coding":[  
         {  
            "system":"http://openmrs.org",
            "code":"cedf8fc4–6fc9–11e7–9b2b-c4d98716fd91",
            "display":"Cetirizine"
         }
      ]
   },
   "subject":{  
      "id":"cf14c415–6fc9–11e7–9b2b-c4d98716fd91",
      "reference":"Patient/cf14c415–6fc9–11e7–9b2b-c4d98716fd91",
      "display":"John Patient(Identifier:100      )"
   },
   "context":{  
      "id":"3fcd2047–2aca-404f-ab9d-0d009265d4dd",
      "reference":"Encounter/3fcd2047–2aca-404f-ab9d-0d009265d4dd"
   },
   "authoredOn":"2008–10–19T09:24:10+05:30   ",
   "requester":{  
      "agent":{  
         "id":"b3d97e25–274e-4ed6-b1aa-18848505c33e",
         "reference":"Practitioner/b3d97e25–274e-4ed6-b1aa-18848505c33e",
         "display":"Super User(Identifier:Test)"
      }
   },
   "recorder":{  
      "id":"b3d97e25–274e-4ed6-b1aa-18848505c33e",
      "reference":"Practitioner/b3d97e25–274e-4ed6-b1aa-18848505c33e",
      "display":      "Horatio L Hornblower(Identifier:Test)"
   },
   "dosageInstruction":[  
      {  
         "sequence":1,
         "timing":{  
            "code":{  
               "coding":[  
                  {  
                     "system":"http://openmrs.org",
                     "code":"ae984cea-24cb-4e1e-abdd-fd19c9802704",
                     "display":"1/day x 7 days/week"
                  }
               ],
               "text":"1/day x 7 days/week"
            }
         },
         "route":{  
            "id":"cee0f244–6fc9–11e7–9b2b-c4d98716fd91",
            "coding":[  
               {  
                  "system":"http://openmrs.org",
                  "code":"cee0f244–6fc9–11e7–9b2b-c4d98716fd91",
                  "display":"UNKNOWN"
               }
            ],
            "text":"UNKNOWN"
         },
         "doseQuantity":{  
            "value":3.0,
            "unit":"mg"
         }
      }
   ],
   "dispenseRequest":{  
      "quantity":{  
         "value":1.0,
         "unit":"tab (s)"
      }
   }
}

Available RESTful web services for the MedicationRequest Resource supported by the API

GET Requests

Read
urldescription
/ws/fhir/MedicationRequest/{id}

Returns a FHIR MedicationRequest resource identified by a MedicationRequest UUID

Outcomes:

  • Returns a FHIR MedicationRequest resource if the specified DrugOrder exists
  • Returns an Operation Outcome resource with a 404 error message if the specified MedicationRequest does not exist
Search
/ws/fhir/MedicationRequest?_id={id}Returns a list of FHIR MedicationRequest resources identified by a MedicationRequest UUID

POST Requests

Create
UrlDescription
/ws/fhir/MedicationRequest

Create a MedicationRequest Resource for the given representation

PUT Requests

Update
UrlDescription
/ws/fhir/MedicationRequest/{id}
  • If the MedicationRequest with the given uuid exists, update the existing attributes according to the representation.
  • If the MedicationRequest with the given uuid doesn't exists, Create a MedicationRequest Resource with the given uuid.

Given below is a JSON body that will update attributes of an MedicationRequest Resource.

JSON Representation of a MedicationRequest
{  
   "resourceType":"MedicationRequest",
   "id":"56b9196c-bcac-4c2f-b3a2–123464a96439",
   "status":"stopped",
   "intent":"order",
   "priority":"routine",
   "medicationCodeableConcept":{  
      "id":"865fceb1-ad0c-4102-aead-26ca25c77b09",
      "coding":[  
         {  
            "system":            "http://openmrs.org",
            "code":"cedf8fc4–6fc9–11e7–9b2b-c4d98716fd91",
            "display":"Cetirizine"
         }
      ]
   },
   "subject":{  
      "id":"cf14c415–6fc9–11e7–9b2b-c4d98716fd91",
      "reference":"Patient/cf14c415–6fc9–11e7–9b2b-c4d98716fd91",
      "display":      "John Patient(Identifier:100      )"
   },
   "context":{  
      "id":"3fcd2047–2aca-404f-ab9d-0d009265d4dd",
      "reference":"Encounter/3fcd2047–2aca-404f-ab9d-0d009265d4dd"
   },
   "authoredOn":   "2008–10–19T09:24:10+05:30   ",
   "requester":{  
      "agent":{  
         "id":"b3d97e25–274e-4ed6-b1aa-18848505c33e",
         "reference":"Practitioner/b3d97e25–274e-4ed6-b1aa-18848505c33e",
         "display":         "Super User(Identifier:Test)"
      }
   },
   "recorder":{  
      "id":"b3d97e25–274e-4ed6-b1aa-18848505c33e",
      "reference":"Practitioner/b3d97e25–274e-4ed6-b1aa-18848505c33e",
      "display":      "Horatio L Hornblower(Identifier:Test)"
   },
   "dosageInstruction":[  
      {  
         "sequence":1,
         "timing":{  
            "code":{  
               "coding":[  
                  {  
                     "system":                     "http://openmrs.org",
                     "code":"ae984cea-24cb-4e1e-abdd-fd19c9802704",
                     "display":"1/day x 7 days/week"
                  }
               ],
               "text":"1/day x 7 days/week"
            }
         },
         "route":{  
            "id":"cee0f244–6fc9–11e7–9b2b-c4d98716fd91",
            "coding":[  
               {  
                  "system":                  "http://openmrs.org",
                  "code":"cee0f244–6fc9–11e7–9b2b-c4d98716fd91",
                  "display":"UNKNOWN"
               }
            ],
            "text":"UNKNOWN"
         },
         "doseQuantity":{  
            "value":3.0,
            "unit":"mg"
         }
      }
   ],
   "dispenseRequest":{  
      "quantity":{  
         "value":1.0,
         "unit":"tab (s)"
      }
   }
}


DELETE (Delete Requests)

Operations
URLDescription
/ws/fhir/MedicationRequest/{id}

If the MedicationRequest with given id exists, makes it void and responds with 203.

If the MedicationRequest already voided, does nothing and responds with 203.

If API refuses to void the MedicationRequest, responds with 405

If MedicationRequest with given id is not found, responds with 404.