android-fhir icon indicating copy to clipboard operation
android-fhir copied to clipboard

Add a Wrapper For fhirPath expressions, cqf-calculatedValue, cqf-library and cqf-expression.

Open RaaziaTarique opened this issue 2 years ago • 6 comments

Is your feature request related to a problem? Please describe. FhirPathEngine, DataRenderer and related classes to evaluate fhirPath expressions, cqf-calculatedValue, cqf-library and cqf-expression will be used multiple time in the project so it's better to have central wrapper for these classes.

Following issues which may use this wrapper in the future:

https://github.com/google/android-fhir/issues/1040 (This wrapper is a Pre-Requisite) https://github.com/google/android-fhir/issues/1033 https://github.com/google/android-fhir/issues/1059

Describe the solution you'd like Add a wrapper in the common module.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context @jingtang10 proposed this solution in the SDK ticket discussion call held on 18th March, 2022 CC: @f-odhiambo

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.

RaaziaTarique avatar Mar 21 '22 12:03 RaaziaTarique

as a first step to speed up development, i think it's ok to create this new api as an internal api in the datacapture module. as a next step we can move it to the common module (which will require a separate release).

jingtang10 avatar Mar 22 '22 08:03 jingtang10

I recommend(draft) the following:

class FhirPathWrapper

functions:

  • evaluate - Can be used by cqf-calculatedValue, cqf-express, calculatedExpression extensions
  • evaluateToBoolean - Can be used by enableWhen extension

It can also be used in the FHIR Path variable issue at a later point

Most of these output either a boolean or a list of resources.

The wrapper can be extended to support constant extensions that need local support such as %questionnaire, qitem(), sum() etc defined here

FhirPathWrapper can also be modified to add support for other expressions as well such as answerExpression and others if needed.

@RaaziaTarique I don't know if this is what @jingtang10 wanted but I believe it's a start based on my understanding

Edited with @RaaziaTarique

ekigamba avatar Mar 30 '22 09:03 ekigamba

@RaaziaTarique @jingtang10 has the approach here been resolved? Thanks

fredhersch avatar May 20 '22 01:05 fredhersch

Updates on this

  1. Min/Max validation Works for Date but not other data types - PR https://github.com/google/android-fhir/pull/1442 ready
  2. calculated-expression - PR https://github.com/google/android-fhir/pull/1380 ready
  3. calculated-value - PR https://github.com/google/android-fhir/pull/1442 ready
  4. Implement calculated-expression extension 1059 | variables -> PR https://github.com/google/android-fhir/pull/1328 ready
  5. CQF Expression not implemented yet - Needs a discussion CC @maimoonak

f-odhiambo avatar Jun 20 '22 11:06 f-odhiambo

CC @fredhersch @jingtang10

f-odhiambo avatar Jun 20 '22 12:06 f-odhiambo

  1. https://github.com/google/android-fhir/pull/1442 has comments to be addressed.
  2. just left a review. also requested @joiskash to review.
  3. that's the same PR as 1
  4. just left a review
  5. can you set up something please @maimoonak

jingtang10 avatar Jul 01 '22 14:07 jingtang10

The expressions support has a long list https://build.fhir.org/ig/HL7/sdc/expressions.html and https://build.fhir.org/ig/HL7/sdc/behavior.html. Some of the expressions discussed in current thread are below

  • Date picker restrict -> https://github.com/google/android-fhir/issues/1040 -> PR UNDER REVIEW https://github.com/google/android-fhir/pull/1442
  • Initial expression -> https://github.com/google/android-fhir/issues/1033 -> PR MERGED -> https://github.com/google/android-fhir/pull/1228
  • Variable support -> https://github.com/google/android-fhir/issues/1059 -> PR APPROVED -> https://github.com/google/android-fhir/pull/1328
  • Calculated expression -> https://github.com/google/android-fhir/issues/971 -> PR AWAITING PR 1328 (variables work) -> https://github.com/google/android-fhir/pull/1380
  • Calculated value -> PR READY -> https://github.com/google/android-fhir/pull/1442
  • Answer expression -> https://github.com/google/android-fhir/issues/1039 -> PR UNDER REVIEW -> https://github.com/google/android-fhir/pull/1480
  • EnableWhen expression -> https://github.com/google/android-fhir/issues/819 -> PR MERGED (long ago) -> https://github.com/google/android-fhir/pull/1294
  • Candidate expression -> https://github.com/google/android-fhir/issues/1038 -> AWAITING PR 1480 (overlaps functionality)
  • CQF Expression -> very vast range http://hl7.org/fhir/R4/extension-cqf-expression.html -> not implemented yet and no specific issue or use case exists/linked - Needs a discussion

@f-odhiambo @jingtang10 @Tarun-Bhardwaj

maimoonak avatar Aug 30 '22 22:08 maimoonak

@fredhersch See the summery above on the related FHIRPath expression tickets

f-odhiambo avatar Aug 31 '22 12:08 f-odhiambo

I think as a tracking issue this issue can be closed as the only item left is 1038.

jingtang10 avatar Mar 06 '23 22:03 jingtang10