Repository navigation
Support library-style tests - #111
bryantaustin13 wants to merge 4 commits into
Conversation
…e.g. the overload-matching test in cql-tests PR cqframework#61).
b597fee to
993d9ef
Compare
brynrhodes
left a comment
There was a problem hiding this comment.
There is no content parameter in the $cql operation, and that's probably not the best way to run Library-level tests anyway. They ought to be using the Library$evaluate, which has a library parameter that you can use to pass the Library as a FHIR resource. Note that that will require the CQL content to be wrapped as a base-64 encoded content element in the FHIR library (i.e. the FHIR Library resource SHALL conform to the CQLLibrary profile in the Using CQL IG).
…d use Library/$evaluate for evaluation.
…d use Library/$evaluate for evaluation.
|
Changes since the Library/$evaluate review The $cql content parameter is gone. Library-style tests now go to Library/$evaluate, with the CQL wrapped as a CQLLibrary-profile FHIR Library (logic-library, one text/cql content element, base64 data). One deviation: the library is published and referenced by url rather than passed inline. The inline library parameter isn't usable on any current engine — clinical-reasoning's EvaluateProcessor.evaluate passes only the canonical through and discards content, so both the Alphora sandbox and local HAPI 8.10.0 answer "Could not load source for library ...". The runner PUTs the Library, evaluates, and deletes it in a finally. Also: library tests are skipped rather than mis-sent when a server is configured for $cql; the define name comes from with no silent default; CqlOperation is now constrained to ["$cql", "$evaluate"]. Verified on local HAPI 8.10.0 — 5 of 6 overload-matching tests pass end-to-end, nothing left on the server. The sixth (invalid="semantic", no ) hits a pre-existing skip path for error-expecting tests. 146 unit tests pass, tsc clean. |
|
Superseded by #118. Now that I have committer access on @brynrhodes — your requested changes here have been addressed on the new PR: library-style tests now publish a CQLLibrary resource and evaluate it by |
Summary
Adds runner support for tests that provide a full CQL
<library>and a named<output>, complementing the schema change in cqframework/cql-tests#141.Enables cqframework/cql-tests#61 to actually execute, and is the runner side of
cqframework/cql-tests#17.
Changes
models/test-types.ts: addTestLibrary; makeexpressionoptional; addlibraryandTestOutput.name.shared/results-shared.ts: build aResultfrom a library test (evaluates thedefine named by
<output name>, defaulting tooutput) and pass the libraryinline via the
$cqlcontentparameter.commands/build-cql-command.ts: skip library tests (they are evaluated inline,not wrapped as generated
definestatements).Wire format
The cqframework
$cqloperation accepts the whole library as a top-levelcontent(string) parameter plusexpression= the unqualified define name;it returns the result keyed by that define name. (HL7 base
$cqlonly referenceslibraries by URL; this uses the cqframework inline-
contentextension.)The engine caches inline libraries by
name+version, so everylibrary-style test must declare a unique
libraryname or a stale compiledcopy is returned. Discovered while validating; flagging for test authors. A
future hardening could auto-uniquify the name/version per test.
Validation
tsc --noEmitclean; ran the runner against #61's file →SimpleOverloadMatching status: pass.Relationship to other work