Page Status: updated 2024-06-04

Resources

Page index

Introduction

FHIR is based on "Resources" which are the common building blocks for all exchanges. Resources are an instance-level representation of some kind of healthcare entity.

This section of the implementation guide lists the resources used by Swedish National Medication List and the common rules used when profiling those resources.

General rules for all resources

Profiles

The FHIR specification describes a set of base resources, frameworks and APIs that are used in many different contexts within healthcare. The FHIR specification is a "platform specification" - it creates a common platform, or foundation, on which a variety of different solutions are implemented. As a consequence, this specification usually requires further adaptation to particular contexts of use. For this reason FHIR includes the possibility to create profiles. A profile is a structure definition with constraints on the resource it represents, i.e. a profile is a description of an implementation of a resource in a specific context.

It is possible to include a reference to one or more profiles in a resource by the element meta.profile. This information is not used by the Swedish National Medication List to interpret incoming data. The rules that apply (as specified by a profile, use case documentation e.t.c.) for a specific scenario is alwayes based on the real data. For example the difference between a medication dispense (NLLMedicationDisoense) and a paper prescription dispense (NLLDispensePaperPrescription) is determinded by the element authorizingPrescription. The meta.profile element is usually included in a response from the Swedish National Medication List but the content will not reflect all possible profiles matching the returned data.

"Must support" property

The general approach of customizing FHIR resources for the Swedish National Medication List has been to mark elements that are used within a resource with the FHIR must mupport flag rather than excluding elements by cardinality, i.e. 0..0, to facilitate interoperability.

The must-support flag indicates that the element is expected in some use cases, and a missing flag that the element is never used. However there may be exceptions to the second rule for non essential data, e.g the element meta.profile.

Data sent to the Swedish National Medication List in elements not marked as must-support are usually ignored.

Cardinality

FHIR generally supports a cardinality of 'zero to many' in a majority of the elements. This is in order to have a flexible structure to cater for different scenarios.

In the profiles, the cardinalities of the used elements (marked with 'must support') is narrowed to support the use cases in which the element is used. This menas that the cardinality defined in a profile in some cases is more open than the actual use case allows. To reflect the actual limitations, see the use case documentation (sv. tillämpningsanvisning).

Identifiers

All resources have a logical identifier. The logical identifier is assigned by the server and is unique on that server. A resource can be fetched by referring to its logical id in the form [base]/[resource-type]/[id] e.g. [base]/MedicationRequest/123 where 123 is the logical id. Most resources in the Swedish National Medication List use an UUID as logical id. A logical id should never change after it has been assigned to a resource, though there may be exceptions to that rule in some special cases. Se more information about the id element in the section references.

Resources can also have a business identifiers. A business identifier is a well known inter system identifier like a personal identification number, organization number, GLN ID etc. It is in many cases possible to perform search operations on business identifiers, e.g. GET [base]/Patient?identifier=http://electronichealth.se/identifier/personnummer|196411193086

A common way to find resources is to use business identifiers in a search operation. One common way is by refering to the linked resource by a search parameter, e.g. GET [base]/MedicationRequest?patient.identifier=196411193086. An other way is by a read on the related resource with a compartment, e.g. GET [base]/Patient/7fbb500f-c27f-4436-95b3-ad70277f40b2/MedicationRequest. See the documentation for each resource to find out what search operations the resorce supports.

In the case that a resource does not have a business identifier, the logical identifier created by the Swedish eHealth Agency can be used as a business identifier in the connecting systems. One example is when the returned id of a MedicationRequest is saved in the system doing the POST MedicationRequest request. In the National Medication list the following URIs are used to identify the name space of such identifiers:

  • MedicationRequest: http://electronichealth.se/identifier/nllmedicationrequestid
  • MedicationDispense: http://electronichealth.se/identifier/nllmedicationdispenseid
  • MulitDoseDispensingBasis: http://electronichealth.se/identifier/nllmultidosedispbasisid
  • DataLock: http://electronichealth.se/identifier/nlldatalockid
  • Consent: http://electronichealth.se/identifier/nllconsentid

For more information about identifiers in FHIR, see the FHIR documentation about Resources, at FHIR identifiers.

Resource version

All persistent resources are conceptually versioned and the version information is found in the meta element.

  "meta": {
    "versionId": "2"
  }

A previous version of a resource can be found by requesting it through the _history operation [base]/[resource-type]/[id]/_history/[vid], e.g. [base]/MedicationRequest/81a98656-4cec-442d-a82a-6a0476e0f3a0/_history/2, will fetch the second version of the MedicationRequest with logical id 81a98656-4cec-442d-a82a-6a0476e0f3a0.

References

A reference to another resource is usually done as a literal reference, i.e. by an URL pointing at the resource. The referenced resource can then be fetched via the URL in a separate request. A literal reference can be eighter absolute and relative. An absolute reference is a complete URL, i.e. https://domain.org/fhir/Patient/123. A relative reference omits the service base URL, i.e. Patient/123. In the Swedish National Medication List very few references are absolute as the service base URL vary depending on the entrence used by different actors.

In some cases it is not possible to reference another resource because the other resource has no identifier. One reason for this is if the resource is not persistent, e.g. the Parameters resource. Another case is when the resource exists only in the context of the referencer, e.g. a MedicationRequest includes a Patient resource whith name and birthdate but no identifier. References to inline resources is in FHIR called contained resources and such references starts with a #, e.g. #1. See FHIR contained resources for more information.

It is important that systems interacting with the Swedish National Medication List can handle all of the above types of references. The way a resource references other resources may change over time if it doesn't break any other implicit or explicit rules regarding the information transmitted.

