From c63cb7e1feeb7903119895557d2f056e45ec0de2 Mon Sep 17 00:00:00 2001 From: Terry J Hawkins Date: Tue, 14 Jun 2022 14:49:45 -0500 Subject: [PATCH] Scott's final export changes --- snprc_ehr/resources/etls/exportLookupSets.xml | 2 +- .../queries/snprc_ehr/ExportLookupSets.sql | 12 ++++++++++-- .../queries/snprc_ehr/ExportLookups.sql | 12 ++++++++++-- .../queries/snprc_ehr/ExportPkgCategories.sql | 4 ++-- .../snprc_ehr/ExportPkgCategoryJunction.sql | 15 +++++++++++++-- .../source_queries/create_CAMP_LookupSets.sql | 19 +++++++++++++++---- .../source_queries/create_CAMP_Lookups.sql | 10 ++++++---- .../create_CAMP_PkgCategories.sql | 10 ++++++++-- .../create_CAMP_PkgCategoryJunction.sql | 7 +++++-- 9 files changed, 70 insertions(+), 21 deletions(-) diff --git a/snprc_ehr/resources/etls/exportLookupSets.xml b/snprc_ehr/resources/etls/exportLookupSets.xml index 4d499ae13..ec882087b 100644 --- a/snprc_ehr/resources/etls/exportLookupSets.xml +++ b/snprc_ehr/resources/etls/exportLookupSets.xml @@ -3,7 +3,7 @@ Push Lookup Sets Data to CAMP - Copy to target + Copy SND to CAMP diff --git a/snprc_ehr/resources/queries/snprc_ehr/ExportLookupSets.sql b/snprc_ehr/resources/queries/snprc_ehr/ExportLookupSets.sql index e1acfd05c..66a71c394 100644 --- a/snprc_ehr/resources/queries/snprc_ehr/ExportLookupSets.sql +++ b/snprc_ehr/resources/queries/snprc_ehr/ExportLookupSets.sql @@ -1,11 +1,19 @@ +/************************************ +Source for TAC/SND etl back to camp + ETL: exportLookupSets.xml +srr 03.04.2021 + Added DisplayName to C/M by + Columns Label and Description are null +srr 08.20.2021 +************************************/ SELECT ls.LookupSetId, ls.SetName, ls.Label, ls.Description, ls.Container, - ls.CreatedBy, + ls.CreatedBy.DisplayName as CreatedByText, ls.Created, - ls.ModifiedBy, + ls.ModifiedByDisplayName as ModifiedByText, ls.Modified, ls.Lsid, ls.ObjectId diff --git a/snprc_ehr/resources/queries/snprc_ehr/ExportLookups.sql b/snprc_ehr/resources/queries/snprc_ehr/ExportLookups.sql index e61200b4e..bcc98a76a 100644 --- a/snprc_ehr/resources/queries/snprc_ehr/ExportLookups.sql +++ b/snprc_ehr/resources/queries/snprc_ehr/ExportLookups.sql @@ -1,11 +1,19 @@ +/************************ +NULL columns exported to CAMP +SortOrder +Lsid +Added DisplayName to CreatedBy and ModifiedBy + srr 08.19.2021 +************************/ + SELECT l.LookupSetId, l.Value, l.Displayable, l.SortOrder, l.Container, - l.CreatedBy, + l.CreatedBy.DisplayName as CreatedByText, l.Created, - l.ModifiedBy, + l.ModifiedBy.DisplayName as ModifiedByText, l.Modified, l.Lsid, l.LookupId, diff --git a/snprc_ehr/resources/queries/snprc_ehr/ExportPkgCategories.sql b/snprc_ehr/resources/queries/snprc_ehr/ExportPkgCategories.sql index 1732ec3d7..1760329a7 100644 --- a/snprc_ehr/resources/queries/snprc_ehr/ExportPkgCategories.sql +++ b/snprc_ehr/resources/queries/snprc_ehr/ExportPkgCategories.sql @@ -12,9 +12,9 @@ SELECT pc.CategoryId, pc.Active, pc.SortOrder, pc.Container, - pc.CreatedBy, + pc.CreatedBy.DisplayName as CreatedByText, pc.Created, - pc.ModifiedBy, + pc.ModifiedBy.DisplayName as ModifiedByText, pc.Modified, pc.Lsid, pc.Objectid diff --git a/snprc_ehr/resources/queries/snprc_ehr/ExportPkgCategoryJunction.sql b/snprc_ehr/resources/queries/snprc_ehr/ExportPkgCategoryJunction.sql index a07f218e6..e95c7d435 100644 --- a/snprc_ehr/resources/queries/snprc_ehr/ExportPkgCategoryJunction.sql +++ b/snprc_ehr/resources/queries/snprc_ehr/ExportPkgCategoryJunction.sql @@ -1,10 +1,21 @@ +/******************************************************** + Query will feed the export ETL back to CAMP. + +03.04.21 srr + +Changed CreatedBy and ModifiedBy to user DisplayName + Added Text to column names + .CreatedBy.DisplayName as CreatedByText, + .ModifiedBy.DisplayName as ModifiedByText, + 08.19.21 srr + ********************************************************/ SELECT pcj.PkgId, pcj.CategoryId, pcj.Container, - pcj.CreatedBy, + pcj.CreatedBy.DisplayName as CreatedByText, pcj.Created, - pcj.ModifiedBy, + pcj.ModifiedBy.DisplayName as ModifiedByText, pcj.Modified, pcj.Lsid, pcj.Objectid diff --git a/snprc_ehr/resources/source_queries/create_CAMP_LookupSets.sql b/snprc_ehr/resources/source_queries/create_CAMP_LookupSets.sql index 080979960..602fee49a 100644 --- a/snprc_ehr/resources/source_queries/create_CAMP_LookupSets.sql +++ b/snprc_ehr/resources/source_queries/create_CAMP_LookupSets.sql @@ -4,19 +4,31 @@ I think this will go to CAMP pkgAttrib lookups 02.24.2021 srr ***********************************************************/ +/****************************** +WORKING NOTE: +Note as of 08.19.2021 +Label, Description and Lsid are all null +on vogon +srr + Changed user data from INT to nvarchar(128) and appended "Text" to column name + 08.23.2021 srr + +******************************/ + +/* DEV Note: Table exists on vogon */ + -- new schema DROP TABLE IF EXISTS TAC_src.LookupSets; - CREATE TABLE [TAC_src].[LookupSets]( [LookupSetId] [int] IDENTITY(1,1) NOT NULL, [SetName] [nvarchar](128) NOT NULL, [Label] [nvarchar](128) NULL, [Description] [nvarchar](900) NULL, [Container] [uniqueidentifier] NOT NULL, - [CreatedBy] [int] NULL, + [CreatedByText] [nvarchar](128) NULL, [Created] [datetime] NULL, - [ModifiedBy] [int] NULL, + [ModifiedByText] [nvarchar](128) NULL, [Modified] [datetime] NULL, [Lsid] [nvarchar](300) NULL, [ObjectId] [uniqueidentifier] NOT NULL @@ -24,7 +36,6 @@ CREATE TABLE [TAC_src].[LookupSets]( PRIMARY KEY CLUSTERED (LookupSetId ASC) ) - -- Table permits GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE ON TAC_src.LookupSets TO z_labkey; GRANT VIEW DEFINITION ON TAC_src.LookupSets TO z_labkey; diff --git a/snprc_ehr/resources/source_queries/create_CAMP_Lookups.sql b/snprc_ehr/resources/source_queries/create_CAMP_Lookups.sql index ad929f852..0f7171883 100644 --- a/snprc_ehr/resources/source_queries/create_CAMP_Lookups.sql +++ b/snprc_ehr/resources/source_queries/create_CAMP_Lookups.sql @@ -1,8 +1,10 @@ /********************************************************** Will go to CAMP lookup_table - 02.24.2021 - srr + 02.24.2021 srr + + Changed user data from INT to nvarchar(128) and appended "Text" to column name + 08.23.2021 srr ***********************************************************/ -- new schema @@ -15,9 +17,9 @@ CREATE TABLE [TAC_src].[Lookups]( [Displayable] [bit] NOT NULL, [SortOrder] [int] NULL, [Container] [uniqueidentifier] NOT NULL, - [CreatedBy] [int] NULL, + [CreatedByText] [nvarchar](128) NULL, [Created] [datetime] NULL, - [ModifiedBy] [int] NULL, + [ModifiedByText] [nvarchar](128) NULL, [Modified] [datetime] NULL, [Lsid] [nvarchar](300) NULL, [LookupId] [int] IDENTITY(1,1) NOT NULL, diff --git a/snprc_ehr/resources/source_queries/create_CAMP_PkgCategories.sql b/snprc_ehr/resources/source_queries/create_CAMP_PkgCategories.sql index a4270e42f..93d308a15 100644 --- a/snprc_ehr/resources/source_queries/create_CAMP_PkgCategories.sql +++ b/snprc_ehr/resources/source_queries/create_CAMP_PkgCategories.sql @@ -1,3 +1,9 @@ +/******************************************************************************** + + Changed user data from INT to nvarchar(128) and appended "Text" to column name + 08.23.2021 srr + +*********************************************************************************/ -- NOTE SQL Server 2016 and after @@ -11,10 +17,10 @@ CREATE TABLE [TAC_src].[PkgCategories]( [Active] [bit] NOT NULL, [SortOrder] [int] NULL, [Container] [uniqueidentifier] NOT NULL, - [CreatedBy] [int] NULL, + [CreatedByText] [nvarchar](128) NULL, [Created] [datetime] NULL, [ModifiedBy] [int] NULL, - [Modified] [datetime] NULL, + [ModifiedText] [nvarchar](128) NULL, [Lsid] [nvarchar](300) NULL, [Objectid] [uniqueidentifier] NOT NULL CONSTRAINT PK_TAC_PkgCategories diff --git a/snprc_ehr/resources/source_queries/create_CAMP_PkgCategoryJunction.sql b/snprc_ehr/resources/source_queries/create_CAMP_PkgCategoryJunction.sql index 8805f391c..6ec42fa46 100644 --- a/snprc_ehr/resources/source_queries/create_CAMP_PkgCategoryJunction.sql +++ b/snprc_ehr/resources/source_queries/create_CAMP_PkgCategoryJunction.sql @@ -3,6 +3,9 @@ TBD 02.24.2021 srr + Changed user data from INT to nvarchar(128) and appended "Text" to column name + 08.23.2021 srr + ***********************************************************/ -- NOTE SQL Server 2016 and after DROP TABLE IF EXISTS TAC_src.PkgCategoryJunction; @@ -14,9 +17,9 @@ CREATE TABLE [TAC_src].[PkgCategoryJunction]( [PkgId] [int] NOT NULL, [CategoryId] [int] NOT NULL, [Container] [uniqueidentifier] NOT NULL, - [CreatedBy] [int] NULL, + [CreatedByText] [nvarchar](128) NULL, [Created] [datetime] NULL, - [ModifiedBy] [int] NULL, + [ModifiedByText] [nvarchar](128) NULL, [Modified] [datetime] NULL, [Lsid] [nvarchar](300) NULL, [Objectid] [uniqueidentifier] NOT NULL