FHIR Chat · Validating an SDC Questionnaire · questionnaire

Stream: questionnaire

Topic: Validating an SDC Questionnaire


view this post on Zulip Paul Lynch (Jun 17 2020 at 22:33):

I have questionnaire examples I would like to validate. How would one use the java validator to do that? I tried:
java -jar ~/tmp/org.hl7.fhir.publisher.jar -version 4.0.1 -ig http://hl7.org/fhir/uv/sdc -profile http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire sample.json
but I get 'Unable to find the nominated IG', so I guess at the least I have the URI for the sdc ig wrong. (I looked around https://build.fhir.org/ig/HL7/sdc/, but could not find a statement as to what IG URI is supposed to be.)

view this post on Zulip Lloyd McKenzie (Jun 17 2020 at 22:36):

you could grab the package.tgz file from the CI build and specify the file location for that as your 'ig' parameter - that should work.

view this post on Zulip Paul Lynch (Jun 17 2020 at 22:40):

Would that be the "here" link at https://build.fhir.org/ig/HL7/sdc/downloads.html? It downloads full-ig.zip, which did not make the validator happy. (Error Reading JSON Config file at /.../full-ig.zip)

view this post on Zulip Grahame Grieve (Jun 17 2020 at 22:40):

you should never need to download a .tgz file

view this post on Zulip Grahame Grieve (Jun 17 2020 at 22:41):

that set of parameters works for me

view this post on Zulip Grahame Grieve (Jun 17 2020 at 22:41):

what version of the validator are you using? what's the full log?

view this post on Zulip Lloyd McKenzie (Jun 17 2020 at 22:42):

It would be https://build.fhir.org/ig/HL7/sdc/package.tgz

view this post on Zulip Paul Lynch (Jun 17 2020 at 22:42):

I downloaded it from here: https://wiki.hl7.org/Using_the_FHIR_Validator (https://storage.googleapis.com/ig-build/org.hl7.fhir.publisher.jar)

view this post on Zulip Grahame Grieve (Jun 17 2020 at 22:44):

that doesn't answer my question

view this post on Zulip Paul Lynch (Jun 17 2020 at 22:46):

The full output is:
FHIR IG Publisher Version 1.0.100-SNAPSHOT (Git# 6c6b419dd19f). Built 2020-06-07T09:06:40.927+10:00 (10 days old)
Detected Java version: 1.8.0_252 from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/jre on amd64 (64bit). 3543MB available
Parameters: -version 4.0.1 -ig package.tgz -profile http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire weight-height-questionnaire.json
dir = /home/plynch/project/lforms-fhir-app/e2e-tests/data/R4, path = /home/plynch/node-v10.15.2-linux-x64/bin:/bin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/etc:/home/plynch/project/lforms-fhir-app/node_modules/.bin:/opt/puppetlabs/bin
Run time = Wednesday, June 17, 2020 6:44:26 PM EDT (2020-06-17T18:44:26-04:00)
Package Cache: /home/plynch/.fhir/packages (00:00.0047)
Load Configuration from /home/plynch/project/lforms-fhir-app/e2e-tests/data/R4/package.tgz (00:00.0181)
Publishing Content Failed: Error Reading JSON Config file at /home/plynch/project/lforms-fhir-app/e2e-tests/data/R4/package.tgz: Error parsing JSON source: Unexpected char '' in json stream at Line 1 (path=[null]) (00:00.0273)
(00:00.0273)
Use -? to get command line help (00:00.0274)
(00:00.0274)
Stack Dump (for debugging): (00:00.0274)
java.lang.Exception: Error Reading JSON Config file at /home/plynch/project/lforms-fhir-app/e2e-tests/data/R4/package.tgz: Error parsing JSON source: Unexpected char '' in json stream at Line 1 (path=[null])
at org.hl7.fhir.igtools.publisher.Publisher.initializeFromJson(Publisher.java:1860)
at org.hl7.fhir.igtools.publisher.Publisher.initialize(Publisher.java:1329)
at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:692)
at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:7533)
Caused by: java.io.IOException: Error parsing JSON source: Unexpected char '' in json stream at Line 1 (path=[null])
at org.hl7.fhir.utilities.json.JsonTrackingParser$Lexer.error(JsonTrackingParser.java:205)
at org.hl7.fhir.utilities.json.JsonTrackingParser$Lexer.next(JsonTrackingParser.java:337)
at org.hl7.fhir.utilities.json.JsonTrackingParser$Lexer.start(JsonTrackingParser.java:230)
at org.hl7.fhir.utilities.json.JsonTrackingParser$Lexer.<init>(JsonTrackingParser.java:141)
at org.hl7.fhir.utilities.json.JsonTrackingParser.parse(JsonTrackingParser.java:404)
at org.hl7.fhir.utilities.json.JsonTrackingParser.parse(JsonTrackingParser.java:400)
at org.hl7.fhir.utilities.json.JsonTrackingParser.parse(JsonTrackingParser.java:392)
at org.hl7.fhir.utilities.json.JsonTrackingParser.parse(JsonTrackingParser.java:388)
at org.hl7.fhir.utilities.json.JsonTrackingParser.parseJsonFile(JsonTrackingParser.java:384)
at org.hl7.fhir.igtools.publisher.Publisher.initializeFromJson(Publisher.java:1858)

