-
Notifications
You must be signed in to change notification settings - Fork 2
Why diagnosis hierarchies matter
Emergency department data contain thousands of individual ICD-10 diagnosis codes.
Monitoring each diagnosis individually would be impractical for surveillance because:
- many diagnoses occur very rarely
- some diagnoses represent closely related conditions
- emerging health events may appear across multiple related diagnoses
To address this, TreeScan organizes diagnoses into a hierarchical tree structure.
In a diagnosis tree, related diagnoses are grouped into broader categories.
For example:
Respiratory disease
├── Upper respiratory infections \
│
├── Acute nasopharyngitis
│
└── Acute sinusitis \
└── Lower respiratory disease
├── Pneumonia
└── Bronchitis \
Each level of the tree represents a different level of diagnostic specificity.
TreeScan evaluates clusters at multiple levels of the diagnosis tree simultaneously.
This means the method can detect clusters involving:
- very specific diagnoses (e.g., a particular ICD-10 code)
- broader diagnostic categories (e.g., respiratory illness)
- intermediate groups of related diagnoses
By scanning across the hierarchy, TreeScan can detect signals that might otherwise be missed if only individual diagnoses were monitored.
Emerging health events often affect groups of related diagnoses rather than a single diagnosis code.
For example:
- a respiratory outbreak may appear across multiple respiratory diagnoses
- gastrointestinal illness may appear across several related ICD-10 codes
- environmental exposures may generate symptoms coded in multiple ways
The hierarchical tree allows TreeScan to detect these broader patterns.
The diagnosis tree allows TreeScan to search across:
- specific nodes, which capture narrow diagnostic categories
- broader nodes, which capture related conditions
This balance helps the method detect both:
- small, specific clusters
- broader increases across related diagnoses
Because the diagnosis hierarchy determines how diagnoses are grouped, the structure of the tree influences the types of signals that can be detected.
For this project, the diagnosis tree is based on standard ICD-10 groupings used in syndromic surveillance systems.
Maintaining a consistent tree structure across jurisdictions helps ensure that signals detected in different locations are comparable.
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