A quantitative cell-cycle kinetics & biological data analysis platform
Cell Division Timer is a biotechnology-focused software platform for recording, validating, analyzing, and interpreting cell division and cell-cycle kinetics data generated from time-lapse microscopy and laboratory experiments.
The platform combines cell biology, quantitative kinetics, database engineering, REST API development, statistical analysis, and biological quality control into a single application โ designed as a foundation for future integration with live-cell imaging systems, laboratory information management systems (LIMS), computational biology pipelines, and bioprocess analytics platforms.
This project is a production-oriented research prototype, not a validated clinical or diagnostic system โ see Scientific Disclaimer.
This delivery is the result of a full backend audit and hardening pass. Highlights:
- Fixed a scientific data-integrity gap:
division_duration_minutesandgrowth_ratecould previously be supplied directly on create, silently overriding what the timestamps / cell-cycle duration implied. They are now always calculated, with an explicit, reason-documented*_override/*_override_reasonfield pair for the rare case a manual correction is genuinely needed (DB-enforced: an override and its reason are always set, or cleared, together โ never one without the other). - Fixed a PATCH validation gap: updating only one of
division_start_time/division_end_timeis now validated against the merged final record, not just the fields present in that request, so a partial update can no longer produce an end-before-start record. - Removed the
create_all()/ Alembic inconsistency: schema management is now owned exclusively by Alembic migrations (alembic upgrade head) in both the API startup path and the seed script;Base.metadata.create_all()remains only inside the isolated in-memory test database. - NCBI client hardening: requests now reuse a single pooled
httpx.AsyncClientinstead of opening a new one per call, and HTTP 429 responses are retried a bounded number of times with backoff (honoringRetry-After) instead of failing immediately. - Docker/security hardening: added a
.dockerignore, the container now runs as a non-root user, and a live NCBI API key that had been left in a local.envfile (never committed to git) was removed from the delivered project โ rotate that key if you haven't already. - Corrected several README/reference-range numbers that had drifted from the actual
app.utils.biologyimplementation, and addeddocs/database_er_diagram.png.
- Why This Project?
- Biological Problem
- Biological Quality Control
- System Architecture
- Technology Stack
- Project Structure
- Database Design
- Synthetic Benchmark Dataset
- API Reference
- Analytics API
- Literature Evidence (NCBI/PubMed)
- CSV Data Transfer
- API Versioning
- Local Installation
- Database Setup
- Seed Synthetic Data
- Start the API
- API Documentation
- Docker
- Testing
- Example Analytical Workflow
- Potential Real-World Applications
- Future Roadmap
- Scientific Disclaimer
- Contributing
- License
- Author
Cell-division experiments can generate hundreds or thousands of observations across:
- Different cell lines
- Experimental conditions
- Temperatures
- Biological replicates
- Generations
- Experimental batches
- Microscopy sessions
Manually organizing and analyzing these observations creates problems with data consistency, reproducibility, quality control, kinetic calculations, outlier identification, experimental comparison, and downstream export.
Cell Division Timer addresses this by providing a structured system for storing observations and automatically deriving biologically meaningful kinetic parameters.
The platform focuses on quantitative measurements associated with cellular proliferation and division.
The active division/mitotic duration is calculated as:
where:
-
$t_{start}$ = beginning of observed division -
$t_{end}$ = completion of division -
$T_{div}$ = division duration in minutes
The system records
For an exponentially growing population:
where:
-
$N(t)$ = population at time$t$ -
$N_0$ = initial population -
$\mu$ = specific growth rate -
$T_d$ = doubling time
The API automatically derives
The platform doesn't just store measurements โ it evaluates observations against biological plausibility rules.
QC capabilities:
- Division-duration validation
- Cell-cycle validation
- Temperature validation
- Biological outlier detection
- Experimental-condition filtering
- Batch-level analysis
- Statistical summaries
- Quality flags
Example quality states:
PASS
OUTLIER_DURATION_EXCESSIVE
OUTLIER_TEMPERATURE_EXTREME
SUSPECT_DIVISION_EXCEEDS_CYCLE
Reference ranges for representative biological systems:
| Organism / Model | Division Duration | Cell Cycle | Normal Temp. |
|---|---|---|---|
| S. cerevisiae | 15โ55 min | 1.0โ4.5 hr | 18โ40 ยฐC |
| E. coli | 8โ35 min | 0.25โ2.5 hr | 15โ44 ยฐC |
| S. pombe | 15โ60 min | 1.8โ5.0 hr | 18โ38 ยฐC |
| Human / HeLa | 35โ160 min | 14โ40 hr | 32โ41 ยฐC |
| Mouse / NIH-3T3 | 35โ150 min | 12โ36 hr | 32โ41 ยฐC |
These are QC / reference-screening thresholds, not biological absolutes.
app.utils.biology.BIOLOGICAL_REFERENCE_RANGESencodes reasonable domain heuristics used to flag implausible data entry (e.g. more than 2ร outside the typical window for that organism), not peer-reviewed diagnostic cutoffs. They are not a substitute for laboratory-specific validated SOPs, and no literature citation is claimed for the exact numeric bounds โ treat them as an assumed/reference dataset, not a sourced one.
The backend follows a layered architecture that separates API handling, business logic, data access, and persistence.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Client / Laboratory โ
โ Data Source โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
HTTP / JSON / CSV
โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ FastAPI API โ
โ โ
โ Cells โ
โ Divisions โ
โ Analytics โ
โ Data Transfer โ
โ Health โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
Service Layer
โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ Business Logic โ
โ โ
โ Cell Service โ
โ Division Service โ
โ Analytics Service โ
โ CSV Service โ
โ Biological Calculations โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
Repository Layer
โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ SQLAlchemy โ
โ ORM Layer โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ PostgreSQL / SQLite โ
โ โ
โ Cells โ
โ Division Records โ
โ Experimental Metadata โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Implemented using FastAPI, SQLAlchemy 2.0, Pydantic v2, and Alembic, with PostgreSQL intended for production and SQLite available for development/testing.
Backend
- Python 3.12+
- FastAPI
- Pydantic v2
- SQLAlchemy 2.0
- Alembic
- PostgreSQL / SQLite
- HTTPX (async NCBI E-utilities client)
- Standard library
logging(structured console logging)
Data & Analytics
- Statistical aggregation (mean, median, std dev, CV) via the standard library
- Biological kinetic calculations
- CSV/JSON data processing
- PubMed literature evidence via NCBI E-utilities
Infrastructure
- Docker & Docker Compose
- Environment-based configuration
Testing
- Pytest
- FastAPI TestClient
- In-memory SQLite test database
- Biological formula tests
- API validation tests
Frontend / Client
- Vite-based JavaScript/TypeScript client for the biological data platform
cell_division_timer/
โ
โโโ cell_division_timer_fastapi/
โ โ
โ โโโ alembic/
โ โ โโโ versions/
โ โ
โ โโโ app/
โ โ โโโ api/
โ โ โ โโโ routes/
โ โ โ โ โโโ analytics.py
โ โ โ โ โโโ cells.py
โ โ โ โ โโโ data_transfer.py
โ โ โ โ โโโ divisions.py
โ โ โ โ โโโ health.py
โ โ โ โ โโโ literature.py
โ โ โ โ
โ โ โ โโโ deps.py
โ โ โ
โ โ โโโ core/
โ โ โ โโโ config.py
โ โ โ โโโ database.py
โ โ โ โโโ logging.py
โ โ โ โโโ middleware.py
โ โ โ
โ โ โโโ models/
โ โ โ โโโ base.py
โ โ โ โโโ cell.py
โ โ โ โโโ division.py
โ โ โ
โ โ โโโ repositories/
โ โ โ โโโ base.py
โ โ โ โโโ cell_repository.py
โ โ โ โโโ division_repository.py
โ โ โ
โ โ โโโ schemas/
โ โ โ โโโ analytics.py
โ โ โ โโโ cell.py
โ โ โ โโโ common.py
โ โ โ โโโ division.py
โ โ โ โโโ literature.py
โ โ โ
โ โ โโโ services/
โ โ โ โโโ analytics_service.py
โ โ โ โโโ cell_service.py
โ โ โ โโโ csv_service.py
โ โ โ โโโ division_service.py
โ โ โ โโโ ncbi_service.py
โ โ โ
โ โ โโโ utils/
โ โ โ โโโ biology.py
โ โ โ โโโ pagination.py
โ โ โ
โ โ โโโ main.py
โ โ โโโ seed.py
โ โ
โ โโโ data/
โ โ โโโ synthetic_cell_divisions_100.csv
โ โ โโโ synthetic_cell_divisions_100.json
โ โ
โ โโโ output/
โ โ โโโ cell_division_export.csv
โ โ
โ โโโ scripts/
โ โ โโโ export_data.py
โ โ โโโ seed.py
โ โ โโโ ncbi_manual_check.py
โ โ
โ โโโ tests/
โ โ โโโ conftest.py
โ โ โโโ test_analytics.py
โ โ โโโ test_biology.py
โ โ โโโ test_cells.py
โ โ โโโ test_csv.py
โ โ โโโ test_divisions.py
โ โ โโโ test_health.py
โ โ โโโ test_literature.py
โ โ โโโ test_ncbi_service.py
โ โ โโโ test_seed.py
โ โ โโโ test_validation.py
โ โ โโโ test_versioning.py
โ โ
โ โโโ Dockerfile
โ โโโ docker-compose.yml
โ โโโ pytest.ini
โ โโโ requirements.txt
โ โโโ .env.example
โ โโโ README.md
โ
โโโ data/
โโโ output/
โโโ public/
โโโ src/
โ โโโ lib/
โ โ โโโ api.ts (typed client for the FastAPI backend, incl. literature search)
โ โโโ data/
โโโ package.json
โโโ tsconfig.json
โโโ vite.config.ts
โโโ README.md
The repository currently contains separate frontend and FastAPI backend components, along with synthetic data, database files, and configuration files.
The core relational model contains two primary entities.
Represents the biological cell line / specimen.
id
name
organism
cell_type
passage_number
source_line
description
created_at
updated_at
Represents an individual cell-division observation.
id
cell_id
experimental_batch
replicate
experimental_condition
medium
temperature_celsius
generation
division_start_time
division_end_time
division_duration_minutes # official value: calculated, or an explicit override
cell_cycle_duration_hours
growth_rate # official value: calculated, or an explicit override
duration_override_minutes # nullable; must be paired with a reason
duration_override_reason # nullable; required whenever an override is set
growth_rate_override # nullable; must be paired with a reason
growth_rate_override_reason # nullable; required whenever an override is set
is_outlier
quality_flag
notes
metadata_json
created_at
updated_at
division_duration_minutes and growth_rate are always derived from the source
measurements (division_start_time/division_end_time and
cell_cycle_duration_hours) unless a scientist explicitly sets one of the
*_override fields together with its *_override_reason โ a CHECK constraint
enforces that an override value and its reason are always set (or cleared)
together, so a manual correction can never silently look like a raw
calculation. The API always returns both the official value and the raw
calculated_duration_minutes / calculated_growth_rate, so an active
override is never invisible to a caller. See
docs/database_er_diagram.png for the full
schema, including indexes and constraints.
Relationship:
Cell
โ
โโโ Division Record 1
โโโ Division Record 2
โโโ Division Record 3
โโโ ...
Foreign-key constraints and validation rules maintain data integrity.
Real microscopy datasets are often proprietary or difficult to distribute, so the project ships a deterministic synthetic dataset with 100 observations.
Cell models
S. cerevisiae BY4741 โ 25 observations
E. coli K-12 MG1655 โ 25 observations
HeLa CCL-2 โ 25 observations
NIH/3T3 Fibroblast โ 25 observations
Experimental conditions
Control
Nutrient Depletion
Thermal Stress
Rapamycin Inhibition
Osmotic Stress
Additional metadata
- Experimental batches
- Replicates
- Generations
- Temperature
- Cell-cycle duration
- Division duration
- Growth rate
- QC classification
The dataset intentionally includes biologically characterized outliers to test the quality-control pipeline.
RESTful endpoints exposed through FastAPI.
GET /healthChecks application and database connectivity.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/cells |
Create cell |
GET |
/api/v1/cells |
List cells |
GET |
/api/v1/cells/{id} |
Retrieve cell |
PUT |
/api/v1/cells/{id} |
Update cell |
DELETE |
/api/v1/cells/{id} |
Delete cell |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/divisions |
Create observation |
GET |
/api/v1/divisions |
List observations |
GET |
/api/v1/divisions/{id} |
Retrieve observation |
PUT |
/api/v1/divisions/{id} |
Update observation |
DELETE |
/api/v1/divisions/{id} |
Delete observation |
The service layer automatically handles relevant biological calculations when observations are created or updated.
| Endpoint | Description |
|---|---|
GET /api/v1/analytics/summary |
Overall kinetic statistics |
GET /api/v1/analytics/by-cell-type |
Kinetics stratified by cell type |
GET /api/v1/analytics/by-condition |
Comparison across experimental conditions |
GET /api/v1/analytics/by-temperature |
Analysis of temperature-associated kinetics |
| Endpoint | Description |
|---|---|
GET /api/v1/literature/search?query=...&retmax=... |
Search PubMed via NCBI E-utilities and return normalized article metadata (PMID, title, authors, journal, date, DOI, abstract) |
This integration is backend-only. The frontend's "Literature Evidence" tab calls this
endpoint through src/lib/api.ts โ it never talks to NCBI directly and never sees an API key.
Requires NCBI_API_KEY to be set in the backend's .env file; see the
backend README
for the full request/response shape and error-handling behavior.
Experimental datasets can be imported/exported through the API, enabling integration with Excel, Python analysis pipelines, R, MATLAB, laboratory databases, LIMS systems, and microscopy analysis software.
Microscopy Data
โ
CSV
โ
Cell Division Timer
โ
Validation
โ
Biological Calculations
โ
QC / Outlier Detection
โ
Database
โ
Analytics
โ
CSV / JSON Export
The project implements API versioning to support long-term evolution of the platform.
- Stable API โ
/api/v1/... - Beta API โ
/api/v2/...
The backend also supports header-based and query-based version selection for compatible unversioned routes, e.g.:
X-API-Version: 2/api/divisions?api-version=2This lets new biological analytics capabilities be introduced without immediately breaking existing clients.
1. Clone the repository
git clone https://github.com/sunilnarayan419-ui/cell_division_timer.git
cd cell_division_timer2. Enter the FastAPI backend
cd cell_division_timer_fastapi3. Create a virtual environment
Windows:
python -m venv .venv
.venv\Scripts\activateLinux / macOS:
python3 -m venv .venv
source .venv/bin/activate4. Install dependencies
pip install -r requirements.txt5. Configure environment variables
Copy .env.example to .env, then configure the database and application settings.
To enable the Literature Evidence feature, also add your own free NCBI API key
(see the backend README) โ
everything else works fine without it.
Run Alembic migrations:
alembic upgrade headThe project uses Alembic for version-controlled database schema migrations.
python -m app.seedor, using the provided script:
python scripts/seed.pyThis populates the database with the benchmark cell-division dataset.
uvicorn app.main:app --reloadThe API will be available at http://localhost:8000.
FastAPI automatically generates interactive API documentation:
- Swagger UI โ
http://localhost:8000/docs - ReDoc โ
http://localhost:8000/redoc
These interfaces let developers and researchers interactively test the API without writing a separate client.
cd cell_division_timer_fastapi
cp .env.example .env
docker compose up --buildDeploys the application and PostgreSQL database together. docker-compose.yml loads .env
via env_file:, so it must exist before you run docker compose up.
Covers biological calculations, cell CRUD, division CRUD, analytics, CSV import/export, database health, synthetic data seeding, validation, API versioning, and the NCBI/PubMed literature integration (fully mocked โ no real NCBI API key or network access required to run the suite).
pytestVerbose output:
pytest -v1. Register cell line
2. Record experimental condition
3. Record division start/end
4. Calculate division duration
5. Record cell-cycle duration
6. Calculate specific growth rate
7. Apply biological QC
8. Flag potential outliers
9. Aggregate observations
10. Compare experimental conditions
11. Export results
This makes the application useful not only as a timer but as a small experimental data-management and quantitative biology platform.
Cell Biology
- Cell-cycle analysis
- Mitotic timing
- Cell-line comparison
- Drug-response experiments
Cancer Biology
- Cell proliferation studies
- Mitotic arrest analysis
- Drug-induced cell-cycle perturbation
- Treatment-condition comparison
Bioprocessing
- Microbial growth kinetics
- Fermentation monitoring
- Temperature-stress analysis
- Growth-rate comparison
Imaging & Microscopy (future integrations)
- Time-lapse microscopy
- Image segmentation pipelines
- Cell tracking algorithms
- Computer vision systems
- Automated phenotype detection
- Live-cell microscopy integration
- Automated cell tracking
- Computer-vision-based division detection
- Cell lineage visualization
- Growth curves
- KaplanโMeier-style division analysis
- Advanced statistical testing
- Experimental batch comparison
- Drug-response modeling
- Dose-response analysis
- LIMS integration
- Authentication and role-based access control
- PostgreSQL production deployment
- Cloud deployment
- Real-time experiment monitoring
- Research dashboard
- ML-based anomaly detection
- The NCBI API key lives only in the backend's
.envfile (never committed, never logged, never sent to the frontend). See Security Notes in the backend README for the full rundown. - The core application has no dependency on paid AI APIs. An earlier scaffold pulled in
an unused
@google/genai(Gemini) dependency and Express/dotenv/tsx tooling with zero actual usage in the codebase โ these have been removed. Literature evidence comes from the free NCBI E-utilities API, not from a generative AI model.
This project is intended for software development, educational, computational biology, and research-prototyping purposes.
The biological reference ranges and QC rules included in the synthetic benchmark should not be interpreted as universal biological standards. For real laboratory use, reference ranges and QC thresholds should be validated against experimental protocol, cell line, organism, instrumentation, environmental conditions, laboratory SOPs, published literature, and experimental controls.
Contributions are welcome. Possible areas:
- Biological models
- Statistical analysis
- API development
- Database optimization
- Visualization
- Computer vision
- Microscopy integration
- Testing
- Documentation
Workflow
git clone <repository>
git checkout -b feature/my-feature
# Make changes
git add .
git commit -m "Add: my feature"
git push origin feature/my-featureThen open a Pull Request.
Licensed under the MIT License. See LICENSE for details.
Sunil Mandloi Biotechnology / Life-Sciences Technology
Interested in: Biotechnology ยท Computational Biology ยท Life-Science Data Analytics ยท Bioinformatics ยท Healthcare Technology ยท Scientific Software ยท Biotechnology Business & Strategy
Turn biological observations into structured, reproducible, and decision-ready data.
Cell Division Timer is intended to evolve from a laboratory timing utility into a broader computational life-sciences analytics platform, connecting experimental biology with software engineering, quantitative analysis, and ultimately real-world biotechnology workflows.
โญ If you find this project useful for learning, experimentation, or biotechnology software development, consider starring the repo: https://github.com/sunilnarayan419-ui/cell_division_timer

