Vinyeh commited on
Commit
4d71eb0
·
verified ·
1 Parent(s): afa0745

Add pinned source: cql-clinical (part 7)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/ExampleELMLibraryBreakdown.xml +90 -0
  2. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/ExampleELMLibraryWithQuery.xml +64 -0
  3. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/ExampleELMTextLibrary.txt +66 -0
  4. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/Zika/v1.8/zika-virus-intervention-logic.cql +156 -0
  5. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/Zika/v3.0.0/zika-virus-intervention-logic.cql +156 -0
  6. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/Zika/v3.0.0/zika-virus-intervention-logic.xml +697 -0
  7. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/README.md +7 -0
  8. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/index.html +14 -0
  9. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/providers.js +68 -0
  10. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/utils.js +6 -0
  11. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/worker.js +37 -0
  12. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/.gitignore +1 -0
  13. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/README.md +8 -0
  14. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/index.mjs +44 -0
  15. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/libraries/FHIRHelpers-4.0.1.cql +520 -0
  16. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/models/fhir-modelinfo-4.0.1.xml +0 -0
  17. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/models/system-modelinfo.xml +40 -0
  18. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/package-lock.json +39 -0
  19. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/package.json +5 -0
  20. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/require-polyfill.mjs +5 -0
  21. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/library-cbp.cql +134 -0
  22. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/library-cbp.json +470 -0
  23. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradle.properties +12 -0
  24. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradle/libs.versions.toml +156 -0
  25. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradle/wrapper/gradle-wrapper.jar +0 -0
  26. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradle/wrapper/gradle-wrapper.properties +7 -0
  27. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradlew +248 -0
  28. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradlew.bat +93 -0
  29. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/grammar/cql.g4 +965 -0
  30. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/grammar/fhirpath.g4 +175 -0
  31. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/grammar/targetmap.g4 +119 -0
  32. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/kotlin-js-store/wasm/yarn.lock +25 -0
  33. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/kotlin-js-store/yarn.lock +573 -0
  34. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/npm-cql/README.md +63 -0
  35. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/npm-cql/build.gradle.kts +37 -0
  36. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/npm-cql/package.json +46 -0
  37. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/.eslintrc.json +3 -0
  38. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/.gitignore +40 -0
  39. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/.npmrc +1 -0
  40. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/README.md +20 -0
  41. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/app/cql-playground.tsx +677 -0
  42. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/app/globals.css +21 -0
  43. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/app/layout.tsx +25 -0
  44. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/app/page.tsx +5 -0
  45. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/build.gradle.kts +21 -0
  46. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-engine-worker.ts +25 -0
  47. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-engine.ts +198 -0
  48. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-to-ast-worker.ts +35 -0
  49. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-to-ast.ts +37 -0
  50. source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-to-elm-worker.ts +25 -0
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/ExampleELMLibraryBreakdown.xml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <library xmlns="urn:hl7-org:elm:r1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:elm:r1 ../schemas/elm/library.xsd">
3
+ <identifier id="ExampleELMLibrary"/>
4
+ <schemaIdentifier id=""/>
5
+ <parameters>
6
+ <def name="ABC" parameterType="List&lt;MissedAppointmentType&gt;"/>
7
+ </parameters>
8
+ <statements>
9
+ <!--
10
+ [Encounter, Performance: "Inpatient"] E
11
+ with [Condition: "Acute Pharyngitis"] P
12
+ where P.effectiveTime overlaps after E.performanceTime
13
+ where duration in days of E.performanceTime >= 120
14
+ return tuple { id: E.id, lengthOfStay: duration in days of E.performanceTime }
15
+ sort by lengthOfStay desc
16
+ -->
17
+ <def name="PharyngitisConditions" context="PATIENT">
18
+ <expression xsi:type="ClinicalRequest" dataType="ConditionObservationOccurrence" cardinality="Multiple" codeProperty="code">
19
+ <codes xsi:type="ValueSetRef" name="AcutePharyngitis"/>
20
+ </expression>
21
+ </def>
22
+
23
+ <def name="InpatientEncounters" context="PATIENT">
24
+ <expression xsi:type="ClinicalRequest" dataType="EncounterPerformanceOccurrence" cardinality="Multiple" codeProperty="encounterType" dateProperty="performanceTime" idProperty="id">
25
+ <codes xsi:type="ValueSetRef" name="Inpatient"/>
26
+ </expression>
27
+ </def>
28
+
29
+ <def name="EncountersWithPharyngitis" context="PATIENT">
30
+ <expression xsi:type="Filter" scope="E">
31
+ <source xsi:type="ExpressionRef" name="InpatientEncounters"/>
32
+ <condition xsi:type="IsNotEmpty">
33
+ <operand xsi:type="Filter" scope="P">
34
+ <source xsi:type="ExpressionRef" name="PharyngitisConditions"/>
35
+ <condition xsi:type="OverlapsAfter">
36
+ <operand xsi:type="Property" path="effectiveTime" scope="P"/>
37
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
38
+ </condition>
39
+ </operand>
40
+ </condition>
41
+ </expression>
42
+ </def>
43
+
44
+ <def name="EncountersLessThan120Days">
45
+ <expression xsi:type="Filter" scope="E">
46
+ <source xsi:type="ExpressionDef" name="EncountersWithPharyngitis"/>
47
+ <condition xsi:type="GreaterOrEqual">
48
+ <operand xsi:type="DateDiff">
49
+ <startDate xsi:type="Begin">
50
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
51
+ </startDate>
52
+ <endDate xsi:type="End">
53
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
54
+ </endDate>
55
+ <granularity xsi:type="Literal" valueType="DateGranularity" value="day"/>
56
+ </operand>
57
+ <operand xsi:type="Literal" valueType="xs:int" value="120"></operand>
58
+ </condition>
59
+ </expression>
60
+ </def>
61
+
62
+ <def name="EncountersWithLengthOfStay">
63
+ <expression xsi:type="ForEach" scope="E">
64
+ <source xsi:type="ExpressionRef" name="EncountersLessThan120Days"/>
65
+ <element xsi:type="ObjectExpression">
66
+ <property name="id">
67
+ <value xsi:type="Property" path="id" scope="E"/>
68
+ </property>
69
+ <property name="lengthOfStay">
70
+ <value xsi:type="DateDiff">
71
+ <startDate xsi:type="Begin">
72
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
73
+ </startDate>
74
+ <endDate xsi:type="End">
75
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
76
+ </endDate>
77
+ <granularity xsi:type="Literal" valueType="DateGranularity" value="day"/>
78
+ </value>
79
+ </property>
80
+ </element>
81
+ </expression>
82
+ </def>
83
+
84
+ <def name="FullQuery" context="PATIENT">
85
+ <expression xsi:type="Sort" orderBy="lengthOfStay">
86
+ <source xsi:type="ExpressionDef" name="EncountersWithLengthOfStay"/>
87
+ </expression>
88
+ </def>
89
+ </statements>
90
+ </library>
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/ExampleELMLibraryWithQuery.xml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <library xmlns="urn:hl7-org:elm:r1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:elm:r1 ../schemas/elm/library.xsd">
3
+ <identifier id="ExampleELMLibrary"/>
4
+ <schemaIdentifier id=""/>
5
+ <statements>
6
+ <!--
7
+ [Encounter, Performance: "Inpatient"] E
8
+ with [Condition: "Acute Pharyngitis"] P
9
+ where P.effectiveTime overlaps after E.performanceTime
10
+ where duration in days of E.performanceTime >= 120
11
+ return tuple { id: E.id, lengthOfStay: duration in days of E.performanceTime }
12
+ sort by lengthOfStay desc
13
+ -->
14
+ <def name="FullQuery" context="PATIENT">
15
+ <expression xsi:type="Query">
16
+ <source alias="E">
17
+ <expression xsi:type="ClinicalRequest" dataType="EncounterPerformanceOccurrence" cardinality="Multiple" codeProperty="encounterType" dateProperty="performanceTime" idProperty="id">
18
+ <codes xsi:type="ValueSetRef" name="Inpatient"/>
19
+ </expression>
20
+ </source>
21
+ <relationship xsi:type="With" alias="P">
22
+ <expression xsi:type="ClinicalRequest" dataType="ConditionObservationOccurrence" cardinality="Multiple" codeProperty="code">
23
+ <codes xsi:type="ValueSetRef" name="AcutePharyngitis"/>
24
+ </expression>
25
+ <where xsi:type="OverlapsAfter">
26
+ <operand xsi:type="Property" path="effectiveTime" scope="P"/>
27
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
28
+ </where>
29
+ </relationship>
30
+ <where xsi:type="GreaterOrEqual">
31
+ <operand xsi:type="DateDiff">
32
+ <startDate xsi:type="Begin">
33
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
34
+ </startDate>
35
+ <endDate xsi:type="End">
36
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
37
+ </endDate>
38
+ <granularity xsi:type="Literal" valueType="DateGranularity" value="day"/>
39
+ </operand>
40
+ <operand xsi:type="Literal" valueType="xsi:int" value="120"></operand>
41
+ </where>
42
+ <return xsi:type="ObjectExpression">
43
+ <property name="id">
44
+ <value xsi:type="Property" path="id" scope="E"/>
45
+ </property>
46
+ <property name="lengthOfStay">
47
+ <value xsi:type="DateDiff">
48
+ <startDate xsi:type="Begin">
49
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
50
+ </startDate>
51
+ <endDate xsi:type="End">
52
+ <operand xsi:type="Property" path="performanceTime" scope="E"/>
53
+ </endDate>
54
+ <granularity xsi:type="Literal" valueType="DateGranularity" value="day"/>
55
+ </value>
56
+ </property>
57
+ </return>
58
+ <sort>
59
+ <by xsi:type="ByColumn" path="lengthOfStay"/>
60
+ </sort>
61
+ </expression>
62
+ </def>
63
+ </statements>
64
+ </library>
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/ExampleELMTextLibrary.txt ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Full Query
2
+ Sort(E):
3
+ orderBy: lengthOfStay
4
+ source:
5
+ ForEach(E):
6
+ ObjectExpression:
7
+ id: E.id
8
+ lengthOfStay: DateDiff(startDate(E.performanceTime), endDate(E.performanceTime), DAYS)
9
+ source:
10
+ Filter(E):
11
+ condition: GreaterOrEqual(DateDiff(startDate(E.performanceTime), endDate(E.performanceTime), DAYS), 120)
12
+ source:
13
+ Filter(E):
14
+ condition:
15
+ IsNotEmpty:
16
+ Filter(P):
17
+ condition: OverlapsAfter(P.effectiveTime, E.performanceTime)
18
+ source:
19
+ ClinicalRequest:
20
+ dataType: ConditionObservationOccurrence
21
+ codeField: code
22
+ valueSet: AcutePharyngitis
23
+ source:
24
+ ClinicalRequest:
25
+ dataType: EncounterPerformanceOccurrence
26
+ codeField: encounterType
27
+ valueSet: Inpatient
28
+
29
+ // With Breakdown
30
+ Pharyngitis:
31
+ ClinicalRequest:
32
+ dataType: ConditionObservationOccurrence
33
+ codeField: code
34
+ valueSet: AcutePharyngitis
35
+
36
+ InpatientEncounters:
37
+ ClinicalRequest:
38
+ dataType: EncounterPerformanceOccurrence
39
+ codeField: encounterType
40
+ valueSet: Inpatient
41
+
42
+ EncountersWithPharyngitis:
43
+ Filter(E):
44
+ condition:
45
+ IsNotEmpty:
46
+ Filter(P):
47
+ condition: OverlapsAfter(P.effectiveTime, E.performanceTime)
48
+ source: Pharyngitis
49
+ source: InpatientEncounters
50
+
51
+ EncountersLessThan120Days:
52
+ Filter(E):
53
+ condition: GreaterOrEqual(DateDiff(startDate(E.performanceTime), endDate(E.performanceTime), DAYS), 120)
54
+ source: EncountersWithPharyngitis
55
+
56
+ EncountersWithLengthOfStay:
57
+ ForEach(E):
58
+ ObjectExpression:
59
+ id: E.id
60
+ lengthOfStay: DateDiff(startDate(E.performanceTime), endDate(E.performanceTime), DAYS)
61
+ source: EncountersLessThan120Days
62
+
63
+ Sort(E):
64
+ orderBy: lengthOfStay
65
+ source: EncountersWithLengthOfStay
66
+
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/Zika/v1.8/zika-virus-intervention-logic.cql ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ library "zika-virus-intervention-logic" version '1.0.0'
2
+
3
+ using FHIR version '1.8'
4
+
5
+ include FHIRHelpers version '1.8' called FHIRHelpers
6
+
7
+ codesystem "Example Questionnaires": 'http://example.org/questionnaires'
8
+
9
+ valueset "Pregnancy": 'urn:oid:X.Y.Z'
10
+ valueset "Zika Affected Areas": 'urn:oid:2.16.840.1.114222.4.11.7457' // Value set has been created based upon Jan 26th, 2016 travel notice from CDC Zika virus disease website https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7457
11
+ valueset "Zika Virus Signs and Symptoms": '2.16.840.1.114222.4.11.7459' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7459
12
+ valueset "General Arbovirus Signs and Symptoms": '2.16.840.1.114222.4.11.7460' // Signs and Symptoms of Arboviral diseases. This value set would be used for public health case notification and includes signs and symptoms of Dengue, Chikungunya and Zika. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7460
13
+ valueset "Zika Virus Tests": '2.16.840.1.114222.4.11.7480' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7480
14
+ valueset "Arbovirus Tests": '2.16.840.1.114222.4.11.4120' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.4120
15
+ valueset "Chikungunya Tests": '2.16.840.1.114222.4.11.7339' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7339
16
+ valueset "Dengue Tests": '2.16.840.1.114222.4.11.4141' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.4141
17
+ valueset "Zika Virus IgM ELISA Results": '2.16.840.1.114222.4.11.7476' // This value set is intended for use in electronic laboratory reporting based on the results received from the laboratory. The laboratory may also report a quantitative titer if applicable. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7476
18
+ valueset "Zika Virus Neutralizing Antibody Results": '2.16.840.1.114222.4.11.7477' // This value set is intended for use in electronic laboratory reporting based on the results received from the laboratory. The laboratory may also report a quantitative titer if applicable. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7477
19
+ valueset "Arbovirus Test Results": '2.16.840.1.114222.4.11.4003' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.4003
20
+ valueset "Chikungunya Test Results": '2.16.840.1.114222.4.11.7343' // This value set is intended for use in electronic laboratory reporting based on the results received from the laboratory. The laboratory may also report a quantitative titer if applicable. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7343
21
+ valueset "Dengue Test Results": '2.16.840.1.114222.4.11.4025' // This value set is intended for use in electronic laboratory reporting based on the results received from the laboratory. The laboratory may also report a quantitative titer if applicable. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.4025
22
+
23
+ code "CDE: Resident of or Frequent Traveler to Zika Area": 'CDE: Resident of or Frequent Traveler to Zika Area' from "Example Questionnaires"
24
+ code "CDE: Recent Travel to Zika Area": 'CDE: Recent Travel to Zika Area' from "Example Questionnaires"
25
+ code "CDE: Time Since Returned From Travel": 'CDE: Time Since Returned From Travel' from "Example Questionnaires"
26
+ code "CDE: Recent Sexual Encounter With Traveler to Zika Area": 'CDE: Recent Sexual Encounter With Traveler to Zika Area' from "Example Questionnaires"
27
+ code "CDE: Time Since Sexual Encounter": 'CDE: Time Since Sexual Encounter' from "Example Questionnaires"
28
+ code "CDE: Planned Travel to Zika Area": 'CDE: Planned Travel to Zika Area' from "Example Questionnaires"
29
+
30
+ parameter "Current Encounter" Encounter
31
+
32
+ context Patient
33
+
34
+ define "Pregnancy Conditions":
35
+ [Condition: "Pregnancy"] C
36
+ where C.clinicalStatus = 'active'
37
+ and C.verificationStatus = 'confirmed'
38
+ // this is pretty awkward formulation...
39
+ and Today() between C.onset and C.abatement
40
+ // This is sub-optimal, would be better if the compiler "converged" on a type
41
+ // The problem is the choices for onsete and abatement are not the same set, so
42
+ // there would be a lossy implicit conversion involved.
43
+ //and Interval[C.onset as dateTime, C.abatement as dateTime] includes Today()
44
+
45
+ define "Is Patient Pregnant":
46
+ Patient.gender = 'female'
47
+ and exists ("Pregnancy Conditions")
48
+
49
+ define "Zika Exposure Assessment":
50
+ Code 'Zika Virus Exposure Assessment' from "Example Questionnaires"
51
+
52
+ define "Zika Exposure Assessment Result":
53
+ First(
54
+ [Observation: "Zika Exposure Assessment"] O
55
+ where O.status = 'final'
56
+ and O.encounter.reference = "Current Encounter".id // TODO: fix
57
+ sort by (O.effective) desc
58
+ )
59
+
60
+ define "Has Zika Exposure Assessment":
61
+ "Zika Exposure Assessment Result" is not null
62
+
63
+ define "Zika Symptoms":
64
+ [Condition: "Zika Virus Signs and Symptoms"] C
65
+ where C.clinicalStatus = 'active'
66
+ and C.verificationStatus = 'confirmed'
67
+ and C."context".reference = "Current Encounter".id // TODO: fix
68
+
69
+ define "Has Zika Symptoms":
70
+ exists "Zika Symptoms"
71
+
72
+ define "No Zika Symptoms":
73
+ not "Has Zika Symptoms"
74
+
75
+ define "Yes": { 'Yes' }
76
+
77
+ define "Resident of or Frequent Traveler to Zika Area":
78
+ exists (
79
+ "Zika Exposure Assessment Result".component C
80
+ // TODO: Need to streamline, this ought to have worked, not sure why it didn't (without the coding[0] access)
81
+ where C.code.coding[0] = "CDE: Resident of or Frequent Traveler to Zika Area"
82
+ and C.value in "Yes"
83
+ )
84
+
85
+ define "Recent Travel to Zika Area":
86
+ exists (
87
+ "Zika Exposure Assessment Result".component C
88
+ where C.code.coding[0] = "CDE: Recent Travel to Zika Area"
89
+ and C.value in "Yes"
90
+ )
91
+
92
+ define "Time Since Returned From Travel":
93
+ singleton from (
94
+ "Zika Exposure Assessment Result".component C
95
+ where C.code.coding[0] = "CDE: Time Since Returned From Travel"
96
+ return C.value
97
+ )
98
+
99
+ define "Recent Sexual Encounter With Traveler to Zika Area":
100
+ exists (
101
+ "Zika Exposure Assessment Result".component C
102
+ where C.code.coding[0] = "CDE: Recent Sexual Encounter With Traveler to Zika Area"
103
+ and C.value in "Yes"
104
+ )
105
+
106
+ define "Time Since Sexual Encounter":
107
+ singleton from (
108
+ "Zika Exposure Assessment Result".component C
109
+ where C.code.coding[0] = "CDE: Time Since Sexual Encounter"
110
+ return C.value as Quantity
111
+ )
112
+
113
+ define "Time Since Possible Exposure":
114
+ Coalesce("Time Since Returned From Travel", "Time Since Sexual Encounter")
115
+
116
+ define "Planned Travel to Zika Area":
117
+ exists (
118
+ "Zika Exposure Assessment Result".component C
119
+ where C.code.coding[0] = "CDE: Planned Travel to Zika Area"
120
+ and C.value in "Yes"
121
+ )
122
+
123
+ define "Has Possible Zika Exposure":
124
+ "Resident of or Frequent Traveler to Zika Area"
125
+ or "Recent Travel to Zika Area"
126
+ or "Recent Sexual Encounter With Traveler to Zika Area"
127
+
128
+ define "Zika Symptom Onset":
129
+ First(
130
+ "Zika Symptoms" S
131
+ // This is suboptimal, it would be better if the compiler could resolve this,
132
+ // but it can't currently trace both the choice convergence and the implicit conversion
133
+ sort by (S.onset as dateTime)
134
+ ).onset
135
+
136
+ define "Time Since Symptom Onset":
137
+ System.Quantity { value: weeks between "Zika Symptom Onset" and Today(), unit: 'wk' }
138
+
139
+ define "Should Administer Zika Exposure Assessment":
140
+ not ("Has Zika Exposure Assessment")
141
+
142
+ define "Should Order Serum + Urine rRT-PCR Test":
143
+ ("Has Possible Zika Exposure" and "Has Zika Symptoms" and "Time Since Symptom Onset" < 2 weeks)
144
+ or ("No Zika Symptoms" and "Time Since Possible Exposure" < 2 weeks)
145
+
146
+ define "Should Order Serum Zika Virus IgM + Dengue Virus IgM":
147
+ ("Has Possible Zika Exposure" and "Has Zika Symptoms" and "Time Since Symptom Onset" in Interval[2 weeks, 12 weeks))
148
+ or ("Resident of or Frequent Traveler to Zika Area" and "No Zika Symptoms")
149
+ or ("No Zika Symptoms" and "Time Since Possible Exposure" in Interval[2 weeks, 12 weeks))
150
+
151
+ define "Should Consider IgM Antibody Testing":
152
+ ("Has Possible Zika Exposure" and "Has Zika Symptoms" and "Time Since Symptom Onset" >= 12 weeks)
153
+ or ("No Zika Symptoms" and "Time Since Possible Exposure" >= 12 weeks)
154
+
155
+ define "Should Provide Mosquito Prevention and Contraception Advice":
156
+ "Planned Travel to Zika Area"
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/Zika/v3.0.0/zika-virus-intervention-logic.cql ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ library "zika-virus-intervention-logic" version '1.0.0'
2
+
3
+ using FHIR version '3.0.0'
4
+
5
+ include FHIRHelpers version '3.0.0' called FHIRHelpers
6
+
7
+ codesystem "Example Questionnaires": 'http://example.org/questionnaires'
8
+
9
+ valueset "Pregnancy": 'urn:oid:X.Y.Z'
10
+ valueset "Zika Affected Areas": 'urn:oid:2.16.840.1.114222.4.11.7457' // Value set has been created based upon Jan 26th, 2016 travel notice from CDC Zika virus disease website https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7457
11
+ valueset "Zika Virus Signs and Symptoms": '2.16.840.1.114222.4.11.7459' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7459
12
+ valueset "General Arbovirus Signs and Symptoms": '2.16.840.1.114222.4.11.7460' // Signs and Symptoms of Arboviral diseases. This value set would be used for public health case notification and includes signs and symptoms of Dengue, Chikungunya and Zika. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7460
13
+ valueset "Zika Virus Tests": '2.16.840.1.114222.4.11.7480' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7480
14
+ valueset "Arbovirus Tests": '2.16.840.1.114222.4.11.4120' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.4120
15
+ valueset "Chikungunya Tests": '2.16.840.1.114222.4.11.7339' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7339
16
+ valueset "Dengue Tests": '2.16.840.1.114222.4.11.4141' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.4141
17
+ valueset "Zika Virus IgM ELISA Results": '2.16.840.1.114222.4.11.7476' // This value set is intended for use in electronic laboratory reporting based on the results received from the laboratory. The laboratory may also report a quantitative titer if applicable. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7476
18
+ valueset "Zika Virus Neutralizing Antibody Results": '2.16.840.1.114222.4.11.7477' // This value set is intended for use in electronic laboratory reporting based on the results received from the laboratory. The laboratory may also report a quantitative titer if applicable. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7477
19
+ valueset "Arbovirus Test Results": '2.16.840.1.114222.4.11.4003' // https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.4003
20
+ valueset "Chikungunya Test Results": '2.16.840.1.114222.4.11.7343' // This value set is intended for use in electronic laboratory reporting based on the results received from the laboratory. The laboratory may also report a quantitative titer if applicable. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7343
21
+ valueset "Dengue Test Results": '2.16.840.1.114222.4.11.4025' // This value set is intended for use in electronic laboratory reporting based on the results received from the laboratory. The laboratory may also report a quantitative titer if applicable. https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.4025
22
+
23
+ code "CDE: Resident of or Frequent Traveler to Zika Area": 'CDE: Resident of or Frequent Traveler to Zika Area' from "Example Questionnaires"
24
+ code "CDE: Recent Travel to Zika Area": 'CDE: Recent Travel to Zika Area' from "Example Questionnaires"
25
+ code "CDE: Time Since Returned From Travel": 'CDE: Time Since Returned From Travel' from "Example Questionnaires"
26
+ code "CDE: Recent Sexual Encounter With Traveler to Zika Area": 'CDE: Recent Sexual Encounter With Traveler to Zika Area' from "Example Questionnaires"
27
+ code "CDE: Time Since Sexual Encounter": 'CDE: Time Since Sexual Encounter' from "Example Questionnaires"
28
+ code "CDE: Planned Travel to Zika Area": 'CDE: Planned Travel to Zika Area' from "Example Questionnaires"
29
+
30
+ parameter "Current Encounter" Encounter
31
+
32
+ context Patient
33
+
34
+ define "Pregnancy Conditions":
35
+ [Condition: "Pregnancy"] C
36
+ where C.clinicalStatus = 'active'
37
+ and C.verificationStatus = 'confirmed'
38
+ // this is pretty awkward formulation...
39
+ and Today() between C.onset and C.abatement
40
+ // This is sub-optimal, would be better if the compiler "converged" on a type
41
+ // The problem is the choices for onsete and abatement are not the same set, so
42
+ // there would be a lossy implicit conversion involved.
43
+ //and Interval[C.onset as dateTime, C.abatement as dateTime] includes Today()
44
+
45
+ define "Is Patient Pregnant":
46
+ Patient.gender = 'female'
47
+ and exists ("Pregnancy Conditions")
48
+
49
+ define "Zika Exposure Assessment":
50
+ Code 'Zika Virus Exposure Assessment' from "Example Questionnaires"
51
+
52
+ define "Zika Exposure Assessment Result":
53
+ First(
54
+ [Observation: "Zika Exposure Assessment"] O
55
+ where O.status = 'final'
56
+ and O."context".reference = "Current Encounter".id // TODO: fix
57
+ sort by (O.effective) desc
58
+ )
59
+
60
+ define "Has Zika Exposure Assessment":
61
+ "Zika Exposure Assessment Result" is not null
62
+
63
+ define "Zika Symptoms":
64
+ [Condition: "Zika Virus Signs and Symptoms"] C
65
+ where C.clinicalStatus = 'active'
66
+ and C.verificationStatus = 'confirmed'
67
+ and C."context".reference = "Current Encounter".id // TODO: fix
68
+
69
+ define "Has Zika Symptoms":
70
+ exists "Zika Symptoms"
71
+
72
+ define "No Zika Symptoms":
73
+ not "Has Zika Symptoms"
74
+
75
+ define "Yes": { 'Yes' }
76
+
77
+ define "Resident of or Frequent Traveler to Zika Area":
78
+ exists (
79
+ "Zika Exposure Assessment Result".component C
80
+ // TODO: Need to streamline, this ought to have worked, not sure why it didn't (without the coding[0] access)
81
+ where C.code.coding[0] = "CDE: Resident of or Frequent Traveler to Zika Area"
82
+ and C.value in "Yes"
83
+ )
84
+
85
+ define "Recent Travel to Zika Area":
86
+ exists (
87
+ "Zika Exposure Assessment Result".component C
88
+ where C.code.coding[0] = "CDE: Recent Travel to Zika Area"
89
+ and C.value in "Yes"
90
+ )
91
+
92
+ define "Time Since Returned From Travel":
93
+ singleton from (
94
+ "Zika Exposure Assessment Result".component C
95
+ where C.code.coding[0] = "CDE: Time Since Returned From Travel"
96
+ return C.value
97
+ )
98
+
99
+ define "Recent Sexual Encounter With Traveler to Zika Area":
100
+ exists (
101
+ "Zika Exposure Assessment Result".component C
102
+ where C.code.coding[0] = "CDE: Recent Sexual Encounter With Traveler to Zika Area"
103
+ and C.value in "Yes"
104
+ )
105
+
106
+ define "Time Since Sexual Encounter":
107
+ singleton from (
108
+ "Zika Exposure Assessment Result".component C
109
+ where C.code.coding[0] = "CDE: Time Since Sexual Encounter"
110
+ return C.value as Quantity
111
+ )
112
+
113
+ define "Time Since Possible Exposure":
114
+ Coalesce("Time Since Returned From Travel", "Time Since Sexual Encounter")
115
+
116
+ define "Planned Travel to Zika Area":
117
+ exists (
118
+ "Zika Exposure Assessment Result".component C
119
+ where C.code.coding[0] = "CDE: Planned Travel to Zika Area"
120
+ and C.value in "Yes"
121
+ )
122
+
123
+ define "Has Possible Zika Exposure":
124
+ "Resident of or Frequent Traveler to Zika Area"
125
+ or "Recent Travel to Zika Area"
126
+ or "Recent Sexual Encounter With Traveler to Zika Area"
127
+
128
+ define "Zika Symptom Onset":
129
+ First(
130
+ "Zika Symptoms" S
131
+ // This is suboptimal, it would be better if the compiler could resolve this,
132
+ // but it can't currently trace both the choice convergence and the implicit conversion
133
+ sort by (S.onset as dateTime)
134
+ ).onset
135
+
136
+ define "Time Since Symptom Onset":
137
+ System.Quantity { value: weeks between "Zika Symptom Onset" and Today(), unit: 'wk' }
138
+
139
+ define "Should Administer Zika Exposure Assessment":
140
+ not ("Has Zika Exposure Assessment")
141
+
142
+ define "Should Order Serum + Urine rRT-PCR Test":
143
+ ("Has Possible Zika Exposure" and "Has Zika Symptoms" and "Time Since Symptom Onset" < 2 weeks)
144
+ or ("No Zika Symptoms" and "Time Since Possible Exposure" < 2 weeks)
145
+
146
+ define "Should Order Serum Zika Virus IgM + Dengue Virus IgM":
147
+ ("Has Possible Zika Exposure" and "Has Zika Symptoms" and "Time Since Symptom Onset" in Interval[2 weeks, 12 weeks))
148
+ or ("Resident of or Frequent Traveler to Zika Area" and "No Zika Symptoms")
149
+ or ("No Zika Symptoms" and "Time Since Possible Exposure" in Interval[2 weeks, 12 weeks))
150
+
151
+ define "Should Consider IgM Antibody Testing":
152
+ ("Has Possible Zika Exposure" and "Has Zika Symptoms" and "Time Since Symptom Onset" >= 12 weeks)
153
+ or ("No Zika Symptoms" and "Time Since Possible Exposure" >= 12 weeks)
154
+
155
+ define "Should Provide Mosquito Prevention and Contraception Advice":
156
+ "Planned Travel to Zika Area"
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/Zika/v3.0.0/zika-virus-intervention-logic.xml ADDED
@@ -0,0 +1,697 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <library xmlns="urn:hl7-org:elm:r1" xmlns:t="urn:hl7-org:elm-types:r1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fhir="http://hl7.org/fhir" xmlns:a="urn:hl7-org:cql-annotations:r1">
3
+ <identifier id="zika-virus-intervention-logic" version="1.0.0"/>
4
+ <schemaIdentifier id="urn:hl7-org:elm" version="r1"/>
5
+ <usings>
6
+ <def localIdentifier="System" uri="urn:hl7-org:elm-types:r1"/>
7
+ <def localId="1" localIdentifier="FHIR" uri="http://hl7.org/fhir" version="3.0.0"/>
8
+ </usings>
9
+ <includes>
10
+ <def localId="2" localIdentifier="FHIRHelpers" path="FHIRHelpers" version="3.0.0"/>
11
+ </includes>
12
+ <parameters>
13
+ <def localId="30" name="Current Encounter" accessLevel="Public">
14
+ <parameterTypeSpecifier localId="29" name="fhir:Encounter" xsi:type="NamedTypeSpecifier"/>
15
+ </def>
16
+ </parameters>
17
+ <codeSystems>
18
+ <def localId="3" name="Example Questionnaires" id="http://example.org/questionnaires" accessLevel="Public"/>
19
+ </codeSystems>
20
+ <valueSets>
21
+ <def localId="4" name="Pregnancy" id="urn:oid:X.Y.Z" accessLevel="Public"/>
22
+ <def localId="5" name="Zika Affected Areas" id="urn:oid:2.16.840.1.114222.4.11.7457" accessLevel="Public"/>
23
+ <def localId="6" name="Zika Virus Signs and Symptoms" id="2.16.840.1.114222.4.11.7459" accessLevel="Public"/>
24
+ <def localId="7" name="General Arbovirus Signs and Symptoms" id="2.16.840.1.114222.4.11.7460" accessLevel="Public"/>
25
+ <def localId="8" name="Zika Virus Tests" id="2.16.840.1.114222.4.11.7480" accessLevel="Public"/>
26
+ <def localId="9" name="Arbovirus Tests" id="2.16.840.1.114222.4.11.4120" accessLevel="Public"/>
27
+ <def localId="10" name="Chikungunya Tests" id="2.16.840.1.114222.4.11.7339" accessLevel="Public"/>
28
+ <def localId="11" name="Dengue Tests" id="2.16.840.1.114222.4.11.4141" accessLevel="Public"/>
29
+ <def localId="12" name="Zika Virus IgM ELISA Results" id="2.16.840.1.114222.4.11.7476" accessLevel="Public"/>
30
+ <def localId="13" name="Zika Virus Neutralizing Antibody Results" id="2.16.840.1.114222.4.11.7477" accessLevel="Public"/>
31
+ <def localId="14" name="Arbovirus Test Results" id="2.16.840.1.114222.4.11.4003" accessLevel="Public"/>
32
+ <def localId="15" name="Chikungunya Test Results" id="2.16.840.1.114222.4.11.7343" accessLevel="Public"/>
33
+ <def localId="16" name="Dengue Test Results" id="2.16.840.1.114222.4.11.4025" accessLevel="Public"/>
34
+ </valueSets>
35
+ <codes>
36
+ <def localId="18" name="CDE: Resident of or Frequent Traveler to Zika Area" id="CDE: Resident of or Frequent Traveler to Zika Area" accessLevel="Public">
37
+ <codeSystem localId="17" name="Example Questionnaires"/>
38
+ </def>
39
+ <def localId="20" name="CDE: Recent Travel to Zika Area" id="CDE: Recent Travel to Zika Area" accessLevel="Public">
40
+ <codeSystem localId="19" name="Example Questionnaires"/>
41
+ </def>
42
+ <def localId="22" name="CDE: Time Since Returned From Travel" id="CDE: Time Since Returned From Travel" accessLevel="Public">
43
+ <codeSystem localId="21" name="Example Questionnaires"/>
44
+ </def>
45
+ <def localId="24" name="CDE: Recent Sexual Encounter With Traveler to Zika Area" id="CDE: Recent Sexual Encounter With Traveler to Zika Area" accessLevel="Public">
46
+ <codeSystem localId="23" name="Example Questionnaires"/>
47
+ </def>
48
+ <def localId="26" name="CDE: Time Since Sexual Encounter" id="CDE: Time Since Sexual Encounter" accessLevel="Public">
49
+ <codeSystem localId="25" name="Example Questionnaires"/>
50
+ </def>
51
+ <def localId="28" name="CDE: Planned Travel to Zika Area" id="CDE: Planned Travel to Zika Area" accessLevel="Public">
52
+ <codeSystem localId="27" name="Example Questionnaires"/>
53
+ </def>
54
+ </codes>
55
+ <statements>
56
+ <def name="Patient" context="Patient">
57
+ <expression xsi:type="SingletonFrom">
58
+ <operand dataType="fhir:Patient" xsi:type="Retrieve"/>
59
+ </expression>
60
+ </def>
61
+ <def localId="50" name="Pregnancy Conditions" context="Patient" accessLevel="Public">
62
+ <annotation xsi:type="a:Annotation">
63
+ <a:s>define &quot;Pregnancy Conditions&quot;:&#xd;
64
+ [Condition: &quot;Pregnancy&quot;] C&#xd;
65
+ where C.clinicalStatus = 'active'&#xd;
66
+ and C.verificationStatus = 'confirmed'&#xd;
67
+ // this is pretty awkward formulation...&#xd;
68
+ and Today() between C.onset and C.abatement</a:s>
69
+ </annotation>
70
+ <expression localId="49" xsi:type="Query">
71
+ <source localId="32" alias="C">
72
+ <expression localId="31" dataType="fhir:Condition" codeProperty="code" xsi:type="Retrieve">
73
+ <codes name="Pregnancy" xsi:type="ValueSetRef"/>
74
+ </expression>
75
+ </source>
76
+ <where localId="48" xsi:type="And">
77
+ <operand localId="41" xsi:type="And">
78
+ <operand localId="36" xsi:type="Equal">
79
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
80
+ <operand localId="34" path="clinicalStatus" scope="C" xsi:type="Property"/>
81
+ </operand>
82
+ <operand localId="35" valueType="t:String" value="active" xsi:type="Literal"/>
83
+ </operand>
84
+ <operand localId="40" xsi:type="Equal">
85
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
86
+ <operand localId="38" path="verificationStatus" scope="C" xsi:type="Property"/>
87
+ </operand>
88
+ <operand localId="39" valueType="t:String" value="confirmed" xsi:type="Literal"/>
89
+ </operand>
90
+ </operand>
91
+ <operand localId="47" xsi:type="And">
92
+ <operand xsi:type="GreaterOrEqual">
93
+ <operand localId="42" xsi:type="Today"/>
94
+ <operand name="ToDateTime" libraryName="FHIRHelpers" xsi:type="FunctionRef">
95
+ <operand asType="fhir:dateTime" xsi:type="As">
96
+ <operand localId="44" path="onset" scope="C" xsi:type="Property"/>
97
+ <asTypeSpecifier name="fhir:dateTime" xsi:type="NamedTypeSpecifier"/>
98
+ </operand>
99
+ </operand>
100
+ </operand>
101
+ <operand xsi:type="LessOrEqual">
102
+ <operand localId="42" xsi:type="Today"/>
103
+ <operand name="ToDateTime" libraryName="FHIRHelpers" xsi:type="FunctionRef">
104
+ <operand asType="fhir:dateTime" xsi:type="As">
105
+ <operand localId="46" path="abatement" scope="C" xsi:type="Property"/>
106
+ <asTypeSpecifier name="fhir:dateTime" xsi:type="NamedTypeSpecifier"/>
107
+ </operand>
108
+ </operand>
109
+ </operand>
110
+ </operand>
111
+ </where>
112
+ </expression>
113
+ </def>
114
+ <def localId="58" name="Is Patient Pregnant" context="Patient" accessLevel="Public">
115
+ <annotation xsi:type="a:Annotation">
116
+ <a:s>define &quot;Is Patient Pregnant&quot;:&#xd;
117
+ Patient.gender = 'female'&#xd;
118
+ and exists (&quot;Pregnancy Conditions&quot;)</a:s>
119
+ </annotation>
120
+ <expression localId="57" xsi:type="And">
121
+ <operand localId="54" xsi:type="Equal">
122
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
123
+ <operand localId="52" path="gender" xsi:type="Property">
124
+ <source localId="51" name="Patient" xsi:type="ExpressionRef"/>
125
+ </operand>
126
+ </operand>
127
+ <operand localId="53" valueType="t:String" value="female" xsi:type="Literal"/>
128
+ </operand>
129
+ <operand localId="56" xsi:type="Exists">
130
+ <operand localId="55" name="Pregnancy Conditions" xsi:type="ExpressionRef"/>
131
+ </operand>
132
+ </expression>
133
+ </def>
134
+ <def localId="61" name="Zika Exposure Assessment" context="Patient" accessLevel="Public">
135
+ <annotation xsi:type="a:Annotation">
136
+ <a:s>define &quot;Zika Exposure Assessment&quot;:&#xd;
137
+ Code 'Zika Virus Exposure Assessment' from &quot;Example Questionnaires&quot;</a:s>
138
+ </annotation>
139
+ <expression localId="60" code="Zika Virus Exposure Assessment" xsi:type="Code">
140
+ <system localId="59" name="Example Questionnaires"/>
141
+ </expression>
142
+ </def>
143
+ <def localId="81" name="Zika Exposure Assessment Result" context="Patient" accessLevel="Public">
144
+ <annotation xsi:type="a:Annotation">
145
+ <a:s>define &quot;Zika Exposure Assessment Result&quot;:&#xd;
146
+ First(&#xd;
147
+ [Observation: &quot;Zika Exposure Assessment&quot;] O&#xd;
148
+ where O.status = 'final'&#xd;
149
+ and O.&quot;context&quot;.reference = &quot;Current Encounter&quot;.id // TODO: fix&#xd;
150
+ sort by (O.effective) desc&#xd;
151
+ )</a:s>
152
+ </annotation>
153
+ <expression localId="80" xsi:type="First">
154
+ <source localId="79" xsi:type="Query">
155
+ <source localId="63" alias="O">
156
+ <expression localId="62" dataType="fhir:Observation" codeProperty="code" xsi:type="Retrieve">
157
+ <codes name="Zika Exposure Assessment" xsi:type="ExpressionRef"/>
158
+ </expression>
159
+ </source>
160
+ <where localId="74" xsi:type="And">
161
+ <operand localId="67" xsi:type="Equal">
162
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
163
+ <operand localId="65" path="status" scope="O" xsi:type="Property"/>
164
+ </operand>
165
+ <operand localId="66" valueType="t:String" value="final" xsi:type="Literal"/>
166
+ </operand>
167
+ <operand localId="73" xsi:type="Equal">
168
+ <operand localId="70" path="reference" xsi:type="Property">
169
+ <source localId="69" path="context" scope="O" xsi:type="Property"/>
170
+ </operand>
171
+ <operand asType="fhir:string" xsi:type="As">
172
+ <operand localId="72" path="id" xsi:type="Property">
173
+ <source localId="71" name="Current Encounter" xsi:type="ParameterRef"/>
174
+ </operand>
175
+ <asTypeSpecifier name="fhir:string" xsi:type="NamedTypeSpecifier"/>
176
+ </operand>
177
+ </operand>
178
+ </where>
179
+ <sort localId="78">
180
+ <by localId="77" direction="desc" xsi:type="ByExpression">
181
+ <expression localId="76" path="effective" scope="O" xsi:type="Property"/>
182
+ </by>
183
+ </sort>
184
+ </source>
185
+ </expression>
186
+ </def>
187
+ <def localId="84" name="Has Zika Exposure Assessment" context="Patient" accessLevel="Public">
188
+ <annotation xsi:type="a:Annotation">
189
+ <a:s>define &quot;Has Zika Exposure Assessment&quot;:&#xd;
190
+ &quot;Zika Exposure Assessment Result&quot; is not null</a:s>
191
+ </annotation>
192
+ <expression localId="83" xsi:type="Not">
193
+ <operand xsi:type="IsNull">
194
+ <operand localId="82" name="Zika Exposure Assessment Result" xsi:type="ExpressionRef"/>
195
+ </operand>
196
+ </expression>
197
+ </def>
198
+ <def localId="104" name="Zika Symptoms" context="Patient" accessLevel="Public">
199
+ <annotation xsi:type="a:Annotation">
200
+ <a:s>define &quot;Zika Symptoms&quot;:&#xd;
201
+ [Condition: &quot;Zika Virus Signs and Symptoms&quot;] C&#xd;
202
+ where C.clinicalStatus = 'active'&#xd;
203
+ and C.verificationStatus = 'confirmed'&#xd;
204
+ and C.&quot;context&quot;.reference = &quot;Current Encounter&quot;.id</a:s>
205
+ </annotation>
206
+ <expression localId="103" xsi:type="Query">
207
+ <source localId="86" alias="C">
208
+ <expression localId="85" dataType="fhir:Condition" codeProperty="code" xsi:type="Retrieve">
209
+ <codes name="Zika Virus Signs and Symptoms" xsi:type="ValueSetRef"/>
210
+ </expression>
211
+ </source>
212
+ <where localId="102" xsi:type="And">
213
+ <operand localId="95" xsi:type="And">
214
+ <operand localId="90" xsi:type="Equal">
215
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
216
+ <operand localId="88" path="clinicalStatus" scope="C" xsi:type="Property"/>
217
+ </operand>
218
+ <operand localId="89" valueType="t:String" value="active" xsi:type="Literal"/>
219
+ </operand>
220
+ <operand localId="94" xsi:type="Equal">
221
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
222
+ <operand localId="92" path="verificationStatus" scope="C" xsi:type="Property"/>
223
+ </operand>
224
+ <operand localId="93" valueType="t:String" value="confirmed" xsi:type="Literal"/>
225
+ </operand>
226
+ </operand>
227
+ <operand localId="101" xsi:type="Equal">
228
+ <operand localId="98" path="reference" xsi:type="Property">
229
+ <source localId="97" path="context" scope="C" xsi:type="Property"/>
230
+ </operand>
231
+ <operand asType="fhir:string" xsi:type="As">
232
+ <operand localId="100" path="id" xsi:type="Property">
233
+ <source localId="99" name="Current Encounter" xsi:type="ParameterRef"/>
234
+ </operand>
235
+ <asTypeSpecifier name="fhir:string" xsi:type="NamedTypeSpecifier"/>
236
+ </operand>
237
+ </operand>
238
+ </where>
239
+ </expression>
240
+ </def>
241
+ <def localId="107" name="Has Zika Symptoms" context="Patient" accessLevel="Public">
242
+ <annotation xsi:type="a:Annotation">
243
+ <a:s>define &quot;Has Zika Symptoms&quot;:&#xd;
244
+ exists &quot;Zika Symptoms&quot;</a:s>
245
+ </annotation>
246
+ <expression localId="106" xsi:type="Exists">
247
+ <operand localId="105" name="Zika Symptoms" xsi:type="ExpressionRef"/>
248
+ </expression>
249
+ </def>
250
+ <def localId="110" name="No Zika Symptoms" context="Patient" accessLevel="Public">
251
+ <annotation xsi:type="a:Annotation">
252
+ <a:s>define &quot;No Zika Symptoms&quot;:&#xd;
253
+ not &quot;Has Zika Symptoms&quot;</a:s>
254
+ </annotation>
255
+ <expression localId="109" xsi:type="Not">
256
+ <operand localId="108" name="Has Zika Symptoms" xsi:type="ExpressionRef"/>
257
+ </expression>
258
+ </def>
259
+ <def localId="113" name="Yes" context="Patient" accessLevel="Public">
260
+ <annotation xsi:type="a:Annotation">
261
+ <a:s>define &quot;Yes&quot;: { 'Yes' }</a:s>
262
+ </annotation>
263
+ <expression localId="112" xsi:type="List">
264
+ <element localId="111" valueType="t:String" value="Yes" xsi:type="Literal"/>
265
+ </expression>
266
+ </def>
267
+ <def localId="130" name="Resident of or Frequent Traveler to Zika Area" context="Patient" accessLevel="Public">
268
+ <annotation xsi:type="a:Annotation">
269
+ <a:s>define &quot;Resident of or Frequent Traveler to Zika Area&quot;:&#xd;
270
+ exists (&#xd;
271
+ &quot;Zika Exposure Assessment Result&quot;.component C&#xd;
272
+ // TODO: Need to streamline, this ought to have worked, not sure why it didn't (without the coding[0] access)&#xd;
273
+ where C.code.coding[0] = &quot;CDE: Resident of or Frequent Traveler to Zika Area&quot;&#xd;
274
+ and C.value in &quot;Yes&quot;&#xd;
275
+ )</a:s>
276
+ </annotation>
277
+ <expression localId="129" xsi:type="Exists">
278
+ <operand localId="128" xsi:type="Query">
279
+ <source localId="115" alias="C">
280
+ <expression localId="114" path="component" xsi:type="Property">
281
+ <source name="Zika Exposure Assessment Result" xsi:type="ExpressionRef"/>
282
+ </expression>
283
+ </source>
284
+ <where localId="127" xsi:type="And">
285
+ <operand localId="122" xsi:type="Equal">
286
+ <operand name="ToCode" libraryName="FHIRHelpers" xsi:type="FunctionRef">
287
+ <operand localId="120" xsi:type="Indexer">
288
+ <operand localId="118" path="coding" xsi:type="Property">
289
+ <source localId="117" path="code" scope="C" xsi:type="Property"/>
290
+ </operand>
291
+ <operand localId="119" valueType="t:Integer" value="0" xsi:type="Literal"/>
292
+ </operand>
293
+ </operand>
294
+ <operand localId="121" name="CDE: Resident of or Frequent Traveler to Zika Area" xsi:type="CodeRef"/>
295
+ </operand>
296
+ <operand localId="126" xsi:type="In">
297
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
298
+ <operand asType="fhir:string" xsi:type="As">
299
+ <operand localId="124" path="value" scope="C" xsi:type="Property"/>
300
+ <asTypeSpecifier name="fhir:string" xsi:type="NamedTypeSpecifier"/>
301
+ </operand>
302
+ </operand>
303
+ <operand localId="125" name="Yes" xsi:type="ExpressionRef"/>
304
+ </operand>
305
+ </where>
306
+ </operand>
307
+ </expression>
308
+ </def>
309
+ <def localId="147" name="Recent Travel to Zika Area" context="Patient" accessLevel="Public">
310
+ <annotation xsi:type="a:Annotation">
311
+ <a:s>define &quot;Recent Travel to Zika Area&quot;:&#xd;
312
+ exists (&#xd;
313
+ &quot;Zika Exposure Assessment Result&quot;.component C&#xd;
314
+ where C.code.coding[0] = &quot;CDE: Recent Travel to Zika Area&quot;&#xd;
315
+ and C.value in &quot;Yes&quot;&#xd;
316
+ )</a:s>
317
+ </annotation>
318
+ <expression localId="146" xsi:type="Exists">
319
+ <operand localId="145" xsi:type="Query">
320
+ <source localId="132" alias="C">
321
+ <expression localId="131" path="component" xsi:type="Property">
322
+ <source name="Zika Exposure Assessment Result" xsi:type="ExpressionRef"/>
323
+ </expression>
324
+ </source>
325
+ <where localId="144" xsi:type="And">
326
+ <operand localId="139" xsi:type="Equal">
327
+ <operand name="ToCode" libraryName="FHIRHelpers" xsi:type="FunctionRef">
328
+ <operand localId="137" xsi:type="Indexer">
329
+ <operand localId="135" path="coding" xsi:type="Property">
330
+ <source localId="134" path="code" scope="C" xsi:type="Property"/>
331
+ </operand>
332
+ <operand localId="136" valueType="t:Integer" value="0" xsi:type="Literal"/>
333
+ </operand>
334
+ </operand>
335
+ <operand localId="138" name="CDE: Recent Travel to Zika Area" xsi:type="CodeRef"/>
336
+ </operand>
337
+ <operand localId="143" xsi:type="In">
338
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
339
+ <operand asType="fhir:string" xsi:type="As">
340
+ <operand localId="141" path="value" scope="C" xsi:type="Property"/>
341
+ <asTypeSpecifier name="fhir:string" xsi:type="NamedTypeSpecifier"/>
342
+ </operand>
343
+ </operand>
344
+ <operand localId="142" name="Yes" xsi:type="ExpressionRef"/>
345
+ </operand>
346
+ </where>
347
+ </operand>
348
+ </expression>
349
+ </def>
350
+ <def localId="162" name="Time Since Returned From Travel" context="Patient" accessLevel="Public">
351
+ <annotation xsi:type="a:Annotation">
352
+ <a:s>define &quot;Time Since Returned From Travel&quot;:&#xd;
353
+ singleton from (&#xd;
354
+ &quot;Zika Exposure Assessment Result&quot;.component C&#xd;
355
+ where C.code.coding[0] = &quot;CDE: Time Since Returned From Travel&quot;&#xd;
356
+ return C.value&#xd;
357
+ )</a:s>
358
+ </annotation>
359
+ <expression localId="161" xsi:type="SingletonFrom">
360
+ <operand localId="160" xsi:type="Query">
361
+ <source localId="149" alias="C">
362
+ <expression localId="148" path="component" xsi:type="Property">
363
+ <source name="Zika Exposure Assessment Result" xsi:type="ExpressionRef"/>
364
+ </expression>
365
+ </source>
366
+ <where localId="156" xsi:type="Equal">
367
+ <operand name="ToCode" libraryName="FHIRHelpers" xsi:type="FunctionRef">
368
+ <operand localId="154" xsi:type="Indexer">
369
+ <operand localId="152" path="coding" xsi:type="Property">
370
+ <source localId="151" path="code" scope="C" xsi:type="Property"/>
371
+ </operand>
372
+ <operand localId="153" valueType="t:Integer" value="0" xsi:type="Literal"/>
373
+ </operand>
374
+ </operand>
375
+ <operand localId="155" name="CDE: Time Since Returned From Travel" xsi:type="CodeRef"/>
376
+ </where>
377
+ <return localId="159">
378
+ <expression localId="158" path="value" scope="C" xsi:type="Property"/>
379
+ </return>
380
+ </operand>
381
+ </expression>
382
+ </def>
383
+ <def localId="179" name="Recent Sexual Encounter With Traveler to Zika Area" context="Patient" accessLevel="Public">
384
+ <annotation xsi:type="a:Annotation">
385
+ <a:s>define &quot;Recent Sexual Encounter With Traveler to Zika Area&quot;:&#xd;
386
+ exists (&#xd;
387
+ &quot;Zika Exposure Assessment Result&quot;.component C&#xd;
388
+ where C.code.coding[0] = &quot;CDE: Recent Sexual Encounter With Traveler to Zika Area&quot;&#xd;
389
+ and C.value in &quot;Yes&quot;&#xd;
390
+ )</a:s>
391
+ </annotation>
392
+ <expression localId="178" xsi:type="Exists">
393
+ <operand localId="177" xsi:type="Query">
394
+ <source localId="164" alias="C">
395
+ <expression localId="163" path="component" xsi:type="Property">
396
+ <source name="Zika Exposure Assessment Result" xsi:type="ExpressionRef"/>
397
+ </expression>
398
+ </source>
399
+ <where localId="176" xsi:type="And">
400
+ <operand localId="171" xsi:type="Equal">
401
+ <operand name="ToCode" libraryName="FHIRHelpers" xsi:type="FunctionRef">
402
+ <operand localId="169" xsi:type="Indexer">
403
+ <operand localId="167" path="coding" xsi:type="Property">
404
+ <source localId="166" path="code" scope="C" xsi:type="Property"/>
405
+ </operand>
406
+ <operand localId="168" valueType="t:Integer" value="0" xsi:type="Literal"/>
407
+ </operand>
408
+ </operand>
409
+ <operand localId="170" name="CDE: Recent Sexual Encounter With Traveler to Zika Area" xsi:type="CodeRef"/>
410
+ </operand>
411
+ <operand localId="175" xsi:type="In">
412
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
413
+ <operand asType="fhir:string" xsi:type="As">
414
+ <operand localId="173" path="value" scope="C" xsi:type="Property"/>
415
+ <asTypeSpecifier name="fhir:string" xsi:type="NamedTypeSpecifier"/>
416
+ </operand>
417
+ </operand>
418
+ <operand localId="174" name="Yes" xsi:type="ExpressionRef"/>
419
+ </operand>
420
+ </where>
421
+ </operand>
422
+ </expression>
423
+ </def>
424
+ <def localId="196" name="Time Since Sexual Encounter" context="Patient" accessLevel="Public">
425
+ <annotation xsi:type="a:Annotation">
426
+ <a:s>define &quot;Time Since Sexual Encounter&quot;:&#xd;
427
+ singleton from (&#xd;
428
+ &quot;Zika Exposure Assessment Result&quot;.component C&#xd;
429
+ where C.code.coding[0] = &quot;CDE: Time Since Sexual Encounter&quot;&#xd;
430
+ return C.value as Quantity&#xd;
431
+ )</a:s>
432
+ </annotation>
433
+ <expression localId="195" xsi:type="SingletonFrom">
434
+ <operand localId="194" xsi:type="Query">
435
+ <source localId="181" alias="C">
436
+ <expression localId="180" path="component" xsi:type="Property">
437
+ <source name="Zika Exposure Assessment Result" xsi:type="ExpressionRef"/>
438
+ </expression>
439
+ </source>
440
+ <where localId="188" xsi:type="Equal">
441
+ <operand name="ToCode" libraryName="FHIRHelpers" xsi:type="FunctionRef">
442
+ <operand localId="186" xsi:type="Indexer">
443
+ <operand localId="184" path="coding" xsi:type="Property">
444
+ <source localId="183" path="code" scope="C" xsi:type="Property"/>
445
+ </operand>
446
+ <operand localId="185" valueType="t:Integer" value="0" xsi:type="Literal"/>
447
+ </operand>
448
+ </operand>
449
+ <operand localId="187" name="CDE: Time Since Sexual Encounter" xsi:type="CodeRef"/>
450
+ </where>
451
+ <return localId="193">
452
+ <expression localId="192" strict="false" xsi:type="As">
453
+ <operand localId="190" path="value" scope="C" xsi:type="Property"/>
454
+ <asTypeSpecifier localId="191" name="fhir:Quantity" xsi:type="NamedTypeSpecifier"/>
455
+ </expression>
456
+ </return>
457
+ </operand>
458
+ </expression>
459
+ </def>
460
+ <def localId="200" name="Time Since Possible Exposure" context="Patient" accessLevel="Public">
461
+ <annotation xsi:type="a:Annotation">
462
+ <a:s>define &quot;Time Since Possible Exposure&quot;:&#xd;
463
+ Coalesce(&quot;Time Since Returned From Travel&quot;, &quot;Time Since Sexual Encounter&quot;)</a:s>
464
+ </annotation>
465
+ <expression localId="199" xsi:type="Coalesce">
466
+ <operand asType="fhir:Quantity" xsi:type="As">
467
+ <operand localId="197" name="Time Since Returned From Travel" xsi:type="ExpressionRef"/>
468
+ <asTypeSpecifier name="fhir:Quantity" xsi:type="NamedTypeSpecifier"/>
469
+ </operand>
470
+ <operand localId="198" name="Time Since Sexual Encounter" xsi:type="ExpressionRef"/>
471
+ </expression>
472
+ </def>
473
+ <def localId="217" name="Planned Travel to Zika Area" context="Patient" accessLevel="Public">
474
+ <annotation xsi:type="a:Annotation">
475
+ <a:s>define &quot;Planned Travel to Zika Area&quot;:&#xd;
476
+ exists (&#xd;
477
+ &quot;Zika Exposure Assessment Result&quot;.component C&#xd;
478
+ where C.code.coding[0] = &quot;CDE: Planned Travel to Zika Area&quot;&#xd;
479
+ and C.value in &quot;Yes&quot;&#xd;
480
+ )</a:s>
481
+ </annotation>
482
+ <expression localId="216" xsi:type="Exists">
483
+ <operand localId="215" xsi:type="Query">
484
+ <source localId="202" alias="C">
485
+ <expression localId="201" path="component" xsi:type="Property">
486
+ <source name="Zika Exposure Assessment Result" xsi:type="ExpressionRef"/>
487
+ </expression>
488
+ </source>
489
+ <where localId="214" xsi:type="And">
490
+ <operand localId="209" xsi:type="Equal">
491
+ <operand name="ToCode" libraryName="FHIRHelpers" xsi:type="FunctionRef">
492
+ <operand localId="207" xsi:type="Indexer">
493
+ <operand localId="205" path="coding" xsi:type="Property">
494
+ <source localId="204" path="code" scope="C" xsi:type="Property"/>
495
+ </operand>
496
+ <operand localId="206" valueType="t:Integer" value="0" xsi:type="Literal"/>
497
+ </operand>
498
+ </operand>
499
+ <operand localId="208" name="CDE: Planned Travel to Zika Area" xsi:type="CodeRef"/>
500
+ </operand>
501
+ <operand localId="213" xsi:type="In">
502
+ <operand name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
503
+ <operand asType="fhir:string" xsi:type="As">
504
+ <operand localId="211" path="value" scope="C" xsi:type="Property"/>
505
+ <asTypeSpecifier name="fhir:string" xsi:type="NamedTypeSpecifier"/>
506
+ </operand>
507
+ </operand>
508
+ <operand localId="212" name="Yes" xsi:type="ExpressionRef"/>
509
+ </operand>
510
+ </where>
511
+ </operand>
512
+ </expression>
513
+ </def>
514
+ <def localId="223" name="Has Possible Zika Exposure" context="Patient" accessLevel="Public">
515
+ <annotation xsi:type="a:Annotation">
516
+ <a:s>define &quot;Has Possible Zika Exposure&quot;:&#xd;
517
+ &quot;Resident of or Frequent Traveler to Zika Area&quot;&#xd;
518
+ or &quot;Recent Travel to Zika Area&quot;&#xd;
519
+ or &quot;Recent Sexual Encounter With Traveler to Zika Area&quot;</a:s>
520
+ </annotation>
521
+ <expression localId="222" xsi:type="Or">
522
+ <operand localId="220" xsi:type="Or">
523
+ <operand localId="218" name="Resident of or Frequent Traveler to Zika Area" xsi:type="ExpressionRef"/>
524
+ <operand localId="219" name="Recent Travel to Zika Area" xsi:type="ExpressionRef"/>
525
+ </operand>
526
+ <operand localId="221" name="Recent Sexual Encounter With Traveler to Zika Area" xsi:type="ExpressionRef"/>
527
+ </expression>
528
+ </def>
529
+ <def localId="235" name="Zika Symptom Onset" context="Patient" accessLevel="Public">
530
+ <annotation xsi:type="a:Annotation">
531
+ <a:s>define &quot;Zika Symptom Onset&quot;:&#xd;
532
+ First(&#xd;
533
+ &quot;Zika Symptoms&quot; S&#xd;
534
+ // This is suboptimal, it would be better if the compiler could resolve this,&#xd;
535
+ // but it can't currently trace both the choice convergence and the implicit conversion&#xd;
536
+ sort by (S.onset as dateTime)&#xd;
537
+ ).onset</a:s>
538
+ </annotation>
539
+ <expression localId="234" path="onset" xsi:type="Property">
540
+ <source localId="233" xsi:type="First">
541
+ <source localId="232" xsi:type="Query">
542
+ <source localId="225" alias="S">
543
+ <expression localId="224" name="Zika Symptoms" xsi:type="ExpressionRef"/>
544
+ </source>
545
+ <sort localId="231">
546
+ <by localId="230" direction="asc" xsi:type="ByExpression">
547
+ <expression localId="229" strict="false" xsi:type="As">
548
+ <operand localId="227" path="onset" scope="S" xsi:type="Property"/>
549
+ <asTypeSpecifier localId="228" name="fhir:dateTime" xsi:type="NamedTypeSpecifier"/>
550
+ </expression>
551
+ </by>
552
+ </sort>
553
+ </source>
554
+ </source>
555
+ </expression>
556
+ </def>
557
+ <def localId="241" name="Time Since Symptom Onset" context="Patient" accessLevel="Public">
558
+ <annotation xsi:type="a:Annotation">
559
+ <a:s>define &quot;Time Since Symptom Onset&quot;:&#xd;
560
+ System.Quantity { value: weeks between &quot;Zika Symptom Onset&quot; and Today(), unit: 'wk' }</a:s>
561
+ </annotation>
562
+ <expression localId="240" classType="t:Quantity" xsi:type="Instance">
563
+ <element name="value">
564
+ <value xsi:type="ToDecimal">
565
+ <operand localId="238" precision="Week" xsi:type="DurationBetween">
566
+ <operand name="ToDateTime" libraryName="FHIRHelpers" xsi:type="FunctionRef">
567
+ <operand asType="fhir:dateTime" xsi:type="As">
568
+ <operand localId="236" name="Zika Symptom Onset" xsi:type="ExpressionRef"/>
569
+ <asTypeSpecifier name="fhir:dateTime" xsi:type="NamedTypeSpecifier"/>
570
+ </operand>
571
+ </operand>
572
+ <operand localId="237" xsi:type="Today"/>
573
+ </operand>
574
+ </value>
575
+ </element>
576
+ <element name="unit">
577
+ <value localId="239" valueType="t:String" value="wk" xsi:type="Literal"/>
578
+ </element>
579
+ </expression>
580
+ </def>
581
+ <def localId="244" name="Should Administer Zika Exposure Assessment" context="Patient" accessLevel="Public">
582
+ <annotation xsi:type="a:Annotation">
583
+ <a:s>define &quot;Should Administer Zika Exposure Assessment&quot;:&#xd;
584
+ not (&quot;Has Zika Exposure Assessment&quot;)</a:s>
585
+ </annotation>
586
+ <expression localId="243" xsi:type="Not">
587
+ <operand localId="242" name="Has Zika Exposure Assessment" xsi:type="ExpressionRef"/>
588
+ </expression>
589
+ </def>
590
+ <def localId="258" name="Should Order Serum + Urine rRT-PCR Test" context="Patient" accessLevel="Public">
591
+ <annotation xsi:type="a:Annotation">
592
+ <a:s>define &quot;Should Order Serum + Urine rRT-PCR Test&quot;:&#xd;
593
+ (&quot;Has Possible Zika Exposure&quot; and &quot;Has Zika Symptoms&quot; and &quot;Time Since Symptom Onset&quot; &lt; 2 weeks)&#xd;
594
+ or (&quot;No Zika Symptoms&quot; and &quot;Time Since Possible Exposure&quot; &lt; 2 weeks)</a:s>
595
+ </annotation>
596
+ <expression localId="257" xsi:type="Or">
597
+ <operand localId="251" xsi:type="And">
598
+ <operand localId="247" xsi:type="And">
599
+ <operand localId="245" name="Has Possible Zika Exposure" xsi:type="ExpressionRef"/>
600
+ <operand localId="246" name="Has Zika Symptoms" xsi:type="ExpressionRef"/>
601
+ </operand>
602
+ <operand localId="250" xsi:type="Less">
603
+ <operand localId="248" name="Time Since Symptom Onset" xsi:type="ExpressionRef"/>
604
+ <operand localId="249" value="2" unit="weeks" xsi:type="Quantity"/>
605
+ </operand>
606
+ </operand>
607
+ <operand localId="256" xsi:type="And">
608
+ <operand localId="252" name="No Zika Symptoms" xsi:type="ExpressionRef"/>
609
+ <operand localId="255" xsi:type="Less">
610
+ <operand name="ToQuantity" libraryName="FHIRHelpers" xsi:type="FunctionRef">
611
+ <operand localId="253" name="Time Since Possible Exposure" xsi:type="ExpressionRef"/>
612
+ </operand>
613
+ <operand localId="254" value="2" unit="weeks" xsi:type="Quantity"/>
614
+ </operand>
615
+ </operand>
616
+ </expression>
617
+ </def>
618
+ <def localId="280" name="Should Order Serum Zika Virus IgM + Dengue Virus IgM" context="Patient" accessLevel="Public">
619
+ <annotation xsi:type="a:Annotation">
620
+ <a:s>define &quot;Should Order Serum Zika Virus IgM + Dengue Virus IgM&quot;:&#xd;
621
+ (&quot;Has Possible Zika Exposure&quot; and &quot;Has Zika Symptoms&quot; and &quot;Time Since Symptom Onset&quot; in Interval[2 weeks, 12 weeks))&#xd;
622
+ or (&quot;Resident of or Frequent Traveler to Zika Area&quot; and &quot;No Zika Symptoms&quot;)&#xd;
623
+ or (&quot;No Zika Symptoms&quot; and &quot;Time Since Possible Exposure&quot; in Interval[2 weeks, 12 weeks))</a:s>
624
+ </annotation>
625
+ <expression localId="279" xsi:type="Or">
626
+ <operand localId="271" xsi:type="Or">
627
+ <operand localId="267" xsi:type="And">
628
+ <operand localId="261" xsi:type="And">
629
+ <operand localId="259" name="Has Possible Zika Exposure" xsi:type="ExpressionRef"/>
630
+ <operand localId="260" name="Has Zika Symptoms" xsi:type="ExpressionRef"/>
631
+ </operand>
632
+ <operand localId="266" xsi:type="In">
633
+ <operand localId="262" name="Time Since Symptom Onset" xsi:type="ExpressionRef"/>
634
+ <operand localId="265" lowClosed="true" highClosed="false" xsi:type="Interval">
635
+ <low localId="263" value="2" unit="weeks" xsi:type="Quantity"/>
636
+ <high localId="264" value="12" unit="weeks" xsi:type="Quantity"/>
637
+ </operand>
638
+ </operand>
639
+ </operand>
640
+ <operand localId="270" xsi:type="And">
641
+ <operand localId="268" name="Resident of or Frequent Traveler to Zika Area" xsi:type="ExpressionRef"/>
642
+ <operand localId="269" name="No Zika Symptoms" xsi:type="ExpressionRef"/>
643
+ </operand>
644
+ </operand>
645
+ <operand localId="278" xsi:type="And">
646
+ <operand localId="272" name="No Zika Symptoms" xsi:type="ExpressionRef"/>
647
+ <operand localId="277" xsi:type="In">
648
+ <operand name="ToQuantity" libraryName="FHIRHelpers" xsi:type="FunctionRef">
649
+ <operand localId="273" name="Time Since Possible Exposure" xsi:type="ExpressionRef"/>
650
+ </operand>
651
+ <operand localId="276" lowClosed="true" highClosed="false" xsi:type="Interval">
652
+ <low localId="274" value="2" unit="weeks" xsi:type="Quantity"/>
653
+ <high localId="275" value="12" unit="weeks" xsi:type="Quantity"/>
654
+ </operand>
655
+ </operand>
656
+ </operand>
657
+ </expression>
658
+ </def>
659
+ <def localId="294" name="Should Consider IgM Antibody Testing" context="Patient" accessLevel="Public">
660
+ <annotation xsi:type="a:Annotation">
661
+ <a:s>define &quot;Should Consider IgM Antibody Testing&quot;:&#xd;
662
+ (&quot;Has Possible Zika Exposure&quot; and &quot;Has Zika Symptoms&quot; and &quot;Time Since Symptom Onset&quot; >= 12 weeks)&#xd;
663
+ or (&quot;No Zika Symptoms&quot; and &quot;Time Since Possible Exposure&quot; >= 12 weeks)</a:s>
664
+ </annotation>
665
+ <expression localId="293" xsi:type="Or">
666
+ <operand localId="287" xsi:type="And">
667
+ <operand localId="283" xsi:type="And">
668
+ <operand localId="281" name="Has Possible Zika Exposure" xsi:type="ExpressionRef"/>
669
+ <operand localId="282" name="Has Zika Symptoms" xsi:type="ExpressionRef"/>
670
+ </operand>
671
+ <operand localId="286" xsi:type="GreaterOrEqual">
672
+ <operand localId="284" name="Time Since Symptom Onset" xsi:type="ExpressionRef"/>
673
+ <operand localId="285" value="12" unit="weeks" xsi:type="Quantity"/>
674
+ </operand>
675
+ </operand>
676
+ <operand localId="292" xsi:type="And">
677
+ <operand localId="288" name="No Zika Symptoms" xsi:type="ExpressionRef"/>
678
+ <operand localId="291" xsi:type="GreaterOrEqual">
679
+ <operand name="ToQuantity" libraryName="FHIRHelpers" xsi:type="FunctionRef">
680
+ <operand localId="289" name="Time Since Possible Exposure" xsi:type="ExpressionRef"/>
681
+ </operand>
682
+ <operand localId="290" value="12" unit="weeks" xsi:type="Quantity"/>
683
+ </operand>
684
+ </operand>
685
+ </expression>
686
+ </def>
687
+ <def localId="296" name="Should Provide Mosquito Prevention and Contraception Advice" context="Patient" accessLevel="Public">
688
+ <annotation xsi:type="a:Annotation">
689
+ <a:s>define &quot;Should Provide Mosquito Prevention and Contraception Advice&quot;:&#xd;
690
+ &quot;Planned Travel to Zika Area&quot;</a:s>
691
+ </annotation>
692
+ <expression localId="295" name="Planned Travel to Zika Area" xsi:type="ExpressionRef"/>
693
+ </def>
694
+ </statements>
695
+ </library>
696
+
697
+
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/README.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # cql2elm-browser
2
+
3
+ Start a local server using
4
+
5
+ python3 -m http.server 3000
6
+
7
+ and open http://localhost:3000 in your browser. In the browser console, you should see the ELM XML output from the web worker.
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/index.html ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>cql2elm in the browser</title>
6
+ </head>
7
+ <body>
8
+ <script>
9
+ new Worker("./worker.js", { type: "module" });
10
+ </script>
11
+ <h1>cql2elm in the browser</h1>
12
+ <p>Open the console to see the output from the web worker.</p>
13
+ </body>
14
+ </html>
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/providers.js ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ createModelInfoProvider,
3
+ createLibrarySourceProvider,
4
+ stringAsSource,
5
+ } from "https://esm.sh/@cqframework/cql@4.0.0-beta.1/cql-to-elm";
6
+ import { fetchSync } from "./utils.js";
7
+
8
+ const supportedModels = [
9
+ {
10
+ id: "System",
11
+ system: null,
12
+ version: null,
13
+ url: "https://raw.githubusercontent.com/cqframework/clinical_quality_language/refs/heads/main/cql/src/commonMain/resources/org/hl7/elm/r1/system-modelinfo.xml",
14
+ },
15
+ {
16
+ id: "FHIR",
17
+ system: null,
18
+ version: "4.0.1",
19
+ url: "https://raw.githubusercontent.com/cqframework/clinical_quality_language/refs/heads/main/quick/src/main/resources/org/hl7/fhir/fhir-modelinfo-4.0.1.xml",
20
+ },
21
+ ];
22
+
23
+ export const modelInfoProvider = createModelInfoProvider(
24
+ (id, system, version) => {
25
+ console.log(
26
+ `Requested model info with id=${id}, system=${system}, version=${version}`,
27
+ );
28
+ for (const model of supportedModels) {
29
+ if (
30
+ model.id === id &&
31
+ model.system === system &&
32
+ model.version === version
33
+ ) {
34
+ const xml = fetchSync(model.url);
35
+ return stringAsSource(xml);
36
+ }
37
+ }
38
+ return null;
39
+ },
40
+ );
41
+
42
+ const supportedLibraries = [
43
+ {
44
+ id: "FHIRHelpers",
45
+ system: null,
46
+ version: "4.0.1",
47
+ url: "https://raw.githubusercontent.com/cqframework/clinical_quality_language/refs/heads/main/quick/src/main/resources/org/hl7/fhir/FHIRHelpers-4.0.1.cql",
48
+ },
49
+ ];
50
+
51
+ export const librarySourceProvider = createLibrarySourceProvider(
52
+ (id, system, version) => {
53
+ console.log(
54
+ `Requested library source with id=${id}, system=${system}, version=${version}`,
55
+ );
56
+ for (const library of supportedLibraries) {
57
+ if (
58
+ library.id === id &&
59
+ library.system === system &&
60
+ library.version === version
61
+ ) {
62
+ const cql = fetchSync(library.url);
63
+ return stringAsSource(cql);
64
+ }
65
+ }
66
+ return null;
67
+ },
68
+ );
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/utils.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ export function fetchSync(url) {
2
+ const xhr = new XMLHttpRequest();
3
+ xhr.open("GET", url, false);
4
+ xhr.send(null);
5
+ return xhr.responseText;
6
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-browser/worker.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { NamespaceManager } from "https://esm.sh/@cqframework/cql@4.0.0-beta.1/cql";
2
+ import {
3
+ ModelManager,
4
+ LibraryManager,
5
+ CqlTranslator,
6
+ } from "https://esm.sh/@cqframework/cql@4.0.0-beta.1/cql-to-elm";
7
+ import { librarySourceProvider, modelInfoProvider } from "./providers.js";
8
+
9
+ const namespaceManager = new NamespaceManager();
10
+ const modelManager = new ModelManager(namespaceManager);
11
+ modelManager.modelInfoLoader.registerModelInfoProvider(modelInfoProvider);
12
+ const libraryManager = new LibraryManager(modelManager);
13
+ libraryManager.librarySourceLoader.registerProvider(librarySourceProvider);
14
+
15
+ const cql = `
16
+ library Test version '0.1.0'
17
+
18
+ using FHIR version '4.0.1'
19
+
20
+ include FHIRHelpers version '4.0.1'
21
+
22
+ valueset "Encounter Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'
23
+
24
+ parameter "Measurement Period" Interval<DateTime>
25
+
26
+ context Patient
27
+
28
+ define "Inpatient Encounter":
29
+ [Encounter: "Encounter Inpatient"] EncounterInpatient
30
+ where EncounterInpatient.status = 'finished'
31
+ and EncounterInpatient.period ends during day of "Measurement Period"
32
+
33
+ `;
34
+
35
+ const translator = CqlTranslator.fromText(cql, libraryManager);
36
+
37
+ console.log(translator.toXml());
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ node_modules
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/README.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # cql2elm-nodejs
2
+
3
+ Run
4
+
5
+ npm install
6
+ node index.mjs
7
+
8
+ to see example ELM generated from CQL.
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/index.mjs ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import "./require-polyfill.mjs";
2
+ import { NamespaceManager } from "@cqframework/cql/cql";
3
+ import {
4
+ DefaultModelInfoProvider,
5
+ DefaultLibrarySourceProvider,
6
+ stringAsPath,
7
+ ModelManager,
8
+ LibraryManager,
9
+ CqlTranslator,
10
+ } from "@cqframework/cql/cql-to-elm";
11
+
12
+ const namespaceManager = new NamespaceManager();
13
+ const modelManager = new ModelManager(namespaceManager);
14
+ modelManager.modelInfoLoader.registerModelInfoProvider(
15
+ new DefaultModelInfoProvider(stringAsPath("./models")),
16
+ );
17
+ const libraryManager = new LibraryManager(modelManager);
18
+ libraryManager.librarySourceLoader.registerProvider(
19
+ new DefaultLibrarySourceProvider(stringAsPath("./libraries")),
20
+ );
21
+
22
+ const cql = `
23
+ library Test version '0.1.0'
24
+
25
+ using FHIR version '4.0.1'
26
+
27
+ include FHIRHelpers version '4.0.1'
28
+
29
+ valueset "Encounter Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'
30
+
31
+ parameter "Measurement Period" Interval<DateTime>
32
+
33
+ context Patient
34
+
35
+ define "Inpatient Encounter":
36
+ [Encounter: "Encounter Inpatient"] EncounterInpatient
37
+ where EncounterInpatient.status = 'finished'
38
+ and EncounterInpatient.period ends during day of "Measurement Period"
39
+
40
+ `;
41
+
42
+ const translator = CqlTranslator.fromText(cql, libraryManager);
43
+
44
+ console.log(translator.toXml());
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/libraries/FHIRHelpers-4.0.1.cql ADDED
@@ -0,0 +1,520 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ @author: Bryn Rhodes
3
+ @description: This library defines functions to convert between FHIR
4
+ data types and CQL system-defined types, as well as functions to support
5
+ FHIRPath implementation. For more information, the FHIRHelpers wiki page:
6
+ https://github.com/cqframework/clinical_quality_language/wiki/FHIRHelpers
7
+ @allowFluent: true
8
+ */
9
+ library FHIRHelpers version '4.0.1'
10
+
11
+ using FHIR version '4.0.1'
12
+
13
+ define function ToInterval(period FHIR.Period):
14
+ if period is null then
15
+ null
16
+ else
17
+ if period."start" is null then
18
+ Interval(period."start".value, period."end".value]
19
+ else
20
+ Interval[period."start".value, period."end".value]
21
+
22
+ define function ToCalendarUnit(unit System.String):
23
+ case unit
24
+ when 'ms' then 'millisecond'
25
+ when 's' then 'second'
26
+ when 'min' then 'minute'
27
+ when 'h' then 'hour'
28
+ when 'd' then 'day'
29
+ when 'wk' then 'week'
30
+ when 'mo' then 'month'
31
+ when 'a' then 'year'
32
+ else unit
33
+ end
34
+
35
+ define function ToQuantity(quantity FHIR.Quantity):
36
+ case
37
+ when quantity is null then null
38
+ when quantity.value is null then null
39
+ when quantity.comparator is not null then
40
+ Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.')
41
+ when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'
42
+ or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then
43
+ System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }
44
+ else
45
+ Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' & quantity.unit.value & ' (' & quantity.system.value & '|' & quantity.code.value & ')')
46
+ end
47
+
48
+ define function ToQuantityIgnoringComparator(quantity FHIR.Quantity):
49
+ case
50
+ when quantity is null then null
51
+ when quantity.value is null then null
52
+ when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'
53
+ or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then
54
+ System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }
55
+ else
56
+ Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' & quantity.unit.value & ' (' & quantity.system.value & '|' & quantity.code.value & ')')
57
+ end
58
+
59
+ define function ToInterval(quantity FHIR.Quantity):
60
+ if quantity is null then null else
61
+ case quantity.comparator.value
62
+ when '<' then
63
+ Interval[
64
+ null,
65
+ ToQuantityIgnoringComparator(quantity)
66
+ )
67
+ when '<=' then
68
+ Interval[
69
+ null,
70
+ ToQuantityIgnoringComparator(quantity)
71
+ ]
72
+ when '>=' then
73
+ Interval[
74
+ ToQuantityIgnoringComparator(quantity),
75
+ null
76
+ ]
77
+ when '>' then
78
+ Interval(
79
+ ToQuantityIgnoringComparator(quantity),
80
+ null
81
+ ]
82
+ else
83
+ Interval[ToQuantity(quantity), ToQuantity(quantity)]
84
+ end
85
+
86
+ define function ToRatio(ratio FHIR.Ratio):
87
+ if ratio is null then
88
+ null
89
+ else
90
+ System.Ratio { numerator: ToQuantity(ratio.numerator), denominator: ToQuantity(ratio.denominator) }
91
+
92
+ define function ToInterval(range FHIR.Range):
93
+ if range is null then
94
+ null
95
+ else
96
+ Interval[ToQuantity(range.low), ToQuantity(range.high)]
97
+
98
+ define function ToCode(coding FHIR.Coding):
99
+ if coding is null then
100
+ null
101
+ else
102
+ System.Code {
103
+ code: coding.code.value,
104
+ system: coding.system.value,
105
+ version: coding.version.value,
106
+ display: coding.display.value
107
+ }
108
+
109
+ define function ToConcept(concept FHIR.CodeableConcept):
110
+ if concept is null then
111
+ null
112
+ else
113
+ System.Concept {
114
+ codes: concept.coding C return ToCode(C),
115
+ display: concept.text.value
116
+ }
117
+
118
+ define function ToValueSet(uri String):
119
+ if uri is null then
120
+ null
121
+ else
122
+ System.ValueSet {
123
+ id: uri
124
+ }
125
+
126
+ define function reference(reference String):
127
+ if reference is null then
128
+ null
129
+ else
130
+ Reference { reference: string { value: reference } }
131
+
132
+ define function ToValue(value Choice<base64Binary,
133
+ boolean,
134
+ canonical,
135
+ code,
136
+ date,
137
+ dateTime,
138
+ decimal,
139
+ id,
140
+ instant,
141
+ integer,
142
+ markdown,
143
+ oid,
144
+ positiveInt,
145
+ string,
146
+ time,
147
+ unsignedInt,
148
+ uri,
149
+ url,
150
+ uuid,
151
+ Address,
152
+ Age,
153
+ Annotation,
154
+ Attachment,
155
+ CodeableConcept,
156
+ Coding,
157
+ ContactPoint,
158
+ Count,
159
+ Distance,
160
+ Duration,
161
+ HumanName,
162
+ Identifier,
163
+ Money,
164
+ Period,
165
+ Quantity,
166
+ Range,
167
+ Ratio,
168
+ Reference,
169
+ SampledData,
170
+ Signature,
171
+ Timing,
172
+ ContactDetail,
173
+ Contributor,
174
+ DataRequirement,
175
+ Expression,
176
+ ParameterDefinition,
177
+ RelatedArtifact,
178
+ TriggerDefinition,
179
+ UsageContext,
180
+ Dosage,
181
+ Meta>):
182
+ case
183
+ when value is base64Binary then (value as base64Binary).value
184
+ when value is boolean then (value as boolean).value
185
+ when value is canonical then (value as canonical).value
186
+ when value is code then (value as code).value
187
+ when value is date then (value as date).value
188
+ when value is dateTime then (value as dateTime).value
189
+ when value is decimal then (value as decimal).value
190
+ when value is id then (value as id).value
191
+ when value is instant then (value as instant).value
192
+ when value is integer then (value as integer).value
193
+ when value is markdown then (value as markdown).value
194
+ when value is oid then (value as oid).value
195
+ when value is positiveInt then (value as positiveInt).value
196
+ when value is string then (value as string).value
197
+ when value is time then (value as time).value
198
+ when value is unsignedInt then (value as unsignedInt).value
199
+ when value is uri then (value as uri).value
200
+ when value is url then (value as url).value
201
+ when value is uuid then (value as uuid).value
202
+ when value is Age then ToQuantity(value as Age)
203
+ when value is CodeableConcept then ToConcept(value as CodeableConcept)
204
+ when value is Coding then ToCode(value as Coding)
205
+ when value is Count then ToQuantity(value as Count)
206
+ when value is Distance then ToQuantity(value as Distance)
207
+ when value is Duration then ToQuantity(value as Duration)
208
+ when value is Quantity then ToQuantity(value as Quantity)
209
+ when value is Range then ToInterval(value as Range)
210
+ when value is Period then ToInterval(value as Period)
211
+ when value is Ratio then ToRatio(value as Ratio)
212
+ else value as Choice<Address,
213
+ Annotation,
214
+ Attachment,
215
+ ContactPoint,
216
+ HumanName,
217
+ Identifier,
218
+ Money,
219
+ Reference,
220
+ SampledData,
221
+ Signature,
222
+ Timing,
223
+ ContactDetail,
224
+ Contributor,
225
+ DataRequirement,
226
+ Expression,
227
+ ParameterDefinition,
228
+ RelatedArtifact,
229
+ TriggerDefinition,
230
+ UsageContext,
231
+ Dosage,
232
+ Meta>
233
+ end
234
+
235
+ define function resolve(reference String) returns Resource: external
236
+ define function resolve(reference Reference) returns Resource: external
237
+ define function reference(resource Resource) returns Reference: external
238
+ define function extension(element Element, url String) returns List<Extension>: external
239
+ define function extension(resource DomainResource, url String) returns List<Extension>: external
240
+ define function modifierExtension(element BackboneElement, url String) returns List<Extension>: external
241
+ define function modifierExtension(resource DomainResource, url String) returns List<Extension>: external
242
+ define function hasValue(element Element) returns Boolean: external
243
+ define function getValue(element Element) returns Any: external
244
+ define function ofType(identifier String) returns List<Any>: external
245
+ define function is(identifier String) returns Boolean: external
246
+ define function as(identifier String) returns Any: external
247
+ define function elementDefinition(element Element) returns ElementDefinition: external
248
+ define function slice(element Element, url String, name String) returns List<Element>: external
249
+ define function checkModifiers(resource Resource) returns Resource: external
250
+ define function checkModifiers(resource Resource, modifier String) returns Resource: external
251
+ define function checkModifiers(element Element) returns Element: external
252
+ define function checkModifiers(element Element, modifier String) returns Element: external
253
+ define function conformsTo(resource Resource, structure String) returns Boolean: external
254
+ define function memberOf(code code, valueSet String) returns Boolean: external
255
+ define function memberOf(coding Coding, valueSet String) returns Boolean: external
256
+ define function memberOf(concept CodeableConcept, valueSet String) returns Boolean: external
257
+ define function subsumes(coding Coding, subsumedCoding Coding) returns Boolean: external
258
+ define function subsumes(concept CodeableConcept, subsumedConcept CodeableConcept) returns Boolean: external
259
+ define function subsumedBy(coding Coding, subsumingCoding Coding) returns Boolean: external
260
+ define function subsumedBy(concept CodeableConcept, subsumingConcept CodeableConcept) returns Boolean: external
261
+ define function htmlChecks(element Element) returns Boolean: external
262
+
263
+ define function ToString(value AccountStatus): value.value
264
+ define function ToString(value ActionCardinalityBehavior): value.value
265
+ define function ToString(value ActionConditionKind): value.value
266
+ define function ToString(value ActionGroupingBehavior): value.value
267
+ define function ToString(value ActionParticipantType): value.value
268
+ define function ToString(value ActionPrecheckBehavior): value.value
269
+ define function ToString(value ActionRelationshipType): value.value
270
+ define function ToString(value ActionRequiredBehavior): value.value
271
+ define function ToString(value ActionSelectionBehavior): value.value
272
+ define function ToString(value ActivityDefinitionKind): value.value
273
+ define function ToString(value ActivityParticipantType): value.value
274
+ define function ToString(value AddressType): value.value
275
+ define function ToString(value AddressUse): value.value
276
+ define function ToString(value AdministrativeGender): value.value
277
+ define function ToString(value AdverseEventActuality): value.value
278
+ define function ToString(value AggregationMode): value.value
279
+ define function ToString(value AllergyIntoleranceCategory): value.value
280
+ define function ToString(value AllergyIntoleranceCriticality): value.value
281
+ define function ToString(value AllergyIntoleranceSeverity): value.value
282
+ define function ToString(value AllergyIntoleranceType): value.value
283
+ define function ToString(value AppointmentStatus): value.value
284
+ define function ToString(value AssertionDirectionType): value.value
285
+ define function ToString(value AssertionOperatorType): value.value
286
+ define function ToString(value AssertionResponseTypes): value.value
287
+ define function ToString(value AuditEventAction): value.value
288
+ define function ToString(value AuditEventAgentNetworkType): value.value
289
+ define function ToString(value AuditEventOutcome): value.value
290
+ define function ToString(value BindingStrength): value.value
291
+ define function ToString(value BiologicallyDerivedProductCategory): value.value
292
+ define function ToString(value BiologicallyDerivedProductStatus): value.value
293
+ define function ToString(value BiologicallyDerivedProductStorageScale): value.value
294
+ define function ToString(value BundleType): value.value
295
+ define function ToString(value CapabilityStatementKind): value.value
296
+ define function ToString(value CarePlanActivityKind): value.value
297
+ define function ToString(value CarePlanActivityStatus): value.value
298
+ define function ToString(value CarePlanIntent): value.value
299
+ define function ToString(value CarePlanStatus): value.value
300
+ define function ToString(value CareTeamStatus): value.value
301
+ define function ToString(value CatalogEntryRelationType): value.value
302
+ define function ToString(value ChargeItemDefinitionPriceComponentType): value.value
303
+ define function ToString(value ChargeItemStatus): value.value
304
+ define function ToString(value ClaimResponseStatus): value.value
305
+ define function ToString(value ClaimStatus): value.value
306
+ define function ToString(value ClinicalImpressionStatus): value.value
307
+ define function ToString(value CodeSearchSupport): value.value
308
+ define function ToString(value CodeSystemContentMode): value.value
309
+ define function ToString(value CodeSystemHierarchyMeaning): value.value
310
+ define function ToString(value CommunicationPriority): value.value
311
+ define function ToString(value CommunicationRequestStatus): value.value
312
+ define function ToString(value CommunicationStatus): value.value
313
+ define function ToString(value CompartmentCode): value.value
314
+ define function ToString(value CompartmentType): value.value
315
+ define function ToString(value CompositionAttestationMode): value.value
316
+ define function ToString(value CompositionStatus): value.value
317
+ define function ToString(value ConceptMapEquivalence): value.value
318
+ define function ToString(value ConceptMapGroupUnmappedMode): value.value
319
+ define function ToString(value ConditionalDeleteStatus): value.value
320
+ define function ToString(value ConditionalReadStatus): value.value
321
+ define function ToString(value ConsentDataMeaning): value.value
322
+ define function ToString(value ConsentProvisionType): value.value
323
+ define function ToString(value ConsentState): value.value
324
+ define function ToString(value ConstraintSeverity): value.value
325
+ define function ToString(value ContactPointSystem): value.value
326
+ define function ToString(value ContactPointUse): value.value
327
+ define function ToString(value ContractPublicationStatus): value.value
328
+ define function ToString(value ContractStatus): value.value
329
+ define function ToString(value ContributorType): value.value
330
+ define function ToString(value CoverageStatus): value.value
331
+ define function ToString(value CurrencyCode): value.value
332
+ define function ToString(value DayOfWeek): value.value
333
+ define function ToString(value DaysOfWeek): value.value
334
+ define function ToString(value DetectedIssueSeverity): value.value
335
+ define function ToString(value DetectedIssueStatus): value.value
336
+ define function ToString(value DeviceMetricCalibrationState): value.value
337
+ define function ToString(value DeviceMetricCalibrationType): value.value
338
+ define function ToString(value DeviceMetricCategory): value.value
339
+ define function ToString(value DeviceMetricColor): value.value
340
+ define function ToString(value DeviceMetricOperationalStatus): value.value
341
+ define function ToString(value DeviceNameType): value.value
342
+ define function ToString(value DeviceRequestStatus): value.value
343
+ define function ToString(value DeviceUseStatementStatus): value.value
344
+ define function ToString(value DiagnosticReportStatus): value.value
345
+ define function ToString(value DiscriminatorType): value.value
346
+ define function ToString(value DocumentConfidentiality): value.value
347
+ define function ToString(value DocumentMode): value.value
348
+ define function ToString(value DocumentReferenceStatus): value.value
349
+ define function ToString(value DocumentRelationshipType): value.value
350
+ define function ToString(value EligibilityRequestPurpose): value.value
351
+ define function ToString(value EligibilityRequestStatus): value.value
352
+ define function ToString(value EligibilityResponsePurpose): value.value
353
+ define function ToString(value EligibilityResponseStatus): value.value
354
+ define function ToString(value EnableWhenBehavior): value.value
355
+ define function ToString(value EncounterLocationStatus): value.value
356
+ define function ToString(value EncounterStatus): value.value
357
+ define function ToString(value EndpointStatus): value.value
358
+ define function ToString(value EnrollmentRequestStatus): value.value
359
+ define function ToString(value EnrollmentResponseStatus): value.value
360
+ define function ToString(value EpisodeOfCareStatus): value.value
361
+ define function ToString(value EventCapabilityMode): value.value
362
+ define function ToString(value EventTiming): value.value
363
+ define function ToString(value EvidenceVariableType): value.value
364
+ define function ToString(value ExampleScenarioActorType): value.value
365
+ define function ToString(value ExplanationOfBenefitStatus): value.value
366
+ define function ToString(value ExposureState): value.value
367
+ define function ToString(value ExtensionContextType): value.value
368
+ define function ToString(value FHIRAllTypes): value.value
369
+ define function ToString(value FHIRDefinedType): value.value
370
+ define function ToString(value FHIRDeviceStatus): value.value
371
+ define function ToString(value FHIRResourceType): value.value
372
+ define function ToString(value FHIRSubstanceStatus): value.value
373
+ define function ToString(value FHIRVersion): value.value
374
+ define function ToString(value FamilyHistoryStatus): value.value
375
+ define function ToString(value FilterOperator): value.value
376
+ define function ToString(value FlagStatus): value.value
377
+ define function ToString(value GoalLifecycleStatus): value.value
378
+ define function ToString(value GraphCompartmentRule): value.value
379
+ define function ToString(value GraphCompartmentUse): value.value
380
+ define function ToString(value GroupMeasure): value.value
381
+ define function ToString(value GroupType): value.value
382
+ define function ToString(value GuidanceResponseStatus): value.value
383
+ define function ToString(value GuidePageGeneration): value.value
384
+ define function ToString(value GuideParameterCode): value.value
385
+ define function ToString(value HTTPVerb): value.value
386
+ define function ToString(value IdentifierUse): value.value
387
+ define function ToString(value IdentityAssuranceLevel): value.value
388
+ define function ToString(value ImagingStudyStatus): value.value
389
+ define function ToString(value ImmunizationEvaluationStatus): value.value
390
+ define function ToString(value ImmunizationStatus): value.value
391
+ define function ToString(value InvoicePriceComponentType): value.value
392
+ define function ToString(value InvoiceStatus): value.value
393
+ define function ToString(value IssueSeverity): value.value
394
+ define function ToString(value IssueType): value.value
395
+ define function ToString(value LinkType): value.value
396
+ define function ToString(value LinkageType): value.value
397
+ define function ToString(value ListMode): value.value
398
+ define function ToString(value ListStatus): value.value
399
+ define function ToString(value LocationMode): value.value
400
+ define function ToString(value LocationStatus): value.value
401
+ define function ToString(value MeasureReportStatus): value.value
402
+ define function ToString(value MeasureReportType): value.value
403
+ define function ToString(value MediaStatus): value.value
404
+ define function ToString(value MedicationAdministrationStatus): value.value
405
+ define function ToString(value MedicationDispenseStatus): value.value
406
+ define function ToString(value MedicationKnowledgeStatus): value.value
407
+ define function ToString(value MedicationRequestIntent): value.value
408
+ define function ToString(value MedicationRequestPriority): value.value
409
+ define function ToString(value MedicationRequestStatus): value.value
410
+ define function ToString(value MedicationStatementStatus): value.value
411
+ define function ToString(value MedicationStatus): value.value
412
+ define function ToString(value MessageSignificanceCategory): value.value
413
+ define function ToString(value Messageheader_Response_Request): value.value
414
+ define function ToString(value MimeType): value.value
415
+ define function ToString(value NameUse): value.value
416
+ define function ToString(value NamingSystemIdentifierType): value.value
417
+ define function ToString(value NamingSystemType): value.value
418
+ define function ToString(value NarrativeStatus): value.value
419
+ define function ToString(value NoteType): value.value
420
+ define function ToString(value NutritiionOrderIntent): value.value
421
+ define function ToString(value NutritionOrderStatus): value.value
422
+ define function ToString(value ObservationDataType): value.value
423
+ define function ToString(value ObservationRangeCategory): value.value
424
+ define function ToString(value ObservationStatus): value.value
425
+ define function ToString(value OperationKind): value.value
426
+ define function ToString(value OperationParameterUse): value.value
427
+ define function ToString(value OrientationType): value.value
428
+ define function ToString(value ParameterUse): value.value
429
+ define function ToString(value ParticipantRequired): value.value
430
+ define function ToString(value ParticipantStatus): value.value
431
+ define function ToString(value ParticipationStatus): value.value
432
+ define function ToString(value PaymentNoticeStatus): value.value
433
+ define function ToString(value PaymentReconciliationStatus): value.value
434
+ define function ToString(value ProcedureStatus): value.value
435
+ define function ToString(value PropertyRepresentation): value.value
436
+ define function ToString(value PropertyType): value.value
437
+ define function ToString(value ProvenanceEntityRole): value.value
438
+ define function ToString(value PublicationStatus): value.value
439
+ define function ToString(value QualityType): value.value
440
+ define function ToString(value QuantityComparator): value.value
441
+ define function ToString(value QuestionnaireItemOperator): value.value
442
+ define function ToString(value QuestionnaireItemType): value.value
443
+ define function ToString(value QuestionnaireResponseStatus): value.value
444
+ define function ToString(value ReferenceHandlingPolicy): value.value
445
+ define function ToString(value ReferenceVersionRules): value.value
446
+ define function ToString(value ReferredDocumentStatus): value.value
447
+ define function ToString(value RelatedArtifactType): value.value
448
+ define function ToString(value RemittanceOutcome): value.value
449
+ define function ToString(value RepositoryType): value.value
450
+ define function ToString(value RequestIntent): value.value
451
+ define function ToString(value RequestPriority): value.value
452
+ define function ToString(value RequestStatus): value.value
453
+ define function ToString(value ResearchElementType): value.value
454
+ define function ToString(value ResearchStudyStatus): value.value
455
+ define function ToString(value ResearchSubjectStatus): value.value
456
+ define function ToString(value ResourceType): value.value
457
+ define function ToString(value ResourceVersionPolicy): value.value
458
+ define function ToString(value ResponseType): value.value
459
+ define function ToString(value RestfulCapabilityMode): value.value
460
+ define function ToString(value RiskAssessmentStatus): value.value
461
+ define function ToString(value SPDXLicense): value.value
462
+ define function ToString(value SearchComparator): value.value
463
+ define function ToString(value SearchEntryMode): value.value
464
+ define function ToString(value SearchModifierCode): value.value
465
+ define function ToString(value SearchParamType): value.value
466
+ define function ToString(value SectionMode): value.value
467
+ define function ToString(value SequenceType): value.value
468
+ define function ToString(value ServiceRequestIntent): value.value
469
+ define function ToString(value ServiceRequestPriority): value.value
470
+ define function ToString(value ServiceRequestStatus): value.value
471
+ define function ToString(value SlicingRules): value.value
472
+ define function ToString(value SlotStatus): value.value
473
+ define function ToString(value SortDirection): value.value
474
+ define function ToString(value SpecimenContainedPreference): value.value
475
+ define function ToString(value SpecimenStatus): value.value
476
+ define function ToString(value Status): value.value
477
+ define function ToString(value StrandType): value.value
478
+ define function ToString(value StructureDefinitionKind): value.value
479
+ define function ToString(value StructureMapContextType): value.value
480
+ define function ToString(value StructureMapGroupTypeMode): value.value
481
+ define function ToString(value StructureMapInputMode): value.value
482
+ define function ToString(value StructureMapModelMode): value.value
483
+ define function ToString(value StructureMapSourceListMode): value.value
484
+ define function ToString(value StructureMapTargetListMode): value.value
485
+ define function ToString(value StructureMapTransform): value.value
486
+ define function ToString(value SubscriptionChannelType): value.value
487
+ define function ToString(value SubscriptionStatus): value.value
488
+ define function ToString(value SupplyDeliveryStatus): value.value
489
+ define function ToString(value SupplyRequestStatus): value.value
490
+ define function ToString(value SystemRestfulInteraction): value.value
491
+ define function ToString(value TaskIntent): value.value
492
+ define function ToString(value TaskPriority): value.value
493
+ define function ToString(value TaskStatus): value.value
494
+ define function ToString(value TestReportActionResult): value.value
495
+ define function ToString(value TestReportParticipantType): value.value
496
+ define function ToString(value TestReportResult): value.value
497
+ define function ToString(value TestReportStatus): value.value
498
+ define function ToString(value TestScriptRequestMethodCode): value.value
499
+ define function ToString(value TriggerType): value.value
500
+ define function ToString(value TypeDerivationRule): value.value
501
+ define function ToString(value TypeRestfulInteraction): value.value
502
+ define function ToString(value UDIEntryType): value.value
503
+ define function ToString(value UnitsOfTime): value.value
504
+ define function ToString(value Use): value.value
505
+ define function ToString(value VariableType): value.value
506
+ define function ToString(value VisionBase): value.value
507
+ define function ToString(value VisionEyes): value.value
508
+ define function ToString(value VisionStatus): value.value
509
+ define function ToString(value XPathUsageType): value.value
510
+ define function ToString(value base64Binary): value.value
511
+ define function ToBoolean(value boolean): value.value
512
+ define function ToDate(value date): value.value
513
+ define function ToDateTime(value dateTime): value.value
514
+ define function ToDecimal(value decimal): value.value
515
+ define function ToDateTime(value instant): value.value
516
+ define function ToInteger(value integer): value.value
517
+ define function ToString(value string): value.value
518
+ define function ToTime(value time): value.value
519
+ define function ToString(value uri): value.value
520
+ define function ToString(value xhtml): value.value
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/models/fhir-modelinfo-4.0.1.xml ADDED
The diff for this file is too large to render. See raw diff
 
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/models/system-modelinfo.xml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <ns4:modelInfo name="System" version="1.0.0" url="urn:hl7-org:elm-types:r1" targetQualifier="system"
3
+ xmlns:ns4="urn:hl7-org:elm-modelinfo:r1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
+ <ns4:typeInfo xsi:type="ns4:SimpleTypeInfo" name="System.Any"/>
5
+ <ns4:typeInfo xsi:type="ns4:SimpleTypeInfo" name="System.Boolean" baseType="System.Any"/>
6
+ <ns4:typeInfo xsi:type="ns4:SimpleTypeInfo" name="System.Integer" baseType="System.Any"/>
7
+ <ns4:typeInfo xsi:type="ns4:SimpleTypeInfo" name="System.Long" baseType="System.Any"/>
8
+ <ns4:typeInfo xsi:type="ns4:SimpleTypeInfo" name="System.Decimal" baseType="System.Any"/>
9
+ <ns4:typeInfo xsi:type="ns4:SimpleTypeInfo" name="System.String" baseType="System.Any"/>
10
+ <ns4:typeInfo xsi:type="ns4:SimpleTypeInfo" name="System.DateTime" baseType="System.Any"/>
11
+ <ns4:typeInfo xsi:type="ns4:SimpleTypeInfo" name="System.Date" baseType="System.Any"/>
12
+ <ns4:typeInfo xsi:type="ns4:SimpleTypeInfo" name="System.Time" baseType="System.Any"/>
13
+ <ns4:typeInfo xsi:type="ns4:ClassInfo" name="System.Quantity" baseType="System.Any">
14
+ <ns4:element name="value" type="System.Decimal"/>
15
+ <ns4:element name="unit" type="System.String"/>
16
+ </ns4:typeInfo>
17
+ <ns4:typeInfo xsi:type="ns4:ClassInfo" name="System.Ratio" baseType="System.Any">
18
+ <ns4:element name="numerator" type="System.Quantity"/>
19
+ <ns4:element name="denominator" type="System.Quantity"/>
20
+ </ns4:typeInfo>
21
+ <ns4:typeInfo xsi:type="ns4:ClassInfo" name="System.Code" baseType="System.Any">
22
+ <ns4:element name="code" type="System.String"/>
23
+ <ns4:element name="system" type="System.String"/>
24
+ <ns4:element name="version" type="System.String"/>
25
+ <ns4:element name="display" type="System.String"/>
26
+ <!--ns4:element name="primary" type="System.Boolean"/-->
27
+ </ns4:typeInfo>
28
+ <ns4:typeInfo xsi:type="ns4:ClassInfo" name="System.Concept" baseType="System.Any">
29
+ <ns4:element name="codes">
30
+ <ns4:typeSpecifier xsi:type="ns4:ListTypeSpecifier" elementType="System.Code"/>
31
+ </ns4:element>
32
+ <ns4:element name="display" type="System.String"/>
33
+ </ns4:typeInfo>
34
+ <ns4:typeInfo xsi:type="ns4:ClassInfo" name="System.Vocabulary" baseType="System.Any">
35
+ <ns4:element name="id" type="System.String"/>
36
+ <ns4:element name="version" type="System.String"/>
37
+ </ns4:typeInfo>
38
+ <ns4:typeInfo xsi:type="ns4:ClassInfo" name="System.ValueSet" baseType="System.Vocabulary"/>
39
+ <ns4:typeInfo xsi:type="ns4:ClassInfo" name="System.CodeSystem" baseType="System.Vocabulary"/>
40
+ </ns4:modelInfo>
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/package-lock.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "cql2elm-nodejs",
3
+ "lockfileVersion": 3,
4
+ "requires": true,
5
+ "packages": {
6
+ "": {
7
+ "dependencies": {
8
+ "@cqframework/cql": "^4.0.0-beta.1"
9
+ }
10
+ },
11
+ "node_modules/@cqframework/cql": {
12
+ "version": "4.0.0-beta.1",
13
+ "resolved": "https://registry.npmjs.org/@cqframework/cql/-/cql-4.0.0-beta.1.tgz",
14
+ "integrity": "sha512-eXjVLLGyvnrOULnTS3KuFOdyMWogTl9dYLVgFVeDDZsRIbwGB0XMxVauYrnXqK4OEONz+R41W/yYuwFfCQDX/A==",
15
+ "license": "Apache-2.0",
16
+ "dependencies": {
17
+ "saxes": "6.0.0"
18
+ }
19
+ },
20
+ "node_modules/saxes": {
21
+ "version": "6.0.0",
22
+ "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
23
+ "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==",
24
+ "license": "ISC",
25
+ "dependencies": {
26
+ "xmlchars": "^2.2.0"
27
+ },
28
+ "engines": {
29
+ "node": ">=v12.22.7"
30
+ }
31
+ },
32
+ "node_modules/xmlchars": {
33
+ "version": "2.2.0",
34
+ "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
35
+ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
36
+ "license": "MIT"
37
+ }
38
+ }
39
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/package.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "dependencies": {
3
+ "@cqframework/cql": "^4.0.0-beta.1"
4
+ }
5
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/js/cql2elm-nodejs/require-polyfill.mjs ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ // This fixes https://github.com/Kotlin/kotlinx-io/issues/345
2
+
3
+ import { createRequire } from "node:module";
4
+ const require = createRequire(import.meta.url);
5
+ global.require = require;
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/library-cbp.cql ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ library CBP version '1'
2
+
3
+ using FHIR // version '1.4'
4
+
5
+ /*
6
+ Blood Pressure value providing blood pressure
7
+ "Systolic Less Than 140"
8
+ "Systolic Greater Than/Equal To 140"
9
+ "Diastolic Less Than 80"
10
+ "Diastolic 80-89"
11
+ "Diastolic Greater Than/Equal To 90"
12
+ CPT
13
+ 1 year
14
+
15
+ Hx HTN Earliest date practice was aware of hypertension
16
+ "Essential Hypertension"
17
+ ICD10CM
18
+ 3 years
19
+
20
+ */
21
+
22
+ /*
23
+ // These are valuesets containing CPT codes indicating these concepts
24
+ valueset "Systolic Less Than 140": '2.16.840.1.113883.3.464.1004.1243'
25
+ valueset "Systolic Greater Than/Equal To 140": '2.16.840.1.113883.3.464.1004.1242'
26
+ valueset "Diastolic Less Than 80": '2.16.840.1.113883.3.464.1004.1084'
27
+ valueset "Diastolic 80-89": '2.16.840.1.113883.3.464.1004.1082'
28
+ valueset "Diastolic Greater Than/Equal To 90": '2.16.840.1.113883.3.464.1004.1083'
29
+ valueset "Essential Hypertension": '2.16.840.1.113883.3.464.1004.1122'
30
+ */
31
+
32
+ codesystem "LOINC": 'http://loinc.org'
33
+
34
+ // Using the DAF profiles, we could also communicate the requirement with value-based filtering
35
+ valueset "Systolic Blood Pressure": 'Systolic Blood Pressure' // TODO: LOINC 8480-6
36
+ valueset "Diastolic Blood Pressure": 'Diastolic Blood Pressure' // TODO: LOINC 8462-4
37
+
38
+ parameter MeasurementPeriod Interval<DateTime>
39
+
40
+ context Patient
41
+
42
+ define "Lookback Interval One Year":
43
+ Interval[start of MeasurementPeriod - 1 years, end of MeasurementPeriod]
44
+
45
+ define "Lookback Interval Three Years":
46
+ Interval[start of MeasurementPeriod - 3 years, end of MeasurementPeriod]
47
+
48
+ // TODO: Need to verify the demographic here
49
+ define "In Demographic":
50
+ true
51
+ //AgeInYearsAt(start of MeasurementPeriod) >= 40
52
+
53
+ // Blood Pressure
54
+
55
+ /*
56
+ // Using NCQA CPT Code Groupings
57
+ define "BP: Systolic Less Than 140":
58
+ [Observation: "Systolic Less Than 140"] O
59
+ where O.status.value in { 'final', 'amended' }
60
+ and O.effectiveDateTime.value during "Lookback Interval One Year"
61
+
62
+ define "BP: Systolic Greater Than/Equal To 140":
63
+ [Observation: "Systolic Greater Than/Equal To 140"] O
64
+ where O.status.value in { 'final', 'amended' }
65
+ and O.effectiveDateTime.value during "Lookback Interval One Year"
66
+
67
+ define "BP: Diastolic Greater Less Than 80":
68
+ [Observation: "Diastolic Less Than 80"] O
69
+ where O.status.value in { 'final', 'amended' }
70
+ and O.effectiveDateTime.value during "Lookback Interval One Year"
71
+
72
+ define "BP: Diastolic 80-89":
73
+ [Observation: "Diastolic 80-89"] O
74
+ where O.status.value in { 'final', 'amended' }
75
+ and O.effectiveDateTime.value during "Lookback Interval One Year"
76
+
77
+ define "BP: Diastolic Greater Than/Equal To 90":
78
+ [Observation: "Diastolic Greater Than/Equal To 90"] O
79
+ where O.status.value in { 'final', 'amended' }
80
+ and O.effectiveDateTime.value during "Lookback Interval One Year"
81
+
82
+ */
83
+
84
+ define "Systolic blood pressure":
85
+ Code '8480-6' from "LOINC" display 'Systolic blood pressure'
86
+
87
+ define "Diastolic blood pressure":
88
+ Code '8462-4' from "LOINC" display 'Diastolic blood pressure'
89
+
90
+ // Using DAF Profiles (LOINC Code)
91
+ define "BP: Systolic":
92
+ [Observation: "Systolic blood pressure"] O
93
+ where O.status.value in { 'final', 'amended' }
94
+ and O.effectiveDateTime.value during "Lookback Interval One Year"
95
+
96
+ define "BP: Diastolic":
97
+ [Observation: "Diastolic blood pressure"] O
98
+ where O.status.value in { 'final', 'amended' }
99
+ and O.effectiveDateTime.value during "Lookback Interval One Year"
100
+
101
+ define "BP: Systolic Less Than 140":
102
+ "BP: Systolic" S
103
+ where S.valueQuantity.value.value < 140
104
+
105
+ define "BP: Systolic Greater Than/Equal To 140":
106
+ "BP: Systolic" S
107
+ where S.valueQuantity.value.value >= 140
108
+
109
+ define "BP: Diastolic Less Than 80":
110
+ "BP: Diastolic" D
111
+ where D.valueQuantity.value.value < 80
112
+
113
+ define "BP: Diastolic 80-89":
114
+ "BP: Diastolic" D
115
+ where D.valueQuantity.value.value between 80 and 89
116
+
117
+ define "BP: Diastolic Greater Than/Equal To 90":
118
+ "BP: Diastolic" D
119
+ where D.valueQuantity.value.value >= 90
120
+
121
+ // Hx HTN
122
+
123
+ /*
124
+ define "Hypertension Diagnosis":
125
+ [Condition: "Essential Hypertension"] H
126
+ where H.clinicalStatus.value = 'active'
127
+ and H.verificationStatus.value = 'confirmed'
128
+ and H.onsetDateTime.value during "Lookback Interval Three Years"
129
+
130
+ // Date of first diagnosis of Hypertension
131
+ define "Hx HTN":
132
+ First("Hypertension Diagnosis" D sort by D.onsetDateTime.value).dateRecorded.value
133
+
134
+ */
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/examples/library-cbp.json ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "library" : {
3
+ "identifier" : {
4
+ "id" : "CBP",
5
+ "version" : "1"
6
+ },
7
+ "schemaIdentifier" : {
8
+ "id" : "urn:hl7-org:elm",
9
+ "version" : "r1"
10
+ },
11
+ "usings" : {
12
+ "def" : [ {
13
+ "localIdentifier" : "System",
14
+ "uri" : "urn:hl7-org:elm-types:r1"
15
+ }, {
16
+ "localIdentifier" : "FHIR",
17
+ "uri" : "http://hl7.org/fhir"
18
+ } ]
19
+ },
20
+ "parameters" : {
21
+ "def" : [ {
22
+ "name" : "MeasurementPeriod",
23
+ "accessLevel" : "Public",
24
+ "parameterTypeSpecifier" : {
25
+ "type" : "IntervalTypeSpecifier",
26
+ "pointType" : {
27
+ "name" : "{urn:hl7-org:elm-types:r1}DateTime",
28
+ "type" : "NamedTypeSpecifier"
29
+ }
30
+ }
31
+ } ]
32
+ },
33
+ "codeSystems" : {
34
+ "def" : [ {
35
+ "name" : "LOINC",
36
+ "id" : "http://loinc.org",
37
+ "accessLevel" : "Public"
38
+ } ]
39
+ },
40
+ "valueSets" : {
41
+ "def" : [ {
42
+ "name" : "Systolic Blood Pressure",
43
+ "id" : "Systolic Blood Pressure",
44
+ "accessLevel" : "Public"
45
+ }, {
46
+ "name" : "Diastolic Blood Pressure",
47
+ "id" : "Diastolic Blood Pressure",
48
+ "accessLevel" : "Public"
49
+ } ]
50
+ },
51
+ "statements" : {
52
+ "def" : [ {
53
+ "name" : "Patient",
54
+ "context" : "Patient",
55
+ "expression" : {
56
+ "type" : "SingletonFrom",
57
+ "operand" : {
58
+ "dataType" : "{http://hl7.org/fhir}Patient",
59
+ "type" : "Retrieve"
60
+ }
61
+ }
62
+ }, {
63
+ "name" : "Lookback Interval One Year",
64
+ "context" : "Patient",
65
+ "accessLevel" : "Public",
66
+ "expression" : {
67
+ "lowClosed" : true,
68
+ "highClosed" : true,
69
+ "type" : "Interval",
70
+ "low" : {
71
+ "type" : "Subtract",
72
+ "operand" : [ {
73
+ "type" : "Start",
74
+ "operand" : {
75
+ "name" : "MeasurementPeriod",
76
+ "type" : "ParameterRef"
77
+ }
78
+ }, {
79
+ "value" : 1,
80
+ "unit" : "years",
81
+ "type" : "Quantity"
82
+ } ]
83
+ },
84
+ "high" : {
85
+ "type" : "End",
86
+ "operand" : {
87
+ "name" : "MeasurementPeriod",
88
+ "type" : "ParameterRef"
89
+ }
90
+ }
91
+ }
92
+ }, {
93
+ "name" : "Lookback Interval Three Years",
94
+ "context" : "Patient",
95
+ "accessLevel" : "Public",
96
+ "expression" : {
97
+ "lowClosed" : true,
98
+ "highClosed" : true,
99
+ "type" : "Interval",
100
+ "low" : {
101
+ "type" : "Subtract",
102
+ "operand" : [ {
103
+ "type" : "Start",
104
+ "operand" : {
105
+ "name" : "MeasurementPeriod",
106
+ "type" : "ParameterRef"
107
+ }
108
+ }, {
109
+ "value" : 3,
110
+ "unit" : "years",
111
+ "type" : "Quantity"
112
+ } ]
113
+ },
114
+ "high" : {
115
+ "type" : "End",
116
+ "operand" : {
117
+ "name" : "MeasurementPeriod",
118
+ "type" : "ParameterRef"
119
+ }
120
+ }
121
+ }
122
+ }, {
123
+ "name" : "In Demographic",
124
+ "context" : "Patient",
125
+ "accessLevel" : "Public",
126
+ "expression" : {
127
+ "valueType" : "{urn:hl7-org:elm-types:r1}Boolean",
128
+ "value" : "true",
129
+ "type" : "Literal"
130
+ }
131
+ }, {
132
+ "name" : "Systolic blood pressure",
133
+ "context" : "Patient",
134
+ "accessLevel" : "Public",
135
+ "expression" : {
136
+ "code" : "8480-6",
137
+ "display" : "Systolic blood pressure",
138
+ "type" : "Code",
139
+ "system" : {
140
+ "name" : "LOINC"
141
+ }
142
+ }
143
+ }, {
144
+ "name" : "Diastolic blood pressure",
145
+ "context" : "Patient",
146
+ "accessLevel" : "Public",
147
+ "expression" : {
148
+ "code" : "8462-4",
149
+ "display" : "Diastolic blood pressure",
150
+ "type" : "Code",
151
+ "system" : {
152
+ "name" : "LOINC"
153
+ }
154
+ }
155
+ }, {
156
+ "name" : "BP: Systolic",
157
+ "context" : "Patient",
158
+ "accessLevel" : "Public",
159
+ "expression" : {
160
+ "type" : "Query",
161
+ "source" : [ {
162
+ "alias" : "O",
163
+ "expression" : {
164
+ "dataType" : "{http://hl7.org/fhir}Observation",
165
+ "codeProperty" : "code",
166
+ "dateProperty" : "effectiveDateTime.value",
167
+ "type" : "Retrieve",
168
+ "codes" : {
169
+ "name" : "Systolic blood pressure",
170
+ "type" : "ExpressionRef"
171
+ },
172
+ "dateRange" : {
173
+ "name" : "Lookback Interval One Year",
174
+ "type" : "ExpressionRef"
175
+ }
176
+ }
177
+ } ],
178
+ "relationship" : [ ],
179
+ "where" : {
180
+ "type" : "In",
181
+ "operand" : [ {
182
+ "path" : "value",
183
+ "type" : "Property",
184
+ "source" : {
185
+ "path" : "status",
186
+ "scope" : "O",
187
+ "type" : "Property"
188
+ }
189
+ }, {
190
+ "type" : "List",
191
+ "element" : [ {
192
+ "valueType" : "{urn:hl7-org:elm-types:r1}String",
193
+ "value" : "final",
194
+ "type" : "Literal"
195
+ }, {
196
+ "valueType" : "{urn:hl7-org:elm-types:r1}String",
197
+ "value" : "amended",
198
+ "type" : "Literal"
199
+ } ]
200
+ } ]
201
+ }
202
+ }
203
+ }, {
204
+ "name" : "BP: Diastolic",
205
+ "context" : "Patient",
206
+ "accessLevel" : "Public",
207
+ "expression" : {
208
+ "type" : "Query",
209
+ "source" : [ {
210
+ "alias" : "O",
211
+ "expression" : {
212
+ "dataType" : "{http://hl7.org/fhir}Observation",
213
+ "codeProperty" : "code",
214
+ "dateProperty" : "effectiveDateTime.value",
215
+ "type" : "Retrieve",
216
+ "codes" : {
217
+ "name" : "Diastolic blood pressure",
218
+ "type" : "ExpressionRef"
219
+ },
220
+ "dateRange" : {
221
+ "name" : "Lookback Interval One Year",
222
+ "type" : "ExpressionRef"
223
+ }
224
+ }
225
+ } ],
226
+ "relationship" : [ ],
227
+ "where" : {
228
+ "type" : "In",
229
+ "operand" : [ {
230
+ "path" : "value",
231
+ "type" : "Property",
232
+ "source" : {
233
+ "path" : "status",
234
+ "scope" : "O",
235
+ "type" : "Property"
236
+ }
237
+ }, {
238
+ "type" : "List",
239
+ "element" : [ {
240
+ "valueType" : "{urn:hl7-org:elm-types:r1}String",
241
+ "value" : "final",
242
+ "type" : "Literal"
243
+ }, {
244
+ "valueType" : "{urn:hl7-org:elm-types:r1}String",
245
+ "value" : "amended",
246
+ "type" : "Literal"
247
+ } ]
248
+ } ]
249
+ }
250
+ }
251
+ }, {
252
+ "name" : "BP: Systolic Less Than 140",
253
+ "context" : "Patient",
254
+ "accessLevel" : "Public",
255
+ "expression" : {
256
+ "type" : "Query",
257
+ "source" : [ {
258
+ "alias" : "S",
259
+ "expression" : {
260
+ "name" : "BP: Systolic",
261
+ "type" : "ExpressionRef"
262
+ }
263
+ } ],
264
+ "relationship" : [ ],
265
+ "where" : {
266
+ "type" : "Less",
267
+ "operand" : [ {
268
+ "path" : "value",
269
+ "type" : "Property",
270
+ "source" : {
271
+ "path" : "value",
272
+ "type" : "Property",
273
+ "source" : {
274
+ "path" : "valueQuantity",
275
+ "scope" : "S",
276
+ "type" : "Property"
277
+ }
278
+ }
279
+ }, {
280
+ "type" : "ToDecimal",
281
+ "operand" : {
282
+ "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
283
+ "value" : "140",
284
+ "type" : "Literal"
285
+ }
286
+ } ]
287
+ }
288
+ }
289
+ }, {
290
+ "name" : "BP: Systolic Greater Than/Equal To 140",
291
+ "context" : "Patient",
292
+ "accessLevel" : "Public",
293
+ "expression" : {
294
+ "type" : "Query",
295
+ "source" : [ {
296
+ "alias" : "S",
297
+ "expression" : {
298
+ "name" : "BP: Systolic",
299
+ "type" : "ExpressionRef"
300
+ }
301
+ } ],
302
+ "relationship" : [ ],
303
+ "where" : {
304
+ "type" : "GreaterOrEqual",
305
+ "operand" : [ {
306
+ "path" : "value",
307
+ "type" : "Property",
308
+ "source" : {
309
+ "path" : "value",
310
+ "type" : "Property",
311
+ "source" : {
312
+ "path" : "valueQuantity",
313
+ "scope" : "S",
314
+ "type" : "Property"
315
+ }
316
+ }
317
+ }, {
318
+ "type" : "ToDecimal",
319
+ "operand" : {
320
+ "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
321
+ "value" : "140",
322
+ "type" : "Literal"
323
+ }
324
+ } ]
325
+ }
326
+ }
327
+ }, {
328
+ "name" : "BP: Diastolic Less Than 80",
329
+ "context" : "Patient",
330
+ "accessLevel" : "Public",
331
+ "expression" : {
332
+ "type" : "Query",
333
+ "source" : [ {
334
+ "alias" : "D",
335
+ "expression" : {
336
+ "name" : "BP: Diastolic",
337
+ "type" : "ExpressionRef"
338
+ }
339
+ } ],
340
+ "relationship" : [ ],
341
+ "where" : {
342
+ "type" : "Less",
343
+ "operand" : [ {
344
+ "path" : "value",
345
+ "type" : "Property",
346
+ "source" : {
347
+ "path" : "value",
348
+ "type" : "Property",
349
+ "source" : {
350
+ "path" : "valueQuantity",
351
+ "scope" : "D",
352
+ "type" : "Property"
353
+ }
354
+ }
355
+ }, {
356
+ "type" : "ToDecimal",
357
+ "operand" : {
358
+ "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
359
+ "value" : "80",
360
+ "type" : "Literal"
361
+ }
362
+ } ]
363
+ }
364
+ }
365
+ }, {
366
+ "name" : "BP: Diastolic 80-89",
367
+ "context" : "Patient",
368
+ "accessLevel" : "Public",
369
+ "expression" : {
370
+ "type" : "Query",
371
+ "source" : [ {
372
+ "alias" : "D",
373
+ "expression" : {
374
+ "name" : "BP: Diastolic",
375
+ "type" : "ExpressionRef"
376
+ }
377
+ } ],
378
+ "relationship" : [ ],
379
+ "where" : {
380
+ "type" : "And",
381
+ "operand" : [ {
382
+ "type" : "GreaterOrEqual",
383
+ "operand" : [ {
384
+ "path" : "value",
385
+ "type" : "Property",
386
+ "source" : {
387
+ "path" : "value",
388
+ "type" : "Property",
389
+ "source" : {
390
+ "path" : "valueQuantity",
391
+ "scope" : "D",
392
+ "type" : "Property"
393
+ }
394
+ }
395
+ }, {
396
+ "type" : "ToDecimal",
397
+ "operand" : {
398
+ "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
399
+ "value" : "80",
400
+ "type" : "Literal"
401
+ }
402
+ } ]
403
+ }, {
404
+ "type" : "LessOrEqual",
405
+ "operand" : [ {
406
+ "path" : "value",
407
+ "type" : "Property",
408
+ "source" : {
409
+ "path" : "value",
410
+ "type" : "Property",
411
+ "source" : {
412
+ "path" : "valueQuantity",
413
+ "scope" : "D",
414
+ "type" : "Property"
415
+ }
416
+ }
417
+ }, {
418
+ "type" : "ToDecimal",
419
+ "operand" : {
420
+ "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
421
+ "value" : "89",
422
+ "type" : "Literal"
423
+ }
424
+ } ]
425
+ } ]
426
+ }
427
+ }
428
+ }, {
429
+ "name" : "BP: Diastolic Greater Than/Equal To 90",
430
+ "context" : "Patient",
431
+ "accessLevel" : "Public",
432
+ "expression" : {
433
+ "type" : "Query",
434
+ "source" : [ {
435
+ "alias" : "D",
436
+ "expression" : {
437
+ "name" : "BP: Diastolic",
438
+ "type" : "ExpressionRef"
439
+ }
440
+ } ],
441
+ "relationship" : [ ],
442
+ "where" : {
443
+ "type" : "GreaterOrEqual",
444
+ "operand" : [ {
445
+ "path" : "value",
446
+ "type" : "Property",
447
+ "source" : {
448
+ "path" : "value",
449
+ "type" : "Property",
450
+ "source" : {
451
+ "path" : "valueQuantity",
452
+ "scope" : "D",
453
+ "type" : "Property"
454
+ }
455
+ }
456
+ }, {
457
+ "type" : "ToDecimal",
458
+ "operand" : {
459
+ "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
460
+ "value" : "90",
461
+ "type" : "Literal"
462
+ }
463
+ } ]
464
+ }
465
+ }
466
+ } ]
467
+ }
468
+ }
469
+ }
470
+
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradle.properties ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ org.gradle.parallel=true
2
+ org.gradle.caching=true
3
+ org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC
4
+ org.gradle.workers.max=4
5
+
6
+ kotlin.daemon.jvm.options=-Xmx4g -XX:+UseParallelGC
7
+
8
+ systemProp.sonar.gradle.skipCompile=true
9
+
10
+ group=org.cqframework
11
+ specification.version=1.5.3
12
+ android.api.level=34
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradle/libs.versions.toml ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [versions]
2
+ hapi = "8.10.0"
3
+ xpp3 = "1.1.6"
4
+
5
+ ucum-java = "1.0.8"
6
+
7
+ kotlin = "2.3.10"
8
+ kotlinx-serialization = "1.9.0"
9
+ kotlinx-io = "0.8.0"
10
+ kotlinx-datetime = "0.7.1"
11
+ kotlinx-browser = "0.3"
12
+
13
+ kotlin-bignum = "0.3.10"
14
+ kotlin-logging = "8.0.01"
15
+
16
+ slf4j = "2.0.13"
17
+
18
+ antlr-kotlin = "1.0.12"
19
+ kotlinpoet = "2.2.0"
20
+ xsom = "4.0.6"
21
+
22
+ buildconfig = "6.0.7"
23
+ node-gradle = "7.1.0"
24
+ openrewrite-plugin = "7.26.0"
25
+ openrewrite = "8.62.6"
26
+
27
+ gson = "2.9.1"
28
+ parsson = "1.1.5"
29
+ apache-commons-compress = "1.24.0"
30
+ apache-commons-text = "1.10.0"
31
+ apache-xmlschema = "2.2.5"
32
+ jopt-simple = "4.7"
33
+
34
+ jaxb-xjc = "3.0.2"
35
+ jaxb-runtime = "4.0.5"
36
+ moxy = "4.0.2"
37
+ jakarta-xml-bind = "4.0.1"
38
+ jaxb2-commons = "3.0.0"
39
+ ant = "1.10.14"
40
+
41
+ junit = "5.10.2"
42
+ hamcrest-all = "1.3"
43
+ hamcrest-json = "0.2"
44
+ archunit = "1.2.1"
45
+ wiremock = "3.9.1"
46
+ mockito = "5.4.0"
47
+ reflections = "0.10.2"
48
+ xmlunit = "2.10.0"
49
+ jsonassert = "1.5.1"
50
+ easy-random = "5.0.0"
51
+
52
+ kover = "0.9.8"
53
+ dokka = "2.1.0"
54
+
55
+ spotless = "8.4.0"
56
+ detekt = "1.23.8"
57
+ sonarqube = "7.2.2.6593"
58
+ errorprone-gradle = "5.0.0"
59
+ animalsniffer = "2.0.1"
60
+
61
+ vanniktech-publish = "0.36.0"
62
+
63
+ task-tree = "4.0.1"
64
+
65
+ [libraries]
66
+ hapi-fhir-bom = { module = "ca.uhn.hapi.fhir:hapi-fhir-bom", version.ref = "hapi" }
67
+ hapi-fhir-base = { module = "ca.uhn.hapi.fhir:hapi-fhir-base" }
68
+ hapi-fhir-client = { module = "ca.uhn.hapi.fhir:hapi-fhir-client" }
69
+ hapi-fhir-converter = { module = "ca.uhn.hapi.fhir:hapi-fhir-converter" }
70
+ hapi-fhir-structures-hl7org-dstu2 = { module = "ca.uhn.hapi.fhir:hapi-fhir-structures-hl7org-dstu2" }
71
+ hapi-fhir-structures-dstu2 = { module = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2" }
72
+ hapi-fhir-structures-dstu3 = { module = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu3" }
73
+ hapi-fhir-structures-r4 = { module = "ca.uhn.hapi.fhir:hapi-fhir-structures-r4" }
74
+ hapi-fhir-structures-r5 = { module = "ca.uhn.hapi.fhir:hapi-fhir-structures-r5" }
75
+ xpp3 = { module = "org.ogce:xpp3", version.ref = "xpp3" }
76
+
77
+ ucum-java = { module = "org.fhir:ucum", version.ref = "ucum-java" }
78
+
79
+ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
80
+ kotlinx-serialization-json-io = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-io", version.ref = "kotlinx-serialization" }
81
+ kotlinx-io-core = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version.ref = "kotlinx-io" }
82
+ kotlinx-io-core-jvm = { module = "org.jetbrains.kotlinx:kotlinx-io-core-jvm", version.ref = "kotlinx-io" }
83
+ kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
84
+ kotlinx-browser = { module = "org.jetbrains.kotlinx:kotlinx-browser", version.ref = "kotlinx-browser" }
85
+
86
+ kotlin-bignum = { module = "com.ionspin.kotlin:bignum", version.ref = "kotlin-bignum" }
87
+ kotlin-logging = { module = "io.github.oshai:kotlin-logging", version.ref = "kotlin-logging" }
88
+
89
+ slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
90
+ slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
91
+
92
+ antlr-kotlin-gradle-plugin = { module = "com.strumenta:antlr-kotlin-gradle-plugin", version.ref = "antlr-kotlin" }
93
+ antlr-kotlin-runtime = { module = "com.strumenta:antlr-kotlin-runtime", version.ref = "antlr-kotlin" }
94
+ antlr-kotlin-runtime-jvm = { module = "com.strumenta:antlr-kotlin-runtime-jvm", version.ref = "antlr-kotlin" }
95
+ kotlinpoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinpoet" }
96
+ xsom = { module = "org.glassfish.jaxb:xsom", version.ref = "xsom" }
97
+
98
+ openrewrite-core = { module = "org.openrewrite:rewrite-core", version.ref = "openrewrite" }
99
+ openrewrite-kotlin = { module = "org.openrewrite:rewrite-kotlin", version.ref = "openrewrite" }
100
+ openrewrite-java = { module = "org.openrewrite:rewrite-java", version.ref = "openrewrite" }
101
+ openrewrite-test = { module = "org.openrewrite:rewrite-test", version.ref = "openrewrite" }
102
+
103
+ gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
104
+ parsson = { module = "org.eclipse.parsson:parsson", version.ref = "parsson" }
105
+ apache-commons-compress = { module = "org.apache.commons:commons-compress", version.ref = "apache-commons-compress" }
106
+ apache-commons-text = { module = "org.apache.commons:commons-text", version.ref = "apache-commons-text" }
107
+ apache-xmlschema-core = { module = "org.apache.ws.xmlschema:xmlschema-core", version.ref = "apache-xmlschema" }
108
+ apache-xmlschema-walker = { module = "org.apache.ws.xmlschema:xmlschema-walker", version.ref = "apache-xmlschema" }
109
+ jopt-simple = { module = "net.sf.jopt-simple:jopt-simple", version.ref = "jopt-simple" }
110
+
111
+ jaxb-xjc = { module = "org.glassfish.jaxb:jaxb-xjc", version.ref = "jaxb-xjc" }
112
+ jaxb-runtime = { module = "org.glassfish.jaxb:jaxb-runtime", version.ref = "jaxb-runtime" }
113
+ moxy = { module = "org.eclipse.persistence:org.eclipse.persistence.moxy", version.ref = "moxy" }
114
+ jakarta-xml-bind-api = { module = "jakarta.xml.bind:jakarta.xml.bind-api", version.ref = "jakarta-xml-bind" }
115
+ jaxb2-commons-basics-ant = { module = "codes.rafael.jaxb2_commons:jaxb2-basics-ant", version.ref = "jaxb2-commons" }
116
+ jaxb2-commons-basics = { module = "codes.rafael.jaxb2_commons:jaxb2-basics", version.ref = "jaxb2-commons" }
117
+ jaxb2-commons-fluent-api = { module = "codes.rafael.jaxb2_commons:jaxb2-fluent-api", version.ref = "jaxb2-commons" }
118
+ ant = { module = "org.apache.ant:ant", version.ref = "ant" }
119
+
120
+ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
121
+ kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin" }
122
+ junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
123
+ junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
124
+ junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }
125
+ hamcrest-all = { module = "org.hamcrest:hamcrest-all", version.ref = "hamcrest-all" }
126
+ hamcrest-json = { module = "uk.co.datumedge:hamcrest-json", version.ref = "hamcrest-json" }
127
+ archunit = { module = "com.tngtech.archunit:archunit", version.ref = "archunit" }
128
+ wiremock = { module = "org.wiremock:wiremock", version.ref = "wiremock" }
129
+ mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
130
+ reflections = { module = "org.reflections:reflections", version.ref = "reflections" }
131
+ xmlunit-assertj = { module = "org.xmlunit:xmlunit-assertj", version.ref = "xmlunit" }
132
+ jsonassert = { module = "org.skyscreamer:jsonassert", version.ref = "jsonassert" }
133
+ easy-random-core = { module = "org.jeasy:easy-random-core", version.ref = "easy-random" }
134
+
135
+ [plugins]
136
+ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
137
+ kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
138
+ kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
139
+
140
+ buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig" }
141
+ node-gradle = { id = "com.github.node-gradle.node", version.ref = "node-gradle" }
142
+ openrewrite = { id = "org.openrewrite.rewrite", version.ref = "openrewrite-plugin" }
143
+
144
+ kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
145
+ jacoco = { id = "jacoco" }
146
+ dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
147
+
148
+ spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
149
+ detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
150
+ sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }
151
+ errorprone = { id = "net.ltgt.errorprone", version.ref = "errorprone-gradle" }
152
+ animalsniffer = { id = "ru.vyarus.animalsniffer", version.ref = "animalsniffer" }
153
+
154
+ vanniktech-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-publish" }
155
+
156
+ task-tree = { id = "com.dorongold.task-tree", version.ref = "task-tree" }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradle/wrapper/gradle-wrapper.jar ADDED
Binary file (46.2 kB). View file
 
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradle/wrapper/gradle-wrapper.properties ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
4
+ networkTimeout=10000
5
+ validateDistributionUrl=true
6
+ zipStoreBase=GRADLE_USER_HOME
7
+ zipStorePath=wrapper/dists
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradlew ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015 the original authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # SPDX-License-Identifier: Apache-2.0
19
+ #
20
+
21
+ ##############################################################################
22
+ #
23
+ # Gradle start up script for POSIX generated by Gradle.
24
+ #
25
+ # Important for running:
26
+ #
27
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28
+ # noncompliant, but you have some other compliant shell such as ksh or
29
+ # bash, then to run this script, type that shell name before the whole
30
+ # command line, like:
31
+ #
32
+ # ksh Gradle
33
+ #
34
+ # Busybox and similar reduced shells will NOT work, because this script
35
+ # requires all of these POSIX shell features:
36
+ # * functions;
37
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39
+ # * compound commands having a testable exit status, especially «case»;
40
+ # * various built-in commands including «command», «set», and «ulimit».
41
+ #
42
+ # Important for patching:
43
+ #
44
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
45
+ # by Bash, Ksh, etc; in particular arrays are avoided.
46
+ #
47
+ # The "traditional" practice of packing multiple parameters into a
48
+ # space-separated string is a well documented source of bugs and security
49
+ # problems, so this is (mostly) avoided, by progressively accumulating
50
+ # options in "$@", and eventually passing that to Java.
51
+ #
52
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54
+ # see the in-line comments for details.
55
+ #
56
+ # There are tweaks for specific operating systems such as AIX, CygWin,
57
+ # Darwin, MinGW, and NonStop.
58
+ #
59
+ # (3) This script is generated from the Groovy template
60
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61
+ # within the Gradle project.
62
+ #
63
+ # You can find Gradle at https://github.com/gradle/gradle/.
64
+ #
65
+ ##############################################################################
66
+
67
+ # Attempt to set APP_HOME
68
+
69
+ # Resolve links: $0 may be a link
70
+ app_path=$0
71
+
72
+ # Need this for daisy-chained symlinks.
73
+ while
74
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75
+ [ -h "$app_path" ]
76
+ do
77
+ ls=$( ls -ld "$app_path" )
78
+ link=${ls#*' -> '}
79
+ case $link in #(
80
+ /*) app_path=$link ;; #(
81
+ *) app_path=$APP_HOME$link ;;
82
+ esac
83
+ done
84
+
85
+ # This is normally unused
86
+ # shellcheck disable=SC2034
87
+ APP_BASE_NAME=${0##*/}
88
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89
+ APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
90
+
91
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
92
+ MAX_FD=maximum
93
+
94
+ warn () {
95
+ echo "$*"
96
+ } >&2
97
+
98
+ die () {
99
+ echo
100
+ echo "$*"
101
+ echo
102
+ exit 1
103
+ } >&2
104
+
105
+ # OS specific support (must be 'true' or 'false').
106
+ cygwin=false
107
+ msys=false
108
+ darwin=false
109
+ nonstop=false
110
+ case "$( uname )" in #(
111
+ CYGWIN* ) cygwin=true ;; #(
112
+ Darwin* ) darwin=true ;; #(
113
+ MSYS* | MINGW* ) msys=true ;; #(
114
+ NONSTOP* ) nonstop=true ;;
115
+ esac
116
+
117
+
118
+
119
+ # Determine the Java command to use to start the JVM.
120
+ if [ -n "$JAVA_HOME" ] ; then
121
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
122
+ # IBM's JDK on AIX uses strange locations for the executables
123
+ JAVACMD=$JAVA_HOME/jre/sh/java
124
+ else
125
+ JAVACMD=$JAVA_HOME/bin/java
126
+ fi
127
+ if [ ! -x "$JAVACMD" ] ; then
128
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
129
+
130
+ Please set the JAVA_HOME variable in your environment to match the
131
+ location of your Java installation."
132
+ fi
133
+ else
134
+ JAVACMD=java
135
+ if ! command -v java >/dev/null 2>&1
136
+ then
137
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
138
+
139
+ Please set the JAVA_HOME variable in your environment to match the
140
+ location of your Java installation."
141
+ fi
142
+ fi
143
+
144
+ # Increase the maximum file descriptors if we can.
145
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
146
+ case $MAX_FD in #(
147
+ max*)
148
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
149
+ # shellcheck disable=SC2039,SC3045
150
+ MAX_FD=$( ulimit -H -n ) ||
151
+ warn "Could not query maximum file descriptor limit"
152
+ esac
153
+ case $MAX_FD in #(
154
+ '' | soft) :;; #(
155
+ *)
156
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
157
+ # shellcheck disable=SC2039,SC3045
158
+ ulimit -n "$MAX_FD" ||
159
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
160
+ esac
161
+ fi
162
+
163
+ # Collect all arguments for the java command, stacking in reverse order:
164
+ # * args from the command line
165
+ # * the main class name
166
+ # * -classpath
167
+ # * -D...appname settings
168
+ # * --module-path (only if needed)
169
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
170
+
171
+ # For Cygwin or MSYS, switch paths to Windows format before running java
172
+ if "$cygwin" || "$msys" ; then
173
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
174
+
175
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
176
+
177
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
178
+ for arg do
179
+ if
180
+ case $arg in #(
181
+ -*) false ;; # don't mess with options #(
182
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183
+ [ -e "$t" ] ;; #(
184
+ *) false ;;
185
+ esac
186
+ then
187
+ arg=$( cygpath --path --ignore --mixed "$arg" )
188
+ fi
189
+ # Roll the args list around exactly as many times as the number of
190
+ # args, so each arg winds up back in the position where it started, but
191
+ # possibly modified.
192
+ #
193
+ # NB: a `for` loop captures its iteration list before it begins, so
194
+ # changing the positional parameters here affects neither the number of
195
+ # iterations, nor the values presented in `arg`.
196
+ shift # remove old arg
197
+ set -- "$@" "$arg" # push replacement arg
198
+ done
199
+ fi
200
+
201
+
202
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204
+
205
+ # Collect all arguments for the java command:
206
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207
+ # and any embedded shellness will be escaped.
208
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209
+ # treated as '${Hostname}' itself on the command line.
210
+
211
+ set -- \
212
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
213
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
214
+ "$@"
215
+
216
+ # Stop when "xargs" is not available.
217
+ if ! command -v xargs >/dev/null 2>&1
218
+ then
219
+ die "xargs is not available"
220
+ fi
221
+
222
+ # Use "xargs" to parse quoted args.
223
+ #
224
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
225
+ #
226
+ # In Bash we could simply go:
227
+ #
228
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
229
+ # set -- "${ARGS[@]}" "$@"
230
+ #
231
+ # but POSIX shell has neither arrays nor command substitution, so instead we
232
+ # post-process each arg (as a line of input to sed) to backslash-escape any
233
+ # character that might be a shell metacharacter, then use eval to reverse
234
+ # that process (while maintaining the separation between arguments), and wrap
235
+ # the whole thing up as a single "set" statement.
236
+ #
237
+ # This will of course break if any of these variables contains a newline or
238
+ # an unmatched quote.
239
+ #
240
+
241
+ eval "set -- $(
242
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
243
+ xargs -n1 |
244
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
245
+ tr '\n' ' '
246
+ )" '"$@"'
247
+
248
+ exec "$JAVACMD" "$@"
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/gradlew.bat ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+ @rem SPDX-License-Identifier: Apache-2.0
17
+ @rem
18
+
19
+ @if "%DEBUG%"=="" @echo off
20
+ @rem ##########################################################################
21
+ @rem
22
+ @rem Gradle startup script for Windows
23
+ @rem
24
+ @rem ##########################################################################
25
+
26
+ @rem Set local scope for the variables with windows NT shell
27
+ if "%OS%"=="Windows_NT" setlocal
28
+
29
+ set DIRNAME=%~dp0
30
+ if "%DIRNAME%"=="" set DIRNAME=.
31
+ @rem This is normally unused
32
+ set APP_BASE_NAME=%~n0
33
+ set APP_HOME=%DIRNAME%
34
+
35
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37
+
38
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40
+
41
+ @rem Find java.exe
42
+ if defined JAVA_HOME goto findJavaFromJavaHome
43
+
44
+ set JAVA_EXE=java.exe
45
+ %JAVA_EXE% -version >NUL 2>&1
46
+ if %ERRORLEVEL% equ 0 goto execute
47
+
48
+ echo. 1>&2
49
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50
+ echo. 1>&2
51
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52
+ echo location of your Java installation. 1>&2
53
+
54
+ goto fail
55
+
56
+ :findJavaFromJavaHome
57
+ set JAVA_HOME=%JAVA_HOME:"=%
58
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59
+
60
+ if exist "%JAVA_EXE%" goto execute
61
+
62
+ echo. 1>&2
63
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64
+ echo. 1>&2
65
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66
+ echo location of your Java installation. 1>&2
67
+
68
+ goto fail
69
+
70
+ :execute
71
+ @rem Setup the command line
72
+
73
+
74
+
75
+ @rem Execute Gradle
76
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
77
+
78
+ :end
79
+ @rem End local scope for the variables with windows NT shell
80
+ if %ERRORLEVEL% equ 0 goto mainEnd
81
+
82
+ :fail
83
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
84
+ rem the _cmd.exe /c_ return code!
85
+ set EXIT_CODE=%ERRORLEVEL%
86
+ if %EXIT_CODE% equ 0 set EXIT_CODE=1
87
+ if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
88
+ exit /b %EXIT_CODE%
89
+
90
+ :mainEnd
91
+ if "%OS%"=="Windows_NT" endlocal
92
+
93
+ :omega
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/grammar/cql.g4 ADDED
@@ -0,0 +1,965 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ grammar cql;
2
+
3
+ /*
4
+ * Clinical Quality Language Grammar Specification
5
+ * Version 1.5 - Mixed Normative/Trial-Use
6
+ */
7
+
8
+ import fhirpath;
9
+
10
+ /*
11
+ * Parser Rules
12
+ */
13
+
14
+ definition
15
+ : usingDefinition
16
+ | includeDefinition
17
+ | codesystemDefinition
18
+ | valuesetDefinition
19
+ | codeDefinition
20
+ | conceptDefinition
21
+ | parameterDefinition
22
+ ;
23
+
24
+ library
25
+ :
26
+ libraryDefinition?
27
+ definition*
28
+ statement*
29
+ EOF
30
+ ;
31
+
32
+ /*
33
+ * Definitions
34
+ */
35
+
36
+ libraryDefinition
37
+ : 'library' qualifiedIdentifier ('version' versionSpecifier)?
38
+ ;
39
+
40
+ usingDefinition
41
+ : 'using' qualifiedIdentifier ('version' versionSpecifier)? ('called' localIdentifier)?
42
+ ;
43
+
44
+ includeDefinition
45
+ : 'include' qualifiedIdentifier ('version' versionSpecifier)? ('called' localIdentifier)?
46
+ ;
47
+
48
+ localIdentifier
49
+ : identifier
50
+ ;
51
+
52
+ accessModifier
53
+ : 'public'
54
+ | 'private'
55
+ ;
56
+
57
+ parameterDefinition
58
+ : accessModifier? 'parameter' identifier (typeSpecifier)? ('default' expression)?
59
+ ;
60
+
61
+ codesystemDefinition
62
+ : accessModifier? 'codesystem' identifier ':' codesystemId ('version' versionSpecifier)?
63
+ ;
64
+
65
+ valuesetDefinition
66
+ : accessModifier? 'valueset' identifier ':' valuesetId ('version' versionSpecifier)? codesystems?
67
+ ;
68
+
69
+ codesystems
70
+ : 'codesystems' '{' codesystemIdentifier (',' codesystemIdentifier)* '}'
71
+ ;
72
+
73
+ codesystemIdentifier
74
+ : (libraryIdentifier '.')? identifier
75
+ ;
76
+
77
+ libraryIdentifier
78
+ : identifier
79
+ ;
80
+
81
+ codeDefinition
82
+ : accessModifier? 'code' identifier ':' codeId 'from' codesystemIdentifier displayClause?
83
+ ;
84
+
85
+ conceptDefinition
86
+ : accessModifier? 'concept' identifier ':' '{' codeIdentifier (',' codeIdentifier)* '}' displayClause?
87
+ ;
88
+
89
+ codeIdentifier
90
+ : (libraryIdentifier '.')? identifier
91
+ ;
92
+
93
+ codesystemId
94
+ : STRING
95
+ ;
96
+
97
+ valuesetId
98
+ : STRING
99
+ ;
100
+
101
+ versionSpecifier
102
+ : STRING
103
+ ;
104
+
105
+ codeId
106
+ : STRING
107
+ ;
108
+
109
+ /*
110
+ * Type Specifiers
111
+ */
112
+
113
+ typeSpecifier
114
+ : namedTypeSpecifier
115
+ | listTypeSpecifier
116
+ | intervalTypeSpecifier
117
+ | tupleTypeSpecifier
118
+ | choiceTypeSpecifier
119
+ ;
120
+
121
+ namedTypeSpecifier
122
+ : (qualifier '.')* referentialOrTypeNameIdentifier
123
+ ;
124
+
125
+ modelIdentifier
126
+ : identifier
127
+ ;
128
+
129
+ listTypeSpecifier
130
+ : 'List' '<' typeSpecifier '>'
131
+ ;
132
+
133
+ intervalTypeSpecifier
134
+ : 'Interval' '<' typeSpecifier '>'
135
+ ;
136
+
137
+ tupleTypeSpecifier
138
+ : 'Tuple' '{' tupleElementDefinition (',' tupleElementDefinition)* '}'
139
+ ;
140
+
141
+ tupleElementDefinition
142
+ : referentialIdentifier typeSpecifier
143
+ ;
144
+
145
+ choiceTypeSpecifier
146
+ : 'Choice' '<' typeSpecifier (',' typeSpecifier)* '>'
147
+ ;
148
+
149
+ /*
150
+ * Statements
151
+ */
152
+
153
+ statement
154
+ : expressionDefinition
155
+ | contextDefinition
156
+ | functionDefinition
157
+ ;
158
+
159
+ expressionDefinition
160
+ : 'define' accessModifier? identifier ':' expression
161
+ ;
162
+
163
+ contextDefinition
164
+ : 'context' (modelIdentifier '.')? identifier
165
+ ;
166
+
167
+ fluentModifier
168
+ : 'fluent'
169
+ ;
170
+
171
+ functionDefinition
172
+ : 'define' accessModifier? fluentModifier? 'function' identifierOrFunctionIdentifier '(' (operandDefinition (',' operandDefinition)*)? ')'
173
+ ('returns' typeSpecifier)?
174
+ ':' (functionBody | 'external')
175
+ ;
176
+
177
+ operandDefinition
178
+ : referentialIdentifier typeSpecifier
179
+ ;
180
+
181
+ functionBody
182
+ : expression
183
+ ;
184
+
185
+ /*
186
+ * Expressions
187
+ */
188
+
189
+ querySource
190
+ : retrieve
191
+ | qualifiedIdentifierExpression
192
+ | '(' expression ')'
193
+ ;
194
+
195
+ aliasedQuerySource
196
+ : querySource alias
197
+ ;
198
+
199
+ alias
200
+ : identifier
201
+ ;
202
+
203
+ queryInclusionClause
204
+ : withClause
205
+ | withoutClause
206
+ ;
207
+
208
+ withClause
209
+ : 'with' aliasedQuerySource 'such that' expression
210
+ ;
211
+
212
+ withoutClause
213
+ : 'without' aliasedQuerySource 'such that' expression
214
+ ;
215
+
216
+ retrieve
217
+ : '[' (contextIdentifier '->')? namedTypeSpecifier (':' (codePath codeComparator)? terminology)? ']'
218
+ ;
219
+
220
+ contextIdentifier
221
+ : qualifiedIdentifierExpression
222
+ ;
223
+
224
+ codePath
225
+ : simplePath
226
+ ;
227
+
228
+ codeComparator
229
+ : 'in'
230
+ | '='
231
+ | '~'
232
+ ;
233
+
234
+ terminology
235
+ : qualifiedIdentifierExpression
236
+ | expression
237
+ ;
238
+
239
+ qualifier
240
+ : identifier
241
+ ;
242
+
243
+ query
244
+ : sourceClause letClause? queryInclusionClause* whereClause? (aggregateClause | returnClause)? sortClause?
245
+ ;
246
+
247
+ sourceClause
248
+ : 'from'? aliasedQuerySource (',' aliasedQuerySource)*
249
+ ;
250
+
251
+ letClause
252
+ : 'let' letClauseItem (',' letClauseItem)*
253
+ ;
254
+
255
+ letClauseItem
256
+ : identifier ':' expression
257
+ ;
258
+
259
+ whereClause
260
+ : 'where' expression
261
+ ;
262
+
263
+ returnClause
264
+ : 'return' ('all' | 'distinct')? expression
265
+ ;
266
+
267
+ aggregateClause
268
+ : 'aggregate' ('all' | 'distinct')? identifier startingClause? ':' expression
269
+ ;
270
+
271
+ startingClause
272
+ : 'starting' (simpleLiteral | quantity | ('(' expression ')'))
273
+ ;
274
+
275
+ sortClause
276
+ : 'sort' ( sortDirection | ('by' sortByItem (',' sortByItem)*) )
277
+ ;
278
+
279
+ sortDirection
280
+ : 'asc' | 'ascending'
281
+ | 'desc' | 'descending'
282
+ ;
283
+
284
+ sortByItem
285
+ : expressionTerm sortDirection?
286
+ ;
287
+
288
+ qualifiedIdentifier
289
+ : (qualifier '.')* identifier
290
+ ;
291
+
292
+ qualifiedIdentifierExpression
293
+ : (qualifierExpression '.')* referentialIdentifier
294
+ ;
295
+
296
+ qualifierExpression
297
+ : referentialIdentifier
298
+ ;
299
+
300
+ simplePath
301
+ : referentialIdentifier #simplePathReferentialIdentifier
302
+ | simplePath '.' referentialIdentifier #simplePathQualifiedIdentifier
303
+ | simplePath '[' simpleLiteral ']' #simplePathIndexer
304
+ ;
305
+
306
+ simpleLiteral
307
+ : STRING #simpleStringLiteral
308
+ | NUMBER #simpleNumberLiteral
309
+ ;
310
+
311
+ expression
312
+ : expressionTerm #termExpression
313
+ | retrieve #retrieveExpression
314
+ | query #queryExpression
315
+ | expression 'is' 'not'? ('null' | 'true' | 'false') #booleanExpression
316
+ | expression ('is' | 'as') typeSpecifier #typeExpression
317
+ | 'cast' expression 'as' typeSpecifier #castExpression
318
+ | 'not' expression #notExpression
319
+ | 'exists' expression #existenceExpression
320
+ | expression 'properly'? 'between' expressionTerm 'and' expressionTerm #betweenExpression
321
+ | ('duration' 'in')? pluralDateTimePrecision 'between' expressionTerm 'and' expressionTerm #durationBetweenExpression
322
+ | 'difference' 'in' pluralDateTimePrecision 'between' expressionTerm 'and' expressionTerm #differenceBetweenExpression
323
+ | expression ('|' | 'union' | 'intersect' | 'except') expression #inFixSetExpression
324
+ | expression ('<=' | '<' | '>' | '>=') expression #inequalityExpression
325
+ | expression intervalOperatorPhrase expression #timingExpression
326
+ | expression ('=' | '!=' | '~' | '!~') expression #equalityExpression
327
+ | expression ('in' | 'contains') dateTimePrecisionSpecifier? expression #membershipExpression
328
+ | expression 'and' expression #andExpression
329
+ | expression ('or' | 'xor') expression #orExpression
330
+ | expression 'implies' expression #impliesExpression
331
+ ;
332
+
333
+ dateTimePrecision
334
+ : 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'
335
+ ;
336
+
337
+ dateTimeComponent
338
+ : dateTimePrecision
339
+ | 'date'
340
+ | 'time'
341
+ | 'timezone' // NOTE: 1.3 compatibility level only
342
+ | 'timezoneoffset'
343
+ ;
344
+
345
+ pluralDateTimePrecision
346
+ : 'years' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds'
347
+ ;
348
+
349
+ expressionTerm
350
+ : term #termExpressionTerm
351
+ | expressionTerm '.' qualifiedInvocation #invocationExpressionTerm
352
+ | expressionTerm '[' expression ']' #indexedExpressionTerm
353
+ | 'convert' expression 'to' (typeSpecifier | unit) #conversionExpressionTerm
354
+ | ('+' | '-') expressionTerm #polarityExpressionTerm
355
+ | ('start' | 'end') 'of' expressionTerm #timeBoundaryExpressionTerm
356
+ | dateTimeComponent 'from' expressionTerm #timeUnitExpressionTerm
357
+ | 'duration' 'in' pluralDateTimePrecision 'of' expressionTerm #durationExpressionTerm
358
+ | 'difference' 'in' pluralDateTimePrecision 'of' expressionTerm #differenceExpressionTerm
359
+ | 'width' 'of' expressionTerm #widthExpressionTerm
360
+ | 'successor' 'of' expressionTerm #successorExpressionTerm
361
+ | 'predecessor' 'of' expressionTerm #predecessorExpressionTerm
362
+ | 'singleton' 'from' expressionTerm #elementExtractorExpressionTerm
363
+ | 'point' 'from' expressionTerm #pointExtractorExpressionTerm
364
+ | ('minimum' | 'maximum') namedTypeSpecifier #typeExtentExpressionTerm
365
+ | expressionTerm '^' expressionTerm #powerExpressionTerm
366
+ | expressionTerm ('*' | '/' | 'div' | 'mod') expressionTerm #multiplicationExpressionTerm
367
+ | expressionTerm ('+' | '-' | '&') expressionTerm #additionExpressionTerm
368
+ | 'if' expression 'then' expression 'else' expression #ifThenElseExpressionTerm
369
+ | 'case' expression? caseExpressionItem+ 'else' expression 'end' #caseExpressionTerm
370
+ | ('distinct' | 'flatten') expression #aggregateExpressionTerm
371
+ | ('expand' | 'collapse') expression ('per' (dateTimePrecision | expression))? #setAggregateExpressionTerm
372
+ ;
373
+
374
+ caseExpressionItem
375
+ : 'when' expression 'then' expression
376
+ ;
377
+
378
+ dateTimePrecisionSpecifier
379
+ : dateTimePrecision 'of'
380
+ ;
381
+
382
+ relativeQualifier
383
+ : 'or before'
384
+ | 'or after'
385
+ ;
386
+
387
+ offsetRelativeQualifier
388
+ : 'or more'
389
+ | 'or less'
390
+ ;
391
+
392
+ exclusiveRelativeQualifier
393
+ : 'less than'
394
+ | 'more than'
395
+ ;
396
+
397
+ quantityOffset
398
+ : (quantity offsetRelativeQualifier?)
399
+ | (exclusiveRelativeQualifier quantity)
400
+ ;
401
+
402
+ temporalRelationship
403
+ : ('on or'? ('before' | 'after'))
404
+ | (('before' | 'after') 'or on'?)
405
+ ;
406
+
407
+ intervalOperatorPhrase
408
+ : ('starts' | 'ends' | 'occurs')? 'same' dateTimePrecision? (relativeQualifier | 'as') ('start' | 'end')? #concurrentWithIntervalOperatorPhrase
409
+ | 'properly'? 'includes' dateTimePrecisionSpecifier? ('start' | 'end')? #includesIntervalOperatorPhrase
410
+ | ('starts' | 'ends' | 'occurs')? 'properly'? ('during' | 'included in') dateTimePrecisionSpecifier? #includedInIntervalOperatorPhrase
411
+ | ('starts' | 'ends' | 'occurs')? quantityOffset? temporalRelationship dateTimePrecisionSpecifier? ('start' | 'end')? #beforeOrAfterIntervalOperatorPhrase
412
+ | ('starts' | 'ends' | 'occurs')? 'properly'? 'within' quantity 'of' ('start' | 'end')? #withinIntervalOperatorPhrase
413
+ | 'meets' ('before' | 'after')? dateTimePrecisionSpecifier? #meetsIntervalOperatorPhrase
414
+ | 'overlaps' ('before' | 'after')? dateTimePrecisionSpecifier? #overlapsIntervalOperatorPhrase
415
+ | 'starts' dateTimePrecisionSpecifier? #startsIntervalOperatorPhrase
416
+ | 'ends' dateTimePrecisionSpecifier? #endsIntervalOperatorPhrase
417
+ ;
418
+
419
+ term
420
+ : invocation #invocationTerm
421
+ | literal #literalTerm
422
+ | externalConstant #externalConstantTerm
423
+ | intervalSelector #intervalSelectorTerm
424
+ | tupleSelector #tupleSelectorTerm
425
+ | instanceSelector #instanceSelectorTerm
426
+ | listSelector #listSelectorTerm
427
+ | codeSelector #codeSelectorTerm
428
+ | conceptSelector #conceptSelectorTerm
429
+ | '(' expression ')' #parenthesizedTerm
430
+ ;
431
+
432
+ qualifiedInvocation // Terms that can be used after the function/member invocation '.'
433
+ : referentialIdentifier #qualifiedMemberInvocation
434
+ | qualifiedFunction #qualifiedFunctionInvocation
435
+ ;
436
+
437
+ qualifiedFunction
438
+ : identifierOrFunctionIdentifier '(' paramList? ')'
439
+ ;
440
+
441
+ invocation
442
+ : referentialIdentifier #memberInvocation
443
+ | function #functionInvocation
444
+ | '$this' #thisInvocation
445
+ | '$index' #indexInvocation
446
+ | '$total' #totalInvocation
447
+ ;
448
+
449
+ function
450
+ : referentialIdentifier '(' paramList? ')'
451
+ ;
452
+
453
+ ratio
454
+ : quantity ':' quantity
455
+ ;
456
+
457
+ literal
458
+ : ('true' | 'false') #booleanLiteral
459
+ | 'null' #nullLiteral
460
+ | STRING #stringLiteral
461
+ | NUMBER #numberLiteral
462
+ | LONGNUMBER #longNumberLiteral
463
+ | DATETIME #dateTimeLiteral
464
+ | DATE #dateLiteral
465
+ | TIME #timeLiteral
466
+ | quantity #quantityLiteral
467
+ | ratio #ratioLiteral
468
+ ;
469
+
470
+ externalConstant
471
+ : '%' ( keywordIdentifier | identifier | STRING )
472
+ ;
473
+
474
+ intervalSelector
475
+ : // TODO: Consider this as an alternative syntax for intervals... (would need to be moved up to expression to make it work)
476
+ //expression ( '..' | '*.' | '.*' | '**' ) expression;
477
+ 'Interval' ('['|'(') expression ',' expression (']'|')')
478
+ ;
479
+
480
+ tupleSelector
481
+ : 'Tuple'? '{' (':' | (tupleElementSelector (',' tupleElementSelector)*)) '}'
482
+ ;
483
+
484
+ tupleElementSelector
485
+ : referentialIdentifier ':' expression
486
+ ;
487
+
488
+ instanceSelector
489
+ : namedTypeSpecifier '{' (':' | (instanceElementSelector (',' instanceElementSelector)*)) '}'
490
+ ;
491
+
492
+ instanceElementSelector
493
+ : referentialIdentifier ':' expression
494
+ ;
495
+
496
+ listSelector
497
+ : ('List' ('<' typeSpecifier '>')?)? '{' (expression (',' expression)*)? '}'
498
+ ;
499
+
500
+ displayClause
501
+ : 'display' STRING
502
+ ;
503
+
504
+ codeSelector
505
+ : 'Code' STRING 'from' codesystemIdentifier displayClause?
506
+ ;
507
+
508
+ conceptSelector
509
+ : 'Concept' '{' codeSelector (',' codeSelector)* '}' displayClause?
510
+ ;
511
+
512
+ keyword
513
+ : 'after'
514
+ | 'aggregate'
515
+ | 'all'
516
+ | 'and'
517
+ | 'as'
518
+ | 'asc'
519
+ | 'ascending'
520
+ | 'before'
521
+ | 'between'
522
+ | 'by'
523
+ | 'called'
524
+ | 'case'
525
+ | 'cast'
526
+ | 'code'
527
+ | 'Code'
528
+ | 'codesystem'
529
+ | 'codesystems'
530
+ | 'collapse'
531
+ | 'concept'
532
+ | 'Concept'
533
+ | 'contains'
534
+ | 'context'
535
+ | 'convert'
536
+ | 'date'
537
+ | 'day'
538
+ | 'days'
539
+ | 'default'
540
+ | 'define'
541
+ | 'desc'
542
+ | 'descending'
543
+ | 'difference'
544
+ | 'display'
545
+ | 'distinct'
546
+ | 'div'
547
+ | 'duration'
548
+ | 'during'
549
+ | 'else'
550
+ | 'end'
551
+ | 'ends'
552
+ | 'except'
553
+ | 'exists'
554
+ | 'expand'
555
+ | 'false'
556
+ | 'flatten'
557
+ | 'fluent'
558
+ | 'from'
559
+ | 'function'
560
+ | 'hour'
561
+ | 'hours'
562
+ | 'if'
563
+ | 'implies'
564
+ | 'in'
565
+ | 'include'
566
+ | 'includes'
567
+ | 'included in'
568
+ | 'intersect'
569
+ | 'Interval'
570
+ | 'is'
571
+ | 'let'
572
+ | 'library'
573
+ | 'List'
574
+ | 'maximum'
575
+ | 'meets'
576
+ | 'millisecond'
577
+ | 'milliseconds'
578
+ | 'minimum'
579
+ | 'minute'
580
+ | 'minutes'
581
+ | 'mod'
582
+ | 'month'
583
+ | 'months'
584
+ | 'not'
585
+ | 'null'
586
+ | 'occurs'
587
+ | 'of'
588
+ | 'on or'
589
+ | 'or'
590
+ | 'or after'
591
+ | 'or before'
592
+ | 'or less'
593
+ | 'or more'
594
+ | 'or on'
595
+ | 'overlaps'
596
+ | 'parameter'
597
+ | 'per'
598
+ | 'point'
599
+ | 'predecessor'
600
+ | 'private'
601
+ | 'properly'
602
+ | 'public'
603
+ | 'return'
604
+ | 'same'
605
+ | 'second'
606
+ | 'seconds'
607
+ | 'singleton'
608
+ | 'start'
609
+ | 'starting'
610
+ | 'starts'
611
+ | 'sort'
612
+ | 'successor'
613
+ | 'such that'
614
+ | 'then'
615
+ | 'time'
616
+ | 'timezone' // NOTE: 1.3 Compatibility level only
617
+ | 'timezoneoffset'
618
+ | 'to'
619
+ | 'true'
620
+ | 'Tuple'
621
+ | 'union'
622
+ | 'using'
623
+ | 'valueset'
624
+ | 'version'
625
+ | 'week'
626
+ | 'weeks'
627
+ | 'where'
628
+ | 'when'
629
+ | 'width'
630
+ | 'with'
631
+ | 'within'
632
+ | 'without'
633
+ | 'xor'
634
+ | 'year'
635
+ | 'years'
636
+ ;
637
+
638
+ // NOTE: Not used, this is the set of reserved words that may not appear as identifiers in ambiguous contexts
639
+ reservedWord
640
+ : 'aggregate'
641
+ | 'all'
642
+ | 'and'
643
+ | 'as'
644
+ | 'after'
645
+ | 'before'
646
+ | 'between'
647
+ | 'case'
648
+ | 'cast'
649
+ | 'Code'
650
+ | 'collapse'
651
+ | 'Concept'
652
+ | 'convert'
653
+ | 'day'
654
+ | 'days'
655
+ | 'difference'
656
+ | 'distinct'
657
+ | 'duration'
658
+ | 'during'
659
+ | 'else'
660
+ | 'exists'
661
+ | 'expand'
662
+ | 'false'
663
+ | 'flatten'
664
+ | 'from'
665
+ | 'if'
666
+ | 'in'
667
+ | 'included in'
668
+ | 'is'
669
+ | 'hour'
670
+ | 'hours'
671
+ | 'Interval'
672
+ | 'let'
673
+ | 'List'
674
+ | 'maximum'
675
+ | 'millisecond'
676
+ | 'milliseconds'
677
+ | 'minimum'
678
+ | 'minute'
679
+ | 'minutes'
680
+ | 'month'
681
+ | 'months'
682
+ | 'not'
683
+ | 'null'
684
+ | 'occurs'
685
+ | 'of'
686
+ | 'on or'
687
+ | 'or'
688
+ | 'or on'
689
+ | 'per'
690
+ | 'point'
691
+ | 'properly'
692
+ | 'return'
693
+ | 'same'
694
+ | 'second'
695
+ | 'seconds'
696
+ | 'singleton'
697
+ | 'sort'
698
+ | 'such that'
699
+ | 'then'
700
+ | 'to'
701
+ | 'true'
702
+ | 'Tuple'
703
+ | 'week'
704
+ | 'weeks'
705
+ | 'when'
706
+ | 'with'
707
+ | 'within'
708
+ | 'without'
709
+ | 'year'
710
+ | 'years'
711
+ ;
712
+
713
+ // Keyword identifiers are keywords that may be used as identifiers in a referential context
714
+ // Effectively, keyword except reservedWord
715
+ keywordIdentifier
716
+ : 'asc'
717
+ | 'ascending'
718
+ | 'by'
719
+ | 'called'
720
+ | 'code'
721
+ | 'codesystem'
722
+ | 'codesystems'
723
+ | 'concept'
724
+ | 'contains'
725
+ | 'context'
726
+ | 'date'
727
+ | 'default'
728
+ | 'define'
729
+ | 'desc'
730
+ | 'descending'
731
+ | 'display'
732
+ | 'div'
733
+ | 'end'
734
+ | 'ends'
735
+ | 'except'
736
+ | 'fluent'
737
+ | 'function'
738
+ | 'implies'
739
+ | 'include'
740
+ | 'includes'
741
+ | 'intersect'
742
+ | 'library'
743
+ | 'meets'
744
+ | 'mod'
745
+ | 'or after'
746
+ | 'or before'
747
+ | 'or less'
748
+ | 'or more'
749
+ | 'overlaps'
750
+ | 'parameter'
751
+ | 'predecessor'
752
+ | 'private'
753
+ | 'public'
754
+ | 'start'
755
+ | 'starting'
756
+ | 'starts'
757
+ | 'successor'
758
+ | 'time'
759
+ | 'timezone' // NOTE: 1.3 Compatibility Level only
760
+ | 'timezoneoffset'
761
+ | 'union'
762
+ | 'using'
763
+ | 'valueset'
764
+ | 'version'
765
+ | 'where'
766
+ | 'width'
767
+ | 'xor'
768
+ ;
769
+
770
+ // Obsolete identifiers are keywords that could be used as identifiers in CQL 1.3
771
+ // NOTE: Not currently used, this is the set of keywords that were defined as allowed identifiers as part of 1.3
772
+ // NOTE: Several keywords were commented out in this list (notably exists) because of an issue with the ANTLR tooling.
773
+ // In 4.5, having these keywords as identifiers results in unacceptable parsing performance. In 4.6+, having them as
774
+ // identifiers resulted in incorrect parsing. See Github issue [#343](https://github.com/cqframework/clinical_quality_language/issues/343) for more detail
775
+ // This should no longer be an issue with 1.4 due to the introduction of reserved words
776
+ obsoleteIdentifier
777
+ : 'all'
778
+ | 'Code'
779
+ | 'code'
780
+ | 'Concept'
781
+ | 'concept'
782
+ | 'contains'
783
+ | 'date'
784
+ | 'display'
785
+ | 'distinct'
786
+ | 'end'
787
+ | 'exists'
788
+ | 'not'
789
+ | 'start'
790
+ | 'time'
791
+ | 'timezone' // NOTE: 1.3 Compatibility level only
792
+ | 'timezoneoffset'
793
+ | 'version'
794
+ | 'where'
795
+ ;
796
+
797
+ // Function identifiers are keywords that may be used as identifiers for functions
798
+ functionIdentifier
799
+ : 'after'
800
+ | 'aggregate'
801
+ | 'all'
802
+ | 'and'
803
+ | 'as'
804
+ | 'asc'
805
+ | 'ascending'
806
+ | 'before'
807
+ | 'between'
808
+ | 'by'
809
+ | 'called'
810
+ | 'case'
811
+ | 'cast'
812
+ | 'code'
813
+ | 'Code'
814
+ | 'codesystem'
815
+ | 'codesystems'
816
+ | 'collapse'
817
+ | 'concept'
818
+ | 'Concept'
819
+ | 'contains'
820
+ | 'context'
821
+ | 'convert'
822
+ | 'date'
823
+ | 'day'
824
+ | 'days'
825
+ | 'default'
826
+ | 'define'
827
+ | 'desc'
828
+ | 'descending'
829
+ | 'difference'
830
+ | 'display'
831
+ | 'distinct'
832
+ | 'div'
833
+ | 'duration'
834
+ | 'during'
835
+ | 'else'
836
+ | 'end'
837
+ | 'ends'
838
+ | 'except'
839
+ | 'exists'
840
+ | 'expand'
841
+ | 'false'
842
+ | 'flatten'
843
+ | 'fluent'
844
+ | 'from'
845
+ | 'function'
846
+ | 'hour'
847
+ | 'hours'
848
+ | 'if'
849
+ | 'implies'
850
+ | 'in'
851
+ | 'include'
852
+ | 'includes'
853
+ | 'included in'
854
+ | 'intersect'
855
+ | 'Interval'
856
+ | 'is'
857
+ | 'let'
858
+ | 'library'
859
+ | 'List'
860
+ | 'maximum'
861
+ | 'meets'
862
+ | 'millisecond'
863
+ | 'milliseconds'
864
+ | 'minimum'
865
+ | 'minute'
866
+ | 'minutes'
867
+ | 'mod'
868
+ | 'month'
869
+ | 'months'
870
+ | 'not'
871
+ | 'null'
872
+ | 'occurs'
873
+ | 'of'
874
+ | 'or'
875
+ | 'or after'
876
+ | 'or before'
877
+ | 'or less'
878
+ | 'or more'
879
+ | 'overlaps'
880
+ | 'parameter'
881
+ | 'per'
882
+ | 'point'
883
+ | 'predecessor'
884
+ | 'private'
885
+ | 'properly'
886
+ | 'public'
887
+ | 'return'
888
+ | 'same'
889
+ | 'singleton'
890
+ | 'second'
891
+ | 'seconds'
892
+ | 'start'
893
+ | 'starting'
894
+ | 'starts'
895
+ | 'sort'
896
+ | 'successor'
897
+ | 'such that'
898
+ | 'then'
899
+ | 'time'
900
+ | 'timezone' // NOTE: 1.3 Compatibility level only
901
+ | 'timezoneoffset'
902
+ | 'to'
903
+ | 'true'
904
+ | 'Tuple'
905
+ | 'union'
906
+ | 'using'
907
+ | 'valueset'
908
+ | 'version'
909
+ | 'week'
910
+ | 'weeks'
911
+ | 'where'
912
+ | 'when'
913
+ | 'width'
914
+ | 'with'
915
+ | 'within'
916
+ | 'without'
917
+ | 'xor'
918
+ | 'year'
919
+ | 'years'
920
+ ;
921
+
922
+ // Reserved words that are also type names
923
+ typeNameIdentifier
924
+ : 'Code'
925
+ | 'Concept'
926
+ | 'date'
927
+ | 'time'
928
+ ;
929
+
930
+ referentialIdentifier
931
+ : identifier
932
+ | keywordIdentifier
933
+ ;
934
+
935
+ referentialOrTypeNameIdentifier
936
+ : referentialIdentifier
937
+ | typeNameIdentifier
938
+ ;
939
+
940
+ identifierOrFunctionIdentifier
941
+ : identifier
942
+ | functionIdentifier
943
+ ;
944
+
945
+ identifier
946
+ : IDENTIFIER
947
+ | DELIMITEDIDENTIFIER
948
+ | QUOTEDIDENTIFIER
949
+ ;
950
+
951
+ QUOTEDIDENTIFIER
952
+ : '"' (ESC | .)*? '"'
953
+ ;
954
+
955
+ DATETIME
956
+ : '@' DATEFORMAT 'T' TIMEFORMAT? TIMEZONEOFFSETFORMAT?
957
+ ;
958
+
959
+ LONGNUMBER
960
+ : [0-9]+'L'
961
+ ;
962
+
963
+ fragment ESC
964
+ : '\\' ([`'"\\/fnrt] | UNICODE) // allow \`, \', \", \\, \/, \f, etc. and \uXXX
965
+ ;
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/grammar/fhirpath.g4 ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ grammar fhirpath;
2
+
3
+ // Grammar rules
4
+ // [FHIRPath](http://hl7.org/fhirpath/N1) Normative Release
5
+
6
+ //prog: line (line)*;
7
+ //line: ID ( '(' expr ')') ':' expr '\r'? '\n';
8
+
9
+ expression
10
+ : term #termExpression
11
+ | expression '.' invocation #invocationExpression
12
+ | expression '[' expression ']' #indexerExpression
13
+ | ('+' | '-') expression #polarityExpression
14
+ | expression ('*' | '/' | 'div' | 'mod') expression #multiplicativeExpression
15
+ | expression ('+' | '-' | '&') expression #additiveExpression
16
+ | expression ('is' | 'as') typeSpecifier #typeExpression
17
+ | expression '|' expression #unionExpression
18
+ | expression ('<=' | '<' | '>' | '>=') expression #inequalityExpression
19
+ | expression ('=' | '~' | '!=' | '!~') expression #equalityExpression
20
+ | expression ('in' | 'contains') expression #membershipExpression
21
+ | expression 'and' expression #andExpression
22
+ | expression ('or' | 'xor') expression #orExpression
23
+ | expression 'implies' expression #impliesExpression
24
+ //| (IDENTIFIER)? '=>' expression #lambdaExpression
25
+ ;
26
+
27
+ term
28
+ : invocation #invocationTerm
29
+ | literal #literalTerm
30
+ | externalConstant #externalConstantTerm
31
+ | '(' expression ')' #parenthesizedTerm
32
+ ;
33
+
34
+ literal
35
+ : '{' '}' #nullLiteral
36
+ | ('true' | 'false') #booleanLiteral
37
+ | STRING #stringLiteral
38
+ | NUMBER #numberLiteral
39
+ | DATE #dateLiteral
40
+ | DATETIME #dateTimeLiteral
41
+ | TIME #timeLiteral
42
+ | quantity #quantityLiteral
43
+ ;
44
+
45
+ externalConstant
46
+ : '%' ( identifier | STRING )
47
+ ;
48
+
49
+ invocation // Terms that can be used after the function/member invocation '.'
50
+ : identifier #memberInvocation
51
+ | function #functionInvocation
52
+ | '$this' #thisInvocation
53
+ | '$index' #indexInvocation
54
+ | '$total' #totalInvocation
55
+ ;
56
+
57
+ function
58
+ : identifier '(' paramList? ')'
59
+ ;
60
+
61
+ paramList
62
+ : expression (',' expression)*
63
+ ;
64
+
65
+ quantity
66
+ : NUMBER unit?
67
+ ;
68
+
69
+ unit
70
+ : dateTimePrecision
71
+ | pluralDateTimePrecision
72
+ | STRING // UCUM syntax for units of measure
73
+ ;
74
+
75
+ dateTimePrecision
76
+ : 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'
77
+ ;
78
+
79
+ pluralDateTimePrecision
80
+ : 'years' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds'
81
+ ;
82
+
83
+ typeSpecifier
84
+ : qualifiedIdentifier
85
+ ;
86
+
87
+ qualifiedIdentifier
88
+ : identifier ('.' identifier)*
89
+ ;
90
+
91
+ identifier
92
+ : IDENTIFIER
93
+ | DELIMITEDIDENTIFIER
94
+ | 'as'
95
+ | 'contains'
96
+ | 'in'
97
+ | 'is'
98
+ ;
99
+
100
+
101
+ /****************************************************************
102
+ Lexical rules
103
+ *****************************************************************/
104
+
105
+ /*
106
+ NOTE: The goal of these rules in the grammar is to provide a date
107
+ token to the parser. As such it is not attempting to validate that
108
+ the date is a correct date, that task is for the parser or interpreter.
109
+ */
110
+
111
+ DATE
112
+ : '@' DATEFORMAT
113
+ ;
114
+
115
+ DATETIME
116
+ : '@' DATEFORMAT 'T' (TIMEFORMAT TIMEZONEOFFSETFORMAT?)?
117
+ ;
118
+
119
+ TIME
120
+ : '@' 'T' TIMEFORMAT
121
+ ;
122
+
123
+ fragment DATEFORMAT
124
+ : [0-9][0-9][0-9][0-9] ('-'[0-9][0-9] ('-'[0-9][0-9])?)?
125
+ ;
126
+
127
+ fragment TIMEFORMAT
128
+ : [0-9][0-9] (':'[0-9][0-9] (':'[0-9][0-9] ('.'[0-9]+)?)?)?
129
+ ;
130
+
131
+ fragment TIMEZONEOFFSETFORMAT
132
+ : ('Z' | ('+' | '-') [0-9][0-9]':'[0-9][0-9])
133
+ ;
134
+
135
+ IDENTIFIER
136
+ : ([A-Za-z] | '_')([A-Za-z0-9] | '_')* // Added _ to support CQL (FHIR could constrain it out)
137
+ ;
138
+
139
+ DELIMITEDIDENTIFIER
140
+ : '`' (ESC | .)*? '`'
141
+ ;
142
+
143
+ STRING
144
+ : '\'' (ESC | .)*? '\''
145
+ ;
146
+
147
+ // Also allows leading zeroes now (just like CQL and XSD)
148
+ NUMBER
149
+ : [0-9]+('.' [0-9]+)?
150
+ ;
151
+
152
+ // Pipe whitespace to the HIDDEN channel to support retrieving source text through the parser.
153
+ WS
154
+ : [ \r\n\t]+ -> channel(HIDDEN)
155
+ ;
156
+
157
+ COMMENT
158
+ : '/*' .*? '*/' -> channel(HIDDEN)
159
+ ;
160
+
161
+ LINE_COMMENT
162
+ : '//' ~[\r\n]* -> channel(HIDDEN)
163
+ ;
164
+
165
+ fragment ESC
166
+ : '\\' ([`'\\/fnrt] | UNICODE) // allow \`, \', \\, \/, \f, etc. and \uXXX
167
+ ;
168
+
169
+ fragment UNICODE
170
+ : 'u' HEX HEX HEX HEX
171
+ ;
172
+
173
+ fragment HEX
174
+ : [0-9a-fA-F]
175
+ ;
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/grammar/targetmap.g4 ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ grammar targetmap;
2
+
3
+ /*
4
+ Target mapping language to support mapping expressions for primitives, choices, extensions, and slicing:
5
+
6
+ // Primitives
7
+ %value.value
8
+ QICoreHelpers.ToConcept(%value)
9
+
10
+ // TODO: Consider alignment with FHIRPath here, $value could be $this?
11
+ // The challenge is that %value is more of a replacement token, and are some FHIR maps that will already have $this (slicing maps in particular often include $this)
12
+
13
+ // Choices
14
+ System.DateTime:%value.value;;QICore.Timing:null
15
+ QICore.Reference:null;System.Concept:QICoreHelpers.ToConcept(%value)
16
+
17
+ // Extensions
18
+ QICoreHelpers.ToConcept(%value.extension[url=http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-doNotPerformReason].value)
19
+ %value.modifierExtension[url=http://hl7.org/fhir/StructureDefinition/request-doNotPerform].value.value
20
+
21
+ // TODO: Consider alignment with FHIRPath here? (i.e. use .extension(), rather than this syntax)
22
+
23
+
24
+ // Slicing
25
+ QICoreHelpers.ToConcept(%value.category[coding.system=http://terminology.hl7.org/CodeSystem/observation-category,coding.code=vital-signs].value)
26
+ QICoreHelpers.ToCode(%value.code.coding[system=http://loinc.org,code=39156-5].value)
27
+ %value.component[code.coding.system=http://loinc.org,code.coding.code=8480-6]
28
+ %value.component[code.coding.system=http://loinc.org,code.coding.code=8462-4]
29
+
30
+ // TODO: Consider alignment with FHIRPath here? (i.e. use .where(), rather than this syntax)
31
+
32
+ // TODO: Consider a use case for coalescing? E.g. %value.foo ?? %value.bar ?? %value.baz (using typescript-inspired syntax; is there a FHIRPath variant?). Maybe that's going too far? I mean, I guess we don't want to redefine all of FHIRPath, right?
33
+ */
34
+
35
+ targetMapping
36
+ : targetMap EOF
37
+ ;
38
+
39
+ targetMap
40
+ : mappingTarget
41
+ | targetInvocation
42
+ | targetMap '.' targetInvocation
43
+ | targetMap '[' targetIndex ']'
44
+ | choiceMap
45
+ ;
46
+
47
+ choiceMap
48
+ : choiceMapItem (';' choiceMapItem)*
49
+ ;
50
+
51
+ choiceMapItem
52
+ : (qualifiedIdentifier ':' targetMap)?
53
+ ;
54
+
55
+ targetIndex
56
+ : targetIndexItem (',' targetIndexItem)*
57
+ ;
58
+
59
+ targetIndexItem
60
+ : identifier '=' STRING
61
+ ;
62
+
63
+ // TODO: Consider use cases for numeric indexes (e.g. component[0] (first item) component[-1] (last item)
64
+
65
+ mappingTarget
66
+ : '%' identifier
67
+ | 'null'
68
+ ;
69
+
70
+ targetInvocation
71
+ : identifier
72
+ | function
73
+ ;
74
+
75
+ qualifiedIdentifier
76
+ : identifier ('.' identifier)*
77
+ ;
78
+
79
+ identifier
80
+ : IDENTIFIER
81
+ | DELIMITEDIDENTIFIER
82
+ ;
83
+
84
+ function
85
+ : identifier '(' targetMap ')'
86
+ ;
87
+
88
+ IDENTIFIER
89
+ : ([A-Za-z] | '_')([A-Za-z0-9] | '_')* // Added _ to support CQL (FHIR could constrain it out)
90
+ ;
91
+
92
+ DELIMITEDIDENTIFIER
93
+ : '`' (ESC | .)*? '`'
94
+ ;
95
+
96
+ STRING
97
+ : '\'' (ESC | .)*? '\''
98
+ ;
99
+
100
+ NUMBER
101
+ : [0-9]+('.' [0-9]+)?
102
+ ;
103
+
104
+ // Pipe whitespace to the HIDDEN channel to support retrieving source text through the parser.
105
+ WS
106
+ : [ \r\n\t]+ -> channel(HIDDEN)
107
+ ;
108
+
109
+ fragment ESC
110
+ : '\\' ([`'\\/fnrt] | UNICODE) // allow \`, \', \\, \/, \f, etc. and \uXXX
111
+ ;
112
+
113
+ fragment UNICODE
114
+ : 'u' HEX HEX HEX HEX
115
+ ;
116
+
117
+ fragment HEX
118
+ : [0-9a-fA-F]
119
+ ;
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/kotlin-js-store/wasm/yarn.lock ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ "@js-joda/core@3.2.0":
6
+ version "3.2.0"
7
+ resolved "https://registry.yarnpkg.com/@js-joda/core/-/core-3.2.0.tgz#3e61e21b7b2b8a6be746df1335cf91d70db2a273"
8
+ integrity sha512-PMqgJ0sw5B7FKb2d5bWYIoxjri+QlW/Pys7+Rw82jSH0QN3rB05jZ/VrrsUdh1w4+i2kw9JOejXGq/KhDOX7Kg==
9
+
10
+ "@js-joda/timezone@2.23.0":
11
+ version "2.23.0"
12
+ resolved "https://registry.yarnpkg.com/@js-joda/timezone/-/timezone-2.23.0.tgz#70558a12036b070772083ccfef1d4270ccde9c10"
13
+ integrity sha512-33rPV8ORT66Httd/IHQaymTZ//MbjF0WRB58JOUT0G04/a9cB5Q0RFTV1+T4XjIjHr+nY5QkO6KppqgogsJs+Q==
14
+
15
+ saxes@6.0.0:
16
+ version "6.0.0"
17
+ resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5"
18
+ integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==
19
+ dependencies:
20
+ xmlchars "^2.2.0"
21
+
22
+ xmlchars@^2.2.0:
23
+ version "2.2.0"
24
+ resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
25
+ integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/kotlin-js-store/yarn.lock ADDED
@@ -0,0 +1,573 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ "@isaacs/cliui@^8.0.2":
6
+ version "8.0.2"
7
+ resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550"
8
+ integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==
9
+ dependencies:
10
+ string-width "^5.1.2"
11
+ string-width-cjs "npm:string-width@^4.2.0"
12
+ strip-ansi "^7.0.1"
13
+ strip-ansi-cjs "npm:strip-ansi@^6.0.1"
14
+ wrap-ansi "^8.1.0"
15
+ wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"
16
+
17
+ "@js-joda/core@3.2.0":
18
+ version "3.2.0"
19
+ resolved "https://registry.yarnpkg.com/@js-joda/core/-/core-3.2.0.tgz#3e61e21b7b2b8a6be746df1335cf91d70db2a273"
20
+ integrity sha512-PMqgJ0sw5B7FKb2d5bWYIoxjri+QlW/Pys7+Rw82jSH0QN3rB05jZ/VrrsUdh1w4+i2kw9JOejXGq/KhDOX7Kg==
21
+
22
+ "@js-joda/timezone@2.23.0":
23
+ version "2.23.0"
24
+ resolved "https://registry.yarnpkg.com/@js-joda/timezone/-/timezone-2.23.0.tgz#70558a12036b070772083ccfef1d4270ccde9c10"
25
+ integrity sha512-33rPV8ORT66Httd/IHQaymTZ//MbjF0WRB58JOUT0G04/a9cB5Q0RFTV1+T4XjIjHr+nY5QkO6KppqgogsJs+Q==
26
+
27
+ "@pkgjs/parseargs@^0.11.0":
28
+ version "0.11.0"
29
+ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
30
+ integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
31
+
32
+ ansi-regex@^5.0.1:
33
+ version "5.0.1"
34
+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
35
+ integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
36
+
37
+ ansi-regex@^6.0.1:
38
+ version "6.2.0"
39
+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.2.0.tgz#2f302e7550431b1b7762705fffb52cf1ffa20447"
40
+ integrity sha512-TKY5pyBkHyADOPYlRT9Lx6F544mPl0vS5Ew7BJ45hA08Q+t3GjbueLliBWN3sMICk6+y7HdyxSzC4bWS8baBdg==
41
+
42
+ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
43
+ version "4.3.0"
44
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
45
+ integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
46
+ dependencies:
47
+ color-convert "^2.0.1"
48
+
49
+ ansi-styles@^6.1.0:
50
+ version "6.2.1"
51
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5"
52
+ integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==
53
+
54
+ argparse@^2.0.1:
55
+ version "2.0.1"
56
+ resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
57
+ integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
58
+
59
+ balanced-match@^1.0.0:
60
+ version "1.0.2"
61
+ resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
62
+ integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
63
+
64
+ brace-expansion@^2.0.1:
65
+ version "2.0.1"
66
+ resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
67
+ integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
68
+ dependencies:
69
+ balanced-match "^1.0.0"
70
+
71
+ browser-stdout@^1.3.1:
72
+ version "1.3.1"
73
+ resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60"
74
+ integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==
75
+
76
+ buffer-from@^1.0.0:
77
+ version "1.1.2"
78
+ resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
79
+ integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
80
+
81
+ camelcase@^6.0.0:
82
+ version "6.3.0"
83
+ resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
84
+ integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
85
+
86
+ chalk@^4.1.0:
87
+ version "4.1.2"
88
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
89
+ integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
90
+ dependencies:
91
+ ansi-styles "^4.1.0"
92
+ supports-color "^7.1.0"
93
+
94
+ chokidar@^4.0.1:
95
+ version "4.0.3"
96
+ resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-4.0.3.tgz#7be37a4c03c9aee1ecfe862a4a23b2c70c205d30"
97
+ integrity sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==
98
+ dependencies:
99
+ readdirp "^4.0.1"
100
+
101
+ cliui@^8.0.1:
102
+ version "8.0.1"
103
+ resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
104
+ integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==
105
+ dependencies:
106
+ string-width "^4.2.0"
107
+ strip-ansi "^6.0.1"
108
+ wrap-ansi "^7.0.0"
109
+
110
+ color-convert@^2.0.1:
111
+ version "2.0.1"
112
+ resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
113
+ integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
114
+ dependencies:
115
+ color-name "~1.1.4"
116
+
117
+ color-name@~1.1.4:
118
+ version "1.1.4"
119
+ resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
120
+ integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
121
+
122
+ cross-spawn@^7.0.6:
123
+ version "7.0.6"
124
+ resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f"
125
+ integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
126
+ dependencies:
127
+ path-key "^3.1.0"
128
+ shebang-command "^2.0.0"
129
+ which "^2.0.1"
130
+
131
+ debug@^4.3.5:
132
+ version "4.3.7"
133
+ resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
134
+ integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
135
+ dependencies:
136
+ ms "^2.1.3"
137
+
138
+ decamelize@^4.0.0:
139
+ version "4.0.0"
140
+ resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837"
141
+ integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==
142
+
143
+ diff@^7.0.0:
144
+ version "7.0.0"
145
+ resolved "https://registry.yarnpkg.com/diff/-/diff-7.0.0.tgz#3fb34d387cd76d803f6eebea67b921dab0182a9a"
146
+ integrity sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==
147
+
148
+ eastasianwidth@^0.2.0:
149
+ version "0.2.0"
150
+ resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb"
151
+ integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
152
+
153
+ emoji-regex@^8.0.0:
154
+ version "8.0.0"
155
+ resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
156
+ integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
157
+
158
+ emoji-regex@^9.2.2:
159
+ version "9.2.2"
160
+ resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72"
161
+ integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==
162
+
163
+ escalade@^3.1.1:
164
+ version "3.2.0"
165
+ resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5"
166
+ integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==
167
+
168
+ escape-string-regexp@^4.0.0:
169
+ version "4.0.0"
170
+ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
171
+ integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
172
+
173
+ find-up@^5.0.0:
174
+ version "5.0.0"
175
+ resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc"
176
+ integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
177
+ dependencies:
178
+ locate-path "^6.0.0"
179
+ path-exists "^4.0.0"
180
+
181
+ flat@^5.0.2:
182
+ version "5.0.2"
183
+ resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241"
184
+ integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==
185
+
186
+ foreground-child@^3.1.0:
187
+ version "3.3.1"
188
+ resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f"
189
+ integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==
190
+ dependencies:
191
+ cross-spawn "^7.0.6"
192
+ signal-exit "^4.0.1"
193
+
194
+ format-util@^1.0.5:
195
+ version "1.0.5"
196
+ resolved "https://registry.yarnpkg.com/format-util/-/format-util-1.0.5.tgz#1ffb450c8a03e7bccffe40643180918cc297d271"
197
+ integrity sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg==
198
+
199
+ get-caller-file@^2.0.5:
200
+ version "2.0.5"
201
+ resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
202
+ integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
203
+
204
+ glob@^10.4.5:
205
+ version "10.4.5"
206
+ resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956"
207
+ integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==
208
+ dependencies:
209
+ foreground-child "^3.1.0"
210
+ jackspeak "^3.1.2"
211
+ minimatch "^9.0.4"
212
+ minipass "^7.1.2"
213
+ package-json-from-dist "^1.0.0"
214
+ path-scurry "^1.11.1"
215
+
216
+ has-flag@^4.0.0:
217
+ version "4.0.0"
218
+ resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
219
+ integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
220
+
221
+ he@^1.2.0:
222
+ version "1.2.0"
223
+ resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
224
+ integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
225
+
226
+ is-fullwidth-code-point@^3.0.0:
227
+ version "3.0.0"
228
+ resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
229
+ integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
230
+
231
+ is-path-inside@^3.0.3:
232
+ version "3.0.3"
233
+ resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
234
+ integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
235
+
236
+ is-plain-obj@^2.1.0:
237
+ version "2.1.0"
238
+ resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287"
239
+ integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==
240
+
241
+ is-unicode-supported@^0.1.0:
242
+ version "0.1.0"
243
+ resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
244
+ integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==
245
+
246
+ isexe@^2.0.0:
247
+ version "2.0.0"
248
+ resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
249
+ integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==
250
+
251
+ jackspeak@^3.1.2:
252
+ version "3.4.3"
253
+ resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a"
254
+ integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==
255
+ dependencies:
256
+ "@isaacs/cliui" "^8.0.2"
257
+ optionalDependencies:
258
+ "@pkgjs/parseargs" "^0.11.0"
259
+
260
+ js-yaml@^4.1.0:
261
+ version "4.1.0"
262
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
263
+ integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
264
+ dependencies:
265
+ argparse "^2.0.1"
266
+
267
+ kotlin-web-helpers@3.0.0:
268
+ version "3.0.0"
269
+ resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-3.0.0.tgz#3ed6b48f694f74bb60a737a9d7e2c0e3b29abdb9"
270
+ integrity sha512-kdQO4AJQkUPvpLh9aglkXDRyN+CfXO7pKq+GESEnxooBFkQpytLrqZis3ABvmFN1cGw/ZQ/K38u5sRGW+NfBnw==
271
+ dependencies:
272
+ format-util "^1.0.5"
273
+
274
+ locate-path@^6.0.0:
275
+ version "6.0.0"
276
+ resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
277
+ integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
278
+ dependencies:
279
+ p-locate "^5.0.0"
280
+
281
+ log-symbols@^4.1.0:
282
+ version "4.1.0"
283
+ resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503"
284
+ integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==
285
+ dependencies:
286
+ chalk "^4.1.0"
287
+ is-unicode-supported "^0.1.0"
288
+
289
+ lru-cache@^10.2.0:
290
+ version "10.4.3"
291
+ resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119"
292
+ integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==
293
+
294
+ minimatch@^9.0.4, minimatch@^9.0.5:
295
+ version "9.0.5"
296
+ resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5"
297
+ integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==
298
+ dependencies:
299
+ brace-expansion "^2.0.1"
300
+
301
+ "minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2:
302
+ version "7.1.2"
303
+ resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707"
304
+ integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==
305
+
306
+ mocha@11.7.5:
307
+ version "11.7.5"
308
+ resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.5.tgz#58f5bbfa5e0211ce7e5ee6128107cefc2515a627"
309
+ integrity sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==
310
+ dependencies:
311
+ browser-stdout "^1.3.1"
312
+ chokidar "^4.0.1"
313
+ debug "^4.3.5"
314
+ diff "^7.0.0"
315
+ escape-string-regexp "^4.0.0"
316
+ find-up "^5.0.0"
317
+ glob "^10.4.5"
318
+ he "^1.2.0"
319
+ is-path-inside "^3.0.3"
320
+ js-yaml "^4.1.0"
321
+ log-symbols "^4.1.0"
322
+ minimatch "^9.0.5"
323
+ ms "^2.1.3"
324
+ picocolors "^1.1.1"
325
+ serialize-javascript "^6.0.2"
326
+ strip-json-comments "^3.1.1"
327
+ supports-color "^8.1.1"
328
+ workerpool "^9.2.0"
329
+ yargs "^17.7.2"
330
+ yargs-parser "^21.1.1"
331
+ yargs-unparser "^2.0.0"
332
+
333
+ ms@^2.1.3:
334
+ version "2.1.3"
335
+ resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
336
+ integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
337
+
338
+ p-limit@^3.0.2:
339
+ version "3.1.0"
340
+ resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b"
341
+ integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==
342
+ dependencies:
343
+ yocto-queue "^0.1.0"
344
+
345
+ p-locate@^5.0.0:
346
+ version "5.0.0"
347
+ resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834"
348
+ integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
349
+ dependencies:
350
+ p-limit "^3.0.2"
351
+
352
+ package-json-from-dist@^1.0.0:
353
+ version "1.0.1"
354
+ resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505"
355
+ integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==
356
+
357
+ path-exists@^4.0.0:
358
+ version "4.0.0"
359
+ resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
360
+ integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
361
+
362
+ path-key@^3.1.0:
363
+ version "3.1.1"
364
+ resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
365
+ integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
366
+
367
+ path-scurry@^1.11.1:
368
+ version "1.11.1"
369
+ resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2"
370
+ integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==
371
+ dependencies:
372
+ lru-cache "^10.2.0"
373
+ minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
374
+
375
+ picocolors@^1.1.1:
376
+ version "1.1.1"
377
+ resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
378
+ integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
379
+
380
+ randombytes@^2.1.0:
381
+ version "2.1.0"
382
+ resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
383
+ integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==
384
+ dependencies:
385
+ safe-buffer "^5.1.0"
386
+
387
+ readdirp@^4.0.1:
388
+ version "4.1.2"
389
+ resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-4.1.2.tgz#eb85801435fbf2a7ee58f19e0921b068fc69948d"
390
+ integrity sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==
391
+
392
+ require-directory@^2.1.1:
393
+ version "2.1.1"
394
+ resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
395
+ integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
396
+
397
+ safe-buffer@^5.1.0:
398
+ version "5.2.1"
399
+ resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
400
+ integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
401
+
402
+ saxes@6.0.0:
403
+ version "6.0.0"
404
+ resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5"
405
+ integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==
406
+ dependencies:
407
+ xmlchars "^2.2.0"
408
+
409
+ serialize-javascript@^6.0.2:
410
+ version "6.0.2"
411
+ resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2"
412
+ integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==
413
+ dependencies:
414
+ randombytes "^2.1.0"
415
+
416
+ shebang-command@^2.0.0:
417
+ version "2.0.0"
418
+ resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
419
+ integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
420
+ dependencies:
421
+ shebang-regex "^3.0.0"
422
+
423
+ shebang-regex@^3.0.0:
424
+ version "3.0.0"
425
+ resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
426
+ integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
427
+
428
+ signal-exit@^4.0.1:
429
+ version "4.1.0"
430
+ resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"
431
+ integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==
432
+
433
+ source-map-support@0.5.21:
434
+ version "0.5.21"
435
+ resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
436
+ integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
437
+ dependencies:
438
+ buffer-from "^1.0.0"
439
+ source-map "^0.6.0"
440
+
441
+ source-map@^0.6.0:
442
+ version "0.6.1"
443
+ resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
444
+ integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
445
+
446
+ "string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
447
+ version "4.2.3"
448
+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
449
+ integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
450
+ dependencies:
451
+ emoji-regex "^8.0.0"
452
+ is-fullwidth-code-point "^3.0.0"
453
+ strip-ansi "^6.0.1"
454
+
455
+ string-width@^5.0.1, string-width@^5.1.2:
456
+ version "5.1.2"
457
+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
458
+ integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==
459
+ dependencies:
460
+ eastasianwidth "^0.2.0"
461
+ emoji-regex "^9.2.2"
462
+ strip-ansi "^7.0.1"
463
+
464
+ "strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
465
+ version "6.0.1"
466
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
467
+ integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
468
+ dependencies:
469
+ ansi-regex "^5.0.1"
470
+
471
+ strip-ansi@^7.0.1:
472
+ version "7.1.0"
473
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
474
+ integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==
475
+ dependencies:
476
+ ansi-regex "^6.0.1"
477
+
478
+ strip-json-comments@^3.1.1:
479
+ version "3.1.1"
480
+ resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
481
+ integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
482
+
483
+ supports-color@^7.1.0:
484
+ version "7.2.0"
485
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
486
+ integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
487
+ dependencies:
488
+ has-flag "^4.0.0"
489
+
490
+ supports-color@^8.1.1:
491
+ version "8.1.1"
492
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
493
+ integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
494
+ dependencies:
495
+ has-flag "^4.0.0"
496
+
497
+ typescript@5.9.3:
498
+ version "5.9.3"
499
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f"
500
+ integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==
501
+
502
+ which@^2.0.1:
503
+ version "2.0.2"
504
+ resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
505
+ integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
506
+ dependencies:
507
+ isexe "^2.0.0"
508
+
509
+ workerpool@^9.2.0:
510
+ version "9.3.3"
511
+ resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-9.3.3.tgz#e75281fe62e851afb21cdeef8fa85f6a62ec3583"
512
+ integrity sha512-slxCaKbYjEdFT/o2rH9xS1hf4uRDch1w7Uo+apxhZ+sf/1d9e0ZVkn42kPNGP2dgjIx6YFvSevj0zHvbWe2jdw==
513
+
514
+ "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
515
+ version "7.0.0"
516
+ resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
517
+ integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
518
+ dependencies:
519
+ ansi-styles "^4.0.0"
520
+ string-width "^4.1.0"
521
+ strip-ansi "^6.0.0"
522
+
523
+ wrap-ansi@^8.1.0:
524
+ version "8.1.0"
525
+ resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
526
+ integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==
527
+ dependencies:
528
+ ansi-styles "^6.1.0"
529
+ string-width "^5.0.1"
530
+ strip-ansi "^7.0.1"
531
+
532
+ xmlchars@^2.2.0:
533
+ version "2.2.0"
534
+ resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
535
+ integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
536
+
537
+ y18n@^5.0.5:
538
+ version "5.0.8"
539
+ resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
540
+ integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
541
+
542
+ yargs-parser@^21.1.1:
543
+ version "21.1.1"
544
+ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
545
+ integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
546
+
547
+ yargs-unparser@^2.0.0:
548
+ version "2.0.0"
549
+ resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb"
550
+ integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==
551
+ dependencies:
552
+ camelcase "^6.0.0"
553
+ decamelize "^4.0.0"
554
+ flat "^5.0.2"
555
+ is-plain-obj "^2.1.0"
556
+
557
+ yargs@^17.7.2:
558
+ version "17.7.2"
559
+ resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
560
+ integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==
561
+ dependencies:
562
+ cliui "^8.0.1"
563
+ escalade "^3.1.1"
564
+ get-caller-file "^2.0.5"
565
+ require-directory "^2.1.1"
566
+ string-width "^4.2.3"
567
+ y18n "^5.0.5"
568
+ yargs-parser "^21.1.1"
569
+
570
+ yocto-queue@^0.1.0:
571
+ version "0.1.0"
572
+ resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
573
+ integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/npm-cql/README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CQL.js
2
+
3
+ ![NPM Version](https://img.shields.io/npm/v/%40cqframework%2Fcql)
4
+
5
+ JavaScript tools for the Clinical Quality Language (CQL).
6
+
7
+ ## Installation
8
+
9
+ npm install @cqframework/cql
10
+
11
+ ## Usage
12
+
13
+ `@cqframework/cql` is an [ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) package. You can
14
+ use it in Node.js and the browser (both on the main thread and in web workers).
15
+
16
+ ### Compiling CQL to ELM
17
+
18
+ ```js
19
+ import { CqlTranslator, LibraryManager, ModelManager } from "@cqframework/cql/cql-to-elm";
20
+
21
+ const modelManager = new ModelManager();
22
+ // Register the necessary model info providers with the model manager here
23
+ const libraryManager = new LibraryManager(modelManager);
24
+ // Register the necessary library source providers with the library manager here
25
+ const cqlTranslator = CqlTranslator.fromText("library Example version '1.0.0'", libraryManager);
26
+ const elmJson = cqlTranslator.toJson();
27
+ ```
28
+
29
+ ### Evaluating ELM
30
+
31
+ ```js
32
+ import { CqlEngine, Environment, EvaluationParams } from "@cqframework/cql/engine";
33
+
34
+ const environment = new Environment(libraryManager);
35
+ const engine = new CqlEngine(environment);
36
+
37
+ const exampleLibraryParamsBuilder = new EvaluationParams.LibraryParams.Builder();
38
+ // To evaluate specific expressions and not the entire Example library, use `exampleLibraryParamsBuilder.expressionsByName(...)` here
39
+ const exampleLibraryParams = libraryParamsBuilder.build();
40
+
41
+ const evaluationParamsBuilder = new EvaluationParams.Builder();
42
+ evaluationParamsBuilder.libraryByName("Example", exampleLibraryParams);
43
+ const evaluationParams = evaluationParamsBuilder.build();
44
+
45
+ const evaluationResults = engine.evaluate(evaluationParams);
46
+ ```
47
+
48
+ ### TypeScript support
49
+
50
+ The TypeScript definitions included in this package are automatically generated from the Kotlin code. The generator is
51
+ currently [experimental](https://kotlinlang.org/docs/js-project-setup.html#generation-of-typescript-declaration-files-d-ts),
52
+ so the types may not be perfect.
53
+
54
+ ## Project status
55
+
56
+ This package is built from the Kotlin
57
+ Multiplatform [source](https://github.com/cqframework/clinical_quality_language) which itself
58
+ evolved from the reference Java implementation. The KMP project targets the JVM and JavaScript environments with
59
+ the goal of maintaining a single, shared codebase for both platforms.
60
+
61
+ This new JavaScript target is currently in beta and its API may change in future releases. If you encounter any issues,
62
+ please report them on [GitHub](https://github.com/cqframework/clinical_quality_language/issues)
63
+ or [Zulip](https://chat.fhir.org/#narrow/stream/179220-cql).
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/npm-cql/build.gradle.kts ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ plugins { id("cql.node-gradle-conventions") }
2
+
3
+ val engineJsDistDir = project(":engine").layout.buildDirectory.dir("dist/js/productionLibrary")
4
+
5
+ val generateTypeDefinitions by
6
+ tasks.registering(GenerateTypeDefinitions::class) {
7
+ description = "Generates .d.mts files for the NPM package."
8
+
9
+ dependsOn(
10
+ ":engine:jsBrowserProductionLibraryDistribution",
11
+ ":engine:jsNodeProductionLibraryDistribution",
12
+ )
13
+
14
+ inputDir.set(engineJsDistDir)
15
+ inputDMts.set("engine")
16
+ outputDir.set(layout.buildDirectory.dir("generated-type-definitions"))
17
+ modules.set(listOf("cql", "cql-to-elm", "elm", "engine", "kotlin-kotlin-stdlib", "shared"))
18
+ }
19
+
20
+ val preparedPackageDir = layout.buildDirectory.dir("npm-package")
21
+
22
+ val preparePackage by
23
+ tasks.registering(Sync::class) {
24
+ description = "Assembles the `@cqframework/cql` NPM package."
25
+
26
+ dependsOn(generateTypeDefinitions)
27
+
28
+ from(engineJsDistDir) { exclude("package.json") }
29
+ from(layout.projectDirectory) {
30
+ include("package.json", "README.md")
31
+ expand("version" to project.version.toString())
32
+ }
33
+ from(generateTypeDefinitions.map { it.outputDir })
34
+ into(preparedPackageDir)
35
+ }
36
+
37
+ tasks.named("build") { dependsOn(preparePackage) }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/npm-cql/package.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@cqframework/cql",
3
+ "version": "${version}",
4
+ "description": "JavaScript tools for the Clinical Quality Language (CQL).",
5
+ "keywords": [
6
+ "cql",
7
+ "clinical quality language"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/cqframework/clinical_quality_language.git"
12
+ },
13
+ "license": "Apache-2.0",
14
+ "type": "module",
15
+ "exports": {
16
+ "./cql": {
17
+ "types": "./cql.exports.d.mts",
18
+ "default": "./cql.mjs"
19
+ },
20
+ "./cql-to-elm": {
21
+ "types": "./cql-to-elm.exports.d.mts",
22
+ "default": "./cql-to-elm.mjs"
23
+ },
24
+ "./elm": {
25
+ "types": "./elm.exports.d.mts",
26
+ "default": "./elm.mjs"
27
+ },
28
+ "./engine": {
29
+ "types": "./engine.exports.d.mts",
30
+ "default": "./engine.mjs"
31
+ },
32
+ "./kotlin-kotlin-stdlib": {
33
+ "types": "./kotlin-kotlin-stdlib.exports.d.mts",
34
+ "default": "./kotlin-kotlin-stdlib.mjs"
35
+ },
36
+ "./shared": {
37
+ "types": "./shared.exports.d.mts",
38
+ "default": "./shared.mjs"
39
+ }
40
+ },
41
+ "dependencies": {
42
+ "@js-joda/timezone": "2.23.0",
43
+ "@js-joda/core": "3.2.0",
44
+ "saxes": "6.0.0"
45
+ }
46
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/.eslintrc.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "extends": ["next/core-web-vitals", "next/typescript"]
3
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/.gitignore ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+ /.pnp
6
+ .pnp.*
7
+ .yarn/*
8
+ !.yarn/patches
9
+ !.yarn/plugins
10
+ !.yarn/releases
11
+ !.yarn/versions
12
+
13
+ # testing
14
+ /coverage
15
+
16
+ # next.js
17
+ /.next/
18
+ /out/
19
+
20
+ # production
21
+ /build
22
+
23
+ # misc
24
+ .DS_Store
25
+ *.pem
26
+
27
+ # debug
28
+ npm-debug.log*
29
+ yarn-debug.log*
30
+ yarn-error.log*
31
+
32
+ # env files (can opt-in for commiting if needed)
33
+ .env*
34
+
35
+ # vercel
36
+ .vercel
37
+
38
+ # typescript
39
+ *.tsbuildinfo
40
+ next-env.d.ts
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/.npmrc ADDED
@@ -0,0 +1 @@
 
 
1
+ install-links=true
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/README.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CQL Playground
2
+
3
+ **Live URL:** https://www.cqframework.org/clinical_quality_language/playground/
4
+
5
+ A playground for the Kotlin/JS-based CQL compiler and engine.
6
+
7
+ ## Local development
8
+
9
+ The `:playground:npmInstall` Gradle task builds and installs the dependencies, including
10
+ the CQL compiler and engine.
11
+
12
+ To start the dev server, run
13
+
14
+ ./gradlew :playground:npmRunDev
15
+
16
+ and open `http://localhost:3000/clinical_quality_language/playground`.
17
+
18
+ ## Deployment
19
+
20
+ This project is deployed to GitHub Pages (the `gh-pages` branch) automatically from the `main` branch.
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/app/cql-playground.tsx ADDED
@@ -0,0 +1,677 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+
3
+ import { useState, Fragment } from "react";
4
+ import { initialState } from "@/state";
5
+ import { logLanguage } from "@/ui/editor/log-language";
6
+ import { Editor } from "@/ui/editor/editor";
7
+ import { EditorView } from "@codemirror/view";
8
+ import { Label } from "@/ui/label";
9
+ import { buttonStyle } from "@/ui/button";
10
+ import { supportedModels } from "@/cql/supported-models";
11
+ import { readFile } from "@/cql/utils";
12
+ import { Heading } from "@/ui/heading";
13
+ import {
14
+ CqlToParseTreeResult,
15
+ CqlToParseTreeSettings,
16
+ } from "@/ui/cql-to-parse-tree";
17
+ import { CqlToAstResult, CqlToAstSettings } from "@/ui/cql-to-ast";
18
+ import { CqlToElmResult, CqlToElmSettings } from "@/ui/cql-to-elm";
19
+ import { Caption } from "@/ui/caption";
20
+ import { CqlEditor } from "@/ui/cql-editor";
21
+ import { CqlEngineResult, CqlEngineSettings } from "@/ui/cql-engine";
22
+ import { compilerOptions, signatureLevels, TLibrarySource } from "@/shared";
23
+
24
+ const tabs = [
25
+ {
26
+ key: "cql-to-parse-tree",
27
+ label: "Parse tree",
28
+ result: CqlToParseTreeResult,
29
+ settings: CqlToParseTreeSettings,
30
+ },
31
+ {
32
+ key: "cql-to-ast",
33
+ label: "AST",
34
+ result: CqlToAstResult,
35
+ settings: CqlToAstSettings,
36
+ },
37
+ {
38
+ key: "cql-to-elm",
39
+ label: "ELM",
40
+ result: CqlToElmResult,
41
+ settings: CqlToElmSettings,
42
+ },
43
+ {
44
+ key: "cql-engine",
45
+ label: "Expression results",
46
+ result: CqlEngineResult,
47
+ settings: CqlEngineSettings,
48
+ },
49
+ ];
50
+
51
+ export function CqlPlayground() {
52
+ const [state, setState] = useState(initialState);
53
+
54
+ const selectedTab = tabs.find((_) => _.key === state.common.selectedTab)!;
55
+
56
+ return (
57
+ <div
58
+ style={{
59
+ position: "absolute",
60
+ inset: 0,
61
+ display: "grid",
62
+ gridTemplateColumns: "1fr",
63
+ gridTemplateRows: "auto 1fr",
64
+ gridTemplateAreas: '"header" "body"',
65
+ minHeight: 0,
66
+ }}
67
+ >
68
+ <div
69
+ style={{
70
+ gridArea: "header",
71
+ boxShadow: "0 2px 5px rgba(0,0,0,0.2)",
72
+ zIndex: 1,
73
+ }}
74
+ >
75
+ <div
76
+ style={{
77
+ display: "flex",
78
+ minHeight: 44,
79
+ padding: "0 4px 0 0",
80
+ gap: 10,
81
+ }}
82
+ >
83
+ <h1
84
+ style={{
85
+ flex: "0 0 auto",
86
+ padding: "0 20px",
87
+ margin: 0,
88
+ fontSize: 18,
89
+ fontWeight: 700,
90
+ display: "grid",
91
+ placeItems: "center start",
92
+ }}
93
+ >
94
+ CQL Playground
95
+ </h1>
96
+
97
+ {tabs.map((tab, tabIndex) => (
98
+ <label
99
+ key={tabIndex}
100
+ style={{
101
+ padding: "0 5px",
102
+ display: "flex",
103
+ gap: 5,
104
+ alignItems: "center",
105
+ fontSize: 14,
106
+ fontWeight: 700,
107
+ }}
108
+ >
109
+ <input
110
+ type={"radio"}
111
+ style={{
112
+ margin: 0,
113
+ }}
114
+ checked={state.common.selectedTab === tab.key}
115
+ onChange={() => {
116
+ setState((prevState) => ({
117
+ ...prevState,
118
+ common: {
119
+ ...prevState.common,
120
+ selectedTab: tab.key,
121
+ },
122
+ }));
123
+ }}
124
+ />
125
+ {tab.label}
126
+ </label>
127
+ ))}
128
+
129
+ <div style={{ flex: "1 1 auto" }} />
130
+
131
+ <a
132
+ style={{
133
+ flex: "0 0 auto",
134
+ alignSelf: "center",
135
+ width: 32,
136
+ height: 32,
137
+ background:
138
+ "url(https://raw.githubusercontent.com/microsoft/vscode-icons/refs/heads/main/icons/light/github-inverted.svg) center/18px 18px no-repeat",
139
+ }}
140
+ href={
141
+ "https://github.com/cqframework/clinical_quality_language/tree/main/playground"
142
+ }
143
+ />
144
+ </div>
145
+ </div>
146
+
147
+ <div
148
+ style={{
149
+ gridArea: "body",
150
+ display: "grid",
151
+ gridTemplateColumns: "4fr 1fr",
152
+ gridTemplateRows: "1fr",
153
+ gridTemplateAreas: '"main sidebar"',
154
+ minHeight: 0,
155
+ }}
156
+ >
157
+ <div
158
+ style={{
159
+ gridArea: "main",
160
+ display: "grid",
161
+ gridTemplateColumns: "1fr",
162
+ gridTemplateRows: "4fr 1fr",
163
+ gridTemplateAreas: state.common.showLog
164
+ ? '"editors" "log"'
165
+ : '"editors" "editors"',
166
+ minHeight: 0,
167
+ background: "white",
168
+ }}
169
+ >
170
+ <div
171
+ style={{
172
+ gridArea: "editors",
173
+ display: "grid",
174
+ gridTemplateColumns: "1fr 1fr",
175
+ gridTemplateRows: "1fr",
176
+ gridTemplateAreas: '"left-editor right-editor"',
177
+ minHeight: 0,
178
+ }}
179
+ >
180
+ <div
181
+ style={{
182
+ gridArea: "left-editor",
183
+ display: "grid",
184
+ minHeight: 0,
185
+ }}
186
+ >
187
+ <CqlEditor state={state} setState={setState} />
188
+ </div>
189
+
190
+ <div
191
+ style={{
192
+ gridArea: "right-editor",
193
+ display: "grid",
194
+ minHeight: 0,
195
+ borderLeft: "var(--border)",
196
+ }}
197
+ >
198
+ {<selectedTab.result state={state} setState={setState} />}
199
+ </div>
200
+ </div>
201
+ {state.common.showLog && (
202
+ <div
203
+ style={{
204
+ gridArea: "log",
205
+ display: "grid",
206
+ minHeight: 0,
207
+ borderTop: "var(--border)",
208
+ }}
209
+ >
210
+ <Editor
211
+ value={state.common.log.join("\n")}
212
+ onChange={() => {}}
213
+ editable={false}
214
+ lineNumbers={false}
215
+ extensions={[
216
+ logLanguage,
217
+ EditorView.updateListener.of((update) => {
218
+ if (update.docChanged) {
219
+ update.view.dispatch({
220
+ effects: EditorView.scrollIntoView(
221
+ update.state.doc.length,
222
+ { y: "end" },
223
+ ),
224
+ });
225
+ }
226
+ }),
227
+ ]}
228
+ />
229
+ </div>
230
+ )}
231
+ </div>
232
+
233
+ <div
234
+ style={{
235
+ gridArea: "sidebar",
236
+ padding: 20,
237
+ minHeight: 0,
238
+ borderLeft: "var(--border)",
239
+ overflow: "auto",
240
+ }}
241
+ >
242
+ <div
243
+ style={{
244
+ display: "grid",
245
+ gap: 25,
246
+ margin: "0 0 30px 0",
247
+ }}
248
+ >
249
+ <div
250
+ style={{
251
+ display: "grid",
252
+ gap: 10,
253
+ }}
254
+ >
255
+ <div>
256
+ <button
257
+ type={"button"}
258
+ style={{
259
+ ...buttonStyle,
260
+ flex: "0 0 auto",
261
+ padding: "4px 12px",
262
+ alignSelf: "center",
263
+ maxWidth: "100%",
264
+ }}
265
+ onClick={async () => {
266
+ const dirHandle: FileSystemDirectoryHandle =
267
+ await // eslint-disable-next-line @typescript-eslint/no-explicit-any
268
+ (window as any).showDirectoryPicker({
269
+ mode: "read",
270
+ });
271
+ const dirScan: FileSystemHandle[] = await Array.fromAsync(
272
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
273
+ (dirHandle as any).values(),
274
+ );
275
+ const files = dirScan
276
+ .filter(
277
+ (handle): handle is FileSystemFileHandle =>
278
+ handle.kind === "file",
279
+ )
280
+ .map((handle) => ({
281
+ handle: handle,
282
+ }));
283
+
284
+ setState((prevState) => ({
285
+ ...prevState,
286
+ common: {
287
+ ...prevState.common,
288
+ mountedDir: {
289
+ handle: dirHandle,
290
+ files: files,
291
+ },
292
+ },
293
+ }));
294
+ }}
295
+ >
296
+ {state.common.mountedDir ? (
297
+ <Fragment>
298
+ <b>{state.common.mountedDir.handle.name}</b> folder
299
+ selected
300
+ </Fragment>
301
+ ) : (
302
+ "Mount directory..."
303
+ )}
304
+ </button>
305
+ <Caption>
306
+ Mount a local directory to load CQL files from your computer.
307
+ </Caption>
308
+ </div>
309
+
310
+ <div>
311
+ <select
312
+ disabled={!state.common.mountedDir}
313
+ style={{
314
+ flex: "0 0 auto",
315
+ alignSelf: "center",
316
+ width: "100%",
317
+ padding: "4px 12px 4px 8px",
318
+ border: "var(--border)",
319
+ borderRadius: "var(--border-radius)",
320
+ whiteSpace: "nowrap",
321
+ overflow: "hidden",
322
+ textOverflow: "ellipsis",
323
+ fontFamily: "inherit",
324
+ }}
325
+ defaultValue={""}
326
+ onChange={async (event) => {
327
+ const fileName = event.target.value;
328
+
329
+ if (state.common.mountedDir) {
330
+ const content = await readFile(
331
+ state.common.mountedDir.files.find(
332
+ (_) => _.handle.name === fileName,
333
+ )!.handle,
334
+ );
335
+ if (content !== null) {
336
+ setState((prevState) => ({
337
+ ...prevState,
338
+ common: {
339
+ ...prevState.common,
340
+ cql: content,
341
+ },
342
+ }));
343
+ }
344
+ }
345
+ }}
346
+ >
347
+ <option value={""}>Import CQL from file...</option>
348
+ {state.common.mountedDir &&
349
+ state.common.mountedDir.files.map((file, fileIndex) => (
350
+ <option key={fileIndex} value={file.handle.name}>
351
+ {file.handle.name}
352
+ </option>
353
+ ))}
354
+ </select>
355
+ <Caption>
356
+ Changing CQL content in the playground editor does not modify
357
+ the file on disk.
358
+ </Caption>
359
+ </div>
360
+ </div>
361
+
362
+ {(state.common.selectedTab === "cql-to-elm" ||
363
+ state.common.selectedTab === "cql-engine") && (
364
+ <Fragment>
365
+ <div>
366
+ <Label>Library sources</Label>
367
+ <div
368
+ style={{
369
+ display: "grid",
370
+ gap: 10,
371
+ }}
372
+ >
373
+ {[
374
+ {
375
+ value: "local" as TLibrarySource,
376
+ label: "Mounted directory",
377
+ content: (
378
+ <Fragment>
379
+ <Caption>
380
+ Included libraries are loaded from files in the
381
+ local directory (library ID + .cql).
382
+ </Caption>
383
+ </Fragment>
384
+ ),
385
+ },
386
+ {
387
+ value: "remote" as TLibrarySource,
388
+ label: "Remote URL",
389
+ content: (
390
+ <Fragment>
391
+ <input
392
+ placeholder={
393
+ "E.g. https://raw.githubusercontent.com/cqframework/cqf-exercises/refs/heads/master/input/cql/"
394
+ }
395
+ value={state.common.baseUrl}
396
+ onChange={(event) => {
397
+ const nextBaseUrl = event.target.value;
398
+ setState((prevState) => ({
399
+ ...prevState,
400
+ common: {
401
+ ...prevState.common,
402
+ baseUrl: nextBaseUrl,
403
+ },
404
+ }));
405
+ }}
406
+ style={{
407
+ width: "100%",
408
+ padding: "6px 12px",
409
+ border: "var(--border)",
410
+ borderRadius: "var(--border-radius)",
411
+ fontFamily: "inherit",
412
+ }}
413
+ />
414
+ <Caption>
415
+ Included libraries are fetched from this base URL
416
+ + library ID + .cql.
417
+ </Caption>
418
+ </Fragment>
419
+ ),
420
+ },
421
+ ].map((librarySourceOption, librarySourceOptionIndex) => (
422
+ <div key={librarySourceOptionIndex}>
423
+ <label
424
+ style={{
425
+ display: "flex",
426
+ gap: 5,
427
+ margin: "0 0 5px 0",
428
+ }}
429
+ >
430
+ <input
431
+ type={"radio"}
432
+ style={{
433
+ margin: 0,
434
+ }}
435
+ checked={
436
+ state.common.librarySource ===
437
+ librarySourceOption.value
438
+ }
439
+ onChange={() => {
440
+ setState((prevState) => ({
441
+ ...prevState,
442
+ common: {
443
+ ...prevState.common,
444
+ librarySource: librarySourceOption.value,
445
+ },
446
+ }));
447
+ }}
448
+ />
449
+ {librarySourceOption.label}
450
+ </label>
451
+ {librarySourceOption.content}
452
+ </div>
453
+ ))}
454
+ </div>
455
+ </div>
456
+
457
+ <div>
458
+ <Label>Compiler options</Label>
459
+
460
+ <div
461
+ style={{
462
+ display: "grid",
463
+ gap: 3,
464
+ margin: "0 0 12px 0",
465
+ }}
466
+ >
467
+ {compilerOptions.map(
468
+ (compilerOption, compilerOptionIndex) => (
469
+ <label
470
+ key={compilerOptionIndex}
471
+ style={{ display: "flex", gap: 5 }}
472
+ >
473
+ <input
474
+ type={"checkbox"}
475
+ style={{
476
+ margin: 0,
477
+ }}
478
+ checked={state.common.compilerOptions.includes(
479
+ compilerOption.value,
480
+ )}
481
+ onChange={(event) => {
482
+ const nextChecked = event.target.checked;
483
+ setState((prevState) => ({
484
+ ...prevState,
485
+ common: {
486
+ ...prevState.common,
487
+ compilerOptions: nextChecked
488
+ ? [
489
+ ...prevState.common.compilerOptions,
490
+ compilerOption.value,
491
+ ]
492
+ : prevState.common.compilerOptions.filter(
493
+ (_) => _ !== compilerOption.value,
494
+ ),
495
+ },
496
+ }));
497
+ }}
498
+ />
499
+ <div>{compilerOption.label}</div>
500
+ </label>
501
+ ),
502
+ )}
503
+ </div>
504
+
505
+ <div>
506
+ <div style={{ margin: "0 0 5px 0" }}>Signature level</div>
507
+ <select
508
+ value={state.common.signatureLevel}
509
+ onChange={(event) => {
510
+ const nextSignatureLevel = event.target.value;
511
+ setState((prevState) => ({
512
+ ...prevState,
513
+ common: {
514
+ ...prevState.common,
515
+ signatureLevel: nextSignatureLevel,
516
+ },
517
+ }));
518
+ }}
519
+ style={{
520
+ width: "100%",
521
+ padding: "6px 12px 6px 8px",
522
+ border: "var(--border)",
523
+ borderRadius: "var(--border-radius)",
524
+ fontFamily: "inherit",
525
+ }}
526
+ >
527
+ {signatureLevels.map(
528
+ (signatureLevel, signatureLevelIndex) => (
529
+ <option
530
+ key={signatureLevelIndex}
531
+ value={signatureLevel}
532
+ >
533
+ {signatureLevel}
534
+ </option>
535
+ ),
536
+ )}
537
+ </select>
538
+ </div>
539
+ </div>
540
+ </Fragment>
541
+ )}
542
+
543
+ <selectedTab.settings state={state} setState={setState} />
544
+
545
+ <div>
546
+ <Label>CQL Editor</Label>
547
+ <label style={{ display: "flex", gap: 5 }}>
548
+ <input
549
+ type={"checkbox"}
550
+ style={{
551
+ margin: 0,
552
+ }}
553
+ checked={state.common.highlightActiveStatement}
554
+ onChange={(event) => {
555
+ const nextChecked = event.target.checked;
556
+ setState((prevState) => ({
557
+ ...prevState,
558
+ common: {
559
+ ...prevState.common,
560
+ highlightActiveStatement: nextChecked,
561
+ },
562
+ }));
563
+ }}
564
+ />
565
+ <div>Highlight active statement</div>
566
+ </label>
567
+ </div>
568
+
569
+ <div>
570
+ <Label>Tool logging</Label>
571
+ <label style={{ display: "flex", gap: 5, margin: "0 0 10px 0" }}>
572
+ <input
573
+ type={"checkbox"}
574
+ style={{
575
+ margin: 0,
576
+ }}
577
+ checked={state.common.showLog}
578
+ onChange={(event) => {
579
+ const nextChecked = event.target.checked;
580
+ setState((prevState) => ({
581
+ ...prevState,
582
+ common: {
583
+ ...prevState.common,
584
+ showLog: nextChecked,
585
+ },
586
+ }));
587
+ }}
588
+ />
589
+ <div>Show log</div>
590
+ </label>
591
+ <button
592
+ type={"button"}
593
+ style={{
594
+ ...buttonStyle,
595
+ }}
596
+ onClick={() => {
597
+ setState((prevState) => ({
598
+ ...prevState,
599
+ common: {
600
+ ...prevState.common,
601
+ log: [],
602
+ },
603
+ }));
604
+ }}
605
+ >
606
+ Clear log
607
+ </button>
608
+ </div>
609
+ </div>
610
+
611
+ {(state.common.selectedTab === "cql-to-elm" ||
612
+ state.common.selectedTab === "cql-engine") && (
613
+ <Fragment>
614
+ <Heading>Supported models</Heading>
615
+
616
+ <div>
617
+ <div style={{ fontSize: 12, margin: "0 0 5px 0" }}>
618
+ You can use any of the models below, and they will be fetched
619
+ automatically from GitHub.
620
+ </div>
621
+ <div
622
+ style={{
623
+ border: "var(--border)",
624
+ borderRadius: "var(--border-radius)",
625
+ background: "white",
626
+ padding: "4px 12px",
627
+ fontFamily: "var(--monospace-font-family)",
628
+ fontSize: 12,
629
+ }}
630
+ >
631
+ {supportedModels.map((model, modelIndex) => (
632
+ <a
633
+ key={modelIndex}
634
+ style={{
635
+ display: "block",
636
+ padding: "1px 0",
637
+ color: "inherit",
638
+ textDecoration: "none",
639
+ }}
640
+ href={model.url}
641
+ >
642
+ <span
643
+ style={{
644
+ color: "#d73a49",
645
+ }}
646
+ >
647
+ using
648
+ </span>{" "}
649
+ {model.id}
650
+ {model.version && (
651
+ <Fragment>
652
+ {" "}
653
+ <span
654
+ style={{
655
+ color: "#d73a49",
656
+ }}
657
+ >
658
+ version
659
+ </span>{" "}
660
+ <span style={{ color: "#032f62" }}>
661
+ {"'"}
662
+ {model.version}
663
+ {"'"}
664
+ </span>
665
+ </Fragment>
666
+ )}
667
+ </a>
668
+ ))}
669
+ </div>
670
+ </div>
671
+ </Fragment>
672
+ )}
673
+ </div>
674
+ </div>
675
+ </div>
676
+ );
677
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/app/globals.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --border: 1px solid #ccc;
3
+ --border-radius: 4px;
4
+ --primary-color: #000;
5
+ --monospace-font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
6
+ }
7
+
8
+ * {
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ body {
13
+ padding: 0;
14
+ margin: 0;
15
+ background: #fff;
16
+ color: #333;
17
+ accent-color: var(--primary-color);
18
+ font-size: 14px;
19
+ line-height: 1.3;
20
+ overscroll-behavior: none;
21
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/app/layout.tsx ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Metadata } from "next";
2
+ import "./globals.css";
3
+ import { Roboto } from "next/font/google";
4
+
5
+ const roboto = Roboto({
6
+ weight: ["300", "400", "700"],
7
+ subsets: ["latin"],
8
+ });
9
+
10
+ export const metadata: Metadata = {
11
+ title: "CQL Playground",
12
+ description: "CQL Playground",
13
+ };
14
+
15
+ export default function RootLayout({
16
+ children,
17
+ }: Readonly<{
18
+ children: React.ReactNode;
19
+ }>) {
20
+ return (
21
+ <html lang={"en"} className={roboto.className}>
22
+ <body>{children}</body>
23
+ </html>
24
+ );
25
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/app/page.tsx ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import { CqlPlayground } from "@/app/cql-playground";
2
+
3
+ export default function Home() {
4
+ return <CqlPlayground />;
5
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/build.gradle.kts ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import com.github.gradle.node.npm.task.NpmTask
2
+
3
+ plugins { id("cql.node-gradle-conventions") }
4
+
5
+ tasks.named("npmInstall") { dependsOn(":engine:build") }
6
+
7
+ val npmRunBuild by
8
+ tasks.registering(NpmTask::class) {
9
+ dependsOn("npmInstall")
10
+ args.set(listOf("run", "build"))
11
+ }
12
+
13
+ val npmRunDev by
14
+ tasks.registering(NpmTask::class) {
15
+ dependsOn("npmInstall")
16
+ args.set(listOf("run", "dev"))
17
+ outputs.upToDateWhen { false }
18
+ doNotTrackState("`npm run dev` starts a local dev server")
19
+ }
20
+
21
+ tasks.named("build") { dependsOn(npmRunBuild) }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-engine-worker.ts ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { createStatefulEngine } from "@/cql/cql-engine";
2
+
3
+ const { runCql } = createStatefulEngine();
4
+
5
+ onmessage = async (event) => {
6
+ const { type, data } = event.data;
7
+
8
+ if (type === "runCql") {
9
+ runCql(data.args, (output) => {
10
+ postMessage({
11
+ type: "output",
12
+ data: {
13
+ output,
14
+ runId: data.runId,
15
+ startTime: data.startTime,
16
+ },
17
+ });
18
+ });
19
+ }
20
+ };
21
+
22
+ postMessage({
23
+ type: "ready",
24
+ data: {},
25
+ });
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-engine.ts ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // @ts-expect-error No type definitions available for @lhncbc/ucum-lhc
2
+ import * as ucum from "@lhncbc/ucum-lhc";
3
+ // @ts-expect-error
4
+ import * as cqlToElmJs from "cql-js/kotlin/cql-to-elm.mjs";
5
+ import * as engineJs from "cql-js/kotlin/engine.mjs";
6
+ // @ts-expect-error
7
+ import * as kotlinStdlibJs from "cql-js/kotlin/kotlin-kotlin-stdlib.mjs";
8
+ import {
9
+ compilerOptions,
10
+ Nullable,
11
+ playgroundLibraryName,
12
+ TCqlEngineArgs,
13
+ TCqlEngineOutput,
14
+ unsupportedOperation,
15
+ } from "@/shared";
16
+ import { getModelXml } from "@/cql/get-model-xml";
17
+ import { getLibraryCql } from "@/cql/get-library-cql";
18
+ import { toJsCqlValue } from "@/cql/cql-value";
19
+ import {
20
+ createFhirDataProvider,
21
+ fhirModelNamespaceUri,
22
+ } from "@/cql/fhir-data-provider";
23
+
24
+ export function createStatefulEngine() {
25
+ const ucumUtils = ucum.UcumLhcUtils.getInstance();
26
+ const validateUnit = (unit: string) => {
27
+ const result = ucumUtils.validateUnitString(unit);
28
+
29
+ if (result.status === "valid") {
30
+ return null;
31
+ } else {
32
+ return result.msg[0];
33
+ }
34
+ };
35
+ const ucumService = cqlToElmJs.createUcumService(
36
+ unsupportedOperation,
37
+ validateUnit,
38
+ unsupportedOperation,
39
+ unsupportedOperation,
40
+ );
41
+
42
+ const modelManager = new cqlToElmJs.ModelManager();
43
+
44
+ const libraryManager = new cqlToElmJs.LibraryManager(
45
+ modelManager,
46
+ cqlToElmJs.CqlCompilerOptions.defaultOptions(),
47
+ null,
48
+ ucumService,
49
+ );
50
+
51
+ const runCql = (
52
+ args: TCqlEngineArgs,
53
+ onOutput: (output: TCqlEngineOutput) => void,
54
+ ) => {
55
+ const modelInfoProvider = cqlToElmJs.createModelInfoProvider(
56
+ (id: string, system: Nullable<string>, version: Nullable<string>) => {
57
+ const xml = getModelXml(
58
+ id,
59
+ system,
60
+ version,
61
+ true,
62
+ (message) => {
63
+ onOutput({
64
+ type: "log",
65
+ log: message,
66
+ });
67
+ },
68
+ () => {
69
+ runCql(args, onOutput);
70
+ },
71
+ );
72
+ if (xml === null) {
73
+ return null;
74
+ }
75
+ return cqlToElmJs.stringAsSource(xml);
76
+ },
77
+ );
78
+
79
+ const librarySourceProvider = cqlToElmJs.createLibrarySourceProvider(
80
+ (id: string, system: Nullable<string>, version: Nullable<string>) => {
81
+ const cql = getLibraryCql(
82
+ id,
83
+ system,
84
+ version,
85
+ args.cql,
86
+ args.librarySource,
87
+ args.baseUrl,
88
+ args.mountedDir,
89
+ true,
90
+ (message) => {
91
+ onOutput({
92
+ type: "log",
93
+ log: message,
94
+ });
95
+ },
96
+ () => {
97
+ runCql(args, onOutput);
98
+ },
99
+ );
100
+ if (cql === null) {
101
+ return null;
102
+ }
103
+ return cqlToElmJs.stringAsSource(cql);
104
+ },
105
+ );
106
+
107
+ modelManager.modelInfoLoader.clearModelInfoProviders();
108
+ modelManager.modelInfoLoader.registerModelInfoProvider(modelInfoProvider);
109
+ libraryManager.librarySourceLoader.clearProviders();
110
+ libraryManager.librarySourceLoader.registerProvider(librarySourceProvider);
111
+
112
+ // Ideally, only the playground library is evicted from the cache.
113
+ libraryManager.compiledLibraries.asJsMapView().clear();
114
+
115
+ for (const compilerOption of compilerOptions) {
116
+ if (args.compilerOptions.includes(compilerOption.value)) {
117
+ libraryManager.cqlCompilerOptions.options.asJsSetView().add(
118
+ cqlToElmJs.CqlCompilerOptions.Options.valueOf(compilerOption.value),
119
+ );
120
+ } else {
121
+ libraryManager.cqlCompilerOptions.options.asJsSetView().delete(
122
+ cqlToElmJs.CqlCompilerOptions.Options.valueOf(compilerOption.value),
123
+ );
124
+ }
125
+ }
126
+
127
+ libraryManager.cqlCompilerOptions.signatureLevel =
128
+ cqlToElmJs.LibraryBuilder.SignatureLevel.valueOf(args.signatureLevel);
129
+
130
+ const output = ((): TCqlEngineOutput => {
131
+ try {
132
+ const environment = new engineJs.Environment(libraryManager);
133
+
134
+ environment.registerDataProvider(
135
+ fhirModelNamespaceUri,
136
+ createFhirDataProvider(modelManager),
137
+ );
138
+
139
+ const engine = new engineJs.CqlEngine(
140
+ environment,
141
+ kotlinStdlibJs.KtMutableSet.fromJsSet(
142
+ new Set(
143
+ args.engineOptions.map((engineOption) => {
144
+ return engineJs.CqlEngine.Options.valueOf(engineOption);
145
+ }),
146
+ ),
147
+ ),
148
+ );
149
+
150
+ const evaluationParamsBuilder = new engineJs.EvaluationParams.Builder();
151
+ const libraryParamsBuilder =
152
+ new engineJs.EvaluationParams.LibraryParams.Builder();
153
+ const libraryParams = libraryParamsBuilder.build();
154
+ evaluationParamsBuilder.libraryByName(
155
+ playgroundLibraryName,
156
+ libraryParams,
157
+ );
158
+ const evaluationParams = evaluationParamsBuilder.build();
159
+
160
+ const evaluationResults = engine.evaluate(evaluationParams);
161
+
162
+ const expressionResults = [
163
+ ...evaluationResults.onlyResultOrThrow.expressionResults
164
+ .asJsReadonlyMapView()
165
+ .entries(),
166
+ ].map(([expressionName, expressionResult]) => ({
167
+ expressionName,
168
+ expressionResult: toJsCqlValue(expressionResult.value),
169
+ }));
170
+
171
+ return {
172
+ type: "expressionResults",
173
+ expressionResults: expressionResults,
174
+ };
175
+ } catch (e) {
176
+ // console.error("Error during CQL evaluation:", e);
177
+ if (e instanceof Error) {
178
+ return {
179
+ type: "evaluationException",
180
+ message: e.message,
181
+ stack: e.stack || "",
182
+ };
183
+ }
184
+ return {
185
+ type: "evaluationException",
186
+ message: String(e),
187
+ stack: "",
188
+ };
189
+ }
190
+ })();
191
+
192
+ onOutput(output);
193
+ };
194
+
195
+ return {
196
+ runCql,
197
+ };
198
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-to-ast-worker.ts ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { cqlToAst, TCqlToAstOutput } from "@/cql/cql-to-ast";
2
+
3
+ onmessage = async (event) => {
4
+ const { type, data } = event.data;
5
+
6
+ if (type === "cqlToAst") {
7
+ const output = ((): TCqlToAstOutput => {
8
+ try {
9
+ return {
10
+ ok: true,
11
+ ast: cqlToAst(data.cql),
12
+ };
13
+ } catch (e) {
14
+ console.error(e);
15
+ return {
16
+ ok: false,
17
+ error: String(e),
18
+ };
19
+ }
20
+ })();
21
+
22
+ postMessage({
23
+ type: "output",
24
+ data: {
25
+ output,
26
+ runId: data.runId,
27
+ },
28
+ });
29
+ }
30
+ };
31
+
32
+ postMessage({
33
+ type: "ready",
34
+ data: {},
35
+ });
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-to-ast.ts ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // @ts-expect-error
2
+ import { inspectCqlAst } from "cql-js/kotlin/cql.mjs";
3
+
4
+ export function cqlToAst(cql: string) {
5
+ return JSON.parse(inspectCqlAst(cql));
6
+ }
7
+
8
+ type TAst = ReturnType<typeof cqlToAst>;
9
+
10
+ export type TCqlToAstOutput =
11
+ | {
12
+ ok: true;
13
+ ast: TAst;
14
+ }
15
+ | {
16
+ ok: false;
17
+ error: string;
18
+ };
19
+
20
+ export function findRangesForCqlPos(ast: TAst, cursorPosition: number) {
21
+ if (ast.library.statements) {
22
+ for (const statement of ast.library.statements) {
23
+ if (
24
+ statement.locator.startIndex <= cursorPosition &&
25
+ cursorPosition <= statement.locator.stopIndex + 1
26
+ ) {
27
+ return [
28
+ {
29
+ start: statement.locator.startIndex,
30
+ end: statement.locator.stopIndex + 1,
31
+ },
32
+ ];
33
+ }
34
+ }
35
+ }
36
+ return [];
37
+ }
source_data/pinned/cql-clinical/clinical_quality_language/commit-bc0c795e4f2a/playground/cql/cql-to-elm-worker.ts ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { createStatefulCompiler } from "@/cql/cql-to-elm";
2
+
3
+ const { compileCql } = createStatefulCompiler(true);
4
+
5
+ onmessage = async (event) => {
6
+ const { type, data } = event.data;
7
+
8
+ if (type === "compileCql") {
9
+ compileCql(data.args, (output) => {
10
+ postMessage({
11
+ type: "output",
12
+ data: {
13
+ output,
14
+ runId: data.runId,
15
+ startTime: data.startTime,
16
+ },
17
+ });
18
+ });
19
+ }
20
+ };
21
+
22
+ postMessage({
23
+ type: "ready",
24
+ data: {},
25
+ });