Skip to content
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 @@ -35,6 +35,7 @@ AS
-- 05/13/19 Added a REPLACE to numeric/decimal CAST
-- Purpose is to handle numeric data with commas (',') ~line 59 srr
-- 04/23/2024 Lookup values need to be string values by default. tjh
-- 6/26/2025 Added check for eventId in labkey Events table. tjh
-- ==========================================================================================
SELECT TOP (99.999999999) PERCENT
cp.ANIMAL_EVENT_ID AS EventId,
Expand Down Expand Up @@ -71,6 +72,8 @@ INNER JOIN dbo.PKG_ATTRIBS AS pa ON pa.PKG_ID = p.PKG_ID AND pa.ATTRIB_KEY = cpa
-- select primates only from the TxBiomed colony
INNER JOIN labkey_etl.V_DEMOGRAPHICS AS D ON D.id = ae.ANIMAL_ID
WHERE LTRIM(RTRIM(cpa.VALUE)) <> '' AND cpa.VALUE IS NOT NULL
-- limit selection to only events that have been imported
AND EXISTS (SELECT 1 FROM labkey.snd.Events AS e WHERE cp.ANIMAL_EVENT_ID = e.EventId)

ORDER BY EventDataId
GO
Expand Down
6 changes: 4 additions & 2 deletions snprc_ehr/resources/source_queries/create_v_snd_eventData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AS
-- Create date: 2/23/2018
-- Description: View provides the datasource for event data with attribute/values
-- Changes: 4/12/2018 Added permissions
--
-- 6/26/2025 Added check for eventId in labkey Events table. tjh
-- ==========================================================================================

SELECT
Expand All @@ -42,7 +42,9 @@ AS
LEFT OUTER JOIN dbo.TAC_COLUMNS AS tc ON tc.object_id = cp.OBJECT_ID

-- select primates only from the TxBiomed colony
INNER JOIN labkey_etl.V_DEMOGRAPHICS AS d ON d.id = ae.ANIMAL_ID;
INNER JOIN labkey_etl.V_DEMOGRAPHICS AS d ON d.id = ae.ANIMAL_ID
-- limit selection to only events that have been imported
WHERE EXISTS (SELECT 1 FROM labkey.snd.Events AS e WHERE cp.ANIMAL_EVENT_ID = e.EventId)

GO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ALTER VIEW [labkey_etl].[v_snd_eventNotes] AS
-- Create date: 3/23/2018
-- Description: View provides the datasource for event notes
-- Changes: 3/28/2018 - Joined with v_demographics to limit the result set to the animal data being exported to LK. tjh
--
-- 6/26/2025 Added check for eventId in labkey Events table. tjh
-- ==========================================================================================

SELECT
Expand All @@ -38,6 +38,8 @@ LEFT OUTER JOIN dbo.TAC_COLUMNS AS tc ON tc.object_id = pn.object_id
INNER JOIN dbo.animal_events AS ae ON ae.ANIMAL_EVENT_ID = pn.ANIMAL_EVENT_ID
-- select primates only from the TxBiomed colony
INNER JOIN Labkey_etl.V_DEMOGRAPHICS AS d ON d.id = ae.animal_id
-- limit selection to only events that have been imported
WHERE EXISTS (SELECT 1 FROM labkey.snd.Events AS e WHERE pn.ANIMAL_EVENT_ID = e.EventId)

GO

Expand Down