Skip to content

SDC crashes when repeats is false for a choice type question with check-box extension #2661

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

Open
MJ1998 opened this issue Aug 22, 2024 · 3 comments · May be fixed by #2800
Open

SDC crashes when repeats is false for a choice type question with check-box extension #2661

MJ1998 opened this issue Aug 22, 2024 · 3 comments · May be fixed by #2800
Labels
good first issue Good for newcomers P2 Medium priority issue type:enhancement New feature or request

Comments

@MJ1998
Copy link
Collaborator

MJ1998 commented Aug 22, 2024

Describe the bug
A question like following will enable mulit-selection but since repeats is false the SDC crashes on selecting the second choice.

{
  "type": "choice",
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
      "valueCodeableConcept": {
        "coding": [
          {
            "system": "http://hl7.org/fhir/questionnaire-item-control",
            "code": "check-box",
            "display": "Check-box"
          }
        ]
      }
    }
  ],
  "linkId": "2",
  "text": "HIV Status",
  "required": true,
  "repeats": false,
  "readOnly": false,
  "answerOption": [
    {
      "valueCoding": {
        "display": "Positive"
      }
    },
    {
      "valueCoding": {
        "display": "Reactive"
      }
    },
    {
      "valueCoding": {
        "display": "Negative/Non Reactive"
      }
    }
  ]
}

Component
SDC library

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. Pixel4a emulator]
  • Android version: [e.g. Settings -> About phone -> Android version]
  • Build number: [e.g. Settings -> About phone -> Build number]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Would you like to work on the issue?
Please state if this issue should be assigned to you or who you think could help to solve this issue.

@MJ1998 MJ1998 added the good first issue Good for newcomers label Aug 22, 2024
@santosh-pingle santosh-pingle added P2 Medium priority issue type:enhancement New feature or request labels Aug 26, 2024
@santosh-pingle
Copy link
Collaborator

@ Manoj

Just adding the missing elements so that you can refer to this questionnaire as it is in the catalog app to reproduce the issue.

{
  "resourceType": "Questionnaire",
  "item": [
    {
      "type": "choice",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "http://hl7.org/fhir/questionnaire-item-control",
                "code": "check-box",
                "display": "Check-box"
              }
            ]
          }
        }
      ],
      "linkId": "2",
      "text": "HIV Status",
      "required": true,
      "repeats": false,
      "readOnly": false,
      "answerOption": [
        {
          "valueCoding": {

            "display": "Positive"
          }
        },
        {
          "valueCoding": {

            "display": "Reactive"
          }
        },
        {
          "valueCoding": {

            "display": "Negative/Non Reactive"
          }
        }
      ]
    }
  ]
}

Or
In the catalog app, update "repeats": false in the component_multi_select_choice.json file to reproduce this issue.

@santosh-pingle
Copy link
Collaborator

santosh-pingle commented Feb 21, 2025

@mmanojkmr
Expected behavior is
"repeats": false, means that the user can only select one of the given answer options.
"repeats": true, means the user could select multiple values.
In any situation, the app should not crash.

@MJ1998 @jingtang10 please confirm

@mmanojkmr
Copy link
Collaborator

I am working on this.

@mmanojkmr mmanojkmr linked a pull request Mar 4, 2025 that will close this issue
7 tasks
mmanojkmr added a commit to mmanojkmr/android-fhir that referenced this issue Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers P2 Medium priority issue type:enhancement New feature or request
Projects
Status: New
Development

Successfully merging a pull request may close this issue.

3 participants