FHIR Chat · R3 to R4 StructureDefinition transformation · implementers

Stream: implementers

Topic: R3 to R4 StructureDefinition transformation


view this post on Zulip Ardon Toonstra (Sep 30 2020 at 22:34):

I am trying to convert a STU3 StructureDefinition to R4 with the Java validator. Not sure I am doing it correctly, as I am getting the below error. Any help or pointers would be great!

PS C:\git\java-validator-transform> java -jar validator_cli.jar zib-AllergyIntolerance.xml -output output-zib-AllergyIntolerance.xml -transform http://hl7.org/fhir/StructureMap/StructureDefinition3to4 -version 3.0 -ig hl7.fhir.xver.r4#1.2.0
FHIR Validation tool Version 5.1.15 (Git# 5bb59c3b8265). Built 2020-09-26T00:16:14.10Z (4 days old)
  Java:   1.8.0_241 from C:\Program Files\Java\jre1.8.0_241 on amd64 (64bit). 3616MB available
  Paths:  Current = C:\git\java-validator-transform, Package Cache = C:\Users\Ardon\.fhir\packages
  Params: zib-AllergyIntolerance.xml -output output-zib-AllergyIntolerance.xml -transform http://hl7.org/fhir/StructureMap/StructureDefinition3to4 -version 3.0 -ig hl7.fhir.xver.r4#1.2.0
Loading
  Load FHIR v3.0 from hl7.fhir.r3.core#3.0.2 - 4017 resources (00:04.0215)
  Terminology server http://tx.fhir.org - Version 1.0.353 (00:02.0194)
  Load hl7.fhir.xver.r4#1.2.0 - 2327 resources (00:10.0589)
  Get set...  go (00:00.0047)
 ...Failure: null
java.lang.NullPointerException
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.PrintWriter.<init>(Unknown Source)
        at org.hl7.fhir.validation.ValidationEngine.setMapLog(ValidationEngine.java:1602)
        at org.hl7.fhir.validation.cli.services.ValidationService.transform(ValidationService.java:152)
        at org.hl7.fhir.validation.Validator.main(Validator.java:192)
Done. Times: Loading: 00:17.0303

view this post on Zulip Grahame Grieve (Oct 01 2020 at 01:43):

fixed next release

view this post on Zulip Jens Villadsen (Oct 01 2020 at 07:14):

I wasn't aware of that feature - thats awesome!

view this post on Zulip Ardon Toonstra (Oct 05 2020 at 10:08):

@Grahame Grieve Thanks. The next releases fixed that issue. But I run into another one (it now started with the transform). The same issue happens wilt multiple profiles, with and without snapshot.

PS C:\git\java-validator-transform> java -jar validator_cli.jar zib-AllergyIntolerance.xml -output output-zib-AllergyIntolerance.xml -transform http://hl7.org/fhir/StructureMap/StructureDefinition3to4 -version 3.0 -ig hl7.fhir.xver.r4#1.2.0
FHIR Validation tool Version 5.1.16 (Git# ea0b4c0c1c10). Built 2020-10-01T04:39:09.65Z (4 days old)
  Java:   1.8.0_241 from C:\Program Files\Java\jre1.8.0_241 on amd64 (64bit). 3616MB available
  Paths:  Current = C:\git\java-validator-transform, Package Cache = C:\Users\Ardon\.fhir\packages
  Params: zib-AllergyIntolerance.xml -output output-zib-AllergyIntolerance.xml -transform http://hl7.org/fhir/StructureMap/StructureDefinition3to4 -version 3.0 -ig hl7.fhir.xver.r4#1.2.0
Exception in thread "main" java.lang.Error: Unrecognised name valueSet on binding
        at org.hl7.fhir.r5.elementmodel.Element.makeProperty(Element.java:456)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.processTarget(StructureMapUtilities.java:1859)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1435)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1422)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.executeDependency(StructureMapUtilities.java:1481)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1443)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1422)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1456)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1439)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1422)
        at org.hl7.fhir.r5.utils.StructureMapUtilities.transform(StructureMapUtilities.java:1384)
        at org.hl7.fhir.validation.ValidationEngine.transform(ValidationEngine.java:1537)
        at org.hl7.fhir.validation.ValidationEngine.transform(ValidationEngine.java:1524)
        at org.hl7.fhir.validation.cli.services.ValidationService.transform(ValidationService.java:153)
        at org.hl7.fhir.validation.Validator.main(Validator.java:194)

view this post on Zulip Vadim Peretokin (Oct 13 2020 at 09:40):

It seems to bomb out processing this rule:

src.valueSet : Reference as vs0 -> tgt.valueSet as vt0 then Reference2Canonical(vs0, vt0) "binding-valueSetR";

For some reason the engine can't create the valueSet inside binding.

view this post on Zulip Jens Villadsen (Mar 11 2021 at 14:15):

Yep ... seeing the same thing. @Grahame Grieve is this something you'll have a look at?

view this post on Zulip Jens Villadsen (Mar 11 2021 at 14:16):

rule : binding-valueSetU; vars = source variables [src: (Element)], target variables [tgt: (Element)], shared variables []
              rule : binding-valueSetR; vars = source variables [src: (Element)], target variables [tgt: (Element)], shared variables []
