FHIR Chat · Java validator picks wrong version? · argonaut

Stream: argonaut

Topic: Java validator picks wrong version?


view this post on Zulip Yunwei Wang (Jul 24 2021 at 01:28):

I run latest java validator against a Provenance resource

java -jar validator_cli_5.4.9.jar -version 4.0.1 -ig hl7.fhir.us.core -profile http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance provenance-1.xml

I got a strange error

  Validate provenance-1.xmlValidation Infrastructure fail validating provenance-1.xml: Problem processing expression ($this.agent.who.resolve().is Practitioner or Device) implies exists() in profile http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance path Provenance.agent[0].onBehalfOf: Error @1, 2: Found Practitioner expecting a ")"
Exception in thread "main" org.hl7.fhir.exceptions.FHIRException: org.hl7.fhir.exceptions.FHIRException: Problem processing expression ($this.agent.who.resolve().is Practitioner or Device) implies exists() in profile http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance path Provenance.agent[0].onBehalfOf: Error @1, 2: Found Practitioner expecting a ")"
    at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:339)
    at org.hl7.fhir.validation.cli.services.ValidationService.validateSources(ValidationService.java:91)
    at org.hl7.fhir.validation.ValidatorCli.doValidation(ValidatorCli.java:238)
    at org.hl7.fhir.validation.ValidatorCli.main(ValidatorCli.java:159)

When I look the header of the log, I notice a strange version (US Core v3.1.0) is used for validation

  Load FHIR v4.0 from hl7.fhir.r4.core#4.0.1 - 4575 resources (00:03.0904)
  Load hl7.terminology#2.1.0 - 3767 resources (00:01.0078)
  Terminology server http://tx.fhir.org - Version 1.9.378 (00:01.0239)
  Load hl7.fhir.us.core#3.1.0 - 143 resources (00:00.0042)

The validator document says when NOT specifing a version, the _current published version_ of the IG is used.
The current published version of US Core is 4.0.0 not 3.1.0

So the question is why validator pulls US Core v3.1.0 as "current published version"?
@Eric Haas @Lloyd McKenzie

view this post on Zulip Lloyd McKenzie (Jul 24 2021 at 01:36):

That seems like a package server issue - @Mark Iantorno ?

view this post on Zulip Mark Iantorno (Jul 26 2021 at 10:38):

hrm that's no good

view this post on Zulip Mark Iantorno (Jul 26 2021 at 10:39):

I"ll look into it this morning

view this post on Zulip Mark Iantorno (Jul 26 2021 at 10:40):

So the fhir version is fine, it's the us core version profile version that's the incorrect one, right?

view this post on Zulip Yunwei Wang (Jul 26 2021 at 13:25):

Yes. US Core is default set to v3.1.0. The correct default version (current published) is v4.0.0

view this post on Zulip Mark Iantorno (Jul 26 2021 at 13:55):

So, strangely enough, when I run that command:

view this post on Zulip Mark Iantorno (Jul 26 2021 at 13:55):

  Load hl7.terminology#2.1.0 - 3767 resources (00:02.0823)
  Terminology server http://tx.fhir.org - Version 1.9.378 (00:01.0434)
  Load hl7.fhir.us.core#1.0.1 - 52 resources (00:00.0015)
  Get set...  go (00:00.0518)

view this post on Zulip Mark Iantorno (Jul 26 2021 at 13:55):

I get v1.0.1

view this post on Zulip Mark Iantorno (Jul 26 2021 at 13:55):

which is also not correct

view this post on Zulip Mark Iantorno (Jul 26 2021 at 14:00):

@Ward Weistra any reason why the latest package would be incorrect?

view this post on Zulip Ward Weistra (Jul 26 2021 at 15:20):

