FHIR Chat · Validation error · IG creation

Stream: IG creation

Topic: Validation error


view this post on Zulip Brian Reinhold (Nov 13 2018 at 23:59):

I have a resource with one code system url in it

The IG builder gives me this error

     [java] Validating Resources                                                             (18.0712sec)
     [java] Terminology server: Check for supported code systems for http://unstats.un.org/unsd/methods/m49/m49.htm
     [java] java.lang.NullPointerException
     [java]     at org.hl7.fhir.r4.utils.FHIRPathEngine.tailMatches(FHIRPathEngine.java:3765)

But the only CodeSystem URL I have is for the dataAbsentReason

http://terminology.hl7.org/CodeSystem/data-absent-reason

Maybe I just do not understand this error. The resource is

{
    "resourceType": "Observation",
    "id": "nan-1.0.0.42",
    "meta": {
        "profile": [
            "http://hl7.org/fhir/uv/phd/StructureDefinition/PhdNumericObservation"
        ]
    },
    "extension": [
        {
            "url": "http://hl7.org/fhir/StructureDefinition/observation-gatewayDevice",
            "valueReference": {
                "reference": "Device/ecde3d4e58532d31"
            }
        }
    ],
    "status": "final",
    "code": {
        "coding": [
            {
                "system": "urn:iso:std:iso:11073:10101",
                "code": "150320"
            }
        ],
        "text": "MDC_SAT_O2_QUAL: Blood oxygen saturation"
    },
    "subject": {
        "reference": "Patient/sisansarahId.1.2.3.4.5.6.7.8.10"
    },
    "effectiveDateTime": "2018-11-11T19:07:48-05:00",
    "dataAbsentReason": {
        "coding": [
            {
                "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
                "code": "not-a-number"
            }
        ],
        "text": "not-a-number (Not a number)"
    },
    "device": {
        "reference": "Device/74E8FFFEFF051C00.001C05FFE874"
    },
    "derivedFrom": [
        {
            "reference": "Observation/coincident-3.14159.20181111190736"
        }
    ]
}

view this post on Zulip Eric Haas (Nov 14 2018 at 00:26):

That coding system is associated with stats. Its not related to this observation.

view this post on Zulip Brian Reinhold (Nov 14 2018 at 00:38):

That coding system is associated with stats. Its not related to this observation.

Why am I getting that error on my Observation example?

view this post on Zulip Eric Haas (Nov 14 2018 at 00:49):

the build may be processing other files in your directory... do you have any folders with other directories.

view this post on Zulip Brian Reinhold (Nov 14 2018 at 00:51):

the build may be processing other files in your directory... do you have any folders with other directories.

Well, if I remove the example file above from the ImplementationGuide.xml, it builds fine.

view this post on Zulip Brian Reinhold (Nov 14 2018 at 10:40):

@Lloyd McKenzie @Grahame Grieve
Any idea why my example gets this validation error?

  [java] Terminology server: Check for supported code systems for http://unstats.un.org/unsd/methods/m49/m49.htm

What is 'unstats.un.org' and why does it have anything to do with my example? The reference to a coding system in the example is for the dataAbsentReason.coding.system.

view this post on Zulip Grahame Grieve (Nov 14 2018 at 10:41):

that's not a validation error - it's a performance optimization note for me

view this post on Zulip Brian Reinhold (Nov 14 2018 at 10:42):

that's not a validation error - it's a performance optimization note for me

Oh. Its always the last line before a null pointer exception

view this post on Zulip Grahame Grieve (Nov 14 2018 at 10:42):

I guess I'll have to debug... that has no bearing on the NPE

view this post on Zulip Brian Reinhold (Nov 14 2018 at 10:44):

I figure if I can get one example to work it should be easy to add more ... I can give you the entire log around the error ...

For some reason the validator does not like this resource

{
    "resourceType": "Observation",
    "id": "nan-1.0.0.42",
    "meta": {
        "profile": [
            "http://hl7.org/fhir/uv/phd/StructureDefinition/PhdNumericObservation"
        ]
    },
    "extension": [
        {
            "url": "http://hl7.org/fhir/StructureDefinition/observation-gatewayDevice",
            "valueReference": {
                "reference": "Device/ecde3d4e58532d31"
            }
        }
    ],
    "status": "final",
    "code": {
        "coding": [
            {
                "system": "urn:iso:std:iso:11073:10101",
                "code": "150320"
            }
        ],
        "text": "MDC_SAT_O2_QUAL: Pulsatile quality"
    },
    "subject": {
        "reference": "Patient/sisansarahId.1.2.3.4.5.6.7.8.10"
    },
    "effectiveDateTime": "2018-11-11T19:07:48-05:00",
    "dataAbsentReason": {
        "coding": [
            {
                "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
                "code": "not-a-number"
            }
        ],
        "text": "not-a-number (Not a number)"
    },
    "device": {
        "reference": "Device/74E8FFFEFF051C00.001C05FFE874"
    }
}

