FHIR Chat · Using custom maps to convert from STU3 to R4 · implementers

Stream: implementers

Topic: Using custom maps to convert from STU3 to R4


view this post on Zulip Debashish Ghosh (Jun 08 2020 at 16:13):

Hi,
I am currently exploring the Validator tool ( https://github.com/hapifhir/org.hl7.fhir.core) to convert from one Fhir version to another . The default maps provided (https://github.com/FHIR/packages/tree/master/interversion/r4/R3toR4) suffices for most of the cases .
But in future if we want to add some extensions we would want to be able to use the updated .map version for that resource to accomodate that . For example I am using the following comandline arguments for the Validator Tool to use my local custom map for Resource Condition .
c:\fhirmessages\fhir_condition_epic_stu3_searched.json -version 3.0 -to-version 4.0 -output c:\fhirmessages\fhir_condition_epic_r4_searched_output.json -do-native -ig C:\fhirmessages\maps_new

The last argument -ig refers to the directory from where it should load my updated Condtions.map.
But while running it keeps giving the following error :

  • .. load IG from C:\fhirmessages\maps_new
  • load file: Condition.txt - ignored due to error: (null - NPE)

Am I missing something here . Has anybody used this tool to do conversion using you custom maps ?

Any help on this is greatly appreciated !

Thanks

view this post on Zulip Lloyd McKenzie (Jun 08 2020 at 16:15):

@Grahame Grieve

view this post on Zulip Grahame Grieve (Jun 08 2020 at 18:49):

you pointed it to a directory to load content from. It's just telling you that it found a file in there that it couldn't read as loadable content. In this case, it looks like it shouldn't be loaded, so that's fine

view this post on Zulip Debashish Ghosh (Jun 08 2020 at 19:36):

Thanks for your reply . So I am trying to do a conversion from STU3 to R4 and following the documentation https://wiki.hl7.org/Using_the_FHIR_Validator_to_transform_content#R3_.2F_R4_conversions .

Based on the documentation I provided the following arguments to the tool :
c:\fhirmessages\fhir_condition_epic_stu3_searched.json -transform http://hl7.org/fhir/StructureMap/Condition3to4 -ig C:\fhirmessages\maps_new\interversion\r4\R3toR4 -output c:\fhirmessages\fhir_condition_epic_r4_searched_output.json -log c:\fhirmessages\log\logs.txt

I changed the Conditions.map file in C:\fhirmessages\maps_new\interversion\r4\R3toR4 and also copied all other files in this directory from https://github.com/FHIR/packages .
It keeps giving me the following error :

  • .. load IG from C:\fhirmessages\maps_new\interversion\r4\R3toR4
    ..Detect format for C:\fhirmessages\maps_new\interversion\r4\R3toR4\AdverseEvent.map.bak
    [Fatal Error] :1:1: Content is not allowed in prolog.

  • load file: ConceptMaps.txt - ignored due to error: Error in ConceptMaps.txt at 8, 6: Unknown relationship token '='
    Start Transform http://hl7.org/fhir/StructureMap/Condition3to4
    Group : Condition; vars = source variables [src: (Bundle)], target variables [tgt: (Condition)], shared variables []
    Exception in thread "main" java.lang.Error: duplicate
    at org.hl7.fhir.r5.utils.StructureMapUtilities.findMatchingMaps(StructureMapUtilities.java:1534)
    at org.hl7.fhir.r5.utils.StructureMapUtilities.resolveGroupReference(StructureMapUtilities.java:1671)
    at org.hl7.fhir.r5.utils.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1402)
    at org.hl7.fhir.r5.utils.StructureMapUtilities.transform(StructureMapUtilities.java:1369)
    at org.hl7.fhir.validation.ValidationEngine.transform(ValidationEngine.java:1215)
    at org.hl7.fhir.validation.ValidationEngine.transform(ValidationEngine.java:1202)
    at org.hl7.fhir.validation.cli.services.ValidationService.transform(ValidationService.java:138)
    at org.hl7.fhir.validation.Validator.main(Validator.java:180)

I just want to change some mapping in the resource Condition and see how easy it is to update the mappings .
Is there a trick I am missing out here to get this working ?

Thanks!

view this post on Zulip Grahame Grieve (Jun 08 2020 at 21:29):

well, it looks like you have a syntax error in tour revised mapping


Last updated: Apr 12 2022 at 19:14 UTC