Repository navigation
Electronic Lab Notebook (ELN)
The BioLabCalc Electronic Lab Notebook (ELN) and Multi-Modal Laboratory Information Management System (LIMS) is an enterprise-grade digital laboratory platform engineered specifically for biochemistry, molecular biology, structural biology, and bioprocess laboratories. It seamlessly bridges benchtop mathematical calculations with regulatory record-keeping, cold-chain freezer management, analytical instrument parsing, and local retrieval-augmented intelligence.
The ELN is designed around a modular, multi-tier architecture capable of running as a lightweight, zero-dependency benchtop server on a personal laptop or as a horizontally scalable, containerized multi-user deployment backed by PostgreSQL 16+ with pgvector.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Modern Web SPA Frontend β
β βββββββββββββββββ¬βββββββββββββββββ¬ββββββββββββββββ¬βββββββββββββββββ¬βββββββββββββββββ β
β β Notebook Tab β FPLC Canvas β Gel Annotator β NanoDrop Plot β Freezer 2D Gridβ β
β βββββββββββββββββ΄βββββββββββββββββ΄ββββββββββββββββ΄βββββββββββββββββ΄βββββββββββββββββ€ β
β β Kinetic Timers β’ HITL OCR Corrector β’ Sequence Viewer β’ Global RAG Assistant (βK)β β
βββββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββ
β HTTP / JSON REST & WebSockets
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Dual-Engine Server Runtime β
β ββββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ β
β β Primary Engine: FastAPI / Uvicorn (ASGI) β Fallback Engine: Pure-Python β β
β β β’ High-concurrency async request pipeline β Multi-threaded HTTP Server β β
β β β’ Real-time WebSocket broadcasting β β’ Zero third-party dependencies β β
β β β’ Automated OpenAPI / Swagger documentation β β’ In-process synchronous routingβ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Application Service Layer β
β ββββββββββββββββββββββββ¬βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β
β β CampaignService β SOPService β InventoryService β β
β β β’ Multi-day studies β β’ Semantic versioningβ β’ 6-tier cold-chain spatial hierarchyβ β
β β β’ Yield aggregation β β’ GxP execution fork β β’ 2D slot collision validation β β
β ββββββββββββββββββββββββΌβββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββ€ β
β β FPLCService β GelService β AuditService β β
β β β’ Peak integration β β’ Lane densitometry β β’ SHA-256 hash-chained ledger β β
β β β’ Fraction pooling β β’ MW Rf calibration β β’ 21 CFR Part 11 tamper-evidence β β
β ββββββββββββββββββββββββ΄βββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββ
β Dual Database Abstraction β β Content-Addressed Storage (CAS) Blob β
β βββββββββββββββββββββ¬ββββββββββββββββββββββββ β β β’ SHA-256 deduplicated file store β
β β SQLite Engine β PostgreSQL 16+ Engine β β β β’ Two-tier directory sharding β
β β β’ Embedded local β β’ Multi-user cluster β β β ({base}/{sha256[:2]}/{sha256}.blob)β
β β β’ Pure-Python ORM β β’ pgvector (HNSW) β β β β’ Atomic staging via temp files β
β β β’ Custom vector β β’ JSONB + tsvector β β β β’ Local filesystem & S3/MinIO driversβ
β β scalar function β β’ 21 relational tablesβ β β β’ Full binary reproducibility β
β βββββββββββββββββββββ΄ββββββββββββββββββββββββ β ββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββ
The persistence layer (biolabcalc.eln.schema.database) implements an abstraction pattern allowing seamless switching between local SQLite storage and high-concurrency PostgreSQL clusters without altering service logic.
For single-investigator workstations, field expeditions, or air-gapped environments where external database packages or compiled C-extensions are unavailable, BioLabCalc incorporates an in-house declarative ORM:
-
Custom Metaclass ORM (
BaseModel,Field,Relationship): Provides model registration, foreign-key resolution, cascading deletions, automatic JSON serialization, and entity tracking without requiring SQLAlchemy. -
In-Database Vector Cosine Similarity: SQLite does not natively support vector datatypes. BioLabCalc injects a compiled C-level scalar function directly into the SQLite connection:
This enables nearest-neighbor hybrid search directly inside SQLite SQL queries without external vector libraries.
conn.create_function("COSINE_SIMILARITY", 2, _sqlite_cosine_similarity)
-
Transactional Identity Map: The custom
Sessionmaintains an identity map and tracks_newand_dirtyobject sets, guaranteeing atomic commits and rollback capabilities. -
Concurrency Locking: When using in-memory SQLite (
:memory:),Engineprotects the shared connection with athreading.Lock()so concurrent multi-threaded operations do not collide or corrupt state. -
Write-Ahead Logging (WAL) Mode: For file-based SQLite databases, connections automatically execute
PRAGMA journal_mode = WAL;and configuretimeout=30.0to eliminate database locks under concurrent access.
For multi-user research institutions, core facilities, and regulated biopharma deployments, the ELN connects to PostgreSQL via SQLAlchemy and psycopg2-binary (installable via pip install "biolabcalc[eln]"). If a postgresql:// or postgres:// URI is specified without required dependencies, the engine raises an explicit ValueError rather than silently falling back to SQLite in-memory storage. The production DDL (biolabcalc.eln.schema.ddl.sql) provisions:
- 21 Relational Tables: Covering users, audit logs, storage blobs, SOP templates, experimental campaigns, daily entries, kinetic timepoint logs, biological sequences, PCR assays, NanoDrop measurements, FPLC columns, FPLC runs, FPLC fractions, gel records, gel lanes, electrophysiology recordings, code analysis runs, storage hierarchy nodes, freezer boxes, inventory tubes, and RAG document chunks.
-
Vector Cosine Indexing (HNSW): 1536-dimensional embeddings indexed via Hierarchical Navigable Small World graphs:
CREATE INDEX idx_rag_document_chunks_embedding_hnsw ON rag_document_chunks USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64);
-
Hybrid Search Indexes: Generalized Inverted Indexes (
GIN) on generatedtsvectorcolumns for full-text lexical search, GIN trigram indexes (pg_trgm) for fuzzy keyword matching, and GIN JSONB indexes for experimental parameter queries.
All raw instrument outputs, gel micrographs, chromatograms, and spectrophotometer runs are ingested through the Content-Addressed Storage subsystem (biolabcalc.eln.storage.blob_store).
- Cryptographic Deduplication: Every file is indexed strictly by the hexadecimal digest of its SHA-256 hash. If two researchers upload identical 500 MB FPLC run files, only one physical blob is written to disk.
-
Two-Tier Directory Sharding: To prevent filesystem performance degradation when storing tens of thousands of raw analytical files, blobs are sharded across subdirectories using the first two hex characters of their hash:
.biolabcalc_data/blobs/ βββ 3a/ β βββ 3a8f9c10...blob <- Raw immutable binary payload β βββ 3a8f9c10...meta.json <- Ingestion metadata, MIME type, size, attributes βββ d4/ β βββ d41d8cd9...blob β βββ d41d8cd9...meta.json - Atomic Writes: Blobs are written to a temporary staging file and atomically renamed to their final sharded path, preventing corrupt reads during concurrent multi-threaded uploads.
-
Storage Backend Flexibility: The storage layer is governed by the
StorageBackendabstract interface, allowing effortless switching between local storage (LocalStorageBackend) and enterprise cloud buckets (S3StorageBackend/ MinIO).
The BioLabCalc ELN user interface is delivered as a modern Single-Page Application (SPA) located in eln/web/templates/index.html and styled via eln/web/static/styles.css.
| Tab / Module | Primary Purpose | Key Features |
|---|---|---|
| π Notebook | Multi-day campaign execution | Daily bench entries, carry-forward buffer/plasmid state, protocol deviation tracking, cumulative protein yield calculations. |
| β±οΈ Kinetic Timepoints | In-run incubation & growth monitoring | Live multi-timer countdown/countup, optical density ( |
| π FPLC Chromatogram | Chromatography trace inspection | ΓKTA UNICORN interactive multi-trace canvas ( |
| 𧬠Gel Canvas | Electrophoresis densitometry | Bio-Rad ChemiDoc & 16-bit TIFF rendering, lane profiling, molecular weight ( |
| π¬ NanoDrop Spectra | Microvolume UV-Vis quantification | 220β350 nm spectral overlay, pathlength normalization, |
| βοΈ Freezer LIMS | Cold-chain sample management | Multi-tier spatial tree (Room |
| π OCR Digitizer | Scanned bench notes digitization | Human-in-the-Loop (HITL) OCR corrector, confidence scoring, ambiguous biochemical character disambiguation, side-by-side interactive correction. |
| 𧬠Sequences & SOPs | Master molecular registries | Plasmid construct repository, translated ORF biophysics (MW, pI, |
| π Assistant (βK) | Context-aware RAG knowledge search | Hybrid BM25 + dense vector semantic search across all historical notebook entries, FPLC runs, and freezer tubes with citation provenance. |
The ELN server can be launched directly from the terminal or initialized programmatically within Python.
# Launch server with default settings (127.0.0.1:8080, local SQLite)
biolabcalc eln
# Bind to custom port and network interface
biolabcalc eln --host 0.0.0.0 --port 9000
# Connect to production PostgreSQL instance
biolabcalc eln --db "postgresql://lims_user:secret@db.lab.internal:5432/eln_production"
# Headless server launch (disable automatic browser pop-up)
biolabcalc eln --no-browser --port 8080
# Specify custom storage directory for database, audit ledger, and CAS blobs
biolabcalc eln --storage-dir /var/data/biolabcalc_storage| Option | Flag | Default | Description |
|---|---|---|---|
--host |
-H |
127.0.0.1 |
Network interface IP address to bind. Use 0.0.0.0 for LAN access. |
--port |
-p |
8080 |
TCP port for incoming HTTP/WebSocket connections. |
--db |
-d |
Local SQLite | Database connection URL (sqlite:///path/to/db.sqlite or postgresql://...). |
--no-browser |
False |
Disables launching the default operating system web browser on startup. | |
--storage-dir |
~/.biolabcalc_eln |
Root directory for SQLite database, CAS blobs, and audit trails. |
-
BIOLABCALC_STORAGE_DIR: Overrides the default base directory for all databases, audit files, and CAS blobs. -
BIOLABCALC_AUDIT_LOG: Explicit path to the append-only JSONL audit ledger. -
DATABASE_URL: Connection string for PostgreSQL or custom database path.
- SOP & Protocol Management β Authoring, semantic versioning, and immutable execution forks.
- Instrument Data Parsers β Ingestion engines for ΓKTA FPLC, NanoDrop, Bio-Rad ChemiDoc, and Axon ABF.
- Inventory & Freezer LIMS β 6-tier cold chain architecture and 2D box grid visualizer.
- RAG & Local AI Assistant β Offline vector search and contextual laboratory synthesis.
- GxP Compliance & Audit Trails β 21 CFR Part 11 cryptographic hash chains and role-based access.
- Developer & Deployment Guide β Testing, Docker deployment, and PostgreSQL migration.
BioLabCalc Documentation Wiki | Licensed under the MIT License | GitHub Repository Research Use Only (RUO). Not intended for clinical or diagnostic procedures.
- Core Calculators & Stoichiometry
- Solution Prep & Spectroscopy
- Buffers & Precipitation
- Protein Quantification & Assays
- Fluorophores & Dye Labeling
- Molecular Cloning & Assembly
- Plasmid Engineering & Workbench
- PCR Kinetics & Primer Design
- In Vitro Transcription (IVT)
- Western Blotting Suite
- Bacterial Growth & Kinetics
- ELN System Architecture
- SOP & Protocol Management
- Instrument Data Parsers
- Inventory & Freezer LIMS
- Local RAG Knowledge Engine
- GxP Compliance & Audit Trails