Upload
others
View
15
Download
0
Embed Size (px)
Citation preview
HL7 FHIR DevDays 2020, Virtual Edition, November 17–20, 2020 | @FirelyTeam | #fhirdevdays | www.devdays.com/november-2020
HL7®, FHIR® and the flame Design mark are the registered trademarks of Health Level Seven International and are used with permission.
MAP CDA to FHIR and Back
Oliver Egger, ahdis ag
1
Who am I?
Oliver Egger
2015 - founder ahdis2003 - 2014 visionary AG, docbox2002 - 2003 Ecofin Research & Consulting AG1994 - 2001 SPEAG
2016 - lecturer BFH Bern, ZHAW Winterthur Medical informatics, Interoperability
HL7.chTechnical Manager, member hl7 since 2009
IHE SuisseDeputy Technical Manager since 2016, member since 2015
Dipl. Inf. ETH, ETH Zürich, 1996IHE XDS Advanced Training, 2015Certified HL7 CDA Specialist, 2015Certified Scrum Master, 2014NDK eHealthcare, Nottwil, 2009
2
Learning Objectives Tutorial/Let’s Build
• Relation between CDA and FHIR documents• Approaches to map CDA to FHIR and back• Validate CDA with the FHIR CDA Logical Model• Using FHIRPath to extract information from CDA• Using FHIR Mapping Language to convert from CDA to FHIR
3
Document Characteristics
• Persistence• Stewardship• Authentication• Wholeness• Human readable
4
CDA – Clinical Document Architecture
5
CDA projects in Europe?
• Austria: ELGA with 7 IG’s• Denmark: UPO, DK APD, PHRM-DK, DKQFDD, DK-QRD• Italy: 5 IG’s published, 4 IG’s in ballot• Switzerland: eHealth Suisse 3 IG’s• Europe: CDA IPS, Electronic Health Record Exchange Format
and many more in Finland, Netherlands, Germany, Norway …
http://www.hl7.eu/download/eun-09-2019.pdf
6
How to implement CDA projects?
• CDA has a XSD Schema (not normative and allows extensions), todays programming languages can work with it• in Europe CDA projects are often developed with ART-DECOR (Output
Website, Schematron rules and HL7 ITS Templates) • MDHT: Model-Driven Health Tools (MDHT) open source project, UML
model-driven tools to create computable models• eHealth Connector, Swiss open source project: first using MDHT now
directly working with CDA Schema and ART-DECOR templates• Simple approach: templating for creating CDA’s and query language
(XPath) for getting specific data out of CDA
7
FHIR – FAST Healthcare Interoperability Resources
• FHIR is fast for implementers, why?• Community and based on modern IT standards• Licensing issues / web-based standard which is searchable with examples• Reference implementations• Test servers• Validation Tools• Publishing Tools
• How this can be applied to implement CDA with FHIR tool stack?
8
FHIR Documents
• FHIR resources can be used to build documents that represent a composition: a coherent set of information that is a statement of healthcare information.• First entry is a Composition Resource
• Equivalent to CDA header and narrative• Can be signed, authenticated, etc.• A FHIR document has the same basic principles as a CDA document
http://hl7.org/fhir/documents.html
9
Documentsare Bundles
Observation Resource
Composition Resource
Section
Device Resource
Condition Resource
List Resource
<Bundle><entry>
<Composition /></entry> <entry>
<Observation /></entry><entry>
<Device /></entry><entry>
<List/></entry><entry>
<Condition/></entry>
</Bundle>
AttesterMetadata Section
Section
Source: https://github.com/FHIR/documents/tree/master/presentations/2019-01%20Webinars
10
FHIR Documents, CDA
• Clinical document focus• Human readability approach• Clinical Statement vs. Resources• Templates and Profiles• CDA markup, xhtml• Discrete to human-readable linkages
https://www.hl7.org/fhir/comparison-cda.html
11
Mapping from CDA to FHIR
• CDA Level 1: (Just metadata and text), map to Bundle/Composition• CDA Level 2: Coded sections, map to Bundle/Composition• CDA Level 3: Structured entries, map to entries in Bundle
Level 1, Level 2 can be done maybe 70% generic, there are some different or missing concepts or too general to mapLevel 3 general mapping hardly possible, can only be done on a profiled CDA (template), like C-CDA or a specific exchange format
Mappings should be done at the CDA template level rather than at the CDA specification
12
Composition CDAMapping
http://hl7.org/fhir/composition-mappings.html
13
Mapping Strategies
• CDA as FHIR Binary with DocumentReference for Metadatea• XSLT• Argonaut: CCDA on FHIR Project (April 2018, STU3)• CCDA to FHIR Project (September 2018)• CDA Logical Model with FHIR Mapping Language• Microsoft CDA Mapping• Google
FHIR documents can represent the same information as a CDA (see limitations of this approach from Marten Smits et al in:A comparison of two Detailed Clinical Model representations: FHIR and CDA
14
Use CDA as documents (no mapping)
• DocumentReference Resource for Metadata (equivalent to XDS or CDA Header)• CDA Document as attachement, embedded in DocumentReference or
referenced to FHIR Binary Endpoint http://server.org/fhir/Binary/
15
Mapping approaches
• C-CDA on FHIR Project http://hl7.org/fhir/us/ccda/index.html• C-CDA Mapping based on FHIR Mapping Language
(https://github.com/HL7/ccda-to-fhir)• CDA FHIR Maps for eMedication Switzerland:
https://github.com/hl7ch/cda-fhir-maps
16
Mapping with the FHIR Mapping Language and CDA Logical Model
• https://www.hl7.org/fhir/mapping-language.html
CDA FHIRMappingEngine
MapsCDA
LogicalModel
17http://build.fhir.org/ig/HL7/cda-core-2.0/branches/master/index.html
FHIR Logical model CDA
• Logical Model is a description of CDA
• no API • datatypes are equivalent to FHIR • no FHIR resources • no query possibilities
• Logical Model can be used with the FHIR Mapping Language
18
MedicationCard - Document
https://github.com/hl7ch/cda-fhir-maps/blob/master/input/maps/CdaChEmedMedicationCardDocumentToBundle.map
19
Microsoft FHIR Converter
• using handlebartemplates
https://github.com/microsoft/FHIR-Converter
20
Google CloudHealthcare DataHarmonization
• v2 to FHIR
https://github.com/GoogleCloudPlatform/healthcare-data-harmonization/blob/master/mapping_language/doc/reference.md
21
Mapping with the FHIR Mapping Language and CDA Logical Model
• https://www.hl7.org/fhir/mapping-language.html
CDA FHIRMappingEngine
MapsCDA
LogicalModel
22
FHIR Logical model CDA
• Introduction FHIR Logical Model• CDA Logical Model• Validating CDA• Conversion to JSON• Querying via FHIRPath• CDA Narrative conversion form xhtml and back with the Java Validator
23
StructureDefinition
• The StructureDefinition resource describes a structure - a set of data element definitions, and their associated rules of usage. These structure definitions are used to describe both the content defined in the FHIR specification itself - Resources, data types, the underlying infrastructural types, and also are used to describe how these structures are used in implementations.• Note that as part of the specification itself, a
full set of structure definitions for all resources and data types is published.
http://hl7.org/fhir/structuredefinition.html
24
Logical models based on StructureDefinitions
• StructureDefinitions can also be used to define any arbitrary structures that are a directed acyclic graph with typed nodes, where the primitive types are those defined by the FHIR specification.• This technique has many uses• Describing any arbitrary content model• Describing existing HL7 content models (e.g. v2, CDA) using FHIR• Describing common design patterns used in FHIR• Defining a content model to support the mapping language
http://hl7.org/fhir/structuredefinition.html#logical
25
FHIR Logical model for CDA
• supports the CCDA on FHIR guide, and other CDA/FHIR mapping projects• Presented by Grahame at FHIR DevDays in 2016• https://github.com/HL7/cda-core-2.0• IG Publisher generates then the model: • http://build.fhir.org/ig/HL7/cda-core-
2.0/branches/master/index.html• Note: no official release yet
26
V3 Datatypes
AD: PostalAddress
ANY: DataValue
BL: Boolean
CD: ConceptDescriptor
CE: CodedWithEquivalents
CO: CodedOrdinal
CR: ConceptRole
CS: CodedSimpleValue
CV: CodedValue
ED: EncapsulatedData
EIVL_TS: EventRelatedPeriodicInterval
EN: EntityName
EN: EntityName
II: InstanceIdentifier
INT: IntegerNumber
IVL_INT: Interval
IVL_PQ: Interval
IVL_TS: Interval
MO: MonetaryAmount
PIVL_TS: PeriodicIntervalOfTime
PQ: PhysicalQuantity
PQR: PhysicalQuantityRepresentation
QTY: Quantity
REAL: RealNumber
RTO_PQ_PQ: Ratio
SC: CharacterStringWithCode
ST: CharacterString
SXCM_TS: GeneralTimingSpecification
SXPR_TS: Component part of GTS
TEL: TelecommunicationAddress
TS: PointInTime
27
Datatypes: ANY – CD - CE
28
CDA classes
ClinicalDocument
Act
Authenticator
Author
AuthoringDevice
Authorization
AssignedAuthor
AssignedCustodian
AssignedEntity
AssociatedEntity
Birthplace
Component2
ComponentOf
Consent
Criterion
Custodian
CustodianOrganization
DataEnterer
Device
DocumentationOf
EncompassingEncounter
Encounter
Entity
ExternalAct
ExternalDocument
ExternalObservation
ExternalProcedure
Guardian
HealthCareFacility
Informant
InformationRecipient
InfrastructureRoot
InFulfillmentOf
IntendedRecipient
LabeledDrug
…
29
CDA classes
30
CDA & FHIR Logical Model
• attributes• type attributes in xml• text in xml elements• CDA narrative vs xhtml• V3 classes with id element and extension attribute • foreign namespaces• choice elements from CDA schema• granularity of model (e.g. EntryRelationship as Element and not as
only type)
31
cda xml attributes
32
text in xml elements: ST datatype
title.dataString
33
CDA narrative vs xhtml
validator: internal conversion
34
Summary CDA Logical Model
• Logical Model is a description of CDA• no API • datatypes are equivalent to FHIR • no FHIR resources • no query possibilities
• Logical Model can be used with the FHIR Mapping Language
35
CDA and FHIR Validation
The HL7 FHIR Validator can validate with logical models, you need to provide the packagename (package.tgz instead of hl7.fhir.cda#current)
java -jar org.hl7.fhir.validation.cli.jar -version 4.0.1 -ig package.tgzresources/examples/cda-ch.xml
FHIR Validation tool Version 4.0.32-SNAPSHOT
.. connect to tx server @ http://tx.fhir.org
.. definitions from hl7.fhir.r4.core#4.0.1
+ .. load IG from package.tgz
.. validate [resources/examples/cda-ch.xml]
Success...validating resources/examples/cda-ch.xml: error:0 warn:0 info:20
https://github.com/ahdis/cda-core-2.0/releases/download/v0.0.3-dev/package.tgz
36
CDA and FHIR ValidatorVisual Studio Code
1) Right click on file to validate and select validate with params
2) Add params –version 4.0.1 cda-core-2.0-pr.tgz
3) Output
37
Convert CDA to JSON Logical Model representation
java -jar org.hl7.fhir.validation.cli.jar -version 4.0.1 -ig package.tgz -convert -output resources/examples/cda-original.json resources/examples/cda-original.xml
38
Applying FHIRPath expressions to CDA documents
• FHIRPath is a path based navigation and extraction language, somewhat like XPath. • Operations are expressed in terms of the logical content of
hierarchical data models, and support traversal, selection and filtering of data. • Its design was influenced by the needs for path navigation, selection
and formulation of invariants in both HL7 Fast Healthcare Interoperability Resources (FHIR) and HL7 Clinical Quality Language (CQL).
39
Applying FHIRPath expressions to CDA documents
java -jar org.hl7.fhir.validation.cli.jar -version 4.0.1 -ig package.tgz -fhirpathrecordTarget.patientRole.patient.name.given.dataString resources/examples/cda-original.xml
.. definitions from hl7.fhir.r4.core#4.0.1
(v4.0.1)
+ .. load IG from package.tgz
...evaluating recordTarget.patientRole.patient.name.given.dataString
Henry
40
FHIRPath expressions to CDA documents
https://niquola.github.io/fhirpath-demo/#/
41
FHIRPath expressions to CDA documents
FHIR tools with Visual Studio Code Extension
42
Mapping with the FHIR Mapping Language and CDA Logical Model
• https://www.hl7.org/fhir/mapping-language.html
CDA FHIRMappingEngine
MapsCDA
LogicalModel
43
FHIR Mapping Language
https://www.hl7.org/fhir/mapping-language.html
44
Mapping Engines
• Java FHIR Mapping• Java Validator• matchbox (hapi-fhir, java, test.ahdis.ch/r4)
• C# FHIR Mapper https://vonk.fire.ly• JavaScript fhir-kit-mapping-language• Pascal
https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Mapping+Language
45
Mapping Authoring
• Define mapping instructions to transform the source content to the target content.• Use the mapping engine to create a
machine-readable representation of the mapping instructions in the form of a FHIR StructureMap resource.
https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Mapping+Language
46
Mapping Execution
• Store the source FHIR StructureMap resource on the FHIR Server.• Execute transformations - $transform - The
mapping engine requires:• The source content to transform.• The machine-readable representation of
the mapping instructions previously created.
• Store the generated target content (optional)
https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Mapping+Language
47
Mapping from CDA to FHIR
Mappings should be done at the CDA template level rather than at the CDA specification …
48
Maps CDA to FHIR
• Data types: CDAtoFHIRTypes.map• CDA: CDAtoBundle.map• CDA-CH: CDAChtoBundle.map• MedicationCard:
CdaChEmedMedicationCardDocumentToBundle.map
https://github.com/hl7ch/cda-fhir-maps
49
MedicationCard - Document
https://github.com/hl7ch/cda-fhir-maps/blob/master/input/maps/CdaChEmedMedicationCardDocumentToBundle.map
50
MedicationCard – Document, Section
https://github.com/ahdis/cda-fhir-maps/blob/master/input/maps/CdaChEmedMedicationCardDocumentToBundle.map
51
MedicationCard – Entry Level Template
https://github.com/hl7ch/cda-fhir-maps/blob/master/input/maps/CdaChEmedMedicationCardDocumentToBundle.map
52
Example transformation
https://github.com/hl7ch/cda-fhir-maps/blob/master/input/maps/CdaChEmedMedicationCardDocumentToBundle.map
53
54
Zulip Streams
• CDA• CCDA / FHIR mapping stream • cda to fhir• cda/publish• mapping-framework
55
What did you learn?
• Relation between CDA and FHIR documents• Approaches to map CDA to FHIR and back• Validate CDA with the FHIR CDA Logical Model• Using FHIRPath to extract information from CDA• Using FHIR Mapping Language to convert from CDA to FHIR
Joint the Let’s build tomorrow to perform above steps yourself, same time as today!https://github.com/ahdis/cda-core-2.0/blob/develop/tutorial.md
56
QA & Contact
• During DevDays, you can find / reach me here:• Via Whova App – Speaker’s Gallery• Email: [email protected]• Twitter: @oliveregger