health-data-standards 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8a64a7088e8424184e26a1b2eddf307d03bfb6c
4
- data.tar.gz: 37678d049beef3e04acf5823083ec6f0046698ac
3
+ metadata.gz: ed7ac32f30130f0ea0517470c15e03fdfe779114
4
+ data.tar.gz: 206797804b2a887780b08b7250ebf9063c6911c1
5
5
  SHA512:
6
- metadata.gz: beab3c39c626c200068b52bc87a2b2fd073e149bc209f3ce51077518172dfa4418e55a8737acafa3cb15096ca7762c7242e27bd85104ccde16330421bfe34b05
7
- data.tar.gz: 6be1b3371612bd1e64a7bdd2c16548d72e3b8753efc8944db6271e216d404029bd279e9968c445f385269791aee465eb5d431992e2a7fc7f5d900a5176c2464f
6
+ metadata.gz: 103de0eb07ad45cf8f1cad1cb52fa58bf150bf4e942fe47aad0be9fe051100580105b5c6d235199eea2f51fdd6b9896f4477bec29509cd7a88d32cf6314f10c3
7
+ data.tar.gz: 212134946675814e7519b8e0761c974da0d5be30c0cc3b75e31f28c822c1e184a45c693b7d7974460a157d730c2635d4395f6ee5d48bab9468a92ccfc40bacf1
@@ -93,20 +93,23 @@ module HealthDataStandards
93
93
  end
94
94
 
95
95
  def dose_quantity(codes, dose)
96
- if (codes["RxNorm"].present? || codes["CVX"].present?)
97
- if dose[:unit].present?
98
- return "value='1' unit='#{ucum_for_dose_quantity(dose[:unit])}'"
99
- else
100
- return "value='1'"
101
- end
96
+ # this previously paid attention to precoordinated medications like RxNorm and CVX
97
+ # and would ignore medication dosage if the code was one of those. However, that does
98
+ # not seem accurate. From conversation with Dave Czulada on 8/8:
99
+ # "When a medication code is "precoordinated" one should not be able to specify a UOM
100
+ # that is other than capsule/dose/tablet/unit. For example, you wouldn't say 20 MG of
101
+ # RxNorm 1000048 (Doxepin Hydrochloride 10 MG Oral Capsule). You would say 2 capsules
102
+ # of RxNorm 1000048 or 2 units of RxNorm 1000048."
103
+ #
104
+ # In order to enable a user to say "2 units" or "2 capsules", we need to allow the
105
+ # dosage to be present even if an RxNorm or CVX code is used. It is the user's job
106
+ # to confirm that they aren't contradicting the coded value.
107
+ if dose[:scalar].present?
108
+ return "value='#{dose[:scalar]}' unit='#{dose[:units]}'"
109
+ elsif dose[:value].present?
110
+ return "value='#{dose[:value]}' unit='#{dose[:unit]}'"
102
111
  else
103
- if dose[:scalar].present?
104
- return "value='#{dose[:scalar]}' unit='#{dose[:units]}'"
105
- elsif dose[:value].present?
106
- return "value='#{dose[:value]}' unit='#{dose[:unit]}'"
107
- else
108
- return "value='1'"
109
- end
112
+ return "value='1' unit='1'"
110
113
  end
111
114
  end
112
115
 
@@ -25,10 +25,9 @@
25
25
  <low <%= value_or_null_flavor(entry.start_time) %>/>
26
26
  <high <%= value_or_null_flavor(entry.end_time) %>/>
27
27
  </effectiveTime>
28
- <% if entry.administrationTiming.present?
29
- period = entry.administrationTiming['period'] %>
28
+ <% if entry.administrationTiming.present? && entry.administrationTiming.key?('scalar') %>
30
29
  <effectiveTime xsi:type="PIVL_TS" institutionSpecified="true" operator="A">
31
- <period value="<%= period['value']%>" unit="<%= period['unit']%>"/>
30
+ <period value="<%= entry.administrationTiming['scalar']%>" <% if entry.administrationTiming['units'] && (entry.administrationTiming['units'] != "") -%>unit="<%= entry.administrationTiming['units']%>"<% end %>/>
32
31
  </effectiveTime>
33
32
  <% end %>
34
33
  <% if entry.route.present? -%>
@@ -38,7 +37,7 @@
38
37
 
39
38
  <!-- Attribute: dose -->
40
39
  <% if entry.dose.present? -%>
41
- <doseQuantity value="<%= entry.dose[:value]%>"/>
40
+ <doseQuantity value="<%= entry.dose[:scalar]%>"/>
42
41
  <% end -%>
43
42
 
44
43
  <% if entry.product_form.present? -%>
@@ -48,21 +48,7 @@
48
48
  displayName="<%=entry.anatomical_location[:title]%>"
49
49
  <% end -%>/>
50
50
  <% end -%>
51
- <% if entry.severity -%>
52
- <entryRelationship typeCode="REFR">
53
- <observation classCode="OBS" moodCode="EVN">
54
- <templateId root="2.16.840.1.113883.10.20.22.4.8" extension="2014-06-09" />
55
- <code code="SEV" codeSystem="2.16.840.1.113883.5.4" />
56
- <statusCode code="completed" />
57
- <value xsi:type="CD"
58
- code="<%= entry.severity[:code] %>"
59
- codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.severity[:codeSystem] || entry.severity[:code_system]) %>"
60
- <% if entry.severity.has_key?(:title) -%>
61
- displayName="<%=entry.severity[:title]%>"
62
- <% end -%>/>
63
- </observation>
64
- </entryRelationship>
65
- <% end -%>
51
+ <%== render(:partial => 'severity', :locals => {:entry => entry, :severity_oids=>field_oids["SEVERITY"]}) %>
66
52
  </observation>
67
53
  </entryRelationship>
68
54
  </act>
@@ -24,5 +24,6 @@
24
24
  </playingEntity>
25
25
  </participantRole>
26
26
  </participant>
27
+ <%== render(:partial => 'severity', :locals => {:entry => entry, :severity_oids=>field_oids["SEVERITY"]}) %>
27
28
  </observation>
28
- </entry>
29
+ </entry>
@@ -19,6 +19,8 @@
19
19
  <high <%= value_or_null_flavor(entry.end_time) %>/>
20
20
  </effectiveTime>
21
21
  <value nullFlavor="NA" xsi:type="CD" />
22
+ <%== render(:partial => 'method', :locals => {:entry => entry, :method_oids=>field_oids["METHOD"]}) %>
23
+ <%== render(:partial => 'facility', :locals => {:entry => entry,:facility_oids=>field_oids["FACILITY_LOCATION"]}) %>
22
24
  <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
23
25
  <%== render(:partial => 'results', :locals => {:entry => entry, :result_oids => result_oids, :value_set_oid => value_set_oid}) %>
24
26
  <% if entry.components -%>
@@ -26,4 +28,4 @@
26
28
  <% end %>
27
29
  </observation>
28
30
  </entry>
29
- <% end %>
31
+ <% end %>
@@ -21,33 +21,11 @@
21
21
  <high <%= value_or_null_flavor(entry.discharge_time || entry.end_time) %>/>
22
22
  </effectiveTime>
23
23
  <% if entry.discharge_disposition.present? %>
24
- <sdtc:dischargeDispositionCode code="<%= entry.discharge_disposition.code %>"
25
- codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.discharge_disposition.code_system) %>"/>
26
- <% end -%>
27
- <% if entry.respond_to?(:facility) && entry.facility.present? -%>
28
- <participant typeCode="LOC">
29
- <!-- Facility Location template -->
30
- <templateId root="2.16.840.1.113883.10.20.24.3.100" extension="2017-08-01"/>
31
- <time>
32
- <!-- Attribute: facility location arrival datetime -->
33
- <low <%= value_or_null_flavor(entry.start_time) %>/>
34
- <!-- Attribute: facility location departure datetime -->
35
- <high <%= value_or_null_flavor(entry.end_time) %>/>
36
- </time>
37
- <participantRole classCode="SDLOC">
38
- <% if entry.facility[:values][0].present? -%>
39
- <code code="<%= entry.facility.values[0][0].code.code %>"
40
- codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.facility.values[0][0].code.code_system) %>"/>
41
- <% else -%>
42
- <code nullFlavor="UNK"/>
43
- <% end -%>
44
- <telecom nullFlavor="UNK"/>
45
- <playingEntity classCode="PLC">
46
- <name><%= entry.facility[:values][0]['display'] %></name>
47
- </playingEntity>
48
- </participantRole>
49
- </participant>
24
+ <sdtc:dischargeDispositionCode code="<%= entry.discharge_disposition[:code] %>"
25
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.discharge_disposition[:code_system]) %>"/>
50
26
  <% end -%>
