From f1211b9ca869e7b2e8a39e8f1c602d3f07cb23a5 Mon Sep 17 00:00:00 2001 From: Dennis Kigen Date: Wed, 11 Aug 2021 12:11:31 +0300 Subject: [PATCH] Breast screening reporting mods (#1093) Modifications to the Breast Cancer screening reporting tools to get them to work with the amended stored procedure and flat table. --- .DS_Store | Bin 10244 -> 10244 bytes ...cer-daily-screening-summary-aggregate.json | 5 - ...r-monthly-screening-summary-aggregate.json | 5 - ...cancer-monthly-screening-summary-base.json | 653 ++++-------------- .../breast-cancer-patient-list-template.json | 242 ++++++- .../oncology-patient-list-cols.json | 587 ++++++++-------- .../breast-cancer-monthly-summary.service.js | 22 +- .../patient-oncology-summary-service.js | 19 +- 8 files changed, 683 insertions(+), 850 deletions(-) diff --git a/.DS_Store b/.DS_Store index 3353497172c3b9030072f499be1657e33d84584c..b1db405d37a3d69b9c36f8afbf01738530a716c0 100644 GIT binary patch delta 32 ocmZn(XbG6$&uFwUU^hRb(Pkcj(>#;^%Us!57Q?ieUEwb~0LK#yL;wH) delta 99 zcmZn(XbG6$&uFqSU^hRb$z~pb(>#(a3?&Sy48;s3o;mr+NjdpR3=9kc3=Aw^C!dgc rtj@_$$&koU#E{3J$B@I2&ydWJjjE2pnt_3_V)Fu7UZ&0L3V+!FS_K)= diff --git a/app/reporting-framework/json-reports/breast-cancer-daily-screening-summary-aggregate.json b/app/reporting-framework/json-reports/breast-cancer-daily-screening-summary-aggregate.json index 8a56fd6bb..9dbace77f 100644 --- a/app/reporting-framework/json-reports/breast-cancer-daily-screening-summary-aggregate.json +++ b/app/reporting-framework/json-reports/breast-cancer-daily-screening-summary-aggregate.json @@ -21,11 +21,6 @@ "alias": "location_name", "column": "location_name" }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "location_uuid" - }, { "type": "derived_column", "alias": "encounter_datetime", diff --git a/app/reporting-framework/json-reports/breast-cancer-monthly-screening-summary-aggregate.json b/app/reporting-framework/json-reports/breast-cancer-monthly-screening-summary-aggregate.json index 9ff47e0fa..f7deda0d0 100644 --- a/app/reporting-framework/json-reports/breast-cancer-monthly-screening-summary-aggregate.json +++ b/app/reporting-framework/json-reports/breast-cancer-monthly-screening-summary-aggregate.json @@ -21,11 +21,6 @@ "alias": "location_name", "column": "location_name" }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "location_uuid" - }, { "type": "derived_column", "alias": "encounter_datetime", diff --git a/app/reporting-framework/json-reports/breast-cancer-monthly-screening-summary-base.json b/app/reporting-framework/json-reports/breast-cancer-monthly-screening-summary-base.json index 81830d996..74fb3d528 100644 --- a/app/reporting-framework/json-reports/breast-cancer-monthly-screening-summary-base.json +++ b/app/reporting-framework/json-reports/breast-cancer-monthly-screening-summary-base.json @@ -13,7 +13,7 @@ "alias": "patient_name", "join": { "type": "inner", - "joinCondition": "fbcs.person_id = patient_name.person_id and (patient_name.voided is null || patient_name.voided = 0)" + "joinCondition": "fbcs.person_id = patient_name.person_id and (patient_name.voided is NULL || patient_name.voided = 0)" } }, { @@ -21,7 +21,7 @@ "alias": "patient_id", "join": { "type": "inner", - "joinCondition": "fbcs.person_id = patient_id.patient_id and (patient_id.voided is null || patient_id.voided = 0)" + "joinCondition": "fbcs.person_id = patient_id.patient_id and (patient_id.voided is NULL || patient_id.voided = 0)" } }, { @@ -37,7 +37,7 @@ "alias": "p", "join": { "type": "left", - "joinCondition": "fbcs.person_id = p.person_id and (p.voided is null || p.voided = 0 and (p.person_attribute_type_id = 10))" + "joinCondition": "fbcs.person_id = p.person_id AND (p.voided IS NULL || p.voided = 0 AND (p.person_attribute_type_id = 10))" } } ], @@ -52,7 +52,7 @@ "alias": "person_name", "expressionType": "simple_expression", "expressionOptions": { - "expression": "concat(coalesce(patient_name.given_name, ''), ' ', coalesce(patient_name.middle_name, ''), ' ', coalesce(patient_name.family_name, ''))" + "expression": "CONCAT(COALESCE(CONCAT(UPPER(SUBSTRING(patient_name.given_name, 1, 1)), LOWER(SUBSTRING(patient_name.given_name, 2))), ''), ' ', CONCAT(COALESCE(CONCAT(UPPER(SUBSTRING(patient_name.middle_name, 1, 1)), LOWER(SUBSTRING(patient_name.middle_name, 2))), ''), ' '), CONCAT(COALESCE(CONCAT(UPPER(SUBSTRING(patient_name.family_name, 1, 1)), LOWER(SUBSTRING(patient_name.family_name, 2))), ''), ' '))" } }, { @@ -60,20 +60,12 @@ "alias": "phone_number", "column": "p.value" }, - { - "type": "derived_column", - "alias": "diagnostic_interval", - "expressionType": "simple_expression", - "expressionOptions": { - "expression": "(SELECT CONCAT(TIMESTAMPDIFF(DAY, DATE(encounter_datetime), (SELECT date_patient_informed_and_referred_for_management FROM etl.flat_breast_cancer_screening WHERE encounter_type = 145 AND person_id = p.person_id ORDER BY encounter_datetime DESC LIMIT 1)), ' day(s)') FROM etl.flat_breast_cancer_screening WHERE person_id = p.person_id AND encounter_type = 86 and (select date_patient_informed_and_referred_for_management from etl.flat_breast_cancer_screening where encounter_type = 145 and person_id = p.person_id order by encounter_datetime desc limit 1) > (select encounter_datetime from etl.flat_breast_cancer_screening where encounter_type = 86 and person_id = p.person_id order by encounter_datetime desc limit 1) ORDER BY encounter_datetime DESC LIMIT 1)" - } - }, { "type": "derived_column", "alias": "identifiers", "expressionType": "simple_expression", "expressionOptions": { - "expression": "group_concat(distinct patient_id.identifier separator ', ')" + "expression": "GROUP_CONCAT(DISTINCT patient_id.identifier separator ', ')" } }, { @@ -93,545 +85,301 @@ }, { "type": "derived_column", - "alias": "type_of_abnormality", - "expressionType": "case_statement", + "alias": "past_clinical_breast_exam_results", + "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "cur_physical_findings = 0", + "condition": "past_clinical_breast_exam_results = '1115'", "value": "Normal" }, { - "condition": "cur_physical_findings = 1", - "value": "Mastitis" + "condition": "past_clinical_breast_exam_results = '1116'", + "value": "Abnormal" }, { - "condition": "cur_physical_findings = 2", + "condition": "past_clinical_breast_exam_results = '6250'", "value": "Breast lumps" }, { - "condition": "cur_physical_findings = 3", - "value": "Cracked nipple" - }, - { - "condition": "cur_physical_findings = 4", - "value": "Other" - }, - { - "condition": "cur_physical_findings = 5", - "value": "Mass" + "condition": "past_clinical_breast_exam_results = '1067'", + "value": "Unknown" }, { - "condition": "cur_physical_findings = 6", + "condition": "past_clinical_breast_exam_results = '6493'", "value": "Nipple discharge" }, { - "condition": "cur_physical_findings = 7", - "value": "Breast skin changes" - }, - { - "condition": "cur_physical_findings = 8", - "value": "Not done" - }, - { - "condition": "cur_physical_findings = 9", - "value": "Breast abscess" - }, - { - "condition": "cur_physical_findings = 10", - "value": "Breast engorgement" - }, - { - "condition": "cur_physical_findings = 11", - "value": "Abnormal" - }, - { - "condition": "cur_physical_findings = 12", - "value": "Calor" - }, - { - "condition": "cur_physical_findings = 13", - "value": "Peau dOrange" - }, - { - "condition": "cur_physical_findings = 14", - "value": "Unknown" - }, - { - "condition": "cur_physical_findings = 15", + "condition": "past_clinical_breast_exam_results = '9689'", "value": "Fine nodularity" }, { - "condition": "cur_physical_findings = 16", + "condition": "past_clinical_breast_exam_results = '9690'", "value": "Dense nodularity" }, { - "condition": "cur_physical_findings = 17", - "value": "Skin edema" + "condition": "past_clinical_breast_exam_results = '1481'", + "value": "Breast abscess" }, { - "condition": "cur_physical_findings = 18", + "condition": "past_clinical_breast_exam_results = '9688'", "value": "Nipple areolar change" }, { - "condition": "cur_physical_findings = 19", - "value": "Muscle tenderness" + "condition": "past_clinical_breast_exam_results = '9687'", + "value": "Skin edema" }, { - "condition": "cur_physical_findings = 20", - "value": "Benign" + "condition": "past_clinical_breast_exam_results = '5622'", + "value": "Other (non-coded)" } ] } }, { "type": "derived_column", - "alias": "screening_mode", - "expressionType": "simple_expression", - "expressionOptions": { - "expression": "case when (select screening_mode from etl.flat_breast_cancer_screening where encounter_type = 145 and person_id = p.person_id order by encounter_datetime desc limit 1) = 1 AND (select date_patient_informed_and_referred_for_management from etl.flat_breast_cancer_screening where encounter_type = 145 and person_id = p.person_id order by encounter_datetime desc limit 1) > (select encounter_datetime from etl.flat_breast_cancer_screening where encounter_type = 86 and person_id = p.person_id order by encounter_datetime desc limit 1) then 'Mammogram' when (select screening_mode from etl.flat_breast_cancer_screening where encounter_type = 145 and person_id = p.person_id order by encounter_datetime desc limit 1) = 2 and (select date_patient_informed_and_referred_for_management from etl.flat_breast_cancer_screening where encounter_type = 145 and person_id = p.person_id order by encounter_datetime desc limit 1) > (select encounter_datetime from etl.flat_breast_cancer_screening where encounter_type = 86 and person_id = p.person_id order by encounter_datetime desc limit 1) then 'Clinical breast exam' when (select screening_mode from etl.flat_breast_cancer_screening where encounter_type = 145 and person_id = p.person_id order by encounter_datetime desc limit 1) = 3 and (select date_patient_informed_and_referred_for_management from etl.flat_breast_cancer_screening where encounter_type = 145 and person_id = p.person_id order by encounter_datetime desc limit 1) > (select encounter_datetime from etl.flat_breast_cancer_screening where encounter_type = 86 and person_id = p.person_id order by encounter_datetime desc limit 1) then 'Ultrasound, breast' else null end" - } - }, - { - "type": "derived_column", - "alias": "lymph_nodes_findings", + "alias": "past_mammogram_results", "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "fbcs.lymph_nodes_findings = 1", + "condition": "past_mammogram_results = 1", "value": "Normal" }, { - "condition": "fbcs.lymph_nodes_findings = 2", - "value": "Lymphadenopathy" - }, - { - "condition": "lymph_nodes_findings = 3", - "value": "Fixed" + "condition": "past_mammogram_results = 2", + "value": "Abnormal" }, { - "condition": "fbcs.lymph_nodes_findings = 4", - "value": "Mobile" + "condition": "past_mammogram_results = 3", + "value": "Unknown" } ] } }, { "type": "derived_column", - "alias": "patient_education", + "alias": "personal_history_of_breast_cancer", "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "fbcs.patient_education = 1", - "value": "Annual screening" - }, - { - "condition": "fbcs.patient_education = 2", - "value": "Follow-up" + "condition": "personal_history_of_breast_cancer = 1", + "value": "Yes" }, { - "condition": "fbcs.patient_education = 3", - "value": "Self examination" + "condition": "personal_history_of_breast_cancer = 2", + "value": "No" }, { - "condition": "fbcs.patient_education = 4", - "value": "Other (Non-coded)" + "condition": "personal_history_of_breast_cancer = 3", + "value": "Unknown" } ] } }, { "type": "derived_column", - "alias": "referral_ordered", + "alias": "family_history_of_breast_cancer", "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "fbcs.referrals_ordered = 1", - "value": "None" + "condition": "family_history_of_breast_cancer = 1", + "value": "Yes" }, { - "condition": "fbcs.referrals_ordered = 2", - "value": "Clinician" - } - ] - } - }, - { - "type": "derived_column", - "alias": "breast_complaints_three_months", - "expressionType": "simple_expression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "fbcs.breast_complaints_3months = 1", - "value": "Asymptomatic" + "condition": "family_history_of_breast_cancer = 2", + "value": "No" }, { - "condition": "fbcs.breast_complaints_3months = 2", - "value": "Symptomatic" + "condition": "family_history_of_breast_cancer = 3", + "value": "Unknown" } ] } }, { "type": "derived_column", - "alias": "breast_mass_location", - "expressionType": "simpleExpression", + "alias": "breast_exam_findings_this_visit", + "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "fbcs.breast_mass_location = 1", - "value": "Bilateral" + "condition": "breast_exam_findings_this_visit = '1115'", + "value": "Normal" }, { - "condition": "fbcs.breast_mass_location = 2", - "value": "Left" + "condition": "breast_exam_findings_this_visit = '1116'", + "value": "Abnormal" }, { - "condition": "fbcs.breast_mass_location = 3", - "value": "Right" + "condition": "breast_exam_findings_this_visit = '1481'", + "value": "Breast abscess" }, { - "condition": "fbcs.breast_mass_location = 4", - "value": "Upper inner quadrant" + "condition": "breast_exam_findings_this_visit = '5313'", + "value": "Muscle tenderness" }, { - "condition": "fbcs.breast_mass_location = 5", - "value": "Lower inner quadrant" + "condition": "breast_exam_findings_this_visit = '6250'", + "value": "Breast lumps" }, { - "condition": "fbcs.breast_mass_location = 6", - "value": "Upper outer quadrant" + "condition": "breast_exam_findings_this_visit = '9689'", + "value": "Fine nodularity" }, { - "condition": "fbcs.breast_mass_location = 7", - "value": "Cyclic" - } - ] - } - }, - { - "type": "derived_column", - "alias": "nipple_discharge_location", - "expressionType": "simpleExpression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "fbcs.nipple_discharge_location = 1", - "value": "Left" + "condition": "breast_exam_findings_this_visit = '9690'", + "value": "Dense nodularity" }, { - "condition": "fbcs.nipple_discharge_location = 2", - "value": "Right" + "condition": "breast_exam_findings_this_visit = '9688'", + "value": "Nipple areolar change" }, { - "condition": "fbcs.nipple_discharge_location = 3", - "value": "Cyclic" - } - ] - } - }, - { - "type": "derived_column", - "alias": "nipple_retraction_location", - "expressionType": "simpleExpression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "fbcs.nipple_retraction_location = 1", - "value": "Left" + "condition": "breast_exam_findings_this_visit = '6493'", + "value": "Nipple discharge" }, { - "condition": "fbcs.nipple_retraction_location = 2", - "value": "Right" + "condition": "breast_exam_findings_this_visit = '9687'", + "value": "Skin edema" }, { - "condition": "fbcs.nipple_retraction_location = 3", - "value": "Cyclic" - } - ] - } - }, - { - "type": "derived_column", - "alias": "breast_erythrema_location", - "expressionType": "simpleExpression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "fbcs.breast_erythrema_location = 1", - "value": "Left" + "condition": "breast_exam_findings_this_visit = '5622'", + "value": "Other (non-coded)" }, { - "condition": "fbcs.breast_erythrema_location = 2", - "value": "Right" + "condition": "breast_exam_findings_this_visit = '6499'", + "value": "Breast skin changes" }, { - "condition": "fbcs.breast_erythrema_location = 3", - "value": "Cyclic" - } - ] - } - }, - { - "type": "derived_column", - "alias": "breast_rash_location", - "expressionType": "simpleExpression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "fbcs.breast_rash_location = 1", - "value": "Left" + "condition": "breast_exam_findings_this_visit = '6729'", + "value": "Breast engorgement" }, { - "condition": "fbcs.breast_rash_location = 2", - "value": "Right" + "condition": "breast_exam_findings_this_visit = '8188'", + "value": "Calor" }, { - "condition": "fbcs.breast_rash_location = 3", - "value": "Cyclic" - } - ] - } - }, - { - "type": "derived_column", - "alias": "breast_pain_location", - "expressionType": "simpleExpression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "fbcs.breast_pain_location = 1", - "value": "Left" + "condition": "breast_exam_findings_this_visit = '8189'", + "value": "Peau d''Orange" }, { - "condition": "fbcs.breast_pain_location = 2", - "value": "Right" + "condition": "breast_exam_findings_this_visit = '582'", + "value": "Breast mass" }, { - "condition": "fbcs.breast_pain_location = 3", - "value": "Cyclic" - } - ] - } - }, - { - "type": "derived_column", - "alias": "other_changes_location", - "expressionType": "simpleExpression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "other_changes_location = 1", - "value": "Left" + "condition": "breast_exam_findings_this_visit = '6249'", + "value": "Cracked nipple" }, { - "condition": "other_changes_location = 2", - "value": "Right" + "condition": "breast_exam_findings_this_visit = '115'", + "value": "Mastitis" }, { - "condition": "other_changes_location = 3", - "value": "Cyclic" - } - ] - } - }, - { - "type": "derived_column", - "alias": "history_of_mammogram", - "expressionType": "simpleExpression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "fbcs.history_of_mammogram = 0", - "value": "No" + "condition": "breast_exam_findings_this_visit = '10945'", + "value": "Retracted nipple associated with childbirth" }, { - "condition": "fbcs.history_of_mammogram = 1", - "value": "Yes" + "condition": "breast_exam_findings_this_visit = '10946'", + "value": "Mastitis associated with childbirth" } ] } }, { "type": "derived_column", - "alias": "mammogram_results", - "expressionType": "simpleExpression", + "alias": "breast_symmetry", + "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "fbcs.mammogram_results = 1", - "value": "Normal" - }, - { - "condition": "fbcs.mammogram_results = 2", - "value": "Abnormal" - }, - { - "condition": "fbcs.mammogram_results = 3", - "value": "Not done" - }, - { - "condition": "mammogram_results = 4", - "value": "Indeterminate" - }, - { - "condition": "fbcs.mammogram_results = 5", - "value": "Completed" + "condition": "breast_symmetry = 1", + "value": "Yes" }, { - "condition": "fbcs.mammogram_results = 6", - "value": "Unknown" - } - ] - } - }, - { - "type": "derived_column", - "alias": "breast_ultrasound_history", - "expressionType": "simpleExpression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "fbcs.breast_ultrasound_history = 0", + "condition": "breast_symmetry = 2", "value": "No" - }, - { - "condition": "fbcs.breast_ultrasound_history = 1", - "value": "Yes" } ] } }, { "type": "derived_column", - "alias": "breast_ultrasound_result", - "expressionType": "simpleExpression", + "alias": "histological_investigations_done", + "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "fbcs.breast_ultrasound_result = 1", - "value": "Normal" + "condition": "histological_investigations_done = 1", + "value": "Core needle biopsy" }, { - "condition": "fbcs.breast_ultrasound_result = 2", - "value": "Abnormal" + "condition": "histological_investigations_done = 2", + "value": "Excisional biopsy" }, { - "condition": "fbcs.breast_ultrasound_result = 3", - "value": "Unknown" + "condition": "histological_investigations_done = 3", + "value": "Incisional biopsy" }, { - "condition": "fbcs.breast_ultrasound_result = 4", - "value": "Not done" - } - ] - } - }, - { - "type": "derived_column", - "alias": "history_of_breast_biopsy", - "expressionType": "simpleExpression", - "expressionOptions": { - "caseOptions": [ - { - "condition": "fbcs.history_of_breast_biopsy = 0", - "value": "No" + "condition": "histological_investigations_done = 4", + "value": "Cytology" }, { - "condition": "fbcs.history_of_breast_biopsy = 1", - "value": "Yes" + "condition": "histological_investigations_done = 5", + "value": "None" } ] } }, { "type": "derived_column", - "alias": "breast_biopsy_results", - "expressionType": "simpleExpression", + "alias": "radiological_investigations_done", + "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "fbcs.breast_biopsy_results = 1", - "value": "Normal" - }, - { - "condition": "fbcs.breast_biopsy_results = 2", - "value": "Abnormal" - }, - { - "condition": "fbcs.breast_biopsy_results = 3", - "value": "Unknown" - }, - { - "condition": "fbcs.breast_biopsy_results = 4", - "value": "Benign" + "condition": "radiological_investigations_done = 1", + "value": "Mammogram" }, { - "condition": "fbcs.breast_biopsy_results = 5", - "value": "Malignant" + "condition": "radiological_investigations_done = 2", + "value": "Breast ultrasound" }, { - "condition": "fbcs.breast_biopsy_results = 6", - "value": "Not done" + "condition": "radiological_investigations_done = 3", + "value": "None" } ] } }, - { - "type": "simple_column", - "alias": "number_of_biopsies", - "column": "number_of_biopsies" - }, { "type": "derived_column", - "alias": "biopsy_type", - "expressionType": "simpleExpression", + "alias": "lymph_node_exam_findings", + "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "fbcs.biopsy_type = 1", - "value": "Core needle biopsy" - }, - { - "condition": "fbcs.biopsy_type = 2", - "value": "Excisional / surgical biopsy" - }, - { - "condition": "fbcs.biopsy_type = 3", - "value": "Skin punch biopsy" - }, - { - "condition": "fbcs.biopsy_type = 4", - "value": "Bone marrow biopsy" - }, - { - "condition": "fbcs.biopsy_type = 5", - "value": "Fine needle aspiration" + "condition": "fbcs.lymph_node_exam_findings = 1", + "value": "Normal" }, { - "condition": "fbcs.biopsy_type = 6", - "value": "Breast biopsy" + "condition": "fbcs.lymph_node_exam_findings = 2", + "value": "Lymphadenopathy" }, { - "condition": "fbcs.biopsy_type = 7", - "value": "Ultrasound guided biopsy" + "condition": "lymph_node_exam_findings = 3", + "value": "Fixed" }, { - "condition": "fbcs.biopsy_type = 8", - "value": "CT Scan guided biopsy" + "condition": "fbcs.lymph_node_exam_findings = 4", + "value": "Mobile" } ] } }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "fbcs.location_uuid" - }, { "type": "simple_column", "alias": "location_name", @@ -647,7 +395,7 @@ "alias": "male_patients", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.gender = 'M', 1, null)" + "expression": "if(fbcs.gender = 'M', 1, NULL)" } }, { @@ -655,7 +403,7 @@ "alias": "female_patients", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.gender = 'F', 1, null)" + "expression": "if(fbcs.gender = 'F', 1, NULL)" } }, { @@ -663,7 +411,7 @@ "alias": "hiv_negative", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 1, 1, null)" + "expression": "if(fbcs.hiv_status = 1, 1, NULL)" } }, { @@ -671,7 +419,7 @@ "alias": "hiv_status_unknown", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 3, 1, null)" + "expression": "if(fbcs.hiv_status = 3, 1, NULL)" } }, { @@ -679,7 +427,7 @@ "alias": "hiv_positive", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 2, 1, null)" + "expression": "if(fbcs.hiv_status = 2, 1, NULL)" } }, { @@ -687,7 +435,7 @@ "alias": "normal_findings", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(cur_physical_findings = 0 or cur_physical_findings is null, 1, null)" + "expression": "if(breast_exam_findings_this_visit = '1115' OR breast_exam_findings_this_visit IS NULL, 1, NULL)" } }, { @@ -695,7 +443,7 @@ "alias": "normal_below_30yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if((cur_physical_findings = 0 or cur_physical_findings is null) and age < 30, 1, null)" + "expression": "if((breast_exam_findings_this_visit = '1115' OR breast_exam_findings_this_visit IS NULL) AND (age < 30), 1, NULL)" } }, { @@ -703,7 +451,7 @@ "alias": "normal_30_to_40yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if((cur_physical_findings = 0 or cur_physical_findings is null) and age >= 30 and age <= 40, 1, null)" + "expression": "if((breast_exam_findings_this_visit = '1115' OR breast_exam_findings_this_visit IS NULL) AND (age >= 30 AND age <= 40), 1, NULL)" } }, { @@ -711,7 +459,7 @@ "alias": "normal_41_to_50yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if((cur_physical_findings = 0 or cur_physical_findings is null) and age >= 41 and age <= 50, 1, null)" + "expression": "if((breast_exam_findings_this_visit = '1115' OR breast_exam_findings_this_visit IS NULL) AND (age >= 41 AND age <= 50), 1, NULL)" } }, { @@ -719,7 +467,7 @@ "alias": "normal_51_to_69yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if((cur_physical_findings = 0 or cur_physical_findings is null) and age >= 51 and age <= 69, 1, null)" + "expression": "if((breast_exam_findings_this_visit = '1115' OR breast_exam_findings_this_visit IS NULL) AND (age >= 51 AND age <= 69), 1, NULL)" } }, { @@ -727,7 +475,7 @@ "alias": "normal_above_70yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if((cur_physical_findings = 0 or cur_physical_findings is null) and age >= 70, 1, null)" + "expression": "if((breast_exam_findings_this_visit = '1115' OR breast_exam_findings_this_visit IS NULL) AND (age >= 70), 1, NULL)" } }, { @@ -735,7 +483,7 @@ "alias": "abnormal_findings", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(cur_physical_findings != 0, 1, null)" + "expression": "if(breast_exam_findings_this_visit IS NOT NULL AND breast_exam_findings_this_visit != '1115', 1, NULL)" } }, { @@ -743,7 +491,7 @@ "alias": "abnormal_below_30yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(cur_physical_findings != 0 and age < 30, 1, null)" + "expression": "if((breast_exam_findings_this_visit IS NOT NULL AND breast_exam_findings_this_visit != '1115') AND (age < 30), 1, NULL)" } }, { @@ -751,7 +499,7 @@ "alias": "abnormal_30_to_40yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(cur_physical_findings != 0 and age >= 30 and age <= 40, 1, null)" + "expression": "if((breast_exam_findings_this_visit IS NOT NULL AND breast_exam_findings_this_visit != '1115') AND (age >= 30 AND age <= 40), 1, NULL)" } }, { @@ -759,7 +507,7 @@ "alias": "abnormal_41_to_50yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(cur_physical_findings != 0 and age >= 41 and age <= 50, 1, null)" + "expression": "if((breast_exam_findings_this_visit IS NOT NULL AND breast_exam_findings_this_visit != '1115') AND (age >= 41 AND age <= 50), 1, NULL)" } }, { @@ -767,7 +515,7 @@ "alias": "abnormal_51_to_69yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(cur_physical_findings != 0 and age >= 51 and age <= 69, 1, null)" + "expression": "if((breast_exam_findings_this_visit IS NOT NULL AND breast_exam_findings_this_visit != '1115') AND (age >= 51 AND age <= 69), 1, NULL)" } }, { @@ -775,20 +523,7 @@ "alias": "abnormal_above_70yrs", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(cur_physical_findings != 0 and age >= 70, 1, null)" - } - }, - { - "type": "derived_column", - "alias": "biopsy_results_within_2wks", - "expressionType": "case_statement", - "expressionOptions": { - "caseOptions": [ - { - "condition": "TIMESTAMPDIFF(WEEK, DATE(encounter_datetime), DATE(date_patient_notified_of_biopsy_results)) <= 2", - "value": 1 - } - ] + "expression": "if((breast_exam_findings_this_visit IS NOT NULL AND breast_exam_findings_this_visit != '1115') AND (age >= 70), 1, NULL)" } }, { @@ -796,7 +531,7 @@ "alias": "hiv_status", "expressionType": "simple_expression", "expressionOptions": { - "expression": "case when hiv_status=1 then 'HIV Negative' when hiv_status=2 then 'HIV Positive' when hiv_status=3 then 'Unknown' else NULL end" + "expression": "CASE WHEN hiv_status = 1 THEN 'HIV Negative' WHEN hiv_status = 2 THEN 'HIV Positive' WHEN hiv_status = 3 THEN 'Unknown' ELSE NULL END" } }, { @@ -804,7 +539,7 @@ "alias": "hiv_positive_below_25", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 2 and age < 25, 1, null)" + "expression": "if(fbcs.hiv_status = 2 AND age < 25, 1, NULL)" } }, { @@ -812,7 +547,7 @@ "alias": "hiv_negative_below_25", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 1 and age < 25, 1, null)" + "expression": "if(fbcs.hiv_status = 1 AND age < 25, 1, NULL)" } }, { @@ -820,7 +555,7 @@ "alias": "hiv_unknown_below_25", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 3 and age < 30, 1, null)" + "expression": "if(fbcs.hiv_status = 3 AND age < 25, 1, NULL)" } }, { @@ -828,7 +563,7 @@ "alias": "hiv_positive_25_to_49", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 2 and age >= 25 and age < 50, 1, null)" + "expression": "if(fbcs.hiv_status = 2 AND age >= 25 AND age <= 49, 1, NULL)" } }, { @@ -836,7 +571,7 @@ "alias": "hiv_negative_25_to_49", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 1 and age >= 25 and age < 50, 1, null)" + "expression": "if(fbcs.hiv_status = 1 AND age >= 25 AND age <= 49, 1, NULL)" } }, { @@ -844,7 +579,7 @@ "alias": "hiv_unknown_25_to_49", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 3 and age >= 25 and age < 50, 1, null)" + "expression": "if(fbcs.hiv_status = 3 AND age >= 25 AND age <= 49, 1, NULL)" } }, { @@ -852,7 +587,7 @@ "alias": "hiv_positive_over_50", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 3 and age > 50, 1, null)" + "expression": "if(fbcs.hiv_status = 2 AND age > 50, 1, NULL)" } }, { @@ -860,7 +595,7 @@ "alias": "hiv_negative_over_50", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 1 and age > 50, 1, null)" + "expression": "if(fbcs.hiv_status = 1 AND age > 50, 1, NULL)" } }, { @@ -868,99 +603,7 @@ "alias": "hiv_unknown_over_50", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if(fbcs.hiv_status = 3 and age > 50, 1, null)" - } - }, - { - "type": "derived_column", - "alias": "clients_staged_before_treatment", - "expressionType": "simple_expression", - "expressionOptions": { - "expression": "(IF(cancer_staging IN (1 , 2, 3, 4), 1, NULL))" - } - }, - { - "type": "derived_column", - "alias": "procedure_done", - "expressionType": "case_statement", - "expressionOptions": { - "caseOptions": [ - { - "condition": "procedure_done = 1", - "value": "Ultrasound" - }, - { - "condition": "procedure_done = 2", - "value": "Mammogram" - }, - { - "condition": "procedure_done = 3", - "value": "Core Needle Biopsy" - }, - { - "condition": "procedure_done = 4", - "value": "FNA" - }, - { - "condition": "procedure_done = 5", - "value": "Surgical biopsy" - }, - { - "condition": "procedure_done = 6", - "value": "Incisional biopsy" - } - ] - } - }, - { - "type": "derived_column", - "alias": "diagnosis", - "expressionType": "case_statement", - "expressionOptions": { - "caseOptions": [ - { - "condition": "diagnosis IN (9618 , 6544, 6250, 6243, 2220, 115)", - "value": 1 - } - ] - } - }, - { - "type": "derived_column", - "alias": "cancer_stage", - "expressionType": "case_statement", - "expressionOptions": { - "caseOptions": [ - { - "condition": "cancer_staging = 1", - "value": "Stage I" - }, - { - "condition": "cancer_staging = 2", - "value": "Stage II" - }, - { - "condition": "cancer_staging = 3", - "value": "Stage III" - }, - { - "condition": "cancer_staging = 4", - "value": "Stage IV" - } - ] - } - }, - { - "type": "simple_column", - "alias": "date_patient_informed_of_results", - "column": "(select DATE_FORMAT(date_patient_informed_and_referred_for_management, '%d-%M-%Y') from etl.flat_breast_cancer_screening where encounter_type = 145 and (select date_patient_informed_and_referred_for_management from etl.flat_breast_cancer_screening where encounter_type = 145 and person_id = p.person_id order by encounter_datetime desc limit 1) > (select encounter_datetime from etl.flat_breast_cancer_screening where encounter_type = 86 and person_id = p.person_id order by encounter_datetime desc limit 1) and person_id = p.person_id order by encounter_datetime desc limit 1)" - }, - { - "type": "derived_column", - "alias": "total_reffered_for_followup", - "expressionType": "simple_expression", - "expressionOptions": { - "expression": "if(referrals_ordered = 1, 1, NULL)" + "expression": "if(fbcs.hiv_status = 3 AND age > 50, 1, NULL)" } } ], @@ -993,7 +636,7 @@ }, { "filterType": "tableColumns", - "conditionExpression": "fbcs.location_uuid in ?", + "conditionExpression": "l.uuid in ?", "parameterName": "locationUuids" }, { diff --git a/app/reporting-framework/json-reports/breast-cancer-patient-list-template.json b/app/reporting-framework/json-reports/breast-cancer-patient-list-template.json index a81b28c3b..97734eb63 100644 --- a/app/reporting-framework/json-reports/breast-cancer-patient-list-template.json +++ b/app/reporting-framework/json-reports/breast-cancer-patient-list-template.json @@ -94,92 +94,262 @@ } }, { - "type": "simple_column", - "alias": "date_patient_informed_of_results", - "column": "date_patient_informed_and_referred_for_management" + "type": "derived_column", + "alias": "past_clinical_breast_exam_results", + "expressionType": "simple_expression", + "expressionOptions": { + "caseOptions": [ + { + "condition": "past_clinical_breast_exam_results LIKE '%1115%'", + "value": "Normal" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%1116%'", + "value": "Abnormal" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%6250%'", + "value": "Breast lumps" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%1067%'", + "value": "Unknown" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%6493%'", + "value": "Nipple discharge" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%9689%'", + "value": "Fine nodularity" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%9690%'", + "value": "Dense nodularity" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%1481%'", + "value": "Breast abscess" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%9688%'", + "value": "Nipple areolar change" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%9687%'", + "value": "Skin edema" + }, + { + "condition": "past_clinical_breast_exam_results LIKE '%5622%'", + "value": "Other (non-coded)" + } + ] + } }, { "type": "derived_column", - "alias": "diagnostic_interval", + "alias": "past_mammogram_results", "expressionType": "simple_expression", "expressionOptions": { - "expression": "timestampdiff(day,date(encounter_datetime),date(date_patient_informed_and_referred_for_management))" + "caseOptions": [ + { + "condition": "past_mammogram_results = 1", + "value": "Normal" + }, + { + "condition": "past_mammogram_results = 2", + "value": "Abnormal" + }, + { + "condition": "past_mammogram_results = 3", + "value": "Unknown" + } + ] } }, { "type": "derived_column", - "alias": "procedure_done", - "expressionType": "case_statement", + "alias": "personal_history_of_breast_cancer", + "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "procedure_done = 1", - "value": "Ultrasound" + "condition": "personal_history_of_breast_cancer = 1", + "value": "Yes" }, { - "condition": "procedure_done = 2", - "value": "Mammogram" + "condition": "personal_history_of_breast_cancer = 2", + "value": "No" + }, + { + "condition": "personal_history_of_breast_cancer = 3", + "value": "Unknown" + } + ] + } + }, + { + "type": "derived_column", + "alias": "family_history_of_breast_cancer", + "expressionType": "simple_expression", + "expressionOptions": { + "caseOptions": [ + { + "condition": "family_history_of_breast_cancer = 1", + "value": "Yes" + }, + { + "condition": "family_history_of_breast_cancer = 2", + "value": "No" + }, + { + "condition": "family_history_of_breast_cancer = 3", + "value": "Unknown" + } + ] + } + }, + { + "type": "derived_column", + "alias": "breast_exam_findings_this_visit", + "expressionType": "simple_expression", + "expressionOptions": { + "caseOptions": [ + { + "condition": "breast_exam_findings_this_visit LIKE '%1115%'", + "value": "Normal" + }, + { + "condition": "breast_exam_findings_this_visit LIKE '%5313%'", + "value": "Muscle tenderness" + }, + { + "condition": "breast_exam_findings_this_visit LIKE '%6250%'", + "value": "Breast lumps" }, { - "condition": "procedure_done = 3", - "value": "Core Needle Biopsy" + "condition": "breast_exam_findings_this_visit LIKE '%9689%'", + "value": "Fine nodularity" }, { - "condition": "procedure_done = 4", - "value": "FNA" + "condition": "breast_exam_findings_this_visit LIKE '%1116%'", + "value": "Abnormal" }, { - "condition": "procedure_done = 5", - "value": "Surgical Biopsy" + "condition": "breast_exam_findings_this_visit LIKE '%6493%'", + "value": "Nipple discharge" }, { - "condition": "procedure_done = 6", - "value": "Incisional Biopsy" + "condition": "breast_exam_findings_this_visit LIKE '%9690%'", + "value": "Dense nodularity" + }, + { + "condition": "breast_exam_findings_this_visit LIKE '%9688%'", + "value": "Nipple areolar change" + }, + { + "condition": "breast_exam_findings_this_visit LIKE '%9687%'", + "value": "Skin edema" + }, + { + "condition": "breast_exam_findings_this_visit LIKE '%5622%'", + "value": "Other (non-coded)" + }, + { + "condition": "breast_exam_findings_this_visit LIKE '%1481%'", + "value": "Breast abscess" } ] } }, { "type": "derived_column", - "alias": "diagnosis", - "expressionType": "case_statement", + "alias": "breast_symmetry", + "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "diagnosis in (9618,6544,6250,6243,2220,115)", - "value": "1" + "condition": "breast_symmetry = 1", + "value": "Yes" }, { - "condition": "else", - "value": "null" + "condition": "breast_symmetry = 2", + "value": "No" } ] } }, { "type": "derived_column", - "alias": "cancer_stage", + "alias": "histological_investigations_done", + "expressionType": "simple_expression", "expressionOptions": { "caseOptions": [ { - "condition": "cancer_staging = 1", - "value": "Stage I" + "condition": "histological_investigations_done = 1", + "value": "Core needle biopsy" + }, + { + "condition": "histological_investigations_done = 2", + "value": "Excisional biopsy" + }, + { + "condition": "histological_investigations_done = 2", + "value": "Incisional biopsy" }, { - "condition": "else", - "value": "null" + "condition": "histological_investigations_done = 2", + "value": "Cytology" + }, + { + "condition": "histological_investigations_done = 2", + "value": "None" + } + ] + } + }, + { + "type": "derived_column", + "alias": "radiological_investigations_done", + "expressionType": "simple_expression", + "expressionOptions": { + "caseOptions": [ + { + "condition": "radiological_investigations_done = 1", + "value": "Mammogram" + }, + { + "condition": "radiological_investigations_done = 2", + "value": "Breast ultrasound" + }, + { + "condition": "radiological_investigations_done = 2", + "value": "None" + } + ] + } + }, + { + "type": "derived_column", + "alias": "lymph_node_exam_findings", + "expressionType": "simple_expression", + "expressionOptions": { + "caseOptions": [ + { + "condition": "fbcs.lymph_node_exam_findings = 1", + "value": "Normal" }, { - "condition": "cancer_staging = 2", - "value": "Stage II" + "condition": "fbcs.lymph_node_exam_findings = 2", + "value": "Lymphadenopathy" }, { - "condition": "cancer_staging = 3", - "value": "Stage III" + "condition": "lymph_node_exam_findings = 3", + "value": "Fixed" }, { - "condition": "cancer_staging = 4", - "value": "Stage IV" + "condition": "fbcs.lymph_node_exam_findings = 4", + "value": "Mobile" } ] } diff --git a/oncology-reports/oncology-patient-list-cols.json b/oncology-reports/oncology-patient-list-cols.json index 166723279..4ad25c659 100644 --- a/oncology-reports/oncology-patient-list-cols.json +++ b/oncology-reports/oncology-patient-list-cols.json @@ -10,31 +10,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "breast_complaints_three_months", - "breast_mass_location", - "nipple_discharge_location", - "nipple_retraction_location", - "breast_erythrema_location", - "breast_rash_location", - "breast_pain_location", - "other_changes_location", - "history_of_mammogram", - "mammogram_results", - "breast_ultrasound_history", - "breast_ultrasound_result", - "history_of_breast_biopsy", - "breast_biopsy_results", - "number_of_biopsies", - "biopsy_type", - "type_of_abnormality", - "patient_uuid", - "screening_mode", - "diagnostic_interval", - "date_patient_informed_of_results" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -44,12 +32,19 @@ "location_name", "identifiers", "person_name", + "age", "gender", + "phone_number", "hiv_status", - "patient_uuid", - "screening_mode", - "diagnostic_interval", - "date_patient_informed_of_results" + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -59,13 +54,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "date_patient_informed_of_results" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -75,13 +76,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "date_patient_informed_of_results" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -91,13 +98,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "date_patient_informed_of_results" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -107,13 +120,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "date_patient_informed_of_results" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -123,13 +142,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "date_patient_informed_of_results" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -139,30 +164,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "screening_mode", - "diagnostic_interval", - "breast_complaints_three_months", - "breast_mass_location", - "nipple_discharge_location", - "nipple_retraction_location", - "breast_erythrema_location", - "breast_rash_location", - "breast_pain_location", - "other_changes_location", - "history_of_mammogram", - "mammogram_results", - "breast_ultrasound_history", - "breast_ultrasound_result", - "history_of_breast_biopsy", - "breast_biopsy_results", - "number_of_biopsies", - "biopsy_type" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -172,30 +186,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "screening_mode", - "diagnostic_interval", - "breast_complaints_three_months", - "breast_mass_location", - "nipple_discharge_location", - "nipple_retraction_location", - "breast_erythrema_location", - "breast_rash_location", - "breast_pain_location", - "other_changes_location", - "history_of_mammogram", - "mammogram_results", - "breast_ultrasound_history", - "breast_ultrasound_result", - "history_of_breast_biopsy", - "breast_biopsy_results", - "number_of_biopsies", - "biopsy_type" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -205,30 +208,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "screening_mode", - "diagnostic_interval", - "breast_complaints_three_months", - "breast_mass_location", - "nipple_discharge_location", - "nipple_retraction_location", - "breast_erythrema_location", - "breast_rash_location", - "breast_pain_location", - "other_changes_location", - "history_of_mammogram", - "mammogram_results", - "breast_ultrasound_history", - "breast_ultrasound_result", - "history_of_breast_biopsy", - "breast_biopsy_results", - "number_of_biopsies", - "biopsy_type" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -238,30 +230,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "screening_mode", - "diagnostic_interval", - "breast_complaints_three_months", - "breast_mass_location", - "nipple_discharge_location", - "nipple_retraction_location", - "breast_erythrema_location", - "breast_rash_location", - "breast_pain_location", - "other_changes_location", - "history_of_mammogram", - "mammogram_results", - "breast_ultrasound_history", - "breast_ultrasound_result", - "history_of_breast_biopsy", - "breast_biopsy_results", - "number_of_biopsies", - "biopsy_type" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -271,30 +252,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "screening_mode", - "diagnostic_interval", - "breast_complaints_three_months", - "breast_mass_location", - "nipple_discharge_location", - "nipple_retraction_location", - "breast_erythrema_location", - "breast_rash_location", - "breast_pain_location", - "other_changes_location", - "history_of_mammogram", - "mammogram_results", - "breast_ultrasound_history", - "breast_ultrasound_result", - "history_of_breast_biopsy", - "breast_biopsy_results", - "number_of_biopsies", - "biopsy_type" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -304,30 +274,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", - "hiv_status", + "gender", "phone_number", - "type_of_abnormality", - "patient_uuid", - "screening_mode", - "diagnostic_interval", - "breast_complaints_three_months", - "breast_mass_location", - "nipple_discharge_location", - "nipple_retraction_location", - "breast_erythrema_location", - "breast_rash_location", - "breast_pain_location", - "other_changes_location", - "history_of_mammogram", - "mammogram_results", - "breast_ultrasound_history", - "breast_ultrasound_result", - "history_of_breast_biopsy", - "breast_biopsy_results", - "number_of_biopsies", - "biopsy_type" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -338,61 +297,6 @@ "indicator": "normal_breast_call_rate", "patientListCols": [] }, - { - "indicator": "diagnostic_interval", - "patientListCols": [ - "encounter_datetime", - "location_name", - "identifiers", - "person_name", - "gender", - "age", - "phone_number", - "diagnosis", - "date_patient_informed_of_results", - "diagnostic_interval", - "patient_uuid" - ] - }, - { - "indicator": "clients_staged_before_treatment", - "patientListCols": [ - "encounter_datetime", - "location_name", - "identifiers", - "person_name", - "gender", - "age", - "phone_number", - "patient_uuid" - ] - }, - { - "indicator": "total_reffered_for_followup", - "patientListCols": [ - "encounter_datetime", - "location_name", - "identifiers", - "person_name", - "gender", - "age", - "phone_number", - "patient_uuid" - ] - }, - { - "indicator": "biopsy_results_within_2wks", - "patientListCols": [ - "encounter_datetime", - "location_name", - "identifiers", - "person_name", - "gender", - "age", - "phone_number", - "patient_uuid" - ] - }, { "indicator": "male_patients", "patientListCols": [ @@ -400,10 +304,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -413,10 +326,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -426,10 +348,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -439,10 +370,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -452,10 +392,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -465,11 +414,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -479,11 +436,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -493,11 +458,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -507,11 +480,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -521,11 +502,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -535,11 +524,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -549,11 +546,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -563,11 +568,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -577,11 +590,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] }, { @@ -591,11 +612,19 @@ "location_name", "identifiers", "person_name", - "gender", "age", + "gender", "phone_number", - "patient_uuid", - "hiv_status" + "hiv_status", + "past_clinical_breast_exam_results", + "past_mammogram_results", + "personal_history_of_breast_cancer", + "family_history_of_breast_cancer", + "breast_exam_findings_this_visit", + "breast_symmetry", + "lymph_node_exam_findings", + "histological_investigations_done", + "radiological_investigations_done" ] } ] diff --git a/service/breast-cancer-monthly-summary.service.js b/service/breast-cancer-monthly-summary.service.js index 29c65c3be..7fab66979 100644 --- a/service/breast-cancer-monthly-summary.service.js +++ b/service/breast-cancer-monthly-summary.service.js @@ -4,7 +4,6 @@ const _ = require('lodash'); const oncologyReportsService = require('../oncology-reports/oncology-reports-service'); import { BaseMysqlReport } from '../app/reporting-framework/base-mysql.report'; import { PatientlistMysqlReport } from '../app/reporting-framework/patientlist-mysql.report'; -import { titleCase } from '../etl-helpers'; export class BreastCancerMonthlySummaryService { getAggregateReport(reportParams) { @@ -29,7 +28,6 @@ export class BreastCancerMonthlySummaryService { results.result = result; delete results['results']; resolve(results); - // TODO Do some post processing }).catch((errors) => { reject(errors); }); @@ -57,17 +55,7 @@ export class BreastCancerMonthlySummaryService { ); return new Promise((resolve, reject) => { - // TODO: Do some pre processing Promise.join(report.generatePatientListReport(indicators), (results) => { - for (const key in results.results.results) { - if (results.results.results.hasOwnProperty(key)) { - if (results.results.results[key].person_name) { - results.results.results[key].person_name = titleCase( - results.results.results[key].person_name - ); - } - } - } oncologyReportsService .getPatientListCols( reportParams.indicators, @@ -78,11 +66,17 @@ export class BreastCancerMonthlySummaryService { resolve(results); }) .catch((error) => { - console.error('ERROR: Error getting patient list cols', error); + console.error( + 'Error fetching breast screening patient list columns', + error + ); reject(error); }); }).catch((errors) => { - console.error('Error', errors); + console.error( + 'Error generating breast screening patient list report: ', + errors + ); reject(errors); }); }); diff --git a/service/oncology/patient-oncology-summary-service.js b/service/oncology/patient-oncology-summary-service.js index 13e2468d2..bc6226610 100644 --- a/service/oncology/patient-oncology-summary-service.js +++ b/service/oncology/patient-oncology-summary-service.js @@ -67,7 +67,7 @@ function generateMedsDataSet(data) { objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj); return objectsByKeyValue; }, {}); - //Group medical history obs by the group + // Group medical history obs by the group if (data) { const groupByEncounter = groupBy('encounter_id'); const encounterData = groupByEncounter(data); @@ -115,7 +115,7 @@ function getOncologyIntegratedProgramSnapshot(request) { let patientUuid = request.uuid; let queryParts = { columns: - "t1.encounter_id, t1.encounter_datetime, t6.encounter_type_name, REPLACE(t3.name, 'Oncology ', '') AS `visit_name`, t5.name AS location, t6.breast_exam_findings, t6.via_test_result, t6.hiv_status, t6.prior_via_test_result, t6.prior_via_test_result_date", + "t1.encounter_id, t1.encounter_datetime, t6.name AS `encounter_type_name`, REPLACE(t3.name, 'Oncology ', '') AS `visit_name`, t5.name AS `location`, t7.breast_exam_findings_this_visit, t7.past_clinical_breast_exam_results, CASE WHEN t8.via_or_via_vili_test_result = 1 THEN 'Negative' WHEN t8.via_or_via_vili_test_result = 2 THEN 'Positive' WHEN t8.via_or_via_vili_test_result = 3 THEN 'Suspicious of cancer' ELSE NULL END, t8.hiv_status, CASE WHEN t8.prior_via_result = 1 THEN 'Positive' WHEN t8.prior_via_result = 1 THEN 'Negative' ELSE NULL END, t8.prior_via_result_date", order: [ { column: 'encounter_datetime', @@ -128,17 +128,24 @@ function getOncologyIntegratedProgramSnapshot(request) { ['amrs.visit_type', 't3', 't3.visit_type_id = t2.visit_type_id'], ['amrs.person', 't4', 't4.person_id = t1.patient_id'], ['amrs.location', 't5', 't5.location_id = t1.location_id'], + ['amrs.encounter_type', 't6', 't6.encounter_type_id = t1.encounter_type'], [ - 'etl.flat_onc_patient_history', - 't6', - 't6.encounter_id = t1.encounter_id' + 'etl.flat_breast_cancer_screening', + 't7', + 't7.encounter_id = t1.encounter_id' + ], + [ + 'etl.flat_cervical_cancer_screening', + 't8', + 't8.encounter_id = t1.encounter_id' ] ], table: 'amrs.encounter', where: [ 't4.uuid = ? and t2.visit_type_id in ? and t1.voided = ?', patientUuid, - [5, 6, 70, 72, 71], + // Visit types: Breast screening, Cervical screening, Lung screening, Sickle cell screening + [5, 6, 70, 71], 0 ], offset: request.startIndex,