3  Prepare Lab Data

3.1 Load Lab Data

We load the lab data using the load_lab_data function. This function now handles the loading of specific event files (“Boyama işlemi bitti”, “Vaka atandı”, “Vaka başka doktora atandı”), cleans the data, and summarizes it to find the lab_finish_time (Staining Complete) and case_assigned_time.

3.2 Data Cleaning and Summary

The load_lab_data function now handles the cleaning and summarization. It returns two datasets: 1. Case Level: Aggregated metrics per case (e.g., lab_finish_time). 2. Slide Level: Raw staining timestamps per slide/cassette.

# A tibble: 6 × 6
  erisim_numarasi staining_complete_time first_assignment_after_staining
  <chr>           <dttm>                 <dttm>                         
1 1-21            2025-04-25 17:06:09    NA                             
2 1-25            2025-01-02 15:34:52    2025-01-02 16:10:56            
3 10-24           2024-01-04 14:13:00    2024-01-04 15:39:47            
4 10-25           2025-01-02 15:34:52    2025-01-02 16:00:23            
5 1000-24         2024-01-08 15:13:46    2024-01-09 14:09:32            
6 1000-25         2025-01-09 10:15:30    2025-01-09 10:21:32            
# ℹ 3 more variables: lab_finish_time <dttm>, used_fallback <lgl>,
#   description_local <chr>

3.3 Column Definitions (Case Level)

The processed lab_summary dataframe contains the following columns:

  • erisim_numarasi: Unique Case ID (e.g., 12345-24).
  • staining_complete_time: The timestamp when the staining process was marked as complete (“Boyama işlemi bitti”).
  • first_assignment_after_staining: The timestamp of the first pathologist assignment (“Vaka atandı”) that occurred after the staining was complete.
  • lab_finish_time: The effective “Case Ready” time. This is the first_assignment_after_staining if it exists; otherwise, it falls back to staining_complete_time.
  • description_local: A static label “Lab Complete” indicating the source of this event.

3.4 Save Processed Data

We save the processed lab data in both Case Level and Slide Level formats.