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-2346 d_disease_site postprocessing #238

Merged
merged 5 commits into from
Mar 12, 2025
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

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions db/upgrade/rdb_modern/tables/039-alter_table_add_index.sql
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,10 @@ BEGIN
CREATE INDEX idx_nrt_inv_notf_notf_uid ON dbo.nrt_investigation_notification (notification_uid);
END

IF NOT EXISTS(SELECT * FROM sys.indexes WHERE name = 'idx_nrt_page_case_answer_act_uid' AND object_id = OBJECT_ID('dbo.nrt_page_case_answer'))
BEGIN
CREATE INDEX idx_nrt_page_case_answer_act_uid ON dbo.nrt_page_case_answer (act_uid);
END



Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_disease_site_group_key' and xtype = 'U')
BEGIN
CREATE TABLE dbo.nrt_disease_site_group_key (
D_DISEASE_SITE_GROUP_KEY bigint IDENTITY (2,1) NOT NULL,
TB_PAM_UID bigint NOT NULL

);

declare @max bigint;
select @max=max(D_DISEASE_SITE_GROUP_KEY)+1 from dbo.d_disease_site_group ;
select @max;
if @max IS NULL --check when max is returned as null
SET @max = 2; -- default to 2
DBCC CHECKIDENT ('dbo.nrt_disease_site_group_key', RESEED, @max);
END
16 changes: 16 additions & 0 deletions db/upgrade/rdb_modern/tables/070-create_nrt_disease_site_key.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_disease_site_key' and xtype = 'U')
BEGIN
CREATE TABLE dbo.nrt_disease_site_key (
D_DISEASE_SITE_KEY bigint IDENTITY (2,1) NOT NULL,
NBS_Case_Answer_UID bigint NOT NULL,
TB_PAM_UID bigint NOT NULL

);

declare @max bigint;
select @max=max(D_DISEASE_SITE_KEY)+1 from dbo.d_disease_site ;
select @max;
if @max IS NULL --check when max is returned as null
SET @max = 2; -- default to 2
DBCC CHECKIDENT ('dbo.nrt_disease_site_key', RESEED, @max);
END
15 changes: 15 additions & 0 deletions db/upgrade/rdb_modern/tables/075-create_d_disease_site_group.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--CNDE-2346
IF NOT EXISTS (SELECT 1
FROM sysobjects
WHERE name = 'D_DISEASE_SITE_GROUP'
and xtype = 'U')

BEGIN
CREATE TABLE DBO.D_DISEASE_SITE_GROUP (
D_DISEASE_SITE_GROUP_KEY BIGINT NOT NULL ,
PRIMARY KEY
(
D_DISEASE_SITE_GROUP_KEY
)
);
END;
23 changes: 23 additions & 0 deletions db/upgrade/rdb_modern/tables/080-create_d_disease_site.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--CNDE-2346 Foreign key constraints will be added after the completion of TB Datamart migration.*/
IF NOT EXISTS (SELECT 1
FROM sysobjects
WHERE name = 'D_DISEASE_SITE'
and xtype = 'U')

BEGIN
CREATE TABLE DBO.D_DISEASE_SITE (
TB_PAM_UID BIGINT NOT NULL ,
D_DISEASE_SITE_KEY BIGINT NOT NULL ,
SEQ_NBR INT NULL ,
D_DISEASE_SITE_GROUP_KEY BIGINT NOT NULL ,
LAST_CHG_TIME DATETIME NULL ,
VALUE VARCHAR (250) NULL ,
PRIMARY KEY
(
D_DISEASE_SITE_KEY,
TB_PAM_UID
)
);
END;


Original file line number Diff line number Diff line change
Expand Up @@ -1175,4 +1175,44 @@ databaseChangeLog:
changes:
- sqlFile:
path: 140-sp_bmird_strep_pneumo_datamart_postprocessing-001.sql
splitStatements: false
- changeSet:
id: 195
author: liquibase
runOnChange: true
changes:
- sqlFile:
path: 075-create_d_disease_site_group-001.sql
splitStatements: false
- changeSet:
id: 200
author: liquibase
runOnChange: true
changes:
- sqlFile:
path: 080-create_d_disease_site-001.sql
splitStatements: false
- changeSet:
id: 205
author: liquibase
runOnChange: true
changes:
- sqlFile:
path: 065-create_nrt_disease_site_group_key-001.sql
splitStatements: false
- changeSet:
id: 210
author: liquibase
runOnChange: true
changes:
- sqlFile:
path: 070-create_nrt_disease_site_key-001.sql
splitStatements: false
- changeSet:
id: 215
author: liquibase
runOnChange: true
changes:
- sqlFile:
path: 145-sp_nrt_d_disease_site_postprocessing-001.sql
splitStatements: false
Loading