Since it is throwing a null pointer exception it must be looking for something that isn't there....I just don't know what. I made up the id since this observation was extracted from a transaction bundle.

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 10:54):

Can you post the full stack trace for the NPE?

view this post on Zulip Brian Reinhold (Nov 14 2018 at 10:55):

Can you post the full stack trace for the NPE?

here

     [java] E:\Ruby25-x64\IG_Publisher\PHD\src\examples\nan-1.0.0.42
     [java] -tx cache miss: $validate null#not-a-number: "null" for null
     [java] Validating Resources                                                             (15.0711sec)
     [java] Terminology server: Check for supported code systems for http://unstats.un.org/unsd/methods/m49/m49.htm
     [java] java.lang.NullPointerException                                                   (17.0032sec)
     [java] Publishing Content Failed: null                                                  (17.0042sec)
     [java]                                                                                  (17.0042sec)
     [java] Use -? to get command line help                                                  (17.0042sec)
     [java]                                                                                  (17.0042sec)
     [java] Stack Dump (for debugging):                                                      (17.0042sec)
     [java] java.lang.NullPointerException
     [java]     at org.hl7.fhir.r4.utils.FHIRPathEngine.tailMatches(FHIRPathEngine.java:3765)
     [java]     at org.hl7.fhir.r4.utils.FHIRPathEngine.evaluateDefinition(FHIRPathEngine.java:3693)
     [java]     at org.hl7.fhir.r4.validation.InstanceValidator.getCriteriaForDiscriminator(InstanceValidator.java:2020)
     [java]     at org.hl7.fhir.r4.validation.InstanceValidator.sliceMatches(InstanceValidator.java:2495)
     [java]     at org.hl7.fhir.r4.validation.InstanceValidator.validateElement(InstanceValidator.java:3479)
     [java]     at org.hl7.fhir.r4.validation.InstanceValidator.validateElement(InstanceValidator.java:3785)
     [java]     at org.hl7.fhir.r4.validation.InstanceValidator.start(InstanceValidator.java:2665)
     [java]     at org.hl7.fhir.r4.validation.InstanceValidator.validateResource(InstanceValidator.java:3978)
     [java]     at org.hl7.fhir.r4.validation.InstanceValidator.validate(InstanceValidator.java:709)
     [java]     at org.hl7.fhir.r4.validation.InstanceValidator.validate(InstanceValidator.java:669)
     [java]     at org.hl7.fhir.igtools.publisher.Publisher.validate(Publisher.java:2802)
     [java]     at org.hl7.fhir.igtools.publisher.Publisher.validate(Publisher.java:2779)
     [java]     at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:591)
     [java]     at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:526)
     [java]     at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:4925)
     [java] Exception in thread "main" java.lang.NullPointerException
     [java]     at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:4935)
     [java] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

BUILD FAILED

view this post on Zulip Grahame Grieve (Nov 14 2018 at 11:02):

unusual...

view this post on Zulip Grahame Grieve (Nov 14 2018 at 11:02):

you have a slice with no value somewhere?

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 11:05):

The specific error seems to be choking on either an element with no path or an element with a single type with no code.

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 11:06):

Is the IG checked in anywhere we can run it through the debugger?

view this post on Zulip Brian Reinhold (Nov 14 2018 at 11:07):

Is the IG checked in anywhere we can run it through the debugger?

I am trying to build it so I can check it in. My understanding is that I need to do that first. But it is on git hub. I can check it in as is

https://github.com/HL7/PHD

I just noted that I committed it with an attempt I was doing on another example resource. That one is BIG. In the ImplementationGuide you can get the same error using the small single-Observation example by uncommenting the small example and commenting out the big one.

