Skip to content

Commit d018c69

Browse files
andie23uniquedj95
authored andcommitted
Fix Cxca dashboard enhancement crashes
# Issue 1. Concept references returned by screened_today method were not matching the hardcoded strings in build_report `methods` # Fix 1. added condition to only retrieved short concept names insead of fully specified 2. formatting references between screening methods to use lower case
1 parent d141e35 commit d018c69

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/services/cxca_service/reports/clinic/dashboard.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def initialize(start_date: Date.today, end_date: Date.today)
1212
end
1313

1414
def build_report
15-
methods = ['VIA', 'Speculum Exam', 'PAP Smear', 'HPV DNA']
16-
15+
methods = ['via', 'speculum exam', 'pap smear', 'hpv dna']
16+
1717
age_groups = ['<25', '25-29', '30-44', '45-49', '49+']
1818
[:reffered, :walkin].each_with_object({}) do |section, report|
1919
report[section] = age_groups.each_with_object({}) do |age_group, age_group_report|
@@ -37,7 +37,7 @@ def dashboard
3737
reffered = refered_from_art&.map { |r| r['person_id'] }
3838
(screened_today || []).each do |person|
3939
section = reffered.include?(person['person_id']) ? :reffered : :walkin
40-
method = person['screening_method']
40+
method = person['screening_method'].downcase
4141
age_group = map_age_group(person['age_group'])
4242
id = person['person_id']
4343

@@ -84,7 +84,9 @@ def screened_today
8484
SELECT person_id, concept_name.name AS screening_method
8585
FROM obs
8686
INNER JOIN concept_name ON concept_name.concept_id = obs.value_coded
87-
AND concept_name.voided = 0
87+
AND concept_name.voided = 0 AND (concept_name.concept_name_type != 'FULLY_SPECIFIED'
88+
OR concept_name.concept_name_type IS NULL
89+
OR concept_name.concept_name_type = '')
8890
INNER JOIN encounter ON encounter.encounter_id = obs.encounter_id
8991
AND encounter.voided = 0
9092
AND encounter.program_id = (SELECT program_id FROM program WHERE name = 'CxCa program' LIMIT 1)

0 commit comments

Comments
 (0)