C2025-027-Develop-a-way-to-filter-annotations-so-the-user-can-view-only-the-types-they-want-to-see-EP #544

Open
plarsen wants to merge 11 commits from C2025-027-Develop-a-way-to-filter-annotations-so-the-user-can-view-only-the-types-they-want-to-see-EP into C2025-023
Showing only changes of commit 7f49c20364 - Show all commits

View File

@ -24029,6 +24029,187 @@ Go
--- end changes for:
---C2025-023 - Electronic Procedures - Modifications to PROMS
---C2025-027
/****** Object: Table [dbo].[AnnotationTypeSelections] Script Date: 4/25/2025 8:06:07 PM ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AnnotationTypeSelections]') AND type in (N'U'))
DROP TABLE [dbo].[AnnotationTypeSelections]
GO
/****** Object: Table [dbo].[AnnotationTypeSelections] Script Date: 4/25/2025 8:06:07 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnnotationTypeSelections](
Review

Should there be indexes on this?

a Primary Key / TypeID and ItemID combo?

Should there be indexes on this? a Primary Key / TypeID and ItemID combo?
[ASTypeID] [int] IDENTITY(1,1) NOT NULL,
[TypeID] [int] NULL,
Review

I might be missing something - but seams strange to have this setting at the item level (i.e. turning off showing Annotation types at the item level) --- wouldn't this be overall (under options) or at the MyDocVersion / Section level?

--- again, could easily be missing something but figured I would bring it up.

I might be missing something - but seams strange to have this setting at the item level (i.e. turning off showing Annotation types at the item level) --- wouldn't this be overall (under options) or at the MyDocVersion / Section level? --- again, could easily be missing something but figured I would bring it up.
[ItemID] [int] NULL,
[Name] [nvarchar](100) NOT NULL,
[Config] [nvarchar](max) NULL,
[DTS] [datetime] NOT NULL,
[UserID] [nvarchar](100) NOT NULL,
[LastChanged] [timestamp] NOT NULL,
[IsEPAnnotationType] [bit] NOT NULL
Review

Might be missing something, but not sure why this would have a Is EPAnnotationType?

Since this has a TypeID --- would assume that would get this from:

Select AnnotationTypes.IsEPAnnotationType FROM AnnotationTypes where AnnotationTypes.TypeID = AnnotationTypeSelections.TypeID

Thoughts are if it is being stored in 2 places - how do you keep them in synch / what if they are not in synch?

Again - could easily be missing the reason for this flag, but figured I would double check?

Might be missing something, but not sure why this would have a Is EPAnnotationType? Since this has a TypeID --- would assume that would get this from: Select AnnotationTypes.IsEPAnnotationType FROM AnnotationTypes where AnnotationTypes.TypeID = AnnotationTypeSelections.TypeID Thoughts are if it is being stored in 2 places - how do you keep them in synch / what if they are not in synch? Again - could easily be missing the reason for this flag, but figured I would double check?
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
---C2025-027
/****** Object: StoredProcedure [dbo].[getAnnotationstypeSelections] Script Date: 4/25/2025 8:19:30 PM ******/
DROP PROCEDURE [dbo].[getAnnotationstypeSelections]
GO
/****** Object: StoredProcedure [dbo].[getAnnotationstypeSelections] Script Date: 4/25/2025 8:19:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
Review

Should this have Author / description info in it?

Should this have Author / description info in it?
-- Create date: <Create Date,,>
-- Description: <Description,,>
CREATE PROC [dbo].[getAnnotationstypeSelections]
(
@itemID int
)
AS
BEGIN
SELECT [ASTypeID]
,[TypeID]
,[ItemID]
,[Name]
,[Config]
,[DTS]
,[UserID]
,[IsEPAnnotationType]
FROM [dbo].[AnnotationTypeSelections]
WHERE itemid = @itemid
END
GO
---C2025-027
/****** Object: StoredProcedure [dbo].[getAnnotationTypes2] Script Date: 4/25/2025 8:08:38 PM ******/
DROP PROCEDURE [dbo].[getAnnotationTypes2]
GO
/****** Object: StoredProcedure [dbo].[getAnnotationTypes2] Script Date: 4/25/2025 8:08:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Matthew Schill
Review

Should this have different author / description/etc...?

Should this have different author / description/etc...?
-- Create date: 3/21/2025
-- Description: Add EP to AnnotationTypes
-- =============================================
CREATE PROCEDURE [dbo].[getAnnotationTypes2]
Review

Should this be something like get AnnotationTypeSelections since it gets the selections not the type details?

Should this be something like get AnnotationTypeSelections since it gets the selections not the type details?
(
@itemID int
)
WITH EXECUTE AS OWNER
AS
SELECT
A.[TypeID],
A.[Name],
A.[Config],
A.[DTS],
A.[UserID],
A.[LastChanged],
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[TypeID]=A.[TypeID]) [AnnotationCount]
--[IsEPAnnotationType]
FROM [AnnotationTypes] A
JOIN AnnotationTypeSelections S ON A.TypeID = S.TypeID
WHERE S.itemid = @itemID
RETURN
GO
---C2025-027
/****** Object: StoredProcedure [dbo].[getAnnotationSelectListTypes] Script Date: 4/25/2025 8:07:15 PM ******/
DROP PROCEDURE [dbo].[getAnnotationSelectListTypes]
GO
/****** Object: StoredProcedure [dbo].[getAnnotationSelectListTypes] Script Date: 4/25/2025 8:07:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
Review

Should this have different author / description/etc...?

Should this have different author / description/etc...?
-- Author: Matthew Schill
-- Create date: 3/21/2025
-- Description: Add EP to AnnotationTypes
-- =============================================
CREATE PROCEDURE [dbo].[getAnnotationSelectListTypes]
(
@ItemID int
)
WITH EXECUTE AS OWNER
AS
SELECT
[TypeID],
[Name],
[Config],
[DTS],
[UserID],
[LastChanged],
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[TypeID]= [TypeID]) [AnnotationCount]
--[IsEPAnnotationType]
FROM [AnnotationTypes] --A
--JOIN AnnotationTypeSelections S ON S.TypeID = A.TypeID
WHERE TypeID NOT IN (SELECT TypeID FROM AnnotationTypeSelections WHERE ItemID = @ItemID) --S.ItemID = @ItemID AND S.TypeID != A.TypeID
RETURN
--SELECT * FROM AnnotationTypeSelections
GO
--C2025-027
/****** Object: StoredProcedure [dbo].[UpdateAnnotationstypeSelections] Script Date: 4/25/2025 8:48:46 PM ******/
DROP PROCEDURE [dbo].[UpdateAnnotationstypeSelections]
GO
/****** Object: StoredProcedure [dbo].[UpdateAnnotationstypeSelections] Script Date: 4/25/2025 8:48:46 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
Review

Should this have different author / description/etc...?

Should this have different author / description/etc...?
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROC [dbo].[UpdateAnnotationstypeSelections]
(
@itemID int,
@TypeID int,
@dltFlg int,
@Name [nvarchar](100) = ''
)
AS
BEGIN
if (@dltFlg = 1)
BEGIN
DELETE FROM AnnotationTypeSelections WHERE itemid = @itemid;
END
INSERT INTO AnnotationTypeSelections ([TypeID], [ItemID], [Name], [Config], [DTS], [UserID], [IsEPAnnotationType])
(SELECT @TypeID, @itemID, @Name, [Config], [DTS], [UserID], [IsEPAnnotationType] FROM AnnotationTypes WHERE [TypeID] = @TypeID)
END
GO
/*
---------------------------------------------------------------------------
| ADD New Code Before this Block |
@ -24062,8 +24243,8 @@ BEGIN TRY -- Try Block
DECLARE @RevDate varchar(255)
DECLARE @RevDescription varchar(255)
set @RevDate = '4/8/2025 11:24'
set @RevDescription = 'Added support for EP Viewer Editing'
set @RevDate = '4/25/2025 8:30 PM'
set @RevDescription = 'Filter annotations so the user can view only the types they want to see.'
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription