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
476 stars 253 forks source link

Measure report test failing due to patient growing older in test case... #2164

Open jingtang10 opened 11 months ago

jingtang10 commented 11 months ago

Describe the bug One of our patients in this test case https://github.com/google/android-fhir/blob/3da3bef82566f02a3e81b3d3bf00c0fc81221fe2/workflow-testing/src/main/resources/group-measure/Data-Patients-bundle.json#L564 has just become 1 year old last week (happy belated birthday!). This has caused our measure reporting test case (stratified by age) to fail.

Component Workflow library

To Reproduce Steps to reproduce the behavior: Run test case:

evaluateGroupPopulationMeasure

in file FhirOperatorTest.kt.

Expected behavior Output should be the same as: https://github.com/google/android-fhir/blob/master/workflow-testing/src/main/resources/group-measure/Results-Measure-report.json

Actual behavior The age group P1-5Y count has gone from 11 to 12. Meanwhile the age group 0Y count has gone from 1 to 0.

Screenshots NA

Smartphone (please complete the following information): Unit test. Not on real device.

Additional context Add any other context about the problem here.

Would you like to work on the issue? Yes

jingtang10 commented 11 months ago

@brynrhodes

jingtang10 commented 11 months ago

trying to work out in https://github.com/cqframework/clinical_quality_language/tree/master/Src/java how system date is retrived...

brynrhodes commented 11 months ago

The engine has an evaluationDateTime that is used to determine the current date time. This is by default set to the machine time when the execution is started. However, there is a setEvaluationDateTime on the State class that can be used to set this for each execution:

https://github.com/cqframework/clinical_quality_language/blob/e0d008a46779aa1d962d4423c959bbbd798b6614/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/execution/State.java#L155

jingtang10 commented 11 months ago

And the default is set here: https://github.com/cqframework/clinical_quality_language/blob/e0d008a46779aa1d962d4423c959bbbd798b6614/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/execution/CqlEngine.java#L199?

brynrhodes commented 11 months ago

Yes, that's correct