Skip to content

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

Open
@kedegger-ait

Description

@kedegger-ait

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions