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

  1. How to query and retrieve documents from NSP

  2. How to upload CDA documents to NSP

  3. Details on transformations FHIR to CDA Document

  4. Details on transformations CDA Document to FHIR

Content

 

 

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:

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:

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.

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:

  1. Look up metadata for the QRD for specific QFDD (via document query and DocumentReference Search)

  2. Retrieve the FHIR Questionnaire from the Questionnaire service with the identifier of the QFDD document ID

  3. Call Retrieve and transform QRD providing the URL for the CDA document and the FHIR Questionnaire as input (optional)

  4. 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.

Transformations Operations 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 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

Transformation

Source (XML document in FHIR DocumentReference)

Target (XML document in FHIR DocumentReference)

Comment

$transform-to-PHMR

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 v1.3 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.

$transform-to-QRD

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.

$transform-to-QFDD

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

 

$transform-to-APD

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.

$transform-from-PHMR

https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-from-PHMR.html

PHMR v1.3 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.

$transform-from-QRD

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.

$transform-from-QRD-based-on-questionnaire

https://ehealth.sundhed.dk/fhir/OperationDefinition--s-transform-from-QRD-based-on-questionnaire.html

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.

$transform-from-QFDD

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.

 

$transform-from-APD

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

HL7 DK CDA Profile

Description

Specification

PHMR v1.3

HL7 Implementation Guide for CDA Release 2.0,
Personal Healthcare Monitoring Report (PHMR),
(Danish profile – PHMR DK),

Release 1.3 31. March 2014,
Updated 24. April 2018

http://svn.medcom.dk/svn/releases/Standarder/HL7/PHMR/Dokumentation/PHMR-DK-Profile-v1.3.pdf

(Note: The available v1.3 is now updated as of March 2, 2020)

QRD v1.3

HL7 Implementation Guide for CDA Release 2.0,
Questionnaire Response Document,
(Danish profile – DK QRD),

Release 1.3 February 11th 2022

https://svn.medcom.dk/svn/drafts/Standarder/HL7/PRO/QRD/Dokumentation/DK-QRD-v1.3.pdf

QFDD v.1.2

HL7 Implementation Guide for CDA Release 2.0,
Questionnaire Form Definition Document,
(Danish profile – DK QFDD),

Draft,
Release 1.2 February 11th 2022.

https://svn.medcom.dk/svn/drafts/Standarder/HL7/PRO/QFDD/Dokumentation/DK-QFDD-v1.2.pdf

APD v2.0

HL7 Implementation Guide for CDA Release 2.0,
Appointment Document,
(Danish profile – DK APD),

Draft for Trial Use,
Release 2.0 November 4th 2019

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

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, reference ranges and so on.

DocumentationOf (CDA Header)

Device (referenced from Observation.device)

Medical Equipment Section

Possible details about device(s) used.

Patient (referenced from ClinicalImpression.subject)

Patient Identification

Patient identifier (CPR number), name (given & family), gender, birth date, telecom

EpisodeOfCare (referenced from ClinicalImpression.episodeOfCare)

See Author Organization below

https://ehealth.sundhed.dk/fhir/StructureDefinition-ehealth-clinicalimpression-definitions.html#ClinicalImpression.extension:episodeOfCare

Organization (referenced from EpisodeOfCare.managingOrganization)

Custodian Organization

SOR ID, name, telecom, address

Practitioner (possibly referenced from ClinicalImpression.assessor)

Author, Author Individual

Organization (referenced from ClinicalImpression.assessorOrganization)

Author, Author 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:

  • Document identifier

    • value = randomUUID

    • system = urn:oid: + OID value from NamingSystem.uniqueId.value (where uniqueId.type is oid) from eHealthIdentifier

    • assigner = the value of NamingSystem.publisher in eHealthIdentifier

  • title = “Hjemmemonitorering for “ + <Patient’s CPR identifier value>

  • date = ClinicalImpression.effective[x] if present, else now (time of assembly)

Organization possibly referenced from Composition.attester.party

Composition.attester elements:

  • party is set to episodeOfCare.CareManagerOrganization

  • mode = legal

  • time set to now (time of assembly)

Practitioner/Patient/RelatedPerson/Organization referenced from Observation.note.author

Author of observation note

When the Observation.note.author contains a reference, the referenced resource needs to be present in the bundle.

Practitioner/Patient possibly referenced from Observation.performer

Observation performer

If the observation performer is of type Practitioner it must be included in the bundle.

Notes on assembling Author Individual and Author Organization in the Infrastructure:

The ClinicalImpression.author and ClinicalImpression.authorOrganization are set depending on the ServiceRequest.sharingApprovalPolicy as follows:

  • For ServiceRequest.sharingApprovalPolicy set to manual:

    • ClinicalImpression.author is set to the Practitioner approving sharing

    • ClinicalImpression.authorOrganization is set to the Organization referenced in the user's (the Practitioner's) security context

  • For ServiceRequest.sharingApprovalPolicy set to automatic:

    • ClinicalImpression.author is not set

    • ClinicalImpression.authorOrganization is set to the Organization possibly referenced in CarePlan.author (the CarePlan is resolved from the ServiceRequest resolved from the Observation). In case CarePlan.author is not present or does not reference an Organization, the EpisodeOfCare.caremanagerOrganization is used.

Assembling FHIR Resources for Transformation to QRD

A FHIR Bundle in-memory is prepared with the resources described below, based on a ClinicalImpression approving document sharing of the FHIR QuestionnaireResponse. 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 the sharing policy.

FHIR Resource

Logical Part in Transformation

Comment

FHIR Resource

Logical Part in Transformation

Comment

QuestionnaireResponse (referenced from ClinicalImpression)

Question/answer details

The QuestionnaireResponse is the primary driver of the information contained in QRD.

DocumentationOf (CDA Header)

effectiveTime = QuestionnaireResponse.authored (dateTime)

Patient (referenced from ClinicalImpression.subject)

Patient identification

identifier (CPR number), name (given & family), gender, birth date, telecom

EpisodeOfCare (referenced from ClinicalImpression.episodeOfCare)

See Author Organization below

https://ehealth.sundhed.dk/fhir/StructureDefinition-ehealth-clinicalimpression-definitions.html#ClinicalImpression.extension:episodeOfCare

Organization (referenced from EpisodeOfCare.managingOrganization)

Custodian Organization

SOR ID, name, telecom, address

Practitioner (referenced from ClinicalImpression.assessor)

Author Individual

A consequence is that the Practitioner will appear as working in the context of the Author Organization (which is not necessarily the case).

Organization (referenced from ClinicalImpression.assessorOrganization)

Author organization

The origin of this Organization is dependent on sharingApprovalPolicy in the ServiceRequest

  • If sharing approval is manual this is the organization from the approver's context.

  • If sharing approval is automatic this is the organization from either CarePlan.author or from EpisodeOfCare.caremanagerOrganization in that order.

If the FHIR Organization has no SOR type identifier, it is checked if it contains a SOR-relation in Organization.ehealth-organization-relatedTo.

Composition (created as part of the assembly)

Document header (CDA Header)

FHIR Resource to represent document fixed values

  • Document id

    • value=randomUUID

    • system=” urn:oid: + OID value from NamingSystem.uniqueId.value (where uniqueId.type is oid) from eHealthIdentifier

    • assigner: the value of NamingSystem.publisher in eHealthIdentifier

  • title = same as Questionnaire.title

  • effectiveTime = now (time of assembly)

Questionnaire (referenced from QuestionnaireResponse.questionnaire)

Used in Document header (CDA Header) above

Questionnaire.identifier must contain the unique QFDD document id:

  • Identifier.system set to urn:oid: + <Attribute root in QFDD /ClinicalDocument/id>

  • Identifier.value set to <Attribute extension in QFDD /ClinicalDocument/id>

Note on prerequisites for document registering:

  • The QFDD must be uploaded to the infrastructure before document registration of QRD.

  • The Questionnaire.identifier can contain multiple identifiers but only the identifier for QFDD is allowed to have an Identifier.system starting with the prefix urn:oid:

DocumentReference (soft reference from Questionnaire.identifier )

QFDD

DocumentReference.masterIdentifier shall contain the QFDD document ID (matched in the Questionnaire Questionnaire.identifier).

DocumentReference.status shall be current.

DocumentReference.type must be Coding for QFDD type: system = http://loinc.org and value = 74468-0).

