FHIR Chat · validator Problem processing expression · implementers

Stream: implementers

Topic: validator Problem processing expression


view this post on Zulip Niklas Haldorn (Aug 29 2020 at 12:09):

Hi everyone,
I am using the validator_cli.jar in my programm to validate bundles and redownloaded it about an hour ago from the confluence page, so it should be the most recent one.
But there appears to be a problem with the address.country attribute.
If I remove the country from all addresses, I get a normal output with errors/warnings/informations.
Howevery if there is an address.country attribute somewhere in the bundle the validation fails with the following output:

$ java -jar validator_cli.jar E:/git/validator/toValidate/composition.json -version 4.0 -ig hl7.fhir.uv.ips
FHIR Validation tool Version 5.1.6 (Git# 7349ad1f0e25). Built 2020-08-27T08:10:25.221Z (51 hours old)
Detected Java version: 1.8.0_242 from C:\Program Files\Amazon Corretto\jdk1.8.0_242\jre on amd64 (64bit). 3628MB available
Arguments: E:/git/validator/toValidate/composition.json -version 4.0 -ig hl7.fhir.uv.ips
Directories: Current = E:\git\validator, Package Cache = C:\Users\Niklas\.fhir\packages
.. FHIR Version 4.0, definitions from hl7.fhir.r4.core#4.0.1
.. connect to tx server @ http://tx.fhir.org
(v4.0.1)

  • .. load IG from hl7.fhir.uv.ips
    .. validate [E:/git/validator/toValidate/composition.json]
    Validation Infrastructure fail validating E:/git/validator/toValidate/composition.json: Problem processing expression IF country NOT IN http://hl7.org/fhir/ValueSet/iso3166-1-2 THEN country IN http://hl7.org/fhir/ValueSet/iso3166-1-3 in profile http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips path Bundle.entry[1].resource.ofType(Patient).address[0].country: Error in ?? at 1, 2: Premature ExpressionNode termination at unexpected token "country"
    Exception in thread "main" org.hl7.fhir.exceptions.FHIRException: org.hl7.fhir.exceptions.FHIRException: Problem processing expression IF country NOT IN http://hl7.org/fhir/ValueSet/iso3166-1-2 THEN country IN http://hl7.org/fhir/ValueSet/iso3166-1-3 in profile http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips path Bundle.entry[1].resource.ofType(Patient).address[0].country: Error in ?? at 1, 2: Premature ExpressionNode termination at unexpected token "country"
    at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:1266)
    at org.hl7.fhir.validation.cli.services.ValidationService.validateSources(ValidationService.java:73)
    at org.hl7.fhir.validation.Validator.main(Validator.java:210)
    Caused by: org.hl7.fhir.exceptions.FHIRException: Problem processing expression IF country NOT IN http://hl7.org/fhir/ValueSet/iso3166-1-2 THEN country IN http://hl7.org/fhir/ValueSet/iso3166-1-3 in profile http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips path Bundle.entry[1].resource.ofType(Patient).address[0].country: Error in ?? at 1, 2: Premature ExpressionNode termination at unexpected token "country"
    at org.hl7.fhir.validation.instance.InstanceValidator.checkInvariant(InstanceValidator.java:4574)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkInvariants(InstanceValidator.java:4524)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkInvariants(InstanceValidator.java:4415)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4061)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:3931)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4200)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:3931)
    at org.hl7.fhir.validation.instance.InstanceValidator.startInner(InstanceValidator.java:3674)
    at org.hl7.fhir.validation.instance.InstanceValidator.start(InstanceValidator.java:3585)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateResource(InstanceValidator.java:4657)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateContains(InstanceValidator.java:3831)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4102)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:3931)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4119)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:3931)
    at org.hl7.fhir.validation.instance.InstanceValidator.startInner(InstanceValidator.java:3674)
    at org.hl7.fhir.validation.instance.InstanceValidator.start(InstanceValidator.java:3561)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateResource(InstanceValidator.java:4657)
    at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:688)
    at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:541)
    at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:1355)
    at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:1259)
    ... 2 more

The problem appears to be the expression, that is used to validate the attribute.
Does anyone know a way to fix this?

Thanks for your attention,
Niklas

view this post on Zulip Lloyd McKenzie (Aug 29 2020 at 14:46):

It seems that the invariant it's complaining about in your build is different than the text of the current invariant. @Rob Hausam

view this post on Zulip Grahame Grieve (Aug 30 2020 at 21:29):

I can't reproduce this. I use the bundle example from the current specification, and validated like so

[jar] -version 4.0 C:\temp\ips.json -ig hl7.fhir.uv.ips:

