Class: Qrda3
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, #onc_gender_code?, #patient, #payer, #provider, #provider_ccn, #provider_npi, #provider_street, #provider_tin, #provider_type_code, #race
#as_id, #hicn, #measures, #medicare_beneficiary_identifier, #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 = {}) ⇒ Qrda3
Returns a new instance of Qrda3.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/qrda-export/catIII/qrda3.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]
@ry2025_submission = options[:ry2025_submission]
@ry2026_submission = options[:ry2026_submission]
@authoring_system = options[:authoring_system]
end
|
Instance Method Details
#agg_results(measure_id, cache_entries, population_sets) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 36
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
|
#authoring_system ⇒ Object
112
113
114
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 112
def authoring_system
@authoring_system || 'TestSystem'
end
|
#cms_payer_code ⇒ Object
91
92
93
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 91
def cms_payer_code
PAYER_MAP[self['code'][0]] || 'D'
end
|
#cpcplus? ⇒ Boolean
95
96
97
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 95
def cpcplus?
@submission_program == 'CPCPLUS'
end
|
#gender_code? ⇒ Boolean
120
121
122
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 120
def gender_code?
self['type'] == 'SEX'
end
|
#measure_results ⇒ Object
44
45
46
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 44
def measure_results
@measure_result_hash.values.as_json
end
|
#msrpopl? ⇒ Boolean
56
57
58
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 56
def msrpopl?
self['type'] == 'MSRPOPL'
end
|
#not_observ? ⇒ Boolean
60
61
62
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 60
def not_observ?
self['type'] != 'OBSERV'
end
|
#other_gender_code? ⇒ Boolean
124
125
126
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 124
def other_gender_code?
!%w[M F].include?(self['code'])
end
|
#payer_code? ⇒ Boolean
116
117
118
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 116
def payer_code?
self['type'] == 'PAYER'
end
|
#population_observation ⇒ Object
68
69
70
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 68
def population_observation
self['observation']
end
|
#population_supplemental_data ⇒ Object
158
159
160
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 158
def population_supplemental_data
reformat_supplemental_data(self['supplemental_data'])
end
|
#population_type ⇒ Object
48
49
50
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 48
def population_type
self['type'] == 'IPP' ? 'IPOP' : self['type']
end
|
#population_value ⇒ Object
52
53
54
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 52
def population_value
self['value'].round
end
|
162
163
164
165
166
167
168
169
170
171
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 162
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
99
100
101
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 99
def ry2022_submission?
@ry2022_submission
end
|
#ry2025_submission? ⇒ Boolean
103
104
105
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 103
def ry2025_submission?
@ry2025_submission
end
|
#ry2026_submission? ⇒ Boolean
use 2026 template ids if 2026 submission is specified as true, or if it unspecified
108
109
110
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 108
def ry2026_submission?
@ry2026_submission || @ry2026_submission.nil?
end
|
#stratification_observation ⇒ Object
64
65
66
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 64
def stratification_observation
self['observation']
end
|
#supplemental_data_code ⇒ Object
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 128
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
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 141
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 72
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'
if other_gender_code?
[{ tid: '2.16.840.1.113883.10.20.27.3.6', extension: '2016-09-01' },
{ tid: '2.16.840.1.113883.10.20.27.3.21', extension: '2025-05-01' }]
else
[{ tid: '2.16.840.1.113883.10.20.27.3.6', extension: '2016-09-01' }]
end
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
154
155
156
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 154
def unknown_supplemental_value?
self['code'] == "" || self['code'] == "UNK"
end
|