Class: Qrda3R21
Constant Summary
collapse
- PAYER_MAP =
{ '1' => 'A', '2' => 'B', '3' => 'D', '4' => 'D', '5' => 'C', '6' => 'C', '7' => 'D', '8' => 'D', '9' => 'D' }.freeze
Instance Method Summary
collapse
#birthdate, #ethnic_group, #expiration, #gender, #given_name, #mrn, #patient, #payer, #provider, #provider_ccn, #provider_npi, #provider_street, #provider_tin, #provider_type_code, #race
#as_id, #measures, #object_id, #random_id, #submission_program
#active_date_time, #author_effective_time, #author_time, #birth_date_time, #completed_prevalence_period, #current_time, #expired_date_time, #facility_period, #incision_datetime, #medication_duration_author_effective_time, #medication_duration_effective_time, #medication_supply_request_period, #participation_period, #performance_period_end, #performance_period_start, #prevalence_period, #received_date_time, #relevant_date_period_or_null_flavor, #relevant_date_time_value, #relevant_period, #result_date_time, #result_date_time?, #sent_date_time, #value_or_null_flavor
Constructor Details
#initialize(aggregate_results, measures, options = {}) ⇒ Qrda3R21
Returns a new instance of Qrda3R21.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 11
def initialize(aggregate_results, measures, options = {})
@aggregate_results = aggregate_results
@measures = measures
@measure_result_hash = {}
@measures.each do |measure|
@measure_result_hash[measure.hqmf_id] = { population_sets: measure.population_sets, hqmf_id: measure.hqmf_id, hqmf_set_id: measure.hqmf_set_id, description: measure.description, measure_data: [], aggregate_count: [] }
end
@aggregate_results.each do |hqmf_id, measure_aggregate_result|
measure_aggregate_result.each do |_key, aggregate_result|
@measure_result_hash[hqmf_id].measure_data << aggregate_result
end
end
@measure_result_hash.each do |key, hash|
@measure_result_hash[key][:aggregate_count] = agg_results(key, hash.measure_data, hash.population_sets)
end
@provider = options[:provider]
@performance_period_start = options[:start_time]
@performance_period_end = options[:end_time]
@submission_program = options[:submission_program]
@ry2022_submission = options[:ry2022_submission]
end
|
Instance Method Details
#agg_results(measure_id, cache_entries, population_sets) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 33
def agg_results(measure_id, cache_entries, population_sets)
aggregate_count = Qrda::Export::Helper::AggregateCount.new(measure_id)
cache_entries.each do |cache_entry|
aggregate_count.add_entry(cache_entry, population_sets)
end
aggregate_count
end
|
#cms_payer_code ⇒ Object
83
84
85
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 83
def cms_payer_code
PAYER_MAP[self['code'][0]] || 'D'
end
|
#cpcplus? ⇒ Boolean
87
88
89
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 87
def cpcplus?
@submission_program == 'CPCPLUS'
end
|
#measure_results ⇒ Object
41
42
43
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 41
def measure_results
@measure_result_hash.values.as_json
end
|
#msrpopl? ⇒ Boolean
53
54
55
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 53
def msrpopl?
self['type'] == 'MSRPOPL'
end
|
#not_observ? ⇒ Boolean
57
58
59
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 57
def not_observ?
self['type'] != 'OBSERV'
end
|
#payer_code? ⇒ Boolean
95
96
97
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 95
def payer_code?
self['type'] == 'PAYER'
end
|
#population_observation ⇒ Object
65
66
67
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 65
def population_observation
self['observation']
end
|
#population_supplemental_data ⇒ Object
129
130
131
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 129
def population_supplemental_data
reformat_supplemental_data(self['supplemental_data'])
end
|
#population_type ⇒ Object
45
46
47
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 45
def population_type
self['type'] == 'IPP' ? 'IPOP' : self['type']
end
|
#population_value ⇒ Object
49
50
51
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 49
def population_value
self['value'].round
end
|
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 133
def reformat_supplemental_data(supplemental_data)
supplemental_data_array = []
supplemental_data.each do |supplemental_data_key, counts|
counts.each do |key, value|
supplemental_data_count = { code: key, value: value, type: supplemental_data_key }
supplemental_data_array << supplemental_data_count
end
end
supplemental_data_array
end
|
#ry2022_submission? ⇒ Boolean
91
92
93
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 91
def ry2022_submission?
@ry2022_submission
end
|
#stratification_observation ⇒ Object
61
62
63
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 61
def stratification_observation
self['observation']
end
|
#supplemental_data_code ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 99
def supplemental_data_code
case self['type']
when 'RACE'
[{ supplemental_data_code: '72826-1', supplemental_data_code_system: '2.16.840.1.113883.6.1' }]
when 'ETHNICITY'
[{ supplemental_data_code: '69490-1', supplemental_data_code_system: '2.16.840.1.113883.6.1' }]
when 'SEX'
[{ supplemental_data_code: '76689-9', supplemental_data_code_system: '2.16.840.1.113883.6.1' }]
when 'PAYER'
[{ supplemental_data_code: '48768-6', supplemental_data_code_system: '2.16.840.1.113883.6.1' }]
end
end
|
#supplemental_data_value_code_system ⇒ Object
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 112
def supplemental_data_value_code_system
case self['type']
when 'RACE'
'2.16.840.1.113883.6.238'
when 'ETHNICITY'
'2.16.840.1.113883.6.238'
when 'SEX'
'2.16.840.1.113883.5.1'
when 'PAYER'
'2.16.840.1.113883.3.221.5'
end
end
|
#supplemental_template_ids ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 69
def supplemental_template_ids
case self['type']
when 'RACE'
[{ tid: '2.16.840.1.113883.10.20.27.3.8', extension: '2016-09-01' }]
when 'ETHNICITY'
[{ tid: '2.16.840.1.113883.10.20.27.3.7', extension: '2016-09-01' }]
when 'SEX'
[{ tid: '2.16.840.1.113883.10.20.27.3.6', extension: '2016-09-01' }]
when 'PAYER'
[{ tid: '2.16.840.1.113883.10.20.27.3.9', extension: '2016-02-01' },
{ tid: '2.16.840.1.113883.10.20.27.3.18', extension: '2018-05-01' }]
end
end
|
#unknown_supplemental_value? ⇒ Boolean
125
126
127
|
# File 'lib/qrda-export/catIII-r2-1/qrda3_r21.rb', line 125
def unknown_supplemental_value?
self['code'] == "" || self['code'] == "UNK"
end
|