27
+ <%== render(:partial => 'facility', :locals => {:entry => entry,:facility_oids=>field_oids["FACILITY_LOCATION"]}) %>
28
+ <%== render(:partial => 'admission_source', :locals => {:entry => entry,:admission_source_oids=>field_oids["ADMISSION_SOURCE"]}) %>
51
29
  <% if entry.reason.present? -%>
52
30
  <%== render(:partial => 'reason', :locals => {:entry => entry,:reason_oids=>field_oids["REASON"]}) %>
53
31
  <% end -%>
@@ -57,11 +35,13 @@
57
35
  <templateId root="2.16.840.1.113883.10.20.24.3.152" extension="2017-08-01"/>
58
36
  <id root="1.3.6.1.4.1.115" extension="<%= UUID.generate %>"/>
59
37
  <code code="8319008" codeSystem="2.16.840.1.113883.6.96" displayName="Principal Diagnosis" codeSystemName="SNOMED CT"/>
60
- <value code="<%= entry.principal_diagnosis.code %>" xsi:type="CD" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.principal_diagnosis.code_system) %>"/>
38
+ <value code="<%= entry.principal_diagnosis[:code] %>" xsi:type="CD" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.principal_diagnosis[:code_system]) %>"/>
61
39
  </observation>
62
40
  </entryRelationship>
63
41
  <% end -%>
64
- <% if entry.diagnosis %>
42
+ <% if entry.diagnosis
43
+ entry.diagnosis[:values].each do |diagnosis|
44
+ %>
65
45
  <entryRelationship typeCode="REFR">
66
46
  <act classCode="ACT" moodCode="EVN">
67
47
  <templateId root="2.16.840.1.113883.10.20.22.4.80" extension="2015-08-01"/>
@@ -81,12 +61,13 @@
81
61
  <!-- Attribute: discharge datetime -->
82
62
  <high <%= value_or_null_flavor(entry.end_time) %>/>
83
63
  </effectiveTime>
84
- <value code="<%= entry.diagnosis.values[1][0].code %>" xsi:type="CD" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.diagnosis.values[1][0].code_system) %>"/>
64
+ <value code="<%= diagnosis[:code] %>" xsi:type="CD" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(diagnosis[:code_system]) %>" />
85
65
  </observation>
86
66
  </entryRelationship>
87
67
  </act>
88
68
  </entryRelationship>
89
- <% end -%>
69
+ <% end
70
+ end -%>
90
71
  </encounter>
91
72
  </entryRelationship>
92
73
  <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"], :r2_compatibility => r2_compatibility}) %>
@@ -14,7 +14,7 @@
14
14
  </effectiveTime>
15
15
  <%== render(:partial => 'reason', :locals => {:entry => entry ,:reason_oids=>field_oids["REASON"]}) %>
16
16
  <%if !entry.values.empty? %>
17
- <%== render(:partial=> 'result_value', :locals => {:values => entry.values}) %>
17
+ <%== render(:partial=> 'results', :locals => {:entry => entry}) %>
18
18
  <% end %>
19
19
 
20
20
  </act>
@@ -19,5 +19,19 @@
19
19
  <% if entry.components -%>
20
20
  <%== render(:partial => 'components', :locals => {:entry => entry} ) %>
21
21
  <% end %>
