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

FHIR questionnaire attachment item shows as "not answered" in review mode #2790

Open
kedegger-ait opened this issue Feb 18, 2025 · 0 comments

Comments

@kedegger-ait
Copy link

kedegger-ait commented Feb 18, 2025

Describe the bug

When answering a Questionnaire with an image attachment item using SDCs QuestionnaireFragment, the created QuestionnaireResponse contains the picture taken as Base64 encoded string in the data field together with a contentType and title correctly.

Displaying the QuestionnaireResponse as QuestionnaireFragment in review mode, providing the original Questionnaire and QuestionnaireResponse again, shows the attachment item as not answered.

The library does only handle the url but not the data property of the Attachment resources.

Component
SDC library (Version 1.3.0)

To Reproduce
Steps to reproduce the behavior:

  1. Display a FHIR questionnaire containing an image attachment item following instructions on how to display a questionnaire
  2. Fill out the questionnaire (e.g. taking a picture)
  3. Collect and store the QuestionnaireResponse
  4. Display the FHIR questionnaire again in review mode providing the response:
	val questionnaireFragment =
	 QuestionnaireFragment.builder()
	   .setQuestionnaire(questionnaire)
	   .setQuestionnaireResponse(questionnaireResponse)
	   .showReviewPageBeforeSubmit(true)
	   .showReviewPageFirst(true)
	   .build()
  1. The attachement item shows "not answered" despite the response does contain the Base64 encoded image and a title to it.

Expected behavior

The review page should at least display "answered", the title of the attachment resource or a thumbnail for the item (mime type dependent).

Smartphone (please complete the following information):

  • Device: Pixel 7a (and other devices)
  • Android version: 15
  • Build number: AP4A.250105.002

Additional context

The issue is caused by checking solely for an url being present and not handling the data field of the Attachment when getting the string to be displayed in

This could be extended to show the title if data is present:

is Attachment -> type.url ?: if (type.data != null) type.title else null 

Would you like to work on the issue?

Yes, a possible solution is given in teh additional context section above.

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

No branches or pull requests

1 participant