Skip to content

Commit

Permalink
Make sure RV and SDE calculations are not impacted by randomazation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dczulada authored Jul 30, 2024
1 parent 4046f3d commit 8b0302b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/validators/calculating_augmented_records.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ def validate_calculated_results(rec, options)

def compare_results(results, record, options)
passed = true
sde_passed = true
@measures.each do |measure|
# compare results to patient as it was initially calculated for product test (use original product patient id before cloning)
orig_results = CQM::IndividualResult.where(patient_id: options[:orig_product_patient].id, measure_id: measure.id)
orig_results.each do |orig_result|
new_result = results.select do |arr|
arr.measure_id == measure.id.to_s &&
arr.patient_id == record.id.to_s &&
arr.population_set_key == orig_result['population_set_key']
arr.measure_id == measure.id.to_s && arr.patient_id == record.id.to_s && arr.population_set_key == orig_result['population_set_key']
end.first
issue_list = []
orig_result.compare_sde_results(new_result, issue_list)
sde_passed = issue_list.blank?
measure.population_keys.each do |pop_id|
if orig_result[pop_id] != new_result[pop_id]
passed = false
Expand All @@ -50,7 +52,7 @@ def compare_results(results, record, options)
end
end
end
passed
passed && sde_passed
end
end
end

0 comments on commit 8b0302b

Please sign in to comment.