Skip to content

Commit

Permalink
Add not null test and 3.15.0-translated fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
lmd59 committed Oct 8, 2024
1 parent d52b6af commit db6f383
Show file tree
Hide file tree
Showing 14 changed files with 35,315 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/unit/ClauseResultsHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ describe('ClauseResultsHelpers', () => {
expect(localIds[100]).not.toBeDefined();
});

test('finds localIds for an not null operator', () => {
// ELM from test/unit/fixtures/cql/NotNull.cql, translated with 3.15.0 translator
const libraryElm: ELM = getJSONFixture('elm/3.15.0/NotNull.json');

const statementName = 'Not Null Clause';
const localIds = ClauseResultsHelpers.findAllLocalIdsInStatementByName(libraryElm, statementName);

// For the fixture loaded for this test it is known that the localId for the IsNull statement
// is 237, and the localId for the Not expression is 238. We want 237 to not be included because 238 is
// the correct id from the annotation.
expect(localIds[238]).toBeDefined();
expect(localIds[237]).not.toBeDefined();
});

test('finds localIds for an ELM Binary Expression with a comparison operator with a literal', () => {
// ELM from test/unit/fixtures/cql/comparisonWithLiteral.cql
const libraryElm: ELM = getJSONFixture('elm/ComparisonWithLiteral.json');
Expand Down
24 changes: 24 additions & 0 deletions test/unit/fixtures/cql/NotNull.cql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
library Test

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include MATGlobalCommonFunctions version '5.0.000' called Global

codesystem "EXAMPLE": 'http://example.com'
codesystem "EXAMPLE-2": 'http://example.com/2'
codesystem "ConditionClinicalStatusCodes": 'http://terminology.hl7.org/CodeSystem/condition-clinical'

valueset "test-vs": 'http://example.com/test-vs'

code "Active": 'active' from "ConditionClinicalStatusCodes"
code "Recurrence": 'recurrence' from "ConditionClinicalStatusCodes"
code "Relapse": 'relapse' from "ConditionClinicalStatusCodes"

concept "Condition Active": { "Active", "Recurrence", "Relapse" } display 'Active'

context Patient

define "Not Null Clause":
[Condition: "test-vs"] C
where C.id is not null
Loading

0 comments on commit db6f383

Please sign in to comment.