Exception in thread "main" java.lang.Error: Unrecognised name valueSet on binding
    at org.hl7.fhir.r5.elementmodel.Element.makeProperty(Element.java:456)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.processTarget(StructureMapUtilities.java:1631)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.executeRule(StructureMapUtilities.java:1209)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1196)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.executeDependency(StructureMapUtilities.java:1255)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.executeRule(StructureMapUtilities.java:1217)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1196)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.executeRule(StructureMapUtilities.java:1230)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.executeRule(StructureMapUtilities.java:1213)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1196)
    at org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities.transform(StructureMapUtilities.java:1158)
    at org.hl7.fhir.validation.ValidationEngine.transform(ValidationEngine.java:392)
    at org.hl7.fhir.validation.ValidationEngine.transform(ValidationEngine.java:382)
    at org.hl7.fhir.validation.cli.services.ValidationService.transform(ValidationService.java:167)
    at org.hl7.fhir.validation.ValidatorCli.doValidation(ValidatorCli.java:206)
    at org.hl7.fhir.validation.ValidatorCli.main(ValidatorCli.java:158)

view this post on Zulip Jens Villadsen (Mar 11 2021 at 14:22):

Or @Vadim Peretokin - would it be you?

view this post on Zulip Jens Villadsen (Mar 11 2021 at 15:11):

@Erik Nielsen - this should also have your attention

view this post on Zulip Jens Villadsen (Mar 12 2021 at 11:51):

Hmmm ... it seems to work without snapshots ;)

view this post on Zulip Jens Villadsen (Apr 06 2021 at 11:53):

Hmmm ... guess I didn't look at the details. It still doesn't work. If you run it on SD's without snapshot, the output fhirVersion is still stated as 3.0.1

view this post on Zulip Jens Villadsen (Apr 06 2021 at 11:54):

@Grahame Grieve would you know what is causing this issue?

view this post on Zulip Jens Villadsen (Apr 06 2021 at 12:23):

FHIR Validation tool Version 5.3.8 (Git# 282188388860). Built 2021-04-01T18:57:27.206Z (4 days old)

view this post on Zulip Jens Villadsen (Apr 07 2021 at 08:31):

@Ward Weistra does Firely Terminal support transformation of SD's from one FHIR version to another? eg. from STU3 to R4

view this post on Zulip Ward Weistra (Apr 07 2021 at 10:02):

@Jens Villadsen It does not yet.
We've thought about building the Mapping Engine into Firely Terminal. But I understood mapping between different FHIR versions was more provided as a documentation than something which you could really run for transformations. The most general process I know is changing the fhirVersion field in your StructureDefinition, opening in Forge and resolving the errors you get.
Perhaps @Gustav Vella knows more on where inter-FHIR version mappings stand :smile:

view this post on Zulip Gustav Vella (Apr 08 2021 at 15:51):

Ward Weistra said:

Jens Villadsen It does not yet.
We've thought about building the Mapping Engine into Firely Terminal. But I understood mapping between different FHIR versions was more provided as a documentation than something which you could really run for transformations. The most general process I know is changing the fhirVersion field in your StructureDefinition, opening in Forge and resolving the errors you get.
Perhaps Gustav Vella knows more on where inter-FHIR version mappings stand :)

Hi Ward, we worked on an estimation for the mapper to support this and may pick it up depending customer decison:

Prerequisites and estimations
Prerequisite 1: The Mapping Engine must provide both StructureDefinitions from R3 and R4

Option 1
In order to fulfill this prerequisite, one needs StructureDefinitionProviders from multiple Information Models.

=> Estimation: unclear (10-20 person-days + the help of Firely due to firely server dependency)

Option 2 (Workaround)
In order to eliminate prerequisite 1, one could theoretically use a workaround. In this workaround, one would append a FHIR version number in all the StructureDefinitions' profile URLs during a preprocessing step. These preprocessed StructureDefinitions would then be imported into the desired information model (i.e. import stu3 into r4) and used in conjunction with the alias functionality for usage in the map.

=> Estimation: 4 person-days

Prerequisite 2: The Mapping Engine must be able to deal with the alias at the top of the map
Currently, this is not working. We estimate 3-4 days for this functionality.

=> Estimation: 3-4 person-days

Prerequisite 3: The Mapping Engine must provide the conditional : source side rules
In order for this to work, our parser and the MappingEngine should be able to handle the conditional : source side rules.

=> Estimation: 0 person-days

Prerequisite 4: The Mapping Engine must be able to deal with the extends keyword
In order for this to work, our parser and the MappingEngine should be able to handle the 'extends' keyword in the group definition. The 'extends' keyword marks groups that extend other groups and will automatically call all rules in the extended group as well.

=> Estimation: 4-6 person-days

Prerequisite 5: The Mapping Engine must be able to deal with the default mapping groups
In order for this to work, our parser and the MappingEngine should be able to handle the '<>' and '<>' keyword in the group definition. These keywords are used in order to mark default groups for specific types. Groups marked with <> can only exist once with the specified parameters whereas groups marked with <> will also be called if the target type does not match (i.e. if the target element is a choice type, this will be called too as long as the source type matches).

=> Estimation: 4-6 person-days

Total without workaround: 21-36 person days

Total with workaround: 15-20 person days

view this post on Zulip Ward Weistra (Apr 09 2021 at 09:47):

@Gustav Vella Not an easy fix for sure! Thanks for the overview, interesting to know :thumbs_up:

view this post on Zulip Jens Villadsen (Apr 12 2021 at 20:58):

@Grahame Grieve is this something that you are willing to have a look at - or should I just proceed to do this upgrade manually :sob:

view this post on Zulip Jens Villadsen (Apr 14 2021 at 16:21):

view this post on Zulip Grahame Grieve (Apr 16 2021 at 05:58):

it's on my list, but I'm not sure how much I'll be fixing, or when I'll get to it


Last updated: Apr 12 2022 at 19:14 UTC