--- The big one ---
    <resource>
      <reference>
        <reference value="Bundle/bundle-continuousnonin"/>
      </reference>
      <name value="Example upload from Pulse Oximeter"/>
      <description value="This example is an upload from a Bluetooth Low Energy Pulse oximeter device streaming data. In this case the gateway has previously uploaded measurements and saved the logical ids of the Patient and Device resources so they are not re-uploaded." />
      <exampleBoolean value="true"/>
      <groupingId value="hl7.fhir.uv.phd" />
    </resource>
    <!-- (small example)
    <resource>
      <reference>
        <reference value="Observation/nan-1.0.0.42"/>
      </reference>
      <name value="Example upload from Pulse Oximeter"/>
      <description value="Example contains a NaN (not a number) measurement." />
      <exampleBoolean value="true"/>
      <groupingId value="hl7.fhir.uv.phd" />
    </resource> -->

I recommitted with the simple example ...

view this post on Zulip Grahame Grieve (Nov 14 2018 at 11:09):

the build will just fail. You don't have to get IGs to build in order to commit (different to the main build)

view this post on Zulip Grahame Grieve (Nov 14 2018 at 11:20):

ok checking in a fix

view this post on Zulip Brian Reinhold (Nov 14 2018 at 11:25):

ok checking in a fix

I still get the error but I only cleared the src-generated files. Probably need to clear the .fhir cache?

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 11:27):

I don't think the fix has been pushed yet?

view this post on Zulip Brian Reinhold (Nov 14 2018 at 11:28):

OH. I guess it takes a while to check in ... I cleared the cache and the src-generated but get the same result.
What was the problem or is it too complicated to explain?

view this post on Zulip Brian Reinhold (Nov 14 2018 at 11:37):

I don't think the fix has been pushed yet?

@Lloyd McKenzie Do I need to commit the IGpublisher.jar in the src-generated files to have the continuous integration work?

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 12:14):

No. Grahame's commit is now merged and built and it looks like it fixes your issue.

view this post on Zulip Brian Reinhold (Nov 14 2018 at 12:19):

No. Grahame's commit is now merged and built and it looks like it fixes your issue.

@Lloyd McKenzie YES IT DID!

Given that, what files in the src-generated do I need to commit in order to have the continuous integration work? Do I just need the directory hierarchy? GitHub is complaining about the igpublisher being too big.

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 12:56):

Github complains, but it still does it. I always commit everything in src-generated

view this post on Zulip Grahame Grieve (Nov 14 2018 at 13:03):

you don't need igpublisher committed for the auto-build. it uses it's own version of the igpublisher

view this post on Zulip Brian Postlethwaite (Nov 14 2019 at 22:41):

In creating some example SDC questionnaires with a contained bundle found a validation issue:
https://sqlonfhir-r4.azurewebsites.net/fhir/Questionnaire/gp-assessment-report

<Questionnaire >
  <id value="gp-assessment-report"/>
  <contained >
    <Bundle >
      <id value="PrePopQuery"/>
      <type value="batch"/>
      <entry >
      <fullUrl value="urn:uuid:88f151c0-a954-468a-88bd-5ae15c08e059"/>
      <request >
      <method value="GET"/>
      <url value="RelatedPerson?patient={{%LaunchPatient.id}}&active=true"/>
      </request>
      </entry>
    </Bundle>
  </contained>

This returns the following 2 invariant errors:
bdl-3: entry.request mandatory for batch/transaction/history, otherwise prohibited [entry.all(request.exists() = ((%resource.type = 'batch') or (%resource.type = 'transaction') or (%resource.type = 'history')))]
bdl-4: entry.response mandatory for batch-response/transaction-response/history, otherwise prohibited [entry.all(response.exists() = ((%resource.type = 'batch-response') or (%resource.type = 'transaction-response') or (%resource.type = 'history')))]
Which I think are not correct.

view this post on Zulip Lloyd McKenzie (Nov 14 2019 at 23:22):

Yup. Looks like a FHIRPath issue where %resource is resolving to the Questionnaire rather than the Bundle.

view this post on Zulip Brian Postlethwaite (Nov 17 2019 at 11:44):

@Grahame Grieve , does the fhirpath/validation tests contain an example like this one?

view this post on Zulip Grahame Grieve (Nov 17 2019 at 11:44):

It’s on my todo list to investigate

view this post on Zulip Grahame Grieve (Nov 28 2019 at 23:30):

looks like i've fixed this, but I've added it as a test case


Last updated: Apr 12 2022 at 19:14 UTC