Page Status: Outdated

Dispense - Create

Page index

Introduction

Sv: användningsfall - Kontrollera utlämnande, Registrera utlämnande.

This section describes the process of supplying a prescription in the form of dispensing a medication product for a named person/patient at a pharmacy.

The basic approach to achieve this use case is to use HTTP POST to create a new MedicationDispense resource and to refer to the MedicationRequest from which a dispatch is being made, in the attribute authorizingPrescription. Note that authorizingprescription must include the version of the medication request. That is done by using the /_history/ suffix.

POST [base]/fhir/MedicationDispense

Sequence diagram

This interactions shows a sequence where the client creates a dispatch (sv: uttag) based on a medication request. It shows a sequence when one dispense only is created. If several dispenses should be included in a dispatch (sv: flera uttag i en expediering) the last request is instead based on the Bundle resource, including several MedicationDispense resources. The interaction requires a valid authorization token as an initial step, which is not shown in the diagram.

Note that the requests shown in the diagram doesn't include the full basepath. It only shows the last part of the http request including resource and possible search/query parameters.

Examples

HTTP Header

Required authorization and provenance information.

TODO

Parameter Mandatory Comment
Authorization
X-Access
X-Purpose
X-Provenance
X-Request-ID
X-User-Agent
X-OrgInfo
X-PatientRef

This is an example of access and purpose type. The type must reflect the given situation. A full list of access and purpose types will be enclosed in the developer portal [Confluence, EHM][1].

See HTTP Header and Authorization for generic information about the HTTP header.

One dispatch for one prescription

This example shows how to create one dispatch for one prescription (MedicationRequest). A presumption is that the Patient and the correct MedicationRequest has been fetched before, since the logical id for these resources must be known.

Header: required authorization and provenance information

Parameter Mandatory Comment
Authorization Yes Bearer [valid OAuth2 token]
X-Access N/A -
X-Purpose N/A -
X-Provenance Yes Must be provided with information as described below
activity.coding.code : EXPEDIERA
agent.type : enterer Create dispense only supports enterer, not author (sv: uppdragsgivare).
agent.who : NLLPractitioner At least name, identifier, workplaceIdentifier must be defined. Make sure that the individual is the same as in the authorization ticket.

An example of a full provenance json structure can be seen in General information about Use Cases

{
  "resourceType": "MedicationDispense",
  "meta": {
    "versionId": "1",
    "profile": [
      "http://electronichealth.se/fhir/StructureDefinition/NLLMedicationDispense"
    ]
  },
  "contained": [
    {
      "resourceType": "Practitioner",
      "id": "6928943b-4dc8-42b5-85f7-90f27dadd2c4",
      "meta": {
        "profile": [
          "http://electronichealth.se/fhir/StructureDefinition/NLLPractitioner"
        ]
      },
      "extension": [
        {
          "url": "http://electronichealth.se/fhir/StructureDefinition/NLLWorkplaceName",
          "valueString": "7350045511999"
        },
        {
          "extension": [
            {
              "url": "http://electronichealth.se/fhir/StructureDefinition/NLLWorkplaceSummary#gln",
              "valueCoding": {
                "system": "http://electronichealth.se/identifier/gln",
                "code": "7350045511997"
              }
            }
          ],
          "url": "http://electronichealth.se/fhir/StructureDefinition/NLLWorkplaceSummary"
        }
      ],
      "identifier": [
        {
          "system": "http://electronichealth.se/identifier/legitimationskod",
          "value": "920007"
        },
        {
          "system": "http://electronichealth.se/identifier/personnummer",
          "value": "19999999"
        },
        {
          "system": "http://electronichealth.se/identifier/anvandarid",
          "value": "2"
        }
      ],
      "name": [
        {
          "family": "Apotekarsson",
          "given": [
            "Bo"
          ]
        }
      ],
      "telecom": [
        {
          "extension": [
            {
              "url": "http://electronichealth.se/fhir/StructureDefinition/NLLContactPointType",
              "valueCode": "P"
            },
            {
              "url": "http://electronichealth.se/fhir/StructureDefinition/NLLAvailableToPatient",
              "valueBoolean": false
            }
          ],
          "value": "011",
          "rank": 1
        }
      ],
      "address": [
        {
          "extension": [
            {
              "url": "http://electronichealth.se/fhir/StructureDefinition/NLLAvailableToPatient",
              "valueBoolean": false
            }
          ],
          "type": "postal",
          "line": [
            "line"
          ]
        }
      ],
      "qualification": [
        {
          "code": {
            "coding": [
              {
                "system": "http://electronichealth.se/fhir/ValueSet/profession-code",
                "code": "AP"
              }
            ]
          }
        }
      ]
    }
  ],
  "extension": [
    {
      "url": "http://electronichealth.se/fhir/StructureDefinition/NLLActorDispatchId",
      "valueString": "1"
    },
    {
      "url": "http://electronichealth.se/fhir/StructureDefinition/NLLNumberOfPackagesDispensed",
      "valuePositiveInt": 1
    },
    {
      "url": "http://electronichealth.se/fhir/StructureDefinition/NLLBenefitChoiceCode",
      "valueCoding": {
        "system": "http://ehalsomyndigheten.se/fhir/ValueSet/benefit-choice-codes",
        "code": "U"
      }
    }
  ],
  "status": "completed",
  "medicationCodeableConcept": {
    "coding": [
      {
        "system": "http://medication.ehm.se/nplid",
        "code": "19851206000039"
      },
      {
        "system": "http://medication.ehm.se/nplpackid",
        "code": "10010101108564"
      }
    ]
  },
  "performer": [
    {
      "actor": {
        "reference": "#6928943b-4dc8-42b5-85f7-90f27dadd2c4"
      }
    }
  ],
  "authorizingPrescription": [
    {
      "reference": "MedicationRequest/2f227c87-2737-4017-b000-c250d1b85dc7/_history/1"
    }
  ],
  "whenHandedOver": "2020-04-28T13:47:36.974709Z",
  "note": [
    {
      "text": "My note"
    }
  ],
  "substitution": {
    "wasSubstituted": false
  }
}