22
- </observation>
23
- </entry>
22
+ <% if entry.referenceRangeHigh || entry.referenceRangeLow %>
23
+ <referenceRange>
24
+ <observationRange>
25
+ <value xsi:type="IVL_PQ">
26
+ <% if entry.referenceRangeLow %>
27
+ <low value="<%= entry.referenceRangeLow['scalar'] %>" <% if entry.referenceRangeLow['units'] && (entry.referenceRangeLow['units'] != "") -%>unit="<%= entry.referenceRangeLow['units'] %>"<% else -%>unit="1"<% end -%>/>
28
+ <% end %>
29
+ <% if entry.referenceRangeHigh %>
30
+ <high value="<%= entry.referenceRangeHigh['scalar'] %>" <% if entry.referenceRangeHigh['units'] && (entry.referenceRangeHigh['units'] != "") -%>unit="<%= entry.referenceRangeHigh['units'] %>"<% else -%>unit="1"<% end -%>/>
31
+ <% end %>
32
+ </value>
33
+ </observationRange>
34
+ </referenceRange>
35
+ <% end %>
36
+ </observation>
37
+ </entry>
@@ -12,10 +12,9 @@
12
12
  <low <%= value_or_null_flavor(entry.start_time) %>/>
13
13
  <high <%= value_or_null_flavor(entry.end_time) %>/>
14
14
  </effectiveTime>
15
- <% if entry.administrationTiming.present?
16
- period = entry.administrationTiming['period'] %>
15
+ <% if entry.administrationTiming.present? && entry.administrationTiming.key?('scalar') %>
17
16
  <effectiveTime xsi:type="PIVL_TS" institutionSpecified="true" operator="A">
18
- <period value="<%= period['value']%>" unit="<%= period['unit']%>"/>
17
+ <period value="<%= entry.administrationTiming['scalar']%>" <% if entry.administrationTiming['units'] && (entry.administrationTiming['units'] != "") -%>unit="<%= entry.administrationTiming['units']%>"<% end %>/>
19
18
  </effectiveTime>
20
19
  <% end %>
21
20
  <%== render(:partial => 'medication_details', :locals => {:entry => entry, :route_oids=>field_oids["ROUTE"]}) %>
@@ -38,7 +37,7 @@
38
37
  </manufacturedProduct>
39
38
  </consumable>
40
39
 
41
- <%== render(:partial => 'medication_dispense', :collection => entry.fulfillmentHistory, :locals => {:entry => entry, :value_set_map => value_set_map, :value_set_oid => value_set_oid}) %>
40
+ <%== render(:partial => 'medication_dispense', :locals => {:entry => entry, :filtered_vs_map => filtered_vs_map}) %>
42
41
 
43
42
  </substanceAdministration>
44
43
 
@@ -11,6 +11,11 @@
11
11
  <low <%= value_or_null_flavor(entry.start_time) %>/>
12
12
  <high <%= value_or_null_flavor(entry.end_time) %>/>
13
13
  </effectiveTime>
14
+ <% if entry.administrationTiming.present? && entry.administrationTiming.key?('scalar') %>
15
+ <effectiveTime xsi:type="PIVL_TS" institutionSpecified="true" operator="A">
16
+ <period value="<%= entry.administrationTiming['scalar']%>" <% if entry.administrationTiming['units'] && (entry.administrationTiming['units'] != "") -%>unit="<%= entry.administrationTiming['units']%>"<% end %>/>
17
+ </effectiveTime>
18
+ <% end %>
14
19
  <%== render(:partial => 'medication_details', :locals => {:entry => entry, :route_oids=>field_oids["ROUTE"]}) %>
15
20
  <consumable>
16
21
  <manufacturedProduct classCode="MANU">
@@ -23,5 +28,6 @@
23
28
  </manufacturedProduct>
24
29
  </consumable>
25
30
  <%== render(:partial => 'reason', :locals => {:entry => entry,:reason_oids=>field_oids["REASON"]}) %>
31
+ <%== render(:partial => 'medication_dispense', :locals => {:entry => entry, :filtered_vs_map => filtered_vs_map}) %>
26
32
  </substanceAdministration>
27
- </entry>
33
+ </entry>
@@ -15,14 +15,15 @@
15
15
  <effectiveTime xsi:type="PIVL_TS" institutionSpecified="true" operator="A">
16
16
  <period nullFlavor="NA"/>
17
17
  </effectiveTime>
