Skip to content

Commit 39d289e

Browse files
authored
Merge pull request #95 from bryantaustin13/readmeFlowUpdate
Readme update with flow of application
2 parents 5970259 + c6bf03b commit 39d289e

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,3 +312,50 @@ Unit tests can be run from the command line using the following
312312
```bash
313313
npm run unit-tests
314314
```
315+
### Test Flow
316+
317+
The test flow starts with a raw CQL expression defined in a test case. The cql-tests-runner sends this expression to the server via a $cql request, where the CQL Engine evaluates it.
318+
319+
The engine returns a result, which is serialized into a FHIR Parameters resource. CQL types are mapped to FHIR types (e.g., Interval → Range + cqf-cqlType).
320+
321+
Back in the runner, the result extractor converts the FHIR response into a JavaScript representation of the CQL value (the actual). In parallel, the expected value from the test is parsed by cvl into the same JS shape.
322+
323+
The runner then compares actual vs expected structurally (not as strings). If they match → PASS; otherwise → FAIL.
324+
325+
Key points
326+
327+
Use FHIR Range + cqf-cqlType for intervals.
328+
Avoid string comparison; compare structured values.
329+
330+
```mermaid
331+
flowchart LR
332+
%% Top row (left → right)
333+
A["Test case (raw CQL)"] --> B["cql-tests-runner"]
334+
B --> C["$cql request"]
335+
C --> D["CQL Engine"]
336+
337+
%% Down from the rightmost node, then flow right → left
338+
D --> E["Response: CQL in Java"]
339+
E --> F["CQL in FHIR"]
340+
F --> G["Result Extractor Maps CQL in FHIR to CQL in JS"]
341+
G --> H["Actual (JS value)"]
342+
343+
%% Continue back toward the left
344+
H --> I["Parse Expected (cvl) into CQL in JS"]
345+
I --> J["Compare (actual vs expected)"]
346+
347+
%% Outcome
348+
J --> K{"Match?"}
349+
K -->|Yes| L["PASS"]
350+
K -->|No| M["FAIL"]
351+
352+
%% Optional note nodes (visual hints)
353+
subgraph Notes
354+
N1["Interval should be mapped via FHIR Range + cqf-cqlType"]
355+
N2["Avoid string compare; compare structured values"]
356+
end
357+
358+
%% Light connections for notes (no arrows affecting flow)
359+
D -.-> N1
360+
H -.-> N2
361+
```

0 commit comments

Comments
 (0)