Giter Site home page Giter Site logo

cda-fhir-maps's People

Contributors

oliveregger avatar robeastwood-agency avatar ziegm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cda-fhir-maps's Issues

Wrong URL for ATC-CodeSystem

In the element Medication.ingredient a wrong URL is generated as CodeSystem

  • OID: 2.16.840.1.113883.6.73
  • wrong: <system value="http://hl7.org/fhir/sid/atc"/>
  • correct: <system value="http://www.whocc.no/atc"/>

FHIR CodeSystem (external)

<itemCodeableConcept>
    <coding>
      <system value="http://hl7.org/fhir/sid/atc"/>
      <code value="C08CA01"/>
      <display value="amlodipine"/>
   </coding>
   <text value="amlodipine"/>
</itemCodeableConcept>

Map PADV CDA->FHIR: Missing element effectiveTime

Source CDA:
entry.observation.effectiveTime -> Type: IVL_TS
<effectiveTime value="20120204140000+0100" />

Target FHIR:
Observation.effective[x] -> Type: dateTime
<effectiveDateTime value="2012-02-04T14:00:00+01:00"/>

To be mapped in group PharmaceuticalAdviceItemEntryContentModule in Map CdaChEmedToBundle

"HTTP/1.1 406 Not Acceptable" for Transformation FHIR to CDA for one document

Request

@host = https://test.ahdis.ch/r4

POST {{host}}/StructureMap/$transform?source=http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaCh
Accept: application/fhir+xml;fhirVersion=4.0
Content-Type: application/fhir+xml;fhirVersion=4.0

< ./input/ch-core/1-ZuweisungZurRadiologischenDiagnostik.xml

Response

HTTP/1.1 406 Not Acceptable
X-Powered-By: HAPI FHIR 5.3.0-SNAPSHOT REST Server (FHIR Server; FHIR 4.0.1/R4)
X-Request-ID: ReQu4ZygqFQ6ThUm
Cache-Control: must-revalidate,no-cache,no-store
Date: Thu, 03 Dec 2020 14:29:42 GMT
Via: 1.1 google
Transfer-Encoding: chunked
Alt-Svc: clear
Connection: close

Maps CDA->FHIR generate "v3:value" for some elements

Examples:

MedicationStatement.dosage.sequence:
<sequence v3:value="1"/>
(e.g. input\generated-files\ch-emed-2-3-MedicationTreatmentPlan.xml,
input\generated-files\ch-emed-2-7-MedicationCard.xml)

MedicationDispense.dosageInstruction.sequence:
<sequence v3:value="1"/>
(e.g. input\generated-files\ch-emed-2-4-MedicationDispense.xml)

MedicationRequest.dispenseRequest.numberOfRepeatsAllowed:
<numberOfRepeatsAllowed v3:value="2"/>
(e.g. input\generated-files\ch-emed-2-6-MedicationPrescription.xml)

Map: CdaChEmedToBundle

group DosageInstructionsEntryDosageChange

entry.sequenceNumber as sequenceNumber -> dosage.sequence = sequenceNumber "sequenceNumber";

group PrescriptionItemEntryContentModule

src.repeatNumber as repeatNumber -> medicationRequest.dispenseRequest as dispenseRequest then {
    repeatNumber -> dispenseRequest.numberOfRepeatsAllowed = repeatNumber "repeatNumber";
} "repeats";

FHIR -> CDA: text.reference

Original FHIR

"text": {
              "status": "generated",
              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n<span id=\"co1\">\nKommentar zu Medication Treatment\n</span>\n</div>"
            }

Transformed CDA

          <text>
            <content ID="co1">
                  Kommentar zu Medication Treatment
              </content>
          </text>
          <text>
                <reference value="#co1"/>
          </text>

Generated JSON

"text": {
                            "status": "generated",
                            "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Kommentar zu Medication Treatment</div>"
                        }

Transformed CDA

<text>Kommentar zu Medication Treatment</text>
              <text>
                <reference value="#&lt;div xmlns="/>
              </text>

CodeableConcept.text -> Element without value=

CodeableConcept.text element is generated without value=

<code>     
   <coding>      
      <system value="urn:oid:2.51.1.1"/>
      <code value="7680500440334"/>
      <display value="NORVASC Tabl 10 mg"/>
   </coding>
   <text>NORVASC Tabl 10 mg</text>
</code>

input\maps\CdaChEmedMedicationPrescriptionDocumentToBundle.map

  • Line 94: initial variant without text element (uncomment)
  • Line 95: variant with text element

FHIR datatype CodeableConcept

Mapping for Medication.ingredient

Wenn ein "individuelles" CodeSystem kommt, wird es nicht gemappt.

(Spec: Snomed CT FHIR: extensible, CDA: SHALL)

Medication.ingredient

