google / android-fhir

The Android FHIR SDK is a set of Kotlin libraries for building offline-capable, mobile-first healthcare applications using the HL7® FHIR® standard on Android.
https://google.github.io/android-fhir/
Apache License 2.0
465 stars 246 forks source link

Only select QuestionnaireItem with 'page' extension as page #2569

Open LZRS opened 2 weeks ago

LZRS commented 2 weeks ago

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #2568

Description Change getQuestionnairePages to only return questionnaire pages from QuestionnaireItems that have extension

        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "http://hl7.org/fhir/questionnaire-item-control",
                "code": "page",
                "display": "Page"
              }
            ]
          }
        }

Alternative(s) considered Have you considered any alternatives? And if so, why have you chosen the approach in this PR?

Type Bug fix

Screenshots (if applicable)

Checklist

LZRS commented 1 week ago

We need to include contiguous set of items not with page extension into another page.

"If there are items at the same level as a 'page' group that are listed before the 'page' group, they will be treated as a separate page" Reference - https://build.fhir.org/ig/HL7/fhir-extensions//CodeSystem-questionnaire-item-control.html

So if the questionnaire looks like -

{
  itemWithNoPageExtension1, 
  itemWithPageExtension2, // have nested items
  itemWithPageExtension3,
  itemWithNoPageExtension4,
  itemWithNoPageExtension5,
  itemWithNoPageExtension6,
  itemWithPageExtension7,
}

The pages would look like following:-

{
  page1: {
      itemWithNoPageExtension1,
  },
  page2: {
      itemWithPageExtension2
  },
  page3: {
      itemWithPageExtension3
  },
  page4: {
      itemWithNoPageExtension4,
      itemWithNoPageExtension5,
      itemWithNoPageExtension6
  },
  page5: {
      itemWithPageExtension7
  }
}

Ah okay, makes sense. Probably we'd then need to make changes to our questionnaires, thanks