Model Restricted Access

Complete AI Sleep Report (CAISR) v1.0

Samaneh Nasiri Wolfgang Ganglberger Thijs Nassi Erik-Jan Meulenbrugge Haoqi Sun Robert Thomas M Brandon Westover

Published: May 19, 2025. Version: 1.0


When using this resource, please cite: (show more options)
Nasiri, S., Ganglberger, W., Nassi, T., Meulenbrugge, E., Sun, H., Thomas, R., & Westover, M. B. (2025). Complete AI Sleep Report (CAISR) v1.0 (version 1.0). Brain Data Science Platform. https://doi.org/10.60508/3cvj-n791.

Abstract

CAISR (v1.0) performs automated scoring of polysomnography (PSG) recordings. This guide will show you how to set up and run CAISR using Docker containers. The github repo is here: https://github.com/bdsp-core/CAISR-App

 


Background

CAISR 1.0 (Complete Artificial Intelligence Sleep Report) is a comprehensive automated system for sleep analysis developed to address the limitations of manual sleep scoring. Traditional manual scoring of polysomnography (PSG) recordings is time-consuming, labor-intensive, and prone to inter- and intra-rater variability, creating bottlenecks in sleep diagnostics and inconsistencies in patient care. CAISR aims to standardize sleep analysis by providing accurate and consistent automated scoring for sleep staging, arousal detection, apnea identification, and limb movement analysis. CAISR matches or exceeds expert-level reliability and accuracy across all these tasks.


Model Description

The code is here. CAISR is a comprehensive automated sleep analysis system that performs four main tasks: sleep staging, arousal detection, respiratory event detection and classification, and limb movement analysis. The sleep staging component classifies each 30-second epoch into five categories (Wake, NREM 1, NREM 2, NREM 3, REM). The arousal detection model identifies the onset and offset times of arousals. The respiratory event detection model identifies and classifies five types of breathing disturbances (obstructive apnea, central apnea, mixed apnea, hypopnea, and RERA). The limb movement model detects and categorizes movements as periodic or isolated. CAISR was trained and validated using diverse datasets including the MGH, SHHS, MESA, and MrOS cohorts, totaling over 25,000 PSG recordings. The system is designed to work with standard PSG signals including EEG, EOG, EMG, respiratory effort belts, nasal pressure, thermistor, oxygen saturation, and leg EMG. CAISR's performance was evaluated using metrics such as Cohen's Kappa, AUROC, AUPRC, and intraclass correlation coefficients, demonstrating performance that matches or exceeds human expert levels across tasks.


Technical Implementation

CAISR was developed using a combination of deep learning and rule-based approaches. The system was trained on a large dataset of >25K PSG recordings from four cohorts (MGH, MESA, MrOS, SHHS). For sleep staging and arousal detection, customized deep neural networks were employed. The sleep staging model, ProductGraphSleepNet, was selected after evaluating several candidate architectures. For arousal detection, a novel model called ArousalNet (A-Net) was developed, inspired by U-Sleep but with expanded input channels. Breathing event detection and limb movement analysis were accomplished using rule-based signal processing approaches. The respiratory event detection model's hyperparameters were fine-tuned using random grid search, while the limb movement detection model (CAISR-PLM) incorporated a Variable Amplitude Thresholding (VAT) algorithm to address signal quality issues. The development process included rigorous testing against multiple independently annotated datasets and comparison with human expert performance.


Installation and Requirements

To set up the software environment for using CAISR, follow these steps:

1. Install Docker on your machine. You can download it from https://www.docker.com/products/docker-desktop.

2. Ensure you have Python 3.7 or later installed.

3. Install the required Python libraries by running:
   pip install docker

4. Organize your project directory as follows:
   - Create a "dockers" folder containing all the Docker image tar.gz files (caisr_preprocess.tar.gz, caisr_stage.tar.gz, caisr_arousal.tar.gz, caisr_resp.tar.gz, caisr_limb.tar.gz, caisr_report.tar.gz)
   - Create a "data" folder for input files to be processed
   - Create a "caisr_output" folder for storing results
   - Place the main script (caisr.py) in the project root directory


your_project_directory/

├── dockers/                 # Contains all the Docker image tar.gz files
│   ├── caisr_preprocess.tar.gz
│   ├── caisr_stage.tar.gz
│   ├── caisr_arousal.tar.gz
│   ├── caisr_resp.tar.gz
│   ├── caisr_limb.tar.gz
│   └── caisr_report.tar.gz

├── data/                    # Input data folder that will be processed
│   ├── file1.edf
│   ├── file2.edf
│   └── ... (other files)

├── caisr_output/            # Output folder where results will be stored
│   ├── stage/
│   ├── arousal/
│   ├── resp/
│   ├── limb/
│   └── report/

└── caisr.py                  # The main script provided in this readme
 

 

 

5. Ensure your input data files (e.g., .edf files) are in the "data" folder.

6. Modify the "tasks" list in caisr.py to include the desired tasks (preprocess, stage, arousal, resp, limb, report).

 


Usage Notes

To use the CAISR software:

1. Run the main script using Python:
   python caisr.py

2. The script will automatically:
   - List available Docker images
   - Match Docker images to specified tasks
   - Load missing Docker images from the "dockers" folder
   - Run tasks inside Docker containers
   - Store results in the "caisr_output" folder

Example function calls:

- To run all tasks:
  tasks = ['preprocess', 'stage', 'arousal', 'resp', 'limb', 'report']

- To skip preprocessing:
  tasks = ['stage', 'arousal', 'resp', 'limb', 'report']

- To run only sleep staging and arousal detection:
  tasks = ['stage', 'arousal']

Notes:
- Preprocessing is optional if data is already preprocessed.
- Results for each task are stored in separate subfolders within "caisr_output".
- The script includes basic error handling for missing Docker images.
- You can customize the order and selection of tasks by modifying the "tasks" list.

For troubleshooting:
- Ensure Docker is installed and running (check with docker --version)
- Verify all required Docker images are in the "dockers" folder or already installed

 


Release Notes

This is version 1.0


Ethics

The study protocol was approved by the Institutional Review Board of Beth Israel Deaconess Medical Center (protocol # 2022P000417). The written informed consents were waived, because of the retrospective study design with minimal risk to participants. The study also complied with the Declaration of Helsinki.


Acknowledgements

Publication of CAISR is supported by a grant (R01HL161253) from the National Heart Lung and Blood Institute (NHLBI) of the NIH to Massachusetts General Hospital, Emory University, Stanford University, Kaiser Permanente, Boston Children's Hospital, and Beth Israel Deaconess Medical Center


Conflicts of Interest

Dr. Westover is a co-founder, scientific advisor, and consultant to  Beacon Biosignals and has a personal equity interest in the company. This work did not receive support from Beacon Biosignals.


Parent Projects
Complete AI Sleep Report (CAISR) v1.0 was derived from: Please cite them when using this project.
Share
Access

Access Policy:
Only registered users who sign the specified data use agreement can access the files.

License (for files):
BDSP Restricted Health Data License 1.0.0

Data Use Agreement:
BDSP Restricted Health Data Use Agreement

Corresponding Author
You must be logged in to view the contact information.

Files