Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDC | Nested items of group are not rendering when loading Questionnaire using QuestionnaireResponse #1998

Closed
ppanchal-argus opened this issue May 4, 2023 · 8 comments · Fixed by #2005
Assignees

Comments

@ppanchal-argus
Copy link

Describe the bug
Nested items under group type are not rendering when loading Questionnaire using QuestionnaireResponse, however they are loading when nested items are under Boolean type.

Component
SDC Library

To Reproduce
Steps to reproduce the behavior:

  1. On Master branch apply the patch group_nested_items_not_visible.txt
  2. Run the app, Go to new questionnaire (+ icon n patient list)
  3. The questionnaire is not rendering the nested group items.
  4. Undo the patch changes and apply this patch: boolean_nested_items_are_visible.txt
  5. Now Re-run the app and again open the questionnaire, on selecting option for boolean type, it shows the nested items. Only change done is that the group type is replaced with boolean type.

Expected behavior
Ideally the nested items should be visible even for group type.

Screenshot
Group Type:
image

Boolean Type:
image

Smartphone (please complete the following information):

  • Device: Pixel 3a emulator

Additional context
After applying patch: Questionnaire is at file: assets/new-patient-registration-paginated.json & QuestionnaireResponse is on line: 82 (AddPatientFragment.kt)

cc: @jingtang10 @omarismail94

@nsabale7
Copy link
Collaborator

nsabale7 commented May 4, 2023

I have experienced the same issue with below questionnaire and questionnaireResponse.

questionnaire.txt
questionnaire-response.txt

Steps:

  1. Provide both questionnaire and questionnaireResponse
  2. Select the stilll-birth option
    Expected was to show up new question 'Still Birth Type'

@jingtang10 @santosh-pingle

@khyativyasargus
Copy link
Contributor

@jingtang10 @santosh-pingle
I have re-tested with latest SDC code, and this is to confirm that the issue we mentioned still persists.

@santosh-pingle santosh-pingle self-assigned this May 10, 2023
@santosh-pingle
Copy link
Collaborator

I will look into it.

@santosh-pingle
Copy link
Collaborator

@ppanchal-argus
Please provide the questionnaire file specifically associated with the reproducible issue? The previously uploaded file unfortunately contains extraneous characters that require removal before I can utilize it.

@ppanchal-argus
Copy link
Author

@santosh-pingle
Thanks for looking into this!
From the first patch :
Questionnaire: group_nested_item_not_visible_questionnaire.txt
QuestionnaireResponse: group_nested_item_not_visible_questionnaire_response.txt

From the second patch:
Questionnarie: boolean_nested_items_are_visible_questionnaire.txt
QuestionnaireResponse: boolean_nested_items_are_visible_questionnaire_response.txt

@jingtang10
Copy link
Collaborator

hey @parthfloyd and @nsabale7, why are questionnaire responses provided without nested items? where did they come from?

can you fix this by using questionnarie responses with nested items?

@ppanchal-argus
Copy link
Author

@jingtang10 This is occuring when the nested items are not enabled due to their enableWhenExpression logic. The questionnaireResponse generated in the SDC doesn't include these disabled (by enableWhenExpression logic) nested items.

The issue occurs when the questionnaire is re-rendered with this QR and user changes question which satisfied the enableWhenExpression condition for those nested items.

@santosh-pingle
Copy link
Collaborator

santosh-pingle commented May 22, 2023

If the corresponding missing response items are added to the questionnaire response, and the questionnaireFragment.getQuestionnaireResponse() API is called to retrieve the response, it has been observed that the newly added items persist in the fetched response though those are not answered.
This response is also equivalent to the one fetched when only the questionnaire is passed to the SDC module, and enabled question items are not answered.

Expectation as per QuestionnaireResponse specification which says However, once a QuestionnaireResponse is marked as 'completed' (including if it is subsequently changed to 'amended'), all requirements of the associated Questionnaire must be met, all non-answered question items must be removed, all non-enabled items must be removed, etc.
https://build.fhir.org/questionnaireresponse.html#validation

cc @jingtang10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
5 participants