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 BioLabCalc ELN single-page application implements an event-driven Reactive Routing Bus managed by the client-side AppController. Rather than treating bench calculations, gel images, spectrophotometer readings, cold-chain inventory, and daily notebook logs as siloed tools, the platform enables bi-directional, cross-tab data flow with single-click actions.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CROSS-SECTION TOOL REACTIVE ROUTING TOPOLOGY β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Tab 8: Sequences & SOPs Registry β
β β’ Oligo / Template / Primer Sequence Input & Presets β
β β’ Instant MW, Tm, GC%, and Length Physicochem Matrix β
βββββββββ¬ββββββββββββββββββ¬βββββββββββββββββ¬ββββββββββ¬ββββ
β β β β
Send to Gel β Send to β Append to β β Store in
(Simulate) β NanoDrop (QC) β Notebook β β Freezer
βΌ βΌ βΌ βΌ
ββββββββββββββββββββββββββ βββββββββββββββββββββββββ ββββββββββββββββββββββββββ
β Tab 4: Gel Canvas β β Tab 5: NanoDrop Plot β β Tab 6: Freezer LIMS β
β β’ Inverted ChemiDoc β β β’ 220-350 nm Spectra β β β’ 6-Tier Spatial Tree β
β β’ Lane Densitometry β β β’ Pathlength Corr. β β β’ 2D Box Grid (9x9) β
β β’ logββ(MW) = -1.85Β·Rf β β β’ A260/A280 Purity β β β’ Tube Metadata & QC β
βββββββββββββ¬βββββββββββββ βββββββββ¬ββββββββββ¬ββββββ βββββββββββββ²βββββββββββββ
β β β β
β Log Band / Lane MW β Log QC β Sync Concentration β
β & Rf Calibration β Metrics β to Selected Tube β
βΌ βΌ βββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Tab 1: Electronic Notebook β
β β’ Immutable Daily Experimental Log in GitHub-Flavored Markdown β
β β’ Live Audit Record Tables with Parameter Targets, Tolerances, and Pass/Fail Status β
β β’ Upstream Campaign Provenance, SOP Deviations, and Multi-Day Yield Aggregation β
ββββββββββββββββββββ²βββββββββββββββββββββββββββββββββββββββββββ²βββββββββββββββββββββββββ
β β
β Log Stamped Audit Table β Finalize & Transfer
β with Deviation Flagging β Verified Bench Text
β β
βββββββββββββββ΄βββββββββββββββ βββββββββββββββ΄βββββββββββββββ
β Tab 2: Kinetic Timers β β Tab 7: OCR Digitizer β
β β’ Multi-Timer State Engine β β β’ HITL Bracketed Corrector β
β β’ Temperature / RPM Log β β β’ Confidence Ambiguity Fix β
β β’ Target vs Actual Minutes β β β’ Atomic Note Integration β
ββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββ
The Sequences & SOPs module acts as the biological source of truth for oligonucleotides, cloning inserts, plasmids, and master procedures. Using the top toolbar, researchers dispatch sequences directly into operational tabs:
- π§ͺ Send to Gel (Tab 4): Calculates single- or double-stranded base-pair length and molecular weight, injecting synthetic migration markers into the Gel Canvas lane simulator. This enables instant visual comparison between expected amplicon sizes and wet-lab electrophoresis lanes.
-
π¬ Send to NanoDrop (Tab 5): Computes sequence-specific molar extinction coefficients (
$\varepsilon_{260}$ or$\varepsilon_{280}$ ) and average molecular weight, automatically pre-populating theoretical concentration baselines and expected$A_{260}$ optical density targets for microvolume UV-Vis analysis. -
π Append to Note (Tab 1): Formats nucleotide properties (
$T_m$ , GC%, MW, length) and active SOP compliance tags (e.g.,SOP-PROT-042 v2.4) into structured Markdown tables and appends them directly to the active day's notebook entry. - βοΈ Store in Freezer (Tab 6): Prompts for slot allocation within the active 2D box grid (e.g., Box B-07), creating an immutable tube entity containing sequence metadata, primer construct identifiers, concentration, and date stored.
The interactive Gel Canvas performs lane profiling, ChemiDoc contrast normalization, and molecular weight calibration via linear regression:
π Log Band to Note extracts the selected band's calibrated molecular weight (e.g., 98.2 kDa for T7 RNA Polymerase), relative migration distance (
The microvolume UV-Vis module evaluates full 220β350 nm spectra with baseline correction and pathlength normalization:
-
π Log QC to Note: Transfers$A_{260}$ ,$A_{280}$ ,$A_{230}$ ,$A_{260}/A_{280}$ purity ratios (target 1.8 for DNA, 2.0 for RNA),$A_{260}/A_{230}$ ratios (target 2.0), pathlength-corrected concentration ($\text{ng}/\mu\text{L}$ ), and chemical purity warnings (phenol at 270 nm, guanidine salts at 230 nm) into the Notebook QC ledger. -
βοΈ Update Freezer Tube: Interactively synchronizes the quantified nucleic acid or protein concentration directly into the corresponding physical tube in the 2D Freezer Grid (Tab 6), updating sample records and lineage metadata without manual data re-entry.
The real-time kinetic timer engine monitors incubations, enzymatic digestions, cell growth curves, and induction milestones:
- Clicking
π Log to Notecompiles active and completed timer milestones into an immutable, timestamped Markdown audit table. - The generated log records Step Description, Planned Duration vs. Actual Elapsed Duration, Parameter Tracked (
$OD_{600}$ , Temperature, RPM), SOP Deviation Flagging, and Operator ID directly into the day's experimental log, satisfying GxP Compliance & Audit Trails requirements.
The Human-in-the-Loop (HITL) OCR corrector ingests handwritten bench notes and instrument slips, highlighting low-confidence tokens (e.g., [[UNCERTAIN:id="ocr_4" text="B4 to B8" conf=0.74]]):
- Once the researcher inspects and accepts or corrects ambiguous values, clicking
Finalize & Log to Notestrips internal uncertainty markers and atomically transfers human-verified experimental observations and harvest parameters into Tab 1.
The ELN server can be configured for multiple environments (development, production, test, offline bench), designated via config.yaml, launched directly from the terminal, or initialized programmatically within Python.
Use the ./configure script to configure hosting parameters and security presets for different deployments:
# Set up development workstation (default: 127.0.0.1:8080)
./configure --env development
# Configure production server binding to all interfaces with anonymization enabled
./configure --env production --host 0.0.0.0 --port 8080 --anonymize
# Configure automated test fixture or offline bench environment
./configure --env test
./configure --env offlineThe ELN automatically reads config.yaml (or ./config.yaml.example as a template) to designate the server host, port, database, and anonymization policy:
server:
host: "127.0.0.1" # Designated host to bind (e.g. "127.0.0.1", "0.0.0.0")
port: 8080 # TCP port
open_browser: false # Auto-launch browser
quiet: false # Suppress startup banners
database:
url: null # Database URL (SQLite or PostgreSQL)
storage_dir: null # Blob & database directory
security:
anonymize_logs: true # Mask IP addresses, user paths, and auth tokens
require_auth: false
environment: "production" # development | production | test | offline# Launch server with default settings or designated config.yaml
biolabcalc eln
# Designate specific config file
biolabcalc eln -c config.yaml
# Override host and port from CLI
biolabcalc eln --host 0.0.0.0 --port 9000
# Generate template config.yaml
biolabcalc eln --generate-config
# Enable anonymized logging
biolabcalc eln --anonymize --no-browser| Option | Flag | Default | Description |
|---|---|---|---|
--host |
config.yaml / 127.0.0.1
|
Network interface IP address to bind. Use 0.0.0.0 for LAN access. |
|
--port |
-p |
config.yaml / 8080
|
TCP port for incoming HTTP/WebSocket connections. |
--config |
-c |
config.yaml |
Path to designated YAML configuration file. |
--anonymize |
True |
Redact IP addresses, home directory paths, and auth tokens. | |
--generate-config |
Write default config.yaml in current working directory. |
||
--db-url |
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. | |
-q, --quiet
|
False |
Suppresses startup banners and decorative bars. |
-
BIOLABCALC_CONFIG: Path to designatedconfig.yaml. -
BIOLABCALC_STORAGE_DIR: Overrides the default base directory for all databases, audit files, and CAS blobs. -
DATABASE_URL: Connection string for PostgreSQL or custom database path.
For laboratories sharing a common network directory (e.g. Windows UNC \\server\share\data, mapped drive Z:\..., or NFS /mnt/lab_share), BioLabCalc provides a dedicated network_share architecture:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Shared Network Drive β
β (UNC \\lab-nas\biology_share or Mapped Drive Z:\BioLabCalc_Data) β
ββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ€
β Central Relational Database β Shared CAS Blob Store β
β β’ SQLite in DELETE mode β β’ SHA-256 content-addressable storage β
β β’ 60s lock queue busy timeout β β’ Immutable raw instrument files β
β β’ Optimistic Concurrency (OCC) β β’ Atomic staging and tempfile rename β
ββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββ€
β Central Master Catalog: Protocols, BioSequences & Custom Templates β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β² β²
β Advisory Lock & OCC Token β Advisory Lock & OCC Token
ββββββββββ΄βββββββββββββββ ββββββββββ΄βββββββββββββββ
β Workstation 1 (Bench) β β Workstation 2 (Office)β
β β’ Standalone Runner β β β’ Standalone Runner β
β β’ Local Web Interface β β β’ Local Web Interface β
βββββββββββββββββββββββββ βββββββββββββββββββββββββ
-
Network-Safe Concurrency: Replaces SQLite WAL mode (which fails across network boundaries due to
-shmshared memory limitations) withPRAGMA journal_mode = DELETE;andPRAGMA busy_timeout = 60000;. -
Cross-Process Advisory Locking: Coordinates write operations using
.lockfiles with exponential backoff and stale-lock recovery. -
Optimistic Concurrency Control (OCC): Every campaign, daily entry, and SOP carries a UUID
version_token. If another researcher saves modifications while you are editing, the system flags a concurrency conflict and offers merge options rather than silently overwriting data.
Wet-lab research encompasses diverse disciplines (molecular cloning, protein purification, cell biology, electrophysiology, chemical biology). Non-coding scientists can design custom experiment templates directly in the ELN:
Templates support:
-
Numeric Fields with Units: Concentration (
mg/mL,Β΅M), Volume (Β΅L,mL), Mass (ng,Β΅g,mg), Temperature (Β°C), OD600. -
Calculation Formulas: Mathematical formulas evaluated via safe pure-Python Abstract Syntax Tree (AST) parsing without
eval():total_yield_mg = (concentration_mg_ml * volume_ml) recovery_percent = (eluate_yield_mg / load_yield_mg) * 100.0 - Step Checklists: Sequential protocol steps with planned incubation countdown timers.
- Select & Multi-Select Dropdowns: Host strains, vectors, buffer types, cell lines.
-
Raw Instrument Slots: Dedicated drag-and-drop slots for ΓKTA FPLC
.res, Bio-Rad.scn, Axon.abf, or NanoDrop.csvfiles.
BioLabCalc ships with ready-to-use templates out of the box:
- General Lab Notebook Entry
- Molecular Cloning & Assembly
- Protein Expression & Purification
- Cell Culture & Growth Kinetics
- Electrophysiology Patch-Clamp Recording
- Custom Blank Canvas
Templates can be exported and imported as portable JSON or YAML files to share across research groups.
Many academic research groups and core facilities operate with flat hierarchies, student peer review, or lab manager oversight rather than requiring the Principal Investigator for everyday checkoffs.
Each laboratory workspace or campaign can designate its approval model:
-
Open Collaboration (
OPEN_COLLABORATION): Entries are auto-finalized upon submission; ideal for exploratory or student research. -
Peer Review (
PEER_REVIEW): Any active colleague or lab member can review, verify checklists, and sign off. -
Designated Reviewer (
DESIGNATED_REVIEWER): The author assigns a specific senior researcher or lab manager. -
PI Hierarchy (
PI_APPROVAL): Formal GxP mode requiring a Principal Investigator role.
Upon approval, BioLabCalc generates a tamper-evident SHA-256 seal:
- 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