The snippet below includes both a literal relative reference and a reference to a contained resource.

{
  "resourceType": "MedicationRequest",
  "contained": [{
      "resourceType": "Practitioner",
      "id": "1"
    }
  ],
  "subject": {
    "reference": "Patient/aa9e5f2b-a906-4312-9d13-61fd46d63f58"
  },
  "requester": {
    "reference": "#1"
  }
}

Extensions

The HL7 FHIR specification covers the most common resource types and the most common elements within those resources for the healthcare industry. Concepts that are of less common use can be added to the generic resources by adding so called FHIR extensions.

The Swedish National Medication List relies on extensions to extend the generic and international FHIR specification with concepts specific to Sweden and the purpose of the Swedish National Medication List system.

In the Swedish National Medication List all incoming resources are interpreted as its base resource with the constraints and extensions specified in the profile and in other documentation, e.g. use cases (sv. tillämpningsanvisningar).

It is important to understand that extensions are mutable. A profile may evolve by addning new extensions. Systems must be able to handle this as long as the new data is not vital for existing use cases. This applies to standard FHIR elements also. Elements not used in one version may come to use in a later version.

Supported FHIR resources

The following table is an overview of all resource types used within the Swedish National Medication List, with a brief description of how each resource is used. A more detailed description can be found by navigating to each resource in the menu.

Resource Comment
Basic Basic is a generic resource that is used for resources not defined by FHIR. In the Swedish National Medication List the Basic resource is used for the following type of resources.
1. Data lock (sv. spärr) to prevent access to certain information depending on purpose and access type.
2. Medication List Info (sv. information om läkemedelslista) provides aggregated information about a patient's medication list.
3. Multi dose dispensing (sv: dosunderlag) contains information used for production of multi dose dispense bags.
ConceptMap A concept map (sv. kodrelation) represents a mapping between codes from different code systems.
Consent Multi dose dispense consent (sv. dossamtycke) is currently the only type of consent. Multi dose dispense consent is used to allow medication in multi dose dispense bags. Other types of consents will be added later.
DetectedIssue DetectedIssue is used for returning information about AFF-issues (sv. AFF-resultat).
Location A pharmacy at a specific location.
Medication A medicinal product (sv. läkemedel) or a medical consumable (sv. handelsvara)
MedicationDispense Dispense (sv: uttag) of a medicinal product or a medical consumable at a pharmacy.
MedicationRequest Prescription (sv: förskrivning) of medicinal product or a medical consumable.
OperationOutcome OperationOutcome is a volatile resource with information of the result of an operation.
Patient Patient (sv: patient) represents a person who has or has had a prescription.
Practitioner Practitioner (sv: personal) represents a person that make changes in a patients national medication list.
Provenance Provenance (sv. händelse) holds meta data about changes made to other resources. Multiple profiles exists for documentation purpose as the meta data differs depending on the related resource.
RelatedPerson Guardian (sv: vårdnadshavare) or some other person acting as proxy (sv. fullmaktstagare) to a patient.
ValueSet A value set (sv. värdemängd) represents a set of codes used for a specific purpose.

List of Resource profile versions

ProfileVersionStatus
NLLAccessConsent1.2.0active
NLLDataLock1.1.0active
NLLMedication1.1.1active
NLLMedicationListInfo1.1.0active
NLLMultiDoseDispConsent1.3.0active
NLLOperationOutcome1.0.0active
NLLPerson0.0.1draft
NLLProvenance2.0.0active
NLLRelatedPerson1.0.0active
NLLValueSet1.0.0active
NLLTransactionBundle1.0.0active
NLLReference1.0.0active
NLLProvenanceReason1.0.0active
NLLProvenanceMedicationRequestStopped1.0.0active
NLLProvenanceMedicationRequestOther1.0.0active
NLLProvenanceMedicationRequestCancelled1.0.1active
NLLProvenanceMedicationDispense1.0.1active
NLLProvenanceConsentMultiDose1.0.1active
NLLProvenanceConsentAccess1.0.3active
NLLProvenanceBasicMultiDoseDispensingBasis1.0.1active
NLLProvenanceBasicDataLock1.0.0active
NLLProvenanceActivity1.0.0active
NLLPrescriptionBundle1.0.1active
NLLPractitioner2.0.0active
NLLPharmacyLocation1.0.0active
NLLPatient1.0.2active
NLLOrganization0.0.1draft
NLLMultiDoseDispensingBasis1.2.0active
NLLMedicationRequest1.4.1active
NLLDosage1.0.4active
NLLDispensePaperPrescription1.2.0active
NLLDetectedIssue1.0.0active
NLLAnnotation1.0.0active
NLLMedicationDispense1.2.0active
NLLDispatch1.0.0active
NLLConceptMap1.0.0active

List of Operation versions

OperationCodeVersionStatus
NLLCancelPrescriptioncancel-prescription1.0.2active
NLLEndend1.0.0active
NLLGetNotApprovedMDDBgetAllInvalid1.1.0active
NLLMonitoringmonitoring1.0.0active
NLLPatientDosageDirectionspatient-dosage-directions1.0.0active
NLLPingping1.1.0active
NLLPrintDispensesprint-dispenses1.1.0active
NLLPrintDosePrescriptionsprint-dose-prescriptions1.0.0active
NLLPrintOriginalprint1.1.0active
NLLPrintPrescriptionHistoryprint-prescription-history1.0.1active
NLLPrintPrescriptionsprint-prescriptions1.0.0active
NLLRestorerestore1.0.0active
NLLVerifyverify1.0.0active