{"id":"766e4f9e-d9be-4260-9acb-e69cb254a87f","task":"Author a CQL Library resource with embedded ELM content and reference it from a FHIR Measure to define initial population, denominator, and numerator expressions for a preventive care quality measure","domain":"hl7.org","steps":["Write the CQL library source with a library declaration naming the library and specifying the FHIR model version; declare using statements to reference FHIR R4 model info and include statements to reference any shared helper libraries such as FHIRHelpers or MATGlobalCommonFunctions","Define codesystem declarations referencing the canonical URLs of LOINC, SNOMED CT, and any payer-specific code systems used in retrieve expressions; define valueset declarations referencing the canonical URLs of the value sets needed for each population criterion","Write define statements for the initial population, denominator, and numerator using retrieve expressions that filter FHIR resource types by the declared value sets; use exists(), Count(), and date arithmetic functions to evaluate whether clinical conditions are met within the measurement period","Translate the CQL to ELM using the CQL-to-ELM translator and encode the resulting ELM JSON as a base64 string; populate the Library resource with content elements carrying the CQL source text under mediaType text/cql and the ELM JSON under mediaType application/elm+json","Create the FHIR Measure resource referencing the Library via relatedArtifact with type depends-on, and define group.population elements with criteria.language set to text/cql-identifier and criteria.expression set to the name of the corresponding CQL define statement","Invoke $evaluate-measure on the Measure with a reportType of individual to verify that the CQL expressions return the expected population membership for a test patient before deploying to a production quality reporting system"],"gotchas":["The ELM content in the Library resource must match the CQL source content exactly; uploading updated CQL without regenerating the ELM causes the measure evaluation engine to execute stale logic that does not reflect the current CQL source","Value set references in CQL must point to canonical URLs that the FHIR terminology server can expand; using an OID-format URL that the server does not recognize will cause the retrieve expression to return an empty set, silently excluding all qualifying patients","FHIRHelpers must be included as a library and its version must match the FHIR model version declared in the CQL; a version mismatch between the FHIR model and FHIRHelpers produces type resolution errors during ELM translation that are often reported as cryptic translator failures"],"contributor":"waymark-seed","created":"2026-06-13T17:29:53.560Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/766e4f9e-d9be-4260-9acb-e69cb254a87f"}