LHNCBC / lforms

See the project website at http://lhncbc.github.io/lforms/, or view the demo website at https://lhcforms.nlm.nih.gov/lhcforms.
Other
105 stars 56 forks source link

conditionnal display not well managed #143

Open Rosnyni opened 7 months ago

Rosnyni commented 7 months ago

I just uploaded a Questionnaire on https://lforms-fhir.nlm.nih.gov/baseR4 titled "form illustrating issue in conditional display resolution" to illustrate the bug I met.

Theoretically, the form act as follow :

When loading the form in your preview tool, it does not act well if the 'aucun antécédent' field is true :

image

Using the csiro renderer (here), it works well.

When deleting the conditional displays on the 'aucun antécedent' field, it works :

image

I found this open issue, that look a little bit like this one, but I don't understand it very well.

plynchnlm commented 7 months ago

We are looking into this. LHC-Forms throws an exception when trying to update the display status (maybe going into a loop because the items refer to each other via the enableWhen-- but that is just a guess).

plynchnlm commented 7 months ago

Since our FHIR server resets itself, I am pasting the Questionnaire referenced above here so we doing lose this test case:


{
  "resourceType": "Questionnaire",
  "id": "[5770853](https://lforms-smart-fhir.nlm.nih.gov/v/r4/fhir/Questionnaire/5770853)",
  "meta": {
    "versionId": "1",
    "lastUpdated": "2024-02-06T10:00:41.000-05:00",
    "source": "#6P24rcs39k6A1KvN",
    "tag": [
      {
        "code": "lformsVersion: 29.0.0"
      }
    ]
  },
  "url": "https://aphp.fr/ig/fhir/sdc/Questionnaire/test_conditionnal_loop",
  "title": "form illustrating issue in conditional display resolution",
  "status": "draft",
  "item": [
    {
      "linkId": "2968534520641",
      "text": "Traumatisme ou blessure ligamentaire",
      "type": "boolean",
      "enableWhen": [
        {
          "question": "3109258400896",
          "operator": "!=",
          "answerBoolean": true
        }
      ],
      "enableBehavior": "all",
      "repeats": false,
      "initial": [
        {
          "valueBoolean": false
        }
      ]
    },
    {
      "linkId": "366620113335",
      "text": "Troubles congénitaux ou développementaux",
      "type": "boolean",
      "enableWhen": [
        {
          "question": "3109258400896",
          "operator": "!=",
          "answerBoolean": true
        }
      ],
      "enableBehavior": "all",
      "repeats": false,
      "initial": [
        {
          "valueBoolean": false
        }
      ]
    },
    {
      "linkId": "5052291573689",
      "text": "Autres troubles articulaires",
      "type": "boolean",
      "enableWhen": [
        {
          "question": "3109258400896",
          "operator": "!=",
          "answerBoolean": true
        }
      ],
      "enableBehavior": "all",
      "repeats": false,
      "initial": [
        {
          "valueBoolean": false
        }
      ]
    },
    {
      "linkId": "3109258400896",
      "text": "Aucun antécédent",
      "type": "boolean",
      "enableWhen": [
        {
          "question": "2968534520641",
          "operator": "!=",
          "answerBoolean": true
        },
        {
          "question": "366620113335",
          "operator": "!=",
          "answerBoolean": true
        },
        {
          "question": "5052291573689",
          "operator": "!=",
          "answerBoolean": true
        }
      ],
      "enableBehavior": "all",
      "repeats": false,
      "initial": [
        {
          "valueBoolean": false
        }
      ]
    }
  ]
}```
lhcye commented 7 months ago

It is a bug and it is fixed in version 35.0.1. Please give it a try. Thanks for the reporting it to us.

plynchnlm commented 7 months ago

I think we'll need to update the version of lforms used by the NLM Form Builder for you to see the fix.