18
- <% elsif entry.administrationTiming.present?
19
- period = entry.administrationTiming['period'] %>
18
+ <% elsif entry.administrationTiming.present? && entry.administrationTiming.key?('scalar')%>
20
19
  <effectiveTime xsi:type="PIVL_TS" institutionSpecified="true" operator="A">
21
- <period value="<%= period['value']%>" unit="<%= period['unit']%>"/>
20
+ <period value="<%= entry.administrationTiming['scalar']%>" <% if entry.administrationTiming['units'] && (entry.administrationTiming['units'] != "") -%>unit="<%= entry.administrationTiming['units']%>"<% end %>/>
22
21
  </effectiveTime>
23
22
  <% end %>
24
23
  <% if entry.allowedAdministrations.present? %>
25
24
  <repeatNumber value="<%== entry.allowedAdministrations %>" />
25
+ <% elsif entry.refills.present? %>
26
+ <repeatNumber value="<%== entry.refills['scalar'] %>" />
26
27
  <% end %>
27
28
  <%== render(:partial => 'medication_details', :locals => {:entry => entry, :route_oids=>field_oids["ROUTE"]}) %>
28
29
  <consumable>
@@ -13,6 +13,14 @@
13
13
  <high <%= value_or_null_flavor(entry.end_time) %>/>
14
14
  </effectiveTime>
15
15
  <%== render(:partial => 'ordinality', :locals => {:entry => entry, :ordinality_oids=>field_oids["ORDINAL"]}) %>
16
+ <%== render(:partial => 'method', :locals => {:entry => entry, :method_oids=>field_oids["METHOD"]}) %>
17
+ <% if entry.anatomical_location -%>
18
+ <targetSiteCode code="<%= entry.anatomical_location[:code] %>"
19
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.anatomical_location[:codeSystem] || entry.anatomical_location[:code_system]) %>"
20
+ <% if entry.anatomical_location.has_key?(:title) -%>
21
+ displayName="<%=entry.anatomical_location[:title]%>"
22
+ <% end -%>/>
23
+ <% end -%>
16
24
  <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
17
25
  <% if entry.respond_to?(:incision_time) && entry.incision_time.present? -%>
18
26
  <entryRelationship typeCode="REFR">
@@ -52,4 +60,3 @@
52
60
  <% end %>
53
61
  </procedure>
54
62
  </entry>
55
-
@@ -28,8 +28,8 @@
28
28
  </playingDevice>
29
29
  </participantRole>
30
30
  </participant>
31
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
31
32
  </supply>
32
33
  </entryRelationship>
33
- <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
34
34
  </act>
35
35
  </entry>
@@ -0,0 +1,8 @@
1
+ <% if entry.admissionSource.present? %>
2
+ <participant typeCode="LOC">
3
+ <participantRole classCode="SDLOC">
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.151" extension="2017-08-01"/>
5
+ <code code="<%= entry.admissionSource.code %>" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.admissionSource.code_system) %>"/>
6
+ </participantRole>
7
+ </participant>
8
+ <% end %>
@@ -1,5 +1,9 @@
1
1
  <% if result['code'] -%>
2
- <value xsi:type="CD" code="<%= result['code'].code %>" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(result['code'].code_system) %>" />
2
+ <value xsi:type="CD" code="<%= result['code']['code'] %>" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(result['code']['code_system']) %>" />
3
3
  <% elsif result['scalar'] %>
4
- <value xsi:type="PQ" value="<%= result['scalar'] %>" unit="<%= result['units'] %>"/>
4
+ <% if result['units'] == 'UnixTime' %>
5
+ <value xsi:type="TS" <%= value_or_null_flavor(result['scalar']) %>/>
6
+ <% else %>
7
+ <value xsi:type="PQ" value="<%= result['scalar'] %>" <% if result['units'] && (result['units'] != "") -%>unit="<%= result['units']%>"<% else %>unit="1"<% end %>/>
8
+ <% end %>
5
9
  <% end %>
@@ -4,8 +4,22 @@
4
4
  <!-- Component -->
5
5
  <templateId root="2.16.840.1.113883.10.20.24.3.149" extension="2017-08-01" />
6
6
  <id root="1.3.6.1.4.1.115" extension="<%= identifier_for(component) %>"/>
