diff --git a/omod/src/main/resources/sql/DDL.sql b/omod/src/main/resources/sql/DDL.sql index 0070f7cb..609a6e99 100644 --- a/omod/src/main/resources/sql/DDL.sql +++ b/omod/src/main/resources/sql/DDL.sql @@ -2106,6 +2106,15 @@ CREATE TABLE kenyaemr_etl.etl_patient_program ( colonoscopy_method_results VARCHAR(255) DEFAULT NULL, fecal_occult_screening_treatment VARCHAR(255) DEFAULT NULL, colonoscopy_method_treatment VARCHAR(255) DEFAULT NULL, + + retinoblastoma_cancer VARCHAR(255) DEFAULT NULL, + retinoblastoma_eua_screening_method VARCHAR(255) DEFAULT NULL, + retinoblastoma_gene_method VARCHAR(255) DEFAULT NULL, + retinoblastoma_eua_screening_results VARCHAR(255) DEFAULT NULL, + retinoblastoma_gene_method_results VARCHAR(255) DEFAULT NULL, + retinoblastoma_eua_treatment VARCHAR(255) DEFAULT NULL, + retinoblastoma_gene_treatment VARCHAR(255) DEFAULT NULL, + referred_out VARCHAR(100) DEFAULT NULL, referral_facility VARCHAR(100) DEFAULT NULL, referral_reason VARCHAR(255) DEFAULT NULL, diff --git a/omod/src/main/resources/sql/DML.sql b/omod/src/main/resources/sql/DML.sql index d7928c75..4b34d423 100644 --- a/omod/src/main/resources/sql/DML.sql +++ b/omod/src/main/resources/sql/DML.sql @@ -4422,6 +4422,13 @@ insert into kenyaemr_etl.etl_cervical_cancer_screening( colonoscopy_method_results, fecal_occult_screening_treatment, colonoscopy_method_treatment, + retinoblastoma_cancer, + retinoblastoma_eua_screening_method, + retinoblastoma_gene_method, + retinoblastoma_eua_screening_results, + retinoblastoma_gene_method_results, + retinoblastoma_eua_treatment, + retinoblastoma_gene_treatment, referred_out, referral_facility, referral_reason, @@ -4495,6 +4502,18 @@ select when 1000143 then "Refer for biopsy" when 1000103 then "Referred for further management" when 162907 then "Refer to surgical resection" else "" end),null)) as colonoscopy_method_treatment, + + max(if(o.concept_id = 116030 and o.value_coded = 127527, 'Yes', null))as retinoblastoma_cancer, + max(if(o.concept_id = 163589 and o.value_coded = 1000149, 'EUA(Examination Under Anesthesia)', null))as retinoblastoma_eua_screening_method, + max(if(o.concept_id = 163589 and o.value_coded = 1000105, 'Retinoblastoma gene (RB1 gene)', null))as retinoblastoma_gene_method, + max(if(o.concept_id=1000149, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as retinoblastoma_eua_screening_results , + max(if(o.concept_id=1000105, (case o.value_coded when 703 then "Negative" + when 664 then "Positive" else "" end),null)) as retinoblastoma_gene_method_results, + max(if(o.concept_id = 1000149, (case o.value_coded when 1000078 then "Counsel on negative findings" + when 1000121 then "Referred for further evaluation" else "" end),null)) as retinoblastoma_eua_treatment, + max(if(o.concept_id = 1000150, (case o.value_coded when 1000078 then "Counsel on negative findings" + when 1000121 then "Referred for further evaluation" else "" end),null)) as retinoblastoma_gene_treatment, + max(if(o.concept_id in (1788,165267),(case o.value_coded when 1065 then "Yes" when 1066 then "No" else "" end),null)) as referred_out, max(if(o.concept_id=165268,o.value_text,null)) as referral_facility, max(if(o.concept_id = 1887, (case o.value_coded when 165388 then 'Site does not have cryotherapy machine' @@ -4543,7 +4562,8 @@ 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) +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) inner join ( select o.person_id, @@ -4586,7 +4606,7 @@ inner join ( from obs o inner join encounter e on e.encounter_id = o.encounter_id 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") - where o.concept_id in (163589, 164934, 116030, 165070,160705,165266,166937,1272,166665,159362,1000148,163591) and o.voided=0 + where o.concept_id in (163589, 164934, 116030, 165070,160705,165266,166937,1272,166665,159362,1000148,163591,1000149,1000105) and o.voided=0 group by e.encounter_id, o.obs_group_id ) t on e.encounter_id = t.encounter_id left join ( diff --git a/omod/src/main/resources/sql/DataTools.sql b/omod/src/main/resources/sql/DataTools.sql index 6733e8a7..4da51785 100644 --- a/omod/src/main/resources/sql/DataTools.sql +++ b/omod/src/main/resources/sql/DataTools.sql @@ -1900,6 +1900,13 @@ create table kenyaemr_datatools.cervical_cancer_screening as hpv_treatment_method, pap_smear_treatment_method, via_vili_treatment_method, + retinoblastoma_cancer, + retinoblastoma_eua_screening_method, + retinoblastoma_gene_method, + retinoblastoma_eua_screening_results, + retinoblastoma_gene_method_results, + retinoblastoma_eua_treatment, + retinoblastoma_gene_treatment, referred_out, referral_facility, referral_reason, diff --git a/omod/src/main/resources/sql/Scheduled_Updates.sql b/omod/src/main/resources/sql/Scheduled_Updates.sql index e6ac64d4..4778f097 100644 --- a/omod/src/main/resources/sql/Scheduled_Updates.sql +++ b/omod/src/main/resources/sql/Scheduled_Updates.sql @@ -4547,6 +4547,13 @@ CREATE PROCEDURE sp_update_etl_cervical_cancer_screening(IN last_update_time DAT hpv_treatment_method, pap_smear_treatment_method, via_vili_treatment_method, + retinoblastoma_cancer, + retinoblastoma_eua_screening_method, + retinoblastoma_gene_method, + retinoblastoma_eua_screening_results, + retinoblastoma_gene_method_results, + retinoblastoma_eua_treatment, + retinoblastoma_gene_treatment, referred_out, referral_facility, referral_reason, @@ -4604,6 +4611,17 @@ select if(t.pap_smear_treatment_method is not null and f.uuid="be5c5602-0a1d-11eb-9e20-37d2e56925ee", t.pap_smear_treatment_method, null))) as pap_smear_treatment_method, max(if(t1.via_vili_treatment_method is not null and f.uuid = "0c93b93c-bfef-4d2a-9fbe-16b59ee366e7", t1.via_vili_treatment_method, if(t.via_vili_treatment_method is not null and f.uuid="be5c5602-0a1d-11eb-9e20-37d2e56925ee", t.via_vili_treatment_method, null))) as via_vili_treatment_method, + max(if(o.concept_id = 116030 and o.value_coded = 127527, 'Yes', null))as retinoblastoma_cancer, + max(if(o.concept_id = 163589 and o.value_coded = 1000149, 'EUA(Examination Under Anesthesia)', null))as retinoblastoma_eua_screening_method, + max(if(o.concept_id = 163589 and o.value_coded = 1000105, 'Retinoblastoma gene (RB1 gene)', null))as retinoblastoma_gene_method, + max(if(o.concept_id=1000149, (case o.value_coded when 1115 then "Normal" when 1116 then "Abnormal" else "" end),null)) as retinoblastoma_eua_screening_results , + max(if(o.concept_id=1000105, (case o.value_coded when 703 then "Negative" + when 664 then "Positive" else "" end),null)) as retinoblastoma_gene_method_results, + max(if(o.concept_id = 1000149, (case o.value_coded when 1000078 then "Counsel on negative findings" + when 1000121 then "Referred for further evaluation" else "" end),null)) as retinoblastoma_eua_treatment, + max(if(o.concept_id = 1000150, (case o.value_coded when 1000078 then "Counsel on negative findings" + when 1000121 then "Referred for further evaluation" else "" end),null)) as retinoblastoma_gene_treatment, + max(if(o.concept_id in (1788,165267),(case o.value_coded when 1065 then "Yes" when 1066 then "No" else "" end),null)) as referred_out, max(if(o.concept_id=165268,o.value_text,null)) as referral_facility, @@ -4653,7 +4671,7 @@ 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) +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) inner join ( select o.person_id, @@ -4696,7 +4714,7 @@ inner join ( from obs o inner join encounter e on e.encounter_id = o.encounter_id 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") - where o.concept_id in (163589, 164934, 165070,160705,165266,166937,1272,166665) and o.voided=0 + where o.concept_id in (163589, 164934, 165070,160705,165266,166937,1272,166665, 1000149,1000105) and o.voided=0 group by e.encounter_id, o.obs_group_id ) t on e.encounter_id = t.encounter_id left join ( @@ -4792,7 +4810,15 @@ colposcopy_screening_result=VALUES(colposcopy_screening_result),hpv_screening_re pap_smear_screening_result=VALUES(pap_smear_screening_result),via_vili_screening_result=VALUES(via_vili_screening_result), colposcopy_treatment_method=VALUES(colposcopy_treatment_method),hpv_treatment_method=VALUES(hpv_treatment_method), pap_smear_treatment_method=VALUES(pap_smear_treatment_method),via_vili_treatment_method=VALUES(via_vili_treatment_method), -referred_out=VALUES(referred_out),referral_facility=VALUES(referral_facility), +referred_out=VALUES(referred_out), +retinoblastoma_cancer=VALUES(retinoblastoma_cancer), +retinoblastoma_eua_screening_method=VALUES(retinoblastoma_eua_screening_method), +retinoblastoma_gene_method=VALUES(retinoblastoma_gene_method), +retinoblastoma_eua_screening_results=VALUES(retinoblastoma_eua_screening_results), +retinoblastoma_gene_method_results=VALUES(retinoblastoma_gene_method_results), +retinoblastoma_eua_treatment=VALUES(retinoblastoma_eua_treatment), +retinoblastoma_gene_treatment=VALUES(retinoblastoma_gene_treatment), +referral_facility=VALUES(referral_facility), referral_reason=VALUES(referral_reason),followup_date=VALUES(followup_date),hiv_status=VALUES(hiv_status), smoke_cigarattes=VALUES(smoke_cigarattes),other_forms_tobacco=VALUES(other_forms_tobacco), take_alcohol=VALUES(take_alcohol),previous_treatment=VALUES(previous_treatment),