health-data-standards 3.1.1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -8
- data/lib/health-data-standards.rb +4 -2
- data/lib/health-data-standards/export/hdata/metadata.rb +2 -2
- data/lib/health-data-standards/export/helper/cat1_view_helper.rb +7 -101
- data/lib/health-data-standards/export/helper/html_view_helper.rb +2 -0
- data/lib/health-data-standards/export/helper/scooped_view_helper.rb +109 -0
- data/lib/health-data-standards/export/html.rb +2 -2
- data/lib/health-data-standards/export/qrda/entry_template_resolver.rb +29 -5
- data/lib/health-data-standards/export/view_helper.rb +2 -2
- data/lib/health-data-standards/import/bundle/importer.rb +8 -2
- data/lib/health-data-standards/import/cda/result_importer.rb +5 -0
- data/lib/health-data-standards/import/hdata/metadata_importer.rb +1 -1
- data/lib/health-data-standards/models/condition.rb +5 -0
- data/lib/health-data-standards/models/cqm/measure.rb +118 -1
- data/lib/health-data-standards/models/cqm/patient_cache.rb +60 -0
- data/lib/health-data-standards/models/encounter.rb +11 -0
- data/lib/health-data-standards/models/entry.rb +8 -0
- data/lib/health-data-standards/models/facility.rb +5 -0
- data/lib/health-data-standards/models/fulfillment_history.rb +4 -0
- data/lib/health-data-standards/models/guarantor.rb +5 -0
- data/lib/health-data-standards/models/insurance_provider.rb +10 -0
- data/lib/health-data-standards/models/medical_equipment.rb +5 -0
- data/lib/health-data-standards/models/medication.rb +11 -0
- data/lib/health-data-standards/models/order_information.rb +6 -0
- data/lib/health-data-standards/models/procedure.rb +5 -0
- data/lib/health-data-standards/models/provider_performance.rb +5 -0
- data/lib/health-data-standards/models/record.rb +16 -0
- data/lib/health-data-standards/models/thing_with_codes.rb +35 -5
- data/lib/health-data-standards/util/code_system_helper.rb +12 -3
- data/lib/hqmf-model/data_criteria.json +2 -2
- data/lib/hqmf-model/document.rb +9 -2
- data/lib/hqmf-parser/1.0/document.rb +6 -1
- data/templates/_author.hdata.erb +3 -0
- data/templates/_pedigree.hdata.erb +16 -15
- data/templates/cat1/_2.16.840.1.113883.10.20.22.4.85.cat1.erb +1 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.1.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.103.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.105.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.11.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.12.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.13.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.14.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.17.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.18.cat1.erb +2 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.2.cat1.erb +2 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.20.cat1.erb +2 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.22.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.23.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.28.cat1.erb +2 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.3.cat1.erb +3 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.31.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.34.cat1.erb +2 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.37.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.40.cat1.erb +2 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.41.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.42.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.43.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.44.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.45.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.46.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.47.cat1.erb +2 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.55.cat1.erb +2 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.57.cat1.erb +2 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.59.cat1.erb +2 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.62.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.63.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +6 -2
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.66.cat1.erb +3 -3
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.69.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.7.cat1.erb +1 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.76.cat1.erb +1 -1
- data/templates/cat1/_measures.cat1.erb +0 -2
- data/templates/cat1/_medication_details.cat1.erb +3 -3
- data/templates/cat1/_patient_data.cat1.erb +3 -0
- data/templates/cat1/_record_target.cat1.erb +6 -1
- data/templates/cat1/_result_value.cat1.erb +16 -13
- data/templates/html/_entries_by_section.html.erb +13 -5
- data/templates/html/show.html.erb +4 -2
- data/templates/metadata.hdata.erb +27 -24
- metadata +5 -2
@@ -0,0 +1,60 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module CQM
|
3
|
+
class PatientCache
|
4
|
+
include Mongoid::Document
|
5
|
+
store_in collection: 'patient_cache'
|
6
|
+
index "value.last" => 1
|
7
|
+
index "bundle_id" => 1
|
8
|
+
embeds_one :value, class_name: "HealthDataStandards::CQM::PatientCacheValue", inverse_of: :patient_cache
|
9
|
+
|
10
|
+
def record
|
11
|
+
Record.where(:medical_record_number => value['medical_record_id'], :test_id => value["test_id"]).first
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.smoking_gun_rational(hqmf_id,sub_ids=nil, filter ={})
|
15
|
+
|
16
|
+
match = {"value.IPP" => {"$gt" => 0},
|
17
|
+
"value.measure_id" => hqmf_id
|
18
|
+
}.merge filter
|
19
|
+
|
20
|
+
if sub_ids
|
21
|
+
match["value.sub_id"] = {"$in" => sub_ids}
|
22
|
+
end
|
23
|
+
|
24
|
+
group = {"$group" => {"_id" => "$value.medical_record_id", "rational" => {"$push"=> "$value.rationale"}}}
|
25
|
+
aggregate = self.mongo_session.command(:aggregate => 'patient_cache', :pipeline => [{"$match" =>match},group])
|
26
|
+
|
27
|
+
merged = {}
|
28
|
+
aggregate["result"].each do |agg|
|
29
|
+
mrn = agg["_id"]
|
30
|
+
rational = {}
|
31
|
+
merged[mrn] = rational
|
32
|
+
agg["rational"].each do |r|
|
33
|
+
rational.merge! r
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
merged
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class PatientCacheValue
|
42
|
+
|
43
|
+
include Mongoid::Document
|
44
|
+
|
45
|
+
embedded_in :patient_cache, inverse_of: :value
|
46
|
+
|
47
|
+
field :DENOM, type: Integer
|
48
|
+
field :NUMER, type: Integer
|
49
|
+
field :DENEX, type: Integer
|
50
|
+
field :DENEXCEP, type: Integer
|
51
|
+
field :MSRPOPL, type: Integer
|
52
|
+
field :OBSERV
|
53
|
+
field :antinumerator, type: Integer
|
54
|
+
field :IPP, type: Integer
|
55
|
+
field :measure_id, type: String
|
56
|
+
field :sub_id, type: String\
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
@@ -23,4 +23,15 @@ class Encounter < Entry
|
|
23
23
|
alias :transfer_to= :transferTo=
|
24
24
|
alias :transfer_from :transferFrom
|
25
25
|
alias :transfer_from= :transferFrom=
|
26
|
+
|
27
|
+
def shift_dates(date_diff)
|
28
|
+
super
|
29
|
+
if self.facility
|
30
|
+
self.facility.shift_dates(date_diff)
|
31
|
+
end
|
32
|
+
|
33
|
+
self.admitTime = (self.admitTime.nil?) ? nil : self.admitTime + date_diff
|
34
|
+
self.dischargeTime = (self.dischargeTime.nil?) ? nil : self.dischargeTime + date_diff
|
35
|
+
end
|
36
|
+
|
26
37
|
end
|
@@ -198,4 +198,12 @@ class Entry
|
|
198
198
|
|
199
199
|
entry_hash
|
200
200
|
end
|
201
|
+
|
202
|
+
|
203
|
+
def shift_dates(date_diff)
|
204
|
+
self.start_time = self.start_time.nil? ? nil : (self.start_time + date_diff)
|
205
|
+
self.end_time = self.end_time.nil? ? nil : (self.end_time + date_diff)
|
206
|
+
self.time = self.time.nil? ? nil : (self.time + date_diff)
|
207
|
+
end
|
208
|
+
|
201
209
|
end
|
@@ -9,4 +9,9 @@ class Facility
|
|
9
9
|
|
10
10
|
embeds_many :addresses, as: :locatable
|
11
11
|
embeds_many :telecoms, as: :contactable
|
12
|
+
|
13
|
+
def shift_dates(date_diff)
|
14
|
+
self.start_time = (self.start_time.nil?) ? nil : self.start_time + date_diff
|
15
|
+
self.end_time = (self.end_time.nil?) ? nil : self.end_time + date_diff
|
16
|
+
end
|
12
17
|
end
|
@@ -21,4 +21,8 @@ class FulfillmentHistory
|
|
21
21
|
alias :fill_status= :fillStatus=
|
22
22
|
alias :prescription_number :prescriptionNumber
|
23
23
|
alias :prescription_number= :prescriptionNumber=
|
24
|
+
|
25
|
+
def shift_dates(date_diff)
|
26
|
+
self.dispenseDate = (self.dispenseDate.nil?) ? nil : self.dispenseDate + date_diff
|
27
|
+
end
|
24
28
|
end
|
@@ -8,4 +8,9 @@ class Guarantor
|
|
8
8
|
field :start_time, type: Integer
|
9
9
|
field :end_time, type: Integer
|
10
10
|
|
11
|
+
|
12
|
+
def shift_dates(date_diff)
|
13
|
+
self.start_time = (self.start_time.nil?) ? nil : self.start_time + date_diff
|
14
|
+
self.end_time = (self.end_time.nil?) ? nil : self.end_time + date_diff
|
15
|
+
end
|
11
16
|
end
|
@@ -17,4 +17,14 @@ class InsuranceProvider
|
|
17
17
|
field :name, type: String
|
18
18
|
field :free_text, type: String
|
19
19
|
|
20
|
+
|
21
|
+
def shift_dates(date_diff)
|
22
|
+
self.start_time = self.start_time.nil? ? nil : self.start_time + date_diff
|
23
|
+
self.end_time = self.end_time.nil? ? nil : self.end_time + date_diff
|
24
|
+
self.time = self.time.nil? ? nil : self.time + date_diff
|
25
|
+
self.guarantors.each do |g|
|
26
|
+
g.shift_dates(date_diff)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
20
30
|
end
|
@@ -8,4 +8,9 @@ class MedicalEquipment < Entry
|
|
8
8
|
alias :anatomical_structure= :anatomicalStructure=
|
9
9
|
alias :removal_time :removalTime
|
10
10
|
alias :removal_time= :removalTime=
|
11
|
+
|
12
|
+
def shift_dates(date_diff)
|
13
|
+
super
|
14
|
+
self.removalTime = self.removalTime.nil? ? nil : self.removalTime + date_diff
|
15
|
+
end
|
11
16
|
end
|
@@ -47,4 +47,15 @@ class Medication < Entry
|
|
47
47
|
alias :dose_indicator= :doseIndicator=
|
48
48
|
alias :cumulative_medication_duration :cumulativeMedicationDuration
|
49
49
|
alias :cumulative_medication_duration= :cumulativeMedicationDuration=
|
50
|
+
|
51
|
+
def shift_dates(date_diff)
|
52
|
+
super
|
53
|
+
self.fulfillmentHistory.each do |fh|
|
54
|
+
fh.shift_dates(date_diff)
|
55
|
+
end
|
56
|
+
self.orderInformation.each do |oi|
|
57
|
+
oi.shift_dates(date_diff)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
50
61
|
end
|
@@ -17,4 +17,10 @@ class OrderInformation
|
|
17
17
|
alias :order_expiration_date_time= :orderExpirationDateTime=
|
18
18
|
alias :order_date_time :orderDateTime
|
19
19
|
alias :order_date_time= :orderDateTime=
|
20
|
+
|
21
|
+
|
22
|
+
def shift_dates(date_diff)
|
23
|
+
self.orderDateTime = self.orderDateTime.nil? ? nil : self.orderDateTime + date_diff
|
24
|
+
self.orderExpirationDateTime = self.orderExpirationDateTime.nil? ? nil : self.orderExpirationDateTime + date_diff
|
25
|
+
end
|
20
26
|
end
|
@@ -7,4 +7,9 @@ class ProviderPerformance
|
|
7
7
|
belongs_to :provider
|
8
8
|
embedded_in :record
|
9
9
|
|
10
|
+
|
11
|
+
def shift_dates(date_diff)
|
12
|
+
self.start_date = self.start_date.nil? ? nil : self.start_date + date_diff
|
13
|
+
self.end_date = self.end_date.nil? ? nil : self.end_date + date_diff
|
14
|
+
end
|
10
15
|
end
|
@@ -96,6 +96,19 @@ class Record
|
|
96
96
|
Record::Sections.each {|section| self.dedup_section!(section)}
|
97
97
|
end
|
98
98
|
|
99
|
+
def shift_dates(date_diff)
|
100
|
+
self.birthdate = (self.birthdate.nil?) ? nil : self.birthdate + date_diff
|
101
|
+
self.deathdate = (self.deathdate.nil?) ? nil : self.deathdate + date_diff
|
102
|
+
self.provider_performances.each {|pp| pp.shift_dates(date_diff)}
|
103
|
+
Sections.each do |sec|
|
104
|
+
(self.send sec || []).each do |ent|
|
105
|
+
ent.shift_dates(date_diff)
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
99
112
|
private
|
100
113
|
|
101
114
|
def self.provider_queries(provider_id, effective_date)
|
@@ -105,4 +118,7 @@ class Record
|
|
105
118
|
{'provider_performances' => {'$elemMatch' => {'provider_id' => provider_id, '$and'=>[{'$or'=>[{'start_date'=>nil},{'start_date'=>{'$lt'=>start_before}}]}, {'$or'=>[{'end_date'=>nil},{'end_date'=> {'$gt'=>end_after}}]}] } }}
|
106
119
|
end
|
107
120
|
|
121
|
+
|
122
|
+
|
123
|
+
|
108
124
|
end
|
@@ -17,12 +17,22 @@ module ThingWithCodes
|
|
17
17
|
|
18
18
|
# Will return a single code and code set if one exists in the code sets that are
|
19
19
|
# passed in. Returns a hash with a key of code and code_set if found, nil otherwise
|
20
|
-
def preferred_code(preferred_code_sets, codes_attribute=:codes)
|
20
|
+
def preferred_code(preferred_code_sets, codes_attribute=:codes, value_set_map=nil)
|
21
21
|
codes_value = send(codes_attribute)
|
22
|
-
|
22
|
+
preferred_code_sets = value_set_map ? (preferred_code_sets & value_set_map.collect{|cs| cs["set"]}) : preferred_code_sets
|
23
|
+
matching_code_sets = preferred_code_sets & codes_value.keys
|
23
24
|
if matching_code_sets.present?
|
25
|
+
if value_set_map
|
26
|
+
matching_code_sets.each do |matching_code_set|
|
27
|
+
matching_codes = codes_value[matching_code_set] & value_set_map.collect{|cs| cs["set"] == matching_code_set ? cs["values"] : []}.flatten.compact
|
28
|
+
if matching_codes.present?
|
29
|
+
return {'code' => matching_codes.first, 'code_set' => matching_code_set}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
else
|
24
33
|
code_set = matching_code_sets.first
|
25
34
|
{'code' => codes_value[code_set].first, 'code_set' => code_set}
|
35
|
+
end
|
26
36
|
else
|
27
37
|
nil
|
28
38
|
end
|
@@ -31,17 +41,37 @@ module ThingWithCodes
|
|
31
41
|
# Will return an Array of code and code_set hashes for all codes for this entry
|
32
42
|
# except for the preferred_code. It is intended that these codes would be used in
|
33
43
|
# the translation elements as childern of a CDA code element
|
34
|
-
def translation_codes(preferred_code_sets)
|
44
|
+
def translation_codes(preferred_code_sets,value_set_map=nil)
|
35
45
|
tx_codes = []
|
36
|
-
|
46
|
+
matching_codes = value_set_map ? codes_in_code_set(value_set_map) : codes
|
47
|
+
matching_codes.each_pair do |code_set, code_list|
|
37
48
|
code_list.each do |code|
|
38
49
|
tx_codes << {'code' => code, 'code_set' => code_set}
|
39
50
|
end
|
40
51
|
end
|
41
52
|
|
42
|
-
tx_codes - [preferred_code(preferred_code_sets)]
|
53
|
+
tx_codes - [preferred_code(preferred_code_sets, :codes, value_set_map)]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Checks if a code is in the list of possible codes
|
57
|
+
# @param [Array] code_set an Array of Hashes that describe the values for code sets
|
58
|
+
# The hash has a key of "set" for the code system name and "values"
|
59
|
+
# for the actual code list
|
60
|
+
# @return [all codes that are in the code set
|
61
|
+
def codes_in_code_set(code_set)
|
62
|
+
matching = {}
|
63
|
+
codes.keys.each do |code_system|
|
64
|
+
matching_codes = []
|
65
|
+
matching[code_system] = matching_codes
|
66
|
+
all_codes_in_system = code_set.find_all {|set| set['set'] == code_system}
|
67
|
+
all_codes_in_system.each do |codes_in_system|
|
68
|
+
matching_codes.concat codes_in_system['values'] & codes[code_system]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
matching
|
43
72
|
end
|
44
73
|
|
74
|
+
|
45
75
|
# Add a code into the Entry
|
46
76
|
# @param [String] code the code to add
|
47
77
|
# @param [String] code_system the code system that the code belongs to
|
@@ -14,7 +14,7 @@ module HealthDataStandards
|
|
14
14
|
'2.16.840.1.113883.6.90' => 'ICD-10-CM',
|
15
15
|
'2.16.840.1.113883.6.14' => 'HCPCS',
|
16
16
|
'2.16.840.1.113883.5.2' => "HL7 Marital Status",
|
17
|
-
'2.16.840.1.113883.
|
17
|
+
'2.16.840.1.113883.12.292' => 'CVX',
|
18
18
|
'2.16.840.1.113883.5.83' => 'HITSP C80 Observation Status',
|
19
19
|
'2.16.840.1.113883.3.26.1.1' => 'NCI Thesaurus',
|
20
20
|
'2.16.840.1.113883.3.88.12.80.20' => 'FDA',
|
@@ -31,18 +31,27 @@ module HealthDataStandards
|
|
31
31
|
'2.16.840.1.113883.1.11.19717' => "HL7 ActNoImmunicationReason",
|
32
32
|
'2.16.840.1.113883.3.88.12.80.33' => "NUBC",
|
33
33
|
'2.16.840.1.113883.1.11.78' => "HL7 Observation Interpretation",
|
34
|
-
'2.16.840.1.
|
34
|
+
'2.16.840.1.113883.3.221.5' => "Source of Payment Typology",
|
35
|
+
'2.16.840.1.113883.6.13' => 'CDT'
|
35
36
|
}
|
36
37
|
|
37
38
|
CODE_SYSTEM_ALIASES = {
|
38
39
|
'FDA SPL' => 'NCI Thesaurus',
|
39
|
-
'HSLOC' => 'HL7 Healthcare Service Location'
|
40
|
+
'HSLOC' => 'HL7 Healthcare Service Location',
|
41
|
+
'SOP' => "Source of Payment Typology"
|
42
|
+
}
|
43
|
+
|
44
|
+
# Some old OID are still around in data, this hash maps retired OID values to
|
45
|
+
# the new value
|
46
|
+
OID_ALIASES = {
|
47
|
+
'2.16.840.1.113883.6.59' => '2.16.840.1.113883.12.292' # CVX
|
40
48
|
}
|
41
49
|
|
42
50
|
# Returns the name of a code system given an oid
|
43
51
|
# @param [String] oid of a code system
|
44
52
|
# @return [String] the name of the code system as described in the measure definition JSON
|
45
53
|
def self.code_system_for(oid)
|
54
|
+
oid = OID_ALIASES[oid] if OID_ALIASES[oid]
|
46
55
|
CODE_SYSTEMS[oid] || "Unknown"
|
47
56
|
end
|
48
57
|
|
@@ -126,7 +126,7 @@
|
|
126
126
|
"property":"ethnicity",
|
127
127
|
"standard_category":"individual_characteristic",
|
128
128
|
"qds_data_type":"individual_characteristic",
|
129
|
-
"not_supported":
|
129
|
+
"not_supported":false},
|
130
130
|
"patient_characteristic_expired":{
|
131
131
|
"title":"patient characteristic, expired",
|
132
132
|
"category":"characteristic",
|
@@ -150,7 +150,7 @@
|
|
150
150
|
"property":"payer",
|
151
151
|
"standard_category":"individual_characteristic",
|
152
152
|
"qds_data_type":"individual_characteristic",
|
153
|
-
"not_supported":
|
153
|
+
"not_supported":false},
|
154
154
|
"patient_characteristic_race":{
|
155
155
|
"title":"patient characteristic, race",
|
156
156
|
"category":"characteristic",
|
data/lib/hqmf-model/document.rb
CHANGED
@@ -135,9 +135,16 @@ module HQMF
|
|
135
135
|
|
136
136
|
# Get the source data criteria that are specific occurrences
|
137
137
|
# @return [Array] an array of HQMF::DataCriteria describing the data elements used by the measure that are specific occurrences
|
138
|
-
def specific_occurrence_source_data_criteria
|
138
|
+
def specific_occurrence_source_data_criteria(force_sources=nil)
|
139
139
|
return [] if @source_data_criteria.nil?
|
140
|
-
@source_data_criteria.select {|dc| !dc.specific_occurrence.nil?}
|
140
|
+
matching = @source_data_criteria.select {|dc| !dc.specific_occurrence.nil?}
|
141
|
+
|
142
|
+
if force_sources
|
143
|
+
existing = matching.map(&:id)
|
144
|
+
matching.concat @source_data_criteria.select {|dc| !existing.include?(dc.id) && force_sources.include?(dc.id)}
|
145
|
+
end
|
146
|
+
|
147
|
+
matching
|
141
148
|
end
|
142
149
|
|
143
150
|
|
@@ -15,7 +15,12 @@ module HQMF1
|
|
15
15
|
@data_criteria = @doc.xpath('//cda:section[cda:code/@code="57025-9"]/cda:entry').collect do |entry|
|
16
16
|
DataCriteria.new(entry, occurrence_counters)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
|
+
@supplemental= @doc.xpath('//cda:section[cda:code/@code="69670-8"]/cda:entry').collect do |entry|
|
20
|
+
DataCriteria.new(entry, occurrence_counters)
|
21
|
+
end
|
22
|
+
|
23
|
+
@data_criteria.concat @supplemental
|
19
24
|
backfill_derived_code_lists
|
20
25
|
|
21
26
|
@attributes = @doc.xpath('//cda:subjectOf/cda:measureAttribute').collect do |attr|
|
@@ -1,24 +1,25 @@
|
|
1
|
-
<PedigreeInfo>
|
1
|
+
<hrf-md:PedigreeInfo>
|
2
2
|
<% unless pedigree.source_documents.empty? && pedigree.source_documents.empty?%>
|
3
|
-
<Source derived="true">
|
3
|
+
<hrf-md:Source derived="true">
|
4
4
|
<% pedigree.source_documents.each do |source| %>
|
5
|
-
<PedigreeInfo>
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
<hrf-md:PedigreeInfo>
|
6
|
+
<% if source.author %>
|
7
|
+
<%== render :partial => "author", locals: {author: source.author }%>
|
8
|
+
<% end %>
|
9
|
+
<hrf-md:Organization><%= source.organization %></hrf-md:Organization>
|
10
|
+
</hrf-md:PedigreeInfo>
|
9
11
|
<% end %>
|
10
12
|
<% pedigree.source_documents.each do |doc|%>
|
11
|
-
<Document>
|
12
|
-
<Target <% if doc.extension %> targetExtension="<%=doc.extension%>" <% end %>><%= doc.uri %></Target>
|
13
|
-
</Document>
|
14
|
-
|
13
|
+
<hrf-md:Document>
|
14
|
+
<hrf-md:Target <% if doc.extension %> targetExtension="<%=doc.extension%>" <% end %>><%= doc.uri %></hrf-md:Target>
|
15
|
+
</hrf-md:Document>
|
16
|
+
<% end %>
|
17
|
+
</hrf-md:Source>
|
15
18
|
<% end %>
|
16
19
|
<% if pedigree.author %>
|
17
|
-
|
18
|
-
<%= pedigree.author.name %>
|
19
|
-
</Author>
|
20
|
+
<%== render :partial => "author", locals: {author: pedigree.author }%>
|
20
21
|
<% end %>
|
21
22
|
<% if pedigree.organization %>
|
22
|
-
<Organization><%= pedigree.organization %></Organization>
|
23
|
+
<hrf-md:Organization><%= pedigree.organization %></hrf-md:Organization>
|
23
24
|
<% end %>
|
24
|
-
</PedigreeInfo>
|
25
|
+
</hrf-md:PedigreeInfo>
|