7
- <code code="<%= component.code['code'] %>" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(component.code['code_system']) %>" />
8
- <%== render(:partial => 'component_value', :locals => {:result => component.result} ) %>
7
+ <code code="<%= component[:code][:code] %>" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(component[:code][:code_system]) %>" />
8
+ <%== render(:partial => 'component_value', :locals => {:result => component[:result]} ) %>
9
+ <% if (component['referenceRangeHigh'] && !component['referenceRangeHigh']['scalar'].to_s.empty?) || (component['referenceRangeLow'] && !component['referenceRangeLow']['scalar'].to_s.empty?) %>
10
+ <referenceRange>
11
+ <observationRange>
12
+ <value xsi:type="IVL_PQ">
13
+ <% if component['referenceRangeLow'] %>
14
+ <low value="<%= component['referenceRangeLow']['scalar'] %>" <% if component['referenceRangeLow']['units'] && (component['referenceRangeLow']['units'] != "") -%>unit="<%= component['referenceRangeLow']['units'] %>"<% else -%>unit="1"<% end -%>/>
15
+ <% end %>
16
+ <% if component['referenceRangeHigh'] %>
17
+ <high value="<%= component['referenceRangeHigh']['scalar'] %>" <% if component['referenceRangeHigh']['units'] && (component['referenceRangeHigh']['units'] != "") -%>unit="<%= component['referenceRangeHigh']['units'] %>"<% else -%>unit="1"<% end -%>/>
18
+ <% end %>
19
+ </value>
20
+ </observationRange>
21
+ </referenceRange>
22
+ <% end %>
9
23
  </observation>
10
24
  </entryRelationship>
11
25
  <% end %>
@@ -0,0 +1,31 @@
1
+ <% if entry.respond_to?(:facility) && entry.facility.present?
2
+ entry.facility[:values].each do |facility|
3
+ start_time = facility[:locationPeriodLow].present? ? DateTime.strptime(facility[:locationPeriodLow], "%m/%d/%Y %I:%M %p").to_i : nil
4
+ end_time = facility[:locationPeriodHigh].present? ? DateTime.strptime(facility[:locationPeriodHigh], "%m/%d/%Y %I:%M %p").to_i : nil
5
+ -%>
6
+ <participant typeCode="LOC">
7
+ <!-- Facility Location template -->
8
+ <templateId root="2.16.840.1.113883.10.20.24.3.100" extension="2017-08-01"/>
9
+ <time>
10
+ <!-- Attribute: facility location arrival datetime -->
11
+ <low <%= value_or_null_flavor(start_time) %>/>
12
+ <!-- Attribute: facility location departure datetime -->
13
+ <high <%= value_or_null_flavor(end_time) %>/>
14
+ </time>
15
+ <participantRole classCode="SDLOC">
16
+ <% if facility[:code].present? -%>
17
+ <code code="<%= facility[:code][:code] %>"
18
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(facility[:code][:code_system]) %>"/>
19
+ <% else -%>
20
+ <code nullFlavor="UNK"/>
21
+ <% end -%>
22
+ <telecom nullFlavor="UNK"/>
23
+ <% if facility[:display].present? -%>
24
+ <playingEntity classCode="PLC">
25
+ <name><%= facility[:display] %></name>
26
+ </playingEntity>
27
+ <% end -%>
28
+ </participantRole>
29
+ </participant>
30
+ <% end
31
+ end -%>
@@ -58,11 +58,10 @@
58
58
  <versionNumber value="<%= measure.hqmf_version_number %>"/>
59
59
  </externalDocument>
60
60
  </reference>
61
- </organizer>
62
-
61
+
63
62
  <% # Only want the epxected values when running from Bonnie
64
63
  if patient.respond_to?('expected_values_for_qrda_export') -%>
65
- <component>
64
+
66
65
  <%
67
66
  # # Going to assume that any expected_value > 0 is a TRUE
68
67
  # # As per HL7 CDA R2:QRDA I, R1, STU Release 3.1, US Realm, Vol. 2 —Templates and Supporting Material
@@ -70,13 +69,13 @@
70
69
  # # QRDA expects IPOP instead of IPP.
