Giter Site home page Giter Site logo

Comments (7)

jingtang10 avatar jingtang10 commented on August 19, 2024

thanks @allan-on can you share your questionnaire?

from android-fhir.

allan-on avatar allan-on commented on August 19, 2024

thanks @allan-on can you share your questionnaire?

Hi @jingtang10 This is the Questionnaire I used in the demo above:

{
  "resourceType": "Questionnaire",
  "item": [
    {
      "linkId": "1",
      "type": "group",
      "text": "Repeated Group",
      "repeats": true,
      "item": [
        {
          "linkId": "1-2",
          "type": "choice",
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
              "valueCodeableConcept": {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/questionnaire-item-control",
                    "code": "drop-down",
                    "display": "Drop down"
                  }
                ],
                "text": "Drop down"
              }
            }
          ],
          "text": "Sample dropdown question",
          "answerOption": [
            {
              "valueCoding": {
                "code": "answer-a",
                "display": "A"
              }
            },
            {
              "valueCoding": {
                "code": "answer-b",
                "display": "B"
              }
            },
            {
              "valueCoding": {
                "code": "answer-c",
                "display": "C"
              }
            },
            {
              "valueCoding": {
                "code": "answer-other",
                "display": "Other"
              }
            }
          ],
          "item": [
            {
              "linkId": "1-3-1",
              "text": "Dropdown question helper text",
              "type": "display",
              "extension": [
                {
                  "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
                  "valueCodeableConcept": {
                    "coding": [
                      {
                        "system": "http://hl7.org/fhir/questionnaire-item-control",
                        "code": "flyover",
                        "display": "Fly-over"
                      }
                    ],
                    "text": "Flyover"
                  }
                }
              ]
            }
          ]
        },
        {
          "linkId": "1-1",
          "text": "Sample date question",
          "type": "date",
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
              "valueString": "yyyy-mm-dd"
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression",
              "valueExpression": {
                "language": "text/fhirpath",
                "expression": "%resource.descendants().where(linkId='1-2').answer.value.code = 'answer-a'"
              }
            }
          ]
        }
      ]
    }
  ]
}

from android-fhir.

santosh-pingle avatar santosh-pingle commented on August 19, 2024

thanks @allan-on can you share your questionnaire?

Hi @jingtang10 This is the Questionnaire I used in the demo above:

{
  "resourceType": "Questionnaire",
  "item": [
    {
      "linkId": "1",
      "type": "group",
      "text": "Repeated Group",
      "repeats": true,
      "item": [
        {
          "linkId": "1-1",
          "text": "Sample date question",
          "type": "date",
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
              "valueString": "yyyy-mm-dd"
            }
          ]
        },
        {
          "linkId": "1-2",
          "type": "choice",
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
              "valueCodeableConcept": {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/questionnaire-item-control",
                    "code": "drop-down",
                    "display": "Drop down"
                  }
                ],
                "text": "Drop down"
              }
            }
          ],
          "text": "Sample dropdown question",
          "answerOption": [
            {
              "valueCoding": {
                "code": "answer-a",
                "display": "A"
              }
            },
            {
              "valueCoding": {
                "code": "answer-b",
                "display": "B"
              }
            },
            {
              "valueCoding": {
                "code": "answer-c",
                "display": "C"
              }
            },
            {
              "valueCoding": {
                "code": "answer-other",
                "display": "Other"
              }
            }
          ],
          "item": [
            {
              "linkId": "1-3-1",
              "text": "Dropdown question helper text",
              "type": "display",
              "extension": [
                {
                  "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
                  "valueCodeableConcept": {
                    "coding": [
                      {
                        "system": "http://hl7.org/fhir/questionnaire-item-control",
                        "code": "flyover",
                        "display": "Fly-over"
                      }
                    ],
                    "text": "Flyover"
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

@allan-on Can you please check whether posted questionnaire has the enable-when expression?

from android-fhir.

allan-on avatar allan-on commented on August 19, 2024

Hi @santosh-pingle. I'm sorry about that. I've updated the sample I shared earlier.

from android-fhir.

jingtang10 avatar jingtang10 commented on August 19, 2024

Hey @allan-on i'm not sure i agree with the use of %resource in the enable when expression I think you end up losing the context of your answer inside the repeated group.

I think the best way to handle this is actually use enable when element defined in the questionnaire base spec.

Take a look at the comemnts section of this element: https://build.fhir.org/questionnaire-definitions.html#Questionnaire.item.enableWhen.question it very clearly defines the order or traversal so I think the behaviour is more predictable.

from android-fhir.

jingtang10 avatar jingtang10 commented on August 19, 2024

Hey @allan-on,

I posted a question on fhir chat https://chat.fhir.org/#narrow/stream/179266-fhirpath/topic/parent.28.29.20or.20siblings.28.29.3F and I've yet to try this method.

But I've I tried to use enable when statement instead of enablewhen expression, and I tried the following questionnaire:

{
  "resourceType": "Questionnaire",
  "item": [
    {
      "linkId": "1",
      "type": "group",
      "text": "Repeated Group",
      "repeats": true,
      "item": [
        {
          "linkId": "1-2",
          "type": "choice",
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
              "valueCodeableConcept": {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/questionnaire-item-control",
                    "code": "drop-down",
                    "display": "Drop down"
                  }
                ],
                "text": "Drop down"
              }
            }
          ],
          "text": "Sample dropdown question",
          "answerOption": [
            {
              "valueCoding": {
                "code": "answer-a",
                "display": "A"
              }
            },
            {
              "valueCoding": {
                "code": "answer-b",
                "display": "B"
              }
            },
            {
              "valueCoding": {
                "code": "answer-c",
                "display": "C"
              }
            },
            {
              "valueCoding": {
                "code": "answer-other",
                "display": "Other"
              }
            }
          ],
          "item": [
            {
              "linkId": "1-3-1",
              "text": "Dropdown question helper text",
              "type": "display",
              "extension": [
                {
                  "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
                  "valueCodeableConcept": {
                    "coding": [
                      {
                        "system": "http://hl7.org/fhir/questionnaire-item-control",
                        "code": "flyover",
                        "display": "Fly-over"
                      }
                    ],
                    "text": "Flyover"
                  }
                }
              ]
            }
          ]
        },
        {
          "linkId": "1-1",
          "text": "Sample date question",
          "type": "date",
          "enableWhen": [
            {
              "question": "1-2",
              "operator": "=",
              "answerCoding": {
                "code": "answer-a",
                "display": "A"
              }
            }
          ],
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
              "valueString": "yyyy-mm-dd"
            }
          ]
        }
      ]
    }
  ]
}

which worked with #2597 which I've just sent out.

from android-fhir.

allan-on avatar allan-on commented on August 19, 2024

Thanks @jingtang10 and @santosh-pingle for working on this!
I've tested this on my end and it works with the enableWhen statement 👍🏾

from android-fhir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.