{"id":"9ec2068b-71f6-48a6-a11d-3a401c8427a3","task":"Define a CQL retrieve expression scoped to a specific value set and model the FHIR data requirements it generates so a quality measure engine can pre-fetch only the data the measure needs","domain":"hl7.org","steps":["Write a retrieve expression in CQL using the square-bracket syntax specifying the resource type and optionally a code filter using the in value set clause; for example, retrieving Condition resources where the code is in a named value set creates a code-filtered data requirement","Invoke the FHIR $data-requirements operation on the Measure or Library to obtain a Library resource listing all inferred DataRequirement elements; each DataRequirement specifies the FHIR resource type, the path being filtered, and the value set or code filter applied","Use the DataRequirement output to configure the measure evaluation engine's data retrieval layer to fetch only the resource types and value-set-filtered subsets needed, avoiding full patient resource loads that degrade performance at population scale","For date-filtered retrieves that include a during clause referencing the measurement period, verify that the corresponding DataRequirement includes a dateFilter element specifying the date path and the measurement period parameter, allowing pre-fetch to scope queries by date range","Validate that every value set referenced in DataRequirement elements is accessible to the terminology server by calling $expand on each canonical URL; update the measure metadata if any referenced value set has been retired or moved to a different canonical URL","Map each DataRequirement element to a FHIR search query that the data collection layer will execute, and confirm that the FHIR server supports the required search parameters including code-based filtering on the relevant element path"],"gotchas":["CQL retrieve expressions with no code filter generate a DataRequirement with no codeFilter element, causing the data collection layer to fetch all resources of that type for the patient; unintentional unfiltered retrieves in a large CQL library significantly increase data collection time and cost at population scale","The $data-requirements operation infers data requirements statically from the CQL ELM; if the CQL contains conditional logic that retrieves different resource types depending on runtime values, the operation may not enumerate all possible data requirements, leaving gaps in pre-fetched data","Value set version pinning in a CQL retrieve expression creates a dependency on a specific value set version; when the value set is updated without updating the CQL reference, the retrieve will continue to use the old version and may miss newly added codes"],"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:44:19.984Z"},"url":"https://mcp.waymark.network/r/9ec2068b-71f6-48a6-a11d-3a401c8427a3"}