Stream: implementers
Topic: Convert DSTU2 JSON to STU3 Json in Javascript
Murari Kirankumar (Jan 21 2019 at 11:22):
As the site implementation, we want to convert the DSTU2 JSON Version to STU3 JSON Version. Can someone suggest me if it is done already or if you have any ideas on how to implement in Javascript?
Lloyd McKenzie (Jan 21 2019 at 15:12):
StructureMaps to convert between DSTU2 and STU3 (independent of syntax) are published as part of the STU3 spec. However, I'm not aware of anyone who's implemented the StructureMap $transform operation in Javascript yet. The FHIRPath engine was only recently implemented. You could either work on $transform to leverage the existing mappings or use them to inform hand-coded transformations of the things you care about.
Gina (Oct 03 2019 at 13:58):
To sort of piggy back on this question. Is there any tools/engines out there that developers can use to do the translation from DSTU2 to STU3 in Java? Or maybe even a plugin like I see Eclipse has for HL7 V2 to V3 Mapping and Transformation. Thank you in advance!
Craig McClendon (Oct 03 2019 at 19:33):
Can anyone comment on what the options are to convert DSTU2 to STU3? I understand that there are StrucutreMaps containing the mappings published with the spec. Is there tooling that can interpret these and actually perform the conversions? I'm assuming yet, but having a difficult time finding anything. Are there other options as well ? Perhaps FHIR Mapping Language (mappings/tooling available)? Thanks!
Grahame Grieve (Oct 03 2019 at 19:54):
HAPI includes an engine that can run those conversions - see StructureMapUtilities. And it also includes an example for how to run it (it's a little tricky to set up. It's on my todo list with James to can a conversion service that does all that)
James Agnew (Oct 03 2019 at 20:00):
that'd be really cool...
Grahame Grieve (Oct 03 2019 at 21:19):
I think we have a stub somewhere to fill out....
Craig McClendon (Oct 09 2019 at 14:07):
@Grahame Grieve
I'm trying to make sense of this and could use a nudge in the right direction.
My end goal is to be able to convert R2 to R3 resources.
I am not finding any StrucutreMap resources published with the spec, but do see FML defintions.
In HAPI, I found a StructureMapUtilities.parse(..) method that appears to convert FML into a StructureMap.
I found the StructureMapUtilities.transform(..) method:
public void transform(Object appInfo, Base source, StructureMap map, Base target)
That sort of looks like what I'd need, except the source and target are fixed to a specific package/fhirversion so likely won't work for moving between versions.
I have not found the example mentioned on how to run it.
Can you point me in the right direction and/or clear up any misunderstandings I've stated above?
Lloyd McKenzie (Oct 09 2019 at 15:43):
@Grahame Grieve
Grahame Grieve (Oct 15 2019 at 22:23):
the class org.hl7.fhir.convertors.R2R3ConversionManager in HAPI brings all this together
Craig McClendon (Oct 22 2019 at 23:17):
@Grahame Grieve (or others). The R2R3ConversionManager class references this file:
http://hl7.org/fhir/r2r3maps.zip
I can't access it there, any idea where to get it?
Thanks again.
Grahame Grieve (Oct 24 2019 at 21:25):
the source is here: https://github.com/FHIR/interversion
Last updated: Apr 12 2022 at 19:14 UTC