health-data-standards 3.4.6 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/README.md +4 -0
- data/lib/health-data-standards.rb +1 -0
- data/lib/health-data-standards/export/cat_1.rb +4 -4
- data/lib/health-data-standards/export/helper/scooped_view_helper.rb +16 -16
- data/lib/health-data-standards/export/qrda/hqmf-qrda-oids.json +6 -0
- data/lib/health-data-standards/export/view_helper.rb +8 -1
- data/lib/health-data-standards/import/bulk_record_importer.rb +45 -13
- data/lib/health-data-standards/import/bundle/importer.rb +2 -4
- data/lib/health-data-standards/import/cda/provider_importer.rb +2 -2
- data/lib/health-data-standards/import/green_c32/section_importer.rb +2 -2
- data/lib/health-data-standards/import/provider_import_utils.rb +2 -2
- data/lib/health-data-standards/models/cda_identifier.rb +1 -0
- data/lib/health-data-standards/models/cqm/bundle.rb +4 -1
- data/lib/health-data-standards/models/cqm/measure.rb +40 -25
- data/lib/health-data-standards/models/cqm/patient_cache.rb +61 -60
- data/lib/health-data-standards/models/encounter.rb +4 -12
- data/lib/health-data-standards/models/entry.rb +4 -8
- data/lib/health-data-standards/models/facility.rb +1 -0
- data/lib/health-data-standards/models/fulfillment_history.rb +6 -18
- data/lib/health-data-standards/models/guarantor.rb +1 -0
- data/lib/health-data-standards/models/lab_result.rb +2 -6
- data/lib/health-data-standards/models/medical_equipment.rb +2 -7
- data/lib/health-data-standards/models/medication.rb +11 -31
- data/lib/health-data-standards/models/metadata/link_info.rb +1 -0
- data/lib/health-data-standards/models/order_information.rb +5 -13
- data/lib/health-data-standards/models/organization.rb +1 -0
- data/lib/health-data-standards/models/procedure.rb +1 -4
- data/lib/health-data-standards/models/provider.rb +2 -1
- data/lib/health-data-standards/models/provider_performance.rb +1 -0
- data/lib/health-data-standards/models/qrda/legal_authenticator.rb +1 -0
- data/lib/health-data-standards/models/qrda/organization.rb +2 -0
- data/lib/health-data-standards/models/record.rb +7 -7
- data/lib/health-data-standards/models/result_value.rb +1 -0
- data/lib/health-data-standards/models/svs/concept.rb +1 -0
- data/lib/health-data-standards/models/svs/value_set.rb +1 -0
- data/lib/health-data-standards/models/telecom.rb +1 -0
- data/lib/health-data-standards/models/transfer.rb +1 -0
- data/lib/health-data-standards/tasks/bundle.rake +3 -3
- data/lib/health-data-standards/util/vs_api.rb +2 -2
- data/lib/hqmf-generator/attribute.xml.erb +9 -11
- data/lib/hqmf-generator/characteristic_criteria.xml.erb +5 -5
- data/lib/hqmf-generator/code.xml.erb +6 -2
- data/lib/hqmf-generator/condition_criteria.xml.erb +4 -5
- data/lib/hqmf-generator/derivation.xml.erb +6 -6
- data/lib/hqmf-generator/description.xml.erb +1 -1
- data/lib/hqmf-generator/document.xml.erb +46 -11
- data/lib/hqmf-generator/encounter_criteria.xml.erb +4 -5
- data/lib/hqmf-generator/field.xml.erb +13 -1
- data/lib/hqmf-generator/grouper_criteria.xml.erb +17 -0
- data/lib/hqmf-generator/hqmf-generator.rb +75 -8
- data/lib/hqmf-generator/local_variable.xml.erb +1 -0
- data/lib/hqmf-generator/measure_observation_definition.xml.erb +25 -0
- data/lib/hqmf-generator/observation_criteria.xml.erb +4 -5
- data/lib/hqmf-generator/population_criteria.xml.erb +2 -3
- data/lib/hqmf-generator/precondition.xml.erb +2 -2
- data/lib/hqmf-generator/precondition_cv.xml.erb +8 -0
- data/lib/hqmf-generator/procedure_criteria.xml.erb +4 -5
- data/lib/hqmf-generator/reference.xml.erb +2 -2
- data/lib/hqmf-generator/source.xml.erb +2 -2
- data/lib/hqmf-generator/specific_occurrence.xml.erb +4 -5
- data/lib/hqmf-generator/subset.xml.erb +16 -3
- data/lib/hqmf-generator/substance_criteria.xml.erb +4 -5
- data/lib/hqmf-generator/supply_criteria.xml.erb +4 -5
- data/lib/hqmf-generator/temporal_relationship.xml.erb +1 -1
- data/lib/hqmf-generator/value.xml.erb +35 -9
- data/lib/hqmf-generator/variable_criteria.xml.erb +2 -3
- data/lib/hqmf-model/attribute.rb +36 -8
- data/lib/hqmf-model/data_criteria.json +38 -204
- data/lib/hqmf-model/data_criteria.rb +40 -16
- data/lib/hqmf-model/document.rb +61 -2
- data/lib/hqmf-model/population_criteria.rb +11 -7
- data/lib/hqmf-model/precondition.rb +1 -1
- data/lib/hqmf-model/types.rb +91 -8
- data/lib/hqmf-parser/1.0/attribute.rb +55 -2
- data/lib/hqmf-parser/1.0/document.rb +10 -23
- data/lib/hqmf-parser/1.0/population_criteria.rb +2 -2
- data/lib/hqmf-parser/1.0/range.rb +0 -1
- data/lib/hqmf-parser/2.0/data_criteria.rb +90 -21
- data/lib/hqmf-parser/2.0/document.rb +122 -7
- data/lib/hqmf-parser/2.0/population_criteria.rb +18 -6
- data/lib/hqmf-parser/2.0/precondition.rb +4 -1
- data/lib/hqmf-parser/2.0/types.rb +36 -15
- data/lib/hqmf-parser/converter/pass1/document_converter.rb +4 -56
- data/lib/hqmf-parser/converter/pass1/population_criteria_converter.rb +24 -8
- data/lib/hqmf-parser/converter/pass1/precondition_extractor.rb +15 -2
- data/lib/hqmf-parser/converter/pass2/comparison_converter.rb +1 -1
- data/lib/hqmf-parser/parser.rb +64 -41
- data/templates/cat1/_2.16.840.1.113883.10.20.22.4.85.cat1.erb +0 -1
- data/templates/cat1/_address.cat1.erb +9 -0
- data/templates/cat1/_author.cat1.erb +28 -0
- data/templates/cat1/_id.cat1.erb +1 -0
- data/templates/cat1/_organization.cat1.erb +8 -0
- data/templates/cat1/_patient_data.cat1.erb +0 -3
- data/templates/cat1/_telecom.cat1.erb +1 -0
- data/templates/cat1/show.cat1.erb +96 -58
- metadata +115 -66
- checksums.yaml +0 -7
@@ -6,7 +6,7 @@ namespace :bundle do
|
|
6
6
|
|
7
7
|
desc 'Activate/Inactivate a measure bundle'
|
8
8
|
task :activate,[:version,:active] => [:environment] do |task, args|
|
9
|
-
bundle = Bundle.where({version: args.version})
|
9
|
+
bundle = HealthDataStandards::CQM::Bundle.where({version: args.version})
|
10
10
|
if bundle.count == 0
|
11
11
|
puts "Cannot find bundle with version number #{args.version}"
|
12
12
|
return
|
@@ -23,7 +23,7 @@ namespace :bundle do
|
|
23
23
|
|
24
24
|
desc 'List bundles'
|
25
25
|
task :list => [:environment] do
|
26
|
-
Bundle.where({}).each do |b|
|
26
|
+
HealthDataStandards::CQM::Bundle.where({}).each do |b|
|
27
27
|
puts "Bundle #{b.title} - #{b.version} active: #{b.active}"
|
28
28
|
end
|
29
29
|
end
|
@@ -49,7 +49,7 @@ namespace :bundle do
|
|
49
49
|
|
50
50
|
if (args.create_indexes != 'false')
|
51
51
|
::Rails.application.eager_load!
|
52
|
-
::
|
52
|
+
::Mongoid::Tasks::Database.create_indexes
|
53
53
|
end
|
54
54
|
|
55
55
|
puts "Successfully imported bundle at: #{args.bundle_path}"
|
@@ -12,10 +12,10 @@ module HealthDataStandards
|
|
12
12
|
@password = password
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
def get_valueset(oid, effective_date=nil, &block)
|
15
|
+
def get_valueset(oid, effective_date=nil, include_draft=false, &block)
|
17
16
|
params = {id: oid, ticket: get_ticket}
|
18
17
|
params[:effectiveDate] = effective_date if effective_date
|
18
|
+
params[:includeDraft] = 'yes' if include_draft
|
19
19
|
vs = RestClient.get api_url, {:params=>params}
|
20
20
|
yield oid,vs if block_given?
|
21
21
|
vs
|
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
</measureAttribute>
|
11
|
-
</subjectOf>
|
1
|
+
<subjectOf>
|
2
|
+
<measureAttribute classCode="OBS" moodCode="EVN">
|
3
|
+
<%- if attribute.id_obj -%>
|
4
|
+
<id root="2.16.840.1.113883.3.100.1" <%="extension=\"#{attribute.id_obj.extension}\"" if attribute.id_obj.extension %>"/>
|
5
|
+
<%- end -%>
|
6
|
+
<%= xml_for_value(attribute.code_obj, 'code', false) %>
|
7
|
+
<%= xml_for_value(attribute.value_obj, 'value') %>
|
8
|
+
</measureAttribute>
|
9
|
+
</subjectOf>
|
@@ -1,9 +1,8 @@
|
|
1
1
|
<entry typeCode="DRIV">
|
2
|
+
<%= xml_for_local_variable(criteria) %>
|
2
3
|
<observationCriteria moodCode="EVN" classCode="OBS">
|
3
4
|
<%= xml_for_template(criteria, is_source_data_criteria) %>
|
4
|
-
<id
|
5
|
-
<item root="2.16.840.1.113883.3.100.1" extension="<%= criteria.id %>"/>
|
6
|
-
</id>
|
5
|
+
<id root="2.16.840.1.113883.3.100.1" extension="<%= criteria.id %>"/>
|
7
6
|
<%= xml_for_code(criteria) %>
|
8
7
|
<%= xml_for_description(criteria) %>
|
9
8
|
<%= xml_for_effective_time(criteria) %>
|
@@ -11,11 +10,12 @@
|
|
11
10
|
<%= xml_for_value(criteria.value) %>
|
12
11
|
<%- end -%>
|
13
12
|
<definition>
|
14
|
-
<
|
13
|
+
<criteriaReference moodCode="EVN" classCode="OBS">
|
15
14
|
<id root="2.16.840.1.113883.3.100.1" extension="<%= section_name(criteria) %>"/>
|
16
|
-
</
|
15
|
+
</criteriaReference>
|
17
16
|
</definition>
|
18
17
|
<%= xml_for_temporal_references(criteria) %>
|
19
18
|
<%= xml_for_fields(criteria) %>
|
19
|
+
<%= xml_for_subsets(criteria) %>
|
20
20
|
</observationCriteria>
|
21
21
|
</entry>
|
@@ -4,10 +4,14 @@
|
|
4
4
|
<%- code_system_oid = oid_for_name(code_system_name) -%>
|
5
5
|
<<%= name %> codeSystemName="<%= code_system_name %>" codeSystem="<%= code_system_oid %>"
|
6
6
|
code="<%= code %>">
|
7
|
-
|
7
|
+
<%- if criteria.title -%>
|
8
|
+
<displayName value="<%=ERB::Util::h criteria.title %>"/>
|
9
|
+
<%- end -%>
|
8
10
|
</<%= name %>>
|
9
11
|
<%- elsif criteria.code_list_id -%>
|
10
12
|
<<%= name %><%= " xsi:type=\"CD\"" if include_type %> valueSet="<%= criteria.code_list_id %>">
|
11
|
-
|
13
|
+
<%- if criteria.title -%>
|
14
|
+
<displayName value="<%=ERB::Util::h criteria.title %>"/>
|
15
|
+
<%- end -%>
|
12
16
|
</<%= name %>>
|
13
17
|
<%- end -%>
|
@@ -1,18 +1,17 @@
|
|
1
1
|
<entry typeCode="DRIV">
|
2
|
+
<%= xml_for_local_variable(criteria) %>
|
2
3
|
<observationCriteria moodCode="EVN" classCode="OBS"<%= " actionNegationInd='true'" if criteria.negation %>>
|
3
4
|
<%= xml_for_template(criteria, is_source_data_criteria) %>
|
4
|
-
<id
|
5
|
-
<item root="2.16.840.1.113883.3.100.1" extension="<%= criteria.id %>"/>
|
6
|
-
</id>
|
5
|
+
<id root="2.16.840.1.113883.3.100.1" extension="<%= criteria.id %>"/>
|
7
6
|
<%= xml_for_description(criteria) %>
|
8
7
|
<%= "<statusCode code=\"#{criteria.status}\"/>" if criteria.status %>
|
9
8
|
<%= xml_for_effective_time(criteria) %>
|
10
9
|
<%= xml_for_reason(criteria) %>
|
11
10
|
<%= xml_for_code(criteria, 'value') %>
|
12
11
|
<definition>
|
13
|
-
<
|
12
|
+
<criteriaReference moodCode="EVN" classCode="OBS">
|
14
13
|
<id root="2.16.840.1.113883.3.100.1" extension="<%= section_name(criteria) %>"/>
|
15
|
-
</
|
14
|
+
</criteriaReference>
|
16
15
|
</definition>
|
17
16
|
<%= xml_for_temporal_references(criteria) %>
|
18
17
|
<%= xml_for_fields(criteria) %>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<%- criteria.children_criteria.each do |child_id| -%>
|
2
|
+
<outboundRelationship typeCode="COMP">
|
3
|
+
<conjunctionCode code="<%= criteria.derivation_operator == 'UNION' ? 'OR' : 'AND' %>"/>
|
4
|
+
<%= xml_for_reference_id(child_id) %>
|
5
|
+
</outboundRelationship>
|
6
|
+
<%- end -%>
|
@@ -1 +1 @@
|
|
1
|
-
<text value="<%= text %>"/>
|
1
|
+
<text value="<%=ERB::Util::h text %>"/>
|
@@ -1,13 +1,17 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<QualityMeasureDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
<typeId root="2.16.840.1.113883.1.3" extension="POQM_MT000001UV03" />
|
4
|
+
<templateId>
|
5
|
+
<item root="2.16.840.1.113883.10.20.28.1.1" />
|
6
|
+
</templateId>
|
3
7
|
<id root="2.16.840.1.113883.3.100.1" extension="<%= doc.hqmf_id %>" />
|
4
8
|
<code code="57024-2" codeSystem="2.16.840.1.113883.6.1"/>
|
5
|
-
<title value="<%= doc.title %>"/>
|
6
|
-
<text value="<%= doc.description %>"/>
|
9
|
+
<title value="<%=ERB::Util::h doc.title %>"/>
|
10
|
+
<text value="<%=ERB::Util::h doc.description %>"/>
|
7
11
|
<statusCode code="completed" />
|
8
12
|
<setId root="2.16.840.1.113883.3.100.1" extension="<%= doc.hqmf_set_id %>" />
|
9
13
|
<versionNumber value="<%= doc.hqmf_version_number %>"/>
|
10
|
-
<author typeCode="AUT"
|
14
|
+
<author typeCode="AUT">
|
11
15
|
<responsibleParty classCode="ASSIGNED" />
|
12
16
|
</author>
|
13
17
|
<custodian typeCode="CST">
|
@@ -18,9 +22,18 @@
|
|
18
22
|
<code code="MSRTP" codeSystem="2.16.840.1.113883.3.560">
|
19
23
|
<displayName value="Measurement period"/>
|
20
24
|
</code>
|
21
|
-
<value>
|
22
|
-
<
|
23
|
-
|
25
|
+
<value xsi:type="PIVL_TS">
|
26
|
+
<phase lowClosed="true" highClosed="true">
|
27
|
+
<%- if doc.measure_period.low != nil -%>
|
28
|
+
<low value="<%= doc.measure_period.low.value %>" />
|
29
|
+
<%- end -%>
|
30
|
+
<%- if doc.measure_period.high != nil -%>
|
31
|
+
<high value="<%= doc.measure_period.high.value %>" />
|
32
|
+
<%- end -%>
|
33
|
+
<%- if doc.measure_period.width != nil -%>
|
34
|
+
<width xsi:type="PQ" value="<%= doc.measure_period.width.value %>" unit="a" />
|
35
|
+
<%- end -%>
|
36
|
+
</phase>
|
24
37
|
</value>
|
25
38
|
</measurePeriod>
|
26
39
|
</controlVariable>
|
@@ -29,9 +42,12 @@
|
|
29
42
|
<%- end -%>
|
30
43
|
<component>
|
31
44
|
<dataCriteriaSection>
|
45
|
+
<templateId>
|
46
|
+
<item root="2.16.840.1.113883.10.20.28.2.2" />
|
47
|
+
</templateId>
|
32
48
|
<code code="57025-9" codeSystem="2.16.840.1.113883.6.1"/>
|
33
49
|
<title value="Data Criteria Section"/>
|
34
|
-
<text
|
50
|
+
<text value="This section describes the data criteria."/>
|
35
51
|
<%- doc.all_data_criteria.each do |data_criteria| -%>
|
36
52
|
<%= xml_for_data_criteria(data_criteria, false) %>
|
37
53
|
<%- end -%>
|
@@ -47,17 +63,36 @@
|
|
47
63
|
<templateId>
|
48
64
|
<item root="<%= HQMF::Document::STRATIFIED_POPULATION_TEMPLATE_ID %>" identifierName="<%= HQMF::Document::STRATIFIED_POPULATION_TEMPLATE_TITLE %>" controlInformationRoot="<%= population['stratification'] %>"/>
|
49
65
|
</templateId>
|
66
|
+
<%- else -%>
|
67
|
+
<templateId>
|
68
|
+
<item root="2.16.840.1.113883.10.20.28.2.1"/>
|
69
|
+
</templateId>
|
50
70
|
<%- end -%>
|
51
71
|
<id root="2.16.840.1.113883.3.100.1" extension="<%= population['id'] || "Population#{population_index}" %>"/>
|
52
72
|
<code code="57026-7" codeSystem="2.16.840.1.113883.6.1"/>
|
53
|
-
<title value="<%= population['title'] %>"/>
|
54
|
-
<text
|
55
|
-
Numerator, Denominator, Denominator Exceptions, and Measure
|
56
|
-
Populations</text>
|
73
|
+
<title value="<%=ERB::Util::h population['title'] %>"/>
|
74
|
+
<text value="This section describes the Initial Patient Population, Numerator, Denominator, Denominator Exceptions, and Measure Populations"/>
|
57
75
|
<%- population.keys.each do |criteria_id| -%>
|
58
76
|
<%= xml_for_population_criteria(population, criteria_id) %>
|
59
77
|
<%- end -%>
|
60
78
|
</populationCriteriaSection>
|
61
79
|
</component>
|
80
|
+
<%- if doc.is_cv? -%>
|
81
|
+
|
82
|
+
<component>
|
83
|
+
<measureObservationsSection>
|
84
|
+
<templateId>
|
85
|
+
<item root="2.16.840.1.113883.10.20.28.2.4" />
|
86
|
+
</templateId>
|
87
|
+
<code code="57027-5" codeSystem="2.16.840.1.113883.6.1">
|
88
|
+
<displayName value="Measure Observation" />
|
89
|
+
</code>
|
90
|
+
<title value="Measure Observation Section" />
|
91
|
+
<text></text>
|
92
|
+
<%= xml_for_measure_observation_definition(doc) %>
|
93
|
+
</measureObservationsSection>
|
94
|
+
</component>
|
95
|
+
|
96
|
+
<%- end -%>
|
62
97
|
<%- end -%>
|
63
98
|
</QualityMeasureDocument>
|
@@ -1,17 +1,16 @@
|
|
1
1
|
<entry typeCode="DRIV">
|
2
|
+
<%= xml_for_local_variable(criteria) %>
|
2
3
|
<encounterCriteria moodCode="EVN" classCode="ENC"<%= " actionNegationInd='true'" if criteria.negation %>>
|
3
4
|
<%= xml_for_template(criteria, is_source_data_criteria) %>
|
4
|
-
<id
|
5
|
-
<item root="2.16.840.1.113883.3.100.1" extension="<%= criteria.id %>"/>
|
6
|
-
</id>
|
5
|
+
<id root="2.16.840.1.113883.3.100.1" extension="<%= criteria.id %>"/>
|
7
6
|
<%= xml_for_code(criteria) %>
|
8
7
|
<%= xml_for_description(criteria) %>
|
9
8
|
<%= xml_for_effective_time(criteria) %>
|
10
9
|
<%= xml_for_reason(criteria) %>
|
11
10
|
<definition>
|
12
|
-
<
|
11
|
+
<criteriaReference moodCode="EVN" classCode="ENC">
|
13
12
|
<id root="2.16.840.1.113883.3.100.1" extension="<%= section_name(criteria) %>"/>
|
14
|
-
</
|
13
|
+
</criteriaReference>
|
15
14
|
</definition>
|
16
15
|
<%= xml_for_temporal_references(criteria) %>
|
17
16
|
<%= xml_for_fields(criteria) %>
|
@@ -19,10 +19,22 @@
|
|
19
19
|
<item root="<%= details[:template_id] %>"/>
|
20
20
|
</templateId>
|
21
21
|
<%- end -%>
|
22
|
+
|
23
|
+
<%- if is_transfer(details[:code]) -%>
|
24
|
+
<title value="<%= details[:code] %>" />
|
25
|
+
<statusCode code="completed" />
|
26
|
+
<%= xml_for_value(value) %>
|
27
|
+
<participation typeCode="ORG">
|
28
|
+
<role classCode="LOCE">
|
29
|
+
<code xsi:type="CD" />
|
30
|
+
</role>
|
31
|
+
</participation>
|
32
|
+
<%- else -%>
|
22
33
|
<code code="<%= details[:code] %>" codeSystem="<%= details[:code_system] %>" codeSystemName="<%= details[:code_system_name] %>">
|
23
|
-
<displayName value="<%= details[:title] %>"/>
|
34
|
+
<displayName value="<%=ERB::Util::h details[:title] %>"/>
|
24
35
|
</code>
|
25
36
|
<%= xml_for_value(value) %>
|
37
|
+
<%- end -%>
|
26
38
|
</observationCriteria>
|
27
39
|
<%- end -%>
|
28
40
|
</outboundRelationship>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<entry typeCode="DRIV">
|
2
|
+
<%= xml_for_local_variable(criteria) %>
|
3
|
+
<grouperCriteria moodCode="EVN" classCode="GROUPER">
|
4
|
+
<%= xml_for_template(criteria, is_source_data_criteria) %>
|
5
|
+
<id root="2.16.840.1.113883.3.100.1" extension="<%= criteria.id %>"/>
|
6
|
+
<%= xml_for_description(criteria) %>
|
7
|
+
<definition>
|
8
|
+
<criteriaReference moodCode="EVN" classCode="GROUPER">
|
9
|
+
<id root="2.16.840.1.113883.3.100.1" extension="<%= section_name(criteria) %>"/>
|
10
|
+
</criteriaReference>
|
11
|
+
</definition>
|
12
|
+
<%= xml_for_temporal_references(criteria) %>
|
13
|
+
<%= xml_for_fields(criteria) %>
|
14
|
+
<%= xml_for_derivation(criteria) %>
|
15
|
+
<%= xml_for_subsets(criteria) %>
|
16
|
+
</grouperCriteria>
|
17
|
+
</entry>
|
@@ -23,8 +23,11 @@ module HQMF2
|
|
23
23
|
# by the erb templates that are used to generate the HQMF document.
|
24
24
|
class ErbContext < OpenStruct
|
25
25
|
|
26
|
+
|
26
27
|
def initialize(vars)
|
27
28
|
super(vars)
|
29
|
+
@local_var_names = {}
|
30
|
+
@local_var_counter = {}
|
28
31
|
end
|
29
32
|
|
30
33
|
# Get a binding that contains all the instance variables
|
@@ -33,6 +36,19 @@ module HQMF2
|
|
33
36
|
binding
|
34
37
|
end
|
35
38
|
|
39
|
+
def xml_for_local_variable(criteria)
|
40
|
+
name = @local_var_names[criteria.id]
|
41
|
+
unless name
|
42
|
+
if criteria.specific_occurrence
|
43
|
+
name = "Occurrence#{criteria.specific_occurrence}#{criteria.id}"
|
44
|
+
else
|
45
|
+
name = criteria.id
|
46
|
+
end
|
47
|
+
@local_var_names[criteria.id] = name
|
48
|
+
end
|
49
|
+
HQMF2::Generator.render_template('local_variable', {'name' => name})
|
50
|
+
end
|
51
|
+
|
36
52
|
def xml_for_reference_id(id)
|
37
53
|
reference = HQMF::Reference.new(id)
|
38
54
|
xml_for_reference(reference)
|
@@ -132,7 +148,11 @@ module HQMF2
|
|
132
148
|
end
|
133
149
|
subsets_xml.join()
|
134
150
|
end
|
135
|
-
|
151
|
+
|
152
|
+
def xml_for_precondition_cv(precondition)
|
153
|
+
HQMF2::Generator.render_template('precondition_cv', {'doc' => doc, 'precondition' => precondition})
|
154
|
+
end
|
155
|
+
|
136
156
|
def xml_for_precondition(precondition)
|
137
157
|
HQMF2::Generator.render_template('precondition', {'doc' => doc, 'precondition' => precondition})
|
138
158
|
end
|
@@ -144,7 +164,7 @@ module HQMF2
|
|
144
164
|
def xml_for_population_criteria(population, criteria_id)
|
145
165
|
xml = ''
|
146
166
|
population_criteria = doc.population_criteria(population[criteria_id])
|
147
|
-
if population_criteria
|
167
|
+
if population_criteria && population_element_prefix(criteria_id) != "measureObservation"
|
148
168
|
xml = HQMF2::Generator.render_template('population_criteria', {'doc' => doc, 'population' => population, 'criteria_id' => criteria_id, 'population_criteria' => population_criteria})
|
149
169
|
end
|
150
170
|
xml
|
@@ -159,6 +179,23 @@ module HQMF2
|
|
159
179
|
end
|
160
180
|
refs.join
|
161
181
|
end
|
182
|
+
|
183
|
+
def xml_for_measure_observation_definition(doc)
|
184
|
+
observation = doc.find_population_by_type(HQMF::PopulationCriteria::OBSERV)
|
185
|
+
msrpopl = doc.find_population_by_type( HQMF::PopulationCriteria::MSRPOPL)
|
186
|
+
HQMF2::Generator.render_template('measure_observation_definition', {'doc' => doc, 'observation' => observation, "msrpopl" => msrpopl})
|
187
|
+
end
|
188
|
+
|
189
|
+
def expression_for_observation(doc,observation)
|
190
|
+
"NOT IMPLEMENTED"
|
191
|
+
end
|
192
|
+
|
193
|
+
def data_criteria_should_be_grouper?(criteria)
|
194
|
+
return false unless criteria
|
195
|
+
return false unless criteria.definition == 'derived'
|
196
|
+
return true unless criteria.subset_operators
|
197
|
+
criteria.subset_operators.all? {|o| o.supports_grouper_criteria?}
|
198
|
+
end
|
162
199
|
|
163
200
|
def oid_for_name(code_system_name)
|
164
201
|
HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(code_system_name)
|
@@ -189,8 +226,14 @@ module HQMF2
|
|
189
226
|
'SBADM'
|
190
227
|
when :medication_supply
|
191
228
|
'SPLY'
|
229
|
+
when :observation
|
230
|
+
'OBS'
|
192
231
|
else
|
193
|
-
|
232
|
+
if data_criteria_should_be_grouper?(referenced_criteria)
|
233
|
+
'GROUPER'
|
234
|
+
else
|
235
|
+
'OBS'
|
236
|
+
end
|
194
237
|
end
|
195
238
|
end
|
196
239
|
|
@@ -212,7 +255,15 @@ module HQMF2
|
|
212
255
|
raise "Unknown demographic code [#{characteristic}]"
|
213
256
|
end
|
214
257
|
end
|
215
|
-
|
258
|
+
|
259
|
+
def is_transfer(code)
|
260
|
+
if code == "TRANSFER_TO" || code == "TRANSFER_FROM"
|
261
|
+
true
|
262
|
+
else
|
263
|
+
false
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
216
267
|
def oid_for_characteristic(characteristic)
|
217
268
|
case characteristic
|
218
269
|
when :birthtime
|
@@ -245,6 +296,12 @@ module HQMF2
|
|
245
296
|
'characteristic_criteria'
|
246
297
|
when 'variable'
|
247
298
|
'variable_criteria'
|
299
|
+
when 'derived'
|
300
|
+
if data_criteria_should_be_grouper?(data_criteria)
|
301
|
+
'grouper_criteria'
|
302
|
+
else
|
303
|
+
'observation_criteria'
|
304
|
+
end
|
248
305
|
else
|
249
306
|
'observation_criteria'
|
250
307
|
end
|
@@ -266,14 +323,18 @@ module HQMF2
|
|
266
323
|
when :medication_supply
|
267
324
|
'supply'
|
268
325
|
else
|
269
|
-
|
326
|
+
if data_criteria_should_be_grouper?(data_criteria)
|
327
|
+
'grouper'
|
328
|
+
else
|
329
|
+
'observation'
|
330
|
+
end
|
270
331
|
end
|
271
332
|
end
|
272
333
|
|
273
334
|
def population_element_prefix(population_criteria_code)
|
274
335
|
case population_criteria_code
|
275
336
|
when HQMF::PopulationCriteria::IPP
|
276
|
-
'
|
337
|
+
'initialPopulation'
|
277
338
|
when HQMF::PopulationCriteria::DENOM
|
278
339
|
'denominator'
|
279
340
|
when HQMF::PopulationCriteria::NUMER
|
@@ -282,11 +343,17 @@ module HQMF2
|
|
282
343
|
'denominatorException'
|
283
344
|
when HQMF::PopulationCriteria::DENEX
|
284
345
|
'denominatorExclusion'
|
285
|
-
|
346
|
+
when HQMF::PopulationCriteria::MSRPOPL
|
347
|
+
'measurePopulation'
|
348
|
+
when HQMF::PopulationCriteria::OBSERV
|
349
|
+
'measureObservation'
|
350
|
+
when HQMF::PopulationCriteria::STRAT
|
351
|
+
'stratifier'
|
352
|
+
else
|
286
353
|
raise "Unknown population criteria type #{population_criteria_code}"
|
287
354
|
end
|
288
355
|
end
|
289
356
|
end
|
290
357
|
|
291
358
|
end
|
292
|
-
end
|
359
|
+
end
|