"ingredient": [{
                                "itemCodeableConcept": {
                                    "coding": [{
                                            "system": "http://chmed16af.emediplan.ch/fhir/CodeSystem/chmed16af-codesystem-substance",
                                            "code": "205432",
                                            "display": "Metoprolol tartrat"
                                        }
                                    ],
                                    "text": "Metoprolol tartrat"
                                },
<pharm:ingredient classCode="MMAT" determinerCode="KIND">
<pharm:code code="205432" displayName="Metoprolol tartrat"/>

FHIR -> CDA: missing author.assignedAuthor

CDA requires the author.assignedAuthor, see spec.

Required elements for assignedAuthor are:

  • hl7:id (The specification of GS1 GLN is REQUIRED. If it is not (yet) known, this MUST be declared using nullFlavor.)
  • Elements to choose from:
    • hl7:assignedPerson
    • hl7:assignedAuthoringDevice

In the FHIR source these elements aren't required.

Note:
If there is a reference to a PractitionerRole from Composition.author the mapping doesn't work.

Examples:

Text element is missing, if the value is empty

If no value is entered in the element note in the CDA document (source), no text element is generated in the FHIR document (target). But in FHIR the Element note.text is required.

TBD in following maps:

  • input\maps\CdaChEmedMedicationCardDocumentToBundle.map
  • input\maps\CdaChEmedMedicationDispenseDocumentToBundle.map
  • input\maps\CdaChEmedMedicationPrescriptionDocumentToBundle.map

Example: 1-2-MedicationDispense
Input (CDA):

<td ID="dis.1.note"></td>

Actual Output (FHIR):

<note>
   <extension url="http://hl7.org/fhir/StructureDefinition/narrativeLink">
      <valueUrl value="#dis.1.note"/>
   </extension>
</note>

Target Output (FHIR):

<note>
   <extension url="http://hl7.org/fhir/StructureDefinition/narrativeLink">
      <valueUrl value="#dis.1.note"/>
   </extension>
   <text value="-"/>
</note>

Comment: An empty text element in FHIR is not valid. (Error from IG-Publisher: Primitive types must have a value that is not empty)

actual mapping section:

// source: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&id=2.16.756.5.30.1.1.10.4.2
// target: Annotation note (e.g. http://build.fhir.org/ig/hl7ch/ch-emed/branches/master/StructureDefinition-ch-emed-medicationdispense.html)
group AnnotationComment(source section: Section, source act: Act, target note: Annotation) {
  act -> note.text =  (%section.text.substring(%section.text.indexOf(%act.text.reference.value.substring(1))).substring(%section.text.substring(%section.text.indexOf(%act.text.reference.value.substring(1))).indexOf('>')+1, %section.text.substring(%section.text.indexOf(%act.text.reference.value.substring(1))).indexOf('<')-%section.text.substring(%section.text.indexOf(%act.text.reference.value.substring(1))).indexOf('>')-1)) "idRef"; 
  act.text as text then {
    text.reference as reference then {
      reference.value as value -> note.extension as ext then NarrativeLink(value, ext) "narrativeLink";
    } "reference";
  } "text";
}

Generate xsi:type

Generate xmlns:xsi & xsi:type

CDA: entry.substanceAdministration.consumable.manufacturedProduct.manufacturedMaterial.pharm:ingredient

  • target state after mapping from FHIR to CDA
<pharm:ingredient classCode="ACTI">
	<pharm:quantity>
		<numerator unit="mg" value="10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PQ"/>
		<denominator value="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PQ"/>
	</pharm:quantity>
  • actual state after mapping from FHIR to CDA
<pharm:ingredient classCode="ACTI">
         <pharm:quantity>
                   <numerator unit="mg" value="10"/>
                   <denominator value="1"/>
         </pharm:quantity>

Mapping PADV: Kommentar

Das Mapping des PADV Kommentars ist folgendermassen definiert:

  • CDA: section.entry.observation.text.reference -> Bsp: value="#padv.1"
  • FHIR: Observation.note

Der Wert, der bei FHIR Observation.note erwartet wird ist folgender:
<td ID="padv.1.note">Abgesetzt aufgrund UAW trockener Husten</td>
(Bsp. 2-2-PharmaceuticalAdvice)

Das Mapping von CDA->FHIR und FHIR->CDA ist noch offen. Wie kann das richtige Element aus dem Text evaluiert werden?

Mapping document author if device to wrong resource type

CDA:
author.assignedAuthor.assignedAuthoringDevice

FHIR:
ACTUAL = Composition.author -> Practitioner
TARGET = Composition.author -> Device

CDA and FHIR example from actual mapping here: 3-1-List-Cetirizine.zip
Device from CDA example:

    <author>
        <templateId root="2.16.756.5.30.1.1.10.9.23"/>
        <functionCode code="COMPOSER" codeSystem="2.16.840.1.113883.5.88" codeSystemName="Participation Function" displayName="composer software"/>
        <time value="20220810072849+0000"/>
        <assignedAuthor>
            <id root="2.51.1.3" extension="7601002860123"/>
            <assignedAuthoringDevice>
                <manufacturerModelName>CARA's PMP</manufacturerModelName>
                <softwareName>PMP CARA v0.1</softwareName>
            </assignedAuthoringDevice>
        </assignedAuthor>
    </author>

pharm:asContent only when amount and code

if the package amount is not specified pharm:asContent should not be generated (otherwise it gives a schematron error)
vice versa the gtin should be taken from manufacturedMaterial.code

FHIR -> CDA: free text medication (no gtin), cda needs the element code with NA

CDA:
manufacturedMaterial.code 1..1
see spec:
The element SHALL be present and describes the code of the medication (GTIN). If it as magistral preparation/compound medicin nullFlavor SHALL be NA

FHIR Source file
only Medication.code.text is required

TBD for Transformation
Generating this part for CDA:
<code code="7680460380107" codeSystem="2.51.1.1" codeSystemName="Global Trade Item Number" displayName="NA"/>

add mapping (cda->fhir) for externalDocumentId and id in the Medication List elements

Medication List (CDA)

   <reference typeCode="XCRPT">
      <externalDocument>
          <id root="363BCBFD-9192-47FA-BB16-878253FBC973"/>
      </externalDocument>
  </reference>

mapping to FHIR in these extensions:

extension:id -> id of the medication entry (e.g. MedicationStatement)
extension:externalDocumentId -> the CDA element above

Adjust mapping for PADV documents

Quentin:

Please use the annotation comment to express the reason for the action in PADV OK, CHANGE, SUSPEND, CANCEL, REFUSE. For PADV COMMENT, the comment goes in the hl7:text element. I’ve updated the integration guide. It’ll be aggregated in the next version.

For CH EMED is it for all PADV in observation.note.text, we will map it according to the type to the correct CDA part.

Mapping defined in : https://docs.google.com/spreadsheets/d/17c6p-67TPhWcZz3a-GwvCugrg9LSm606tLR8QarL9Hw/edit?usp=sharing

Generated UUID cannot be transformed into uppercase

Mapping from FHIR to CDA:
If no section id is included in the fhir bundle, a uuid for the cda document will be generated. Because uuid() is not a fhir path expression, upper() cannot be used.

// create section id if there is none in the fhir bundle (mapping source)
section as section where $this.extension.where(url='http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-sectionid').exists()=false 
    -> cdasection.id as id then { 
      section -> id.root = uuid() "section id";
    } "extension";

Concerned are all Maps for the Medication Documents:
input\maps\BundleToCdaChEmedMedication...Document.map

CH-EMED-PMP: invalid text.reference in AnnotationComment

Source MTP (Composition.section):

        "section": [
          {
            "title": "Plan de traitement médicamenteux",
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "77604-7",
                  "display": "Medication treatment plan.brief"
                }
              ]
            },
            "text": {
              "status": "generated",
              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p id=\"refpdf\">Temesta Expidet cpr orodisp 1 mg, 0-0-0-1, durant 3 jours, raison: pour dormir</p></div>"
            },
            "entry": [
              {
                "reference": "MedicationStatement/1-3-MedStatTemesta"
              }
            ]
          },
          {
            "title": "Commentaire",
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "48767-8",
                  "display": "Annotation comment"
                }
              ]
            },
            "text": {
              "status": "generated",
              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">si aucune amélioration au bout de 3 jours, reprendre contact avec le médecin</div>"
            }
          }
        ]

