A Python implementation for automated reconciliation of sleep scoring data from multiple scorers, supporting flow events, arousals, and sleep staging.
This tool automates the initial reconciliation of sleep scoring data by:
- Comparing scores from multiple technicians
- Auto-reconciling clear agreements
- Flagging discrepancies for manual review
- Generating analysis reports and visualizations
.
├── src/
│ ├── analysis/
│ │ └── event_reconciliation_analysis.py
│ ├── reconciliation/
│ │ ├── arousal.py
│ │ ├── flow.py
│ │ └── staging.py
│ └── utils/
│ ├── add_stage_numbers.py
│ ├── combine_events.py
│ └── merge_staging_events.py
├── output/
│ ├── flow_reconciliation_output/
│ ├── arousal_reconciliation_output/
│ ├── staging_annotation/
│ ├── combined/
│ └── merged/
├── pyproject.toml
├── README.md
└── .gitignore
- Flow Event Reconciliation: Automatically reconciles flow events marked by multiple scorers
- Arousal Event Reconciliation: Processes arousal events and identifies agreements/discrepancies
- Sleep Stage Reconciliation: Compares sleep staging between scorers
- Analysis Tools: Generates statistical analysis and visualizations of reconciliation results
- Demographics Integration: Analyzes reconciliation patterns across demographic groups
- Ensure you have Python 3.12+ installed
- Poetry for dependency management
- Clone the repository:
-
Prepare Data Structure
data_all/ ├── STUDY_ID/ │ ├── ES/ │ │ ├── Flow Events.txt │ │ ├── Classification Arousals.txt │ │ └── Markers.txt │ ├── LS/ │ └── MS/
-
Run Reconciliation
poetry run python src/reconciliation/flow.py poetry run python src/reconciliation/arousal.py poetry run python src/reconciliation/staging.py
-
Generate Analysis
poetry run python src/analysis/event_reconciliation_analysis.py
- Python ≥3.12
- pandas ≥2.2.3
- seaborn ≥0.13.2
- matplotlib ≥3.10.0