Query, Retrieve and Transform Documents from NSP
The eHealth Infrastructure document-query and document-transformation services provide integrations to the Danish national document-sharing infrastructure.
This page describes the eHealth infrastructure capabilities for
How to query and retrieve documents from NSP
How to upload CDA documents to NSP
Details on transformations FHIR to CDA Document
Details on transformations CDA Document to FHIR
Content
- 1 Content
- 2 Services to perform Document Query and Document Retrieve
- 3 Operations for Transformation between FHIR Resources and Danish CDA Profiles
- 4 Preparing Transformations by Assembling Required FHIR Resources
- 5 Details on Transformations to CDA Documents
- 6 Details on Transformations from CDA Documents
The national document-sharing infrastructure is based on Integrating the Health Enterprise (IHE) Cross-enterprise Document Sharing (XDS-b) profiles and uses Danish profiles for document metadata. While XDS-b is content-agnostic, currently shared documents are XML documents (ideally) adhering to Danish profiles of Clinical Document Architecture (CDA) document types.
Queries for document metadata and retrieval of documents can be performed through the healthcare domain National Service Platform (NSP) Document Sharing Service (Danish: Dokumentdelingsservice DDS). Acting as a front, the DDS encapsulates details about the topology of XDS-b components, whether this is one or more XDS Registry containing document metadata or one or more XDS Repository containing documents.
The eHealth Infrastructure:
Performs registering of measurement data to the KIH XDS Repository (see Registering of documents)
Performs registering of appointments to the XDS Repository fronted by NSP Document Registering and Update Service (see Registering of documents)
Provides a FHIR wrapping for performing querying for document metadata and retrieving documents on the NSP DDS (see Performing Document Query and Document Retrieve below)
The eHealth Infrastructure provides operations to transform between FHIR resources and Danish profiles of Clinical Document Architecture (CDA) XML documents.
The transformations to CDA documents are used (see details below) when the eHealth infrastructure uploads documents and metadata to the national document-sharing infrastructure.
The transformations to FHIR resources can be used by a client performing XDS-b document metadata query and document retrieving.
Services to perform Document Query and Document Retrieve
The Danish National Service Platform (NSP) in Healthcare provides a national document-sharing service (Danish: Dokumentdelingsservice DDS).
The DDS provides the following operations described in https://profiles.ihe.net/ITI/TF/Volume1/ch-10.html:
The Registry Stored Query (XDS-b transaction ITI-18) lets you search for document metadata using criteria like patient ID and period. It returns matching results, which could be none, one, or more.
The Retrieve Document Set (XDS-b transaction ITI-43) allows you to get documents based on their metadata. It returns the documents, which could be none, one, or more.
Further details on how the NSP DDS processes ITI-18 and ITI-43 requests, including possibly withholding data due to patient’s consent (Danish: Min Spærring) are described in Danish at https://www.nspop.dk/x/WJC6.
These operations are supported through the following eHealth infrastructure operations provided by the document-query service:
DocumentReference?<query>see https://ehealth.sundhed.dk/fhir/ehealth-documentreference-search.htmlBinary/$retrieve-documentreturn document as CDA. See https://ehealth.sundhed.dk/fhir/OperationDefinition-Binary-t-retrieve-document.htmlBinary/$retrieve-and-transform-QRDreturn document as FHIR resource. See https://ehealth.sundhed.dk/fhir/OperationDefinition-Bundle-t-retrieve-and-transform-QRD.html. This operation is a little special as it requires QFDD to be present in the infrastructure and the corresponding FHIR Questionnaire. See below.Binary/$retrieve-and-transform-PHMRreturn document as FHIR resource. See https://ehealth.sundhed.dk/fhir/OperationDefinition-Bundle-t-retrieve-and-transform-PHMR.htmlBinary/$retrieve-and-transform-APDreturn document as FHIR resource. See https://ehealth.sundhed.dk/fhir/OperationDefinition-Bundle-t-retrieve-and-transform-APD.html
Querying document metadata is a necessary step before retrieving the actual document.
While the XDS-b transaction ITI-43 Retrieve Document Set supports the retrieval of multiple documents, the $retrieve-document supports the retrieval of a single document only.
Document Query Parameters Supported by the Infrastructure
The infrastructure supports a number of ITI-18 parameters. The table below is an expansion of Table 2:3.67.4.1.3.1-1: ITI-18 FindDocuments Query Parameter Mapping from the IHE documentation, showing which specific parameters are supported in the infrastructure and how they map to the ITI-18 and ITI-67 parameters.
Infrastructure Query Parameters | [ITI-67] Parameter Name | [ITI-18] Parameter Name |
|---|---|---|
| patient or patient.identifier | $XDSDocumentEntryPatientId |
| ||
| creation | $XDSDocumentEntryCreationTimeFrom |
creation | $XDSDocumentEntryCreationTimeTo | |
N/A | author.given / author.family | $XDSDocumentEntryAuthorPerson |
| status | $XDSDocumentEntryStatus |
N/A | (Not supported) | $XDSDocumentEntryType |
| category | $XDSDocumentEntryClassCode |
| type | $XDSDocumentEntryTypeCode |
| setting | $XDSDocumentEntryPracticeSettingCode |
| period | $XDSDocumentEntryServiceStartTimeFrom |
period | $XDSDocumentEntryServiceStartTimeTo | |
period | $XDSDocumentEntryServiceStopTimeFrom | |
period | $XDSDocumentEntryServiceStopTimeTo | |
| facility | $XDSDocumentEntryHealthcareFacilityTypeCode |
| event | $XDSDocumentEntryEventCodeList |
N/A | security-label | $XDSDocumentEntryConfidentialityCode |
| format | $XDSDocumentEntryFormatCode |
N/A | related | $XDSDocumentEntryReferenceIdList |
Mapping DocumentEntry Values to DocumentReference in Query Results
When performing a Query for documents, the result is a Bundle containing DocumentReferences representing the DocumentEntries (document metadata) found. IHE has a standard for mapping from DocumentEntry to fhir’s DocumentReference. The infrastructure is based on that standard and implements a subset thereof.
The table below is an overview of how the infrastructure maps from DocumentEntry to DocumentReference. Additionally, it shows where and how the implementation deviates slightly from the aforementioned standard that it is based upon.
fhir DocumentReference | XDS DocumentEntry |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Deviates from standard: By being a concatenated string of the above variables instead of simply |
|
|
Deviates from standard: As it is assigned to |
|
|
|
|
|
|
|
|
|
|
|
|
|
Special notes on retrieve-and-transform-QRD operation
The retrieval and transformation are offered as a single call via operations (one per document type).
The retrieve-and-transform-QRD operation is a little special as it requires QFDD to be present in the infrastructure and the corresponding FHIR Questionnaire.
Prerequisites:
The QFDD is uploaded to the infrastructure (e.g., via KAM), and the infrastructure has stored the QFDD in an FHIR DocumentReference.
The FHIR Questionnaire:
is an analogue (or close match) to the QFDD
has QFDD document ID as an identifier.
Client Applications must:
Look up metadata for the QRD for specific QFDD (via document query and DocumentReference Search)
Retrieve the FHIR Questionnaire from the Questionnaire service with the identifier of the QFDD document ID
Call Retrieve and transform QRD providing the URL for the CDA document and the FHIR Questionnaire as input (optional)
The Document-query service returns the FHIR QuestionnaireResponse if the FHIR Questionnaire is provided as input and the transformation is successful. Otherwise, it returns the QRD CDA XML.
Operations for Transformation between FHIR Resources and Danish CDA Profiles
The https://ehealth.sundhed.dk/fhir/CapabilityStatement-document-transformation.html provides operations for transforming documents between FHIR resources and Danish CDA document profiles.
Details on the transformations are provided in the table below which includes references to Danish CDA profiles.
The transformations have the following characteristics:
The transformations are idempotent (except for generated identifiers such as the CDA document ID in the output).
The transformations do not provide access to any FHIR resources. Client Applications must supply the necessary FHIR resources as input. This design prevents security breaches.
Transformation | Source (XML document in FHIR DocumentReference) | Target (XML document in FHIR DocumentReference) | Comment |
|---|---|---|---|
https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-to-PHMR.html | Bundle of FHIR resources. The primary source of information is a FHIR Observation. | PHMR v2.1 XML document. | Used in assembly, transformation and upload of FHIR Observation transformed to PHMR to XDS-based document sharing infrastructure as described in Sharing through Registering Documents in National Document Sharing Infrastructure. |
https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-to-QRD.html
| Bundle of FHIR resources. The primary source of information is an FHIR QuestionnaireResponse. | QRD v1.3 XML document | Used in assembly, transformation and upload of FHIR QuestionnaireResponse transformed to QRD to XDS-based document sharing infrastructure as described in Sharing through Registering Documents in National Document Sharing Infrastructure. |
https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-to-QFDD.html | Bundle of FHIR resources. The primary source of information is the FHIR Questionnaire. | QFDD v1.2 XML document |
|
https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-to-APD.html | Bundle of FHIR resources. The primary source of information is a FHIR Appointment. | APD v2.0 XML document | Used in assembly, transformation and upload of FHIR Appointment transformed to APD to XDS-based document sharing infrastructure as described in Sharing through Registering Documents in National Document Sharing Infrastructure. |
https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-from-PHMR.html | PHMR v2.1 XML document. | Bundle of FHIR resources. The most significant information is within an FHIR Observation. | The resulting Observation(s) is not guaranteed to be a valid FHIR Observation. |
https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-from-QRD.html | QRD v1.3 XML document | Bundle of FHIR resources. The most significant information is within a FHIR QuestionnaireResponse. | The resulting QuestionnaireResponse is not guaranteed to be a valid FHIR QuestionnaireResponse. |
| QRD v1.3 XML document | Bundle of FHIR resources Most significant information is within an FHIR QuestionnaireResponse with a structure matching the Questionnaire given as input. The QuestionnaireResponse will have linkIDs matching the corresponding Questionnaire. | The resulting QuestionnaireResponse is not guaranteed to be a valid FHIR QuestionnaireResponse. |
https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-from-QFDD.html | QFDD v1.2 XML document | The primary resource in the return bundle is the FHIR Questionnaire. |
|
https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-from-APD.html | APD v2.0 XML document | Bundle of FHIR resources. The primary source of information is a FHIR Appointment. | The resulting Appointment is not guaranteed to be a valid FHIR Appointment. |
HL7 DK CDA Profile | Description | Specification |
|---|---|---|
PHMR v2.1 | HL7 Implementation Guide for CDA Release 2.0, Release 2.1.0 May 13th 2025 | https://svn.medcom.dk/svn/releases/Standarder/HL7/PHMR/Dokumentation/PHMR-DK-v2.1.0.pdf |
QRD v1.3 | HL7 Implementation Guide for CDA Release 2.0, Release 1.3 February 11th 2022 | https://svn.medcom.dk/svn/releases/Standarder/HL7/PRO/QRD/Dokumentation/DK-QRD-v1.3.pdf
|
QFDD v.1.2 | HL7 Implementation Guide for CDA Release 2.0, Release 1.2 February 11th 2022. | https://svn.medcom.dk/svn/releases/Standarder/HL7/PRO/QFDD/Dokumentation/DK-QFDD-v1.2.pdf |
APD v2.0 | HL7 Implementation Guide for CDA Release 2.0, Draft for Trial Use, | http://svn.medcom.dk/svn/releases/Standarder/HL7/Appointment/Dokumentation/DK-APD-v2.0.pdf |
Preparing Transformations by Assembling Required FHIR Resources
As described above, the transformations to CDA XML documents require that the client provides all the required FHIR resources. What FHIR resources must be part of the assembled FHIR bundle depends on the transformation.
When the eHealth infrastructure assembles FHIR resources to transform and upload to XDS-based document-sharing infrastructure, the assembled resources are fetched from the various eHealth services. Whether this is the case for a client’s possible use is up to the client, that is, they could be provided as in-memory FHIR resources that are not stored in the infrastructure.
Assembling FHIR Resources for Transformation to PHMR
A FHIR Bundle in-memory is prepared with the resources described below, based on a ClinicalImpression approving document sharing of the FHIR Observation. Typically, the assembly (and subsequent transformation and upload) is triggered by the creation of the ClinicalImpression, but might otherwise be triggered by a ServiceRequest update reflecting a Practitioner’s registering of the citizen’s decision to change sharing policy.
FHIR Resource | Logical Part in Transformation | Comment |
|---|---|---|
Observation (referenced from ClinicalImpression) | Observation Details | The Observation is the primary driver of the information contained in the generated PHMR document, including observation code, measured value and so on. |
DocumentationOf (CDA Header) | ||
|
| |
Patient (possibly referenced from | Author, Author Individual | When |
Practitioner (possibly referenced from | When | |
Organization (referenced from | Author, Author Organization | Author Organization is set to Organization referenced in |
|
|
|
| DataEnterer | When
and |
Patient (referenced from | Patient Identification | Patient identifier (CPR number), name (given & family), gender, birth date (in format: |
Organization (referenced from | Custodian Organization | SOR ID, name, telecom, address |
Practitioner (possibly referenced from | Legal Authenticator, Legal authenticator Individual | Legal authenticator is set only if the Observation has been approved for sharing manually (when |
Organization (referenced from | Legal Authenticator, Legal authenticator Organization | |
Composition (created as part of the assembly) | Document header (CDA Header) | The FHIR Composition resource represents the document and has fixed values as follows:
|