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

Flyover text as secondary dialog title #2647

Closed
FikriMilano opened this issue Jul 28, 2024 · 22 comments · Fixed by #2648
Closed

Flyover text as secondary dialog title #2647

FikriMilano opened this issue Jul 28, 2024 · 22 comments · Fixed by #2648
Assignees
Labels
effort:xsmall Extra small effort - 1 day P2 Medium priority issue

Comments

@FikriMilano
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Currently, when the item.text is null, the title of the dialog is also null. We'd still like to have something displayed as the dialog title, and the closest thing is to display the flyover text. Unless there's a specific extension to display a dialog title (couldn't find one).

Currently:

              OptionSelectDialogFragment(
                title = questionnaireItem.localizedTextSpanned ?: "",
                config = questionnaireItem.buildConfig(),
                selectedOptions = selectedOptions,
              )

Describe the solution you'd like
If item.text is null, apply flyover text as the dialog title.

              OptionSelectDialogFragment(
                title = questionnaireItem.localizedTextSpanned ?: questionnaireItem.localizedFlyoverSpanned ?: "",
                config = questionnaireItem.buildConfig(),
                selectedOptions = selectedOptions,
              )

Describe alternatives you've considered
Specific extension to display a dialog title (couldn't find one).

Additional context
Screen Shot 2024-07-29 at 06 00 55

Would you like to work on the issue?
Yes

@MJ1998
Copy link
Collaborator

MJ1998 commented Jul 29, 2024

Using flyover here might cause developer miss adding localized text.
But I guess I am okay with this solution as there are no recommendation in FHIR about this.
Should we suggest this in FHIR community ?

@MJ1998 MJ1998 assigned MJ1998 and FikriMilano and unassigned MJ1998 Jul 29, 2024
@MJ1998 MJ1998 added P2 Medium priority issue effort:xsmall Extra small effort - 1 day labels Jul 29, 2024
@FikriMilano
Copy link
Collaborator Author

@MJ1998 We are already localizing flyover text, so no worries there.

/**
* A nested questionnaire item of type display with code [DisplayItemControlType.FLYOVER] (if
* present) is used as the fly-over text of the parent question.
*/
internal val QuestionnaireItemComponent.localizedFlyoverSpanned: Spanned?
get() = item.localizedFlyoverSpanned
/** [localizedFlyoverSpanned] over list of [Questionnaire.QuestionnaireItemComponent] */
val List<QuestionnaireItemComponent>.localizedFlyoverSpanned: Spanned?
get() =
this.firstOrNull { questionnaireItem ->
questionnaireItem.type == Questionnaire.QuestionnaireItemType.DISPLAY &&
questionnaireItem.displayItemControl == DisplayItemControlType.FLYOVER
}
?.localizedTextSpanned

Using help extension is also an option, but we are already using it as help card. Declaring a help extension to an item will immediately show a help button, wanting to not show a help button and instead showing the help extension text in the dialog title is not possible.
https://hl7.org/fhir/R4/codesystem-questionnaire-item-control.html

@MJ1998
Copy link
Collaborator

MJ1998 commented Aug 5, 2024

@FikriMilano, btw, why not change the text in the questionnaire itself ?

@FikriMilano
Copy link
Collaborator Author

@MJ1998 design reasons, in this case, we would like the question as flyover text, instead of a text above the field.

When we only use flyover text as question, the question in the dialog is null, we would like for the dialog to still show the question that's from the flyover text.

@jingtang10
Copy link
Collaborator

if we're using fly over as the title for the dialog, shouldn't we just not use the question text as the dialog title?

how would you customise the dialog title if you already have question text?

@FikriMilano
Copy link
Collaborator Author

  1. Exactly, that's what I did
  2. We will have 2 item, first item is a display type that contains the question text (item.text). Second item is the dropdown field w flyover that will open the dialog, but have a null question text.

@MJ1998
Copy link
Collaborator

MJ1998 commented Aug 6, 2024

What if you use questionnaire-rendering extension and set code to "no-header" ?

@jingtang10
Copy link
Collaborator

  1. Exactly, that's what I did
  2. We will have 2 item, first item is a display type that contains the question text (item.text). Second item is the dropdown field w flyover that will open the dialog, but have a null question text.

Yeah but what I mean is I'd like for you to be able to do that using only 1 questionnaire item... I feel it's easier just to use the flyover text for the dialog title (without first checking the question text)

@FikriMilano
Copy link
Collaborator Author

  1. What if you use questionnaire-rendering extension and set code to "no-header" ?

    @MJ1998 could provide a more detailed documentation, I couldn't find what you're referring to.

  2. Yeah but what I mean is I'd like for you to be able to do that using only 1 questionnaire item... I feel it's easier just to use the flyover text for the dialog title (without first checking the question text)

    @jingtang10 I mean, sure, thank you, but what if someone is just simply using item.text? How should we handle that?

@MJ1998
Copy link
Collaborator

MJ1998 commented Aug 8, 2024

@FikriMilano Sorry I thought there is some "questionnaire-rendering" extension.
What my idea was to use an extension which disables header text. This way you could have added the text in the second item without displaying it above the field, and it would have also shown as dialog title.
Instead of the flyover text as a custom approach, I incline more towards having a custom extension which disables header text.

@FikriMilano
Copy link
Collaborator Author

FikriMilano commented Aug 8, 2024

@MJ1998 feels like a very roundabout way to do it, no?

Would be simpler to use the custom extension to directly change the dialog title i.e. the custom extension will contains the dialog title

@jingtang10
Copy link
Collaborator

@FikriMilano Sorry I thought there is some "questionnaire-rendering" extension. What my idea was to use an extension which disables header text. This way you could have added the text in the second item without displaying it above the field, and it would have also shown as dialog title. Instead of the flyover text as a custom approach, I incline more towards having a custom extension which disables header text.

why would we want to disable header test?

@jingtang10
Copy link
Collaborator

  1. What if you use questionnaire-rendering extension and set code to "no-header" ?

    @MJ1998 could provide a more detailed documentation, I couldn't find what you're referring to.

  2. Yeah but what I mean is I'd like for you to be able to do that using only 1 questionnaire item... I feel it's easier just to use the flyover text for the dialog title (without first checking the question text)

    @jingtang10 I mean, sure, thank you, but what if someone is just simply using item.text? How should we handle that?

they that should be used as question title. if we're forcing questionnaire authors to write split their questions into two because of the dialog title it's bad for consistency. imagine if questionnaire authors need to know the quirks of android fhir sdk sdc library to be able to write a questionnaire that's correctly rendered - we don't want that.

i'd rather if we reuse an extension, or come up with a new extension for the dialog title.

@MJ1998
Copy link
Collaborator

MJ1998 commented Aug 8, 2024

why would we want to disable header test?

By header I mean item.text. Disabling item.text will let users specify one but it will only show as the dialog title and hide the title above the input field.

i'd rather if we reuse an extension, or come up with a new extension for the dialog title.

+1 to Jing. A custom extension is better than custom logic in code.

Would be simpler to use the custom extension to directly change the dialog title i.e. the custom extension will contains the dialog title

Also you are right @FikriMilano. I guess we can have a custom extension which provides a dialog title.

@jingtang10
Copy link
Collaborator

why do you need an anternative title again? is it because of space? would this work https://build.fhir.org/ig/HL7/sdc/StructureDefinition-sdc-questionnaire-shortText.html?

@FikriMilano
Copy link
Collaborator Author

FikriMilano commented Aug 13, 2024

@jingtang10 we want a dialog title that can be defined with a custom extension, or simply reuse the flyover extension.

The extension you mentioned has a different purpose
https://build.fhir.org/ig/HL7/sdc/StructureDefinition-sdc-questionnaire-shortText.html

@jingtang10
Copy link
Collaborator

@jingtang10 we want a dialog title that can be defined with a custom extension, or simply reuse the flyover extension.

The extension you mentioned has a different purpose
https://build.fhir.org/ig/HL7/sdc/StructureDefinition-sdc-questionnaire-shortText.html

Yes but why do you want an alternative title? Is it because of space? Would the short text be more suitable than fly over?

@FikriMilano
Copy link
Collaborator Author

It's not about space.

It's just when we use flyover text as a question in a dropdown field, but not using item.text (it's null),

The dialog we opened has no title, but we still want to display the title, where in this case, the question is defined as flyover text.

@jingtang10
Copy link
Collaborator

but why is the question text null in this case? i'm trying to look for the most sensible way for both questionnaire authors and implementation to do this using the right extensions. i know for your question you might not have text field but the question is why? This dictates if we will try to reuse an extension or create a new extension.

In the original screenshot I am seeing question text in the background actually.

@jingtang10
Copy link
Collaborator

does it not have question text because you're using another display item for the question text before this drop down? that is strange and i would argue it's a usage pattern that should be discouraged.

@jingtang10
Copy link
Collaborator

Fikri's reply:

can you pls add some background as to the root reason?
A: It's simply a UI preference, where instead displaying the question above the field, we display it as flyover text (see image) 

why is the dialog title different from question text?
A: It's still the same, but the dialog title is retrieved from flyover, the flyover is the question in this case.

is it because it needs to be shorter? 
A: No

and if you say the original question has null text that's even odder - why doesn't a question have text but require the dialog to have text...?
A: the question still have text but that is retrieved from flyover, knowing that, the dialog title now needs to also display the text from flyover (see image).

@jingtang10
Copy link
Collaborator

Thanks @FikriMilano for the replies to my questions - now I understand the issue I'm happy with the PR.

@github-project-automation github-project-automation bot moved this from New to Complete in Android FHIR SDK Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:xsmall Extra small effort - 1 day P2 Medium priority issue
Projects
Status: Complete
Development

Successfully merging a pull request may close this issue.

3 participants