From c22659d1bb40a3a019bc098d088a26aba9f2af82 Mon Sep 17 00:00:00 2001 From: UpasanaPattnaik Date: Tue, 3 Dec 2024 06:22:02 -0500 Subject: [PATCH 1/3] CNDE-1916: Align RTR Investigation with baseline --- .../repository/model/dto/Investigation.java | 3 + .../reporting/InvestigationReporting.java | 1 + .../service/InvestigationServiceTest.java | 6 + .../db.rdb_modern.changelog-16.1.yaml | 2 + .../routines/009-sp_observation_event-003.sql | 36 ++-- .../010-sp_investigation_event-002.sql | 180 +++++++++++------- ...p_nrt_investigation_postprocessing-003.sql | 30 +-- .../007-create_nrt_investigation-001.sql | 14 +- .../017-create_nrt_observation_date-001.sql | 10 +- ...017-create_nrt_observation_numeric-001.sql | 10 +- .../rdb_modern/views/002-v_getobsdate-001.sql | 2 +- .../rdb_modern/views/003-v_getobsnum-001.sql | 2 +- .../model/reporting/ObservationDate.java | 1 + .../model/reporting/ObservationNumeric.java | 1 + .../ObservationDataProcessTests.java | 2 + .../rawDataFiles/ObservationDate.json | 3 +- .../rawDataFiles/ObservationNumeric.json | 3 +- 17 files changed, 200 insertions(+), 106 deletions(-) diff --git a/investigation-service/src/main/java/gov/cdc/etldatapipeline/investigation/repository/model/dto/Investigation.java b/investigation-service/src/main/java/gov/cdc/etldatapipeline/investigation/repository/model/dto/Investigation.java index 9e63c846..5abf4b42 100644 --- a/investigation-service/src/main/java/gov/cdc/etldatapipeline/investigation/repository/model/dto/Investigation.java +++ b/investigation-service/src/main/java/gov/cdc/etldatapipeline/investigation/repository/model/dto/Investigation.java @@ -178,6 +178,9 @@ public class Investigation { @Column(name = "outbreak_ind_val") private String outbreakIndVal; + @Column(name = "outbreak_name_desc") + private String outbreakNameDesc; + @Column(name = "hospitalized_ind_cd") private String hospitalizedIndCd; diff --git a/investigation-service/src/main/java/gov/cdc/etldatapipeline/investigation/repository/model/reporting/InvestigationReporting.java b/investigation-service/src/main/java/gov/cdc/etldatapipeline/investigation/repository/model/reporting/InvestigationReporting.java index 063da975..f74c4fb8 100644 --- a/investigation-service/src/main/java/gov/cdc/etldatapipeline/investigation/repository/model/reporting/InvestigationReporting.java +++ b/investigation-service/src/main/java/gov/cdc/etldatapipeline/investigation/repository/model/reporting/InvestigationReporting.java @@ -59,6 +59,7 @@ public class InvestigationReporting { private Long hospitalizedDurationAmt; private String outbreakInd; private String outbreakIndVal; + private String outbreakNameDesc; private String hospitalizedIndCd; private String hospitalizedInd; private String transmissionModeCd; diff --git a/investigation-service/src/test/java/gov/cdc/etldatapipeline/investigation/service/InvestigationServiceTest.java b/investigation-service/src/test/java/gov/cdc/etldatapipeline/investigation/service/InvestigationServiceTest.java index e36fce42..86b6101f 100644 --- a/investigation-service/src/test/java/gov/cdc/etldatapipeline/investigation/service/InvestigationServiceTest.java +++ b/investigation-service/src/test/java/gov/cdc/etldatapipeline/investigation/service/InvestigationServiceTest.java @@ -253,6 +253,9 @@ private Investigation constructInvestigation(Long investigationUid) { investigation.setMmwrWeek("22"); investigation.setMmwrYear("2024"); investigation.setInvestigationFormCd("INV_FORM_MEA"); + investigation.setOutbreakInd("Yes"); + investigation.setOutbreakName("MDK"); + investigation.setOutbreakNameDesc("Ketchup - McDonalds"); investigation.setActIds(readFileData(FILE_PATH_PREFIX + "ActIds.json")); investigation.setInvestigationConfirmationMethod(readFileData(FILE_PATH_PREFIX + "ConfirmationMethod.json")); @@ -283,6 +286,9 @@ private InvestigationReporting constructInvestigationReporting(Long investigatio reporting.setMmwrWeek("22"); reporting.setMmwrYear("2024"); reporting.setInvestigationFormCd("INV_FORM_MEA"); + reporting.setOutbreakInd("Yes"); + reporting.setOutbreakName("MDK"); + reporting.setOutbreakNameDesc("Ketchup - McDonalds"); reporting.setInvestigatorId(32143250L); // PersonParticipations.json, entity_id for type_cd=InvestgrOfPHC reporting.setPhysicianId(14253651L); // PersonParticipations.json, entity_id for type_cd=PhysicianOfPHC diff --git a/liquibase-service/src/main/resources/db/changelog/db.rdb_modern.changelog-16.1.yaml b/liquibase-service/src/main/resources/db/changelog/db.rdb_modern.changelog-16.1.yaml index 0ba16ce0..79701337 100644 --- a/liquibase-service/src/main/resources/db/changelog/db.rdb_modern.changelog-16.1.yaml +++ b/liquibase-service/src/main/resources/db/changelog/db.rdb_modern.changelog-16.1.yaml @@ -315,6 +315,7 @@ databaseChangeLog: - changeSet: id: 42 author: liquibase + runOnChange: true changes: - sqlFile: path: 017-create_nrt_observation_date-001.sql @@ -336,6 +337,7 @@ databaseChangeLog: - changeSet: id: 45 author: liquibase + runOnChange: true changes: - sqlFile: path: 017-create_nrt_observation_numeric-001.sql diff --git a/liquibase-service/src/main/resources/db/odse/routines/009-sp_observation_event-003.sql b/liquibase-service/src/main/resources/db/odse/routines/009-sp_observation_event-003.sql index eb754f13..b385e4da 100644 --- a/liquibase-service/src/main/resources/db/odse/routines/009-sp_observation_event-003.sql +++ b/liquibase-service/src/main/resources/db/odse/routines/009-sp_observation_event-003.sql @@ -147,8 +147,8 @@ BEGIN o2.cd_desc_txt AS [parent_cd_desc_txt], o2.obs_domain_cd_st_1 AS [parent_domain_cd_st_1] FROM - act_relationship ar WITH (NOLOCK) - join observation o2 WITH (NOLOCK) on ar.target_act_uid = o2.observation_uid + dbo.act_relationship ar WITH (NOLOCK) + join dbo.observation o2 WITH (NOLOCK) on ar.target_act_uid = o2.observation_uid WHERE ar.source_act_uid = o.observation_uid and ar.target_class_cd = 'OBS' @@ -183,7 +183,7 @@ BEGIN person.subject_class_cd AS [role_subject_class_cd], person.scoping_class_cd AS [role_scoping_class_cd] FROM - participation p WITH (NOLOCK) + dbo.participation p WITH (NOLOCK) JOIN ( select person.[person_parent_uid], @@ -203,9 +203,9 @@ BEGIN r.scoping_class_cd from dbo.person WITH (NOLOCK) - join nbs_odse.dbo.person_name pn WITH (NOLOCK) on pn.person_uid = person.person_uid - left join entity_id e WITH (NOLOCK) ON e.entity_uid = person.person_uid - left join role r WITH (NOLOCK) on person.person_uid = r.subject_entity_uid + join dbo.person_name pn WITH (NOLOCK) on pn.person_uid = person.person_uid + left join dbo.entity_id e WITH (NOLOCK) ON e.entity_uid = person.person_uid + left join dbo.role r WITH (NOLOCK) on person.person_uid = r.subject_entity_uid left join nbs_srte.dbo.code_value_general AS cvg WITH (NOLOCK) on e.type_cd = cvg.code and cvg.code_set_nm = 'EI_TYPE' ) person on person.person_uid = p.subject_entity_uid @@ -255,8 +255,8 @@ BEGIN m.risk_cd AS [risk_cd], m.risk_desc_txt AS [risk_desc_txt] FROM - participation p WITH (NOLOCK) - JOIN material m WITH (NOLOCK) ON m.material_uid = p.subject_entity_uid + dbo.participation p WITH (NOLOCK) + JOIN dbo.material m WITH (NOLOCK) ON m.material_uid = p.subject_entity_uid WHERE p.act_uid = o.observation_uid FOR json path,INCLUDE_NULL_VALUES ) AS material_participations @@ -274,7 +274,7 @@ BEGIN type_desc_txt AS [type_desc_txt], last_chg_time AS [act_last_change_time] FROM - act_id WITH (NOLOCK) + dbo.act_id WITH (NOLOCK) WHERE act_uid = o.observation_uid FOR json path,INCLUDE_NULL_VALUES ) AS act_ids @@ -287,7 +287,7 @@ BEGIN act_uid AS [edx_act_uid], add_time AS [edx_add_time] FROM - EDX_Document WITH (NOLOCK) + dbo.EDX_Document WITH (NOLOCK) WHERE act_uid = o.observation_uid FOR json path,INCLUDE_NULL_VALUES ) AS edx_ids @@ -300,7 +300,7 @@ BEGIN obr.reason_cd, obr.reason_desc_txt FROM - Observation_reason obr WITH (NOLOCK) + dbo.observation_reason obr WITH (NOLOCK) WHERE obr.observation_uid = o.observation_uid FOR json path,INCLUDE_NULL_VALUES @@ -315,7 +315,7 @@ BEGIN ot.txt_type_cd AS [ovt_txt_type_cd], REPLACE(REPLACE(ot.value_txt, CHAR(13), ' '), CHAR(10), ' ') as [ovt_value_txt] FROM - obs_value_txt ot WITH (NOLOCK) + dbo.obs_value_txt ot WITH (NOLOCK) WHERE ot.observation_uid = o.observation_uid and ot.value_txt is not null FOR json path,INCLUDE_NULL_VALUES @@ -335,7 +335,7 @@ BEGIN ob.alt_cd_system_cd AS [ovc_alt_cd_system_cd], ob.alt_cd_system_desc_txt AS [ovc_alt_cd_system_desc_txt] FROM - obs_value_coded ob WITH (NOLOCK) + dbo.obs_value_coded ob WITH (NOLOCK) WHERE ob.observation_uid = o.observation_uid FOR json path,INCLUDE_NULL_VALUES @@ -347,9 +347,10 @@ BEGIN SELECT od.observation_uid, od.from_time AS [ovd_from_date], - od.to_time AS [ovd_to_date] + od.to_time AS [ovd_to_date], + od.obs_value_date_seq AS [ovd_seq] FROM - obs_value_date od WITH (NOLOCK) + dbo.obs_value_date od WITH (NOLOCK) WHERE od.observation_uid = o.observation_uid FOR json path,INCLUDE_NULL_VALUES @@ -366,9 +367,10 @@ BEGIN ovn.numeric_value_2 AS [ovn_numeric_value_2], ovn.numeric_unit_cd AS [ovn_numeric_unit_cd], -- asresult_units, substring(ovn.low_range,1,20) AS [ovn_low_range], -- AS ref_range_frm, - substring(ovn.high_range,1,20) AS [ovn_high_range] -- AS ref_range_to, + substring(ovn.high_range,1,20) AS [ovn_high_range], -- AS ref_range_to, + ovn.obs_value_numeric_seq AS [ovn_seq] FROM - obs_value_numeric ovn WITH (NOLOCK) + dbo.obs_value_numeric ovn WITH (NOLOCK) WHERE ovn.observation_uid = o.observation_uid FOR json path,INCLUDE_NULL_VALUES diff --git a/liquibase-service/src/main/resources/db/odse/routines/010-sp_investigation_event-002.sql b/liquibase-service/src/main/resources/db/odse/routines/010-sp_investigation_event-002.sql index c3c9331d..426d646a 100644 --- a/liquibase-service/src/main/resources/db/odse/routines/010-sp_investigation_event-002.sql +++ b/liquibase-service/src/main/resources/db/odse/routines/010-sp_investigation_event-002.sql @@ -9,23 +9,23 @@ BEGIN INSERT INTO [rdb_modern].[dbo].[job_flow_log] ( batch_id - , [Dataflow_Name] - , [package_Name] - , [Status_Type] - , [step_number] - , [step_name] - , [row_count] - , [Msg_Description1]) + , [Dataflow_Name] + , [package_Name] + , [Status_Type] + , [step_number] + , [step_name] + , [row_count] + , [Msg_Description1]) VALUES ( - @batch_id - , 'Investigation PRE-Processing Event' - , 'NBS_ODSE.sp_investigation_event' - , 'START' - , 0 - , LEFT ('Pre ID-' + @phc_id_list, 199) - , 0 - , LEFT (@phc_id_list, 199) - ); + @batch_id + , 'Investigation PRE-Processing Event' + , 'NBS_ODSE.sp_investigation_event' + , 'START' + , 0 + , LEFT ('Pre ID-' + @phc_id_list, 199) + , 0 + , LEFT (@phc_id_list, 199) + ); /*Complete Investigation section*/ SELECT results.public_health_case_uid, @@ -91,6 +91,7 @@ BEGIN results.hospitalized_duration_amt, results.outbreak_ind, results.outbreak_ind_val, + results.outbreak_name_desc, results.hospitalized_ind_cd, results.hospitalized_ind, results.transmission_mode_cd, @@ -127,8 +128,28 @@ BEGIN investigation_act_entity.nac_page_case_uid, investigation_act_entity.nac_last_chg_time, investigation_act_entity.nac_add_time, + investigation_act_entity.investigator_uid, investigation_act_entity.person_as_reporter_uid, + investigation_act_entity.patient_uid, + investigation_act_entity.physician_uid, + investigation_act_entity.ca_supervisorofphc, + investigation_act_entity.closure_investgr_of_phc, + investigation_act_entity.dispo_fld_fupinvestgr_of_phc, + investigation_act_entity.fld_fup_investgr_of_phc, + investigation_act_entity.fld_fup_prov_of_phc, + investigation_act_entity.fld_fup_supervisor_of_phc, + investigation_act_entity.init_fld_fup_investgr_of_phc, + investigation_act_entity.init_fup_investgr_of_phc, + investigation_act_entity.init_interviewer_of_phc, + investigation_act_entity.interviewer_of_phc, + investigation_act_entity.surv_investgr_of_phc, + investigation_act_entity.fld_fup_facility_of_phc, investigation_act_entity.hospital_uid, + investigation_act_entity.org_as_hospital_of_delivery, + investigation_act_entity.per_as_provider_of_delivery, + investigation_act_entity.per_as_provider_of_obgyn, + investigation_act_entity.per_as_provider_of_pediatrics, + investigation_act_entity.org_as_reporter_uid, investigation_act_entity.ordering_facility_uid, results.act_ids, results.investigation_observation_ids, @@ -220,6 +241,10 @@ BEGIN when (phc.outbreak_ind is not null or phc.outbreak_ind != '') then (select * from dbo.fn_get_value_by_cd_codeset(phc.outbreak_ind, 'INV150')) end as outbreak_ind_val, + case + when (phc.outbreak_ind is not null or phc.outbreak_ind != '') then (select * + from dbo.fn_get_value_by_cd_codeset(phc.outbreak_name, 'INV151')) + end as outbreak_name_desc, phc.hospitalized_ind_cd, case when (phc.hospitalized_ind_cd is not null or phc.hospitalized_ind_cd != '') then (select * @@ -287,7 +312,7 @@ BEGIN --,nesteddata.ldf_public_health_case FROM --public health case - public_health_case phc WITH (NOLOCK) + dbo.public_health_case phc WITH (NOLOCK) OUTER apply ( SELECT * @@ -313,13 +338,13 @@ BEGIN person.record_status_cd AS [person_record_status], person.last_chg_time AS [person_last_chg_time] FROM - participation p + dbo.participation p WITH (NOLOCK) - JOIN person WITH (NOLOCK) ON person.person_uid = ( + JOIN dbo.person WITH (NOLOCK) ON person.person_uid = ( select person.person_parent_uid from - person + dbo.person where person.person_uid = p.subject_entity_uid ) @@ -340,9 +365,9 @@ BEGIN STRING_ESCAPE(org.display_nm, 'json') AS [name], org.last_chg_time AS [org_last_change_time] FROM - participation p + dbo.participation p WITH (NOLOCK) - JOIN organization org WITH (NOLOCK) ON org.organization_uid = p.subject_entity_uid + JOIN dbo.organization org WITH (NOLOCK) ON org.organization_uid = p.subject_entity_uid WHERE p.act_uid = phc.public_health_case_uid FOR json path,INCLUDE_NULL_VALUES ) AS organization_participations @@ -372,9 +397,9 @@ BEGIN act1.source_class_cd as branch_source_class_cd, act1.type_cd as branch_type_cd FROM - act_id WITH (NOLOCK) - join act_relationship act WITH (NOLOCK) on act_id.act_uid = act.target_act_uid - left join act_relationship act1 WITH (NOLOCK) on act.source_act_uid = act1.target_act_uid + dbo.act_id WITH (NOLOCK) + join dbo.act_relationship act WITH (NOLOCK) on act_id.act_uid = act.target_act_uid + left join dbo.act_relationship act1 WITH (NOLOCK) on act.source_act_uid = act1.target_act_uid WHERE act.target_act_uid = phc.public_health_case_uid FOR json path,INCLUDE_NULL_VALUES @@ -396,7 +421,7 @@ BEGIN act_id.last_chg_user_id act_id_last_chg_user_id, act_id.last_chg_time AS [act_id_last_change_time] FROM - act_id WITH (NOLOCK) + dbo.act_id WITH (NOLOCK) WHERE act_uid = phc.public_health_case_uid FOR json path,INCLUDE_NULL_VALUES ) AS act_ids @@ -608,8 +633,8 @@ BEGIN phc.cd as 'condition_cd', phc.cd_desc_txt as 'condition_desc' FROM - act_relationship act WITH (NOLOCK) - join notification notif WITH (NOLOCK) on act.source_act_uid = notif.notification_uid + dbo.act_relationship act WITH (NOLOCK) + join dbo.notification notif WITH (NOLOCK) on act.source_act_uid = notif.notification_uid join nbs_odse.dbo.participation part with (nolock) ON part.type_cd='SubjOfPHC' AND part.act_uid=act.target_act_uid join nbs_odse.dbo.person per with (nolock) ON per.cd='PAT' AND per.person_uid = part.subject_entity_uid WHERE @@ -750,10 +775,10 @@ BEGIN ) AS ldf_public_health_case */ - ) as nestedData + ) as nestedData WHERE phc.public_health_case_uid in (SELECT value FROM STRING_SPLIT(@phc_id_list - , ','))) AS results + , ','))) AS results LEFT JOIN nbs_srte.dbo.jurisdiction_code jc WITH (NOLOCK) ON results.jurisdiction_cd = jc.code LEFT JOIN act WITH (NOLOCK) ON act.act_uid = results.public_health_case_uid LEFT JOIN nbs_srte.dbo.program_area_code pac WITH (NOLOCK) on results.prog_area_cd = pac.prog_area_cd @@ -767,12 +792,33 @@ 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 = 'InvestgrOfPHC' THEN entity_uid END) INVESTIGATOR_uid, + MAX(CASE WHEN type_cd = 'PerAsReporterOfPHC' THEN entity_uid END) PERSON_AS_REPORTER_UID, + MAX(CASE WHEN type_cd = 'SubjOfPHC' THEN entity_uid END) patient_uid, + MAX(CASE WHEN type_cd = 'PhysicianOfPHC' THEN entity_uid END) PHYSICIAN_UID, + MAX(CASE WHEN type_cd = 'CASupervisorOfPHC' THEN entity_uid END) CA_SupervisorOfPHC, + MAX(CASE WHEN type_cd = 'ClosureInvestgrOfPHC' THEN entity_uid END) Closure_Investgr_Of_PHC, + MAX(CASE WHEN type_cd = 'DispoFldFupInvestgrOfPHC' THEN entity_uid END) Dispo_Fld_FupInvestgr_Of_PHC, + MAX(CASE WHEN type_cd = 'FldFupInvestgrOfPHC' THEN entity_uid END) Fld_Fup_Investgr_Of_PHC, + MAX(CASE WHEN type_cd = 'FldFupProvOfPHC' THEN entity_uid END) Fld_Fup_Prov_Of_PHC, + MAX(CASE WHEN type_cd = 'FldFupSupervisorOfPHC' THEN entity_uid END) Fld_Fup_Supervisor_Of_PHC, + MAX(CASE WHEN type_cd = 'InitFldFupInvestgrOfPHC' THEN entity_uid END) Init_Fld_Fup_Investgr_Of_PHC, + MAX(CASE WHEN type_cd = 'InitFupInvestgrOfPHC' THEN entity_uid END) Init_Fup_Investgr_Of_PHC, + MAX(CASE WHEN type_cd = 'InitInterviewerOfPHC' THEN entity_uid END) Init_Interviewer_Of_PHC, + MAX(CASE WHEN type_cd = 'InterviewerOfPHC' THEN entity_uid END) Interviewer_Of_PHC, + MAX(CASE WHEN type_cd = 'SurvInvestgrOfPHC' THEN entity_uid END) Surv_Investgr_Of_PHC, + MAX(CASE WHEN type_cd = 'FldFupFacilityOfPHC' THEN entity_uid END) Fld_Fup_Facility_Of_PHC, + MAX(CASE WHEN type_cd = 'HospOfADT' THEN entity_uid END) HOSPITAL_UID, + MAX(CASE WHEN type_cd = 'OrgAsHospitalOfDelivery' THEN entity_uid END) Org_As_Hospital_Of_Delivery, + MAX(CASE WHEN type_cd = 'PerAsProviderOfDelivery' THEN entity_uid END) Per_As_Provider_Of_Delivery, + MAX(CASE WHEN type_cd = 'PerAsProviderOfOBGYN' THEN entity_uid END) Per_As_Provider_Of_OBGYN, + MAX(CASE WHEN type_cd = 'PerAsProvideroOfPediatrics' THEN entity_uid END) Per_As_Provider_Of_Pediatrics, + MAX(CASE WHEN type_cd = 'OrgAsReporterOfPHC' THEN entity_uid END) ORG_AS_REPORTER_UID, + MAX(CASE WHEN type_cd = 'OrgAsClinicOfPHC' THEN entity_uid END) ordering_facility_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 @@ -783,34 +829,34 @@ BEGIN INSERT INTO [rdb_modern].[dbo].[job_flow_log] ( batch_id - , [Dataflow_Name] - , [package_Name] - , [Status_Type] - , [step_number] - , [step_name] - , [row_count] - , [Msg_Description1]) + , [Dataflow_Name] + , [package_Name] + , [Status_Type] + , [step_number] + , [step_name] + , [row_count] + , [Msg_Description1]) VALUES ( - @batch_id - , 'Investigation PRE-Processing Event' - , 'NBS_ODSE.sp_investigation_event' - , 'COMPLETE' - , 0 - , LEFT ('Pre ID-' + @phc_id_list, 199) - , 0 - , LEFT (@phc_id_list, 199) - ); + @batch_id + , 'Investigation PRE-Processing Event' + , 'NBS_ODSE.sp_investigation_event' + , 'COMPLETE' + , 0 + , LEFT ('Pre ID-' + @phc_id_list, 199) + , 0 + , LEFT (@phc_id_list, 199) + ); END TRY BEGIN CATCH - IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION; + IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION; - DECLARE @ErrorMessage NVARCHAR(4000) = ERROR_MESSAGE(); - INSERT INTO [rdb_modern].[dbo].[job_flow_log] - ( batch_id + DECLARE @ErrorMessage NVARCHAR(4000) = ERROR_MESSAGE(); + INSERT INTO [rdb_modern].[dbo].[job_flow_log] + ( batch_id , [Dataflow_Name] , [package_Name] , [Status_Type] @@ -818,17 +864,17 @@ BEGIN , [step_name] , [row_count] , [Msg_Description1]) - VALUES ( - @batch_id - , 'Investigation PRE-Processing Event' - , 'NBS_ODSE.sp_investigation_event' - , 'ERROR: ' + @ErrorMessage - , 0 - , LEFT ('Pre ID-' + @phc_id_list, 199) - , 0 - , LEFT (@phc_id_list, 199) - ); - return @ErrorMessage; + VALUES ( + @batch_id + , 'Investigation PRE-Processing Event' + , 'NBS_ODSE.sp_investigation_event' + , 'ERROR: ' + @ErrorMessage + , 0 + , LEFT ('Pre ID-' + @phc_id_list, 199) + , 0 + , LEFT (@phc_id_list, 199) + ); + return @ErrorMessage; END CATCH diff --git a/liquibase-service/src/main/resources/db/rdb_modern/routines/005-sp_nrt_investigation_postprocessing-003.sql b/liquibase-service/src/main/resources/db/rdb_modern/routines/005-sp_nrt_investigation_postprocessing-003.sql index be3602d9..8dcf1cf6 100644 --- a/liquibase-service/src/main/resources/db/rdb_modern/routines/005-sp_nrt_investigation_postprocessing-003.sql +++ b/liquibase-service/src/main/resources/db/rdb_modern/routines/005-sp_nrt_investigation_postprocessing-003.sql @@ -57,7 +57,7 @@ BEGIN program_jurisdiction_oid as CASE_OID, nrt.local_id as INV_LOCAL_ID, nrt.shared_ind as INV_SHARE_IND, - nrt.outbreak_name as OUTBREAK_NAME, + NULLIF(nrt.outbreak_name,'') as OUTBREAK_NAME, nrt.investigation_status as INVESTIGATION_STATUS, nrt.inv_case_status as INV_CASE_STATUS, nrt.case_type_cd as CASE_TYPE, @@ -75,16 +75,16 @@ BEGIN nrt.mmwr_week as CASE_RPT_MMWR_WK, nrt.mmwr_year as CASE_RPT_MMWR_YR, nrt.disease_imported_ind as DISEASE_IMPORTED_IND, - nrt.imported_from_country as IMPORT_FRM_CNTRY, - nrt.imported_from_state as IMPORT_FRM_STATE, - nrt.imported_from_county as IMPORT_FRM_CNTY, - nrt.imported_city_desc_txt as IMPORT_FRM_CITY, + NULLIF(nrt.imported_from_country,'') as IMPORT_FRM_CNTRY, + NULLIF(nrt.imported_from_state,'') as IMPORT_FRM_STATE, + NULLIF(nrt.imported_from_county,'') as IMPORT_FRM_CNTY, + NULLIF(nrt.imported_city_desc_txt,'') as IMPORT_FRM_CITY, nrt.earliest_rpt_to_cdc_dt as EARLIEST_RPT_TO_CDC_DT, NULLIF(nrt.rpt_source_cd,'') as RPT_SRC_CD, - nrt.imported_country_cd as IMPORT_FRM_CNTRY_CD, - nrt.imported_state_cd as IMPORT_FRM_STATE_CD, - nrt.imported_county_cd as IMPORT_FRM_CNTY_CD, - nrt.import_frm_city_cd as IMPORT_FRM_CITY_CD, + NULLIF(nrt.imported_country_cd,'') as IMPORT_FRM_CNTRY_CD, + NULLIF(nrt.imported_state_cd,'') as IMPORT_FRM_STATE_CD, + NULLIF(nrt.imported_county_cd,'') as IMPORT_FRM_CNTY_CD, + NULLIF(nrt.import_frm_city_cd,'') as IMPORT_FRM_CITY_CD, nrt.diagnosis_time as DIAGNOSIS_DT, nrt.hospitalized_admin_time as HSPTL_ADMISSION_DT, nrt.hospitalized_discharge_time as HSPTL_DISCHARGE_DT, @@ -93,7 +93,7 @@ BEGIN nrt.hospitalized_ind as HSPTLIZD_IND, CASE WHEN nrt.inv_state_case_id = '' OR nrt.inv_state_case_id = 'null' THEN NULL ELSE nrt.inv_state_case_id END as INV_STATE_CASE_ID, - nrt.city_county_case_nbr as CITY_COUNTY_CASE_NBR, + NULLIF(nrt.city_county_case_nbr,'') as CITY_COUNTY_CASE_NBR, nrt.transmission_mode as TRANSMISSION_MODE, nrt.record_status_cd as RECORD_STATUS_CD, nrt.pregnant_ind as PATIENT_PREGNANT_IND, @@ -128,10 +128,11 @@ BEGIN nrt.curr_process_state as CURR_PROCESS_STATE, nrt.inv_priority_cd as INV_PRIORITY_CD, nrt.coinfection_id as COINFECTION_ID, - nrt.legacy_case_id as LEGACY_CASE_ID, - NULLIF(nrt.outbreak_name, '') as OUTBREAK_NAME_DESC, + NULLIF(nrt.legacy_case_id,'') as LEGACY_CASE_ID, + NULLIF(nrt.outbreak_name_desc, '') as OUTBREAK_NAME_DESC, nrt.cd, - nrt.investigation_form_cd + nrt.investigation_form_cd, + nrt.investigator_assigned_datetime as INV_ASSIGNED_DT_LEGACY into #temp_inv_table from dbo.nrt_investigation nrt left join dbo.investigation i with (nolock) on i.case_uid = nrt.public_health_case_uid @@ -330,7 +331,8 @@ BEGIN IMPORT_FRM_CITY = COALESCE(tmp.IMPORT_FRM_CITY, obs.IMPORT_FRM_CITY), HSPTL_ADMISSION_DT = COALESCE(tmp.HSPTL_ADMISSION_DT, obs.HSPTL_ADMISSION_DT), HSPTL_DISCHARGE_DT = COALESCE(tmp.HSPTL_DISCHARGE_DT, obs.HSPTL_DISCHARGE_DT), - HSPTL_DURATION_DAYS = COALESCE(tmp.HSPTL_DURATION_DAYS, obs.HSPTL_DURATION_DAYS) + HSPTL_DURATION_DAYS = COALESCE(tmp.HSPTL_DURATION_DAYS, obs.HSPTL_DURATION_DAYS), + INV_ASSIGNED_DT = COALESCE(tmp.INV_ASSIGNED_DT, tmp.INV_ASSIGNED_DT_LEGACY) FROM #temp_inv_table tmp with (nolock) LEFT JOIN #final_inv_obs obs with (nolock) on tmp.case_uid = obs.public_health_case_uid; diff --git a/liquibase-service/src/main/resources/db/rdb_modern/tables/007-create_nrt_investigation-001.sql b/liquibase-service/src/main/resources/db/rdb_modern/tables/007-create_nrt_investigation-001.sql index 99a3637a..d9145f74 100644 --- a/liquibase-service/src/main/resources/db/rdb_modern/tables/007-create_nrt_investigation-001.sql +++ b/liquibase-service/src/main/resources/db/rdb_modern/tables/007-create_nrt_investigation-001.sql @@ -115,11 +115,21 @@ CREATE TABLE dbo.nrt_investigation ( ); IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_investigation' and xtype = 'U') -BEGIN + BEGIN 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; -END; \ No newline at end of file + END; + +IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_investigation' and xtype = 'U') + BEGIN + + IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'outbreak_name_desc' AND Object_ID = Object_ID(N'nrt_investigation')) + BEGIN + ALTER TABLE dbo.nrt_investigation ADD outbreak_name_desc VARCHAR(100); + END; + + END; \ No newline at end of file diff --git a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation_date-001.sql b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation_date-001.sql index 56a9d64e..3fc2b035 100644 --- a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation_date-001.sql +++ b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation_date-001.sql @@ -6,4 +6,12 @@ CREATE TABLE rdb_modern.dbo.nrt_observation_date ( refresh_datetime datetime2(7) GENERATED ALWAYS AS ROW START NOT NULL, max_datetime datetime2(7) GENERATED ALWAYS AS ROW END HIDDEN NOT NULL, PERIOD FOR SYSTEM_TIME (refresh_datetime, max_datetime) -); \ No newline at end of file +); + +IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_observation_date' and xtype = 'U') +BEGIN + IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'ovd_seq' AND Object_ID = Object_ID(N'nrt_observation_date')) + BEGIN + ALTER TABLE dbo.nrt_observation_date ADD ovd_seq smallint(2); + END; +END; \ No newline at end of file diff --git a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation_numeric-001.sql b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation_numeric-001.sql index ce4fa0b0..4e60c7ed 100644 --- a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation_numeric-001.sql +++ b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation_numeric-001.sql @@ -11,4 +11,12 @@ CREATE TABLE rdb_modern.dbo.nrt_observation_numeric ( refresh_datetime datetime2(7) GENERATED ALWAYS AS ROW START NOT NULL, max_datetime datetime2(7) GENERATED ALWAYS AS ROW END HIDDEN NOT NULL, PERIOD FOR SYSTEM_TIME (refresh_datetime, max_datetime) -); \ No newline at end of file +); + +IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_observation_numeric' and xtype = 'U') +BEGIN + IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'ovn_seq' AND Object_ID = Object_ID(N'nrt_observation_numeric')) + BEGIN + ALTER TABLE dbo.nrt_observation_numeric ADD ovn_seq smallint(2); + END; +END; \ No newline at end of file diff --git a/liquibase-service/src/main/resources/db/rdb_modern/views/002-v_getobsdate-001.sql b/liquibase-service/src/main/resources/db/rdb_modern/views/002-v_getobsdate-001.sql index 54a30444..4722fb74 100644 --- a/liquibase-service/src/main/resources/db/rdb_modern/views/002-v_getobsdate-001.sql +++ b/liquibase-service/src/main/resources/db/rdb_modern/views/002-v_getobsdate-001.sql @@ -11,5 +11,5 @@ FROM dbo.nrt_investigation_observation tnio with (nolock) LEFT JOIN dbo.nrt_observation o with (nolock) ON o.observation_uid = tnio.branch_id LEFT JOIN dbo.nrt_observation_date ovd with (nolock) ON ovd.observation_uid = o.observation_uid -WHERE tnio.branch_type_cd = 'InvFrmQ' --AND ovd.obs_value_date_seq = 1; +WHERE tnio.branch_type_cd = 'InvFrmQ' AND ovd.ovd_seq = 1; ; \ No newline at end of file diff --git a/liquibase-service/src/main/resources/db/rdb_modern/views/003-v_getobsnum-001.sql b/liquibase-service/src/main/resources/db/rdb_modern/views/003-v_getobsnum-001.sql index 2db29c9c..b357add0 100644 --- a/liquibase-service/src/main/resources/db/rdb_modern/views/003-v_getobsnum-001.sql +++ b/liquibase-service/src/main/resources/db/rdb_modern/views/003-v_getobsnum-001.sql @@ -11,5 +11,5 @@ FROM dbo.nrt_investigation_observation tnio with (nolock) LEFT JOIN dbo.nrt_observation o with (nolock) ON o.observation_uid = tnio.branch_id LEFT JOIN dbo.nrt_observation_numeric ovn with (nolock) ON ovn.observation_uid = o.observation_uid - WHERE tnio.branch_type_cd = 'InvFrmQ' --AND ovn.obs_value_numeric_seq = 1; + WHERE tnio.branch_type_cd = 'InvFrmQ' AND ovn.ovn_seq = 1; ; \ No newline at end of file diff --git a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationDate.java b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationDate.java index 8274b064..8384e189 100644 --- a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationDate.java +++ b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationDate.java @@ -12,4 +12,5 @@ public class ObservationDate { private Long observationUid; private String ovdFromDate; private String ovdToDate; + private Integer ovdSeq; } diff --git a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationNumeric.java b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationNumeric.java index 7000cafc..5144f52d 100644 --- a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationNumeric.java +++ b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationNumeric.java @@ -21,4 +21,5 @@ public class ObservationNumeric { private String ovnNumericValue2; private String ovnNumericUnitCd; private String ovnSeparatorCd; + private Integer ovnSeq; } diff --git a/observation-service/src/test/java/gov/cdc/etldatapipeline/observation/ObservationDataProcessTests.java b/observation-service/src/test/java/gov/cdc/etldatapipeline/observation/ObservationDataProcessTests.java index 9bb775d0..9a549a1f 100644 --- a/observation-service/src/test/java/gov/cdc/etldatapipeline/observation/ObservationDataProcessTests.java +++ b/observation-service/src/test/java/gov/cdc/etldatapipeline/observation/ObservationDataProcessTests.java @@ -240,6 +240,7 @@ void testObservationDateTransformation() throws JsonProcessingException { ObservationDate obd = new ObservationDate(); obd.setObservationUid(observation.getObservationUid()); obd.setOvdFromDate("2024-08-16T00:00:00"); + obd.setOvdSeq(1); transformer.transformObservationData(observation); verify(kafkaTemplate, times(4)).send(topicCaptor.capture(), keyCaptor.capture(), messageCaptor.capture()); @@ -292,6 +293,7 @@ void testObservationNumericTransformation() throws JsonProcessingException { numeric.setOvnNumericValue2("1.0"); numeric.setOvnNumericUnitCd("mL"); numeric.setOvnSeparatorCd(":"); + numeric.setOvnSeq(1); transformer.transformObservationData(observation); verify(kafkaTemplate, times(4)).send(topicCaptor.capture(), keyCaptor.capture(), messageCaptor.capture()); diff --git a/observation-service/src/test/resources/rawDataFiles/ObservationDate.json b/observation-service/src/test/resources/rawDataFiles/ObservationDate.json index 750f9c09..059941d0 100644 --- a/observation-service/src/test/resources/rawDataFiles/ObservationDate.json +++ b/observation-service/src/test/resources/rawDataFiles/ObservationDate.json @@ -2,6 +2,7 @@ { "observation_uid": 10001234, "ovd_from_date": "2024-08-16T00:00:00", - "ovd_to_date": null + "ovd_to_date": null, + "ovd_seq": 1 } ] \ No newline at end of file diff --git a/observation-service/src/test/resources/rawDataFiles/ObservationNumeric.json b/observation-service/src/test/resources/rawDataFiles/ObservationNumeric.json index eddc62bd..6f315bd3 100644 --- a/observation-service/src/test/resources/rawDataFiles/ObservationNumeric.json +++ b/observation-service/src/test/resources/rawDataFiles/ObservationNumeric.json @@ -7,6 +7,7 @@ "ovn_numeric_value_2": 1.00000, "ovn_numeric_unit_cd": "mL", "ovn_low_range": "10-100", - "ovn_high_range": "100-1000" + "ovn_high_range": "100-1000", + "ovn_seq": "1" } ] \ No newline at end of file From 12de4fd0e5dae5f64f7dc39e1903ac99ead6152a Mon Sep 17 00:00:00 2001 From: UpasanaPattnaik Date: Tue, 3 Dec 2024 11:57:41 -0500 Subject: [PATCH 2/3] CNDE-1916: Remove updated NBS_Act_Entity logic --- .../010-sp_investigation_event-002.sql | 57 +++---------------- 1 file changed, 8 insertions(+), 49 deletions(-) diff --git a/liquibase-service/src/main/resources/db/odse/routines/010-sp_investigation_event-002.sql b/liquibase-service/src/main/resources/db/odse/routines/010-sp_investigation_event-002.sql index 426d646a..741180f7 100644 --- a/liquibase-service/src/main/resources/db/odse/routines/010-sp_investigation_event-002.sql +++ b/liquibase-service/src/main/resources/db/odse/routines/010-sp_investigation_event-002.sql @@ -128,28 +128,8 @@ BEGIN investigation_act_entity.nac_page_case_uid, investigation_act_entity.nac_last_chg_time, investigation_act_entity.nac_add_time, - investigation_act_entity.investigator_uid, investigation_act_entity.person_as_reporter_uid, - investigation_act_entity.patient_uid, - investigation_act_entity.physician_uid, - investigation_act_entity.ca_supervisorofphc, - investigation_act_entity.closure_investgr_of_phc, - investigation_act_entity.dispo_fld_fupinvestgr_of_phc, - investigation_act_entity.fld_fup_investgr_of_phc, - investigation_act_entity.fld_fup_prov_of_phc, - investigation_act_entity.fld_fup_supervisor_of_phc, - investigation_act_entity.init_fld_fup_investgr_of_phc, - investigation_act_entity.init_fup_investgr_of_phc, - investigation_act_entity.init_interviewer_of_phc, - investigation_act_entity.interviewer_of_phc, - investigation_act_entity.surv_investgr_of_phc, - investigation_act_entity.fld_fup_facility_of_phc, investigation_act_entity.hospital_uid, - investigation_act_entity.org_as_hospital_of_delivery, - investigation_act_entity.per_as_provider_of_delivery, - investigation_act_entity.per_as_provider_of_obgyn, - investigation_act_entity.per_as_provider_of_pediatrics, - investigation_act_entity.org_as_reporter_uid, investigation_act_entity.ordering_facility_uid, results.act_ids, results.investigation_observation_ids, @@ -633,8 +613,8 @@ BEGIN phc.cd as 'condition_cd', phc.cd_desc_txt as 'condition_desc' FROM - dbo.act_relationship act WITH (NOLOCK) - join dbo.notification notif WITH (NOLOCK) on act.source_act_uid = notif.notification_uid + act_relationship act WITH (NOLOCK) + join notification notif WITH (NOLOCK) on act.source_act_uid = notif.notification_uid join nbs_odse.dbo.participation part with (nolock) ON part.type_cd='SubjOfPHC' AND part.act_uid=act.target_act_uid join nbs_odse.dbo.person per with (nolock) ON per.cd='PAT' AND per.person_uid = part.subject_entity_uid WHERE @@ -792,33 +772,12 @@ 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 = 'InvestgrOfPHC' THEN entity_uid END) INVESTIGATOR_uid, - MAX(CASE WHEN type_cd = 'PerAsReporterOfPHC' THEN entity_uid END) PERSON_AS_REPORTER_UID, - MAX(CASE WHEN type_cd = 'SubjOfPHC' THEN entity_uid END) patient_uid, - MAX(CASE WHEN type_cd = 'PhysicianOfPHC' THEN entity_uid END) PHYSICIAN_UID, - MAX(CASE WHEN type_cd = 'CASupervisorOfPHC' THEN entity_uid END) CA_SupervisorOfPHC, - MAX(CASE WHEN type_cd = 'ClosureInvestgrOfPHC' THEN entity_uid END) Closure_Investgr_Of_PHC, - MAX(CASE WHEN type_cd = 'DispoFldFupInvestgrOfPHC' THEN entity_uid END) Dispo_Fld_FupInvestgr_Of_PHC, - MAX(CASE WHEN type_cd = 'FldFupInvestgrOfPHC' THEN entity_uid END) Fld_Fup_Investgr_Of_PHC, - MAX(CASE WHEN type_cd = 'FldFupProvOfPHC' THEN entity_uid END) Fld_Fup_Prov_Of_PHC, - MAX(CASE WHEN type_cd = 'FldFupSupervisorOfPHC' THEN entity_uid END) Fld_Fup_Supervisor_Of_PHC, - MAX(CASE WHEN type_cd = 'InitFldFupInvestgrOfPHC' THEN entity_uid END) Init_Fld_Fup_Investgr_Of_PHC, - MAX(CASE WHEN type_cd = 'InitFupInvestgrOfPHC' THEN entity_uid END) Init_Fup_Investgr_Of_PHC, - MAX(CASE WHEN type_cd = 'InitInterviewerOfPHC' THEN entity_uid END) Init_Interviewer_Of_PHC, - MAX(CASE WHEN type_cd = 'InterviewerOfPHC' THEN entity_uid END) Interviewer_Of_PHC, - MAX(CASE WHEN type_cd = 'SurvInvestgrOfPHC' THEN entity_uid END) Surv_Investgr_Of_PHC, - MAX(CASE WHEN type_cd = 'FldFupFacilityOfPHC' THEN entity_uid END) Fld_Fup_Facility_Of_PHC, - MAX(CASE WHEN type_cd = 'HospOfADT' THEN entity_uid END) HOSPITAL_UID, - MAX(CASE WHEN type_cd = 'OrgAsHospitalOfDelivery' THEN entity_uid END) Org_As_Hospital_Of_Delivery, - MAX(CASE WHEN type_cd = 'PerAsProviderOfDelivery' THEN entity_uid END) Per_As_Provider_Of_Delivery, - MAX(CASE WHEN type_cd = 'PerAsProviderOfOBGYN' THEN entity_uid END) Per_As_Provider_Of_OBGYN, - MAX(CASE WHEN type_cd = 'PerAsProvideroOfPediatrics' THEN entity_uid END) Per_As_Provider_Of_Pediatrics, - MAX(CASE WHEN type_cd = 'OrgAsReporterOfPHC' THEN entity_uid END) ORG_AS_REPORTER_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 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 From 14f6500254543d7246b1ce1f7c362dcec8e2d92a Mon Sep 17 00:00:00 2001 From: UpasanaPattnaik Date: Tue, 3 Dec 2024 16:37:53 -0500 Subject: [PATCH 3/3] CNDE-1916: Reducing lines of code --- .../rdb_modern/tables/007-create_nrt_investigation-001.sql | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/liquibase-service/src/main/resources/db/rdb_modern/tables/007-create_nrt_investigation-001.sql b/liquibase-service/src/main/resources/db/rdb_modern/tables/007-create_nrt_investigation-001.sql index d9145f74..a23b5dfb 100644 --- a/liquibase-service/src/main/resources/db/rdb_modern/tables/007-create_nrt_investigation-001.sql +++ b/liquibase-service/src/main/resources/db/rdb_modern/tables/007-create_nrt_investigation-001.sql @@ -122,14 +122,9 @@ IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_investigation' and xtype = ALTER TABLE dbo.nrt_investigation ADD investigation_form_cd VARCHAR(50); END; - END; - -IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_investigation' and xtype = 'U') - BEGIN - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'outbreak_name_desc' AND Object_ID = Object_ID(N'nrt_investigation')) BEGIN ALTER TABLE dbo.nrt_investigation ADD outbreak_name_desc VARCHAR(100); END; - END; \ No newline at end of file + END;