Transformed CDA:

     <component>
        <section>
          <templateId root="2.16.756.5.30.1.1.10.3.2"/>
          <id root="4137D4F8-E966-425B-B383-E4933A80C8CE"/>
          <code code="48767-8" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Annotation comment"/>
          <title>Commentaire</title>
          <text>si aucune amélioration au bout de 3 jours, reprendre contact avec le médecin</text>
          <entry>
            <act classCode="ACT" moodCode="EVN">
              <templateId root="2.16.756.5.30.1.1.10.4.2"/>
              <templateId root="2.16.840.1.113883.10.20.1.40"/>
              <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.2"/>
              <code code="48767-8" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Annotation comment"/>
              <text>
                <reference value="#&lt;div xmlns="/>
              </text>
              <statusCode code="completed"/>
            </act>
          </entry>
        </section>
      </component>

Map BundleToCdaChEmed (Line 43)

Missing mapping for different authors (on different levels)

FHIR: source file

  • Composition.author
    • Practitioner/AuthorDocument: mapping done
    • Organization/AuthorDocumentOrganization: mapping done
  • Composition.section.author
    • Practitioner/AuthorSection
    • Organization/AuthorSectionOrganization
  • MedicationStatement.extension:ch-emed-ext-documentauthor
    • Practitioner/AuthorOriginalDocument
    • Organization/AuthorOriginalDocumentOrganization
  • MedicationStatement.informationSource
    • .extension:ch-emed-ext-representedorganization: Organization/AuthorMedicalDecisionOrganization
    • Practitioner/AuthorMedicalDecision

