Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add herotod/medical-reference-interval-analysis
Or install specific skill: npx add-skill https://github.com/herotod/medical-reference-interval-analysis
# Description
A comprehensive tool for calculating and validating medical reference intervals (RIs) according to CLSI C28-A3 guidelines. It supports automatic data cleaning, outlier detection, gender/age partitioning (Harris-Boyd, Cohen's d), and robust statistical analysis.
# SKILL.md
name: medical-reference-interval-analysis
description: A comprehensive tool for calculating and validating medical reference intervals (RIs) according to CLSI C28-A3 guidelines. It supports automatic data cleaning, outlier detection, gender/age partitioning (Harris-Boyd, Cohen's d), and robust statistical analysis.
version: 1.0.0
usage:
- "Analyze reference intervals for a dataset: python analysis.py"
- "The script automatically processes all .xlsx files in the current directory."
Medical Reference Interval Analysis Skill
This skill provides a robust pipeline for establishing and verifying medical reference intervals from laboratory data. It automates the complex statistical procedures required by CLSI guidelines, making it easier for laboratory professionals to determine accurate reference ranges.
Features
- Automated Data Loading: Automatically detects and processes all Excel (
.xlsx) files in the source directory. - Data Preprocessing: Handles column renaming (Sex->gender, Age->age), type conversion, and missing value removal.
- Advanced Outlier Detection:
- Tukey's Fences (IQR method)
- Z-Score
- Gaussian Mixture Models (GMM)
- Isolation Forest
- Local Outlier Factor (LOF)
- Intelligent Partitioning:
- Gender: Uses Harris-Boyd method (Z-test) to determine if separate intervals are needed for males and females.
- Age: Implements an iterative algorithm to group ages based on minimum sample size and effect size (Cohen's d).
- Reference Interval Calculation: Uses the robust non-parametric percentile method (2.5th and 97.5th percentiles) with Bootstrap confidence intervals (90% CI).
- Visualization: Generates comprehensive plots:
- Age vs. Result scatter plots with GAM (Generalized Additive Model) trends.
- Kernel Density Estimation (KDE) distributions.
- Forest plots for comparing reference intervals across groups.
- Internal Validation: Performs a second pass of analysis after removing detected outliers to refine the intervals.
Usage
- Place your data files (
.xlsx) in the directory where the script is run. The files should contain at leastsex(orgender),age, andresultcolumns. - Run the analysis script.
- Results will be saved in a new
results_YYYYMMDD_HHMMSSdirectory, containing:analysis_summary.xlsx: Detailed statistical results.reference_intervals.xlsx: Calculated reference intervals.*.png: Visualization plots.
Requirements
- pandas
- numpy
- scipy
- matplotlib
- seaborn
- scikit-learn
- pygam
- openpyxl
# README.md
Medical Reference Interval Analysis Skill
A comprehensive tool for calculating and validating medical reference intervals (RIs) according to CLSI C28-A3 guidelines.
Features
- Automated Data Loading
- Data Preprocessing
- Advanced Outlier Detection
- Intelligent Partitioning (Gender/Age)
- Reference Interval Calculation
- Visualization
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.