FHIR Validation tool Version 5.0.7-SNAPSHOT (Git# 6bc790d98b04). Built 2020-06-07T08:35:37.25+10:00 (84 days old)
Detected Java version: 1.8.0_251 from C:\Program Files\Java\jre1.8.0_251 on amd64 (64bit). 14526MB available
Arguments: -version 4.0 C:\temp\ips.json -ig hl7.fhir.uv.ips
Directories: Current = c:\temp, Package Cache = C:\Users\graha\.fhir\packages
  .. FHIR Version 4.0, definitions from hl7.fhir.r4.core#4.0.1
  .. connect to tx server @ http://tx.fhir.org
    (v4.0.1)
+  .. load IG from hl7.fhir.uv.ips
Installing hl7.fhir.uv.ips#0.3.0 to the package cache
  Fetching:..
  Installing: .. done.
  .. validate [C:\temp\ips.json]
[main] INFO org.hl7.fhir.utilities.cache.BasePackageCacheManager - Failed to resolve package hl7.terminology#2.7 from server: http://packages.fhir.org
[main] INFO org.hl7.fhir.utilities.cache.BasePackageCacheManager - Failed to resolve package hl7.terminology#2.7 from server: http://packages2.fhir.org/packages
Installing hl7.terminology#2.7 to the package cache
  Fetching:*FAILURE* validating C:\temp\ips.json:  error:1 warn:3 info:6
  Error @ Bundle.entry[2].resource.ofType(Practitioner).qualification[0].code.coding[0].system (line 340, col81) : URL value 'http://terminology.hl7.org/CodeSystem/v2-0360|2.7' does not resolve
  Information @ Bundle.entry[4].resource.ofType(Condition).severity (line 430, col22) : None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/condition-severity (http://hl7.org/fhir/ValueSet/condition-severity), and a code is recommended to come from this value set) (codes = http://loinc.org#LA6751-7)
  Information @ Bundle.entry[10].resource.ofType(Condition).severity (line 753, col22) : None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/condition-severity (http://hl7.org/fhir/ValueSet/condition-severity), and a code is recommended to come from this value set) (codes = http://loinc.org#LA6750-9)
  Information @ Bundle.entry[0].resource.ofType(Composition).author[0] (line 40, col12) : Details for Practitioner/1c616b24-3895-48c4-9a02-9a64110351ef matching against Profilehttp://hl7.org/fhir/StructureDefinition/Practitioner
  Information @ Bundle.entry[0].resource.ofType(Composition).attester[0].party (line 52, col14) : Details for Practitioner/1c616b24-3895-48c4-9a02-9a64110351ef matching against Profilehttp://hl7.org/fhir/StructureDefinition/Practitioner
  Information @ Bundle.entry[7].resource.ofType(Medication).code.coding[1] (line 597, col14) : Code System URI 'urn:oid:2.16.840.1.113883.2.4.4.1' is unknown so the code cannot be validated
  Information @ Bundle.entry[7].resource.ofType(Medication).code.coding[2] (line 602, col14) : Code System URI 'urn:oid:2.16.840.1.113883.2.4.4.7' is unknown so the code cannot be validated
  Warning @ Bundle.entry[1].resource.ofType(Patient).contact[0].relationship[0] (line 274, col16) : None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/patient-contactrelationship (http://hl7.org/fhir/ValueSet/patient-contactrelationship), and a code should come from this value set unless it has no suitable code) (codes = http://terminology.hl7.org/CodeSystem/v3-RoleCode#MTH)
  Warning @ Bundle.entry[4].resource.ofType(Condition).category[0] (line 419, col12) : None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/condition-category (http://hl7.org/fhir/ValueSet/condition-category), and a code should come from this value set unless it has no suitable code) (codes = http://loinc.org#75326-9)
  Warning @ Bundle.entry[10].resource.ofType(Condition).category[0] (line 742, col12) : None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/condition-category (http://hl7.org/fhir/ValueSet/condition-category), and a code should come from this value set unless it has no suitable code) (codes = http://loinc.org#75326-9)

view this post on Zulip Niklas Haldorn (Aug 31 2020 at 09:02):

Does the validator use the meta.profile Attribute to choose which profile to validate against?
Because the error occurs when trying to validate a patient resource against the Patient(IPS) profile, but the patient in the ips bundle example has no meta.profile attribute.
If the attribute is added and set to the Patient(IPS) profiles official URL ("http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips") the validation fails with the same error.

view this post on Zulip Grahame Grieve (Aug 31 2020 at 09:41):

It does, so that is possibly the cause. do you want to post the bundle you are validating? (or just send it to me directly)

view this post on Zulip Grahame Grieve (Aug 31 2020 at 09:42):

It does, so that is possibly the cause. do you want to post the bundle you are validating? (or just send it to me directly)

view this post on Zulip Niklas Haldorn (Aug 31 2020 at 11:05):

composition_test.json

view this post on Zulip Niklas Haldorn (Sep 09 2020 at 09:00):

The problem appears to be caused by an older ips version. I checked my FHIR package cache and realised there was an hl7.fhir.uv.ips#0.3.0 folder and an hl7.fhir.uv.ips#1.0.0 folder, so I deleted both to check which one the validator is using. If I start the validator with -ig hl7.fhir.uv.ips, it downloads hl7.fhir.uv.ips#0.3.0 and the validation fails. However if I explicitly use the current version and start the validator with -ig hl7.fhir.uv.ips#1.0.0 or hl7.fhir.uv.ips#current it works.

view this post on Zulip Grahame Grieve (Sep 14 2020 at 06:26):

is this still a problem with the current validator?

view this post on Zulip Niklas Haldorn (Sep 14 2020 at 09:10):

It still happens. If the validator is started with http://hl7.org/fhir/uv/ips/ , hl7.fhir.uv.ips#1.0.0 or hl7.fhir.uv.ips#current as ig it works, but with hl7.fhir.uv.ips it downloads hl7.fhir.uv.ips#0.3.0 and the validation fails. But I as far as I understand it, the validator is behaving correctly and the problem is caused by the ig. I checked the entries on https://registry.fhir.org/package/hl7.fhir.uv.ips|0.3.0 and the simplifier package list and both show 0.3.0 as latest version, so the validator validates against the currenty published version, when no version is specified.


Last updated: Apr 12 2022 at 19:14 UTC