for mapping details see here

elements of quantity are generated in wrong order

Map:

  • input\maps\CdaChEmedMedicationDispenseDocumentToBundle.map
  • input\maps\CdaChEmedMedicationPrescriptionDocumentToBundle.map

Mapping MedicationDispense as example

// quantity value (number of packages)
  source.quantity as quantity -> medicationDispense.quantity as medDispQuantity then {
    // IHE-DIS: If the product-element contains package information, the unit attribute is not be present
    quantity.value as value -> medDispQuantity.value = value "value";

    // IHE-DIS: If the product-element does not contain package information, the unit attribut is present and the value SHALL be out of the UCUM code system
    quantity.unit as unit then {
      unit -> medDispQuantity.unit = unit "unit";
      unit -> medDispQuantity.system = 'http://unitsofmeasure.org' "ucum";
      unit -> medDispQuantity.code = unit "code";
    } "unit";
  } "quantity";

Input (CDA, e.g. 1-2-MedicationDispense):

<quantity value="20" unit="mg"/>

Output (FHIR) -> element value in wrong order:

<quantity>
    <unit value="mg"/>
    <system value="http://unitsofmeasure.org"/>
    <code value="mg"/>
    <value value="20"/>
</quantity>

Target Output (FHIR):

<quantity>
    <value value="20"/>
    <unit value="mg"/>
    <system value="http://unitsofmeasure.org"/>
    <code value="mg"/>     
</quantity>

Missing author on entry level

This element on entry level is not yet mapped.

CDA:
component.section.entry.substanceAdministration.author

                            <author>
                                <templateId root="2.16.756.5.30.1.1.10.9.23"/>
                                <time value="20190227110000+0100"/>
                                <assignedAuthor>
                                    <id root="2.51.1.3" extension="7601000234322"/>
                                    <assignedPerson>
                                        <name>
                                            <family>Hôpital</family>
                                            <given>Docteur</given>
                                        </name>
                                    </assignedPerson>
                                </assignedAuthor>
                            </author>

FHIR:
MedicationStatement.informationSource
details see here in column D/E

CDA and FHIR example from actual mapping here: 3-1-List-Cetirizine.zip

CDA -> FHIR: quantity mapping isn't complete

Transformation from CDA to FHIR

actual mapping:
<doseQuantity value="40" unit="mg"/>

"doseAndRate": [{
       "doseQuantity": {
                "value": 40,
                 "code": "mg"
          }
      }
]

Validation error: qty-3: If a code for the unit is present, the system SHALL also be present [code.empty() or system.exists()]

target mapping:

"doseQuantity": {
      "value": 40,
      "unit": "mg",
      "system": "http://unitsofmeasure.org",
      "code": "mg"
},

Maps FHIR -> CDA: add fullUrl reference rule for urn:uuid

View this comment in following Maps:
// FIXME: add fullUrl reference rule which for urn:uuid

  • BundleToCdaChEmedMedicationCardDocument
  • BundleToCdaChEmedMedicationDispenseDocument
  • BundleToCdaChEmedMedicationPrescriptionDocument
  • BundleToCdaChEmedPharmaceuticalAdviceDocument

Encoding problems

Encoding problems have been noticed in the following cases:
CDA document:
<city>Z&#xFC;rich</city>
<family>Wegm&#xFC;ller</family>
<th>Pr&#xE4;partename</th>

FHIR document:
<family value="Wegm&#xFC;ller"/>
<city value="Z&#xFC;rich"/>

fullUrl are required on entries in bundle

If no fullUrl on entries is existing, the IG publisher aborts the process with the following error message:
e.g. No fullUrl on entry 1 in Bundle 2-6-MedicationPrescription-FHIR

FHIR -> CDA: PADV - missing observation.entryRelationship

The element hl7:observation.hl7:entryRelationship is not mapped with these examples (spec):

Error:
(PharmaceuticalAdviceItemEntryContentModule): choice (hl7:entryRelationship[@typecode='REFR' and hl7:substanceAdministration[hl7:templateId[@root='2.16.756.5.30.1.1.10.4.45']]] or hl7:entryRelationship[@typecode='REFR' and hl7:supply[hl7:templateId[@root='2.16.756.5.30.1.1.10.4.46']]] or hl7:entryRelationship[@typecode='REFR' and hl7:substanceAdministration[hl7:templateId[@root='2.16.756.5.30.1.1.10.4.47']]]) does not contain enough elements [min 1x]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.