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: Include 'text' attribute in QuestionnaireResponse #1439

Closed
KhumboLihonga opened this issue Jun 6, 2022 · 8 comments
Closed

SDC: Include 'text' attribute in QuestionnaireResponse #1439

KhumboLihonga opened this issue Jun 6, 2022 · 8 comments
Assignees

Comments

@KhumboLihonga
Copy link

Is your feature request related to a problem? Please describe.
I have a scenario where I need to record the weight and the height of a patient. With these two values, I need to show the patient's MUAC assessment in a 'display' widget. I want to save the text of the 'display' widget to our server using structure map based extraction but the items in a QuestionnaireResponse only include the 'linkId' and the 'answer' properties.

Describe the solution you'd like
I would like the QuestionnaireResponse to also include the text attribute as is shown in the specification.

Describe alternatives you've considered
The alternative is creating a 'string' widget and setting the initial value as the MUAC assessment result and making it read-only. This feels quite verbose and I can't style the text if need be.

Additional context
N/A

Would you like to work on the issue?
I don't know who could look into this but I'd really appreciate the help.

@jingtang10
Copy link
Collaborator

thanks for raising this @KhumboLihonga - am i right in saying you would like for the questionnaire response generated by structured data capture library to include the text field? what's the use of this? isn't the text field just going to be a copy of the text field of the questionnaire resource? can you just access the questionnaire? thanks

@KhumboLihonga
Copy link
Author

  • am i right in saying you would like for the questionnaire response generated by structured data capture library to include the text field? -> Yes, you are right.
  • what's the use of this? -> in my scenario, the given weight and height combination will enable a specific display item that shows the MUAC assessment for those two values. We want to be able to record this assessment as an observation.
  • isn't the text field just going to be a copy of the text field of the questionnaire resource? -> Yes, it will.
  • can you just access the questionnaire? -> When using structure map based extraction, don't we just receive the QuestionnaireResponse as the source? Can I also access the Questionnaire resource?

If there's a better way to handle this, please let me know.

@f-odhiambo
Copy link
Collaborator

  • am i right in saying you would like for the questionnaire response generated by structured data capture library to include the text field? -> Yes, you are right.
  • what's the use of this? -> in my scenario, the given weight and height combination will enable a specific display item that shows the MUAC assessment for those two values. We want to be able to record this assessment as an observation.
  • isn't the text field just going to be a copy of the text field of the questionnaire resource? -> Yes, it will.
  • can you just access the questionnaire? -> When using structure map based extraction, don't we just receive the QuestionnaireResponse as the source? Can I also access the Questionnaire resource?

If there's a better way to handle this, please let me know.

@jingtang10 any feedback on this approach? CC @Tarun-Bhardwaj @KhumboLihonga

@maimoonak
Copy link
Collaborator

@f-odhiambo @jingtang10 the text is an exact copy of questionnaire.text (as discussed above), however, the text can also be calculated value with cqf-expression on item _text. See example here.

@maimoonak
Copy link
Collaborator

@jingtang10 the issue needs changes into the way localizedTextSpanned is extracted from questionnaireItem.

run {
  ToolingExtensions.getExtension(this.textElement, EXTENSION_CQF_EXPRESSION_URL)
          ?.value
          ?.let { castToExpression(it) }
          ?.evaluate<StringType>(questionnaire, this)
          ?.value
          ?: this.textElement.getLocalizedText()
}?.toSpanned()

Also I see for display it picks same value for hint/flyover for Display item.

This would also pick from calculated value
Screenshot from 2022-07-14 11-25-59

The requirement of ticket is more towards calculated-expression which is other PR for #971 . So current requirements would need merger of both PRs.

@fredhersch
Copy link
Collaborator

@maimoonak @KhumboLihonga is this issue merfed with #971? Can we close this OR are there still open questions?

cc: @jingtang10 @Tarun-Bhardwaj @f-odhiambo

@f-odhiambo
Copy link
Collaborator

I think we can close this and mark as DONE

@KhumboLihonga
Copy link
Author

Apologies for the late response, but yes we can close this.

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

No branches or pull requests

6 participants