Hi,
I have a patient location table with patient ID, location, start date, end date and service. This data is generated by the admission and discharge system.
I have two issues that need to be solved. They are:
1) Make sure that the data is cleaned and the correct records are considered for calculating length of stay.
2) Calculate start and end dates for unit admissions based on the fact that if the patient is readmitted to the same unit within 0.5 days(12 hours) it is not a new admission (i.e. has the start date of the first admission but the end date of the readmission).
The patient location table (TblPtLocations) has the following fields and data.
PatientID Location StartDate EndDate SERVICE
1034 Location2 10/30/2009 11:44:00 PM 11/03/2009 1:22:00 AM Medicine
1034 Location2 10/31/2009 12:16:00 AM 10/30/2009 11:44:00 PM Surgery
1034 Location2 10/31/2009 12:16:00 AM 12/29/2009 5:26:00 AM Surgery
1034 Location3 11/03/2009 1:22:00 AM 11/05/2009 12:36:00 AM Medicine
1034 Location2 11/05/2009 12:36:00 AM 11/08/2009 4:41:00 PM Medicine
1034 Location1 11/08/2009 4:41:00 PM 11/08/2009 5:51:00 PM Medicine
1034 Location1 11/08/2009 5:51:00 PM 11/09/2009 7:03:00 PM Medicine
1034 Location1 12/24/2009 3:28:00 AM 11/09/2009 7:04:00 PM Medicine
1034 Location1 12/29/2009 4:41:00 AM 12/29/2009 4:42:00 AM Medicine
1034 Location2 12/29/2009 4:42:00 AM 12/29/2009 4:43:00 AM Surgery
1034 Location1 12/29/2009 5:26:00 AM 11/09/2009 7:04:00 PM Surgery
1034 Location2 12/29/2009 10:40:00 AM 12/31/2009 11:15:00 AM Surgery
The cleaned data table should be
PatientID Location StartDate EndDate SERVICE
1034 Location2 10/30/2009 11:44:00 PM 11/03/2009 1:22:00 AM Medicine
1034 Location3 11/03/2009 1:22:00 AM 11/05/2009 12:36:00 AM Medicine
1034 Location2 11/05/2009 12:36:00 AM 11/08/2009 4:41:00 PM Medicine
1034 Location1 11/08/2009 4:41:00 PM 11/08/2009 5:51:00 PM Medicine
1034 Location1 11/08/2009 5:51:00 PM 11/09/2009 7:03:00 PM Medicine
1034 Location1 12/29/2009 4:41:00 AM 12/29/2009 4:42:00 AM Medicine
1034 Location2 12/29/2009 4:42:00 AM 12/29/2009 4:43:00 AM Surgery
1034 Location2 12/29/2009 10:40:00 AM 12/31/2009 11:15:00 AM Surgery
The unit admission table should be the following
PatientID Location StartDate EndDate SERVICE
1034 Location2 10/30/2009 11:44:00 PM 11/03/2009 1:22:00 AM Medicine
1034 Location3 11/03/2009 1:22:00 AM 11/05/2009 12:36:00 AM Medicine
1034 Location2 11/05/2009 12:36:00 AM 11/08/2009 4:41:00 PM Medicine
1034 Location1 11/08/2009 4:41:00 PM 11/09/2009 7:03:00 PM Medicine
1034 Location1 12/29/2009 4:41:00 AM 12/29/2009 4:42:00 AM Medicine
1034 Location2 12/29/2009 4:42:00 AM 12/31/2009 11:15:00 AM Surgery
I am not sure of how to accomplish this. Any help would be appreciated.
Thanks!
I have a patient location table with patient ID, location, start date, end date and service. This data is generated by the admission and discharge system.
I have two issues that need to be solved. They are:
1) Make sure that the data is cleaned and the correct records are considered for calculating length of stay.
2) Calculate start and end dates for unit admissions based on the fact that if the patient is readmitted to the same unit within 0.5 days(12 hours) it is not a new admission (i.e. has the start date of the first admission but the end date of the readmission).
The patient location table (TblPtLocations) has the following fields and data.
PatientID Location StartDate EndDate SERVICE
1034 Location2 10/30/2009 11:44:00 PM 11/03/2009 1:22:00 AM Medicine
1034 Location2 10/31/2009 12:16:00 AM 10/30/2009 11:44:00 PM Surgery
1034 Location2 10/31/2009 12:16:00 AM 12/29/2009 5:26:00 AM Surgery
1034 Location3 11/03/2009 1:22:00 AM 11/05/2009 12:36:00 AM Medicine
1034 Location2 11/05/2009 12:36:00 AM 11/08/2009 4:41:00 PM Medicine
1034 Location1 11/08/2009 4:41:00 PM 11/08/2009 5:51:00 PM Medicine
1034 Location1 11/08/2009 5:51:00 PM 11/09/2009 7:03:00 PM Medicine
1034 Location1 12/24/2009 3:28:00 AM 11/09/2009 7:04:00 PM Medicine
1034 Location1 12/29/2009 4:41:00 AM 12/29/2009 4:42:00 AM Medicine
1034 Location2 12/29/2009 4:42:00 AM 12/29/2009 4:43:00 AM Surgery
1034 Location1 12/29/2009 5:26:00 AM 11/09/2009 7:04:00 PM Surgery
1034 Location2 12/29/2009 10:40:00 AM 12/31/2009 11:15:00 AM Surgery
The cleaned data table should be
PatientID Location StartDate EndDate SERVICE
1034 Location2 10/30/2009 11:44:00 PM 11/03/2009 1:22:00 AM Medicine
1034 Location3 11/03/2009 1:22:00 AM 11/05/2009 12:36:00 AM Medicine
1034 Location2 11/05/2009 12:36:00 AM 11/08/2009 4:41:00 PM Medicine
1034 Location1 11/08/2009 4:41:00 PM 11/08/2009 5:51:00 PM Medicine
1034 Location1 11/08/2009 5:51:00 PM 11/09/2009 7:03:00 PM Medicine
1034 Location1 12/29/2009 4:41:00 AM 12/29/2009 4:42:00 AM Medicine
1034 Location2 12/29/2009 4:42:00 AM 12/29/2009 4:43:00 AM Surgery
1034 Location2 12/29/2009 10:40:00 AM 12/31/2009 11:15:00 AM Surgery
The unit admission table should be the following
PatientID Location StartDate EndDate SERVICE
1034 Location2 10/30/2009 11:44:00 PM 11/03/2009 1:22:00 AM Medicine
1034 Location3 11/03/2009 1:22:00 AM 11/05/2009 12:36:00 AM Medicine
1034 Location2 11/05/2009 12:36:00 AM 11/08/2009 4:41:00 PM Medicine
1034 Location1 11/08/2009 4:41:00 PM 11/09/2009 7:03:00 PM Medicine
1034 Location1 12/29/2009 4:41:00 AM 12/29/2009 4:42:00 AM Medicine
1034 Location2 12/29/2009 4:42:00 AM 12/31/2009 11:15:00 AM Surgery
I am not sure of how to accomplish this. Any help would be appreciated.
Thanks!