DocumentReference.content.attachment.data shall contain the QFDD XML content.

Details on Transformations to CDA Documents

Transformation to the CDA Header Details

The following table describes how logical parts in the transformation map to the header part of the CDA document. The CDA header part is common across all Danish profiles with a few variations. Certain elements of the mapping are specific to the document type (marked as <specific to document type>). The details for these elements are provided in the sections on the transformation of specific document types below.

Source (typically FHIR Resource)

Logical Part in Transformation

CDA Document

Details

Source (typically FHIR Resource)

Logical Part in Transformation

CDA Document

Details

Random UUID and details from the Infrastructure’s NamingSystem

https://ehealth.sundhed.dk/fhir/NamingSystem-ehealth-identifier.html

Document id

/ClinicalDocument/id

 

 

  • Document identifier

    • value = randomUUID

    • system =urn:oid: + OID value from NamingSystem.uniqueId.value (where uniqueId.type is oid) from eHealthIdentifier

    • assigner = the value of NamingSystem.publisher in eHealthIdentifier

<specific to document type>

Document title

/ClinicalDocument/title

 

System time at the time of transformation

Time of document creation

/ClinicalDocument/effectiveTime

 

<specific to document type>

DocumentationOf (CDA Header)

/ClinicalDocument/documentationOf[0, 1, …]

Code(s) and DateTime

Composition.subject referencing a Patient

Patient identification

/ClinicalDocument/recordTarget/patientRole

CPR-number (identification), name (given & family), gender, birth date, telecom

<specific to document type>

Author, Author Individual

/ClinicalDocument/author/assignedAuthor/assignedPerson

Name (given & family), prefix

Composition.authorOrganization

Author, Author Organization

/ClinicalDocument/author/assignedAuthor/id

/ClinicalDocument/author/assignedAuthor/addr

/ClinicalDocument/author/assignedAuthor/telecom

/ClinicalDocument/author/assignedAuthor/representedOrganization/name

If QuestionnaireResponse.source is a patient, the author is the patient and the ID will be CPR number.

If QuestionnaireResponse.source is a practitioner, the author is a practitioner and it will be a SOR organization.

Composition.custodian

Custodian Organization

/ClinicalDocument/custodian/assignedCustodian/representedCustodianOrganization

 

<specific to document type>

Legal Authenticator

/ClinicalDocument/legalAuthenticator

(Not generally used but depends on the document type)

n/a

Information Recipient

/ClinicalDocument/informationRecipientOptional

Not used

n/a

Authenticator

/ClinicalDocument/authenticator

Not used

n/a

Optional Participant

/ClinicalDocument/participantOptional

Not used

n/a

Optional In Fulfillment Of

/ClinicalDocument/inFulfillmentOfOptional

Not used

specific to QRD transformation

 

Data Enterer

/ClinicalDocument/dataEnterer

If QuestionnaireResponse.source is a patient and QuestionnaireResponse.author is a practitioner, then the dataEnterer is filled with QuestionnaireResponse.author info.

If QuestionnaireResponse.source is a practitioner and QuestionnaireResponse.author is a different practitioner, then the dataEnterer is filled with QuestionnaireResponse.author info

Transformation to PHMR Details

The PHMR transformation entails the transformation of the CDA Header (see above) as well as the PHMR-specific parts described below.

Source (typically FHIR Resource)

Logical Part in Transformation

CDA Document

Details

Source (typically FHIR Resource)

Logical Part in Transformation

CDA Document

Details

Patient.identifier

 

Document title

/ClinicalDocument/title

“Hjemmemonitorering for “ concatenated with Danish CPR, that is, Patient.identifier.value (where the system is urn:oid:1.2.208.176.1.2)

Observation.effective[x]

DocumentationOf (CDA Header)

/ClinicalDocument/documentationOf[0, 1, …]

One DocumentationOf entry for time:

effectiveTime = (Observation.effective[x] or widest span of multiple Observations Observation.effective[x])

Observation.code

One DocumentationOf for each Observation.code

Observation.component.code

One DocumentationOf for each Observation.component.code

composition.author

Author, Author Individual

/ClinicalDocument/author/assignedAuthor/assignedPerson

Name (given & family), prefix

Composition.attester.party referencing an Organization

Legal Authenticator

/ClinicalDocument/legalAuthenticator

 

The following table details how logical parts in the transformation map to specific areas of the body part of a PHMR document.

Source (typically FHIR Resource)

Logical Part in Transformation

CDA Document

Details

Source (typically FHIR Resource)

Logical Part in Transformation

CDA Document

Details

n/a

Observation(s) Section - Results

/ClinicalDocument/component/structuredBody/component[2]/section (title=Results)

Grouping of zero, one or more Observations/Observation components

Observation

Per Observation (or Observation and Observation.component)

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/

 

Observation.identifier

(if an Observation.identifier has a system resolvable to OID type)

  • Measurement id

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/ovservation/id

id@extension is set to Observation.identifier.value.

id@root is set to OID value resolved from Observation.identifier.system.

Resolving as OID type system is either (in order):

  • Observation.identifier.system prefixed with urn:oid:

  • Observation.identifier.system can be matched to FHIR NamingSystem (in terminology service) which has NamingSystem.uniqueId.value where uniqueId.type is oid

A random UUID

(Observation.identifier has no system resolvable to OID type)

id@extension is set to random UUID

id@root is set to "1.2.208.176.7.200.1" (which is OID type in https://ehealth.sundhed.dk/fhir/NamingSystem-ehealth-identifier.html )

Observation.effective[x]

  • Measurement time

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/effectiveTime

Start date of observation.

If Observation.effective is a Period, the Period.start value is used if present, otherwise it is set to the Period.end.

If Observation.effective is a DateTime or InstantType the value is used.

Observation.code

  • Measurement type

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/code

SNOMED CT system with value set to nullFlavor.

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/code/translation

 

Observation.valueQuantity

  • Measured value, unit

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/value

Value and unit in percent are converted to unitless decimals (fraction).

Observation.performer

 

  • Measurement Method and Measured By (MethodCode)

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/methodCode

The details for deciding the two method codes can be found in the table below.

Observation.quality

Observation.referenceRange

  • Reference Range

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/referenceRange

As mentioned above, the PHMR reference ranges are inverted ranges compared to the fhir format, so we need to invert the ranges when transforming to fhir. If a yellow range is present we check if there is also a red range, if so we map the yellow range to an interval between the start of the yellow range and the start of the red range. Otherwise, the ranges are open-ended.

If the reference ranges are exclusive we encode this in fhir by subtracting or adding a small constant. For the same reason, we are not able to handle values with more than 7 decimals. So we check if any referenceRange value has more than 7 decimals and if that is the case we throw an exception and stop the translation.

Observation.note

Observation.note.authorReference (referencing a Practitioner or Organization)

Comment on observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation/entryRelationship/act

An entryRelationship is added to the observation with LOINC code for Annotation comment (code=48767-8, codeSystem=2.16.840.1.113883.6.1).

The author of the note is mapped like Author Organization and/or Author Individual, depending on Observation.note.authorReference.

n/a

Observation(s) Section - Vital Signs

/ClinicalDocument/component/structuredBody/component[x]/section (title=Vital Signs)

Grouping of zero, one or more Observations/Observation components.

Not used. Empty section created as specified in PHMR profile.

n/a

Medical Equipment Section

/ClinicalDocument/component/structuredBody/component[3]/section (title=Medical Equipment)

Grouping of one or more Device details

Device

Per Device in use

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer

 

Device.serialNumber

Device.lotNumber

  • Device identifier

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer/participant/participantRole/id

If a serial number or lot number is present on the Device, the id is set to the number with assigningAuthority being the number type and the root: “1.2.208.184“

 

the determined device type code (see below

When no Device.serialNumber or Device.lotNumber is present, the determined device type code is used, with assigningAuthority: "MedCom" and root: "1.2.208.184".

Device.type

Device.manufacturer

Device.deviceName

Device.modelNumber

Device.version.value

  • Device type code

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer/participant/participantRole/playingDevice/code/translation

If a MedCom Instrument Code matches:
Device.type
Device.manufacturer
Device.deviceName
Device.modelNumber
Device.version.value

can be found, it is used. Otherwise set to the nullflavor NI

Device.manufacturer

Device.deviceName

Device.modelNumber

 

  • Manufacturer and Model Name

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer/participant/participantRole/playingDevice/manufacturerModelName

Encoded string comprised of:

  • Device manufacturer

  • Device model and model number

Device.serialNumber

Device.lotNumber

Device.version

  • Software Name

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer/participant/participantRole/playingDevice/softwareName

Encoded string, comprised of device.version and device.serialNumber or device.lotNumber depending on which is present.

n/a

External References

 

Not used

Determining MethodCodes

FHIR Observation.performer

FHIR Observation.quality

MethodCode 1

PerformerType

MethodCode 2

ProvisionMethod

FHIR Observation.performer

FHIR Observation.quality

MethodCode 1

PerformerType

MethodCode 2

ProvisionMethod

Observation.performer references Patient

Observation.quality contains ehealth-quality with:

  • qualityType = UQ (Usage Quality)

  • qualityCode = http://ehealth.sundhed.dk/cs/usage-quality | automatically-transferred

 

POT (performed by citizen)

AUT (electronically)

Observation.performer references Practitioner with at least one Practitioner.qualification which has qualification.identifier.system = https://autregweb.sst.dk .

PNT (performed by a healthcare professional)

AUT (electronically)

Observation.performer references Practitioner with no Practitioner.qualification or (if qualification present) none with qualification.identifier.system = https://autregweb.sst.dk .

PCG (performed by caregiver)

AUT (electronically)

Observation.performer references Patient

Observation.quality contains ehealth-quality with:

  • qualityType = UQ (Usage Quality)

  • qualityCode = http://ehealth.sundhed.dk/cs/usage-quality | entered-manually

POT (performed by citizen)

TPD (typed in by citizen)

Observation.performer references Practitioner with at least one Practitioner.qualification which has qualification.identifier.system = https://autregweb.sst.dk .

PNT (performed by a healthcare professional)

TPH (typed in by a healthcare professional)

Observation.performer references Practitioner with no Practitioner.qualification or (if qualification present) none with qualification.identifier.system = https://autregweb.sst.dk .

PCG (performed by caregiver)

TPC (typed in by caregiver)

Transforming Reference Ranges

Reference ranges (aka measurement ranges) are supported as regular, sensible ranges in the eHealth Infrastructure. In the PHMR, they are expressed as alarm thresholds. Oddly, the PHMR uses a range construct to carry the lower and higher threshold values, respectively, in effect describing an inverted range where the alarm is not in effect. Furthermore, the PHMR can contain zero, one or two alarm thresholds per observation. As shown in the figure below, the measurement range(s) in an FHIR Observation are transformed to such alarm thresholds for the PHMR document.

 

AbsoluteMeasurementRange vs PHMR.png

 

There need not be both yellow and red type measurement ranges and they need not be symmetrical as in the figure above. There are, however, certain constraints on which measurement ranges are supported due to the representation as alarm thresholds:

  • at most two yellow and two red measurement ranges are supported and they cannot be interleaved (for instance red, yellow, red, yellow)

  • the outermost measurement range cannot have both high and low values (because the alarm threshold is open-ended)

  • the outermost measurement range cannot be yellow if it is preceded by a red measurement range

In the example above, measurement ranges are overlapping (for instance yellow high value is equal to the red low value) which the Clinical Administration Application prevents by requiring non-overlapping intervals. In reality, the measurement ranges will be non-overlapping by use of exclusiveness. This is accounted for in the transformation to alarm threshold through the use of the PHMR inclusive=false | true construct.

Error situations

The transformation terminates in the error situations given below.

Situation

Error message

Situation

Error message

Observation.quality is empty or contains no ehealth-quality with:

  • qualityType = UQ (Usage Quality)

  • qualityCode = http://ehealth.sundhed.dk/cs/usage-quality | automatically-transferred or http://ehealth.sundhed.dk/cs/usage-quality | entered-manullay

Method codes for performerType and provisionMethod for observation with id {observationId} could not be established

Observation.performer references ehealth-organization or ehealth-relatedperson.

Method codes for performerType and provisionMethod for observation with id {observationId} could not be established

Observation.effective is of type Timing. Valid types are: dateTime, Period and instant.

Invalid Observation.effective, expecting DateTime, Period or Instant

Observation.value is missing or is not of type Quantity.

The Value should be Quantity type and not null

Observation.referenceRange component contains both low and high values.

Observation ranges should not have both High and Low set when transforming to PHRM, but High is: {high}, and Low is: {low}

Observation.referenceRange component value contains more than 7 decimals.

The Value should have no more than 7 decimals but is: {value}

Patient.identifier contains no CPR (Danish citizen identifier).

CPR is mandatory for patients but not present in the fhir bundle

Observation.note.author is not of type Reference(Practitioner | Patient | RelatedPerson | Organization) | string.

Unknown author type: {authorType}

Composition.author is missing or is not of type Patient | Practitioner.

Composition.author should either be a Patient or a Practitioner

Composition.authorOrganization does not contain a SOR identifier.

Composition.authorOrganization must contain SOR identifier

Composition.attester organization does not contain a SOR identifier.

Composition.attester.party must contain SOR identifier

Composition.custodian organization does not contain a SOR identifier.

Custodian organization must contain SOR identifier

Composition.authorOrganization is missing.

Composition.authorOrganization is mandatory for transformation

Composition.custodian is missing.

Custodian is mandatory for transformation

Composition.identifier is missing.

Identifier on composition is mandatory

Composition.confidentiality is missing.

Composition.confidentiality is mandatory

Composition.subject is not of type Patient.

Composition.subject should be a Patient

 

A Narrative in the Results section and/or Medical Equipment section cannot be generated due to unexpected issues.

Can't generate a narrative for: medical equipment OR

Can't generate a narrative for: results

Transformation to QRD Details

The QRD transformation entails the transformation of the CDA Header (see above) as well as the QRD-specific parts described below.

QRD-specific transformation to CDA Header

Source (typically FHIR Resource)

Logical Part in Transformation

QRD Document

Details

Source (typically FHIR Resource)

Logical Part in Transformation

QRD Document

Details

QuestionnaireResponse.effectivePeriod.start

 

/ClinicalDocument/documentationOf/serviceEvent/effectiveTime/low

The transformation fails if no effectivePeriod.start has been specified.

QuestionnaireResponse.effectivePeriod.end

 

/ClinicalDocument/documentationOf/serviceEvent/effectiveTime/high

If effectivePeriod.end is not specified, the transformation results in nullFlavor.

The transformation fails if effectivePeriod.end is specified with the same value as effectivePeriod.start.

QuestionnaireResponse.source

Author

/ClinicalDocument/author

 

QuestionnaireResponse.author

Data Enterer

/ClinicalDocument/dataEnterer/assignedEntity

(telecom, address and assignedPerson)

Transformed only when QuestionnaireResponse.source is not the same as QuestionnaireResponse.author

Details on Transformations from CDA Documents

Transformation from the CDA Document Header Details

It is described in the following table how logical parts in the transformation map the CDA header to FHIR resources. The CDA header part is common for all the Danish profiles with a few variations. Certain elements of the mapping are specific to the document type (marked as <specific to document type>). The details for these elements are specified in the sections on the transformation of specific document types below.

CDA Document

Logical Part in Transformation

FHIR Resource

Details

CDA Document

Logical Part in Transformation

FHIR Resource

Details

/ClinicalDocument/id

Document id

Composition.identifier

Composition.identifier is set to a new identifier with
value = @extension
system = “urn:oid:” + @root

/ClinicalDocument/title

Document title

Composition.title

 

/ClinicalDocument/effectiveTime

Time of document creation

Composition.date

 

/ClinicalDocument/documentationOf[0, 1, …]

DocumentationOf (CDA Header)

<specific to document type>

Code(s) and datetime

/ClinicalDocument/recordTarget/patientRole

Patient identification

Composition.subject

A new transient Patient resource is created with address, gender, name, birth date, telecom and identifier data mapped from this element and sub-elements.

Composition.subject is set to a reference to this Patient resource.

/ClinicalDocument/author/assignedAuthor/assignedPerson

Author, Author Individual

<specific to document type>

Name (given & family), prefix

/ClinicalDocument/author/assignedAuthor/id

/ClinicalDocument/author/assignedAuthor/addr

/ClinicalDocument/author/assignedAuthor/telecom

/ClinicalDocument/author/assignedAuthor/representedOrganization/name

Author, Author Organization

Composition.authorOrganization

If present the organizationName is taken from assignedAuthor/representedOrganization
Telecom, address and identifier are taken from the assignedAuthor element

The organization source is set to manual and the synchronizationStatus is set to NotSynchronized

/ClinicalDocument/custodian/assignedCustodian/representedCustodianOrganization

Custodian Organization

Composition.custodian

A new transient Organization resource is created with name, identifier and address data set from elements and sub-elements.

The organization source is set to manual and the synchronizationStatus is set to “NotSynchronized”

/ClinicalDocument/legalAuthenticator

Legal Authenticator

<specific to document type>

(Not generally used but depends on the document type)

/ClinicalDocument/informationRecipientOptional

Information Recipient

n/a

Not used

/ClinicalDocument/authenticator

Authenticator

n/a

Not used

/ClinicalDocument/participantOptional

Optional Participant

n/a

Not used

/ClinicalDocument/inFulfillmentOfOptional

Optional In Fulfillment Of

n/a

Not used

/ClinicalDocument/

 

 

 

Transformation from PHMR Document Details

The PHMR format and the FHIR model of the eHealth Infrastructure vary in what information is represented. The transformations to PHMR and from PHMR document are not symmetric.

When transforming from FHIR resources, an FHIR Observation with components is mapped to consecutive observations in the PHMR document. When transforming from a PHMR document, there is no way of knowing which observations where originally components and consequently, each observation is transformed into an individual FHIR Observation.

General principles of the transformation:

Principle

Description

Principle

Description

No assumptions on pedigree

The input PHMR document could be from any source. It is most likely, however, that it was retrieved from the national document-sharing infrastructure.

Assume the PHMR document adheres to the profile

 

Preserve as much information as possible

The resulting FHIR resources are not guaranteed to be persistable in the eHealth Infrastructure, cf. the note on varying information represented (see above).

The transformation can result in one or more FHIR resources without element values in cases where the presence of the FHIR resource alone represents the information in the PHMR document.

A FHIR MethodOutcome can be part of the FHIR Bundle returned by the transformation operation. The MethodOutcome will reflect possible data loss.

 

CDA Document

Logical Part in Transformation

FHIR Resource

Details

CDA Document

Logical Part in Transformation

FHIR Resource

Details

/ClinicalDocument/component/structuredBody/component[2]/section (title=Results)

Observation(s) Section - Results

n/a

Grouping of zero or more measurements each transformed to an observation as described below

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/

Per Observation (or Observation and Observation.component)

Observation

 

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/ovservation/id

  • Measurement id

Observation.identifier

 

Observation.identifier.value is set to id@extension

Observation.identifier.system is set to “urn:oid:”+id@root

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/effectiveTime

  • Measurement time

Observation.effective[x]

Observation.effective

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/code

  • Measurement type

Observation.code

if code is present and not “NI” a code is added to Observation.code with code = @code and display = @displayName

If it is possible to match the value of @codeSystem with the oid of the known code system, system is set to the URL of the known codeSystem. If now the value of codeSystem is set to “urn:oid:” +

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/code/translation

if code is present and not “NI” a code is added to Observation.code with code = @code and display = @displayName

If it is possible to match the value of @codeSystem with the oid of the known code system, system is set to the URL of the known codeSystem. If now the value of codeSystem is set to “urn:oid:” +

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/value

  • Measured value, unit

Observation.valueQuantity

If the value of @unit is “NA” and the value of @value is a 2 decimal value, the valueQuantity.unit is set to “%” and the value is multiplied by 100 to convert it to a percent. Otherwise the values are used directly.

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/methodCode

  • Measurement Method and Measured By (MethodCode)

Observation.performer

 

If the performer is specified as a citizen the Observation.performer is set to the Patient present in Composition.subject.

If not, it is not possible discern between health-care professionals as performers and care giver as performer in the FHIR model. So Observation.performer is set to a new transient Practitioner ressource and raise an issue noting the original performer.

If a provision method specifies that the observation was entered by a different actor than the performer, there is no way of representing this and an issue is raised.

Observation.quality

If the provision method is listed as automatic, a coding is added to the observation quality specifying this, if not the coding specifies that it is entered manually.

/ClinicalDocument/component/structuredBody/component[2]/section/entry/organizer/component/observation/referenceRange

  • Reference Range

Observation.referenceRange

FHIR ranges are inverted to PHMR representation.

Only Observation.referenceRange.type "GAL" and "RAL" are transformed.

Other Observation.referenceRange.type are ignored as these are not supported in PHMR.

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation/entryRelationship/act

Comment on observation

None

This information is currently ignored.

/ClinicalDocument/component/structuredBody/component[x]/section (title=Vital Signs)

Observation(s) Section - Vital Signs

 

Grouping of zero or more measurements, handled like the result section as described above

/ClinicalDocument/component/structuredBody/component[3]/section (title=Medical Equipment)

Medical Equipment Section

n/a

Grouping of one or more Device details

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer

Per Device in use

Device

 

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer/participant/participantRole/id

  • Device identifier

Device.serialNumber

 

set to @extension

 

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer/participant/participantRole/playingDevice/code/translation

  • Device type code

Device.type

A Coding is added to Device.type with

system = "urn:oid:1.2.208.184.100.3"

code = @code

display = @displayName

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer/participant/participantRole/playingDevice/manufacturerModelName

  • Manufacturer and Model Name

Device.manufacturer

Device.deviceName

Device.modelNumber

 

If the element value matches the regular expression "Manufacturer: (.*) / Model: (\\S*) (\\S*)"

the string is split in 3 and set to Device.manufacturer, Device.deviceName,and Device.modelNumber, respectively.

Otherwise Device.manufacturer is set to the entire string.

/ClinicalDocument/component/structuredBody/component[3]/section/entry/organizer/participant/participantRole/playingDevice/softwareName

  • Software Name

Device.version

 

 

External References

n/a

Not used

Errors and issues

When transforming from a PHMR document to a FHIR representation, the goal is to preserve as much information as possible and there are no hard requirements for validity of the produced FHIR resources. When it is not possible to translate specific data in the PHMR document to FHIR, an issue describing the situation or missing information is added to a FHIR OperationOutcome resource included in the return Bundle. Except for cases where it is not possible to translate the measurement values. In these cases the system throws an error and aborts the transformation.

The situations where an error is thrown and the transformation is aborted:

Situation

Error message

Situation

Error message

A measurement with type Observation Media is present

Measurement was of media type. This was not translated to an observation since it is not supported in FHIR

A measurement range with more than 7 decimals is present

Could not transform measurement with reference range Low: %s and High: %s since we cannot correctly translate more than 7 decimals.

The situations where an issue is raised as a warning in the OperationOutcome:

Situation

Issue message

Situation

Issue message

A method code denoting the provision method is missing

Measurement provision method code is missing

A method code denoting that the provision method was “typed in by relative”

Provision method of measurement was marked as typed by relative, it is not possible to reflect this in the FHIR model. The usage quality is marked as manually entered.

A method code denoting that the provision method was “typed in by health care professional” and method code denoting that performer was not “health care professional”

Provision method of measurement was marked as typed by healthcare professional, it is not possible to reflect this in the FHIR model. The usage quality is marked as manually entered.

A method code denoting that the provision method was “typed in by care giver” and method code denoting that performer was not “care giver”

Provision method of measurement was marked as typed by caregiver, it is not possible to reflect this in the FHIR model. The usage quality is marked as manually entered.

A method code denoting that the provision method was “typed in by citizen” and method code denoting that performer was not “citizen”

Provision method of measurement was marked as typed by citizen, it is not possible to reflect this in the FHIR model. The usage quality is marked as manually entered.

A method code denoting that the performer is care giver

It is not possible to discern between care giver and health care professional in the FHIR model. The method code indicated the performer was a care giver.

A method code denoting that the performer is health care professional

It is not possible to discern between care giver and health care professional in the FHIR model. The method code indicated the performer was a health care professional.

A method code denoting the performer is missing

Measurement performer code is missing

The confidentiality code is missing

Confidentiality code is missing

The confidentiality code is not “N”

Confidentiality code is not supported

A measurement with a value interval

Measurement contained an interval value. This was not translated to an observation since it is not supported in FHIR

Transformation from QRD Details

The QRD transformation entails transformation of the CDA Header (see above) as well as QRD-specific parts described below.

Matching between FHIR Questionnaire, FHIR QuestionnaireResponse and QFDD

Just like the FHIR QuestionnaireResponse must be structurally consistent with the FHIR Questionnaire, the QRD must be structurally consistent with the QFDD. It follows that transformation of a FHIR QuestionnaireResponse to a QRD implies that the FHIR Questionnaire must be an approximation of the QFDD.

The following are prerequisites for a FHIR Questionnaire (shortened Questionnaire and covering both the ehealth-questionnaire and ehealth-questionnaire-advanced profiles) to be an approximation of a QFDD:

  1. At root level of the FHIR Questionnaire, the number of question groups (Questionnaire.item with item.type set to group) shall match the number of QFDD sections for all but QFDD copyright section.

    • Rationale: Copyright is placed in Questionnaire.copyright.

  2. For each QFDD section except Information Only sections, the number of FHIR Questionnaire subgroups (Questionnaire.item.item with item.type set to group) shall match the number of QFDD organizers inside the section.

    • The Questionnaire.item.item.externalIdentifier (on a subgroup) shall match the QFDD organizer id.

  3. For each QFDD question within an organizer there shall be a FHIR Questionnaire question item (Questionnaire.item.item.item)

    • The Questionnaire.item.item.item.externalIdentifier shall match the QFDD question id.

    • A QFDD question with associated text shall have the associated text represented as a separate FHIR Questionnaire question item (Questionnaire.item.item.item)

  4. Calculation type Questionnaire.item at any level are allowed in the FHIR Questionnaire without counterpart in the QFDD

    • Rationale: Calculations and formulas are not represented in QFDD.

 

Overall these prerequisites for approximation of QFDD ensures that the FHIR Questionnaire is structurally compatible with QFDD. In addition, groups, subgroups and questions must have the same ids and the same order. Also, the use of coded values for questions, answer options, and possibly subgroups must be identical.

The QFDD organizer/question id is matched to the corresponding item in a FHIR Questionnaire by item.item.item.extension.externalIdentifier. The Questionnaire.item.linkId is compared with QuestionnaireResponse.item.linkId (at any level, that is also for Questionnaire.item.item and .item.item.item) to locate the same item in the QuestionnaireResponse.

Validation

As part of the transformation from FHIR QuestionnaireResponse to QRD, validation of the QFDD approximation prerequisites is performed.

QRD-specific CDA Header

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Documentation Time Interval

/ClinicalDocument/documentationOf/serviceEvent/effectiveTime/low

QuestionnaireResponse.effectivePeriod.start

/ClinicalDocument/documentationOf/serviceEvent/effectiveTime/high

QuestionnaireResponse.effectivePeriod.end

Author

/ClinicalDocument/author

QuestionnaireResponse.source

The referenced resource type depends on the following:

  • if author/id is a CPR number and the same as in /ClinicalDocument/recordTarget/patientRole (the Patient), then QuestionnaireResponse.source references a Patient;

  • otherwise if author/id is a CPR number but different than in /ClinicalDocument/recordTarget/patientRole (the Patient), then QuestionnaireResponse.source references a Person;

  • otherwise if author/id is a SOR Id, then QuestionnaireResponse.source references a Practitioner;

Author

/ClinicalDocument/dataEnterer/assignedEntity

QuestionnaireResponse.author

The referenced resource type depends on the following:

  • if dataEnterer/assignedEntity/id is a CPR number and same as in /ClinicalDocument/recordTarget/patientRole (the Patient), then QuestionnaireResponse.author references a Patient;

  • otherwise if dataEnterer/assignedEntity/id is a CPR number and different than the one in /ClinicalDocument/recordTarget/patientRole, then QuestionnaireResponse.author references a Person;

  • otherwise if dataEnterer/assignedEntity/id is a SOR Id, then QuestionnaireResponse.author references a Practitioner;

Information Only Section

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Information Only Section

/ClinicalDocument/component/structuredBody/component/section

  • A root item on Questionnaire.item with Questionnaire.item.type: "group"

    • A child item with type: Questionnaire.item.type: "display"

Title

…/component/section/title

From root item Questionnaire.item.text else QFDD section title (…/component/section/title)

Narrative

…/component/section/text

QFDD text (…/component/section/text)

Language

languageCode

Questionnaire.language

Questionnaire Response Section

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Questionnaire Response Section

/ClinicalDocument/component/structuredBody/component/section

A root item on Questionnaire.item with Questionnaire.item.type: "group"

Title

…/component/section/title

From root item Questionnaire.item.text else QFDD section title (…/component/section/title)

Narrative

…/component/section/text

QFDD text (…/component/section/text)

The narrative (QFDD text) from the QFDD section is updated with answers before being assigned to the QRD section text.

Language

languageCode

Questionnaire.language

Response Organizer

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Response Organizer

/ClinicalDocument/component/structuredBody/component/section/entry/organizer

An item of type item.type: "group" inside a root item of type Questionnaire.item.type: "group".

Only items of type item.type: "group" are allowed at the level below the root item.

OBS: Items with calculated expression are allowed but is ignored during transformation.

Id

…/section/entry/organizer/id

QFDD id (…/section/entry/organizer/id).

Validating if item(item.extension.externalIdentifier) inside subgroup matches QFDD organizer id.

Code

…/section/entry/organizer/code

Uses code from Questionnaire item item.code

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Numeric Response Pattern Observation

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Numeric Response Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup

  • Root item with Questionnaire.item.type: "group" (QRD section)

    • Sub group item with item.type: "group" (QRD organizer)

      • Question item

Numeric Response if

Id

…/observation/id

Uses Id from QFFD question

Validating if Questionnaire item(item.extension.externalIdentifier) matches QFDD question id

Code

…/observation/code

Uses code from Questionnaire item item.code

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Answer

…/observation/value

Value: QuestionnaireResponse.item.answer

For Questionnaire.item.type = integer, the question answer value is from QuestionnaireResponse.item.answer.valueInteger.

For Questionnaire.item.type = decimal, the question answer value is from QuestionnaireResponse.item.answer.valueDecimal.

For Questionnaire.item.type = datetime, the question answer value is from QuestionnaireResponse.item.answer.valueDateTime (formatted as YYYYMMDDHHmmssZ).

QRD Type:

  • Questionnaire.item.type equal Integer then 'INT'

  • Questionnaire.item.type equal Decimal then ‘REAL’

  • Questionnaire.item.type equal DateTime then 'TS'

Help text

Image

…/observation/entryRelationship

Is added if Questionnaire item has one or more extensions:

External reference

…/observation/reference

The QFDD unique id. From id element and the property 'extension'

Range

…/observation/referenceRange

If Questionnaire.item has the following extension the referenceRange is assigned

Analog Slider Response Pattern Observation

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Analog Slider Response Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup

  • Root item with type: “Group” (QRD section)

    • Sub group item with type: “Group” (QRD organizer)

      • Question item

Analog Slider Response if

Properties: id, code, value, entryRelationship and reference is the same configuration as for numeric Response

Id

…/observation/id

Uses Id from QFFD question

Validating if Questionnaire item(item.extension.externalIdentifier) matches QFDD question id

Code

…/observation/code

Uses code from Questionnaire item item.code

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Answer

…/observation/value

Value: QuestionnaireResponse.item.answer .

For Questionnaire.item.type = integer, the question answer value is from QuestionnaireResponse.item.answer.valueInteger.

For Questionnaire.item.type = decimal, the question answer value is from QuestionnaireResponse.item.answer.valueDecimal.

Type:

  • Questionnaire.item.type equal Integer then 'INT'

  • Questionnaire.item.type equal Decimal then ‘REAL’

Help text

Image

…/observation/entryRelationship

Is added if Questionnaire item has one or more extensions:

External reference

…/observation/reference

The QFDD unique id. From id element and the property 'extension'

Range

…/referenceRange/observationRange/

Denominator: item.extension http://hl7.org/fhir/StructureDefinition/maxValue

Head: item.extension http://hl7.org/fhir/StructureDefinition/minValue

Increment: item.extensioneither value from questionnaire-sliderStepValue or ehealth-questionnaire-sliderStepValueDecimal

Text Response Pattern Observation

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Text Response Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup

  • Root item with type: “Group” (QRD section)

    • Sub group item with type: “Group” (QRD organizer)

      • Question item

Test Response if

  • item.type is either text, string or openchoice

 

Id

…/observation/id

Uses Id from QFFD question

Validating if Questionnaire item(item.extension.externalIdentifier) matches QFDD question id

Code

…/observation/code

Uses code from Questionnaire item item.code

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Answer

…/observation/value

Value: QuestionnaireResponse.item.answer .

For Questionnaire.item.type = text, string or openchoice , the question answer is a text string in QRD. Question answer text is from QuestionnaireResponse.item.answer.valueString.

Type: ST

Help text

Image

…/observation/entryRelationship

Is added if Questionnaire item has one or more extensions:

External reference

…/observation/reference

Value from QFDD. From id element and the property 'extension'

Multiple Choice Response Pattern Observation

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Multiple Choice Response Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup

  • Root item with type: “Group” (QRD section)

    • Sub group item with type: “Group” (QRD organizer)

      • Question item

Multiple Choice Response if

Id

…/observation/id

Uses Id from QFFD question

Validating if Questionnaire item(item.extension.externalIdentifier) matches QFDD question id

Code

…/observation/code

Uses code from Questionnaire item item.code

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Answer

…/observation/value

Value: from QuestionnaireResponse.item.answer .

For Questionnaire.item.type = choice , the question answer(s) is one or more coded elements in QRD. Question answer code is from QuestionnaireResponse.item.answer.valueCoding.

Code: answer.code

CodeSystem: if answer.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: answer.display

Help text

Image

Associated text question

…/observation/entryRelationship

Is added if Questionnaire item has one or more extensions:

And if QFDD has associated text question and preconditions are fulfilled.

Structure for associated text question in FHIR Questionnaire:

  • Root item with type: “Group” (QRD section)

    • Sub group item with type: “Group” (QRD organizer)

      • Question item with type: “choice“

      • Associated text question item (The item must be right after the question)

        • Question item with either type: “string“ or “text”.

OBS: Supported precondition for Associated text question:

  • Only one precondition element

  • The precondition is only based on answers from the related multiple choice (no reference to other questions)

  • Supported groupers inside the one preconditon element

    • AllTrue

    • AllFalse

    • AtLeastOneTrue

    • AtLeaseOneFalse

    • OnlyOneTrue

    • OnlyOneFalse

External reference

…/observation/reference

The QFDD unique id. From id element and the property 'extension'

Range

…/observation/referenceRange

If Questionnaire.item has the following extension the referenceRange is assigned

Discrete Slider Response Pattern Observation

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Discrete Slider Response Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup

  • Root item with type: “Group” (QRD section)

    • Sub group item with type: “Group” (QRD organizer)

      • Question item

Multiple Choice Response if

Id

…/observation/id

Uses Id from QFFD question

Validating if Questionnaire item(item.extension.externalIdentifier) matches QFDD question id

Code

…/observation/code

Uses code from Questionnaire item item.code.

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Value

…/observation/value

Value: from QuestionnaireResponse.item.answer .

For Questionnaire.item.type = choice , the question answer is one coded element in QRD. Question answer code is from QuestionnaireResponse.item.answer.valueCoding.

Code: Coding.code

CodeSystem: if Coding.system has prefix “urn:oid:” then Coding.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: Coding.display

Max occurrence

Min occurrence

Help text

Image

…/observation/entryRelationship

Low: http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs

High: http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs always 1 (1 only allowed value for Discrete Slider type)

Is added if Questionnaire item has one or more extensions:

QFDD reference

…/observation/reference

The QFDD unique id. From id element and the property 'extension'

Copyright Section

Logical Part

QRD Document

Details

Logical Part

QRD Document

Details

Copyright Section

/ClinicalDocument/component/structuredBody/component/section

Copyright section is copied directly from the QFDD


Supported types

FHIR Questionnaire.item.type

QRD Response Pattern Observation

FHIR Questionnaire.item.type

QRD Response Pattern Observation

text, string

Text Response Pattern Observation

choice

Multiple Choice Response Pattern Observation

Discrete Slider Response Pattern Observation (when Questionnaire.item.extension.itemControl has value 'slider' and Questionnaire.item.maxOccurs = 1)

decimal, integer

Numeric Response Pattern Observation

Analog Slider Response Pattern Observation (when Questionnaire.item.extension.itemControl has value 'slider' )

datetime

Numeric Response Pattern Observation

Transformation from QFDD Details

The QFDD transformation entails transformation of the CDA Header (see above) as well as QFDD-specific parts described below.

Overall and except for certain details described below, the structure of the Questionnaire must match the structure of the QFDD.

This means that the structure rules below must be adhere to and that information sections/groups and questions must be in the same order.

QFDD Element

FHIR Questionnaire

Comment

QFDD Element

FHIR Questionnaire

Comment

Information Only Section

A Questionnaire.item at root level with Questionnaire.item.type ="group"

A single child item Questionnaire.item.item with .type = "display"

 

Question Section (with one or more Question Organizer)

A Questionnaire.item at root level with Questionnaire.item.type ="group"

For each QFDD Question Organizer:

A single child item Questionnaire.item.item with .type = "group"

For each question in the group/QFDD Question Organizer:

A single child item Questionnaire.item.item.item with .type = subtype of "question" eg. ‘decimal’

 

Not transformed as algorithms and expressions are not supported in QFDD.

A Questionnaire.item at any level with .type = "decimal" and .readOnly = "true"

A Calculated expression within the questionnaire, see https://ehealth-dk.atlassian.net/wiki/spaces/EDTW/pages/1716060177/Managing+Questionnaires#Defining-a-Calculation-Expression


To QFDD Transformation

The operation $transform-to-QFDD transforms a FHIR Questionnaire resource to a DK-HL7 Questionnaire Form Definition Document (QFDD). The section below describes the transformation in more details.

Structure

As a QFDD is structured by sections, organizers and questions, the FHIR Questionnaire must be structured in a specified way to match the QFDD definition. The table below gives a quick overview of the structure.

QFDD Element

FHIR Questionnaire

Comment

QFDD Element

FHIR Questionnaire

Comment

Information Only Section

A Questionnaire.item at root level with Questionnaire.item.type ="group"

A single child item Questionnaire.item.item with .type = "display"

 

Question Section (with one or more Question Organizer)

A Questionnaire.item at root level with Questionnaire.item.type ="group"

Root-level group

For each QFDD Question Organizer:

A single child item Questionnaire.item.item with .type = "group"

Subgroup of root-level group

For each question in the group/QFDD Question Organizer:

A single child item Questionnaire.item.item.item with .type = subtype of "question" for instance "decimal"

Question type item in subgroup of root-level group.

For subtypes of "question" see http://hl7.org/fhir/R4/valueset-item-type.html

Copyright Section

A Questionnaire.item at root level with:

  • Questionnaire.item.type ="group"

  • Questionnaire.item.isCopyright = true (see isCopyright)

One or more child items Questionnaire.item.item with:

  • Questionnaire.item.item.type = "display"

  • Questionnaire.item.item.isCopyright = true

 

Not transformed as algorithms and expressions are not supported in QFDD.

A Questionnaire.item at any level with an .extension http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression and .readOnly = "true"

A Calculated expression within the FHIR Questionnaire, see https://ehealth-dk.atlassian.net/wiki/spaces/EDTW/pages/1716060177/Managing+Questionnaires#Defining-a-Calculation-Expression

The sub sections below describe the structure and information needed in more details.

Information Only Section

Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Information Only Section

/ClinicalDocument/component/structuredBody/component/section

(with (./templateId root = "2.16.840.1.113883.10.20.32.2.1")

A root-level item with:

  • Questionnaire.item.type = "group"

  • Title

…/component/section/title

  • Questionnaire.item.text containing the group title

  • Narrative

…/component/section/text

A child item in the group with:

  • Questionnaire.item.item.type = "display"

  • Questionnaire.item.item.text.xhtml = formatted text

  • (Questionnaire.item.item.text contains the unformatted equivalent)

  • Language

/ClinicalDocument/languageCode

Questionnaire.language

Narrative guidelines and limitations

FHIR Questionnaire.item.text.xhtml has type XHTML and QFDD narrative has type XML Markup. Therefore the transformation must convert XHTML to XML Markup which is performed with limitations as described below.

Limitations on conversion of formatted text from FHIR XHTML to XML Markup

The converter supports:

  • Paragraphs

  • Headings - converts to paragraphs

  • Bold, italics, underline

  • Ordered and unordered list

  • Line break

  • Table (might not support all functionality)

  • Anchor tag  ( from a  -> linkHTML)

  • Span (converted to content)

  • Subscript and superscript

Be aware:

  • Stylings like color are not supported.

  • A single root div shall be present

Sanitizer

Questionnaire Form Definition Section

Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Questionnaire Response Section

/ClinicalDocument/component/structuredBody/component/section

A root item on Questionnaire.item with Questionnaire.item.type: "group"

Title

…/component/section/title

From root item Questionnaire.item.text

Narrative

…/component/section/text

The narrative text for the section is created automatically by the transformation . The narrative contains all the questions inside the section.

Additional narrative content:

  • Help text

  • Images

Language

languageCode

Questionnaire.language

Questions Organizer

Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Response Organizer

/ClinicalDocument/component/structuredBody/component/section/entry/organizer

An item of type item.type: "group" inside a root item of type Questionnaire.item.type: "group". (See Questionnaire Form Definition Section)

Only items of type item.type: "group" are allowed at the level below the root item.

OBS: Items with calculated expression are allowed but is ignored during transformation.

Id

…/section/entry/organizer/id

item.item.extension.externalIdentifier

Code

…/section/entry/organizer/code

Uses code from Questionnaire item item.code

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Precondition

…/section/entry/organizer/precondition

See Preconditions

Numeric Question Pattern Observation

Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Numeric Response Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup (see Questions Organizer )

  • Root item with Questionnaire.item.type: "group" (QFDD section)

    • Sub group item with item.type: "group" (QFDD organizer)

      • Question item

Numeric Response if

Id

…/observation/id

item.extension.externalIdentifier

Code

…/observation/code

Uses code from Questionnaire item item.code

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Help text

Image

…/observation/entryRelationship

Is added if Questionnaire item has one or more extensions:

Feedback

…/observation/entryRelationship

Not supported

Range

…/observation/referenceRange

If Questionnaire.item has the following extension the referenceRange is assigned

Precondition

 

See Preconditions

Analog Slider Question Pattern Observation

Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Analog Slider Question Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup

  • Root item with type: “Group” (QFDD section)

    • Sub group item with type: “Group” (QFDD organizer)

      • Question item

Analog Slider if

Properties: id, code, help text, image and precondition is the same configuration as for Numeric Question

Feedback

…/observation/entryRelationship

Not supported

Range

…/referenceRange/observationRange/

Denominator: item.extension http://hl7.org/fhir/StructureDefinition/maxValue

Head: item.extension http://hl7.org/fhir/StructureDefinition/minValue

Increment: item.extensioneither value from:

Text Question Pattern Observation

Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Text Question Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup

  • Root item with type: “Group” (QFDD section)

    • Sub group item with type: “Group” (QFDD organizer)

      • Question item

Test Response if

  • item.type is either text, string

 

Id

…/observation/id

item.extension.externalIdentifier

Code

…/observation/code

Uses code from Questionnaire item item.code

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Help text

Image

…/observation/entryRelationship

Is added if Questionnaire item has one or more extensions:

Precondition

 

See Preconditions

Multiple Choice Question Pattern Observation

Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Multiple Choice Question Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup

  • Root item with type: “Group” (QFDD section)

    • Sub group item with type: “Group” (QFDD organizer)

      • Question item

Multiple Choice if

Id

…/observation/id

item.extension.externalIdentifier

Code

…/observation/code

Uses code from Questionnaire item item.code

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Options

 

item.answerOptions

Help text

Image

…/observation/entryRelationship

Is added if Questionnaire item has one or more extensions:

Associated text question

 

Not supported

Feedback

 

Not supported

Range

…/observation/referenceRange

Range is based on item and the fields item.required , item.repeats and the following extensions.

See more regarding min and max: https://docs.ehealth.sundhed.dk/latest-released/ig/StructureDefinition-ehealth-questionnaire.html#setting-minimal-and-maximal-number-of-permitted-choices

Precondition

 

See Preconditions

Discrete Slider Question Pattern Observation

Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Discrete Slider Question Pattern Observation

/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component/observation

An item inside a subgroup

  • Root item with type: “Group” (QFDD section)

    • Sub group item with type: “Group” (QFDD organizer)

      • Question item

Multiple Choice if

Properties: id, code, help text, image and precondition is the same configuration as for Multiple Choice

Id

…/observation/id

Uses Id from QFFD question

Validating if Questionnaire item(item.extension.externalIdentifier) matches QFDD question id

Code

…/observation/code

Uses code from Questionnaire item item.code.

Code: item.code.code

CodeSystem: ifitem.code.system has prefix “urn:oid:” then item.code.system without prefix. Else lookup in Questionnaire Terminology.

CodeSystemName: is fetched from CodeSystem in Questionnaire Terminology. Value is taken in the following order: codeSystem.title, codeSystem.name, codeSystem.url or “Unknown“.

Display: item.text or else item.code.display

OriginalText: Question text (item.text) or, if not present, (item.code.display)

Range

…/observation/entryRelationship

Range is based on item and the fields item.required , item.repeats and the following extensions.

Low: http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs

High: http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs always 1 (1 only allowed value for Discrete Slider type)

See more regarding min and max: https://docs.ehealth.sundhed.dk/latest-released/ig/StructureDefinition-ehealth-questionnaire.html#setting-minimal-and-maximal-number-of-permitted-choices

Copyright Section

 

Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Copyright Section

/ClinicalDocument/component/structuredBody/component/section

Copyright section uses Questionnaire.copyright


Logical Part

QFDD Document

Details

Logical Part

QFDD Document

Details

Copyright Section

/ClinicalDocument/component/structuredBody/component/section

(with (./templateId root = "2.16.840.1.113883.10.20.32.2.2")

A root-level item with:

  • Questionnaire.item.type = "group"

  • Questionnaire.item.isCopyright = true

Title

…/component/section/title

  • Questionnaire.item.text containing the group title

Narrative

…/component/section/text

The narrative is automatically generated by the transformation and contains the plain text from each copyright text(entry) separated by three <br/>.

Note: When transforming from QFDD to FHIR Questionnaire the narrative is not transformed.

Entry

../entry/observation/value

One or more child items in the group with:

  • Questionnaire.item.item.type = "display"

  • Questionnaire.item.item.text.xhtml = formatted text

  • (Questionnaire.item.item.text contains the unformatted equivalent)

  • Questionnaire.item.item.isCopyright = true

Note: When transforming from QFDD the display items will contain the plain text.

  • Language

/ClinicalDocument/languageCode

Questionnaire.language


Supported types

FHIR Questionnaire.item.type

QRD Response Pattern Observation

FHIR Questionnaire.item.type

QRD Response Pattern Observation

text, string

Text Question Pattern Observation.

choice

Multiple Choice Question Pattern Observation.

Discrete Slider Question Pattern Observation when Questionnaire.item.extension.itemControl has value 'slider'.

decimal, integer

Numeric Question Pattern Observation.

Analog Slider Question Pattern Observation when Questionnaire.item.extension.itemControl has value 'slider'.

datetime

Numeric Question Pattern Observation

Validation

The returned Bundle from the operation can contain an OperationOutcome with warnings and errors. In case of validation errors no QFDD will be generated.

Errors

Errors can occur if for instance some mandatory information is missing or the FHIR questionnaire structure is not compatible with the QFDD structure.

Examples:

  • Invalid root item in questionnaire. Only items of type 'group' and calculated expression items are allowed. Type was: '%s'. LinkId: %s

  • NamingSystem publisher is missing. Oid: '%s'. Referenced by items with following LinkIds: %s

  • Item enableWhen refers to item with linkId: '%s' which is of type '%s' but the operator: '%s' is not supported. LinkId: %s

Warnings

Warnings can occur if some information is missing but not mandatory or maybe a fallback value is used instead.

Examples:

  • CodeSystem title is missing. Will use the first non-null value as CodeSystemName: 'NamingSystem.name', 'NamingSystem.url' or 'unknown'. CodeSystem url: '%s'. Used by items with the following linkIds: %s

  • CodeSystem title is missing for choice option. Will use the first non-null value as CodeSystemName: 'NamingSystem.name', 'NamingSystem.url' or 'unknown'. CodeSystem url: '%s'. LinkIds: %s

Preconditions

In some scenarios a questions should only be asked to the user based on answers given to other questions. The sections below describes the rules and limitations regarding preconditions.

Precondition rules

As the modeling of preconditions in FHIR questionnaire and QFDD is not 1 to 1 the table below describes which combination of preconditions that are supported.

Question refers to question of type

Condition

 

Question refers to question of type

Condition

 

Numeric (FHIR type: integer, decimal, timestamp)

If specifying both  ">=" and "<=" to the same question then

  • if ">=" value is larger than "<=" value (eg. <=7 or >=10) then

    • Only "any"(AtLeastOneTrue) is allowed

    • Only those two conditions are allowed to the same numeric question.

    • Will be two preconditions in QFDD with min and max as QFDD requires both min and max per precondition. (Precondition Extension Pattern - AtLeastOneTrue)

      • For ">=" a max value will be added

        • For integer: Integer max value.

        • For decimal: Double max value.

        • For timestamp: January 1. 2200.

      • For "<=" a min value

        • For integer: Integer min value.

        • For decimal: Double min value.

        • For timestamp: January 1. 1970.

  • if ">=" value is less than "<=" value (absolute range, eg. >=5 <=10) then

    • Only "all" (AND) is allowed.

    • Only those two conditions are allowed to the same question.

    • Will be one preconditions in QFDD with min and max.

If specifying only one operator either ">=" or "<=" to the same numeric question then

  • Then "all"(AND) and "any"(OR) is allowed

  • Max one condition to the same numeric question allowed.

  • As QFDD requires both min and max

    • For ">=" a max value will be added

      • For integer: Integer max value.

      • For decimal: Double max value.

      • For timestamp: January 1. 2200.

    • For "<=" a min value will be added

      • For integer: Integer min value.

      • For decimal: Double min value.

      • For timestamp: January 1. 1970. (epoch time)

if specifying "=" to a numeric question then

  • Then "all"(AND) and "any"(OR) is allowed.

  • Max one condition to the same numeric question allowed.

  • As QFDD requires both min and max.

    • min and max will be assigned the same value.

Choice (FHIR type: choice)

When specifying "=" to a choice question then

  • If only conditions to choice questions then both AllTrue(all) and AtLeastOneTrue(any) is allowed.

  • If the conditions are combined with conditions to numeric questions then the numeric rules determines if both AllTrue(all) and AtLeastOneTrue(any) is allowed.

text, string

 

Precondition to text or string questions are not supported.

Precondition is only allowed on FHIR sub groups(item.item (QFDD organizer)) and questions (item.item.item (QFDD Question)).

If enablebehavior is ‘all’(AllTrue) and no condition-id is specified then the preconditions will be created as QFDD Criterion(s). If condition-id is specified and/or the boolean expression is either ‘all’(AllTrue) or ‘any’(AtLeastOneTrue) then the preconditions will be created as QFDD Precondition Extension Pattern.

Supported operators

FHIR Questionnaire (enableWhen operators)

Comments

FHIR Questionnaire (enableWhen operators)

Comments

exists

Not supported

=

Supported.

If numeric:

  • min/max same value in QFDD

If multiple choice

  • The option

!=

Not supported

>

Not supported

<

Not supported

>=

if numeric:

  • Supported

    • Used a minimum value in QFDD

If multiple choice

  • Not supported

<=

if numeric:

  • Supported

    • Used as maximum value in QFDD

If multiple choice

  • Not supported

From QFDD Transformation

The operation $transform-from-QFDD transforms a DK-HL7 Questionnaire Form Definition Document (QFDD) to a FHIR Questionnaire resource. The below sections describes the transformation in more details.

Structure

The transformation generates a FHIR questionnaire which structure is describes in below table. See more details regarding the structure here https://ehealth-dk.atlassian.net/wiki/spaces/EDTW/pages/edit-v2/2242281473#Structure.

QFDD Element

FHIR Questionnaire

Comment

QFDD Element

FHIR Questionnaire

Comment

Information Only Section

A Questionnaire.item at root level with Questionnaire.item.type ="group"

A single child item Questionnaire.item.item with .type = "display"

 

Question Section (with one or more Question Organizer)

A Questionnaire.item at root level with Questionnaire.item.type ="group"

For each QFDD Question Organizer:

A single child item Questionnaire.item.item with .type = "group"

For each question in the group/QFDD Question Organizer:

A single child item Questionnaire.item.item.item with .type = subtype of "question" eg. ‘decimal’

 

Copyright Section

A Questionnaire.item at root level with:

  • Questionnaire.item.type ="group"

  • Questionnaire.item.isCopyright = true (See isCopyright)

One or more child items Questionnaire.item.item with:

  • Questionnaire.item.item.type = "display"

  • Questionnaire.item.item.isCopyright = true

 

Not transformed as algorithms and expressions are not supported in QFDD.

A Questionnaire.item at any level with an .extension http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression and .readOnly = "true"

A Calculated expression within the questionnaire, see https://ehealth-dk.atlassian.net/wiki/spaces/EDTW/pages/1716060177/Managing+Questionnaires#Defining-a-Calculation-Expression

Details regarding converting from CDA XML Markup to XHTML - Information Only Section

All CDA XML elements are supported but with some exceptions,

CDA XML element

FHIR XHTML

CDA XML element

FHIR XHTML

footnote

p, with a data attribute: data-cda-tag = "footnote"

footnoteRef

a, with a data attribute data-cda-tag="footnoteRef"

renderMultiMedia

Limitation: The base64 image to be inside @referencedObject attribute, and not a reference to an existing image from other section from QFDD document. We don't search the image.

Attributes:

CDA XML attributes

Comment

CDA XML attributes

Comment

revised

Attribute on <content> in CDA XML has no corresponding match in XHTML. A custom data attribute has been added ‘data-cda-revised’.

name

Attribute on <linkHTML> is not supported as NarrativeBlock documentation states “DO NOT USE THIS”.

language

Always assigned lang=”da”.

mediaType

Omitted. From NarrativeBlock documentation: mediaType is akin to mimeType. This is a fixed value in the CDA narrative block, and so can be omitted.

Validation

The returned Bundle from the operation can contain an OperationOutcome with information, warnings and errors. In case of validation errors no FHIR questionnaire will be generated.

Errors

Errors can occur if for instance some mandatory information is missing or QFDD content is not supported in FHIR questionnaire.

Examples:

  • Unsupported question type: '%s' (safeguard against future question types supported in CDA Builder. Currently(August 2024) all question types are supported)

  • Choice option is missing either code, codeSystem. Question id: %s

  • Question is missing id. Organizer id: %s

  • Precondition group type: '%s' is not supported. Question id: %s

  • Precondition group type: '%s' is not supported for conditions referring to numeric questions. Only 'AllTrue' is supported. Question id: %s

Warnings

Warnings can occur if some information is missing but not mandatory or content which will not be transformed as it is not supported.

Examples:

  • Numeric question has no interval. Cannot determine type. Setting item.type to 'decimal'. Question id: %s

  • Feedback will not be transformed to FHIR questionnaire. Question id: %s

Information

Message unrelated to the transformation success.

Examples:

  • Question with id: '%s' has associated text question with id: '%s'. The questions will be split into two separate question items in Fhir questionnaire.

Preconditions

In some scenarios a questions should only be asked to the user based on answers given to other questions. The sections below describes the rules and limitations regarding preconditions.

Precondition rules

As the modeling of preconditions in FHIR questionnaire and QFDD is not 1 to 1 the table below describes which combination of preconditions that are supported.

Condition

Rules

Condition

Rules

If one or more precondition refers to numeric question then

AllTrue(all) is supported.

If no precondition refers to a numeric question then

AllTrue(all) and AtLeastOneTrue(any) is supported.

Not supported:

  • The following precondition types is not supported: AllFalse, AtLeastOneFalse, OnlyOneTrue, OnlyOneFalse.

  • Multiple grouper (Only one grouper is supported eg. AllTrue).

Additional information

  • Associated text question which can be part of Multiple Choice and Discrete Slider question will be created as two items in FHIR questionnaire. The item for the associated text question will contain the preconditions specified in the QFDD.

  • As QFDD Numeric Question do not have a type, reference range is used to determine if it is integer, decimal or timestamp. If no reference range is specified the question item is created with item.type ‘decimal’.

  • Analog Slider Question is created with item.type ‘decimal’.

  • Feedback is not supported