Page Status: Outdated

Dispense(es) - Fetch

Page index

Introduction

Sv: Hämta uttag

This section describes the process of fetching dispenses for a patient. The logical id of the patient must be defined as one of the query parameters when fetching dispenses and it is only possible to fetch dispenses for one patient in a request.

The basic approach to achieve this use case is to use HTTP GET on the MedicationDispense resource.

GET [base]/fhir/MedicationDispense

Sequence diagram

This interactions shows a sequence where the client wants fetch all medication dispenses for a patient. These interactions requires a valid authorization token as an initial step, which is not shown in the diagram.

The logical id of the patient or the authorizing prescription must be known before the medication dispenses are fetched. This sequence shows how to fetch the logical id of the patient as a first interaction. The logical id could of course already be known, if this interaction is part of a longer sequence (e.g. medication list of the patient has been fetched previously).

Examples

Header: required authorization and provenance information

Parameter Mandatory Comment
Authorization Yes Bearer [valid OAuth2 token]
X-Access Yes Applicable type, e.g. UTAN_KRAV_SAMTYCKE
X-Purpose Yes Applicable type, e.g. EXPEDIERING
X-Provenance N/A
X-Request-ID Yes UUID
X-User-Agent Yes
X-PatientRef Yes UUID of the patient

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

Example 1 - Fetch all dispenses for a patient

Practitioners with the approproiate access right to a patient medication list, may also access dispatches made in order to get a complete view of current and historical medications the patient may be using. In pharmacies, the dispenses shows a historical view of a patients dispenses made at any pharmacy.

The logical id must be fetched first, if it is not known from a previous interaction. This is shown in step 1 below.

Search-query:

  1. GET basepath/fhir/Patient?identifier=19981116239 Fetches the logical id of the patient.

  2. GET basepath/fhir/MedicationDispense?patient._id=470cec1c-8cd9 Fetches all dispenses made for the patient and the timeframe as stated by Lag om Nationell läkemedelslista.

Result A bundle resource with 0 or several entries, e.g.

{
  "resourceType": "Bundle",
  "id": "c03a893a-03f4-413b",
  "meta": {
    "lastUpdated": "2020-05-01T08:23:31.971+02:00"
  },
  "type": "searchset",
  "total": 1,
  "link": [
    {
      "relation": "self",
      "url": "https://basepath/fhir/MedicationDispense?patient._id=09b27e4a-a02f-4132"
    }
  ],
  "entry": [
    {
    ... //The dispenses

Example 2 - Fetch dispenses for a specific day and patient

Some scenarios may require to check dispense(s) made/handed over a specific day for a patient. Below shows an example of a search query.

The logical id must be fetched first, if it is not known from a previous interaction. This is shown in step 1 below.

Search-query:

  1. GET basepath/fhir/Patient?identifier=19981116239

  2. GET basepath/fhir/MedicationDispense?patient._id=470cec1c-8cd9&whenHandedOver=2020-01-20

Result A bundle resource with 0 or several entries, e.g.

{
  "resourceType": "Bundle",
  "id": "c03a893a-03f4-413b",
  "meta": {
    "lastUpdated": "2020-05-01T08:23:31.971+02:00"
  },
  "type": "searchset",
  "total": 1,
  "link": [
    {
      "relation": "self",
      "url": "https://basepath/fhir/MedicationDispense?patient._id=09b27e4a-a02f-4132"
    }
  ],
  "entry": [
    {
    ... //The dispenses