From 4465b07656af7b86c78f2d3c4aace62507bbb48d Mon Sep 17 00:00:00 2001 From: ruhanga Date: Fri, 28 Jun 2024 15:37:59 +0300 Subject: [PATCH] Fixed raw data queries --- ...reening_Appointment_Status_Tracking_4.yaml | 43 +++++++++++++++++- ...Cervical_Cancer_Screening_RH_Raw_Data.yaml | 6 +-- .../Analytics/NCD_HC_EMR_Raw_Data.yaml | 2 +- .../Analytics/NCD_RH_EMR_Raw_Data.yaml | 44 +++++++++---------- 4 files changed, 67 insertions(+), 28 deletions(-) diff --git a/base/configs/superset/assets/dashboards/Cervical_Cancer_Screening_Appointment_Status_Tracking_4.yaml b/base/configs/superset/assets/dashboards/Cervical_Cancer_Screening_Appointment_Status_Tracking_4.yaml index 5369b96a..c26ffebb 100644 --- a/base/configs/superset/assets/dashboards/Cervical_Cancer_Screening_Appointment_Status_Tracking_4.yaml +++ b/base/configs/superset/assets/dashboards/Cervical_Cancer_Screening_Appointment_Status_Tracking_4.yaml @@ -59,7 +59,12 @@ metadata: timed_refresh_immune_slices: [] cross_filters_enabled: false default_filters: '{}' - chart_configuration: {} + chart_configuration: + '59': + id: 59 + crossFilters: + scope: global + chartsInScope: [] native_filter_configuration: - id: NATIVE_FILTER-EumcJiApY controlValues: @@ -86,7 +91,7 @@ metadata: type: NATIVE_FILTER description: '' chartsInScope: - - 17 + - 59 tabsInScope: [] - id: NATIVE_FILTER-uTQNiHhdj controlValues: @@ -147,6 +152,40 @@ metadata: chartsInScope: - 17 tabsInScope: [] + - id: NATIVE_FILTER_DIVIDER-1ughKpvv4 + type: DIVIDER + scope: + rootPath: + - ROOT_ID + excluded: [] + title: "\u179A\u1799\u17C8\u1796\u17C1\u179B\u179A\u17B6\u1799\u1780\u17B6\u179A\ + \u178E\u17CD (Reporting Period)" + description: '' + - id: NATIVE_FILTER-fk1fEAut9 + controlValues: + enableEmptyFilter: false + name: "\u1787\u17BD\u179A\u1796\u17C1\u179B\u179C\u17C1\u179B\u17B6 (Time Range)" + filterType: filter_time + targets: + - {} + defaultDataMask: + extraFormData: {} + filterState: {} + ownState: {} + cascadeParentIds: [] + scope: + rootPath: + - ROOT_ID + excluded: [] + type: NATIVE_FILTER + description: '' shared_label_colors: {} color_scheme_domain: [] + global_chart_configuration: + scope: + rootPath: + - ROOT_ID + excluded: [] + chartsInScope: + - 59 version: 1.0.0 diff --git a/base/configs/superset/assets/datasets/Analytics/Cervical_Cancer_Screening_RH_Raw_Data.yaml b/base/configs/superset/assets/datasets/Analytics/Cervical_Cancer_Screening_RH_Raw_Data.yaml index 1ae59552..986ffddd 100644 --- a/base/configs/superset/assets/datasets/Analytics/Cervical_Cancer_Screening_RH_Raw_Data.yaml +++ b/base/configs/superset/assets/datasets/Analytics/Cervical_Cancer_Screening_RH_Raw_Data.yaml @@ -200,9 +200,9 @@ sql: "SELECT\n MAX(p.openmrs_id) AS client_id,\n MAX(p.patient_name) AS client \ SUBSTRING(\n identifiers\n FROM\n 'Passport No: ([^,]*)'\n\ \ ) AS passport_no,\n COALESCE(\n REGEXP_REPLACE (\n REGEXP_REPLACE\ \ (\n identifiers,\n '(?:OpenMRS ID|National ID|IDPoor|PMRS\ - \ ID|COVID vaccination ID): [^,]*,?\\s?',\n '',\n 'g'\n \ - \ ),\n '^, |, $',\n ''\n ),\n NULL\n \ - \ ) AS other_identifiers,\n -- Addresses\n address_country AS country,\n\ + \ ID|NSSF|SSN|COVID vaccination ID): [^,]*,?\\s?',\n '',\n \ + \ 'g'\n ),\n '^, |, $',\n ''\n ),\n NULL\n\ + \ ) AS other_identifiers,\n -- Addresses\n address_country AS country,\n\ \ address_state_province AS province,\n address_county_district AS district,\n\ \ address_city AS commune,\n address_1 AS village,\n -- Attributes\n\ \ SUBSTRING(\n attributes\n FROM\n 'Occupation: ([^/]*)'\n\ diff --git a/base/configs/superset/assets/datasets/Analytics/NCD_HC_EMR_Raw_Data.yaml b/base/configs/superset/assets/datasets/Analytics/NCD_HC_EMR_Raw_Data.yaml index 01a3b2c6..ab2dce8c 100644 --- a/base/configs/superset/assets/datasets/Analytics/NCD_HC_EMR_Raw_Data.yaml +++ b/base/configs/superset/assets/datasets/Analytics/NCD_HC_EMR_Raw_Data.yaml @@ -217,7 +217,7 @@ sql: "SELECT\n MAX(p.openmrs_id) AS client_id,\n MAX(p.patient_name) AS client \ FROM\n 'SSN: ([^,]*)'\n ) AS ssn,\n SUBSTRING(\n \ \ identifiers\n FROM\n 'Passport No: ([^,]*)'\n ) AS passport_no,\n\ \ COALESCE(\n REGEXP_REPLACE (\n REGEXP_REPLACE (\n \ - \ identifiers,\n '(?:OpenMRS ID|National ID|IDPoor|PMRS ID|COVID\ + \ identifiers,\n '(?:OpenMRS ID|National ID|IDPoor|PMRS ID|NSSF|SSN|COVID\ \ vaccination ID): [^,]*,?\\s?',\n '',\n 'g'\n ),\n\ \ '^, |, $',\n ''\n ),\n NULL\n ) AS other_identifiers,\n\ \ -- Addresses\n address_country AS country,\n address_state_province\ diff --git a/base/configs/superset/assets/datasets/Analytics/NCD_RH_EMR_Raw_Data.yaml b/base/configs/superset/assets/datasets/Analytics/NCD_RH_EMR_Raw_Data.yaml index 13349a66..69bc4c95 100644 --- a/base/configs/superset/assets/datasets/Analytics/NCD_RH_EMR_Raw_Data.yaml +++ b/base/configs/superset/assets/datasets/Analytics/NCD_RH_EMR_Raw_Data.yaml @@ -240,28 +240,28 @@ sql: "SELECT\n MAX(p.openmrs_id) AS client_id,\n MAX(p.patient_name) AS client \ FROM\n 'SSN: ([^,]*)'\n ) AS ssn,\n SUBSTRING(\n \ \ identifiers\n FROM\n 'Passport No: ([^,]*)'\n ) AS passport_no,\n\ \ COALESCE(\n REGEXP_REPLACE (\n REGEXP_REPLACE (\n \ - \ identifiers,\n '(?:OpenMRS ID|National ID|IDPoor|PMRS ID|COVID\ - \ vaccination ID): [^,]*,?\\s?',\n '',\n 'g'\n ),\n\ - \ '^, |, $',\n ''\n ),\n NULL\n ) AS other_identifiers,\n\ - \ -- Addresses\n address_country AS country,\n address_state_province\ - \ AS province,\n address_county_district AS district,\n address_city AS\ - \ commune,\n address_1 AS village,\n -- Attributes\n SUBSTRING(\n\ - \ attributes\n FROM\n 'Occupation: ([^/]*)'\n ) AS occupation,\n\ - \ SUBSTRING(\n attributes\n FROM\n 'Place of Birth:\ - \ ([^/]*)'\n ) AS place_of_birth,\n SUBSTRING(\n attributes\n \ - \ FROM\n 'Ethnicity: ([^/]*)'\n ) AS ethnicity,\n SUBSTRING(\n\ - \ attributes\n FROM\n 'Marital Status: ([^/]*)'\n )\ - \ AS marital_status,\n SUBSTRING(\n attributes\n FROM\n \ - \ 'Education: ([^/]*)'\n ) AS education,\n SUBSTRING(\n attributes\n\ - \ FROM\n 'Telephone Number: ([^/]*)'\n ) AS phone_number\n\ - \ FROM\n patients\n WHERE\n person_voided IS FALSE\n ) p ON (p.patient_uuid=v.patient_uuid)\n\ - WHERE\n o.obs_voided IS FALSE\n AND v.visit_voided IS FALSE\n AND v.visit_type_uuid\ - \ IN (\n '5f4975a7-1af8-4a0b-9bbb-c4cfc22f2aab',\n '54da8fbc-b92f-4251-b53a-feedc8e8c594'\n\ - \ )\n -- NCD Consultation, Medication History and Orders Encounter Types\n AND\ - \ e.encounter_type_uuid IN (\n 'f9fdbe63-12b4-479f-b8fd-dcbfde6aa944',\n 'b870b6bb-9441-4664-9087-3d3477174213',\n\ - \ '39da3525-afe4-45ff-8977-c53b7b359158'\n ) -- 422b7e0c-b8f3-4748-8e60-d6684315f141\n\ - \ -- Referral Hospital (RH)\n AND l.location_tags ILIKE '%Referral Hospital%'\n\ - GROUP BY\n v.visit_uuid,\n p.patient_uuid" + \ identifiers,\n '(?:OpenMRS ID|National ID|IDPoor|NSSF|SSN|PMRS\ + \ ID|COVID vaccination ID): [^,]*,?\\s?',\n '',\n 'g'\n \ + \ ),\n '^, |, $',\n ''\n ),\n NULL\n \ + \ ) AS other_identifiers,\n -- Addresses\n address_country AS country,\n\ + \ address_state_province AS province,\n address_county_district AS district,\n\ + \ address_city AS commune,\n address_1 AS village,\n -- Attributes\n\ + \ SUBSTRING(\n attributes\n FROM\n 'Occupation: ([^/]*)'\n\ + \ ) AS occupation,\n SUBSTRING(\n attributes\n FROM\n \ + \ 'Place of Birth: ([^/]*)'\n ) AS place_of_birth,\n SUBSTRING(\n\ + \ attributes\n FROM\n 'Ethnicity: ([^/]*)'\n ) AS ethnicity,\n\ + \ SUBSTRING(\n attributes\n FROM\n 'Marital Status:\ + \ ([^/]*)'\n ) AS marital_status,\n SUBSTRING(\n attributes\n \ + \ FROM\n 'Education: ([^/]*)'\n ) AS education,\n SUBSTRING(\n\ + \ attributes\n FROM\n 'Telephone Number: ([^/]*)'\n \ + \ ) AS phone_number\n FROM\n patients\n WHERE\n person_voided IS\ + \ FALSE\n ) p ON (p.patient_uuid=v.patient_uuid)\nWHERE\n o.obs_voided IS FALSE\n\ + \ AND v.visit_voided IS FALSE\n AND v.visit_type_uuid IN (\n '5f4975a7-1af8-4a0b-9bbb-c4cfc22f2aab',\n\ + \ '54da8fbc-b92f-4251-b53a-feedc8e8c594'\n )\n -- NCD Consultation, Medication\ + \ History and Orders Encounter Types\n AND e.encounter_type_uuid IN (\n 'f9fdbe63-12b4-479f-b8fd-dcbfde6aa944',\n\ + \ 'b870b6bb-9441-4664-9087-3d3477174213',\n '39da3525-afe4-45ff-8977-c53b7b359158'\n\ + \ ) -- 422b7e0c-b8f3-4748-8e60-d6684315f141\n -- Referral Hospital (RH)\n AND\ + \ l.location_tags ILIKE '%Referral Hospital%'\nGROUP BY\n v.visit_uuid,\n p.patient_uuid" params: null template_params: null filter_select_enabled: false