-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathExampleELMLibraryBreakdown.xml
More file actions
90 lines (85 loc) · 3.49 KB
/
Copy pathExampleELMLibraryBreakdown.xml
File metadata and controls
90 lines (85 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version="1.0" encoding="UTF-8"?>
<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">
<identifier id="ExampleELMLibrary"/>
<schemaIdentifier id=""/>
<parameters>
<def name="ABC" parameterType="List<MissedAppointmentType>"/>
</parameters>
<statements>
<!--
[Encounter, Performance: "Inpatient"] E
with [Condition: "Acute Pharyngitis"] P
where P.effectiveTime overlaps after E.performanceTime
where duration in days of E.performanceTime >= 120
return tuple { id: E.id, lengthOfStay: duration in days of E.performanceTime }
sort by lengthOfStay desc
-->
<def name="PharyngitisConditions" context="PATIENT">
<expression xsi:type="ClinicalRequest" dataType="ConditionObservationOccurrence" cardinality="Multiple" codeProperty="code">
<codes xsi:type="ValueSetRef" name="AcutePharyngitis"/>
</expression>
</def>
<def name="InpatientEncounters" context="PATIENT">
<expression xsi:type="ClinicalRequest" dataType="EncounterPerformanceOccurrence" cardinality="Multiple" codeProperty="encounterType" dateProperty="performanceTime" idProperty="id">
<codes xsi:type="ValueSetRef" name="Inpatient"/>
</expression>
</def>
<def name="EncountersWithPharyngitis" context="PATIENT">
<expression xsi:type="Filter" scope="E">
<source xsi:type="ExpressionRef" name="InpatientEncounters"/>
<condition xsi:type="IsNotEmpty">
<operand xsi:type="Filter" scope="P">
<source xsi:type="ExpressionRef" name="PharyngitisConditions"/>
<condition xsi:type="OverlapsAfter">
<operand xsi:type="Property" path="effectiveTime" scope="P"/>
<operand xsi:type="Property" path="performanceTime" scope="E"/>
</condition>
</operand>
</condition>
</expression>
</def>
<def name="EncountersLessThan120Days">
<expression xsi:type="Filter" scope="E">
<source xsi:type="ExpressionDef" name="EncountersWithPharyngitis"/>
<condition xsi:type="GreaterOrEqual">
<operand xsi:type="DateDiff">
<startDate xsi:type="Begin">
<operand xsi:type="Property" path="performanceTime" scope="E"/>
</startDate>
<endDate xsi:type="End">
<operand xsi:type="Property" path="performanceTime" scope="E"/>
</endDate>
<granularity xsi:type="Literal" valueType="DateGranularity" value="day"/>
</operand>
<operand xsi:type="Literal" valueType="xs:int" value="120"></operand>
</condition>
</expression>
</def>
<def name="EncountersWithLengthOfStay">
<expression xsi:type="ForEach" scope="E">
<source xsi:type="ExpressionRef" name="EncountersLessThan120Days"/>
<element xsi:type="ObjectExpression">
<property name="id">
<value xsi:type="Property" path="id" scope="E"/>
</property>
<property name="lengthOfStay">
<value xsi:type="DateDiff">
<startDate xsi:type="Begin">
<operand xsi:type="Property" path="performanceTime" scope="E"/>
</startDate>
<endDate xsi:type="End">
<operand xsi:type="Property" path="performanceTime" scope="E"/>
</endDate>
<granularity xsi:type="Literal" valueType="DateGranularity" value="day"/>
</value>
</property>
</element>
</expression>
</def>
<def name="FullQuery" context="PATIENT">
<expression xsi:type="Sort" orderBy="lengthOfStay">
<source xsi:type="ExpressionDef" name="EncountersWithLengthOfStay"/>
</expression>
</def>
</statements>
</library>