Skip to content

wl5e/ich-stability-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ICH Stability Analyzer

A command-line tool for pharmaceutical stability data analysis. Fits a linear regression model to time–measurement data, evaluates statistical significance, and estimates shelf life as the time when the lower one-sided 95% confidence bound crosses a predefined specification limit. Designed for GMP environments following ICH Q1E.

Features

  • Reads stability data from a CSV file (customizable column names)
  • Computes ordinary least-squares slope, intercept, R², and p-value
  • Tests regression significance and checks for problematic data (small sample, constant X)
  • Uses the t-distribution to build a one-sided lower 95% confidence band for the fitted line
  • Finds shelf life by solving the intersection of the lower confidence bound with a user-provided specification limit
  • Prints a structured summary report to the terminal or writes to a file
  • No external dependencies – uses only Python standard library

Installation

Clone the repository or download stability_analyzer.py. No installation required.

git clone https://github.com/your-username/ich-stability-analyzer.git
cd ich-stability-analyzer

Usage

python stability_analyzer.py stability_data.csv --spec-limit 95.0 --time-unit months

Required arguments

  • FILE – Path to CSV file containing the data
  • --spec-limit – Specification limit (e.g., minimum acceptable potency)

Optional arguments

  • --time-col – Name of column holding time values (default: time)
  • --value-col – Name of column holding measurement values (default: value)
  • --delimiter – CSV delimiter (default: ,)
  • --time-unit – Label for time axis in the report (default: time unit)
  • --output – Write report to a text file instead of stdout

CSV format

time,value
0,100.5
3,99.2
6,98.1
9,96.7
12,95.4

The tool expects one row per observation, with numeric entries in the specified columns.

Example output

ICH Stability Analyzer Report
=============================
Input file: stability_data.csv
Specification limit: 95.0
Time unit: months

Regression summary:
  Slope: -0.4350  (degrades over time)
  Intercept: 100.6200
  R²: 0.9987
  p-value: 0.00008 (significant at α=0.05)
  Standard error of slope: 0.0091

Shelf life (lower 95% CL): 11.4 months

Testing

Run the test suite with:

PYTHONPATH=. pytest tests/ -v

License

MIT License. See LICENSE for details.

About

Calculate shelf life from GMP stability data using linear regression with 95% lower confidence bound, following ICH Q1E guidelines

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages