Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions backend/src/main/resources/measures/audiogram.cql
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ parameter "Measurement Period" Interval<DateTime>
context Patient

define "In Hearing Conservation Program":
exists([Condition])
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:hearing-enrollment' and x.code = 'hearing-enrollment'))

define "Has Active Waiver":
Count([Condition]) > 1
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:audiogram-waiver' and x.code = 'audiogram-waiver'))

define "Most Recent Audiogram Date":
Last(
[Procedure] P
where exists(P.code.coding C where C.system = 'urn:workwell:vs:audiogram-procedures' and C.code = 'audiogram-procedure')
sort by (performed as FHIR.dateTime)
).performed as FHIR.dateTime

Expand Down
7 changes: 5 additions & 2 deletions backend/src/main/resources/measures/cholesterol_ldl.cql
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ parameter "Measurement Period" Interval<DateTime>
context Patient

define "In Cholesterol Program":
exists([Condition])
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:cholesterol-program' and x.code = 'cholesterol-enrolled'))

define "Has Medical Exemption":
Count([Condition]) > 1
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:cholesterol-exemption' and x.code = 'cholesterol-exempt'))

define "Most Recent LDL Screening Date":
Last(
[Procedure] P
where exists(P.code.coding C where C.system = 'urn:workwell:vs:ldl-labs' and C.code = 'ldl-lab')
sort by (performed as FHIR.dateTime)
).performed as FHIR.dateTime

Expand Down
7 changes: 5 additions & 2 deletions backend/src/main/resources/measures/diabetes_hba1c.cql
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ parameter "Measurement Period" Interval<DateTime>
context Patient

define "In Diabetes Program":
exists([Condition])
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:diabetes-program' and x.code = 'diabetes-enrolled'))

define "Has Medical Exemption":
Count([Condition]) > 1
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:diabetes-exemption' and x.code = 'diabetes-exempt'))

define "Most Recent HbA1c Date":
Last(
[Procedure] P
where exists(P.code.coding C where C.system = 'urn:workwell:vs:hba1c-labs' and C.code = 'hba1c-lab')
sort by (performed as FHIR.dateTime)
).performed as FHIR.dateTime

Expand Down
10 changes: 7 additions & 3 deletions backend/src/main/resources/measures/flu_vaccine.cql
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ parameter "Measurement Period" Interval<DateTime>
context Patient

define "Clinical Facing Employee":
exists([Condition])
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:clinical-roles' and x.code = 'clinical-role'))

define "Has Valid Exemption":
Count([Condition]) > 1
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:flu-exemption' and x.code = 'flu-exemption'))

define "Flu Vaccine This Season":
exists([Immunization] I
where (I.occurrence as FHIR.dateTime) during "Measurement Period")
where exists(I.vaccineCode.coding C where C.system = 'urn:workwell:vs:flu-vaccines' and C.code = 'flu-vaccine')
and (I.occurrence as FHIR.dateTime) during "Measurement Period")

define "Most Recent Flu Vaccine Date":
Last(
[Immunization] I
where exists(I.vaccineCode.coding C where C.system = 'urn:workwell:vs:flu-vaccines' and C.code = 'flu-vaccine')
sort by (occurrence as FHIR.dateTime)
).occurrence as FHIR.dateTime

Expand Down
7 changes: 5 additions & 2 deletions backend/src/main/resources/measures/hypertension.cql
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ parameter "Measurement Period" Interval<DateTime>
context Patient

define "In Wellness Program":
exists([Condition])
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:wellness-enrollment' and x.code = 'wellness-enrolled'))

define "Has Medical Exemption":
Count([Condition]) > 1
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:wellness-exemption' and x.code = 'wellness-exempt'))

define "Most Recent BP Screening Date":
Last(
[Procedure] P
where exists(P.code.coding C where C.system = 'urn:workwell:vs:bp-screening' and C.code = 'bp-screen')
sort by (performed as FHIR.dateTime)
).performed as FHIR.dateTime

Expand Down
7 changes: 5 additions & 2 deletions backend/src/main/resources/measures/obesity_bmi.cql
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ parameter "Measurement Period" Interval<DateTime>
context Patient

define "In Wellness Program":
exists([Condition])
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:wellness-enrollment' and x.code = 'wellness-enrolled'))

define "Has Medical Exemption":
Count([Condition]) > 1
exists([Condition] C
where exists(C.code.coding x where x.system = 'urn:workwell:vs:wellness-exemption' and x.code = 'wellness-exempt'))

define "Most Recent BMI Screening Date":
Last(
[Procedure] P
where exists(P.code.coding C where C.system = 'urn:workwell:vs:bmi-screening' and C.code = 'bmi-screen')
sort by (performed as FHIR.dateTime)
).performed as FHIR.dateTime

Expand Down
2 changes: 1 addition & 1 deletion docs/MEASURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,6 @@ Each outcome evidence payload includes:

## Implementation Notes

- TB and HAZWOPER recency checks use explicit procedure-code filtering in CQL so the seeded in-memory CQF evaluator can resolve the most recent exam date without relying on unsupported value-set token retrieval.
- All 8 active CQL measures now use inline code-filter expressions on both the qualifying event (Procedure or Immunization) and the enrollment/exemption Conditions, matching the system/code stamped by `SyntheticFhirBundleBuilder`. This replaces the earlier `exists([Condition])` / `Count([Condition]) > 1` pattern that was semantically correct but not code-scoped. True ValueSet token expansion (resolving `urn:workwell:vs:*` OIDs via the VSAC or a local expansion service) is a known evaluator limitation of the in-memory CQF path; the inline-code pattern is the stable workaround until a resolver is wired.
- All four HEDIS wellness measures are seeded via `ensureInstanceSeeds()` when `WORKWELL_INSTANCE=ecqm` or `twh`.
- All 49 CMS eCQM catalog entries (2026 performance period) are seeded via `ensureCmsEcqmCatalogSeed()` for the same instance values. They are Draft-only and do not participate in CQL evaluation runs until CQL is authored and compiled. On re-seed, existing measures are looked up by CMS ID prefix (`LIKE 'CMSNNNv%'`) and updated in-place so version bumps (e.g., v13→v14) do not create duplicate DB rows.
Loading