Skip to content

Common-Longitudinal-ICU-data-Format/clifpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clifpy - Python Client for CLIF

CLIF Logo

Transform critical care data into actionable insights

PyPI version Python Versions License Documentation uv

Documentation | Quick Start | CLIF Website

Standardized framework for critical care data analysis and research

CLIFpy is the official Python implementation for working with CLIF (Common Longitudinal ICU data Format) data. Transform heterogeneous ICU data into standardized, analysis-ready datasets with built-in validation, clinical calculations, and powerful data manipulation tools.

Key Features

  • 📊 Comprehensive CLIF Support: Full implementation of all CLIF 2.0 tables with automatic schema validation
  • 🏥 Clinical Calculations: Built-in SOFA scores, comorbidity indices, and other ICU-specific metrics
  • 💊 Smart Unit Conversion: Automatically standardize medication dosages across different unit systems
  • 🔗 Encounter Stitching: Link related ICU stays within configurable time windows
  • High Performance: Leverages DuckDB and Polars for efficient processing of large datasets
  • 🌍 Timezone Aware: Proper timestamp handling across different healthcare systems
  • 📈 Wide Format Support: Transform longitudinal data into hourly resolution for analysis

Installation

pip install clifpy

Quick Example

from clifpy import ClifOrchestrator

# Load and validate CLIF data
orchestrator = ClifOrchestrator(
    data_directory='/path/to/clif/data',
    timezone='US/Eastern'
)

# Validate all tables against CLIF schemas
orchestrator.validate_all()

# Access individual tables
vitals = orchestrator.vitals.df
labs = orchestrator.labs.df

# Advanced features
wide_df = orchestrator.create_wide_dataset()  # Hourly resolution data
sofa_scores = orchestrator.compute_sofa_scores()  # Calculate SOFA scores

Development

CLIFpy uses uv for fast, reliable dependency management.

Quick Setup

  1. Install uv:

    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Clone and install:

    git clone https://github.com/Common-Longitudinal-ICU-data-Format/CLIFpy.git
    cd CLIFpy
    uv sync
  3. Run tests:

    uv run pytest

Links & Resources