Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Metrics/ClassLength:
- 'lib/cypress/demographics_randomizer.rb'
- 'lib/cypress/expected_results_calculator.rb'
- 'lib/cypress/population_clone_job.rb'
- 'lib/validators/cat3_population_validator.rb'
Metrics/CyclomaticComplexity:
Max: 12
Exclude:
Expand Down
14 changes: 7 additions & 7 deletions lib/validators/cat3_population_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ class Cat3PopulationValidator < QrdaFileValidator
include ::CqmValidators::ReportedResultExtractor
include QrdaHelper

# These are the demographic codes specified in the CMS IG for Payer, Sex, Race and Ethnicity
REQUIRED_CODES = { 'PAYER' => %w[A B C D], 'SEX' => %w[M F], 'RACE' => %w[2106-3 2076-8 2054-5 2028-9 1002-5 2131-1],
'ETHNICITY' => %w[2135-2 2186-5] }.freeze

def initialize(expected_measures = [])
@expected_measures = expected_measures
end
Expand Down Expand Up @@ -111,11 +107,15 @@ def validate_demographics(reported_result, pop_key, pop_set_hash, options)
verify_all_codes_reported(reported_result, pop_key, 'ETHNICITY', options) unless @missing_codes['ETHNICITY']
end

# Verifiy that all demographic codes for a sup_key (e.g., RACE) are present for a pop_key (e.g., DENOM) in a reported result
# Verify that all demographic codes for a sup_key (e.g., RACE) are present for a pop_key (e.g., DENOM) in a reported result
def verify_all_codes_reported(reported_result, pop_key, sup_key, options)
gender_codes = options['test_execution'].task.bundle.randomization['genders']&.map(&:code)
required_codes = { 'PAYER' => %w[A B C D], 'SEX' => gender_codes, 'RACE' => %w[2106-3 2076-8 2054-5 2028-9 1002-5 2131-1],
'ETHNICITY' => %w[2135-2 2186-5] }.freeze

reported_codes = reported_result[:supplemental_data][pop_key][sup_key]
required_codes = REQUIRED_CODES[sup_key]
missing_codes = required_codes - reported_codes.keys
required_codes_for_key = required_codes[sup_key]
missing_codes = required_codes_for_key - reported_codes.keys
return if missing_codes.empty?

msg = "For CMS eligible clinicians and eligible professionals programs, all #{sup_key} codes present in the value set must be reported," \
Expand Down
Loading
Loading