FHIR Chat · Validation of codes fails after terminology server downtime · implementers

Stream: implementers

Topic: Validation of codes fails after terminology server downtime


view this post on Zulip Morten Ernebjerg (Jul 18 2018 at 07:01):

Last week, the terminology server used by default by the Java JAR validator (tx.fhir.org/r3) was down for several days, causing validation errors. Now it's back up again, but I am seeing validation errors when validating codes in resources that had no errors before. All the errors have the same form, e.g.:

Error @ Observation.code.coding (line 8, col17) : Error null validating Coding

As far as I can tell, I get this for every field containing a code with a coding system. I am using a validator JAR downloaded today.

Was there a deliberate change in the way codes are handled or is it a bug?

view this post on Zulip Grahame Grieve (Jul 18 2018 at 07:07):

bug

view this post on Zulip Grahame Grieve (Jul 18 2018 at 07:08):

things are changing too quickly.... my aim is to have all the substantiative changes made and things stable by the end of next week

view this post on Zulip Morten Ernebjerg (Jul 18 2018 at 08:06):

OK, thanks for the update!

view this post on Zulip Morten Ernebjerg (Aug 24 2018 at 08:29):

Hi @Grahame Grieve Reviving this thread as I came across what seems to be a related problem. The validator now appears to break completely with the default terminology server.:

java -jar org.hl7.fhir.validator.jar -defn http://hl7.org/fhir patient-example.xml
  .. load FHIR from http://hl7.org/fhir
  .. connect to tx server @ http://tx.fhir.org/r3
Exception in thread "main" org.hl7.fhir.dstu3.utils.client.EFhirClientException: Error parsing response message
        at org.hl7.fhir.dstu3.utils.client.ClientUtils.unmarshalReference(ClientUtils.java:284)
        at org.hl7.fhir.dstu3.utils.client.ClientUtils.issueResourceRequest(ClientUtils.java:179)
        at org.hl7.fhir.dstu3.utils.client.ClientUtils.issueResourceRequest(ClientUtils.java:161)
        at org.hl7.fhir.dstu3.utils.client.ClientUtils.issueResourceRequest(ClientUtils.java:152)
        at org.hl7.fhir.dstu3.utils.client.ClientUtils.issueGetResourceRequest(ClientUtils.java:99)
        at org.hl7.fhir.dstu3.utils.client.FHIRToolingClient.getCapabilitiesStatementQuick(FHIRToolingClient.java:169)
        at org.hl7.fhir.dstu3.context.SimpleWorkerContext.connectToTSServer(SimpleWorkerContext.java:161)
        at org.hl7.fhir.dstu3.validation.ValidationEngine.connectToTSServer(ValidationEngine.java:316)
        at org.hl7.fhir.dstu3.validation.ValidationEngine.<init>(ValidationEngine.java:169)
        at org.hl7.fhir.dstu3.validation.Validator.main(Validator.java:214)
Caused by: org.hl7.fhir.exceptions.FHIRFormatError: only whitespace content allowed before start tag and not D (position: START_DOCUMENT seen D... @1:1)
        at org.hl7.fhir.dstu3.formats.XmlParserBase.parse(XmlParserBase.java:90)
        at org.hl7.fhir.dstu3.utils.client.ClientUtils.unmarshalReference(ClientUtils.java:277)
        ... 9 more
Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not D (position: START_DOCUMENT seen D... @1:1)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1519)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at org.hl7.fhir.dstu3.formats.XmlParserBase.next(XmlParserBase.java:192)
        at org.hl7.fhir.dstu3.formats.XmlParserBase.loadXml(XmlParserBase.java:182)
        at org.hl7.fhir.dstu3.formats.XmlParserBase.parse(XmlParserBase.java:87)

If I explicitly switch off the terminology server (i.e. add -tx n/a), it works fine. However, if I do not set the -defn option, I get another error with or without terminology server (same error in both cases):

java -jar org.hl7.fhir.validator.jar patient-example.xml -tx n/a
  .. load FHIR from http://build.fhir.org/
  .. connect to tx server @ null
Exception in thread "main" java.lang.ClassCastException: com.google.gson.JsonArray cannot be cast to com.google.gson.JsonObject
        at com.google.gson.JsonObject.getAsJsonObject(JsonObject.java:182)
        at org.hl7.fhir.dstu3.formats.JsonParser.parseCodeSystemProperties(JsonParser.java:5018)
        at org.hl7.fhir.dstu3.formats.JsonParser.parseCodeSystem(JsonParser.java:5007)
        at org.hl7.fhir.dstu3.formats.JsonParser.parseResource(JsonParser.java:19571)
        at org.hl7.fhir.dstu3.formats.JsonParser.parseBundleBundleEntryComponentProperties(JsonParser.java:2754)
        at org.hl7.fhir.dstu3.formats.JsonParser.parseBundleBundleEntryComponent(JsonParser.java:2737)
        at org.hl7.fhir.dstu3.formats.JsonParser.parseBundleProperties(JsonParser.java:2710)
        at org.hl7.fhir.dstu3.formats.JsonParser.parseBundle(JsonParser.java:2685)
        at org.hl7.fhir.dstu3.formats.JsonParser.parseResource(JsonParser.java:19555)
        at org.hl7.fhir.dstu3.formats.JsonParserBase.parse(JsonParserBase.java:90)
        at org.hl7.fhir.dstu3.context.SimpleWorkerContext.loadFromFileJson(SimpleWorkerContext.java:199)
        at org.hl7.fhir.dstu3.context.SimpleWorkerContext.loadDefinitionItem(SimpleWorkerContext.java:151)
        at org.hl7.fhir.dstu3.context.SimpleWorkerContext.fromDefinitions(SimpleWorkerContext.java:142)
        at org.hl7.fhir.dstu3.validation.ValidationEngine.loadDefinitions(ValidationEngine.java:174)
        at org.hl7.fhir.dstu3.validation.ValidationEngine.<init>(ValidationEngine.java:168)
        at org.hl7.fhir.dstu3.validation.Validator.main(Validator.java:214)

