-
Notifications
You must be signed in to change notification settings - Fork 2
Temporal parameter design decisions
TreeScan analyses require several design choices that define:
- the time window examined
- the data used for baseline comparison
- how diagnoses are defined as new (incident)
These parameters strongly influence the stability and interpretability of the surveillance results.
To maintain consistency across jurisdictions, this project recommends a standardized set of parameter settings based on prior operational experience.
The maximum temporal window defines the longest time period over which TreeScan will search for clusters.
In this project, the maximum temporal window is set to 28 days.
This allows the method to detect clusters that occur over periods ranging from 1 day up to 4 weeks.
This range captures both short-term spikes and more gradual increases in diagnoses.
The study period refers to the time window in which clusters are evaluated.
In this project, the study period is set to 90 days.
A study period that is too long may introduce instability due to administrative changes in healthcare systems, such as:
- hospitals adopting new diagnosis codes
- changes in reporting practices
- structural changes in healthcare systems
Using a relatively short study period helps ensure that baseline conditions remain comparable.
The study period must be sufficiently longer than the maximum temporal window to allow reliable comparisons.
A commonly used guideline is that the study period should be at least three times longer than the maximum temporal window.
In this project:
- maximum temporal window = 28 days
- study period = 90 days
This relationship helps maintain statistical power while preserving stability in the baseline comparison.
TreeScan analyzes incident diagnoses, meaning diagnoses that are newly observed for a patient during the study period.
This helps avoid repeatedly counting chronic conditions that may appear in multiple visits.
To determine whether a diagnosis is incident, the analysis must examine whether the patient had previously received the same diagnosis.
Because incident diagnoses must be identified, the analysis requires historical data prior to the study period.
A one-year lookback period is used to determine whether a diagnosis occurred previously for the same patient.
This ensures that diagnoses counted in the study period represent new occurrences rather than ongoing chronic conditions.
The analysis therefore requires:
- 12 months of historical data for incident diagnosis classification
- 3 months of study data (90 days)
Together, this results in a total data pull of approximately 15 months of ED visit data.
A full pipeline for running TreeScan-based analyses using R and the TreeScan software.
This project provides a structured workflow to prepare data, run TreeScan, and process results using an R-based pipeline.
- Click the green Code button on GitHub
- Select Download ZIP
- Extract the ZIP file
- Locate the
treescan_projectsubfolder - Move
treescan_projectto your desired working directory
Download and install RStudio:
https://posit.co/download/rstudio-desktop/
Download TreeScan from:
https://www.treescan.org/download_treescan.html
- You must create an account before downloading
- Choose version based on your environment:
- Windows → if running locally
- Linux → if running on a server
- Select the NON-graphical version
- The standard (graphical) version may cause IT/access issues
After downloading:
Move the TreeScan files into the correct subfolder inside treescan_project:
| Environment | Folder |
|---|---|
| Windows | TS_windows/ |
| Linux | TS_linux/ |
- Launch RStudio
- In the bottom-right file explorer:
- Navigate to:
treescan_project/code/ - Open:
run_full_pipeline.R
- Navigate to:
Before running, update the following:
Update line 4 to match your local path:
setwd("~/TreeScan-implementation/treescan_project")Replace with wherever you saved treescan_project.
Modify these variables depending on your setup:
server <- FALSE # Set to TRUE if running on a server
first_time <- TRUE # Set to FALSE after first run- Run the script in RStudio
The pipeline will:
- Execute TreeScan
- Process outputs
- Complete the full analysis workflow
- Ensure the correct TreeScan version is placed in the matching folder (
TS_windowsorTS_linux) - Using the non-graphical version is required
- Incorrect working directory paths will cause errors