Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNDE-1913: Preprocess service and proc changes for F_STD_PAGE_CASE #103

Merged
merged 6 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,56 @@ public class Investigation {

@Column(name = "investigation_form_cd")
private String investigationFormCd;

@Column(name = "ca_supervisor_of_phc_uid")
private Long caSupervisorOfPhcUid;

@Column(name = "closure_investgr_of_phc_uid")
private Long closureInvestgrOfPhcUid;

@Column(name = "dispo_fld_fupinvestgr_of_phc_uid")
private Long dispoFldFupinvestgrOfPhcUid;

@Column(name = "fld_fup_investgr_of_phc_uid")
private Long fldFupInvestgrOfPhcUid;

@Column(name = "fld_fup_prov_of_phc_uid")
private Long fldFupProvOfPhcUid;

@Column(name = "fld_fup_supervisor_of_phc_uid")
private Long fldFupSupervisorOfPhcUid;

@Column(name = "init_fld_fup_investgr_of_phc_uid")
private Long initFldFupInvestgrOfPhcUid;

@Column(name = "init_fup_investgr_of_phc_uid")
private Long initFupInvestgrOfPhcUid;

@Column(name ="init_interviewer_of_phc_uid")
private Long initInterviewerOfPhcUid;

@Column(name = "interviewer_of_phc_uid")
private Long interviewerOfPhcUid;

@Column(name = "surv_investgr_of_phc_uid")
private Long survInvestgrOfPhcUid;

@Column(name = "fld_fup_facility_of_phc_uid")
private Long fldFupFacilityOfPhcUid;

@Column(name = "org_as_hospital_of_delivery_uid")
private Long orgAsHospitalOfDeliveryUid;

@Column(name = "per_as_provider_of_delivery_uid")
private Long perAsProviderOfDeliveryUid;

@Column(name = "per_as_provider_of_obgyn_uid")
private Long perAsProviderOfObgynUid;

@Column(name = "per_as_provider_of_pediatrics_uid")
private Long perAsProviderOfPediatricsUid;

@Column(name = "org_as_reporter_uid")
private Long orgAsReporterUid;

}
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,21 @@ public class InvestigationReporting {
private Long caseCount;
private String investigatorAssignedDatetime;
private String investigationFormCd;
private Long caSupervisorOfPhcUid;
private Long closureInvestgrOfPhcUid;
private Long dispoFldFupinvestgrOfPhcUid;
private Long fldFupInvestgrOfPhcUid;
private Long fldFupProvOfPhcUid;
private Long fldFupSupervisorOfPhcUid;
private Long initFldFupInvestgrOfPhcUid;
private Long initFupInvestgrOfPhcUid;
private Long initInterviewerOfPhcUid;
private Long interviewerOfPhcUid;
private Long survInvestgrOfPhcUid;
private Long fldFupFacilityOfPhcUid;
private Long orgAsHospitalOfDeliveryUid;
private Long perAsProviderOfDeliveryUid;
private Long perAsProviderOfObgynUid;
private Long perAsProviderOfPediatricsUid;
private Long orgAsReporterUid;
}
Original file line number Diff line number Diff line change
Expand Up @@ -443,20 +443,6 @@ databaseChangeLog:
- sqlFile:
path: 020-sp_lab101_datamart_postprocessing-001.sql
splitStatements: false
- changeSet:
id: 59
author: liquibase
changes:
- sqlFile:
path: 007-create_nrt_investigation-002.sql
splitStatements: false
- changeSet:
id: 60
author: liquibase
changes:
- sqlFile:
path: 007-create_nrt_investigation-003.sql
splitStatements: false
- changeSet:
id: 61
author: liquibase
Expand Down Expand Up @@ -487,13 +473,6 @@ databaseChangeLog:
- sqlFile:
path: 022-sp_nrt_case_management_postprocessing-001.sql
splitStatements: false
- changeSet:
id: 65
author: liquibase
changes:
- sqlFile:
path: 007-create_nrt_investigation-004.sql
splitStatements: false
- changeSet:
id: 66
author: liquibase
Expand Down Expand Up @@ -597,4 +576,4 @@ databaseChangeLog:
changes:
- sqlFile:
path: 024-sp_f_interview_case_postprocessing-001.sql
splitStatements: false
splitStatements: false
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ BEGIN
results.hospitalized_ind,
results.transmission_mode_cd,
results.transmission_mode,
results.outcome_cd,
results.outcome_cd,
results.die_frm_this_illness_ind,
results.day_care_ind_cd,
results.day_care_ind,
Expand Down Expand Up @@ -131,6 +131,23 @@ BEGIN
investigation_act_entity.person_as_reporter_uid,
investigation_act_entity.hospital_uid,
investigation_act_entity.ordering_facility_uid,
investigation_act_entity.ca_supervisor_of_phc_uid,
investigation_act_entity.closure_investgr_of_phc_uid,
investigation_act_entity.dispo_fld_fupinvestgr_of_phc_uid,
investigation_act_entity.fld_fup_investgr_of_phc_uid,
investigation_act_entity.fld_fup_prov_of_phc_uid,
investigation_act_entity.fld_fup_supervisor_of_phc_uid,
investigation_act_entity.init_fld_fup_investgr_of_phc_uid,
investigation_act_entity.init_fup_investgr_of_phc_uid,
investigation_act_entity.init_interviewer_of_phc_uid,
investigation_act_entity.interviewer_of_phc_uid,
investigation_act_entity.surv_investgr_of_phc_uid,
investigation_act_entity.fld_fup_facility_of_phc_uid,
investigation_act_entity.org_as_hospital_of_delivery_uid,
investigation_act_entity.per_as_provider_of_delivery_uid,
investigation_act_entity.per_as_provider_of_obgyn_uid,
investigation_act_entity.per_as_provider_of_pediatrics_uid,
investigation_act_entity.org_as_reporter_uid,
results.act_ids,
results.investigation_observation_ids,
results.person_participations,
Expand Down Expand Up @@ -772,12 +789,30 @@ BEGIN
on results.contact_inv_status_cd = cvg2.code and cvg2.code_set_nm = 'PHC_IN_STS'
LEFT OUTER JOIN nbs_odse.dbo.case_management cm WITH (NOLOCK) on results.public_health_case_uid = cm.public_health_case_uid
LEFT JOIN
(SELECT DISTINCT act_uid AS nac_page_case_uid,
MAX(last_chg_time) AS nac_last_chg_time,
MIN(add_time) AS nac_add_time,
MAX(CASE WHEN type_cd = 'PerAsReporterOfPHC' THEN entity_uid END) person_as_reporter_uid,
MAX(CASE WHEN type_cd = 'HospOfADT' THEN entity_uid END) hospital_uid,
MAX(CASE WHEN type_cd = 'OrgAsClinicOfPHC' THEN entity_uid END) ordering_facility_uid
(SELECT DISTINCT
act_uid AS nac_page_case_uid,
MAX(last_chg_time) AS nac_last_chg_time,
MIN(add_time) AS nac_add_time,
MAX(CASE WHEN type_cd = 'PerAsReporterOfPHC' THEN entity_uid END) person_as_reporter_uid,
MAX(CASE WHEN type_cd = 'HospOfADT' THEN entity_uid END) hospital_uid,
MAX(CASE WHEN type_cd = 'OrgAsClinicOfPHC' THEN entity_uid END) ordering_facility_uid,
MAX(CASE WHEN type_cd = 'CASupervisorOfPHC' THEN entity_uid END) ca_supervisor_of_phc_uid,
MAX(CASE WHEN type_cd = 'ClosureInvestgrOfPHC' THEN entity_uid END) closure_investgr_of_phc_uid,
MAX(CASE WHEN type_cd = 'DispoFldFupInvestgrOfPHC' THEN entity_uid END) dispo_fld_fupinvestgr_of_phc_uid,
MAX(CASE WHEN type_cd = 'FldFupInvestgrOfPHC' THEN entity_uid END) fld_fup_investgr_of_phc_uid,
MAX(CASE WHEN type_cd = 'FldFupProvOfPHC' THEN entity_uid END) fld_fup_prov_of_phc_uid,
MAX(CASE WHEN type_cd = 'FldFupSupervisorOfPHC' THEN entity_uid END) fld_fup_supervisor_of_phc_uid,
MAX(CASE WHEN type_cd = 'InitFldFupInvestgrOfPHC' THEN entity_uid END) init_fld_fup_investgr_of_phc_uid,
MAX(CASE WHEN type_cd = 'InitFupInvestgrOfPHC' THEN entity_uid END) init_fup_investgr_of_phc_uid,
MAX(CASE WHEN type_cd = 'InitInterviewerOfPHC' THEN entity_uid END) init_interviewer_of_phc_uid,
MAX(CASE WHEN type_cd = 'InterviewerOfPHC' THEN entity_uid END) interviewer_of_phc_uid,
MAX(CASE WHEN type_cd = 'SurvInvestgrOfPHC' THEN entity_uid END) surv_investgr_of_phc_uid,
MAX(CASE WHEN type_cd = 'FldFupFacilityOfPHC' THEN entity_uid END) fld_fup_facility_of_phc_uid,
MAX(CASE WHEN type_cd = 'OrgAsHospitalOfDelivery' THEN entity_uid END) org_as_hospital_of_delivery_uid,
MAX(CASE WHEN type_cd = 'PerAsProviderOfDelivery' THEN entity_uid END) per_as_provider_of_delivery_uid,
MAX(CASE WHEN type_cd = 'PerAsProviderOfOBGYN' THEN entity_uid END) per_as_provider_of_obgyn_uid,
MAX(CASE WHEN type_cd = 'PerAsProvideroOfPediatrics' THEN entity_uid END) per_as_provider_of_pediatrics_uid,
MAX(CASE WHEN type_cd = 'OrgAsReporterOfPHC' THEN entity_uid END) org_as_reporter_uid
FROM nbs_act_entity nac WITH (NOLOCK)
GROUP BY act_uid) AS investigation_act_entity
ON investigation_act_entity.nac_page_case_uid = results.public_health_case_uid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ CREATE TABLE dbo.nrt_investigation (
PERIOD FOR SYSTEM_TIME (refresh_datetime, max_datetime)
);


IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_investigation' and xtype = 'U')
BEGIN

--CNDE-1916
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'investigation_form_cd' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD investigation_form_cd VARCHAR(50);
Expand All @@ -127,4 +129,116 @@ IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_investigation' and xtype =
ALTER TABLE dbo.nrt_investigation ADD outbreak_name_desc VARCHAR(100);
END;

END;
--CNDE-1802
IF EXISTS(SELECT 1 FROM sys.columns WHERE name = N'notification_local_id' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation DROP COLUMN notification_local_id;
END;

IF EXISTS(SELECT 1 FROM sys.columns WHERE name = N'notification_add_time' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation DROP COLUMN notification_add_time;
END;

IF EXISTS(SELECT 1 FROM sys.columns WHERE name = N'notification_record_status_cd' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation DROP COLUMN notification_record_status_cd;
END;

IF EXISTS(SELECT 1 FROM sys.columns WHERE Name = N'notification_last_chg_time' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation DROP COLUMN notification_last_chg_time;
END;

--CNDE-1602
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'investigation_count' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD investigation_count bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'case_count' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD case_count bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'investigator_assigned_datetime' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD investigator_assigned_datetime datetime;
END;

--CNDE-1902
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'investigation_form_cd' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD investigation_form_cd VARCHAR(50);
END;

--CNDE-1913
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'ca_supervisor_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD ca_supervisor_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'closure_investgr_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD closure_investgr_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'dispo_fld_fupinvestgr_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD dispo_fld_fupinvestgr_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'fld_fup_investgr_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD fld_fup_investgr_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'fld_fup_prov_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD fld_fup_prov_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'fld_fup_supervisor_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD fld_fup_supervisor_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'init_fld_fup_investgr_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD init_fld_fup_investgr_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'init_fup_investgr_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD init_fup_investgr_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'init_interviewer_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD init_interviewer_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'interviewer_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD interviewer_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'surv_investgr_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD surv_investgr_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'fld_fup_facility_of_phc_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD fld_fup_facility_of_phc_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'org_as_hospital_of_delivery_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD org_as_hospital_of_delivery_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'per_as_provider_of_delivery_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD per_as_provider_of_delivery_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'per_as_provider_of_obgyn_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD per_as_provider_of_obgyn_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'per_as_provider_of_pediatrics_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD per_as_provider_of_pediatrics_uid bigint;
END;
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'org_as_reporter_uid' AND Object_ID = Object_ID(N'nrt_investigation'))
BEGIN
ALTER TABLE dbo.nrt_investigation ADD org_as_reporter_uid bigint;
END;
END;

This file was deleted.

This file was deleted.

This file was deleted.

Loading