FHIR Chat · Validate QuestionnaireResponses locally · implementers

Stream: implementers

Topic: Validate QuestionnaireResponses locally


view this post on Zulip Pascal Escher (Jul 08 2021 at 12:23):

Hey everybody,

I have a question concering validating questionnaire responses with the corresponding questionnaire.
As far as I understood the documentation every response is connected to a questionnaire via its canonical uri and the items via the individual linkid. Does this mean that every questionnaire has to be online available so it can be validated? How can i test responses locally in case the questionnaires have a copyright and cannot be uploaded?

At the moment I'm using the jar-validator to validate the reponses and want to add the corresponding questionnaire as an additional parameter. As it seems this is not possible. All data I have are locally available and not yet on a fhir server. How can i test these responses before uploading?

Thanks in advantage!

Pascal

view this post on Zulip Morten Ernebjerg (Jul 08 2021 at 12:41):

Hi Pascal :wave:. The canonical URI of a resource serves as a globally unique identifier for that resource - though it is nice if they actually resolve as URLs, they don't absolutely have do (see this bit of the FHIR spec). Either way, you can test entirely locally by doing as follows:

  1. Make sure the canonical URL is entered in Questionnaire.url (if you are actually going to use it, it should be in a namespace you control so you can ensure it is unique)
  2. Store the questionnaire in a folder, say qs/.
  3. Make sure the the QuestionnaireResponse has the canonical URL of the matching Questionnaire in QuestionnaireResponse.questionnaire (assuming you are using R4)
  4. Use the -ig parameter with the JAR-validator to load the questionnaires (passing the name of the folder).

Hence, assuming that the validator and the response is in the current directory and the Questionnaire in the sub-directory /qs, you would run

java -jar validator_cli.jar -version 4.0.1 -ig qs my-questionnaire-response-resource.json

This should automatically trigger validation against the Questionnaire. The full documentation for the JAR validator is available here.

view this post on Zulip Pascal Escher (Jul 08 2021 at 13:57):

Hey Morten,

thanks a lot! That's a very good guide about how to do validation properly!
I used the documentation of the validator, but at some point it lacks of some details in this chapter about where to put the questionnaire: https://confluence.hl7.org/pages/viewpage.action?pageId=35718580#UsingtheFHIRValidator-Questionnaires
Thanks again for clarify that out! Maybe somebody can add your explanation to confluence...

Best regards Pascal

view this post on Zulip Brian Postlethwaite (Jul 08 2021 at 22:04):

Do you mean validation on the client side or server side?
Both sides need the definition to be able to function properly.

view this post on Zulip Brian Postlethwaite (Jul 08 2021 at 22:05):

And typically the server receiving the content would have it's own copy of the questionnaire and not reach out externally (although it could)

view this post on Zulip Pascal Escher (Jul 12 2021 at 12:41):

At first I want to validate the data locally and later on this should be done automatically on the fhir server.
So if I understood that correctly then the fhir server will validate a QuestionnaireResponse with the given questionnaire in the uri, e.g. http://hl7.org/fhir/Questionnaire/3141
in case the server does not contain a corresponding questionnaire? The internal questionnaire will be prioritized?

view this post on Zulip Lloyd McKenzie (Jul 12 2021 at 15:14):

What do you mean by 'internal' Questionnaire?

view this post on Zulip Pascal Escher (Jul 13 2021 at 08:34):

Internal questionnaire = questionnaire which is stored on the server as a fhir resource.

view this post on Zulip Lloyd McKenzie (Jul 13 2021 at 14:24):

Then I'm not understanding this sentence: "in case the server does not contain a corresponding questionnaire? The internal questionnaire will be prioritized?"

When dealing with a resource that is pointed to by canonical URL (profile, value set, code system, questionnaire, etc.) systems would typically first look for the resource within the local server. If not found, they would then search their favorite registry(ies) to see if they can find the resource there. As a last resort (and if comfortable from a security perspective), they might try to resolve the URL itself.

view this post on Zulip Pascal Escher (Jul 15 2021 at 07:15):

Thanks, that was the point of my question! :)


Last updated: Apr 12 2022 at 19:14 UTC