Page Status: draft updated 2024-12-03

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 Catalog of Organization, Offerings and Contracts to interpret incoming data. The rules that apply (as specified by a profile, use case documentation e.t.c.) for a specific scenario is always based on the real data. For example the difference between an organization (HVOOrganization) and an organizational unit (HVOOrganizationalUnit) is determinded by the which attributes and valuesets that are used. The meta.profile element is always included in a response from the Swedish National Catalog of Organization, Offerings and Contracts.

"Must support" property

The general approach of customizing FHIR resources for the Swedish National Catalog of Organization, Offerings and Contracts has been to mark elements that are used within a resource with the FHIR must support 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 Catalog of Organization, Offerings and Contracts in elements not marked as must-support will be 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 means that the cardinality defined in a profile in some cases is more open than the actual use case allows.

Element constraints

An element can have constraints, also called "invariants", that specify rules which the element has to follow. In this guide they are found by hovering over an element in a resource tree, under the title "Constraints". If a constraint is not followed, the server might return a warning or an error. The constraints can come from the base specification of the resource or from the profiles. Those that are defined by the Swedish National Catalog of Organization, Offerings and Contracts are prefixed with "hvo" and are listed in the table below.

Name Rule Description Affected elements
hvo-telecom-1 system = 'phone' implies value.matches('\+46[0-9]{9}') If telecom.system = #phone, value should follow format +46XXXX HVOOrganization.contact.telecom, HVOContactExtension.telecom
hvo-organization-identifier-value-1 value.matches('[0-9]{6}-[0-9]{4}') If identifier.system = urn:oid:2.5.4.97, value should follow format for organization identifier (sv: organisationsnummer): XXXXXX-XXXX HVOOrganization.identifier[organizationIdentifier].value
hvo-hsa-identifier-value-1 value.length <= 31 If identifier.system = urn:oid:1.2.752.29.4.19, value should follow format for HSA ID: max length = 31 HVOOrganization.identifier[hsaid].value, HVOOrganizationalUnit.identifier[hsaid].value

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]/Organization/123 where 123 is the logical id. Most resources in the Swedish National Catalog of Organization, Offerings and Contracts use an UUID as logical id. A logical id will never change after it has been assigned to a resource. Se more information about the id element in the section references.

Resources can also have a business identifier. 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 HVOOrganization is saved in the system doing the POST HVOOrganization request.

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]/Organization/81a98656-4cec-442d-a82a-6a0476e0f3a0/_history/2, will fetch the second version of the Organization 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 Catalog of Organization, Offerings and Contracts very few references are absolute as the service base URL vary depending on the entry point 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. an Organizational Unit includes a Business resource with no identifier. References to inline resources is in FHIR called contained resources and such references starts with a #, e.g. #p1. See FHIR contained resources for more information.

It is important that systems interacting with the Swedish National Catalog of Organization, Offerings and Contracts 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": "Organization",
  "contained": [{
      "resourceType": "HealthcareService",
      "id": "p1"
    }
  ],
  "partOf": {
    "reference": "Organization/aa9e5f2b-a906-4312-9d13-61fd46d63f58"
  }
}

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 Catalog of Organization, Offerings and Contracts relies on extensions to extend the generic and international FHIR specification with concepts specific to Sweden and the purpose of the Swedish National Catalog of Organization, Offerings and Contracts.

In the Swedish National Catalog of Organization, Offerings and Contracts 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 adding 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 Catalog of Organization, Offerings and Contracts, 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
CodeSystem .
Contract A legally binding agreement between two parties.
Group A group of persons defined by certain traits.
HealthcareService A defined and specific healthcare activity that is offered as a service.
Location A geographical point or area.
Organization A legal entity.
OrganizationAffiliation A group of healthcare services that an organization provides.
Practitioner A person who is, as part of their formal responsibilities, directly or indirectly involved in the provisioning of healthcare, social care or related services.
PractitionerRole The role a practioner can play in relation to another entity.
ValueSet A value set (sv. värdemängd) represents a set of codes used for a specific purpose.

List of Resource profile versions

Profile Version Status
HVOAuditEvent 0.1.0 draft
HVOBusiness 0.1.0 draft
HVOContract 0.1.0 draft
HVODevice 0.1.0 draft
HVOEligibilityGroup 0.1.0 draft
HVOLocation 0.1.0 draft
HVOOperationOutcome 0.1.0 draft
HVOOrganization 0.1.0 draft
HVOOrganizationAffiliation 0.1.0 draft
HVOOrganizationalUnit 0.1.0 draft
HVOPractitioner 0.1.0 draft
HVOPractionerRole 0.1.0 draft
HVOService 0.1.0 draft