building bridges: mapping hl7 v2 to fhir - fhir devdays · •create two patient resource from the...
TRANSCRIPT
![Page 1: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/1.jpg)
FHIR® is the registered trademark of HL7 and is used with the permission of HL7. The Flame Design mark is the registered trademark of HL7 and is used with the permission of HL7.
Amsterdam, 15-17 November | @fhir_furore | #fhirdevdays17 | www.fhirdevdays.com
Building Bridges: Mapping HL7 V2 to FHIR
Simone Heckmann, Gefyra GmbH / HL7 Germany
![Page 2: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/2.jpg)
Who we are
„gefyra“ is the Greek word for „bridge“
We offer• FHIR training, • consultancy for FHIR projects• professional tooling• integration services (j/w Health-Comm,
based on INfOR Cloverleaf®)
We have been involved with FHIR since2014,
have tested our V2 mappings on > 7 Connectathons,
and have them running in productionenvironments
![Page 3: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/3.jpg)
V2-based EHR
Integration Engine
FHIR-Server
FHIR-Clients
ADT-Messages
?
![Page 4: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/4.jpg)
FHIR als Daten-Hub
6
Integration Engine
![Page 5: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/5.jpg)
Scenario
• Mapping a V2 ADT_A01 message
http://wiki.hl7.org/index.php?title=Version_2_-_FHIR_Mapping_Scenarios
![Page 6: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/6.jpg)
MSH|^~\&|LegacyEHR||SPARK||20150502090000||ADT^A01|00000002|P|2.5
EVN|A01|20150502090000|
PID|1||345345412312345^10^^NHS^NH~456756756745^^^TCPAS^MR||Gefyra^Alpha^F^^Ms^
^L||19280524|F|||Bridge Street 22^^Bridgetown^^^12345^^^^P||277543^PRN|||U||
NK1|1|Gefyra^Beta|FTH|||+44 201 12345678||
PV1||I|INT^0001^02^GENHOS||||0100^ANDERSON,CARL|0148^ADDISON,JAMES||SUR|||||||
0148^ANDERSON,CARL|S|234637^^^GENHOS|A|||||||||||||||||||GENHOS|||||2015050209
0000|
AL1|1|DA|1605^acetaminophen^L|MO|Muscle Pain~hair loss
AL1|2|DA|1558^Oxycodone^L|MO|Muscle Pain~hair loss
AL1|3|MA|2221^Peanuts^L|SV|Anaphylactic Shock
![Page 7: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/7.jpg)
MSH|^~\&|LegacyEHR||SPARK||20150502090000||ADT^A01|00000002|P|2.5
EVN|A01|20150502090000|
PID|1||345345412312345^10^^NHS^NH~456756756745^^^TCPAS^MR||Gefyra^Alpha^F^^Ms^
^L||19280524|F|||Bridge Street 22^^Bridgetown^^^12345^^^^P||277543^PRN|||U||
NK1|1|Gefyra^Beta|FTH|||+44 201 12345678||
PV1||I|INT^0001^02^GENHOS||||0100^ANDERSON,CARL|0148^ADDISON,JAMES||SUR|||||||
0148^ANDERSON,CARL|S|234637^^^GENHOS|A|||||||||||||||||||GENHOS|||||2015050209
0000|
AL1|1|DA|1605^acetaminophen^L|MO|Muscle Pain~hair loss
AL1|2|DA|1558^Oxycodone^L|MO|Muscle Pain~hair loss
AL1|3|MA|2221^Peanuts^L|SV|Anaphylactic Shock
PatientEncounter
AllergyIntolerance(s)
MessageHeader
![Page 8: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/8.jpg)
…so, it‘s a Bundle of Resources!
• Yes. But there are multiple typesof Bundles. Is it a message, a batch, a transaction or a document…?
http://build.fhir.org/bundle.html
![Page 9: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/9.jpg)
![Page 10: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/10.jpg)
A message, obviously!
• True, but which event? Whichstructure? What‘s the logicassociated with the event? Doesthe server know all this?
• Do we really want to re-implementV2 messaging with FHIR?
http://build.fhir.org/messagedefinition.html
![Page 11: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/11.jpg)
So what do we do?
• We (the integration engine) knowwhat the events mean and whichactions we expect the server toperform. So we can tell the serverwhat to do.
• Let‘s try Transactions!
![Page 12: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/12.jpg)
how
what
![Page 13: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/13.jpg)
MSH|^~\&|LegacyEHR||SPARK||20150502090000||ADT^A01|00000002|P|2.5
EVN|A01|20150502090000|
PID|1||345345412312345^10^^NHS^NH~456756756745^^^TCPAS^MR||Gefyra^Alpha^F^^Ms^
^L||19280524|F|||Bridge Street 22^^Bridgetown^^^12345^^^^P||277543^PRN|||U||
NK1|1|Gefyra^Beta|FTH|||+44 201 12345678||
PV1||I|INT^0001^02^GENHOS||||0100^ANDERSON,CARL|0148^ADDISON,JAMES||SUR|||||||
0148^ANDERSON,CARL|S|234637^^^GENHOS|A|||||||||||||||||||GENHOS|||||2015050209
0000|
AL1|1|DA|1605^acetaminophen^L|MO|Muscle Pain~hair loss
AL1|2|DA|1558^Oxycodone^L|MO|Muscle Pain~hair loss
AL1|3|MA|2221^Peanuts^L|SV|Anaphylactic Shock
Patient -> create/update?
Encounter -> create
AllergyIntolerance(s) -> purge/create
![Page 14: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/14.jpg)
Now, let‘s REST-ify that!
![Page 15: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/15.jpg)
How do I update/create?
• We need to check if the Patient already exists. If it does, we wantto PUT, if it doesn‘t we want toPOST.
• Enter the „Conditional UPDATE“!
http://build.fhir.org/http.html#2.42.0.10.2
![Page 16: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/16.jpg)
![Page 17: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/17.jpg)
So what‘s the criteria?
• The Conditional UPDATE will fail ifit matches multiple resources, so our criteria must identify thePatient uniquely.
• Sounds like „identifier“, right?
http://build.fhir.org/search.html#token
![Page 18: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/18.jpg)
PID|1||345345412312345^10^^NHS^NH~456756756745^^^TCPAS^MR||
urn:oid:2.16.840.1.113883.2.1.4.1 http://www.ghh.org/identifiers
![Page 19: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/19.jpg)
How do I purge/create?
• First, we need to DELETE all previously submittedAllergyIntolerances, then POST thenew ones. But wait! We need tomake sure, we only delete theones we (the integration engine) created!
• Enter the „Conditional Delete“!
http://build.fhir.org/http.html#2.42.0.12.1
![Page 20: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/20.jpg)
So what‘s the criteria?
• Somehow we need to be able torecognize the AllergyIntoleranceswe submitted.This can be achieved by either
• adding tags to the resourcemetadata (simple) or
• using Provenance resources (not so simple, but more powerful)
http://build.fhir.org/resource.html#Metahttp://build.fhir.org/provenance.html
![Page 21: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/21.jpg)
So, if we use tags, our criteria is:
DELETE [base]/AllergyIntolerance?patient.identifier=[?]&_tag=[?]
„chained search“ „token parameter“
![Page 22: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/22.jpg)
These are our resources!
That‘s us!
![Page 23: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/23.jpg)
So, in our case:GET [base]/AllergyIntolerance?patient.identifier=[?]&_has:Provenance:agent:device=[?]
We also need to create a Device resource! Advantage: the Provenance Resource also gives us an chance to store the original message for traceability as an Attachment. (…yes, we need to create that resource, too…)
![Page 24: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/24.jpg)
Does that really work?
• Well, we made it work (at least, with tags)after changing the processingorder for Transactions toDELETE > POST > PUT > GET
http://build.fhir.org/http.html#2.42.0.16.2
![Page 25: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/25.jpg)
Now: the field mapping!
• Check the „mapping“ tab at thetop of each resource
• There‘s no „one-size-fits-all“ – V2 structures and FHIR serverrequirements will vary!
• + look at the FHIR mappinglanguage and StructureMapresource!
• + look at ConceptMap resourceand the $translate-Operation!
http://build.fhir.org/mapping-language.htmlhttp://build.fhir.org/structuremap.htmlhttp://build.fhir.org/conceptmap.htmlhttp://build.fhir.org/terminology-service.html#4.6.8
![Page 26: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/26.jpg)
How do I reference a resource that doesn‘t have a url(yet)?• Assign a UUID to every
Bundle.entry.fullUrlThen reference the associatedresource by this uri. The server must replace UUIDs with the actual urls whenprocessing the Transaction
http://build.fhir.org/bundle.html#references
![Page 27: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/27.jpg)
![Page 28: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/28.jpg)
But what if I don‘t want to touch the resource I need toreference?• Conditional Update will update the
matching resource,Conditional Create will create a new resource if none matches. Both can get us into trouble, if wedon‘t have permission tocreate/update specific resources.
• Solution: Use ConditionalReferences instead!
http://build.fhir.org/bundle.html#references
![Page 29: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/29.jpg)
![Page 30: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/30.jpg)
Limitations!
• V2 Source will overwrite all changes and additions to Resources on the Server (-> Patch)
• There is no „trigger“ to invoke additional actions on the server (-> Message/Operations)
• „Merge“ is tricky (-> Operations)
• Doesn‘t work in the absence of REST Protocol (-> Message)
• Is it PV1 actually an Encounter or rather an EpisodeOfCare?
![Page 31: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/31.jpg)
The MERGE hack
• Create two Patient resource from the A40‘s PID, one with the good, onewith the bad identifier.
• Create the conditional update URLs accordingly
• Add a link (type=„replaces“) from the good to the bad Patient
• Add a link (type=„replaced-by“) from the bad to the good Patient
• Set the bad Patient to „inactive“
• Downside: we‘re losing the NK1 information when updating the goodpatient! -> try to PATCH the link into the good Patient instead
![Page 32: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/32.jpg)
What if the server doesn‘t support Transactions?
• Basically, the Transaction Bundle constitutes a list ofindividual, atomic REST interactions. We can run themthrough „post processing“ and split them up.
• But remember: we have to handle the replacing of theUUIDs with the actual URLs ourselves!
• We can even split the Conditional interactions up into a GET and PUT/POST/DELETE interaction,But then we have to deal with the errors on our side.
![Page 33: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/33.jpg)
You can move complexity around, but you can‘t make it go away
(Grahame Grieve)
![Page 34: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/34.jpg)
Client Server
Message
Transaction
Plain REST
Co
mp
lexityC
om
ple
xity
Client Server
![Page 35: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/35.jpg)
V2-based EHR
Integration Engine
FHIR-Server
FHIR-Clients
ADT-Messages
Transaction-Bundles
![Page 36: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/36.jpg)
V2-based EHR
Integration Engine
FHIR-Server
FHIR-Clients
ORU-Messages
/Observation/_history
Searchset Bundle?
![Page 37: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/37.jpg)
_history Subscription
+ reliability
+ simple to implement
+ repeatable (if something wentwrong)
- not selective/high traffic
- delay
- second interaction for includes
+ realtime
+ selective
+ low bandwidth
- no queueing
- no trigger if a resource drops out of your selection
![Page 38: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/38.jpg)
What next?
• Tell us about your use case and join the Hands On
• Give feedback at https://chat.fhir.org/#narrow/stream/v2.20to.20FHIR
• Join the discussion on how to handle merge
• Join the next connectathon in San Antonio and help us toevaluate Subscription and _history interactions to transferResources from a FHIR server back to a V2 systemhttp://wiki.hl7.org/index.php?title=201701_Resource_Subscription_Track
![Page 39: Building Bridges: Mapping HL7 V2 to FHIR - FHIR DevDays · •Create two Patient resource from the A40‘s PID, one with the good, one with the bad identifier. •Create the conditional](https://reader034.vdocument.in/reader034/viewer/2022042409/5f261ecd7152fe48254618db/html5/thumbnails/39.jpg)
wemake fhir®work