I'm using a validator I just downloaded.

view this post on Zulip Lloyd McKenzie (Aug 24 2018 at 15:09):

Just for clarification, it's the validator you downloaded from http://build.fhir.org?

view this post on Zulip Grahame Grieve (Aug 26 2018 at 21:58):

I don't think it is

view this post on Zulip Morten Ernebjerg (Aug 27 2018 at 10:35):

Indeed, I was using the STU 3 validator downloaded from

https://www.hl7.org/fhir/downloads.html

I tested again with the validator from build.fhir.org but three I also run into errors (despite trying out different combinations of -defn and -tx). I see two errors reported, depending on the options passed:

java -jar org.hl7.fhir.validator.jar patient-example.xml
  .. connect to tx server @ http://tx.fhir.org/r4
Exception in thread "main" org.hl7.fhir.exceptions.FHIRException: Unable to resolve the package 'hl7.fhir.core-3.5.0'
        at org.hl7.fhir.utilities.cache.PackageCacheManager.resolvePackage(PackageCacheManager.java:491)
        at org.hl7.fhir.r4.validation.ValidationEngine.resolvePackage(ValidationEngine.java:541)
        at org.hl7.fhir.r4.validation.ValidationEngine.fetchByPackage(ValidationEngine.java:530)
        at org.hl7.fhir.r4.validation.ValidationEngine.loadIgSource(ValidationEngine.java:390)
        at org.hl7.fhir.r4.validation.ValidationEngine.loadDefinitions(ValidationEngine.java:298)
        at org.hl7.fhir.r4.validation.ValidationEngine.loadInitialDefinitions(ValidationEngine.java:263)
        at org.hl7.fhir.r4.validation.ValidationEngine.<init>(ValidationEngine.java:288)
        at org.hl7.fhir.r4.validation.Validator.main(Validator.java:337)

and

java -jar org.hl7.fhir.validator.jar -defn http://hl7.org/fhir patient-example.xml
  .. connect to tx server @ http://tx.fhir.org/r4
   ... Using version 3.0.1
-tx cache miss: Connect to http://tx.fhir.org/r4
    (v3.0.1-null)
  .. validate [patient-example.xml]
Exception in thread "main" org.hl7.fhir.exceptions.FHIRException: Unable to resolve the package 'patient-example.xml'
        at org.hl7.fhir.utilities.cache.PackageCacheManager.resolvePackage(PackageCacheManager.java:491)
        at org.hl7.fhir.r4.validation.ValidationEngine.resolvePackage(ValidationEngine.java:541)
        at org.hl7.fhir.r4.validation.ValidationEngine.fetchByPackage(ValidationEngine.java:530)
        at org.hl7.fhir.r4.validation.ValidationEngine.loadIgSource(ValidationEngine.java:390)
        at org.hl7.fhir.r4.validation.ValidationEngine.loadContent(ValidationEngine.java:720)
        at org.hl7.fhir.r4.validation.ValidationEngine.validate(ValidationEngine.java:750)
        at org.hl7.fhir.r4.validation.Validator.main(Validator.java:395)

(this is what I see after the specs were already fetched and cached - failed be fore caching, too, though)

view this post on Zulip Grahame Grieve (Aug 27 2018 at 11:04):

have you followed the instructions here: http://wiki.hl7.org/index.php?title=Using_the_FHIR_Validator

view this post on Zulip Morten Ernebjerg (Aug 27 2018 at 11:30):

I thought I had - but after following your hint, I realized that I had simply forgotten "./" in the path to the file to validate (didn't know the -version parameter, either)... So now the following runs through fine on the build.fhir.org validator - thanks!

java -jar org.hl7.fhir.validator.jar ./patient-example.xml -version 3.0.1

So I will just use that now. (The validator downloaded from the STU 3 page still seems to give an error with this command, however.)

view this post on Zulip Grahame Grieve (Aug 27 2018 at 11:30):

I don't understand why ./ makes any difference

view this post on Zulip Morten Ernebjerg (Aug 27 2018 at 12:08):

My apologies if I am confusing things here - I just noticed that if the file to validate is in the same directory as the validator itself, then giving the file path as simply "example-patient.xml" causes an error while "./example-patient.xml" works (when running the validator from the directory).

view this post on Zulip Grahame Grieve (Aug 27 2018 at 12:11):

.. that's... weird. Doesn't happen on windows. I'll have to debug on OSX...

view this post on Zulip Morten Ernebjerg (Aug 27 2018 at 12:17):

I'm seeing it on Window 10,. I tested on three different shells now (normal CMD, Git CMD and PowerShell): All of them work with "./" or ".\" prefixed to the filename, but none work without such a prefix.

view this post on Zulip Grahame Grieve (Aug 27 2018 at 12:20):

what directory are you in? I never use ./ on windows 10

view this post on Zulip Morten Ernebjerg (Aug 27 2018 at 12:25):

In the directory containing both the validator and the file I want to validate.

view this post on Zulip Morten Ernebjerg (Aug 28 2018 at 14:01):

BTW: I seemed to see another validator problem, but since I am pretty sure it has nothing to do with terminology servers, I decided to put it in a separate thread to have a more fitting title: https://chat.fhir.org/#narrow/stream/4-implementers/subject/Validator.20-.20trouble.20loading.20custom.20profiles


Last updated: Apr 12 2022 at 19:14 UTC