Sync from GitHub (main)
Browse files- .gitignore +1 -0
- .pre-commit-config.yaml +13 -0
- README.md +46 -0
- labels.json +16 -0
- prompts/planner_system.txt +7 -0
- prompts/reviewer_system.txt +7 -0
- pyproject.toml +28 -0
- qPCR.md +26 -0
- ruodisclaimer.txt +1 -0
- src/protocol_pilot/__init__.py +5 -0
- src/protocol_pilot/bom.py +33 -0
- src/protocol_pilot/extract.py +72 -0
- src/protocol_pilot/guards.py +13 -0
- src/protocol_pilot/schema.py +38 -0
- tests/test_schema.py +26 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Python
|
.pre-commit-config.yaml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
repos:
|
| 2 |
+
- repo: https://github.com/psf/black
|
| 3 |
+
rev: 24.4.2
|
| 4 |
+
hooks:
|
| 5 |
+
- id: black
|
| 6 |
+
- repo: https://github.com/PyCQA/isort
|
| 7 |
+
rev: 5.13.2
|
| 8 |
+
hooks:
|
| 9 |
+
- id: isort
|
| 10 |
+
- repo: https://github.com/pycqa/flake8
|
| 11 |
+
rev: 7.1.1
|
| 12 |
+
hooks:
|
| 13 |
+
- id: flake8
|
README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ProtocolPilot (RUO)
|
| 2 |
+
|
| 3 |
+
Convert papers/preprints into draft, **research-use-only** lab protocols with a structured schema, auto-generated Bill of Materials (BOM), guardrails, and CI. Designed to pair with async agents (e.g., Open SWE) that open pull requests instead of just chatting.
|
| 4 |
+
|
| 5 |
+
## Quick start
|
| 6 |
+
|
| 7 |
+
**Requirements**: Python 3.11+, GitHub repo, (optional) Open SWE + Daytona for async runs.
|
| 8 |
+
|
| 9 |
+
```bash
|
| 10 |
+
# Clone and set up
|
| 11 |
+
uv venv -p 3.11 # or python -m venv .venv
|
| 12 |
+
source .venv/bin/activate
|
| 13 |
+
pip install -U uv || true
|
| 14 |
+
uv pip install -e .
|
| 15 |
+
pre-commit install
|
| 16 |
+
pytest -q
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
## Typical flow
|
| 20 |
+
1. Open a GitHub Issue using the "ProtocolPilot task" template and include links to PDFs/DOIs and constraints.
|
| 21 |
+
2. Agent (or you) runs the extractor → planner → programmer → reviewer flow.
|
| 22 |
+
3. A PR adds `protocols/<slug>.md`, `env/conda.yaml` (optional), `tests/` updates, and a BOM JSON/CSV.
|
| 23 |
+
4. You edit, request changes, and merge when satisfied.
|
| 24 |
+
|
| 25 |
+
## Open SWE integration (labels)
|
| 26 |
+
- Add labels from `labels.json` to your repo.
|
| 27 |
+
- To run **with plan approval**: label an Issue `open-swe`.
|
| 28 |
+
- To run **auto-execute**: label `open-swe-auto` (use sparingly).
|
| 29 |
+
|
| 30 |
+
## Safety & scope
|
| 31 |
+
- RUO only; no patient data; no diagnostic/treatment claims.
|
| 32 |
+
- PRs include a RUO disclaimer and the guardrails checker blocks unsafe language.
|
| 33 |
+
|
| 34 |
+
## Commands
|
| 35 |
+
```bash
|
| 36 |
+
# Validate a protocol Markdown against the schema
|
| 37 |
+
python -m protocol_pilot.extract --validate protocols/examples/qPCR.md
|
| 38 |
+
|
| 39 |
+
# Generate a BOM stub from a protocol (to JSON)
|
| 40 |
+
python -m protocol_pilot.bom protocols/examples/qPCR.md --out bom.json
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
## Contributing
|
| 44 |
+
- Keep protocol steps numbered, measurable, and source-cited.
|
| 45 |
+
- Prefer SI units and temperatures in °C.
|
| 46 |
+
- Use PRs; auto-merge should remain off.
|
labels.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"open-swe": {
|
| 3 |
+
"color": "0E8A16",
|
| 4 |
+
"description": "Plan \u2192 human approval \u2192 execute"
|
| 5 |
+
},
|
| 6 |
+
"open-swe-auto": {
|
| 7 |
+
"color": "1F77B4",
|
| 8 |
+
"description": "Auto-execute when safe"
|
| 9 |
+
},
|
| 10 |
+
"protocols": {
|
| 11 |
+
"color": "5319E7"
|
| 12 |
+
},
|
| 13 |
+
"ruo": {
|
| 14 |
+
"color": "B60205"
|
| 15 |
+
}
|
| 16 |
+
}
|
prompts/planner_system.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are the Planner in a multi-agent workflow that converts scientific methods into a RUO protocol.
|
| 2 |
+
Constraints:
|
| 3 |
+
- RUO only. No clinical/diagnostic claims. No patient-specific guidance.
|
| 4 |
+
- Produce: title, sources[], reagents[], equipment[], steps[] with measurable actions, safety_notes[], and a bill-of-materials proposal.
|
| 5 |
+
- SI units; temperatures in °C; durations in minutes; explicit ranges.
|
| 6 |
+
- Flag any missing info as TODOs.
|
| 7 |
+
Output: A structured plan that a Programmer can implement into Markdown + JSON.
|
prompts/reviewer_system.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are the Reviewer. Your job is to block unsafe or low-quality outputs before PR.
|
| 2 |
+
Checklist:
|
| 3 |
+
- Contains RUO disclaimer.
|
| 4 |
+
- No diagnostic/treatment language; no PHI.
|
| 5 |
+
- Steps are numbered, measurable, and feasible; units consistent; ranges plausible.
|
| 6 |
+
- BOM has generic + 2 vendor alternatives where possible.
|
| 7 |
+
If any check fails, return a blocking report with line numbers and fix suggestions.
|
pyproject.toml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[build-system]
|
| 2 |
+
requires = ["setuptools>=68", "wheel"]
|
| 3 |
+
build-backend = "setuptools.build_meta"
|
| 4 |
+
|
| 5 |
+
[project]
|
| 6 |
+
name = "protocol-pilot"
|
| 7 |
+
version = "0.1.0"
|
| 8 |
+
description = "RUO protocol extraction, schema, and tooling"
|
| 9 |
+
readme = "README.md"
|
| 10 |
+
authors = [{name = "ProtocolPilot"}]
|
| 11 |
+
requires-python = ">=3.11"
|
| 12 |
+
dependencies = [
|
| 13 |
+
"pydantic>=2.7",
|
| 14 |
+
"markdown-it-py>=3.0",
|
| 15 |
+
"jsonschema>=4.22",
|
| 16 |
+
"click>=8.1",
|
| 17 |
+
"python-slugify>=8.0",
|
| 18 |
+
"pre-commit>=3.7",
|
| 19 |
+
]
|
| 20 |
+
|
| 21 |
+
[tool.setuptools]
|
| 22 |
+
package-dir = {"" = "src"}
|
| 23 |
+
|
| 24 |
+
[tool.setuptools.packages.find]
|
| 25 |
+
where = ["src"]
|
| 26 |
+
|
| 27 |
+
[tool.pytest.ini_options]
|
| 28 |
+
addopts = "-q"
|
qPCR.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
> Research Use Only (RUO). Not for use in diagnostic procedures or patient care.
|
| 2 |
+
|
| 3 |
+
# qPCR for gene expression (example template)
|
| 4 |
+
|
| 5 |
+
**Sources**: DOI:xx.xxxx/xxxx; Preprint: <link>
|
| 6 |
+
|
| 7 |
+
## Equipment
|
| 8 |
+
- qPCR thermocycler
|
| 9 |
+
- Calibrated micropipettes (P10, P200)
|
| 10 |
+
|
| 11 |
+
## Reagents (example)
|
| 12 |
+
- SYBR Green Master Mix — 1x final
|
| 13 |
+
- Forward primer (10 µM); Reverse primer (10 µM)
|
| 14 |
+
- cDNA template
|
| 15 |
+
|
| 16 |
+
## Steps
|
| 17 |
+
1. Thaw reagents on ice (≈10 min). Mix by gentle inversion.
|
| 18 |
+
2. Prepare master mix (per 20 µL reaction): 10 µL SYBR mix; 0.8 µL fwd primer; 0.8 µL rev primer; x µL template; nuclease-free water to 20 µL.
|
| 19 |
+
3. Plate reactions; seal; brief spin.
|
| 20 |
+
4. Thermocycler program: 95 °C 2 min; 40 cycles of [95 °C 15 s, 60 °C 60 s]; melt curve.
|
| 21 |
+
|
| 22 |
+
## Safety notes
|
| 23 |
+
- Wear PPE; handle reagents per SDS.
|
| 24 |
+
|
| 25 |
+
## Bill of Materials (example)
|
| 26 |
+
- SYBR mix (generic), Alt1: Vendor A cat#..., Alt2: Vendor B cat#...
|
ruodisclaimer.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Research Use Only (RUO). Not for use in diagnostic procedures or patient care. Outputs are drafts for expert review; you are responsible for validation and safety.
|
src/protocol_pilot/__init__.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__all__ = [
|
| 2 |
+
"Protocol", "Step", "Reagent",
|
| 3 |
+
"validate_protocol",
|
| 4 |
+
]
|
| 5 |
+
from .schema import Protocol, Step, Reagent, validate_protocol
|
src/protocol_pilot/bom.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
import json
|
| 3 |
+
import click
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from slugify import slugify
|
| 6 |
+
from .extract import parse_markdown
|
| 7 |
+
|
| 8 |
+
DEFAULT_ALTS = [
|
| 9 |
+
{"vendor": "Vendor A", "catalog_number": "TBD"},
|
| 10 |
+
{"vendor": "Vendor B", "catalog_number": "TBD"},
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
@click.command()
|
| 14 |
+
@click.argument("protocol_md", type=click.Path(exists=True))
|
| 15 |
+
@click.option("--out", "out_path", type=click.Path(), help="Output JSON file")
|
| 16 |
+
def main(protocol_md, out_path):
|
| 17 |
+
proto = parse_markdown(Path(protocol_md).read_text(encoding="utf-8"))
|
| 18 |
+
items = []
|
| 19 |
+
for r in proto.reagents:
|
| 20 |
+
items.append({
|
| 21 |
+
"name": r.name,
|
| 22 |
+
"amount": r.amount,
|
| 23 |
+
"unit": r.unit,
|
| 24 |
+
"alternatives": DEFAULT_ALTS,
|
| 25 |
+
})
|
| 26 |
+
payload = {"protocol": slugify(proto.title), "items": items}
|
| 27 |
+
if out_path:
|
| 28 |
+
Path(out_path).write_text(json.dumps(payload, indent=2), encoding="utf-8")
|
| 29 |
+
else:
|
| 30 |
+
print(json.dumps(payload, indent=2))
|
| 31 |
+
|
| 32 |
+
if __name__ == "__main__":
|
| 33 |
+
main()
|
src/protocol_pilot/extract.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
import re
|
| 3 |
+
import json
|
| 4 |
+
import click
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
from markdown_it import MarkdownIt
|
| 7 |
+
from .schema import Protocol, Step, Reagent, validate_protocol
|
| 8 |
+
|
| 9 |
+
md = MarkdownIt()
|
| 10 |
+
|
| 11 |
+
RUO_PREFIX = "Research Use Only (RUO)."
|
| 12 |
+
|
| 13 |
+
def parse_markdown(md_text: str) -> Protocol:
|
| 14 |
+
# Very light parser for the example template
|
| 15 |
+
title_match = re.search(r"^#\s+(.+)$", md_text, re.M)
|
| 16 |
+
title = title_match.group(1).strip() if title_match else "Untitled Protocol"
|
| 17 |
+
|
| 18 |
+
sources = re.findall(r"^\*\*Sources\*\*:([^\n]+)$", md_text, re.M)
|
| 19 |
+
sources = [s.strip() for s in ",".join(sources).split(",") if s.strip()] or []
|
| 20 |
+
|
| 21 |
+
equipment_section = re.search(r"## Equipment\n([\s\S]*?)\n##", md_text)
|
| 22 |
+
equipment = []
|
| 23 |
+
if equipment_section:
|
| 24 |
+
equipment = [l.strip("- ") for l in equipment_section.group(1).splitlines() if l.strip().startswith("-")]
|
| 25 |
+
|
| 26 |
+
reagents_section = re.search(r"## Reagents[\s\S]*?\n([\s\S]*?)\n##", md_text)
|
| 27 |
+
reagents = []
|
| 28 |
+
if reagents_section:
|
| 29 |
+
for l in reagents_section.group(1).splitlines():
|
| 30 |
+
if l.strip().startswith("-"):
|
| 31 |
+
name = l.strip("- ").strip()
|
| 32 |
+
reagents.append(Reagent(name=name))
|
| 33 |
+
|
| 34 |
+
# Steps
|
| 35 |
+
steps = []
|
| 36 |
+
for i, m in enumerate(re.finditer(r"^\d+\.\s+(.+)$", md_text, re.M), start=1):
|
| 37 |
+
steps.append(Step(number=i, description=m.group(1).strip()))
|
| 38 |
+
|
| 39 |
+
# Safety
|
| 40 |
+
safety = []
|
| 41 |
+
safety_sec = re.search(r"## Safety notes\n([\s\S]*?)\n##|$", md_text)
|
| 42 |
+
if safety_sec:
|
| 43 |
+
for l in safety_sec.group(1).splitlines():
|
| 44 |
+
if l.strip().startswith("-"):
|
| 45 |
+
safety.append(l.strip("- ").strip())
|
| 46 |
+
|
| 47 |
+
disclaimer = "Research Use Only (RUO). Not for use in diagnostic procedures or patient care."
|
| 48 |
+
|
| 49 |
+
return Protocol(
|
| 50 |
+
title=title,
|
| 51 |
+
sources=sources,
|
| 52 |
+
equipment=equipment,
|
| 53 |
+
reagents=reagents,
|
| 54 |
+
steps=steps,
|
| 55 |
+
safety_notes=safety,
|
| 56 |
+
ruo_disclaimer=disclaimer,
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
@click.command()
|
| 60 |
+
@click.argument("path", type=click.Path(exists=True))
|
| 61 |
+
@click.option("--validate", "do_validate", is_flag=True, help="Validate after parsing")
|
| 62 |
+
@click.option("--json-out", "json_out", is_flag=True, help="Print JSON to stdout")
|
| 63 |
+
def main(path, do_validate, json_out):
|
| 64 |
+
text = Path(path).read_text(encoding="utf-8")
|
| 65 |
+
proto = parse_markdown(text)
|
| 66 |
+
if do_validate:
|
| 67 |
+
validate_protocol(proto)
|
| 68 |
+
if json_out:
|
| 69 |
+
click.echo(proto.model_dump_json(indent=2))
|
| 70 |
+
|
| 71 |
+
if __name__ == "__main__":
|
| 72 |
+
main()
|
src/protocol_pilot/guards.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
import re
|
| 3 |
+
|
| 4 |
+
BANNED_PATTERNS = [
|
| 5 |
+
r"diagnos(e|is|tic)",
|
| 6 |
+
r"treat(ment|ing)?",
|
| 7 |
+
r"patient\-specific",
|
| 8 |
+
r"clinical decision",
|
| 9 |
+
]
|
| 10 |
+
|
| 11 |
+
def contains_banned_language(text: str) -> bool:
|
| 12 |
+
text_low = text.lower()
|
| 13 |
+
return any(re.search(p, text_low) for p in BANNED_PATTERNS)
|
src/protocol_pilot/schema.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
from typing import List, Optional
|
| 3 |
+
from pydantic import BaseModel, Field, ValidationError, model_validator
|
| 4 |
+
|
| 5 |
+
class Reagent(BaseModel):
|
| 6 |
+
name: str
|
| 7 |
+
amount: Optional[float] = Field(default=None, description="Numeric amount if known")
|
| 8 |
+
unit: Optional[str] = Field(default=None, description="Unit for amount, e.g., µL, mg, mM")
|
| 9 |
+
vendor: Optional[str] = None
|
| 10 |
+
catalog_number: Optional[str] = None
|
| 11 |
+
|
| 12 |
+
class Step(BaseModel):
|
| 13 |
+
number: int
|
| 14 |
+
description: str
|
| 15 |
+
duration_minutes: Optional[float] = None
|
| 16 |
+
temperature_c: Optional[float] = None
|
| 17 |
+
hazards: List[str] = []
|
| 18 |
+
|
| 19 |
+
class Protocol(BaseModel):
|
| 20 |
+
title: str
|
| 21 |
+
sources: List[str]
|
| 22 |
+
equipment: List[str] = []
|
| 23 |
+
reagents: List[Reagent] = []
|
| 24 |
+
steps: List[Step]
|
| 25 |
+
safety_notes: List[str] = []
|
| 26 |
+
ruo_disclaimer: str
|
| 27 |
+
|
| 28 |
+
@model_validator(mode="after")
|
| 29 |
+
def check_steps_sequential(self):
|
| 30 |
+
nums = [s.number for s in self.steps]
|
| 31 |
+
if nums != list(range(1, len(nums) + 1)):
|
| 32 |
+
raise ValueError("Steps must be sequential starting at 1")
|
| 33 |
+
return self
|
| 34 |
+
|
| 35 |
+
def validate_protocol(proto: Protocol) -> None:
|
| 36 |
+
"""Raises ValidationError if invalid."""
|
| 37 |
+
if not proto.ruo_disclaimer.lower().startswith("research use only"):
|
| 38 |
+
raise ValidationError([{"loc":("ruo_disclaimer",), "msg":"Missing RUO disclaimer"}], Protocol)
|
tests/test_schema.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from protocol_pilot.schema import Protocol, Step, Reagent, validate_protocol
|
| 2 |
+
|
| 3 |
+
def test_minimal_protocol_valid():
|
| 4 |
+
p = Protocol(
|
| 5 |
+
title="Example",
|
| 6 |
+
sources=["DOI:10.0000/example"],
|
| 7 |
+
equipment=["pipette"],
|
| 8 |
+
reagents=[Reagent(name="water")],
|
| 9 |
+
steps=[Step(number=1, description="Do a thing.")],
|
| 10 |
+
safety_notes=["Wear PPE"],
|
| 11 |
+
ruo_disclaimer="Research Use Only (RUO). Not for use in diagnostic procedures or patient care.",
|
| 12 |
+
)
|
| 13 |
+
validate_protocol(p) # should not raise
|
| 14 |
+
|
| 15 |
+
def test_steps_must_be_sequential():
|
| 16 |
+
try:
|
| 17 |
+
Protocol(
|
| 18 |
+
title="Bad",
|
| 19 |
+
sources=["x"],
|
| 20 |
+
steps=[Step(number=2, description="oops")],
|
| 21 |
+
ruo_disclaimer="Research Use Only (RUO).",
|
| 22 |
+
)
|
| 23 |
+
except Exception:
|
| 24 |
+
assert True
|
| 25 |
+
else:
|
| 26 |
+
assert False, "Expected an error for non-sequential steps"
|