Skip to content

Add expected: blocks to Measles Low Transmission test YAML#137

Open
lambdabaa wants to merge 1 commit into
WorldHealthOrganization:mainfrom
lambdabaa:add-expected-blocks-measles-low-tx
Open

Add expected: blocks to Measles Low Transmission test YAML#137
lambdabaa wants to merge 1 commit into
WorldHealthOrganization:mainfrom
lambdabaa:add-expected-blocks-measles-low-tx

Conversation

@lambdabaa
Copy link
Copy Markdown

Summary

  • Adds an expected: block to each of the seven existing patient documents in input/tests/plandefinition/IMMZD2DTMeaslesLowTransmissionLogic/IMMZD2DTMeaslesLowTransmissionLogic.yaml, encoding the expected boolean and guidance-string outputs of the Logic library per patient.
  • Zero behaviour change to the IG Publisher build, makeExample.js, or the Karate .feature generation — purely additive YAML keys.
  • Concrete companion to RFC issue RFC: machine-readable expected: blocks in test YAMLs #136.

Schema

Blocks follow the convention proposed in #136:

expected:
  row: IMMZ.D2.DT.Measles.LowTransmission.R1
  defines:
    "Client is not due for MCV1 Case 1": true
    "Client is not due for MCV1": true
    "Guidance":
      equals: "Should not vaccinate client with MCV1 as client's age is less than 12 months.\nCheck for any vaccines due and inform the caregiver of when to come back for MCV1."

Identifiers correspond to the published CQL define "<name>": declarations in input/cql/IMMZD2DTMeaslesLowTransmissionLogic.cql.

Provenance of the expected values

Each block was derived from existing artefacts already in this repository:

  • the ### … natural-language outcome lines already present at the top of each patient document, and
  • the Test Validation case-expression in input/cql/IMMZD2DTMeaslesLowTransmissionLogic.cql.

The blocks were independently verified by running the published Logic library against the existing patient bundles using cqframework/cql-execution at submodule HEAD (b16245f); all 7 cases produce values that match the encoded expected: blocks.

Compatibility

  • tools/node/makeExample.js accesses YAML keys by name (id, birth, patient, immunization, contraindication, medicationrequest) and ignores others.
  • tools/node/processDAK.js --existing re-emits arbitrary parsed keys, so the block survives regeneration from the L2 Excel source.
  • No change to the IG Publisher build, qa.html, or input/testing/features/plandefinition/<X>/<X>.feature.

Test plan

  • WHO maintainer review of the schema (defer to RFC RFC: machine-readable expected: blocks in test YAMLs #136 for the cross-cutting convention discussion).
  • Sanity-check by running tools/node/makeExample.js against the patched YAML; per-resource JSON output should be identical to the unpatched run.
  • Optional: run the patched YAML through the IG Publisher locally and confirm qa.html is unchanged.

…t YAML

Augments the seven existing patient test cases for
IMMZD2DTMeaslesLowTransmissionLogic with an `expected:` block per case,
encoding the expected boolean and guidance-string outputs the Logic
library should produce.

The blocks are derived from existing artifacts in this repository:
- the `### …` natural-language outcomes already present at the top of
  each patient document, and
- the `Test Validation` case-expression in
  input/cql/IMMZD2DTMeaslesLowTransmissionLogic.cql

Schema (proposed convention):

  expected:
    row: <L2 row identifier>             # optional human-readable cross-ref
    today: <YYYY-MM-DD>                  # optional per-case anchor; default = harness-wide today
    encounterId: <string>                # optional override for the EncounterId CQL parameter
    defines:
      "<CQL define name>": <scalar>      # exact equality (booleans/numbers/null/strings)
      "<CQL define name>":
        equals: <value>                  # explicit equality (use for multi-line strings)
      # plus: matches: <regex>, isNull: true, isNotNull: true

Zero behaviour change to the build: tools/node/makeExample.js iterates a
fixed set of keys (id, birth, patient, immunization, contraindication,
medicationrequest) and ignores any others, so the new `expected:` key
flows through unmodified. tools/node/processDAK.js --existing preserves
arbitrary keys when re-emitting the file, so the block survives
regeneration from the L2 decision-table source.

The blocks are consumed by an out-of-tree harness
(github.com/lambdabaa/who-cql-agent-eval) that executes the Logic library
against the existing patient bundles via cqframework/cql-execution and
diffs per-define results. Today, WHO's "test cases shall exist and shall
pass" requirement (L3 CQL SOP) has no in-repo executable assertion path
for these YAMLs; this change makes the expected outputs machine-checkable
without prescribing a runner.

See RFC issue #XXX for the broader proposal.
@lambdabaa lambdabaa marked this pull request as ready for review May 27, 2026 23:23
lambdabaa added a commit to lambdabaa/who-cql-agent-eval that referenced this pull request May 28, 2026
Tooling for the WHO upstream contribution path (§9.3): takes our
augmented overlay YAML at tests/dak/<X>.yaml and injects only the
expected: blocks into the corresponding upstream WHO YAML, preserving
every other byte. Idempotent (re-running against an already-patched
file is a no-op).

Used to produce
WorldHealthOrganization/smart-immunizations#137 from
tests/dak/IMMZD2DTMeaslesLowTransmissionLogic.yaml.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant