A view has been created and adjustments to Linking rules made to provide more Precise linkage between EDIS?REDIT/EMG2 data and The Inpatient System. The Order in this last paragraph is important. We are looking at Emergency Episodes and the Inpatient Episodes that arise from them.
Views currently in use link to preceding IP episodes as well.. but we want to link only to AFTER.. and then the first After at that.. within tight confines.
We wants one row per ED episode.. and if there is an inpatient link, we wanna what where why and when about that too please..
and.. because this is Kansas, Dorothy
Please note that this report using triage and URG_Disposal can be used to identify data for MACONES reporting <watch this space> but that is not it's intention.. Talons SQL currently does not have the data elements to sort the various columns in the MAC, the rows match Triage and disposal.. That is because we do not have that data in the EDIS extract.
From EDIS and The URG Grouper (Currently in URG/UDG grouper version 1.2)
From Admissions System
Some Niceties..
The linking changes
These rules are now applied only for ED/ADM linking - THEY MAY BE A LITTLE DIFFERENT
Episode_Type |
Priority_Order |
Check_times_flag |
Requesting_Feeder |
Neg_offset |
Pos_offset |
Include_Cancelled_flag |
Note |
I |
2 |
1 |
EMERG |
-1 |
0 |
0 |
EMERG IP / ATTENDANCE LINK - 2 |
I |
1 |
1 |
EMERG |
0 |
0 |
0 |
EMERG IP / ATTENDANCE LINK - 1 |
They are carefully designed to identify in order, episodes that overlap an admission, and those within 24 hours of Disposal from ED
The view has two names <tla>_EDIS_ADM_interlink and the other is <tla>EDISEF_Episode_details
Note the use of the dynamic episode linking function ( dbo.fnEPID2(epm.Disch_date, epm.UR, 'EMERG', epm.Campus_TLA,'None') )makes it slower to use than before..
CREATE VIEW [dbo].[<tla>_EDIS_ADM_interlink]
AS
-- ********************* ver 0.9.903.9081 ********************
select distinct
epm.Company_TLA
, epm.Campus_TLA
, epm.episode as ED_episode
, epm.ur as ur
, dbo.fnEPID2(epm.Disch_date, epm.UR, 'EMERG', epm.Campus_TLA,'None') AS IP_episode
, ipepm.Admit_date as IP_Admit_Datetime
, ipepm.Disch_date as IP_Disch_Datetime
, edis.Arrival_Date as arrive_ED_datetime
, edis.Discharge_Date as left_ED_datetime
, edis.Triage_Code
, edis.ICD_Code as ED_Diagnosis
, det.Admit_Source_code
, det.Admit_Complaint_text
, det.Admit_Type_code
, det.Disch_code AS IP_Disch_Code
, drgs.DRG_code as IP_DRG
, urgs.URG_DISPOSAL as URG_Disposal
, urgs.DISCHARGETYPE_CODE As ED_Disch_Code
, urgs.URG_MDB
, urgs.URG
from tblEpisodeMaster epm inner join tblEdisEFData edis on
edis.Episode = epm.EPISODE and
edis.Campus_TLA = epm.CAMPUS_TLA
left outer join view_URG_Data urgs on
epm.Episode = urgs.EPISODE and
epm.Campus_TLA = urgs.Campus_TLA
left outer join tblEpisodeMaster ipepm on
dbo.fnEPID2(epm.Disch_date, epm.UR, 'EMERG', epm.Campus_TLA,'None') = ipepm.EPISODE and
epm.Campus_TLA = ipepm.CAMPUS_TLA and
isnull(ipepm.Episode_Type,'I') = 'I'
left outer join tblADMDetails det on
ipepm.Episode = det.EPISODE and
ipepm.Campus_TLA = det.CAMPUS_TLA
left outer join tblADMDrgs drgs on
ipepm.Campus_TLA = drgs.Campus_TLA and
ipepm.Episode = drgs.Episode
where epm.Episode_Type = 'E' and epm.Company_TLA = '<TLA>'