FHIR Chat · NPEs with older versions or unsupported version "current" · mapping-framework

Stream: mapping-framework

Topic: NPEs with older versions or unsupported version "current"


view this post on Zulip Harrison Tarr (Dec 30 2019 at 13:41):

Hi all,
i'm trying to learn and play with the fhir mapping language. i'm using the resources in
https://www.hl7.org/fhir/mapping-tutorial.html
https://wiki.hl7.org/index.php?title=Using_the_FHIR_Mapping_Language
https://www.devdays.com/wp-content/uploads/2018/06/DD18-US-R4-Mapping-Language-Grahame-Grieve-2018-06-21.pdf and
https://github.com/ahdis/fhir-mapping-tutorial

i'm trying to use the command line jar to take in a source XML file, like in the tutorial example step 1, and convert it to the TRight format. i used implemented resource files for the TLeft and TRight structure defs and the map from the github link. I had to make some updates to the SDs and the map - it seems they were made for an older format? i noticed some differences between the hl7 documentation and the PDF / github.

my current issue is that i'm running into an inevitable NPE when trying to use version 3.0 or 4.0:
lines 844 or 855 of the ValidatorEngine (3.0 / 4.0 respectively) are

        res = new org.hl7.fhir.dstu3.utils.StructureMapUtilities(null).parse(new String(content));
        res = new org.hl7.fhir.r4.utils.StructureMapUtilities(null).parse(new String(content), fn);

then later in the StructureMapUtilities constructor, it attempts to call a method on the null and it throws an NPE.
I noticed that the current version if statement uses different parse logic:

        r = new StructureMapUtilities(context, null, null).parse(TextFile.bytesToString(content), fn);

however, i can't figure out how to get into that if-block, since it checks for equality to 4.1 but the version variable is always set to "current" at that point.

any assistance or add'l resources would be super helpful!

view this post on Zulip Harrison Tarr (Dec 30 2019 at 13:43):

structuredefinition-tright.xml structuredefinition-tleft.xml step1.map

i've attached my edited versions of the structure documents and map

view this post on Zulip David Hay (Dec 31 2019 at 09:19):

Hi Harrison - take a look at https://fhirblog.com/2019/12/20/making-a-transaction-bundle-using-the-mapping-language/ and the prior post it references. That might help you (I'm learning too :) )

view this post on Zulip Lloyd McKenzie (Jan 03 2020 at 14:54):

@Grahame Grieve

view this post on Zulip Oliver Egger (Jan 05 2020 at 20:33):

@Harrison Tarr : the ahdis repo you were referring to was based on STU3, the maps and structuredefinitions have been now updated to R4, thanks for your notice. To use the maps with the java validator you need currently a patched version https://github.com/ahdis/org.hl7.fhir.core/releases/download/4.1.38-dev/org.hl7.fhir.validation.cli-4.1.38-SNAPSHOT.jar, otherwise the maps cannot be loaded, I need to provide a pull reqeuest for this.

view this post on Zulip Oliver Egger (Jan 05 2020 at 20:36):

The validator uses the r5.StructureMapUtilities, how you do end up in dstu3 or r4 NPE's?

view this post on Zulip Harrison Tarr (Jan 08 2020 at 17:22):

@Oliver Egger
when i run it with the jar you provided, i get this output:

 .. FHIR Version current, definitions from hl7.fhir.r5.core#current
  .. connect to tx server @ http://tx.fhir.org
    (vcurrent)
+  .. load IG from /Users/harrison/projects/helios/fhir-mapping-tutorial/maptutorial/step1/logical/
* load file: structuredefinition-tright.xml - ignored due to error: Unsupported version current
* load file: structuredefinition-tleft.xml - ignored due to error: Unsupported version current
+  .. load IG from /Users/harrison/projects/helios/fhir-mapping-tutorial/maptutorial/step1/map/step1.map
* load file: /Users/harrison/projects/helios/fhir-mapping-tutorial/maptutorial/step1/map/step1.map - ignored due to error: Unsupported version current
 ...Failure: This does not appear to be a FHIR resource (unknown namespace/name 'http://hl7.org/fhir/tutorial::TLeft') at line 0 col 0
org.hl7.fhir.exceptions.FHIRFormatError: This does not appear to be a FHIR resource (unknown namespace/name 'http://hl7.org/fhir/tutorial::TLeft') at line 0 col 0
    at org.hl7.fhir.r5.elementmodel.ParserBase.logError(ParserBase.java:88)
    at org.hl7.fhir.r5.elementmodel.ParserBase.getDefinition(ParserBase.java:110)
    at org.hl7.fhir.r5.elementmodel.XmlParser.parse(XmlParser.java:171)
    at org.hl7.fhir.r5.elementmodel.XmlParser.parse(XmlParser.java:163)
    at org.hl7.fhir.r5.elementmodel.XmlParser.parse(XmlParser.java:135)
    at org.hl7.fhir.r5.elementmodel.Manager.parse(Manager.java:78)
    at org.hl7.fhir.r5.validation.ValidationEngine.transform(ValidationEngine.java:1229)
    at org.hl7.fhir.r5.validation.ValidationEngine.transform(ValidationEngine.java:1222)
    at org.hl7.fhir.r5.validation.Validator.main(Validator.java:592)

i think that's caused by the second error i mentioned above, where it interprets the version as "current" but then tries to compare it to "4.1". this is still using the same SD and map file that i provided above

view this post on Zulip Oliver Egger (Jan 08 2020 at 18:17):

please try with the updated structuredefintions and map in the repo, they had all to be adjusted.

view this post on Zulip Harrison Tarr (Jan 08 2020 at 20:08):

@Oliver Egger fantastic! i just pulled and reran according to the instructions and step 1 worked! i see that according to the readme some of the following steps fail, is that because of missing support in the jar or something else?
in any case, thank you so much for your help!

view this post on Zulip Oliver Egger (Jan 08 2020 at 20:42):

@Harrison Tarr glad that it works. some of the steps fail because the java mapping language implementation does not work with the map provided for the fhir tutorial. as i am also learning to work with the fhir mapping language I did not yet check if its an issued in the tutorial or in the fhir mapping language implementation, the jar is just the same as the validator, just a different branch with a few commits ahead and behind, see https://github.com/ahdis/org.hl7.fhir.core


Last updated: Apr 12 2022 at 19:14 UTC