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, #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
|
# 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]
@authoring_system = options[:authoring_system]
end
|
Instance Method Details
#agg_results(measure_id, cache_entries, population_sets) ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 35
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
101
102
103
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 101
def authoring_system
@authoring_system || 'TestSystem'
end
|
#cms_payer_code ⇒ Object
85
86
87
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 85
def cms_payer_code
PAYER_MAP[self['code'][0]] || 'D'
end
|
#cpcplus? ⇒ Boolean
89
90
91
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 89
def cpcplus?
@submission_program == 'CPCPLUS'
end
|
#measure_results ⇒ Object
43
44
45
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 43
def measure_results
@measure_result_hash.values.as_json
end
|
#msrpopl? ⇒ Boolean
55
56
57
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 55
def msrpopl?
self['type'] == 'MSRPOPL'
end
|
#not_observ? ⇒ Boolean
59
60
61
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 59
def not_observ?
self['type'] != 'OBSERV'
end
|
#payer_code? ⇒ Boolean
105
106
107
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 105
def payer_code?
self['type'] == 'PAYER'
end
|
#population_observation ⇒ Object
67
68
69
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 67
def population_observation
self['observation']
end
|
#population_supplemental_data ⇒ Object
139
140
141
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 139
def population_supplemental_data
reformat_supplemental_data(self['supplemental_data'])
end
|
#population_type ⇒ Object
47
48
49
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 47
def population_type
self['type'] == 'IPP' ? 'IPOP' : self['type']
end
|
#population_value ⇒ Object
51
52
53
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 51
def population_value
self['value'].round
end
|
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 143
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
93
94
95
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 93
def ry2022_submission?
@ry2022_submission
end
|
#ry2025_submission? ⇒ Boolean
97
98
99
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 97
def ry2025_submission?
@ry2025_submission
end
|
#stratification_observation ⇒ Object
63
64
65
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 63
def stratification_observation
self['observation']
end
|
#supplemental_data_code ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 109
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
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 122
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
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 71
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
135
136
137
|
# File 'lib/qrda-export/catIII/qrda3.rb', line 135
def unknown_supplemental_value?
self['code'] == "" || self['code'] == "UNK"
end
|