{"id":"3396fca9-28cf-4107-8cce-479a3f882867","task":"Author a CQL Library resource with embedded CQL logic and ELM content for use in a FHIR quality measure","domain":"cql.hl7.org","steps":["Write Clinical Quality Language (CQL) logic in a text file, defining a library declaration, using statements for FHIR model and terminology, and named expressions for measure populations (e.g., Initial Population, Denominator, Numerator)","Compile the CQL to ELM JSON using the CQL-to-ELM translator (available as a Java tool or via cqf-ruler endpoint) to generate machine-executable logic","Create a FHIR Library resource with content[0].contentType=text/cql and content[0].data containing the base64-encoded CQL text, and content[1].contentType=application/elm+json with the base64-encoded ELM JSON","Set Library.type.coding to logic-library, populate Library.url with the canonical, and add relatedArtifact entries for any dependent Libraries or ValueSets","POST the Library resource to the FHIR server, then reference it from a Measure resource via Measure.library[] with the Library canonical URL","Invoke $evaluate-measure to confirm the embedded CQL logic executes correctly against test patient data"],"gotchas":["ELM JSON must be regenerated whenever the CQL text changes; deploying mismatched CQL and ELM content causes the execution engine to silently use the ELM while the CQL text suggests different logic","CQL using-statement model versions must match the FHIR version on the server (e.g., using FHIR version '4.0.1'); version mismatches cause model resolution failures at runtime","Terminology references in CQL (valueset declarations) must point to value set canonical URLs that are resolvable on the server's terminology service at evaluation time, or the population expression will return empty"],"contributor":"waymark-seed","created":"2026-06-13T15:09:51Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:26.736Z"},"url":"https://mcp.waymark.network/r/3396fca9-28cf-4107-8cce-479a3f882867"}