Your Patient Journey Data Template
Your Patient Journey Data Template
- Recommended attributes for clinical context
- Key process milestones for tracking
- Specific extraction guidance for Epic EHR
Patient Journey Attributes
| Name | Description | ||
|---|---|---|---|
| Activity Name ActivityName | The specific clinical or administrative action performed. | ||
| Description This attribute captures the name of the event occurring within the patient journey, such as 'Patient Registered', 'Medication Administered', or 'Discharge Order Signed'. It is the central element for defining the process flow. In analysis, this field forms the nodes of the process map. It is derived from various transaction codes and order statuses within the EHR to create a human-readable event log. Why it matters It defines the steps of the process and allows for the visualization of the workflow. Where to get Derived from CLARITY_ADT, ORDER_PROC, and ORDER_MED tables. Examples Triage CompletedDiagnostic Test OrderedPatient DischargedMedication Administered | |||
| Event Timestamp EventTimestamp | The exact date and time when the activity occurred. | ||
| Description This attribute records the precise moment an event was logged in the Epic system. It is used to sequence activities and calculate all duration-based metrics, such as length of stay and cycle times. Accuracy in this field is critical for identifying bottlenecks. It supports the Triage Throughput and Time to Definitive Diagnosis dashboards by providing the temporal anchors for start and end points. Why it matters It allows for the calculation of cycle times, lead times, and process ordering. Where to get Various timestamp columns (e.g., EFFECTIVE_TIME, ORDER_TIME) depending on the source table. Examples 2023-10-15T08:30:00Z2023-10-15T09:15:22Z2023-10-16T14:20:00Z | |||
| Patient Episode PatientEpisodeId | The unique identifier for the specific patient encounter or episode of care. | ||
| Description The Patient Episode serves as the primary case identifier for process mining. It groups all clinical, administrative, and logistical events related to a single continuous period of care, such as an inpatient stay or an emergency department visit. In Epic Clarity, this typically corresponds to the Contact Serial Number (CSN) or Encounter ID. Analyzing this attribute allows for the reconstruction of the end-to-end patient journey. It enables the association of triage, diagnosis, treatment, and discharge activities into a cohesive process instance. Why it matters It is the fundamental key for linking disparate events into a single process case. Where to get Epic Clarity Table: PAT_ENC, Column: PAT_ENC_CSN_ID Examples 200459112200459113200459114200459115 | |||
| Last Data Update LastDataUpdate | The timestamp when the data was extracted or last refreshed. | ||
| Description This attribute indicates when the record was last processed by the ETL pipeline. It is distinct from the event timestamp and helps in monitoring data freshness. Analysts use this to determine if the dashboard reflects real-time reality or if there is a data latency issue affecting the accuracy of KPIs like Triage Wait Times. Why it matters It helps assess the currency and reliability of the process mining data. Where to get ETL system timestamp. Examples 2023-10-27T23:59:59Z2023-10-28T06:00:00Z | |||
| Source System SourceSystem | The system of record for the data, usually Epic EHR. | ||
| Description This attribute identifies the origin of the data. While primarily 'Epic EHR' for this view, it is useful if data is blended with other systems like a separate LIS (Lab Information System) or billing system. In analysis, it ensures data lineage and helps troubleshooting if specific events seem missing or malformed compared to the source. Why it matters It provides traceability and context for the data origin. Where to get Hardcoded or derived from connection string configuration. Examples Epic EHREpic ClarityEpic Caboodle | |||
| Department Name DepartmentName | The hospital unit or department where the activity took place. | ||
| Description This attribute identifies the functional location of the event, such as 'Emergency Department', 'Radiology', or 'General Surgery Ward'. It is crucial for the Internal Ward Transfer Analysis. Data is used to segment the process map by department, allowing managers to isolate bottlenecks specific to their unit versus systemic hospital-wide issues. Why it matters It allows for organizational filtering and handoff analysis. Where to get Epic Clarity Table: CLARITY_DEP, Column: DEPARTMENT_NAME Examples Emergency DepartmentRadiologyICUPediatrics | |||
| Discharge Disposition DischargeDisposition | The destination of the patient upon discharge (Home, SNF, Died). | ||
| Description This attribute records where the patient went after leaving the hospital. It is captured at the 'Patient Discharged' activity. This is crucial for the Readmission Risk dashboard, as patients discharged to Skilled Nursing Facilities (SNF) have different readmission profiles than those discharged home. Why it matters It contextualizes the outcome of the care process. Where to get Epic Clarity Table: PAT_ENC, Column: DISCH_DISP_C Examples HomeSkilled Nursing FacilityHome Health Care | |||
| Encounter Type EncounterType | The classification of the patient visit (e.g., Inpatient, Emergency). | ||
| Description This attribute categorizes the nature of the patient episode. Common values include 'Emergency', 'Inpatient', 'Outpatient', or 'Virtual'. Mapping to 'CaseType', this field is fundamental for filtering the analysis. For example, the Discharge Planning dashboard is primarily relevant for Inpatient encounters, while Triage is specific to Emergency. Why it matters It provides the high-level context for the process instance. Where to get Epic Clarity Table: PAT_ENC, Column: ENC_TYPE_C Examples EmergencyHospital OutpatientInpatient | |||
| Event End Time EventEndTime | The timestamp when the activity was completed. | ||
| Description While many events are instantaneous, some activities like 'Diagnostic Test Performed' or 'Consultation Completed' have a duration. This attribute captures the completion time. It enables the calculation of active processing time versus wait time. This is particularly relevant for the Diagnostic Service Cycle Times dashboard. Why it matters It enables the calculation of activity duration and resource utilization. Where to get Consult Epic EHR documentation for specific end-time columns in ORDER_PROC. Examples 2023-10-15T09:45:00Z2023-10-16T15:00:00Z | |||
| Patient MRN PatientMrn | The Medical Record Number identifying the patient. | ||
| Description The MRN is the unique identifier for the patient across the healthcare system, distinct from the episode ID. It allows for tracking a patient's history across multiple visits. This attribute is used to detect readmissions and link separate episodes for the Readmission Risk dashboard. It maps to 'Customer' in the generic model. Why it matters It is essential for identifying repeat visits and analyzing patient history. Where to get Epic Clarity Table: PATIENT, Column: PAT_ID or PAT_MRN_ID Examples MRN-882910MRN-112003MRN-554211 | |||
| Primary Diagnosis Code PrimaryDiagnosisCode | The ICD-10 or internal code representing the main diagnosis. | ||
| Description This attribute records the confirmed medical condition of the patient. It is usually populated during the 'Diagnosis Confirmed' activity. It is used to group cases by clinical condition for the Clinical Protocol Compliance View. Mapping to 'Product' allows analysts to see how the 'production' of care differs by medical condition. Why it matters It groups cases by clinical similarity for protocol analysis. Where to get Epic Clarity Table: PAT_ENC_DX, Column: DX_ID Examples J18.9I21.9E11.9 | |||
| Provider ID ProviderId | The identifier of the user or clinician who performed the activity. | ||
| Description This attribute captures the unique ID of the staff member responsible for the event, such as the nurse administering medication or the doctor signing discharge orders. It is mapped to the 'User' generic attribute to analyze resource variation and workload. Note that for automated activities, this might be a system user ID. Why it matters It enables analysis of variation in performance and workload across staff. Where to get Epic Clarity Table: CLARITY_EMP, Column: USER_ID Examples EMP10023DOC5592SYSTEM | |||
| Readmission Flag ReadmissionFlag | Indicates if the patient returned unexpectedly within 30 days. | ||
| Description This boolean attribute identifies if the specific episode was followed by another unplanned admission for the same patient within a 30-day window. It is the core of the 30-Day Unplanned Readmission Rate KPI. In analysis, this serves as a major outcome variable. Process paths leading to a 'True' flag are analyzed to find root causes in the discharge planning phase. Why it matters It identifies failed discharge processes and quality of care issues. Where to get Calculated via SQL looking ahead at future encounters for the same MRN. Examples truefalse | |||
| Triage Acuity Level TriageAcuityLevel | The severity score assigned to the patient during triage. | ||
| Description This attribute indicates the urgency of the patient's condition, typically on a scale (e.g., ESI levels 1-5). It is captured during the 'Triage Completed' activity. It allows for segmentation in the Resource Intensity by Severity Score dashboard. High acuity patients follow different process paths than low acuity patients, and this field helps distinguish those variants. Why it matters It segments the process based on urgency and expected resource consumption. Where to get Consult Epic EHR documentation for Acuity field in ED logs. Examples 1 - Resuscitation2 - Emergent3 - Urgent | |||
| Diagnostic Order Cost DiagnosticOrderCost | The internal cost associated with a diagnostic test or procedure. | ||
| Description This attribute assigns a financial value to 'Diagnostic Test Performed' activities. It allows for financial overlay on the process map. While not a primary clinical metric, it helps administration understand the financial weight of different process variants, particularly those involving high-resource severity scores. Why it matters It adds a financial dimension to process efficiency analysis. Where to get Billing or Cost Accounting tables linked to the procedure. Examples 150.001200.0045.00 | |||
| Is Automated Scheduling IsAutomatedScheduling | Flag indicating if scheduling was performed without staff intervention. | ||
| Description This boolean attribute is derived from the Scheduling Method. If the appointment was made via MyChart or an automated Cadence workflow, this is True. It directly supports the Follow-up Scheduling Automation Rate KPI. This helps operational leaders understand how much administrative burden is being offloaded to technology. Why it matters It measures process automation success. Where to get Derived from SchedulingMethod. Examples truefalse | |||
| Medication Admin Delay MedicationAdminDelay | Time difference between scheduled and actual medication administration. | ||
| Description This attribute calculates the variance between the ordered administration time and the actual scan time of the medication barcode. It is vital for the Medication Delivery Performance dashboard. Positive values indicate late administration. This metric allows nursing supervisors to identify shifts or units where workload is impacting timely care delivery. Why it matters It is a direct measure of nursing workflow adherence and patient safety. Where to get Calculated from MAR (Medication Administration Record) data. Examples 15m-5m1h 20m | |||
| Ordering Provider Specialty OrderingProviderSpecialty | The medical specialty of the doctor requesting a consult or test. | ||
| Description This attribute captures the department or specialty (e.g., 'Cardiology', 'Oncology') of the ordering provider. It is used in the Specialist Consultation Latency dashboard. It helps analyze if certain specialties face longer wait times for internal services than others, revealing potential bias or resource shortages in specific service lines. Why it matters It segments demand for diagnostic and consultation services. Where to get Consult Epic EHR documentation for provider master data. Examples CardiologyInternal MedicineOrthopedics | |||
| Protocol Adherence Status ProtocolAdherenceStatus | Status indicating if the case followed the standard clinical pathway. | ||
| Description This attribute compares the sequence of activities in the case against a defined reference model (Standard Operating Procedure). It supports the Clinical Protocol Compliance View. Values might include 'Compliant', 'Skipped Step', or 'Out of Sequence'. This allows clinical leads to rapidly filter for non-compliant cases without manually inspecting every process map. Why it matters It quickly identifies deviations from evidence-based care standards. Where to get Calculated within the process mining tool or pre-processed in SQL. Examples CompliantDeviantIncomplete | |||
| Region Name RegionName | The geographical region or hospital campus. | ||
| Description For health systems with multiple campuses, this attribute identifies the facility location. It allows for comparison of performance across different hospital sites. Mapping to 'Region' enables multi-site benchmarking to see if one hospital manages Triage Throughput better than another. Why it matters It enables benchmarking across different facilities in a health network. Where to get Derived from Department or Facility master data. Examples North CampusCity CenterWest Wing | |||
| Scheduling Method SchedulingMethod | Indicates how the follow-up appointment was booked. | ||
| Description This attribute captures the channel used to book appointments, such as 'MyChart', 'Cadence Auto', or 'Front Desk'. It is critical for the Outpatient Follow Up Automation Status dashboard. If the value indicates a system or patient-led digital channel, the 'IsAutomated' flag can be set to true. It highlights the success of digital transformation initiatives. Why it matters It tracks the adoption of automated or self-service tools. Where to get Consult Epic EHR documentation for appointment creation source. Examples MyChartCadencePhoneIn Person | |||
| Transfer Wait Duration TransferWaitDuration | Time elapsed between a transfer order and the actual transfer. | ||
| Description This metric measures the gap between 'Transfer Ordered' and 'Patient Transferred'. It is the primary data point for the Internal Ward Transfer Analysis. High values here indicate 'boarding' (patients waiting for beds), which blocks upstream flow from the Emergency Department. Why it matters It highlights logistics and capacity bottlenecks in patient flow. Where to get Calculated timestamp difference between order and transfer events. Examples 2h 30m45m12h | |||
Patient Journey Activities
| Activity | Description | ||
|---|---|---|---|
| Diagnosis Confirmed | The entry of a confirmed diagnosis into the patient's problem list or encounter diagnosis field. Represents the conclusion of the investigative phase. | ||
| Why it matters Required for the 'Time to Definitive Diagnosis' KPI. Marks the transition from assessment to targeted treatment. Where to get PAT_ENC_DX table or PROBLEM_LIST update linked to the encounter. Capture Logged when clinician adds an entry to the Encounter Diagnosis activity Event type explicit | |||
| Patient Discharged | The official closure of the inpatient encounter. Captured when the patient is virtually discharged from the census. | ||
| Why it matters The formal end of the episode for 'Length of Stay' calculations. Essential for 'Patient Flow Variant Discovery'. Where to get ADT Feed (Event A03) or PAT_ENC_HSP.DISCH_TIME. Capture Logged when administrative staff completes discharge workflow Event type explicit | |||
| Patient Registered | The initial creation of the patient encounter record in the system, marking the start of the care episode. This is explicitly captured when a patient arrives at the registration desk or emergency department and is checked into Epic. | ||
| Why it matters Establishes the anchor point for the entire Patient Journey and enables the calculation of total length of stay. Essential for the 'Triage Throughput and Wait Times' dashboard. Where to get ADT Feed (Event A04 or A01) or Clarity table PAT_ENC (HSP_ACCOUNT_ID creation). Capture Logged when transaction 'Check In' or 'Admit' is executed Event type explicit | |||
| Triage Completed | The completion of the initial nursing assessment or triage evaluation. This is typically captured when the triage flowsheet is filed or the triage status changes to 'Complete'. | ||
| Why it matters Critical for the 'Triage Throughput and Wait Times' dashboard to measure front-end efficiency. Delays here ripple through the entire care pathway. Where to get PAT_ENC_HSP.TRIAGE_END_TIME or timestamp of specific Flowsheet row filing (FLO_MEASUREMENT). Capture Logged when triage documentation is signed or status field updates Event type explicit | |||
| Care Plan Initiated | The assignment of a specific clinical pathway or protocol to the patient. This is captured when a standard Order Set or Care Plan is applied to the encounter context. | ||
| Why it matters Supports the 'Clinical Protocol Compliance View' by marking the intent to follow a standard of care. Deviations from the subsequent planned steps can be measured from this point. Where to get ORDER_SET_BKG or care plan tables indicating a protocol was linked to the encounter. Capture Logged when clinician selects and signs an Order Set Event type explicit | |||
| Consultation Completed | The completion of the specialist assessment, typically marked by the signing of a Consult Note or closing the consult order. | ||
| Why it matters End point for 'Specialist Consultation Lead Time'. Indicates that expert advice has been provided and the care plan can proceed. Where to get HNO_NOTE_TEXT (Note filed with type Consult) or ORDER_PROC status change to Completed. Capture Inferred from Consult Note creation time or Order status update Event type inferred | |||
| Consultation Requested | An order placed for a specialist to evaluate the patient. Captured as a specific procedure order type 'Consult' within Epic. | ||
| Why it matters Start point for 'Specialist Consultation Lead Time' KPI. Helps identify shortages in specific medical specialties. Where to get ORDER_PROC where ORDER_CLASS = 'Consult' or specific referral orders. Capture Logged when consult order is signed Event type explicit | |||
| Diagnostic Test Ordered | The entry of an order for imaging (Radiology) or laboratory services. Captured when a physician enters and signs an order in the CPOE system. | ||
| Why it matters The start point for the 'Diagnostic Service Cycle Times' dashboard. High volumes here without corresponding results indicate bottlenecks. Where to get ORDER_PROC table where ORDER_TYPE is Lab or Imaging/Radiology. Capture Logged when order status becomes 'Signed' or 'Active' Event type explicit | |||
| Diagnostic Test Performed | The actual execution of the diagnostic test or the filing of the result. For labs, this is when the specimen is processed; for imaging, when the scan is completed. | ||
| Why it matters End point for 'Mean Diagnostic Test Cycle Time' KPI. Vital for understanding delays in clinical decision support services. Where to get ORDER_PROC.PROC_END_TIME or ORDER_STAT_HISTORY when status changes to 'Completed' or 'Resulted'. Capture Logged when technician completes task or result interface receives data Event type explicit | |||
| Discharge Order Signed | The physician's formal authorization for the patient to leave the hospital. This is a specific order entry in Epic. | ||
| Why it matters A critical milestone in 'Discharge Planning and Execution'. The gap between this and actual departure represents administrative lag. Where to get ORDER_PROC where type is 'Discharge Patient'. Capture Logged when MD signs the discharge order Event type explicit | |||
| Discharge Planning Initiated | The commencement of activities to prepare for the patient's release. Captured via Case Management documentation or specific 'Discharge' order types. | ||
| Why it matters Key for 'Discharge Planning and Execution' dashboard. Early initiation is correlated with reduced Length of Stay. Where to get HSP_DISCH_PLAN creation or first note by Case Manager/Social Worker. Capture Inferred from first interaction with Discharge Navigator or Case Mgmt note Event type inferred | |||
| Follow-up Appointment Scheduled | The booking of a future outpatient visit for the patient. Captured in the Cadence scheduling module linked to the patient record. | ||
| Why it matters Supports 'Follow-up Scheduling Automation Rate'. Ensures continuity of care and helps prevent readmissions. Where to get PAT_ENC_APPT linked to patient ID, created near discharge time. Capture Logged when appointment slot is confirmed in Cadence Event type explicit | |||
| Medication Administered | The act of a nurse or provider administering medication to the patient. Captured in the Medication Administration Record (MAR). | ||
| Why it matters Core event for 'Medication Delivery Performance' dashboard. tracks adherence to the 'Treatment Plan Developed'. Where to get MAR_ADMIN_INFO table, specifically events with action 'Given' or 'New Bag'. Capture Logged when nurse scans patient wristband and medication (BCMA) Event type explicit | |||
| Patient Transferred | The physical movement of the patient to a new department or ward. Captured via ADT transfer events. | ||
| Why it matters End point for 'Average Inter-Ward Transfer Time'. Supports 'Internal Ward Transfer Analysis' to find bottlenecks in hospital logistics. Where to get ADT Feed (Event A02) or PAT_ENC_HSP_TRANSACTION (Transfer In). Capture Logged when unit clerk updates patient location in Census Event type explicit | |||
| Transfer Ordered | A request to move the patient to a different unit or level of care. Captured as a 'Bed Request' or 'Transfer Order' in the system. | ||
| Why it matters Start point for 'Average Inter-Ward Transfer Time'. Differentiates between the clinical decision to move and the logistical availability of a bed. Where to get ADT_TRANSFER_ORDER or ORDER_PROC (Bed Request). Capture Logged when physician enters transfer order Event type explicit | |||
Extraction Guides
Steps
- Log in to Epic Hyperspace and launch the Reporting Workbench (RWB) via the Analytics or My Reports activity.
- Create a New Report by selecting the Library tab and searching for the template "Encounter Search" or "Patient Encounters". This template allows retrieval of contact-level details identified by the CSN (Contact Serial Number).
- Configure Criteria (Settings Tab):
- Set Date Range (e.g., Discharge Date = Last 90 Days) to capture completed episodes.
- Filter by Encounter Type (e.g., 'Hospital Encounter', 'Emergency') to exclude irrelevant outpatient visits.
- Filter by Department or Facility if specific scope is required.
- Configure Display Columns (Display Tab):
- This is the critical extraction step. You must search for and add specific columns that correspond to the timestamps of the required activities.
- Add Patient Identifiers:
CSN(Patient Episode),MRN(Patient ID). - Add Demographics/Attributes:
Department,Discharge Disposition,Primary Diagnosis Code,Provider. - Add Timestamp Columns: Search for columns like
Admission Time,Triage End Time,Discharge Time,Discharge Order Time,First Med Admin Time, etc. (See the Query/Configuration section for the exact mapping).
- Run the Report and verify the results in the preview window.
- Export Data:
- Click Toolbar > Export.
- Select CSV or Text (Tab Delimited) format.
- Ensure 'Include Column Headers' is checked.
- Save the file as
Raw_Epic_Extract.csv.
- Data Transformation (Crucial):
- The RWB export produces a "Wide" dataset (one row per patient episode with multiple timestamp columns).
- You must Unpivot (reshape) this data so that each timestamp column becomes a distinct row in the event log.
- Create a final file with columns:
PatientEpisodeId,ActivityName,EventTimestamp, and mapped attributes.
- Format Dates: Ensure the
EventTimestampis in ISO format (YYYY-MM-DD HH:MM:SS) compatible with ProcessMind. - Final Validation: Check that the file has headers
PatientEpisodeId,ActivityName,EventTimestampand upload to ProcessMind.
Configuration
- Template: Use "Encounter Search" (LBF) or "Find Patients" depending on Epic version.
- Date Range: Limit to 3-6 months initially to avoid timeout errors (RWB is not optimized for massive bulk extraction).
- Row Limit: Epic RWB often has a row limit (e.g., 25,000 or 50,000 rows). Ensure your date range does not exceed this, or run multiple batches.
- Permissions: Requires Reporting Workbench 'Create' and 'Export' security points.
- Performance: Run during off-peak hours if searching large historical ranges.
- Granularity: This method provides Encounter-level summary timestamps (e.g., 'First Med Admin'). It does not extract every loop (e.g., every single pill given) unless specific "Audit" templates are used, which are rare for this use case.
a Sample Query config
[REPORT CONFIGURATION SPECIFICATION]
# GENERAL SETTINGS
Application: Epic Reporting Workbench
Template_ID: Encounter_Search_LBF
Time_Horizon: Discharge Date between [Start Date] and [End Date]
Filters: Encounter Type IN ('Hospital Encounter', 'Emergency')
# COLUMN SELECTION MAPPING
# Map the following Epic RWB Columns (Display Names) to the Output Activities.
# Note: Column names may vary slightly by Epic customized build.
[MANDATORY ATTRIBUTES]
Column: Contact Serial Number (CSN) -> Target: PatientEpisodeId
Column: Patient MRN -> Target: PatientMrn
Column: Department at Discharge -> Target: DepartmentName
Column: Discharge Disposition -> Target: DischargeDisposition
Column: Primary Diagnosis ICD-10 -> Target: PrimaryDiagnosisCode
Column: Attending Provider -> Target: ProviderId
Column: Current Date -> Target: LastDataUpdate
Column: System Name (Fixed 'Epic') -> Target: SourceSystem
[ACTIVITY TIMESTAMP MAPPING]
# These columns represent the 'EventTimestamp' for the specific 'ActivityName'
1. Activity: Patient Registered
Epic_Column: Hospital Admission Time OR Check-In Time
2. Activity: Triage Completed
Epic_Column: Triage End Time OR Triage Acuity Time
3. Activity: Care Plan Initiated
Epic_Column: Care Plan Start Date
4. Activity: Diagnostic Test Ordered
Epic_Column: First Lab Order Time OR First Imaging Order Time
(Note: Select 'Earliest' if multiple columns exist)
5. Activity: Diagnostic Test Performed
Epic_Column: First Lab Result Time OR First Imaging End Time
6. Activity: Diagnosis Confirmed
Epic_Column: Principal Diagnosis Problem List Date
7. Activity: Consultation Requested
Epic_Column: Consult Order Create Time
8. Activity: Consultation Completed
Epic_Column: Consult Complete Time
9. Activity: Medication Administered
Epic_Column: First Medication Administration Time
10. Activity: Transfer Ordered
Epic_Column: Transfer Order Time
11. Activity: Patient Transferred
Epic_Column: Last Transfer In Time OR ADT Event Time
12. Activity: Discharge Planning Initiated
Epic_Column: Case Management Start Date
13. Activity: Discharge Order Signed
Epic_Column: Discharge Order Time
14. Activity: Patient Discharged
Epic_Column: Hospital Discharge Time
15. Activity: Follow-up Appointment Scheduled
Epic_Column: Discharge Follow-Up Appointment Made Date
# TRANSFORMATION LOGIC (PSEUDO-CODE)
# The export will be 'Wide'. Apply this logic to create the Event Log:
FOR EACH Row IN Exported_CSV:
EpisodeID = Row['Contact Serial Number']
FUNCTION CreateEvent(ActivityName, TimestampColumn):
IF Row[TimestampColumn] IS NOT NULL:
OUTPUT_ROW = {
'PatientEpisodeId': EpisodeID,
'ActivityName': ActivityName,
'EventTimestamp': Row[TimestampColumn],
'PatientMrn': Row['Patient MRN'],
'DepartmentName': Row['Department at Discharge'],
... [All Attributes]
}
APPEND OUTPUT_ROW TO Event_Log
# Execute for all 15 mappings defined above
CreateEvent('Patient Registered', 'Hospital Admission Time')
CreateEvent('Triage Completed', 'Triage End Time')
... [Repeat for all mapped columns]
END LOOP Steps
Request Database Access: Ensure you have read access to the Epic Clarity Console or a SQL client connected to the Clarity production or reporting database. You will need permissions for
PAT_ENC,ORDER_PROC,CLARITY_ADT,MAR_ADMIN_INFO, and related reference tables.Identify Scope and Filter IDs: Before running the full script, execute small discovery queries to identify the specific
ORDER_TYPE_Cvalues for Labs, Radiology, Consults, and Transfers in your specific Epic instance, as these Custom Lists (Category Lists) vary by hospital.Configure the Time Window: Locate the
WHEREclauses in the provided SQL script filtering onCONTACT_DATEorHOSP_ADMSN_TIME. Adjust these to your desired extraction window (e.g., last 6 months).Map Custom Flowsheets (Optional): If you need precise timestamps for Triage or Discharge Planning that are not in the main encounter table, identify the specific
FLO_MEAS_ID(Flowsheet Measure ID) for these fields and update the script's placeholder sections.Execute the Query: Run the complete SQL script in your SQL client (e.g., SQL Server Management Studio, Oracle SQL Developer). The script uses
UNION ALLto combine different clinical events into a single standardized event log structure.Post-Processing: The query returns a flat list. Verify that
EventTimestampis not null. Convert any database specific datetime formats to ISO 8601 (YYYY-MM-DDTHH:MM:SS) if your middleware requires it.Export Data: Save the result set as a CSV file. Ensure headers match the specific attributes defined (PatientEpisodeId, ActivityName, etc.).
Upload to ProcessMind: Import the CSV into ProcessMind. Map
PatientEpisodeIdas the Case ID,ActivityNameas the Activity, andEventTimestampas the Timestamp.
Configuration
- Database Connection: Epic Clarity (typically MSSQL or Oracle back-end).
- Date Filtering: Filter on
PAT_ENC.HOSP_ADMSN_TIMEorPAT_ENC.CONTACT_DATE. Recommended range is 3-6 months for initial analysis to manage query performance. - Encounter Types: The script filters for Inpatient and Emergency encounters (
ENC_TYPE_Cvalues commonly 3 and 50, but verify againstZC_ENC_TYPE). - Order Types: requires customization of
ORDER_TYPE_Cvalues for Labs, Imaging, and Consults based on local ZC_ORDER_TYPE configuration. - Performance: The script scans high-volume tables (
ORDER_PROC,CLARITY_ADT). Ensure appropriate indexing is used or run during off-peak hours.
a Sample Query sql
WITH Cohort AS (
SELECT
pe.PAT_ENC_CSN_ID,
pe.PAT_ID,
pe.HOSP_ADMSN_TIME,
pe.HOSP_DISCH_TIME,
pe.DEPARTMENT_ID,
dep.DEPARTMENT_NAME,
emp.NAME AS ProviderName,
pat.PAT_MRN_ID,
pe.ACUITY_LEVEL_C,
disch.NAME AS DischargeDisposition,
pe.ENC_TYPE_C
FROM PAT_ENC pe
LEFT JOIN CLARITY_DEP dep ON pe.DEPARTMENT_ID = dep.DEPARTMENT_ID
LEFT JOIN CLARITY_EMP emp ON pe.VISIT_PROV_ID = emp.PROV_ID
LEFT JOIN PATIENT pat ON pe.PAT_ID = pat.PAT_ID
LEFT JOIN ZC_DISCH_DISP disch ON pe.DISCH_DISP_C = disch.DISCH_DISP_C
WHERE pe.HOSP_ADMSN_TIME >= DATEADD(month, -6, GETDATE())
AND pe.ENC_TYPE_C IN (3, 50) -- 3=Inpatient, 50=Emergency (Verify local codes)
)
-- 1. Patient Registered
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)) AS PatientEpisodeId,
'Patient Registered' AS ActivityName,
c.HOSP_ADMSN_TIME AS EventTimestamp,
c.DepartmentName,
c.ProviderName AS ProviderId,
c.PAT_MRN_ID AS PatientMrn,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)) AS TriageAcuityLevel,
CAST(c.ENC_TYPE_C AS VARCHAR(50)) AS EncounterType,
NULL AS PrimaryDiagnosisCode,
NULL AS ReadmissionFlag,
c.DischargeDisposition,
'Epic EHR' AS SourceSystem,
GETDATE() AS LastDataUpdate
FROM Cohort c
WHERE c.HOSP_ADMSN_TIME IS NOT NULL
UNION ALL
-- 2. Triage Completed (Using Flowsheet or Triage Time)
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Triage Completed',
ISNULL(pe.TRIAGE_END_INSTANT, c.HOSP_ADMSN_TIME), -- Fallback if specific column unused
c.DepartmentName,
c.ProviderName,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN PAT_ENC pe ON c.PAT_ENC_CSN_ID = pe.PAT_ENC_CSN_ID
WHERE pe.TRIAGE_END_INSTANT IS NOT NULL
UNION ALL
-- 3. Care Plan Initiated (Based on Order Type)
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Care Plan Initiated',
ord.ORDER_INST,
c.DepartmentName,
emp.NAME,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN ORDER_PROC ord ON c.PAT_ENC_CSN_ID = ord.PAT_ENC_CSN_ID
LEFT JOIN CLARITY_EMP emp ON ord.ORDERING_PROV_ID = emp.PROV_ID
WHERE ord.ORDER_TYPE_C = 100 -- Placeholder: Replace with ID for Care Plan/Protocol
UNION ALL
-- 4. Diagnostic Test Ordered (Lab/Radiology)
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Diagnostic Test Ordered',
ord.ORDER_INST,
c.DepartmentName,
emp.NAME,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN ORDER_PROC ord ON c.PAT_ENC_CSN_ID = ord.PAT_ENC_CSN_ID
LEFT JOIN CLARITY_EMP emp ON ord.ORDERING_PROV_ID = emp.PROV_ID
WHERE ord.ORDER_TYPE_C IN (1, 2) -- Placeholder: 1=Lab, 2=Radiology (Verify local codes)
UNION ALL
-- 5. Diagnostic Test Performed (Result Time or Procedure Start)
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Diagnostic Test Performed',
COALESCE(ord2.PROC_START_TIME, ord2.PROC_ENDING_TIME, ord.ORDER_INST),
c.DepartmentName,
emp.NAME,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN ORDER_PROC ord ON c.PAT_ENC_CSN_ID = ord.PAT_ENC_CSN_ID
JOIN ORDER_PROC_2 ord2 ON ord.ORDER_PROC_ID = ord2.ORDER_PROC_ID
LEFT JOIN CLARITY_EMP emp ON ord.ORDERING_PROV_ID = emp.PROV_ID
WHERE ord.ORDER_TYPE_C IN (1, 2)
AND ord2.PROC_START_TIME IS NOT NULL
UNION ALL
-- 6. Diagnosis Confirmed
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Diagnosis Confirmed',
dx.NOTED_DATE,
c.DepartmentName,
c.ProviderName,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
edg.DX_NAME,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN PAT_ENC_DX dx ON c.PAT_ENC_CSN_ID = dx.PAT_ENC_CSN_ID
JOIN CLARITY_EDG edg ON dx.DX_ID = edg.DX_ID
WHERE dx.NOTED_DATE IS NOT NULL
UNION ALL
-- 7. Consultation Requested
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Consultation Requested',
ord.ORDER_INST,
c.DepartmentName,
emp.NAME,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN ORDER_PROC ord ON c.PAT_ENC_CSN_ID = ord.PAT_ENC_CSN_ID
LEFT JOIN CLARITY_EMP emp ON ord.ORDERING_PROV_ID = emp.PROV_ID
WHERE ord.ORDER_TYPE_C = 35 -- Placeholder: Replace with ID for Consult
UNION ALL
-- 8. Consultation Completed
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Consultation Completed',
ord.ORDER_END_TIME,
c.DepartmentName,
emp.NAME,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN ORDER_PROC ord ON c.PAT_ENC_CSN_ID = ord.PAT_ENC_CSN_ID
LEFT JOIN CLARITY_EMP emp ON ord.ORDERING_PROV_ID = emp.PROV_ID
WHERE ord.ORDER_TYPE_C = 35 -- Placeholder: Replace with ID for Consult
AND ord.ORDER_STATUS_C = 5 -- Placeholder: 5=Completed
AND ord.ORDER_END_TIME IS NOT NULL
UNION ALL
-- 9. Medication Administered
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Medication Administered',
mar.TAKEN_TIME,
c.DepartmentName,
emp.NAME,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN ORDER_MED med ON c.PAT_ENC_CSN_ID = med.PAT_ENC_CSN_ID
JOIN MAR_ADMIN_INFO mar ON med.ORDER_MED_ID = mar.ORDER_MED_ID
LEFT JOIN CLARITY_EMP emp ON mar.TAKEN_USER_ID = emp.USER_ID
WHERE mar.TAKEN_TIME IS NOT NULL
AND mar.MAR_ACTION_C = 1 -- Placeholder: 1=Given
UNION ALL
-- 10. Transfer Ordered
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Transfer Ordered',
ord.ORDER_INST,
c.DepartmentName,
emp.NAME,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN ORDER_PROC ord ON c.PAT_ENC_CSN_ID = ord.PAT_ENC_CSN_ID
LEFT JOIN CLARITY_EMP emp ON ord.ORDERING_PROV_ID = emp.PROV_ID
WHERE ord.ORDER_TYPE_C = 60 -- Placeholder: Replace with ID for Transfer/Bed Request
UNION ALL
-- 11. Patient Transferred
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Patient Transferred',
adt.EFFECTIVE_TIME,
dep.DEPARTMENT_NAME,
c.ProviderName,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN CLARITY_ADT adt ON c.PAT_ENC_CSN_ID = adt.PAT_ENC_CSN_ID
LEFT JOIN CLARITY_DEP dep ON adt.DEPARTMENT_ID = dep.DEPARTMENT_ID
WHERE adt.EVENT_TYPE_C = 3 -- 3=Transfer In
UNION ALL
-- 12. Discharge Planning Initiated
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Discharge Planning Initiated',
ord.ORDER_INST,
c.DepartmentName,
emp.NAME,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN ORDER_PROC ord ON c.PAT_ENC_CSN_ID = ord.PAT_ENC_CSN_ID
LEFT JOIN CLARITY_EMP emp ON ord.ORDERING_PROV_ID = emp.PROV_ID
WHERE ord.ORDER_TYPE_C = 70 -- Placeholder: Case Management/Discharge Order Type
UNION ALL
-- 13. Discharge Order Signed
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Discharge Order Signed',
ord.ORDER_INST,
c.DepartmentName,
emp.NAME,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN ORDER_PROC ord ON c.PAT_ENC_CSN_ID = ord.PAT_ENC_CSN_ID
LEFT JOIN CLARITY_EMP emp ON ord.ORDERING_PROV_ID = emp.PROV_ID
WHERE ord.PROC_CODE = 'DISCHARGE' -- Placeholder: Filter by specific discharge procedure code
UNION ALL
-- 14. Patient Discharged
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Patient Discharged',
c.HOSP_DISCH_TIME,
c.DepartmentName,
c.ProviderName,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
WHERE c.HOSP_DISCH_TIME IS NOT NULL
UNION ALL
-- 15. Follow-up Appointment Scheduled
SELECT
CAST(c.PAT_ENC_CSN_ID AS VARCHAR(50)),
'Follow-up Appointment Scheduled',
next_pe.APPT_MADE_DATE,
c.DepartmentName,
c.ProviderName,
c.PAT_MRN_ID,
CAST(c.ACUITY_LEVEL_C AS VARCHAR(50)),
CAST(c.ENC_TYPE_C AS VARCHAR(50)),
NULL,
NULL,
c.DischargeDisposition,
'Epic EHR',
GETDATE()
FROM Cohort c
JOIN PAT_ENC next_pe ON c.PAT_ID = next_pe.PAT_ID
WHERE next_pe.APPT_MADE_DATE BETWEEN c.HOSP_ADMSN_TIME AND ISNULL(c.HOSP_DISCH_TIME, GETDATE())
AND next_pe.CONTACT_DATE > c.HOSP_ADMSN_TIME -- The appointment is for a future date relative to admission