Repository navigation
SOP & Protocol Management
In regulated wet-lab and bioprocessing environments (GLP, GMP, ISO 17025), experimental reproducibility requires strict separation between Master Protocol Blueprints and Executed Experimental Instances. The BioLabCalc SOP subsystem (biolabcalc.eln.services.sop_service, biolabcalc.eln.api.routes.sops) enforces GxP compliance through formal semantic versioning, electronic Principal Investigator (PI) sign-offs, immutable execution forking, interactive step checkoffs, and kinetic timer integration.
Master SOPs represent approved, standard protocols maintained in the master catalog. Each SOP combines high-level Markdown procedural documentation with machine-readable parameter definitions and sequential step checklists.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Master SOP Entity (`MasterSOP`) β
βββββββββββββββββββ¬ββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββ€
β SOP ID β Title β Version β Status β
β (SOP-EXP-001) β T7RNAP Express β Semantic (1.2) β draft/approved β
βββββββββββββββββββ΄ββββββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββ€
β Description & Formatted Markdown Instructions β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Default Parameter Blueprint: β
β { "host_strain": "BL21(DE3)", "induction_temp_c": 18.0, ... } β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Structured Step Pipeline (`List[SOPStep]`): β
β βββββββ¬βββββββββββββββββββββββ¬ββββββββββββββ¬ββββββββββββββββββββββββββ β
β β # β Step Name β Planned Min β Checkpoint Parameters β β
β βββββββΌβββββββββββββββββββββββΌββββββββββββββΌββββββββββββββββββββββββββ€ β
β β 1 β Seed Culture Inoc β 15.0 min β 50 mL LB + 50 Β΅g/mL Kan β β
β β 2 β Bioreactor Scaling β 240.0 min β 37.0Β°C, 220 RPM, OD 0.6 β β
β β 3 β IPTG Induction β 10.0 min β 0.5 mM IPTG, cool to 18Β°β β
β β 4 β Overnight Expression β 960.0 min β 18.0Β°C, 180 RPM β β
β β 5 β Cell Harvest Centrif β 30.0 min β 4Β°C, 6000 x g, 20 min β β
β βββββββ΄βββββββββββββββββββββββ΄ββββββββββββββ΄ββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
from biolabcalc.eln.services.sop_service import get_sop_service
sop_service = get_sop_service()
# Register a master protocol
sop = sop_service.create_sop(
sop_id="SOP-EXP-T7RNAP-001",
title="High-Density Recombinant T7 RNA Polymerase Expression",
version="1.0",
category="Expression",
description="Standardized fed-batch protocol for pET-28a-T7RNAP in E. coli BL21(DE3).",
parameters={
"host_strain": "BL21(DE3)",
"antibiotic": "Kanamycin 50 ug/mL",
"target_induction_od600": 0.65,
"iptg_concentration_mm": 0.5,
"induction_temp_celsius": 18.0,
"expression_duration_hours": 16.0,
},
steps=[
{
"step_index": 1,
"name": "Primary Inoculation",
"instruction": "Inoculate 50 mL sterile LB broth containing 50 ug/mL kanamycin with a single fresh colony.",
"planned_duration_minutes": 15.0,
"parameters": {"media": "LB", "volume_ml": 50},
},
{
"step_index": 2,
"name": "Biomass Growth to Mid-Log Phase",
"instruction": "Incubate culture at 37.0Β°C, 220 RPM until OD600 reaches 0.60 - 0.70.",
"planned_duration_minutes": 210.0,
"parameters": {"temp_c": 37.0, "rpm": 220, "target_od": 0.65},
},
{
"step_index": 3,
"name": "Temperature Shift & IPTG Induction",
"instruction": "Transfer flasks to 18Β°C shaker for 30 minutes to equilibrate, then add IPTG to 0.5 mM final.",
"planned_duration_minutes": 40.0,
"parameters": {"temp_c": 18.0, "iptg_mm": 0.5},
},
{
"step_index": 4,
"name": "Overnight Induction & Harvest",
"instruction": "Express for 16 hours at 18Β°C. Pellet cells at 6,000 x g for 20 minutes at 4Β°C.",
"planned_duration_minutes": 980.0,
"parameters": {"centrifuge_rcf": 6000, "duration_min": 20},
},
],
created_by="researcher_alice",
)BioLabCalc enforces a formal governance lifecycle across all SOPs:
ββββββββββββββββ PI Approval βββββββββββββββββββ Deprecation ββββββββββββββββββ
β Draft β βββββββββββββββββββ> β Approved β ββββββββββββββββ> β Deprecated β
β (In Edit) β Electronic Sign β (Executable GxP)β New Version β (Historical) β
ββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββ
-
Semantic Versioning Semantics:
-
Patch Release (
1.0$\rightarrow$ 1.0.1): Clarifications, typographical corrections, safety equipment notes; does not alter chemical stoichiometry or execution steps. -
Minor Release (
1.0$\rightarrow$ 1.1): Additions of optional wash steps, non-critical buffer adjustments, or modified incubation temperature tolerances ($\pm 1.0^\circ\text{C}$ ). -
Major Release (
1.0$\rightarrow$ 2.0): Changes to host strain, column chromatography resin (e.g., Ni-NTA to Co-TALON), lysis mechanics, or reaction chemistry.
-
Patch Release (
-
Electronic PI Sign-Off:
Before an SOP can be instantiated into daily bench execution runs, a user holding the
principal_investigatororlab_managerrole must authorize it:This operation transitions the SOP status fromapproved_sop = sop_service.approve_sop( sop_id="SOP-EXP-T7RNAP-001", approver_id="prof_franklin", )
drafttoapprovedand writes an immutable, timestamped event to the cryptographic audit trail recording the approver's identity and signed version.
In historical research notebooks, altering a master protocol after experiments have completed can retroactively falsify or obscure past methodology. BioLabCalc eliminates this risk through Immutable Execution Forking:
Master SOP: SOP-EXP-T7RNAP-001 (Version 1.0)
β
βββΊ Execution Fork FORK-001 (Campaign CMP-2026-T7, Day 1) [FROZEN]
β βββ Locked Parameters: { "induction_temp_celsius": 18.0, ... }
β βββ Execution Checklist: Steps 1..4 (Completed by Operator Alice)
β
βΌ (PI updates Master SOP to Version 2.0 with Cobalt resin)
Master SOP: SOP-EXP-T7RNAP-001 (Version 2.0)
β
βββΊ Execution Fork FORK-002 (Campaign CMP-2026-T7, Day 4) [FROZEN]
βββ Locked Parameters: { "resin": "TALON-Cobalt", ... }
βββ Execution Checklist: Steps 1..4 (In Progress by Operator Bob)
When an operator begins Day 1 of an experimental campaign, the ELN creates an isolated SOPFork:
fork = sop_service.fork_sop_for_entry(
sop_id="SOP-EXP-T7RNAP-001",
entry_id="ENTRY-CAMP-T7-D1",
forked_by="researcher_alice",
parameter_overrides={
"induction_temp_celsius": 16.0 # Approved run-specific optimization
},
)
print(f"Created Execution Fork: {fork.fork_id} (Version {fork.sop_version})")-
Approved Status Enforcement: To enforce GxP compliance,
fork_sop_for_entryvalidates that the target master SOP hasapprovedstatus. Attempting to fork an SOP withdraftordeprecatedstatus raisesValueError(Cannot fork SOP '{sop_id}' with status '{status}'. Only approved SOPs can be executed in experimental entries.). - Parameter Snapshot: Master default parameters are deep-copied and merged with any authorized parameter overrides. The resulting dictionary is permanently locked.
-
Independent Checklist: The step definitions are deep-copied into individual
StepExecutioninstances with pending statuses.
During laboratory execution, operators check off steps in real time via the web interface or REST API.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Step 2: Biomass Growth to Mid-Log Phase [ COMPLETED ] β
β Instruction: Incubate culture at 37.0Β°C, 220 RPM until OD600 reaches 0.60 - 0.70. β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Planned Duration: 210.0 min β Actual Duration: 235.0 min (Deviation: +25.0 min) β
β Completed By: alice_r β Timestamp: 2026-11-12T14:35:10Z β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β οΈ Protocol Deviation Logged: β
β "Culture growth was slower than anticipated due to initial incubator lag at 35.5Β°C. β
β Induction delayed until target OD600 (0.64) was verified by spectrophotometer." β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
updated_fork = sop_service.checkoff_step(
fork_id="FORK-SOP-EXP-T7RNAP-001-A48F91",
step_index=2,
completed_by="alice_r",
actual_duration_minutes=235.0,
deviation_notes="Incubator took 25 minutes longer to reach target OD600 of 0.64.",
)Regulatory guidelines mandate that any departure from written procedure must be documented, justified, and reviewed:
-
Planned vs. Actual Delta: The system automatically computes and displays the variance between
planned_duration_minutesandactual_duration_minutes. - Mandatory Deviation Rationale: If actual duration or parameter measurements fall outside pre-configured tolerances, the UI requires the operator to provide an explanation before the checkoff is accepted.
-
Audit Ledger Coupling: Every checkoff event generates a
STEP_CHECKOFFaudit event containing the exact timestamp, actor ID, duration metrics, and deviation text.
The ELN web interface features an integrated kinetic timer engine (eln/web/static/timer_widget.js) directly synchronized with SOP execution steps:
- Multi-Timer Parallel Tracking: Run multiple incubation, digestion, and centrifuge countdowns simultaneously across different benches.
-
Step Duration Pre-population: Clicking a step's timer icon automatically initializes the timer to
planned_duration_minutes. - Elapsed Countup & Overtime Warning: If an incubation timer expires, it immediately transitions to a flashing amber/red overtime countup, alerting the scientist to the exact duration of over-incubation.
- Web Audio Synthesis: Built-in harmonic frequency beeps fire across standard computer or mobile speakers upon milestone completion without relying on external MP3 assets.
The SOP router (biolabcalc.eln.api.routes.sops) exposes the following endpoints:
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/sops |
List all Master SOPs, filterable by category and status. |
POST |
/api/sops |
Create a new master SOP blueprint (Draft status). |
GET |
/api/sops/{sop_id} |
Retrieve complete master SOP details and step checklist. |
POST |
/api/sops/{sop_id}/approve |
Principal Investigator authorization sign-off. |
POST |
/api/sops/{sop_id}/fork |
Instantiate an immutable execution fork for an experiment. |
GET |
/api/sops/forks/{fork_id} |
Retrieve real-time progress and checklist of an execution fork. |
POST |
/api/sops/forks/{fork_id}/checkoff |
Record step completion, operator signature, duration, and deviation. |
- Electronic Lab Notebook (ELN) β System architecture and web SPA overview.
- GxP Compliance & Audit Trails β Audit ledger hashing, 21 CFR Part 11, and electronic signatures.
- Inventory & Freezer LIMS β Linking SOP execution yields to freezer tubes and aliquots.
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