Page Status: updated 2022-06-17

Prescriptions - Fetch

Page index

Introduction

This page describes the process of fetching MedicationRequests for a patient by a few examples.

Note that a MedicationRequest may have a data lock on some information (sv: spärrad information) for certain roles. Some information in the response is excluded in such cases. It is also possible, for a patient or practitioner, to lock a full MedicationRequest instance for certain roles, meaning that the instance is excluded from the response when a read is initiated by such a roles.

Feching prescriptions can be done in many different ways. See MedicationRequest query operations for more information about all options.

In short a query request is either a read, i.e. fetching by the resource ID, or a search, i.e. using search parameters. The result differs between a read and a search. A search alwayes results in a bundle unless there is a system error. The bundle will contain a list of the requested resourse or an empty bundle if no resource matched the search criteria. A read will eighter return the requested resource or an error if the requested resource ID didn't exists.

GET [base]/MedicationRequest/[id]
GET [base]/MedicationRequest?[search parameters]

A set of HTTP headers must be provided in order to fetch a prescription. See HTTP Header and Authorization for more information about the various headers used by the Swedish National Medication List.

See MedicationRequest for more information about the MedicationRequest resource.

Before a prescription can be fetched other information is needed in many cases, the patient info, consents, etc. In order to do so the calling system must communicate with many different FHIR resources. As the national medication list is largely based on structured information, this also includes retrieving a large amount of value sets in order to be able to translate codes into display texts.

For more information about different scenarios and what information is required for each scenario see Handbok för vård- och apotekstjänster: Verksamhetsområden.

Examples

HTTP Headers

See HTTP Header and Authorization for generic information about all HTTP headers used by the Swedish National Medication List including information about authorization, purpose and access type. The authorization token is translated to an authority role. The authority role together with the purpose and type of access is used by the national medication list to determine what actions a user may perform and what information the user may access.

Header Comment
authorization The users's security token
prefer Type of returned content when creating or updating a resource is mandatory when creating or updating a prescription
x-access The cause for the call is not needed when creating or updating a resource
x-org-info Information about the users's organisation
x-patientref The logical ID of the patient is not needed when creating a resource
x-provenance A provenance resource with information about the user interacting with NLL
x-purpose The purpose of the call is not needed when creating or updating a resource
x-request-id A random and unique ID in each request
x-user-agent Information about the caller

Example 1 - Fetch prescription for a patient with an identification number

This example shows a prescription created by a healtcare provider (Create prescription as a healthcare provider) for a patient having a personal identification number (sv. personnummer). The request is made by a healthcare professional.

The request is made as a read by the logical id. GET [base]/MedicationRequest/1f4b3dc7-e0ca-4783-9ba2-8137c0a1967f

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access TILLFALLIGT_SAMTYCKE
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref 722c3e2f-52bb-458f-af46-aa22466f478c
x-provenance
x-purpose VARD
x-request-id fcc5ed38-43bf-4bbd-8fc5-ad403e0bb9aa
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest as a healthcare provider

Example 2 - Fetch prescription created by a pharmacy

This example shows a prescription created by a pharmacy (Create prescription as a pharmacy) for a patient having a personal identification number (sv. personnummer). The request is made by a healthcare professional.

The request is made as a read by the logical id. GET [base]/MedicationRequest/9c25b201-bbf7-406b-a791-37a20b241e3a

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access TILLFALLIGT_SAMTYCKE
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref 722c3e2f-52bb-458f-af46-aa22466f478c
x-provenance
x-purpose VARD
x-request-id 66696a28-f950-4243-a21c-0d1a4bf34922
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest created by a pharmacy

Example 3 - Fetch prescription for a patient without identification number

This example shows a prescription with a patient lacking identification number (sv. personnummer) (Create prescription for a patient on birthdate). The request is made by a pharmacy staff.

The request is made as a read by the logical id. GET [base]/MedicationRequest/85ddc225-3d1d-4c03-9b7b-886e77f8b74b

HTTP headers

Header Value Comment
authorization {...,"APOTEKSID":"7350046611966","LEGITIMATIONSKOD":"920007","YRKESKOD":["AP"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access TILLFALLIGT_SAMTYCKE_BEHANDLINGSORSAK
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref
x-provenance
x-purpose EXPEDIERING
x-request-id 87a60b43-fb52-41b4-b793-66cdad878188
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest without a national identity number

Example 4 - Fetch prescription of medical consumables

This example shows a prescription of a medical consumable (Create prescription of medical consumables). The request is made by a healthcare professional.

The request is made as a read by the logical id. GET [base]/MedicationRequest/3a4fcef3-57b9-476a-a419-b96ed790e3f7

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access UTAN_KRAV_SAMTYCKE_BARN
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref cefe1521-d4dc-48bc-be51-52a12b9697ef
x-provenance
x-purpose VARD
x-request-id f26e514a-f550-4f1c-a1d0-f660ace5e13c
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest for medical consumables

Example 5 - Fetch prescription for a patient having a multi-dose dispensing consent

This example shows a prescription of multi-dose dispensing to a patient who has a multi-dose dispensing consent (Create prescription for a patient having a multi-dose dispensing consent). The request is made by a healthcare professional.

The request is made as a read by the logical id. GET [base]/MedicationRequest/eaea2586-e672-4d14-9a72-99ae05fb6df0

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access TILLFALLIGT_SAMTYCKE
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref 722c3e2f-52bb-458f-af46-aa22466f478c
x-provenance
x-purpose VARD
x-request-id 9cc4f881-4e06-4999-a299-4da93e9126f1
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest for multi dose dispensing

Example 6 - Fetch prescriptions by a search

This example shows the result of a search for prescriptions related to a patient. The request is made by a healthcare professional.

The request is made as a search by the logical id of the patient. GET [base]/MedicationRequest?patient._id=722c3e2f-52bb-458f-af46-aa22466f478c

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access TILLFALLIGT_SAMTYCKE
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref 722c3e2f-52bb-458f-af46-aa22466f478c
x-provenance
x-purpose VARD
x-request-id bb82ee7e-c90b-42c4-b58c-d4f3f0e17814
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest by a search