view this post on Zulip Grahame Grieve (Jun 17 2020 at 22:47):

oh.

view this post on Zulip Grahame Grieve (Jun 17 2020 at 22:48):

you're running the wrong thing, and the link is wrong

view this post on Zulip Paul Lynch (Jun 17 2020 at 22:53):

The confluence version of that page (https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Validator) has the right link. I will try that. Should I file an issue against the page with the wrong link, which says it has been migrated?

view this post on Zulip Grahame Grieve (Jun 17 2020 at 22:55):

well, that's still the wrong link, but it's only the wrong version and probably not wrong enough to matter.

view this post on Zulip Grahame Grieve (Jun 17 2020 at 22:55):

I'll fix both of them

view this post on Zulip Paul Lynch (Jun 17 2020 at 22:57):

Now I am getting "Must provide at least one source file" but I think I am:
$ java -jar org.hl7.fhir.validator.jar -version 4.0.1 -ig http://hl7.org/fhir/uv/sdc -profile http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire ./weight-height-questionnaire.json
FHIR Validation tool Version 5.0.7-SNAPSHOT (Git# 6bc790d98b04). Built 2020-06-07T08:35:37.25+10:00 (11 days old)
Detected Java version: 1.8.0_252 from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/jre on amd64 (64bit). 3543MB available
Arguments: -version 4.0.1 -ig http://hl7.org/fhir/uv/sdc -profile http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire ./weight-height-questionnaire.json
Directories: Current = /home/plynch/project/lforms-fhir-app/e2e-tests/data/R4, Package Cache = /home/plynch/.fhir/packages
Exception in thread "main" java.lang.Exception: Must provide at least one source file
at org.hl7.fhir.validation.cli.utils.Params.loadCliContext(Params.java:215)
at org.hl7.fhir.validation.Validator.main(Validator.java:171)

view this post on Zulip Grahame Grieve (Jun 17 2020 at 22:58):

that's a bug I just fixed but on that release, you must put the -profile command last

view this post on Zulip Paul Lynch (Jun 17 2020 at 23:01):

Okay, that worked, thanks! Now I just have some issues to fix with my sample questionnaire.

view this post on Zulip Yunwei Wang (Jun 18 2020 at 13:56):

@Paul Lynch Inferno team created a UI wrapper for validator.jar making it easier to use. https://inferno.healthit.gov/validator

view this post on Zulip Paul Lynch (Jun 18 2020 at 14:06):

Thanks. It is a nice UI, but it looks like it is missing the SDC IG (I guess because the new one is not yet published.)

view this post on Zulip Yunwei Wang (Jun 18 2020 at 14:29):

it supports at profile level. If the profile is resolvable, like most of the US Core, validator will download profile automatically. Otherwise, you can save the profile, such as http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire StructureDefinition, to a JOSN file and upload/paste to the profile section. There is a limitation that it can only upload one profile, which means, you cannot validate most of the extensions in a resource. Inferno team is working on that.

view this post on Zulip Paul Lynch (Jun 26 2020 at 22:16):

Lloyd McKenzie said:

It would be https://build.fhir.org/ig/HL7/sdc/package.tgz

Where does one find that link in the implementation guide? I thought it must the on the "downloads" page but couldn't find it.

view this post on Zulip Lloyd McKenzie (Jun 26 2020 at 22:32):

We don't expose it anywhere because the general expectation is that tools will simply resolve to the one in the HL7 registry

view this post on Zulip Paul Lynch (Jun 27 2020 at 00:12):

Lloyd McKenzie said:

the one in the HL7 registry

Is that at https://registry.fhir.org/guides? I don't see links to package.tgz files there either.

view this post on Zulip Lloyd McKenzie (Jun 27 2020 at 01:11):

@Grahame Grieve

view this post on Zulip Grahame Grieve (Jun 28 2020 at 02:22):

you never need the .tgz file directly, but there's links here: http://hl7.org/fhir/uv/sdc/history.html

view this post on Zulip Brian Postlethwaite (Mar 25 2022 at 11:12):

While implementing the validations on this specific questionnaire

 <Questionnaire xmlns="http://hl7.org/fhir">
  <item>
    <linkId value="q1" />
    <type value="string" />
    <required value="true" />
  </item>
</Questionnaire>

With this response...

<QuestionnaireResponse xmlns="http://hl7.org/fhir">
  <item>
    <linkId value="q1" />
    <answer>
      <valueString value="a1" />
    </answer>
    <answer>
      <valueString value="a2" />
    </answer>
  </item>
</QuestionnaireResponse>

Would this OperationOutcome seem reasonable?

<OperationOutcome xmlns="http://hl7.org/fhir">
  <issue>
    <severity value="error" />
    <code value="business-rule" />
    <details>
      <coding>
        <system value="http://fhir.forms-lab.com/CodeSystem/errors" />
        <code value="repeats" />
        <display value="multiple values" />
      </coding>
      <text value="q1: Provided 2 answers for a question that only permits 1 answer" />
    </details>
    <location value="linkId='q1'" />
    <expression value="QuestionnaireResponse.item[0]" />
  </issue>
</OperationOutcome>

The specific part I'm not 100% sure on what I should have in the expression there, it could also have these...

    <expression value="QuestionnaireResponse.item[0].answer[0].value" />
    <expression value="QuestionnaireResponse.item[0].answer[1].value" />

view this post on Zulip Brian Postlethwaite (Mar 25 2022 at 11:14):

Reason for this would be important would be for the renderer to be able to include the error message with the appropriate field...

view this post on Zulip Lloyd McKenzie (Mar 25 2022 at 14:48):

There are no expectations around if or how location and expression are populated - because different systems will have different abilities to detect location.

view this post on Zulip Brian Postlethwaite (Mar 25 2022 at 22:20):

location is deprecated, so don't really consider that one, but the expression I would have thought was pretty specific, and quite processable.

view this post on Zulip Brian Postlethwaite (Mar 26 2022 at 22:37):

I'm implementing the Choice type validations now and reviewing the extension http://hl7.org/fhir/extension-11179-permitted-value-valueset.html for inclusion, and I'm not understanding if this applied to choice questions (if this, what's different to answerValueSet?), or just string values? (and if so, is it matching the display or code value?)

view this post on Zulip Lloyd McKenzie (Mar 27 2022 at 04:27):

It's about "how is the data stored in the database". I don't know why you'd want to support it. It's very much a data element thing, not so much a questionnaire thing.

view this post on Zulip Brian Postlethwaite (Mar 27 2022 at 07:58):

Cool, its on the set of extensions on questionnaire, hence the question.

view this post on Zulip Brian Postlethwaite (Mar 27 2022 at 07:59):

I thought maybe it was the one where you can bind a string to a valueset (such as town or postcode) but in a questionnaire I'd just use a choice or open-choice with autocomplete.

view this post on Zulip Brian Postlethwaite (Mar 29 2022 at 11:31):

Validating an attachment type, there is a maxLength property that you can use to limit the length of an attachment, can you use the minLength extension to also restrict the minimum length of an attachment?
(for cases where you might want to use that to verify that an image is of a sufficient size e.g. > 4k to ensure that not attaching corrupt content)

view this post on Zulip Lloyd McKenzie (Mar 29 2022 at 15:00):

There's a maxSize, not a maxLength. We don't have a minSize. But I suppose we could define one...

view this post on Zulip Brian Postlethwaite (Mar 29 2022 at 19:20):

Thanks. Will cleanup my code.


Last updated: Apr 12 2022 at 19:14 UTC