$evaluate-measure forces the measurement period to second precision, so CMS's millisecond boundary test data evaluates as uncertain

Open
#1,133 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
43/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java
Domain
backend, databases

Research direction

Start by tracing MeasureProcessorTimeUtils.getMeasurementPeriod through DateHelper.buildMeasurementPeriodInterval to DateHelper.convertToDateTime, where the issue identifies setPrecision(Precision.SECOND) as the point that coarsens the period. Compare the parameterized period with the measure's default millisecond precision and the boundary cases described for CMS165 and CMS125. Done means parameterized evaluation preserves the needed boundary precision and agrees with the steward's expected reports; the issue does not name tests to run.

Written by the indexing model from the issue text.

Description

What happened?

When periodStart and periodEnd are supplied to $evaluate-measure, the measurement period is built at second precision. CMS's MADiE test data puts events on the period boundaries at millisecond precision, so those comparisons come out uncertain (null) and the patients fall out of the population.

The path is MeasureProcessorTimeUtils.getMeasurementPeriod → DateHelper.buildMeasurementPeriodInterval → DateHelper.convertToDateTime, which calls convertedDateTime.setPrecision(Precision.SECOND). This is in v4.13.0 and on main.

CMS's measures declare their default period at millisecond precision, e.g. Interval[@2026-01-01T00:00:00.000, @2027-01-01T00:00:00.000). When the operation is called without period parameters, the same cases agree.

How can we reproduce it?

  • Server: hapiproject/hapi:v8.12.0-2 (HAPI FHIR 8.12.0, clinical-reasoning 4.13.0), digest sha256:0ff86aac4c7bd13a1ee226444a70263bb46ed1c28ef543c30a44f865b80ca04e, with a fresh container per run.
  • Content: CMS165FHIRControllingHighBP from cqframework/dqm-content-qicore-2025 at ca4b495, with its 68 MADiE test cases.
  • Request: Measure/$evaluate-measure per subject.

CMS165's initial population requires:

Hypertension.prevalenceInterval() overlaps Interval[start of "Measurement Period", start of "Measurement Period" + 6 months)

51 of its IPP cases put the earliest hypertension onset at 2026-06-30T23:59:59.000+00:00.

Run Agree with the MADiE expected reports
periodStart=2026-01-01&periodEnd=2026-12-31 13/68
no period parameters (the library's default period) 67/68
as the first run, but with only the 63 hypertension onsets at 2026-06-30T23:59:59.000 moved to 2026-06-30T12:00:00.000 67/68

With the period at second precision, the window's open end is 2026-06-30T23:59:59 at second precision. An onset of 23:59:59.000 matches it to the second but has more precision, so overlaps is null. (The one remaining case is #1071.)

CMS125 shows the same thing at the period end. Its ends on or before end of "Measurement Period" meets mastectomy procedures at 2026-12-31T23:59:59.000: 64/66 with the parameters, and 66/66 when only those 5 procedures move to noon the same day.

What did you expect to happen?

The period should keep the precision of the measure's own default (milliseconds, ending at 23:59:59.999), as fqm-execution does. At least, it should not be coarsened below the precision of the value supplied.

I realise the DEQM $evaluate documentation uses 2014-12-31T23:59:59 as its example end, so the intended precision may be partly a spec question. As it stands, though, the steward's own test cases fail.

(The other path, DateHelper.resolveDate, carries a TODO: Seems like we might want set the precision appropriately here?.)

Dominant language
Java
Stars
52
Forks
46
Avg merge
1d 14h
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cqframework/clinical-reasoning

All issues in cqframework/clinical-reasoning

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.