Performing Document Query/Retrieve and Transforming to/from Documents

The eHealth Infrastructure provides integrations to the Danish national document sharing infrastructure.

The national document sharing infrastructure is based on Integrating the Health Enterprise (IHE) Cross-enterprise Document Sharing (XDS-b) profiles and makes use of 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 retrieve 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 transformations 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 document sharing infrastructure . The transformations to FHIR resources can be used by a client performing XDS-b document metadata query and document retrieving.

Performing Document Query and Document Retrieve

The Danish National Service Platform (NSP) in Healthcare provides a Document Sharing Service (Danish: Dokumentdelingsservice DDS) which provides the following operations described in https://profiles.ihe.net/ITI/TF/Volume1/ch-10.html:

  • Registry Stored Query (known as XDS-b transaction ITI-18) which given query parameters such as patient identification and time period (and more), returns matching document metadata, possibly zero, one or more.

  • Retrieve Document Set (known as XDS-b transaction ITI-43) which given parameters identifying the document (based on document metadata), returns possibly zero, one or more documents.

Further details on how the NSP DDS processes ITI-18 and ITI-43 requests, including possibly withholding data due to patient’s consents (Danish: Min Spærring) are described in Danish at https://www.nspop.dk/x/WJC6.

 

Use of these operations is fronted by the following eHealth infrastructure operations provided by the document-query service:

Document metadata query is a precursor for actually retrieving a document.

While the XDS-b transaction ITI-43 Retrieve Document Set supports retrieval of multiple documents, the $retrieve-document supports retrieve of a single document only.

Provided Transformations between FHIR resources and Danish CDA Profiles

Details on the transformations are included in the table below containing references to Danish CDA profiles for which further details are given in the table further below.

The transformations are:

  • idempotent (except for generated identifiers such as CDA document id in output)

  • provide no access to any FHIR resources - they require that the client provides the necessary FHIR resources as input. This is by design in order to prevent security breach.

 

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

Bundle of FHIR resources.

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

 

Bundle of FHIR resources.

Primary source of information is a 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

Bundle of FHIR resources.

Primary source of information is a FHIR Questionnaire.

QFDD v1.1 XML document

 

$transform-to-APD

Bundle of FHIR resources.

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

PHMR v1.3 XML document.

Bundle of FHIR resources.

Most significant information is within a FHIR Observation.

The resulting Observation(s) is not guaranteed to be a valid FHIR Observation.

$transform-from-QRD

QRD v1.3 XML document

Bundle of FHIR resources.

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

Please note that the description of the operation is valid as of v3.0.0 of the eHealth Infrastructure Implementation Guide (IG) even though the link is to the IG continuous build. Please refer to the latest released version of the IG for all other purposes.

QRD v1.3 XML document

Bundle of FHIR resources

Most significant information is within a FHIR QuestionnaireResponse with a structure matching the Questionnaire given as input. The QuestionnaireResponse will have linkIds matching the corresponding Questionnnaire.

The resulting QuestionnaireResponse is not guaranteed to be a valid FHIR QuestionnaireResponse.

$transform-from-QFDD

QFDD v1.1 XML document

Bundle of FHIR resources.

Primary source of information is a FHIR Questionnaire.

 

$transform-from-APD

APD v2.0 XML document

Bundle of FHIR resources.

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 per 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 v1.1

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

Draft,
Release 1.1 May 19th 2015,
Updated September 28th 2016

http://svn.medcom.dk/svn/releases/Standarder/HL7/PRO/QFDD/Dokumentation/DK-QFDD-v1.1.pdf

(Note: The available v1.1 is now updated as per June 11, 2021)

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 in order 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 in principle 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 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

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)

  • attester is created if episodeOfCare.caremanagerOrganization is present with:

    • mode set to Composition.CompositionAttestationMode.LEGAL,

    • party set to episodeOfCare.CareManagerOrganization

    • time set to time of assembly

Practitioner/Patient/RelatedPerson/Organization

Author of observation note

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

Practitioner (possibly referenced from Observation.performer)

Observation performer

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

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

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

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 context of the Author Organization (which is not necessarily the case).

Organization (referenced from ClinicalImpression.assessorOrganization)

Author organization

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

  • If sharing approval is manual this is the organization from the approvers 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 registering of QRD.

  • The Questionnaire.identifier can contain multiple identifiers but only the identifier for QFDD is allowed to have an Identifier.system starting with 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.

Transformation Details

CDA Header Transformation Details

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

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 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 patient and id will be CPR number.

If QuestionnaireResponse.source is a practitioner , the author is practitioner and id 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 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

 

PHMR Transformation Details

The PHMR transformation entails transformation of the CDA Header (see above) as well as 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 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 is 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 )

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 decimal (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

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.

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 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 matching:
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 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 healthcare professional)

TPH (typed in by 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 a 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 value (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 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 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.

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.

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

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

CPR is mandatory for patient but not present in 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 Practitioner

Composition.authorOrganization does not contain SOR identifier.

Composition.authorOrganization must contain SOR identifier

Composition.attester organization does not contain SOR identifier.

Composition.attester.party must contain SOR identifier

Composition.custodian organization does not contain 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

 

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

Can't generate narrative for: medical equipment OR

Can't generate narrative for: results

QRD Transformation 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.

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)

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'

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, openchoice

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

QFDD Transformation 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"

 

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