71
70
  qrda_expected_values = patient.expected_values_for_qrda_export(measure)
72
71
  qrda_expected_values.each do |qev| -%>
72
+ <component>
73
73
  <observation classCode="OBS" moodCode="EVN" negationInd="<%= qev[:expected_value] == '0' ? 'true' : 'false' %>">
74
74
  <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
75
75
  <value xsi:type="CD"
76
76
  code="<%= qev[:code] == 'IPP' ? 'IPOP' : qev[:code] %>"
77
77
  codeSystem="2.16.840.1.113883.5.4"
78
- codeSystemName="ActCode"
79
- displayName="<%= qev[:display_name] %>"/>
78
+ codeSystemName="ActCode"/>
80
79
  <!-- Explicit reference to the eMeasure population (because some eMeasures have multiple Numerators, etc -->
81
80
  <reference typeCode="REFR">
82
81
  <externalObservation classCode="OBS" moodCode="EVN">
@@ -84,9 +83,10 @@
84
83
  </externalObservation>
85
84
  </reference>
86
85
  </observation>
86
+ </component>
87
87
  <% end -%>
88
- </component>
89
88
  <% end -%>
89
+ </organizer>
90
90
  </entry>
91
91
  <% end -%>
92
92
  </section>
@@ -1,13 +1,16 @@
1
-
1
+ <% if entry.supply %>
2
2
  <entryRelationship typeCode="REFR">
3
3
  <supply classCode="SPLY" moodCode="EVN">
4
4
  <!-- Medication Dispense template -->
5
5
  <templateId root="2.16.840.1.113883.10.20.22.4.18" extension="2014-06-09"/>
6
6
  <id root="1.3.6.1.4.1.115" extension="<%= UUID.generate %>"/>
7
7
  <statusCode code="completed"/>
8
- <effectiveTime <%= value_or_null_flavor(medication_dispense.dispense_date) %>/>
8
+ <effectiveTime xsi:type="IVL_TS">
9
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
10
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
11
+ </effectiveTime>
9
12
  <repeatNumber value="1"/>
10
- <quantity <%= fulfillment_quantity(entry.codes, medication_dispense, entry.dose) %>/>
13
+ <quantity value="<%= entry.supply[:scalar] %>" <% if entry.supply[:units] %>unit="<%= entry.supply[:units] %>"<% end %>/>
11
14
  <product>
12
15
  <manufacturedProduct classCode="MANU">
13
16
  <!-- Medication Information (consolidation) template -->
@@ -20,3 +23,4 @@
20
23
  </product>
21
24
  </supply>
22
25
  </entryRelationship>
26
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% if entry.respond_to?(:method) && entry.method.present?
2
+ -%>
3
+ <methodCode code="<%= entry.method[:code] %>"
4
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.method[:codeSystem] || entry.method[:code_system]) %>"
5
+ />
6
+ <% end -%>
@@ -3,14 +3,17 @@
3
3
  <observation classCode="OBS" moodCode="EVN">
4
4
  <!-- Conforms to C-CDA R2 Result Observation (V2) -->
5
5
  <templateId root="2.16.840.1.113883.10.20.22.4.2" extension="2015-08-01"/>
6
- <!-- Result (QRDA I R3) -->
7
- <templateId root="2.16.840.1.113883.10.20.24.3.87" extension="2016-02-01"/>
8
6
  <id root="1.3.6.1.4.1.115" extension="<%= identifier_for(value) %>"/>
9
7
  <%== code_display(entry, 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['*']) %>
10
8
  <statusCode code="completed"/>
11
9
  <effectiveTime>
10
+ <% if entry.result_date_time? %>
11
+ <low <%= value_or_null_flavor(entry.result_date_time) %>/>
12
+ <high <%= value_or_null_flavor(entry.result_date_time) %>/>
13
+ <% else %>
12
14
  <low <%= value_or_null_flavor(entry.start_time) %>/>
13
15
  <high <%= value_or_null_flavor(entry.end_time) %>/>
16
+ <% end %>
14
17
  </effectiveTime>
15
18
  <%== render(:partial=> 'result_value', :locals => {:values => [value], :result_oids=>result_oids}) %>
