FHIR Chat · validation and Questionnaire Response status · questionnaire

Stream: questionnaire

Topic: validation and Questionnaire Response status


view this post on Zulip Diane (Jun 10 2021 at 19:59):

Any tips on validation contingent on Questionnaire Response status? I am using the NLM LHC Forms application, so that might limit what I can do as well. Some of our Questionnaires are very long and might take 4-5 hours to complete. I would like the users to be able to store their work if they want to take a break as a FHIR Questionnaire Response (with a status of "in-progress" ) and not have the validation rules take effect.

So far, the validation rules use readily available extensions like "http://hl7.org/fhir/StructureDefinition/minLength" and are very simple like:
some items are required
item has a minimum quantity
if "other " is selected, then the text box explanation must be filled in
date validation between answers (eg. the root cause assessment activity must occur after the problematic event actually happened)

I would prefer that the users can submit their Questionnaire Response with a status of "in-progress" without being blocked by these value constraints.

Once the user clicks a button on the UI to "Submit as Completed", then I would like the validation to take place.

Is this possible? I thought about updating the Questionnaire Response status via the Client to "Completed" then pulling the Questionnaire Response back for editing and validation using custom fhirpath.js invariants with a ternary to check that Questionnaire Response status is "Completed". But, that is cumbersome and if validation fails and the user gives up, then the client has to have a robust way to be sure to reset the Questionnaire Response to "in-progress" in the FHIR server.

Maybe I am making this too difficult.

view this post on Zulip Paul Lynch (Jun 10 2021 at 20:03):

If the user is clicking "Submit as Completed", your code that handles that button could call the LHC-Forms API LForms.Util.checkValidity() to run the validations then.

view this post on Zulip Lloyd McKenzie (Jun 10 2021 at 22:51):

Validation rules shouldn't kick in as anything other than 'warnings' unless the status is 'completed'. However basic 'resource' validations are always in force. Are you finding any of those problematic?

view this post on Zulip Brian Postlethwaite (Jun 11 2021 at 01:47):

After seeing this one recently in another post (and changing our internal implementation too) I've had a bit of a change of heart on this one...
There is definitely a difference between errors and warnings here, and I think if you're calling $validate, then it shouldn't matter what the status is, but if you're storing it, then I think that should permit it to be stored (and maybe return warnings if you're returning the operationoutcome).
@Paul Lynch @Lloyd McKenzie thoughts on that subtle difference?

view this post on Zulip Lloyd McKenzie (Jun 11 2021 at 03:22):

I think an instance of a QuestionnaireResponse must always be valid against the resource constraints and any profile it declares. It doesn't need to be valid against the Questionnaire it asserts it's a response to until/unless the status is 'complete' or 'amended', though it should have base validity - e.g. refer to the appropriate linkIds, use appropriate types for responses, etc. But all invariants, required answers, etc. should be ignored until complete. Once the status changes, servers MAY (but don't have to) reject instances that aren't strictly valid against their referenced Questionnaire.

view this post on Zulip Brian Postlethwaite (Jun 11 2021 at 12:10):

Base yes, but was thinking a $validate could also verify all the other rules there, but be permissive on the save.
Still seems a little weird. (either way)

view this post on Zulip Brian Postlethwaite (Mar 22 2022 at 04:00):

In my new validation implementation I'm considering the display text to be included in the output error messages, and I'm wondering if the display text in the QuestionnaireResponse should also be considered?

view this post on Zulip Brian Postlethwaite (Mar 22 2022 at 04:02):

e.g. IF the QR.item.text = 'localized/personalized Q1 display' and the W.item.text = 'Q1 Display value'
should/could the localized display be included in the validation output?

view this post on Zulip Lloyd McKenzie (Mar 22 2022 at 13:37):

I'm not understanding the question...

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

Eg. Output an error message like
'localuzed/personalised Q1 display is greater than the maximum value 4.4"
Where that display label text value was in the QR.


Last updated: Apr 12 2022 at 19:14 UTC