Multiple dispatches belonging to the same dispatch id

This example shows how to create multiple dispatches, which all belongs to the same dispatch id (sv: expediering). A presumption is that the Patient and the correct MedicationRequest has been fetched before, since the logical id for these resources must be known.

This payload is sent by POST to the root endpoint, ie [base]/fhir.

It's important to use transaction as the type. Also notice the request attribute:

"request": {
  "method": "POST",
  "url": "MedicationDispense"
}

Header: required authorization and provenance information

Parameter Mandatory Comment
Authorization Yes Bearer [valid OAuth2 token]
X-Access N/A -
X-Purpose N/A -
X-Provenance Yes Must be provided with information as described below
activity.coding.code : EXPEDIERA
agent.type : enterer Create dispense only supports enterer, not author (sv: uppdragsgivare).
agent.who : NLLPractitioner At least name, identifier, workplaceIdentifier must be defined. Make sure that the individual is the same as in the authorization ticket.

An example of a full provenance json structure can be seen in General information about Use Cases

{
  "resourceType": "Bundle",
  "id": "553d4940-8a8e-4b4c-99cd-eba76de05210",
  "meta": {
    "profile": [
      "http://electronichealth.se/fhir/StructureDefinition/NLLDispatch"
    ]
  },
  "type": "transaction",
  "entry": [
    {
      "resource": {
        "resourceType": "MedicationDispense",
        "meta": {
          "versionId": "1",
          "profile": [
            "http://electronichealth.se/fhir/StructureDefinition/NLLMedicationDispense"
          ]
        },
        "extension": [
          {
            "url": "http://electronichealth.se/fhir/StructureDefinition/NLLActorDispatchId",
            "valueString": "1"
          },
          {
            "url": "http://electronichealth.se/fhir/StructureDefinition/NLLNumberOfPackagesDispensed",
            "valuePositiveInt": 1
          },
          {
            "url": "http://electronichealth.se/fhir/StructureDefinition/NLLBenefitChoiceCode",
            "valueCoding": {
              "system": "http://ehalsomyndigheten.se/fhir/ValueSet/benefit-choice-codes",
              "code": "U"
            }
          }
        ],
        "status": "completed",
        "medicationCodeableConcept": {
          "coding": [
            {
              "system": "http://medication.ehm.se/nplid",
              "code": "19851206000039"
            },
            {
              "system": "http://medication.ehm.se/nplpackid",
              "code": "10010101108564"
            }
          ]
        },
        "authorizingPrescription": [
          {
            "reference": "MedicationRequest/2f227c87-2737-4017-b000-c250d1b85dc7/_history/1"
          }
        ],
        "whenHandedOver": "2020-04-29T08:20:41.529667Z",
        "note": [
          {
            "text": "My note"
          }
        ],
        "substitution": {
          "wasSubstituted": false
        }
      },
      "request": {
        "method": "POST",
        "url": "MedicationDispense"
      }
    },
    {
      "resource": {
        "resourceType": "MedicationDispense",
        "meta": {
          "versionId": "1",
          "profile": [
            "http://electronichealth.se/fhir/StructureDefinition/NLLMedicationDispense"
          ]
        },
        "extension": [
          {
            "url": "http://electronichealth.se/fhir/StructureDefinition/NLLActorDispatchId",
            "valueString": "1"
          },
          {
            "url": "http://electronichealth.se/fhir/StructureDefinition/NLLNumberOfPackagesDispensed",
            "valuePositiveInt": 1
          },
          {
            "url": "http://electronichealth.se/fhir/StructureDefinition/NLLBenefitChoiceCode",
            "valueCoding": {
              "system": "http://ehalsomyndigheten.se/fhir/ValueSet/benefit-choice-codes",
              "code": "U"
            }
          }
        ],
        "status": "completed",
        "medicationCodeableConcept": {
          "coding": [
            {
              "system": "http://medication.ehm.se/nplid",
              "code": "19851206000039"
            },
            {
              "system": "http://medication.ehm.se/nplpackid",
              "code": "10010101108564"
            }
          ]
        },
        "authorizingPrescription": [
          {
            "reference": "MedicationRequest/2f227c87-2737-4017-b000-c250d1b85dc7/_history/1"
          }
        ],
        "whenHandedOver": "2020-04-29T08:20:41.529667Z",
        "note": [
          {
            "text": "My note"
          }
        ],
        "substitution": {
          "wasSubstituted": false
        }
      },
      "request": {
        "method": "POST",
        "url": "MedicationDispense"
      }
    }
  ]
}