16
19
  </observation>
@@ -0,0 +1,14 @@
1
+ <% if entry.severity.present? -%>
2
+ <entryRelationship typeCode="RSON">
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.8" extension="2014-06-09"/>
5
+ <id root="1.3.6.1.4.1.115" extension="<%= identifier_for([reason, entry.start_time]) %>" />
6
+ <code code="SEV" codeSystem="2.16.840.1.113883.5.4" />
7
+ <statusCode code="completed"/>
8
+ <value xsi:type="CD"
9
+ code="<%= entry.severity[:code] %>"
10
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.severity[:codeSystem] || entry.severity[:code_system]) %>"
11
+ />
12
+ </observation>
13
+ </entryRelationship>
14
+ <% end -%>
@@ -0,0 +1,17 @@
1
+ <% status = entry.qmd_status
2
+
3
+ if status.present?
4
+ debugger
5
+ -%>
6
+ <entryRelationship typeCode="REFR">
7
+ <observation classCode="OBS" moodCode="EVN">
8
+ <templateId root="2.16.840.1.113883.10.20.24.3.93"/>
9
+ <id root="1.3.6.1.4.1.115" extension="<%= identifier_for(status) %>" />
10
+ <code code="33999-4"
11
+ codeSystem="2.16.840.1.113883.6.1"
12
+ displayName="status"
13
+ codeSystemName="LOINC"/>
14
+ <%== render(:partial=> 'result_value', :locals => {:values => [status], :result_oids=>status_oids}) %>
15
+ </observation>
16
+ </entryRelationship>
17
+ <% end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health-data-standards
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MITRE Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-13 00:00:00.000000000 Z
11
+ date: 2018-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -128,14 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.8.2
131
+ version: 1.8.3
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.8.2
138
+ version: 1.8.3
139
+ - !ruby/object:Gem::Dependency
140
+ name: mongo
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 2.4.3
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 2.4.3
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: highline
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -830,15 +844,18 @@ files:
830
844
  - templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.9.cat1.erb
831
845
  - templates/cat1/r5/_2.16.840.1.113883.10.20.28.3.6.cat1.erb
832
846
  - templates/cat1/r5/_address.cat1.erb
847
+ - templates/cat1/r5/_admission_source.cat1.erb
833
848
  - templates/cat1/r5/_author.cat1.erb
834
849
  - templates/cat1/r5/_author_qdm.cat1.erb
835
850
  - templates/cat1/r5/_component_value.cat1.erb
836
851
  - templates/cat1/r5/_components.cat1.erb
852
+ - templates/cat1/r5/_facility.cat1.erb
837
853
  - templates/cat1/r5/_fulfills.cat1.erb
838
854
  - templates/cat1/r5/_id.cat1.erb
839
855
  - templates/cat1/r5/_measures.cat1.erb
840
856
  - templates/cat1/r5/_medication_details.cat1.erb
841
857
  - templates/cat1/r5/_medication_dispense.cat1.erb
858
+ - templates/cat1/r5/_method.cat1.erb
842
859
  - templates/cat1/r5/_ordinality.cat1.erb
843
860
  - templates/cat1/r5/_organization.cat1.erb
844
861
  - templates/cat1/r5/_patient_data.cat1.erb
@@ -848,6 +865,8 @@ files:
848
865
  - templates/cat1/r5/_reporting_parameters.cat1.erb
849
866
  - templates/cat1/r5/_result_value.cat1.erb
850
867
  - templates/cat1/r5/_results.cat1.erb
868
+ - templates/cat1/r5/_severity.cat1.erb
869
+ - templates/cat1/r5/_status.cat1.erb
851
870
  - templates/cat1/r5/_telecom.cat1.erb
852
871
  - templates/cat1/r5/show.cat1.erb
853
872
  - templates/cat3/r1/_address.cat3.erb
@@ -945,7 +964,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
945
964
  version: '0'
946
965
  requirements: []
947
966
  rubyforge_project:
948
- rubygems_version: 2.5.2.1
967
+ rubygems_version: 2.6.12
949
968
  signing_key:
950
969
  specification_version: 4
951
970
  summary: A library for generating and consuming various healthcare related formats.