Skip to content

Commit

Permalink
Merge pull request #393 from njorocs/oral-cancer
Browse files Browse the repository at this point in the history
Fixed issues in populating oral cancer columns
  • Loading branch information
PatrickWaweru authored Oct 13, 2023
2 parents bf09045 + b5a9443 commit 3fe005c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 50 deletions.
45 changes: 22 additions & 23 deletions omod/src/main/resources/sql/DML.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4433,7 +4433,13 @@ insert into kenyaemr_etl.etl_cervical_cancer_screening(
retinoblastoma_gene_method_results,
retinoblastoma_eua_treatment,
retinoblastoma_gene_treatment,

prostate_cancer,
digital_rectal_prostate_examination,
digital_rectal_prostate_results,
digital_rectal_prostate_treatment,
prostatic_specific_antigen_test,
prostatic_specific_antigen_results,
prostatic_specific_antigen_treatment,
oral_cancer,
oral_cancer_visual_exam_method,
oral_cancer_cytology_method,
Expand All @@ -4447,14 +4453,6 @@ insert into kenyaemr_etl.etl_cervical_cancer_screening(
oral_cancer_cytology_treatment,
oral_cancer_imaging_treatment,
oral_cancer_biopsy_treatment,

prostate_cancer,
digital_rectal_prostate_examination,
digital_rectal_prostate_results,
digital_rectal_prostate_treatment,
prostatic_specific_antigen_test,
prostatic_specific_antigen_results,
prostatic_specific_antigen_treatment,
breast_cancer,
clinical_breast_examination_screening_method,
ultrasound_screening_method,
Expand Down Expand Up @@ -4559,21 +4557,21 @@ select

-- Getting oral cancer screening data
max(if(o.concept_id = 116030 and o.value_coded = 115355, 'Yes', null))as oral_cancer,
max(if(o.concept_id = 163589 and o.value_coded = 162737, 'Oral Visual Exam', null))as oral_cancer_visual_exam_method,
max(if(o.concept_id = 163589 and o.value_coded = 161199, 'Oral cytology', null))as oral_cancer_cytology_method,
max(if(o.concept_id = 163589 and o.value_coded = 161347, 'Oral Imaging', null))as oral_cancer_imaging_method,
max(if(o.concept_id = 163589 and o.value_coded = 161657, 'Oral Biopsy', null))as oral_cancer_biopsy_method,
max(if(o.concept_id = 162737, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_visual_exam_results,
max(if(o.concept_id = 132679, (case o.value_coded when 703 then 'Positive' when 664 then 'Negative' else '' end),null)) as oral_cancer_cytology_results,
max(if(o.concept_id = 1392, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_imaging_results,
max(if(o.concept_id = 166664, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_biopsy_results,
max(if(o.concept_id = 160049, (case o.value_coded when 1000078 then "Counsel on negative findings"
max(if(o.concept_id = 163308, 'Yes', null))as oral_cancer_visual_exam_method,
max(if(o.concept_id = 167139, 'Yes', null))as oral_cancer_cytology_method,
max(if(o.concept_id = 1000135, 'Yes', null))as oral_cancer_imaging_method,
max(if(o.concept_id = 1000136,'Yes', null))as oral_cancer_biopsy_method,
max(if(o.concept_id = 163308, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_visual_exam_results,
max(if(o.concept_id = 167139, (case o.value_coded when 703 then 'Positive' when 664 then 'Negative' else '' end),null)) as oral_cancer_cytology_results,
max(if(o.concept_id = 1000135, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_imaging_results,
max(if(o.concept_id = 1000136, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_biopsy_results,
max(if(o.concept_id = 1000151, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_visual_exam_treatment,
max(if(o.concept_id = 160049, (case o.value_coded when 1000078 then "Counsel on negative findings"
max(if(o.concept_id = 1000152, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_cytology_treatment,
max(if(o.concept_id = 160049, (case o.value_coded when 1000078 then "Counsel on negative findings"
max(if(o.concept_id = 1000153, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_imaging_treatment,
max(if(o.concept_id = 160049, (case o.value_coded when 1000078 then "Counsel on negative findings"
max(if(o.concept_id = 1000154, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_biopsy_treatment,

-- Getting breast cancer screening data
Expand Down Expand Up @@ -4660,8 +4658,9 @@ e.voided
from encounter e
inner join person p on p.person_id=e.patient_id and p.voided=0
inner join form f on f.form_id=e.form_id and f.uuid in ("be5c5602-0a1d-11eb-9e20-37d2e56925ee","0c93b93c-bfef-4d2a-9fbe-16b59ee366e7")
inner join obs o on o.encounter_id = e.encounter_id and o.concept_id in (165383,1788,163042,116030,164959,166664,1000147,1000148,165267,163589,163731,159449,163201,1169,5096,1887,165268,1169,164181,
160288,161011,1729,160632,162964,160592,159931,1546,164879,163589,1000149,1000105,1000150,116030,1000107,1000111,1169,1000090,159780,1000091,1000145,116030,163589,162737,132679,1392,166664,160049)
inner join obs o on o.encounter_id = e.encounter_id and o.concept_id in (1169,1392,1546,1729,1788,1887,5096,116030,132679,159449,159780,159931,160049,
160288,160592,160632,161011,162737,162964,163042,163201,163308,163589,163731,164181,164879,164959,165267,165268,165383,166664,
167139,1000090,1000091,1000105,1000107,1000111,1000135,1000136,1000145,1000147,1000148,1000149,1000150,1000151,1000152,1000153,1000154)
inner join (
select
o.person_id,
Expand Down
54 changes: 27 additions & 27 deletions omod/src/main/resources/sql/Scheduled_Updates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4566,7 +4566,13 @@ CREATE PROCEDURE sp_update_etl_cervical_cancer_screening(IN last_update_time DAT
retinoblastoma_gene_method_results,
retinoblastoma_eua_treatment,
retinoblastoma_gene_treatment,

prostate_cancer,
digital_rectal_prostate_examination,
digital_rectal_prostate_results,
digital_rectal_prostate_treatment,
prostatic_specific_antigen_test,
prostatic_specific_antigen_results,
prostatic_specific_antigen_treatment,
oral_cancer,
oral_cancer_visual_exam_method,
oral_cancer_cytology_method,
Expand All @@ -4580,14 +4586,6 @@ CREATE PROCEDURE sp_update_etl_cervical_cancer_screening(IN last_update_time DAT
oral_cancer_cytology_treatment,
oral_cancer_imaging_treatment,
oral_cancer_biopsy_treatment,

prostate_cancer,
digital_rectal_prostate_examination,
digital_rectal_prostate_results,
digital_rectal_prostate_treatment,
prostatic_specific_antigen_test,
prostatic_specific_antigen_results,
prostatic_specific_antigen_treatment,
breast_cancer,
clinical_breast_examination_screening_method,
ultrasound_screening_method,
Expand Down Expand Up @@ -4692,23 +4690,23 @@ select
max(if(o.concept_id = 1000111 and o.value_coded in (1000081,1000121,1000143), case o.value_coded when 1000081 then 'Routine follow up after 2 years' when 1000121 then 'Further evaluation' when 1000121 then 'Further evaluation' when 1000143 then 'Perform/refer for biopsy' end, null)) as prostatic_specific_antigen_treatment,

-- Getting oral cancer screening data
max(if(o.concept_id = 116030 and o.value_coded = 115355, 'Yes', null))as oral_cancer,
max(if(o.concept_id = 163589 and o.value_coded = 162737, 'Oral Visual Exam', null))as oral_cancer_visual_exam_method,
max(if(o.concept_id = 163589 and o.value_coded = 161199, 'Oral cytology', null))as oral_cancer_cytology_method,
max(if(o.concept_id = 163589 and o.value_coded = 161347, 'Oral Imaging', null))as oral_cancer_imaging_method,
max(if(o.concept_id = 163589 and o.value_coded = 161657, 'Oral Biopsy', null))as oral_cancer_biopsy_method,
max(if(o.concept_id = 162737, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_visual_exam_results,
max(if(o.concept_id = 132679, (case o.value_coded when 703 then 'Positive' when 664 then 'Negative' else '' end),null)) as oral_cancer_cytology_results,
max(if(o.concept_id = 1392, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_imaging_results,
max(if(o.concept_id = 166664, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_biopsy_results,
max(if(o.concept_id = 160049, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_visual_exam_treatment,
max(if(o.concept_id = 160049, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_cytology_treatment,
max(if(o.concept_id = 160049, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_imaging_treatment,
max(if(o.concept_id = 160049, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_biopsy_treatment,
max(if(o.concept_id = 116030 and o.value_coded = 115355, 'Yes', null))as oral_cancer,
max(if(o.concept_id = 163308, 'Yes', null))as oral_cancer_visual_exam_method,
max(if(o.concept_id = 167139, 'Yes', null))as oral_cancer_cytology_method,
max(if(o.concept_id = 1000135, 'Yes', null))as oral_cancer_imaging_method,
max(if(o.concept_id = 1000136,'Yes', null))as oral_cancer_biopsy_method,
max(if(o.concept_id = 163308, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_visual_exam_results,
max(if(o.concept_id = 167139, (case o.value_coded when 703 then 'Positive' when 664 then 'Negative' else '' end),null)) as oral_cancer_cytology_results,
max(if(o.concept_id = 1000135, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_imaging_results,
max(if(o.concept_id = 1000136, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as oral_cancer_biopsy_results,
max(if(o.concept_id = 1000151, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_visual_exam_treatment,
max(if(o.concept_id = 1000152, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_cytology_treatment,
max(if(o.concept_id = 1000153, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_imaging_treatment,
max(if(o.concept_id = 1000154, (case o.value_coded when 1000078 then "Counsel on negative findings"
when 1000121 then "Referred for further evaluation" else "" end),null)) as oral_cancer_biopsy_treatment,

-- Getting breast cancer screening data
max(if(o.concept_id = 116030 and o.value_coded = 116026, 'Yes', null))as breast_cancer,
Expand Down Expand Up @@ -4794,7 +4792,9 @@ e.voided
from encounter e
inner join person p on p.person_id=e.patient_id and p.voided=0
inner join form f on f.form_id=e.form_id and f.uuid in ("be5c5602-0a1d-11eb-9e20-37d2e56925ee","0c93b93c-bfef-4d2a-9fbe-16b59ee366e7")
inner join obs o on o.encounter_id = e.encounter_id and o.concept_id in (165383,1788,165267,163589,163042,116030,163731,159449,163201,1169,5096,1887,165268,1169,164181,160288,161011,1729,160632,162964,160592,159931,1546,164879,163589,1000149,1000105,1000150,116030,1000107,1000111,1169,1000090,159780,1000091,1000145,116030,163589,162737,132679,1392,166664,160049)
inner join obs o on o.encounter_id = e.encounter_id and o.concept_id in (1169,1392,1546,1729,1788,1887,5096,116030,132679,159449,159780,159931,160049,
160288,160592,160632,161011,162737,162964,163042,163201,163308,163589,163731,164181,164879,164959,165267,165268,165383,166664,
167139,1000090,1000091,1000105,1000107,1000111,1000135,1000136,1000145,1000147,1000148,1000149,1000150,1000151,1000152,1000153,1000154)
inner join (
select
o.person_id,
Expand Down

0 comments on commit 3fe005c

Please sign in to comment.