android-fhir icon indicating copy to clipboard operation
android-fhir copied to clipboard

Subtitle text not behaving as expected

Open williamito opened this issue 3 years ago • 13 comments

Case 1: The text "Correct!" appears twice, once incorrectly above the question "Cats are better than dogs", and once correctly based on the enableWhen element.

{
  "resourceType": "Questionnaire",
  "status": "active",
  "item": [
    {
      "linkId": "2",
      "text": "Demographic Information",
      "type": "group",
      "item": [
        {
          "linkId": "2.1",
          "text": "Cats are better than dogs",
          "type": "boolean"
        },
        {
          "linkId": "2.1.1",
          "text": "Correct!",
          "type": "display",
          "enableWhen": [
            {
              "question": "2.1",
              "operator": "=",
              "answerBoolean": true
            }
          ]
        }
      ]
    }
  ]
}

image

Case 2: When enableWhen is a child of the item, the "Correct!" text never appears. It still shows up incorrectly above the question, like in Case 1.

{
  "resourceType": "Questionnaire",
  "status": "active",
  "item": [
    {
      "linkId": "2",
      "text": "Demographic Information",
      "type": "group",
      "item": [
        {
          "linkId": "2.1",
          "text": "Cats are better than dogs",
          "type": "boolean",
          "item": [
            {
              "linkId": "2.1.1",
              "text": "Correct!",
              "type": "display",
              "enableWhen": [
                {
                  "question": "2.1",
                  "operator": "=",
                  "answerBoolean": true
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

image

This is using the published version of com.google.android.fhir:data-capture:0.1.0-beta03.

williamito avatar Jun 07 '22 20:06 williamito

@PallaviGanorkar can you take a look at this please

jingtang10 avatar Jun 07 '22 22:06 jingtang10

https://github.com/google/android-fhir/pull/1222

santosh-pingle avatar Jul 07 '22 11:07 santosh-pingle

Case 2: As per issue 1113 and PR 1222, this behavior is as expected. i.e Showing Nested display item text as subtitle text.

PallaviGanorkar avatar Jul 07 '22 12:07 PallaviGanorkar

Case 1: Reproducible in version com.google.android.fhir:data-capture:0.1.0-beta03, but in latest code base its not reproducible, its working fine.

PallaviGanorkar avatar Jul 07 '22 12:07 PallaviGanorkar

For Case 2, I did not understand that it was considered subtitle text because the text "Correct!" is rendered the same as the other text on the questionnaire. The intended use would be more clear if the text styling was different.

That said, I think it is difficult to understand when something would be considered a subtitle vs a new text element. Can you describe how the rendering logic works based on the JSON structure for documentation purposes?

As an alternative, maybe we could use the displayCategory extension to make the rendering style decisions more explicit.

williamito avatar Jul 18 '22 04:07 williamito

In addition, the display of "Correct!" does not appear to respect the enableWhen.

image

re: formatting based on JSON structure, the top level text "Demographic Information" looks the same as "Cats are better than dogs". I would expect the contents of a "text" field of a "group" type to be a section header and render differently than a question text.

williamito avatar Jul 19 '22 07:07 williamito

For Case 2, I did not understand that it was considered subtitle text because the text "Correct!" is rendered the same as the other text on the questionnaire. The intended use would be more clear if the text styling was different.

That said, I think it is difficult to understand when something would be considered a subtitle vs a new text element. Can you describe how the rendering logic works based on the JSON structure for documentation purposes?

As an alternative, maybe we could use the displayCategory extension to make the rendering style decisions more explicit.

i agre with this. maybe we should use display category.

maybe we should use "instructions" http://hl7.org/fhir/R4/valueset-questionnaire-display-category.html

jingtang10 avatar Jul 19 '22 12:07 jingtang10

https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/Hints.20for.20questions

jingtang10 avatar Jul 19 '22 12:07 jingtang10

re: formatting based on JSON structure, the top level text "Demographic Information" looks the same as "Cats are better than dogs". I would expect the contents of a "text" field of a "group" type to be a section header and render differently than a question text.

@williamito @jingtang10 @santosh-pingle This is a great call out. I agree they should render differently. From what I'm aware of we don't have a "section header" text style. I have some old mocks where we have this type of text rendering above a question. See below I'd recommend we use the "Title Medium - Roboto 16 Medium" text style. @santosh-pingle any questions/issues with implementing this type of section header text style?

Screen Shot 2022-07-21 at 06 01 59

shelaghm avatar Jul 21 '22 13:07 shelaghm

i agre with this. maybe we should use display category. maybe we should use "instructions" http://hl7.org/fhir/R4/valueset-questionnaire-display-category.html

@jingtang10 @williamito

The "subtitle text" usually instructions that accompany the questions. I think changing it to "instructions" might be the most clear.

shelaghm avatar Jul 21 '22 13:07 shelaghm

Looking into it. thanks!

santosh-pingle avatar Aug 05 '22 05:08 santosh-pingle

re: formatting based on JSON structure, the top level text "Demographic Information" looks the same as "Cats are better than dogs". I would expect the contents of a "text" field of a "group" type to be a section header and render differently than a question text.

@williamito @jingtang10 @santosh-pingle This is a great call out. I agree they should render differently. From what I'm aware of we don't have a "section header" text style. I have some old mocks where we have this type of text rendering above a question. See below I'd recommend we use the "Title Medium - Roboto 16 Medium" text style. @santosh-pingle any questions/issues with implementing this type of section header text style?

Screen Shot 2022-07-21 at 06 01 59

working on it.

santosh-pingle avatar Aug 05 '22 05:08 santosh-pingle

i agre with this. maybe we should use display category. maybe we should use "instructions" http://hl7.org/fhir/R4/valueset-questionnaire-display-category.html

@jingtang10 @williamito

The "subtitle text" usually instructions that accompany the questions. I think changing it to "instructions" might be the most clear.

We can provide implementation. thanks!

santosh-pingle avatar Aug 05 '22 05:08 santosh-pingle

i agre with this. maybe we should use display category. maybe we should use "instructions" http://hl7.org/fhir/R4/valueset-questionnaire-display-category.html

@jingtang10 @williamito The "subtitle text" usually instructions that accompany the questions. I think changing it to "instructions" might be the most clear.

We can provide implementation. thanks!

looking into it.

santosh-pingle avatar Aug 18 '22 09:08 santosh-pingle