@Mark Iantorno I don't think it's anything in the FHIR registry mechanics that does this. FHIR Package API (https://app.swaggerhub.com/apis-docs/firely/Simplifier.net_FHIR_Package_API/1.0.1#/default/get__package_name_) nicely lists 4.0.0 as the latest.

Searching on Registry UI also gives you latest package for this: https://registry.fhir.org/results?query=%22http%3A%2F%2Fhl7.org%2Ffhir%2Fus%2Fcore%2FStructureDefinition%2Fus-core-provenance%22&latestFilter=true. Though IF the Java validator is getting this from the package ecosystem, which I'm not sure about, it would of course be using the API. There's a specific catalog search endpoint to search on canonical or other terms, which would be perfect for this.

I remember overhearing there's some specific US realm logic in the IG Publisher (perhaps Java validator too?), perhaps it is somewhere in there?

view this post on Zulip Ward Weistra (Jul 26 2021 at 15:21):

Or, given that it's different for both of you, it could be package cache related? Could just empty your package cache to be sure.

view this post on Zulip Yunwei Wang (Jul 26 2021 at 15:27):

Interesting. It works after empty package cache. Thanks @Ward Weistra

view this post on Zulip Yunwei Wang (Jul 26 2021 at 15:58):

I run some tests with different version of US Core. Here is the steps:

clean package cache
run validator_cli.jar with -ig hl7.fhir.us.core
validator loaded hl7.fhir.us.core#4.0.0 -- ok
run validator_cli.jar with -ig hl7.fhir.us.core#3.1.1
validator loaded hl7.fhir.us.core#3.1.1 -- ok
run validator_cli.jar with -ig hl7.fhir.us.core
validator loaded hl7.fhir.us.core#3.1.1 -- NOT ok
run validator_cli.jar with -ig hl7.fhir.us.core#3.1.0
validator loaded hl7.fhir.us.core#3.1.0 -- ok
run validator_cli.jar with -ig hl7.fhir.us.core
validator loaded hl7.fhir.us.core#3.1.0 -- NOT ok
run validator_cli.jar with -ig hl7.fhir.us.core#3.2.0
validator loaded hl7.fhir.us.core#3.2.0 -- ok
run validator_cli.jar with -ig hl7.fhir.us.core
validator loaded hl7.fhir.us.core#3.1.0 -- NOT ok
remove hl7.fhir.us.core#3.1.0 from package cache
run validator_cli.jar with -ig hl7.fhir.us.core
validator loaded hl7.fhir.us.core#3.1.1 -- NOT ok

For the results, I found that when there are multiple versions in package cache, the validator always pick the lowest version not the highest. Is this a validator bug?

view this post on Zulip Mark Iantorno (Jul 26 2021 at 17:59):

package cache strikes again!

view this post on Zulip Mark Iantorno (Jul 26 2021 at 17:59):

Thanks @Ward Weistra

view this post on Zulip Mark Iantorno (Jul 26 2021 at 18:00):

I am unsure of the code implications of this @Yunwei Wang , but can you get by just clearing your cache for now

view this post on Zulip Yunwei Wang (Jul 26 2021 at 18:12):

I did it again. It is the same result.

clear package cache
run validator_cli.jar with -ig hl7.fhir.us.core
validator loaded hl7.fhir.us.core#4.0.0 -- ok
run validator_cli.jar with -ig hl7.fhir.us.core#3.1.1
validator loaded hl7.fhir.us.core#3.1.1 -- ok
run validator_cli.jar with -ig hl7.fhir.us.core
validator loaded hl7.fhir.us.core#3.1.1 -- NOT ok

I don't know why the last validation uses the v3.1.1 instead of v4.0.0
@Mark Iantorno

view this post on Zulip Mark Iantorno (Jul 26 2021 at 18:18):

Okay, but can you get it to work the way you want

view this post on Zulip Mark Iantorno (Jul 26 2021 at 18:18):

Like, if you clear the cache and then run it with the version you need, does it work?

view this post on Zulip Mark Iantorno (Jul 26 2021 at 18:19):

or, are you saying that your use case involves multiple runs with different versions

view this post on Zulip Yunwei Wang (Jul 26 2021 at 18:48):

Yes. I can get it work. I will create a JIRA ticket for the multiple versions issue. Thanks

view this post on Zulip Ward Weistra (Jul 27 2021 at 11:16):

@Mark Iantorno https://martinfowler.com/bliki/TwoHardThings.html

There are only two hard things in Computer Science: cache invalidation and naming things.

view this post on Zulip Gino Canessa (Jul 27 2021 at 16:26):

Ward Weistra said:

Mark Iantorno https://martinfowler.com/bliki/TwoHardThings.html

There are only two hard things in Computer Science: cache invalidation, naming things, and off-by-one errors.

Fixed it for you! :wink:


Last updated: Apr 12 2022 at 19:14 UTC