Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Measure Evaluate Start and End times #362

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

vitorpamplona
Copy link
Contributor

Something like this:

    val measureReport =
      fhirOperator.evaluateMeasure(
        measureUrl = "http://fhir.org/guides/who/anc-cds/Measure/ANCIND01",
        start = "2020-01-01",
        end = "2020-01-31",
        reportType = MeasureEvalType.SUBJECT.toCode(),
        subjectId = "charity-otala-1",
        practitioner = "jane",
      )

went from outputting

  "period": {
    "start": "2020-01-01T00:00:00+00:00",
    "end": "2020-01-31T23:59:59+00:00"
  },

to

  "period": {
    "start": "2020-01-01T00:00:00+00:00",
    "end": "2020-01-31T00:00:00+00:00"
  },

after the upgrade to 3.0.

After lots of debug, I believe the following lines set the precision to seconds without considering if the last day is closed or open, which causes the subsequent operations to be based on the 0 hour and the output to match that.

…t day. Because it was not setting the precision, the default becomes SECONDS and when printing the report, it adds 00:00:00+00:00 without considering if the period was open or closed. By setting the precision correctly, it seems that the rest falls into place and the appropriate start and end times are considered.

Expected: 2020-01-31T23:59:59+00:00
          got: 2020-01-31T00:00:00+00:00
@vitorpamplona
Copy link
Contributor Author

@JPercival looks like you changed these lines recently. You might be aware of this potential issue.

@JPercival
Copy link
Contributor

We have a couple DateTime bugs in-flight, one was resolved with cqframework/clinical_quality_language#1259.

I'm going to take another look at this once cqframework/clinical_quality_language#1269 lands.

@JPercival
Copy link
Contributor

@Capt-Mac - Can you take a look at this? DateTime fixes were merged into CQL.

Based on the spec here I'd say that the millisecond-level output is correct:
https://build.fhir.org/operation-measure-evaluate-measure.html

Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (ca6099b) 53.30% compared to head (dfdb31b) 53.30%.

Files Patch % Lines
...ir/cr/measure/dstu3/Dstu3MeasureReportBuilder.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #362      +/-   ##
============================================
- Coverage     53.30%   53.30%   -0.01%     
  Complexity     2133     2133              
============================================
  Files           281      281              
  Lines         11836    11840       +4     
  Branches       1618     1618              
============================================
+ Hits           6309     6311       +2     
- Misses         4912     4914       +2     
  Partials        615      615              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Capt-Mac
Copy link
Contributor

@vitorpamplona I took a look at your changes to R4MeasureReportBuilder.java

R4MeasureProcessor.buildMeasurementPeriod does correctly default interval to expected value, which is what the CQL will use to actually calculate results:

  • test submitted (2014-01-01, 2014-12-31)
  • observed results (2014-01-01T00:00:00, 2014-12-31T23:59:59)

This matches spec definition https://build.fhir.org/operation-measure-evaluate-measure.html

"The end of the measurement period. The period will end at the end of the period implied by the supplied timestamp. E.g. a value of 2014 would set the period end to be 2014-12-31T23:59:59 inclusive"

MeasureReport.Period however has different requirements https://www.hl7.org/fhir/R4/datatypes.html#Period
and R4MeasureReportBuilder.getPeriod does correctly assume period based on provided values to $evaluate-measure.

Though for clarity, I do think these values should match

whatever value is passed in gets put on https://www.hl7.org/fhir/R4/datatypes.html#dateTime

example: passed in => returned
yyyy-mm-dd => yyyy-mm-ddT00:00:00,
yyyy-mm-ddT23:59:59 => yyy-mm-ddT23:59:59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants