Profiles & Operations Index > Medication Dispense Create

Operation: MedicationDispense Submit

The Submit MedicationDispense operation is used to transfer medication records to the DHDR. This encompasses both Create and Update.

Scope

This transaction involves a request by a Point of Service system to transfer a Medication Dispense with contained resources, to the DHDR Solution. The request is received by the DHDR which stores the received record and returns an HTTP response code and an OperationOutcome resource if applicable.

For example, a user at a HIC site records a medication dispense in a Point of Care System. The Point of Care System will extract and assemble the medication dispense record as per the Ontario Digital Health Drug Repository HL7 FHIR Implementation Guide specification and submit it to the DHDR, where it is available for viewing by other DHDR Consumers.

Interaction Diagram

Actor: Client Application

Role: Submits a MedicationDispense record containing at minimum patient, MedicationDispense, Medication and MedicationRequest resources, along with other additional resources that may be populated with data to the DHDR Solution.

Actor: DHDR Solution

Role: Receives and stores MedicationDispense from the Client Application.

Specification

The FHIR DHDR specification is based on the HL7 FHIR R4 Create operation.

MedicationDispense Create Request

The Create Request will create a new MedicationDispense based upon information available from the MedicationDispense source,if one does not already exist in the repository. If there is already an existing MedicationDispense record, the newly submitted version will replace the existing version in the repository.

The MedicationDispense Create Request creates a new resource in a server-assigned location. The create interaction is performed by an HTTP POST command as shown:

POST [base]/[type]{?_format=[mime-type]}

MedicationDispense Create Response

  • OperationOutcome

MedicationDispense Update Request

The Update Request will update an existing MedicationDispense record based upon information available from the MedicationDispense record source.

PUT [base]/[type]/[id] {?_format=[mime-type]}

MedicationDispense Updated Response

  • OperationOutcome

Note:

For new dispenses, MedicationDispense.status should be set to completed.

For reversal of a dispense, MedicationDispense.status should be set to entered-in-error.

Example Create Single Event Message

HTTP Method:

POST

Headers:

Content-Type: application/fhir+json

Address:

[base]/MedicationDispense/

Message Body:


{
  "resourceType": "MedicationDispense",
  "id": "94066C2D3E7D3025E05400144FF9F54ASB",
  "meta": {
    "lastUpdated": "2019-10-03T14:06:20.148-04:00",
    "source": "http://ehealthontario.ca/hns"
  },
  "text": {
    "status": "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Narrative is not implemented in this release</div>"
  },
  "contained": [
    {
      "resourceType": "Medication",
      "id": "Medication94066C2D3E7D3025E05400144FF9F54A",
      "extension": [
        {
          "url": "http://ehealthontario.ca/fhir/StructureDefinition/ca-on-medications-ext-medication-strength",
          "valueString": "5mg"
        }
      ],
      "code": {
        "coding": [
          {
            "system": "https://fhir.infoway-inforoute.ca/CodeSystem/canadianclinicaldrugdataset",
            "code": "02267470",
            "display": "Novo-Bisoprolol"
          }
        ]
      },
...

Example Create Bundle Message

HTTP Method:

POST

Headers:

Content-Type: application/fhir+json

Address:

[base]/Bundle/

Message Body:

{
  "resourceType": "Bundle",
  "id": "3bbb062a-a103-4041-98b1-0f8f46a803sbn",
    "meta": {
    "lastUpdated": "2019-10-03T14:06:20.148-04:00",
    },
  "language": "en",
  "type": "batch",
  "timestamp": "2022-06-20T08:30:49.547-04:00",
  "entry": [
    {
      "fullUrl": "https://provider.pst.ehealthontario.ca/api2/fhir/MedicationDispense/93F05B0FF748525FE05400144FF9F54A",
      "resource": {
        "resourceType": "MedicationDispense",
        "id": "93F05B0FF748525FE05400144FF9F54A",
        "meta": {
          "lastUpdated": "2019-10-02T11:45:17.000-04:00",
          "source": "http://ehealthontario.ca/hns"
        },
        "text": {
          "status": "generated",
          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Narrative is not implemented in this release</div>"
        },
        "contained": [
          {
            "resourceType": "Medication",
            "id": "Medication93F05B0FF748525FE05400144FF9F54A",
      "extension": [
        {
          "url": "http://ehealthontario.ca/fhir/StructureDefinition/ca-on-medications-ext-medication-strength",
          "valueString": "5mg"
        }
      ], 
 ...

Medication Dispense Profiles

Extensions


Expected Behaviour

See Response Handling page for a complete listig of response codes

Operation Validation HTTP Response Code OpOutcome Code OpOutcome Severity OperationOutcome.details.text&OperationOutcome.text
MedicationDispense Create (POST) Missing security token 400 required error Missing required security token: PIN
MedicationDispense Create (POST) Failed authentication 401 security error Authorization is required for the interaction that was attempted
MedicationDispense Create (POST) Rate Limit 429 throttled error Too Many Requests
MedicationDispense Create (POST) Unhandled Exception 500 exception fatal Internal Error
MedicationDispense Create (POST) Accepted 202