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

Custom Search Parameter does not Consider in x-fhir-query #2554

Closed asad-zaman closed 1 day ago

asad-zaman commented 4 weeks ago

Describe the bug Support for Custom Search Parameter implemented here #1382. But this doesn't work when we try to pull data via x-fhir-query.

Component Core library - Engine

To Reproduce Steps to reproduce the behavior:

  1. Use below application/x-fhir-query expression in the Questionnaire to pull Patient data
{
  "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression",
  "valueExpression": {
    "language": "application/x-fhir-query",
    "expression": "Patient?gender=female&maritalStatus=M"
  }
}
  1. It ended with an exception like java.lang.IllegalArgumentException: maritalStatus not found in Patient though we supply maritalStatus via a custom search parameter in FhirEngineConfiguration like below:
FhirEngineProvider.init(
  FhirEngineConfiguration(
    customSearchParameters =
      listOf(
        SearchParameter().apply {
          addBase("Patient")
          name = "maritalStatus"
          code = "maritalStatus"
          type = Enumerations.SearchParamType.TOKEN
          expression = "Patient.maritalStatus.coding.code"
          description = "Search the maritalStatus of Patient"
        },
      ),
  ),
)

Expected behavior x-fhir-query should consider the custom search parameter to pull related data.

Would you like to work on the issue? A PR is created which resolves the issue.

asad-zaman commented 4 weeks ago

cc: @aditya-07, @MJ1998