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.
- 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
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-analyzerpython stability_analyzer.py stability_data.csv --spec-limit 95.0 --time-unit monthsFILE– Path to CSV file containing the data--spec-limit– Specification limit (e.g., minimum acceptable potency)
--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
time,value
0,100.5
3,99.2
6,98.1
9,96.7
12,95.4The tool expects one row per observation, with numeric entries in the specified columns.
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
Run the test suite with:
PYTHONPATH=. pytest tests/ -vMIT License. See LICENSE for details.