Stream: questionnaire
Topic: QuestionnaireResponse Status
milton mitjans (Jun 10 2021 at 03:14):
When a UI client Posts a Questionnaire Response should it set status as Completed when all required questions are answered?
Does the BackEnd is responsible for changing the status when all questions are answered?
If the backend determines the questionnaire is not completed should it return an error on the QuestionnaireResponse or change back the status as in progress?
Brian Postlethwaite (Jun 10 2021 at 03:18):
If that's the intent yes.
Storing it with in-progress is for drafts.
Brian Postlethwaite (Jun 10 2021 at 03:19):
Backend doesn't imply storing as complete.
Josh Mandel (Jun 10 2021 at 03:25):
Keep in mind that a questionnaire response where all questions have an answer isn't necessarily "completed"; sometimes the act of marking a questionnaire response "complete" is an explicit final step (e.g., before that, it may still represent work in progress, with draft answers that aren't considered finished.)
Lloyd McKenzie (Jun 10 2021 at 15:18):
Agree that it would typically be client driven. Exception would be adaptive forms where the server determines when the form is 'complete'.
milton mitjans (Jun 10 2021 at 20:47):
Thanks all for the response
milton mitjans (Jun 10 2021 at 20:51):
When there's a "In-Progress" QuestionnaireResponse. When the client wants go to back to continue on the Questionnaire administration. The flow we have is:
- Call Task Resource. It returns the Questionnaire ID and the Questionnaire Response ID
- Grabs the Questionnaire Resource to get the definition
- Grabs the In Progress Answers by calling the QuestionnaireResponse
Is there a way that client can avoid calling Questionnaire and QuestionnaireResponse to continue on the flow? Maybe by setting the already answered questions in the Questionnaire Resource as "selected answers"? For example "initial: [value]"
Josh Mandel (Jun 10 2021 at 21:53):
I'm not following here. If you have a client managing in-progress questionnaires, you could POST a QuestionnaireReponse with an in-progress
status, and PUT to that same endpoint when you've got updates.
Lloyd McKenzie (Jun 10 2021 at 22:52):
Right. You should be GETing your prior QuestionnaireResponse and just loading that up to continue editing
milton mitjans (Jun 11 2021 at 00:08):
Correct, in order for the client to get the question definition (for example when a user logs back in to website) does it needs to call Questionnaire to get definitions? we would like to avoid GET on Questionnaire and another GET in QuestionnaireResponse to get answered questions and questions definitions.
Lloyd McKenzie (Jun 11 2021 at 01:30):
In theory, you should be able to do a search for the Task and do an _include to get both the QuestionnaireResponse and the Questionnaire, though at the moment, you'd need a custom search parameter on Task to do that. You can certainly do a search to grab the QuestionnaireResponse and do an _include to get the Questionnaire.
Tilo Christ (Jun 11 2021 at 11:51):
Would it be a valid/supported way to put the Questionnaire into the "contained" section of the response and thus retrieve it as part of the response?
Josh Mandel (Jun 11 2021 at 13:14):
No. If the questionnaire can have an independent existence then it needs to. Assuming this is a response to an actual questionnaire that was created somewhere else and is managed independently, you should not be sticking in "contained" array.
Lloyd McKenzie (Jun 11 2021 at 13:44):
We use 'contained' Questionnaires for adaptive form responses because in that case, the Questionnaire is created as part of the answering process - and is only relevant to that specific set of answers. If the Questionnaire can be used for multiple responses, it needs to be a separate resource. 'contained' is for resources that have no independent existence. It's never for packaging convenience or to avoid searching for multiple resources.
Yunwei Wang (Jun 11 2021 at 14:29):
@milton mitjans One of our client loads existing answers from QuestionnaireResponse to Questionnaire.initial
milton mitjans (Jun 11 2021 at 18:29):
Was also thinking on those lines but how does the Questionnaire.initial is linked to a QuestionnaireResponse id?
Last updated: Apr 12 2022 at 19:14 UTC