proef 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- proef/__init__.py +25 -0
- proef/acquisition.py +244 -0
- proef/ad.py +159 -0
- proef/adapters/__init__.py +0 -0
- proef/adapters/admet.py +196 -0
- proef/adapters/bio/__init__.py +0 -0
- proef/adapters/bio/rdkit_ops.py +52 -0
- proef/adapters/bio/safety_rules.json +146 -0
- proef/adapters/bio/seq_alerts.py +79 -0
- proef/adapters/bio/structure_score.py +85 -0
- proef/adapters/bio/tox_alerts.py +99 -0
- proef/adapters/data/__init__.py +0 -0
- proef/adapters/data/admet.py +62 -0
- proef/adapters/data/chembl.py +110 -0
- proef/adapters/data/frozen/admet/MANIFEST.json +48 -0
- proef/adapters/data/frozen/admet/bbb_martins/test.csv +407 -0
- proef/adapters/data/frozen/admet/bbb_martins/train_val.csv +1625 -0
- proef/adapters/data/frozen/admet/caco2_wang/test.csv +183 -0
- proef/adapters/data/frozen/admet/caco2_wang/train_val.csv +729 -0
- proef/adapters/data/frozen/admet/hia_hou/test.csv +118 -0
- proef/adapters/data/frozen/admet/hia_hou/train_val.csv +462 -0
- proef/adapters/data/moleculenet.py +60 -0
- proef/adapters/databases/__init__.py +0 -0
- proef/adapters/databases/chembl_gates.py +121 -0
- proef/adapters/databases/chembl_lookup.py +35 -0
- proef/adapters/databases/open_targets.py +102 -0
- proef/adapters/databases/pubmed.py +94 -0
- proef/adapters/devices/__init__.py +0 -0
- proef/adapters/devices/ezo_ph.py +251 -0
- proef/adapters/devices/hcs_microscope.py +143 -0
- proef/adapters/devices/lcms.py +123 -0
- proef/adapters/devices/scheduler.py +84 -0
- proef/adapters/devices/sila2.py +134 -0
- proef/adapters/genomics/alphagenome.py +146 -0
- proef/adapters/lab/__init__.py +0 -0
- proef/adapters/lab/bioprocess.py +32 -0
- proef/adapters/lab/devices.py +170 -0
- proef/adapters/lab/imaging.py +226 -0
- proef/adapters/lab/mhs_driver.py +124 -0
- proef/adapters/lab/opentrons.py +222 -0
- proef/adapters/lab/ot2_sim.py +174 -0
- proef/adapters/lab/plate_reader_share.py +108 -0
- proef/adapters/lab/protein_design.py +199 -0
- proef/adapters/lab/recording.py +119 -0
- proef/adapters/lab/replay.py +107 -0
- proef/adapters/lab/simulator.py +282 -0
- proef/adapters/lab/synthesis.py +92 -0
- proef/adapters/models/__init__.py +0 -0
- proef/adapters/models/anthropic_provider.py +157 -0
- proef/adapters/models/assayloop_ranker.py +67 -0
- proef/adapters/models/from_env.py +93 -0
- proef/adapters/models/gp_policy.py +93 -0
- proef/adapters/models/gp_policy_gp.py +36 -0
- proef/adapters/models/llm_policy.py +187 -0
- proef/adapters/models/openai_compat.py +150 -0
- proef/adapters/models/sklearn_policy.py +65 -0
- proef/adapters/retrosynthesis.py +247 -0
- proef/adapters/sandbox/__init__.py +20 -0
- proef/adapters/sandbox/agentenv.py +145 -0
- proef/adapters/sandbox/docker.py +217 -0
- proef/adapters/sandbox/local.py +164 -0
- proef/adapters/sandbox/opensandbox.py +122 -0
- proef/adapters/store/__init__.py +0 -0
- proef/adapters/store/sqlite.py +207 -0
- proef/adaptive.py +108 -0
- proef/advisory.py +76 -0
- proef/analysis_profiles/__init__.py +8 -0
- proef/analysis_profiles/measurements.py +266 -0
- proef/analysis_profiles/plate_assay.py +316 -0
- proef/analysis_report.py +195 -0
- proef/analysis_store.py +183 -0
- proef/anchor.py +154 -0
- proef/api/app.py +107 -0
- proef/api/launch.py +170 -0
- proef/api/v1/__init__.py +29 -0
- proef/api/v1/analyses.py +367 -0
- proef/api/v1/campaigns.py +802 -0
- proef/api/v1/deps.py +10 -0
- proef/api/v1/evals.py +16 -0
- proef/api/v1/evidence.py +132 -0
- proef/api/v1/governance.py +35 -0
- proef/api/v1/inbox.py +119 -0
- proef/api/v1/lab.py +110 -0
- proef/api/v1/pauses.py +77 -0
- proef/api/v1/programs.py +397 -0
- proef/api/v1/results.py +147 -0
- proef/api/v1/schemas.py +932 -0
- proef/api/v1/system.py +79 -0
- proef/api/v1/trees.py +216 -0
- proef/api/wizard_sessions.py +253 -0
- proef/approvals.py +102 -0
- proef/assays/__init__.py +15 -0
- proef/assays/dls.py +114 -0
- proef/assays/dsf.py +81 -0
- proef/assays/elisa.py +58 -0
- proef/assays/properties.py +65 -0
- proef/assays/simulate.py +157 -0
- proef/audit.py +152 -0
- proef/autoloop.py +1620 -0
- proef/benchmark.py +442 -0
- proef/campaign_fsm.py +151 -0
- proef/citations.py +141 -0
- proef/cli.py +1249 -0
- proef/connect.py +74 -0
- proef/core/__init__.py +0 -0
- proef/core/contracts/__init__.py +35 -0
- proef/core/contracts/analysis.py +100 -0
- proef/core/contracts/models.py +395 -0
- proef/core/device_card.py +125 -0
- proef/core/hypothesis.py +720 -0
- proef/core/interfaces.py +164 -0
- proef/core/registry.py +123 -0
- proef/core/safety.py +324 -0
- proef/core/workflow.py +159 -0
- proef/critic.py +62 -0
- proef/demo.py +164 -0
- proef/derivation.py +128 -0
- proef/diary.py +301 -0
- proef/eln.py +87 -0
- proef/evals/__init__.py +1 -0
- proef/evals/hallucination.py +86 -0
- proef/evals/harness.py +358 -0
- proef/evals/orchestration.py +254 -0
- proef/evals/tasks.py +1010 -0
- proef/evals/toolcalls.py +425 -0
- proef/experiment.py +172 -0
- proef/experiment_analysis.py +114 -0
- proef/experiments/__init__.py +0 -0
- proef/experiments/grounding_exp.py +689 -0
- proef/figures.py +218 -0
- proef/fitting.py +309 -0
- proef/fixtures.py +140 -0
- proef/flywheel.py +125 -0
- proef/followup.py +126 -0
- proef/governance.py +290 -0
- proef/groundedness.py +361 -0
- proef/grounding.py +202 -0
- proef/hypothesis_agent.py +369 -0
- proef/ingest.py +157 -0
- proef/instruments.json +173 -0
- proef/interpret.py +95 -0
- proef/kinetic.py +102 -0
- proef/labread/__init__.py +45 -0
- proef/labread/analysis.py +428 -0
- proef/labread/common.py +153 -0
- proef/labread/formats.py +190 -0
- proef/labread/layout.py +168 -0
- proef/labread/pubchem.py +179 -0
- proef/labselect.py +431 -0
- proef/materials.py +140 -0
- proef/mcp_instrument.py +396 -0
- proef/mcp_server.py +283 -0
- proef/modality.py +111 -0
- proef/model_guard.py +245 -0
- proef/output_blocks.py +183 -0
- proef/paths.py +32 -0
- proef/physfail.py +55 -0
- proef/plan.py +160 -0
- proef/plots.py +123 -0
- proef/predictors.py +217 -0
- proef/probes.py +79 -0
- proef/problem_tree.py +581 -0
- proef/program.py +308 -0
- proef/protocol_design.py +42 -0
- proef/proxy.py +78 -0
- proef/readiness.py +259 -0
- proef/reliability.py +49 -0
- proef/report.py +117 -0
- proef/reproduce.py +310 -0
- proef/reviewer.py +254 -0
- proef/sandbox_session.py +247 -0
- proef/sandboxd.py +109 -0
- proef/scaffold.py +195 -0
- proef/series.py +327 -0
- proef/skills.py +203 -0
- proef/sweep.py +83 -0
- proef/taste.py +177 -0
- proef/templates/confirmatory-followup.json +34 -0
- proef/templates/dose-response-screen.json +39 -0
- proef/templates/sar-exploration.json +38 -0
- proef/templates.py +124 -0
- proef/toolkit.py +433 -0
- proef/toolloop.py +133 -0
- proef/tools.py +441 -0
- proef/tpp.py +185 -0
- proef/views/__init__.py +14 -0
- proef/views/counts.py +102 -0
- proef/views/experiment.py +154 -0
- proef/views/ids.py +49 -0
- proef/views/narrative.py +294 -0
- proef/views/pipeline.py +370 -0
- proef/vision.py +165 -0
- proef/watch.py +790 -0
- proef/wizard_chain.py +25 -0
- proef/wizard_store.py +373 -0
- proef-0.2.0.dist-info/METADATA +662 -0
- proef-0.2.0.dist-info/RECORD +200 -0
- proef-0.2.0.dist-info/WHEEL +4 -0
- proef-0.2.0.dist-info/entry_points.txt +14 -0
- proef-0.2.0.dist-info/licenses/LICENSE +202 -0
proef/api/v1/schemas.py
ADDED
|
@@ -0,0 +1,932 @@
|
|
|
1
|
+
"""API v1 response models, the single source of truth for the workbench
|
|
2
|
+
contract. The TypeScript client is GENERATED from the OpenAPI these produce."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Annotated, Any, Literal
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, Field, field_validator
|
|
8
|
+
|
|
9
|
+
State = Literal["confirmed", "validated", "abstained", "refuted", "refused",
|
|
10
|
+
"in_lab", "selected", "not_selected", "proposed"]
|
|
11
|
+
VerdictStatus = Literal["confirmed", "validated", "abstained", "refuted"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# a 2-element [low, high] pair; a plain list keeps the generated TS type simple
|
|
15
|
+
Interval = Annotated[list[float], Field(min_length=2, max_length=2)]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Problem(BaseModel):
|
|
19
|
+
"""RFC 7807-style error body."""
|
|
20
|
+
type: str = "about:blank"
|
|
21
|
+
title: str
|
|
22
|
+
detail: str | None = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ProgramRef(BaseModel):
|
|
26
|
+
slug: str
|
|
27
|
+
name: str
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Gate(BaseModel):
|
|
31
|
+
"""The pre-registered success criterion the campaign is judged against."""
|
|
32
|
+
metric: str | None = None
|
|
33
|
+
direction: Literal["min", "max"] | None = None
|
|
34
|
+
threshold: float | None = None
|
|
35
|
+
unit: str | None = None
|
|
36
|
+
label: str | None = Field(None, description="e.g. 'IC50 (µM) ≤ 2'")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class Budget(BaseModel):
|
|
40
|
+
runs_used: int
|
|
41
|
+
runs_max: int | None = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Funnel(BaseModel):
|
|
45
|
+
proposed: int
|
|
46
|
+
selected: int = Field(description="chosen for testing (incl. refused/in lab)")
|
|
47
|
+
tested: int = Field(description="reached the lab")
|
|
48
|
+
judged: int = Field(description="has a verdict")
|
|
49
|
+
claimed: int = Field(description="validated or confirmed")
|
|
50
|
+
refuted: int
|
|
51
|
+
abstained: int = Field(description="interval straddles the gate")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class Verdict(BaseModel):
|
|
55
|
+
status: VerdictStatus
|
|
56
|
+
observed: float | None = None
|
|
57
|
+
ci: Interval | None = None
|
|
58
|
+
unit_label: str | None = None
|
|
59
|
+
margin: str | None = None
|
|
60
|
+
extrapolation: bool = False
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class Review(BaseModel):
|
|
64
|
+
"""A scientist's recorded decision on a hypothesis (sealed in provenance)."""
|
|
65
|
+
decision: Literal["follow_up", "accept", "drop"]
|
|
66
|
+
note: str = ""
|
|
67
|
+
by: str
|
|
68
|
+
ts: float | None = None
|
|
69
|
+
follow_up_campaign_id: str | None = Field(None, description="the campaign started to follow up")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class Suggestion(BaseModel):
|
|
73
|
+
"""What the model suggested for an abstained hypothesis, after code validated it. Never a decision: accept and drop are a
|
|
74
|
+
person's, and a follow-up runs only if valid and, under approvals, after a person approves it."""
|
|
75
|
+
action: Literal["follow_up", "accept", "drop"]
|
|
76
|
+
ok: bool
|
|
77
|
+
status: str
|
|
78
|
+
reasons: list[str] = []
|
|
79
|
+
replicates: int | None = Field(None, description="the replicate count the lab will run, when the lab honors a request")
|
|
80
|
+
replicates_requested: int | None = None
|
|
81
|
+
concentrations: list[str] | None = None
|
|
82
|
+
why: str = Field("", description="the model's own words: shown, never trusted")
|
|
83
|
+
ran: bool = Field(False, description="a follow-up hypothesis was created from this suggestion")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class HypothesisSummary(BaseModel):
|
|
87
|
+
id: str
|
|
88
|
+
candidate: str | None = None
|
|
89
|
+
family: str | None = Field(None, description="the mechanistic family this hypothesis belongs to")
|
|
90
|
+
head: str
|
|
91
|
+
statement: str
|
|
92
|
+
state: State
|
|
93
|
+
stage: str = Field(description="one-line, human-readable status")
|
|
94
|
+
round: int | None = None
|
|
95
|
+
verdict: Verdict | None = None
|
|
96
|
+
gate_label: str | None = None
|
|
97
|
+
selected: bool = False
|
|
98
|
+
review: Review | None = None
|
|
99
|
+
suggestion: Suggestion | None = None
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class Pick(BaseModel):
|
|
103
|
+
candidate: str
|
|
104
|
+
reason: str
|
|
105
|
+
score: float | None = Field(None, description="EI value or portfolio score")
|
|
106
|
+
mean: float | None = None
|
|
107
|
+
sd: float | None = None
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class Refusal(BaseModel):
|
|
111
|
+
candidate: str
|
|
112
|
+
reason: str
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class Why(BaseModel):
|
|
116
|
+
"""'Why this plate': how a round's batch was chosen."""
|
|
117
|
+
policy: str | None = None
|
|
118
|
+
policy_version: str | None = None
|
|
119
|
+
k: int | None = None
|
|
120
|
+
target: float | None = None
|
|
121
|
+
direction: str | None = None
|
|
122
|
+
picks: list[Pick] = []
|
|
123
|
+
refusals: list[Refusal] = []
|
|
124
|
+
note: str = ""
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class Round(BaseModel):
|
|
128
|
+
n: int
|
|
129
|
+
candidates: list[str]
|
|
130
|
+
verdicts: dict[str, str] = {}
|
|
131
|
+
why: Why | None = None
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class ReviewFinding(BaseModel):
|
|
135
|
+
severity: str
|
|
136
|
+
kind: str
|
|
137
|
+
candidate: str | None = None
|
|
138
|
+
detail: str
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class Reviewer(BaseModel):
|
|
142
|
+
critical: int = 0
|
|
143
|
+
warnings: int = 0
|
|
144
|
+
findings: list[ReviewFinding] = []
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class ChainStatus(BaseModel):
|
|
148
|
+
verified: bool
|
|
149
|
+
records: int
|
|
150
|
+
problems: list[dict[str, Any]] = []
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class ActivityItem(BaseModel):
|
|
154
|
+
ts: float | None = None
|
|
155
|
+
kind: str
|
|
156
|
+
text: str
|
|
157
|
+
candidate: str | None = None
|
|
158
|
+
actor: str | None = Field(None, description="who did it (agent / service / person)")
|
|
159
|
+
event: str | None = Field(None, description="the ledger event type, e.g. lab_run, gate_decision")
|
|
160
|
+
hash: str | None = Field(None, description="first characters of the record's hash in the ledger chain")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class CampaignSummary(BaseModel):
|
|
164
|
+
id: str
|
|
165
|
+
title: str
|
|
166
|
+
status: str
|
|
167
|
+
autonomy: str | None = None
|
|
168
|
+
program: ProgramRef | None = None
|
|
169
|
+
updated_at: float | None = None
|
|
170
|
+
problem_id: str | None = None
|
|
171
|
+
paused: bool = Field(False, description="held by a pause on this campaign or on its program")
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class PlanVariant(BaseModel):
|
|
175
|
+
hypothesis_id: str
|
|
176
|
+
candidate: str = ""
|
|
177
|
+
statement: str = ""
|
|
178
|
+
predicted: str = ""
|
|
179
|
+
rationale: str = ""
|
|
180
|
+
assay: str = ""
|
|
181
|
+
protocol: str = Field("", description="the dose ladder the model designed, as one line")
|
|
182
|
+
lab: PlanLab | None = None
|
|
183
|
+
predictions: list[PlanPrediction] = []
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class PlanLab(BaseModel):
|
|
187
|
+
"""Where a hypothesis would run and whether the model's instrument pick holds up. Checked on facts, not wording."""
|
|
188
|
+
pick: str | None = Field(None, description="the instrument the model named, from the operator's pool")
|
|
189
|
+
runs_on: str | None = Field(None, description="where the run will really go: the campaign's instrument")
|
|
190
|
+
status: Literal["ok", "unstated", "unverified", "invented", "lacks", "other_instrument", "cannot_run"]
|
|
191
|
+
ok: bool
|
|
192
|
+
reasons: list[str] = []
|
|
193
|
+
flags: list[str] = []
|
|
194
|
+
eligible: list[str] = Field([], description="pool instruments that declare this assay")
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class PlanPrediction(BaseModel):
|
|
198
|
+
"""A prior from a registered prediction tool. Never evidence: only the measurement judges the hypothesis."""
|
|
199
|
+
tool: str
|
|
200
|
+
version: str | None = None
|
|
201
|
+
status: Literal["ok", "unknown_tool", "untrusted_tool", "wrong_modality", "no_input", "invalid_input", "error", "invalid_output"]
|
|
202
|
+
reason: str | None = None
|
|
203
|
+
input: str | None = Field(None, description="the structure or sequence the model gave for the candidate, so it can be checked")
|
|
204
|
+
values: dict[str, float | bool] = {}
|
|
205
|
+
units: dict[str, str] = {}
|
|
206
|
+
in_domain: bool | None = None
|
|
207
|
+
uncertainty: str | None = Field(None, description="interval, ensemble or none: a tool with none is uncalibrated")
|
|
208
|
+
calibrated: bool = False
|
|
209
|
+
evidence: Literal[False] = False
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class GroundingItem(BaseModel):
|
|
213
|
+
kind: Literal["supports", "contradicts", "prior_measurement", "already_known", "prior"]
|
|
214
|
+
claim: str
|
|
215
|
+
source: str = Field("", description="the PMID, ChEMBL id or Ensembl id of a tool result this run retrieved; for a `prior`, the compute tool that returned it (a prior is never evidence)")
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class PlanGrounding(BaseModel):
|
|
219
|
+
"""What the model found when it looked for evidence for and against a family. Only items that trace to a retrieved result."""
|
|
220
|
+
items: list[GroundingItem] = []
|
|
221
|
+
dropped: int = Field(0, description="items the model offered that did not trace to anything it retrieved")
|
|
222
|
+
calls: int = 0
|
|
223
|
+
stopped: str | None = None
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class PlanFamily(BaseModel):
|
|
227
|
+
"""One mechanistic bet a model proposed, with the variants that test it."""
|
|
228
|
+
id: str
|
|
229
|
+
claim: str = ""
|
|
230
|
+
mechanism: str = ""
|
|
231
|
+
refuted_if: str = Field("", description="the one observation that would kill this family")
|
|
232
|
+
confidence: float | None = None
|
|
233
|
+
citation: str = ""
|
|
234
|
+
citation_status: str = ""
|
|
235
|
+
citation_traced: bool | None = Field(None, description="whether the citation appears in a result this run retrieved (None: grounding was off)")
|
|
236
|
+
grounding: PlanGrounding | None = None
|
|
237
|
+
variants: list[PlanVariant] = []
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
class PlanNote(BaseModel):
|
|
241
|
+
target: str = "plan"
|
|
242
|
+
severity: Literal["concern", "note"] = "note"
|
|
243
|
+
text: str
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class PlanCritique(BaseModel):
|
|
247
|
+
"""A second model's review of the plan. Advisory: it cannot change or approve anything."""
|
|
248
|
+
model: str = ""
|
|
249
|
+
notes: list[PlanNote] = []
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class PlanWarning(BaseModel):
|
|
253
|
+
"""A deterministic check on the plan, shown before approval."""
|
|
254
|
+
kind: Literal["duplicate_compound", "already_tested", "untraced_citation", "untestable_refutation", "not_in_library", "bad_structure", "ruled_out",
|
|
255
|
+
"quoted_number", "gate_misstated"]
|
|
256
|
+
candidate: str = ""
|
|
257
|
+
family: str | None = Field(None, description="untraced_citation: the family whose citation this run never retrieved")
|
|
258
|
+
citation: str | None = None
|
|
259
|
+
citation_status: str | None = Field(None, description="untraced_citation: whether the citation resolves (it may still be real)")
|
|
260
|
+
reason: str | None = Field(None, description="why a check fired (untestable_refutation, bad_structure, ruled_out)")
|
|
261
|
+
families: list[str] = []
|
|
262
|
+
hypothesis_ids: list[str] = []
|
|
263
|
+
verdict: str | None = Field(None, description="already_tested: the verdict an earlier round reached on this compound")
|
|
264
|
+
prior_family: str | None = None
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
class Plan(BaseModel):
|
|
268
|
+
"""What a model proposed, shown to a person before anything reaches the lab."""
|
|
269
|
+
warnings: list[PlanWarning] = []
|
|
270
|
+
families: list[PlanFamily] = []
|
|
271
|
+
n_hypotheses: int = 0
|
|
272
|
+
label: str | None = Field(None, description="e.g. 'after round 1' for a re-plan")
|
|
273
|
+
critique: PlanCritique | None = None
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
class ApprovalRef(BaseModel):
|
|
277
|
+
id: str
|
|
278
|
+
title: str
|
|
279
|
+
detail: str = ""
|
|
280
|
+
ts: float | None = None
|
|
281
|
+
plan: Plan | None = Field(None, description="set when this approval is a research plan to review")
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class LlmUse(BaseModel):
|
|
285
|
+
"""Where a language model took part. Absent = every step of this campaign was deterministic."""
|
|
286
|
+
models: list[str] = []
|
|
287
|
+
proposed_hypotheses: int = Field(0, description="hypotheses whose wording, mechanism and refuted-if clause a model wrote")
|
|
288
|
+
reviewed: bool = Field(False, description="an LLM reviewer also read the verdicts")
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
class PlanReview(BaseModel):
|
|
292
|
+
"""The person's decision on the model's research plan, as sealed in the ledger."""
|
|
293
|
+
approved: bool
|
|
294
|
+
by: str
|
|
295
|
+
proposed: int
|
|
296
|
+
kept: int
|
|
297
|
+
removed: int = 0
|
|
298
|
+
note: str | None = None
|
|
299
|
+
ts: float | None = None
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
class CampaignDetail(CampaignSummary):
|
|
303
|
+
pause: PauseState | None = Field(None, description="this campaign is paused")
|
|
304
|
+
paused_by_program: PauseState | None = Field(None, description="its program is paused, which holds it too")
|
|
305
|
+
llm: LlmUse | None = None
|
|
306
|
+
plan_review: PlanReview | None = None
|
|
307
|
+
awaiting_approvals: list[ApprovalRef] = []
|
|
308
|
+
objective: str | None = None
|
|
309
|
+
branch: str | None = None
|
|
310
|
+
gate: Gate = Gate()
|
|
311
|
+
budget: Budget
|
|
312
|
+
funnel: Funnel
|
|
313
|
+
rounds: list[Round] = []
|
|
314
|
+
hypotheses: list[HypothesisSummary] = []
|
|
315
|
+
eliminated: list[Refusal] = []
|
|
316
|
+
reviewer: Reviewer | None = None
|
|
317
|
+
chain: ChainStatus
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
class HypothesisDetail(HypothesisSummary):
|
|
321
|
+
rationale: str | None = None
|
|
322
|
+
predicted: str | None = None
|
|
323
|
+
predicted_by: dict[str, Any] | None = None
|
|
324
|
+
mechanism: str | None = None
|
|
325
|
+
refutation_condition: str | None = None
|
|
326
|
+
citation: str | None = None
|
|
327
|
+
citation_status: str | None = None
|
|
328
|
+
evidence: dict[str, Any] | None = None
|
|
329
|
+
derivation: str | None = Field(None, description="how the verdict was derived")
|
|
330
|
+
evidence_runs: list[str] = []
|
|
331
|
+
events: list[ActivityItem] = []
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
class ProvenanceRecord(BaseModel):
|
|
335
|
+
ts: float | None = None
|
|
336
|
+
event: str
|
|
337
|
+
summary: str
|
|
338
|
+
actor: str | None = None
|
|
339
|
+
actor_kind: str | None = None
|
|
340
|
+
model_version: str | None = None
|
|
341
|
+
detail: dict[str, Any] | None = Field(None, description="the recorded decision, verbatim")
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
class ProvenanceView(BaseModel):
|
|
345
|
+
chain: ChainStatus
|
|
346
|
+
records: list[ProvenanceRecord]
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
class EvalSummary(BaseModel):
|
|
350
|
+
mean: float
|
|
351
|
+
tasks: int
|
|
352
|
+
all_pass: bool
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
class AnchorStatus(BaseModel):
|
|
356
|
+
records: int
|
|
357
|
+
age_s: float | None = Field(None, description="seconds since the last anchor")
|
|
358
|
+
published: bool | None = None
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
class ModelStatus(BaseModel):
|
|
362
|
+
"""Is a real language model configured for LLM-assisted campaigns? Never includes the key."""
|
|
363
|
+
configured: bool
|
|
364
|
+
model: str | None = None
|
|
365
|
+
api: str | None = None
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class SystemStatus(BaseModel):
|
|
369
|
+
"""What the top bar and trust strip show on every page."""
|
|
370
|
+
model: ModelStatus
|
|
371
|
+
halted: bool
|
|
372
|
+
halt_reason: str | None = None
|
|
373
|
+
pending_approvals: int
|
|
374
|
+
chain: ChainStatus
|
|
375
|
+
anchor: AnchorStatus | None = None
|
|
376
|
+
eval: EvalSummary | None = None
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
class CurvePoint(BaseModel):
|
|
380
|
+
conc_um: float
|
|
381
|
+
value: float
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
class CurveFit(BaseModel):
|
|
385
|
+
ic50_um: float | None = None
|
|
386
|
+
ci: Interval | None = None
|
|
387
|
+
top: float | None = Field(None, description="known or fitted plateau")
|
|
388
|
+
method: str | None = None
|
|
389
|
+
model: str | None = Field(None, description="what the curve model is (slope/bottom fixed)")
|
|
390
|
+
right_censored: bool = False
|
|
391
|
+
left_censored: bool = False
|
|
392
|
+
line: list[CurvePoint] = Field([], description="the fitted curve, sampled for plotting")
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
class Curve(BaseModel):
|
|
396
|
+
run_id: str
|
|
397
|
+
label: str
|
|
398
|
+
points: list[CurvePoint]
|
|
399
|
+
fit: CurveFit | None = None
|
|
400
|
+
z_prime: float | None = None
|
|
401
|
+
z_kind: str | None = None
|
|
402
|
+
unit: str | None = None
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
class CurveSet(BaseModel):
|
|
406
|
+
candidate: str | None = None
|
|
407
|
+
curves: list[Curve] = []
|
|
408
|
+
note: str | None = None
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
class BestResult(BaseModel):
|
|
412
|
+
campaign_id: str
|
|
413
|
+
campaign_title: str
|
|
414
|
+
candidate: str
|
|
415
|
+
state: str
|
|
416
|
+
observed: float | None = None
|
|
417
|
+
ci: Interval | None = None
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
class Goal(BaseModel):
|
|
421
|
+
"""Progress against the program's pre-registered gate, across ALL its campaigns."""
|
|
422
|
+
met: bool = Field(description="at least one candidate is claimed (validated/confirmed)")
|
|
423
|
+
best: BestResult | None = Field(None, description="best claimed result, else the closest judged one")
|
|
424
|
+
claimed: int = 0
|
|
425
|
+
refuted: int = 0
|
|
426
|
+
abstained: int = 0
|
|
427
|
+
judged: int = 0
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class CampaignDigest(BaseModel):
|
|
431
|
+
id: str
|
|
432
|
+
title: str
|
|
433
|
+
status: str
|
|
434
|
+
updated_at: float | None = None
|
|
435
|
+
funnel: Funnel
|
|
436
|
+
best: BestResult | None = None
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
class Limits(BaseModel):
|
|
440
|
+
"""Hard caps a program puts on every campaign it runs. A campaign may ask for less, never more."""
|
|
441
|
+
max_rounds: int = Field(3, ge=1, le=8, description="sequential rounds; each round's results feed the next")
|
|
442
|
+
max_lab_runs: int = Field(20, ge=1, le=500, description="lab runs, including confirmation assays")
|
|
443
|
+
max_hypotheses: int = Field(12, ge=1, le=200, description="hypotheses across all rounds")
|
|
444
|
+
max_families: int = Field(3, ge=1, le=8, description="distinct mechanistic bets a model may propose")
|
|
445
|
+
max_variants_per_family: int = Field(3, ge=1, le=8)
|
|
446
|
+
breadth: int = Field(3, ge=1, le=12, description="hypotheses taken to the lab per round")
|
|
447
|
+
max_depth: int = Field(2, ge=1, le=3, description="how many levels an objective may be split into sub-problems")
|
|
448
|
+
max_wall_minutes: int = Field(0, ge=0, le=10080, description="a campaign ends early once it has run this long, not counting time spent waiting for a person or on a pause. 0 means no limit")
|
|
449
|
+
max_model_calls: int = Field(200, ge=5, le=2000, description="model calls: proposals, re-plans, the critic and the reviewer. A research tree shares it across its sub-problems")
|
|
450
|
+
max_subproblems: int = Field(8, ge=2, le=16, description="sub-problems in one research tree, all levels together")
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class PauseState(BaseModel):
|
|
454
|
+
scope: str
|
|
455
|
+
kind: Literal["program", "campaign"]
|
|
456
|
+
reason: str = ""
|
|
457
|
+
by: str
|
|
458
|
+
ts: float | None = None
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
class PauseIn(BaseModel):
|
|
462
|
+
paused: bool
|
|
463
|
+
reason: str = Field("", max_length=300)
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
class PauseResult(BaseModel):
|
|
467
|
+
paused: bool
|
|
468
|
+
pause: PauseState | None = None
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
class ProgramSummary(BaseModel):
|
|
472
|
+
pause: PauseState | None = Field(None, description="the program is paused: no new lab submissions until resumed")
|
|
473
|
+
slug: str
|
|
474
|
+
name: str
|
|
475
|
+
objective: str | None = None
|
|
476
|
+
modality: str | None = None
|
|
477
|
+
mode: str | None = None
|
|
478
|
+
limits: Limits = Limits()
|
|
479
|
+
gate: Gate
|
|
480
|
+
goal: Goal
|
|
481
|
+
campaigns: int
|
|
482
|
+
running: int
|
|
483
|
+
updated_at: float | None = None
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
class ProgramResult(BaseModel):
|
|
487
|
+
hypothesis_id: str
|
|
488
|
+
campaign_id: str
|
|
489
|
+
campaign_title: str
|
|
490
|
+
candidate: str
|
|
491
|
+
state: str
|
|
492
|
+
observed: float | None = None
|
|
493
|
+
ci: Interval | None = None
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
class NextStep(BaseModel):
|
|
497
|
+
"""A rule-based recommendation, deterministic, always available, no model needed."""
|
|
498
|
+
kind: Literal["inbox", "follow_up", "start", "expand", "milestone", "submit_results"]
|
|
499
|
+
title: str
|
|
500
|
+
detail: str = ""
|
|
501
|
+
action: Literal["inbox", "launch", "new_program", "open_campaign"]
|
|
502
|
+
candidates: list[str] = []
|
|
503
|
+
campaign_id: str | None = None
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
class DecomposeIn(BaseModel):
|
|
507
|
+
objective: str | None = Field(None, description="split this instead of the program's own objective")
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
class ProgramDetail(ProgramSummary):
|
|
511
|
+
runs_left: int = Field(0, description="lab runs not yet used or reserved by the program's campaigns")
|
|
512
|
+
campaign_list: list[CampaignDigest] = []
|
|
513
|
+
results: list[ProgramResult] = []
|
|
514
|
+
next_steps: list[NextStep] = []
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
class AbstentionNote(BaseModel):
|
|
518
|
+
campaign_id: str
|
|
519
|
+
campaign_title: str
|
|
520
|
+
candidates: list[str]
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
class Attention(BaseModel):
|
|
524
|
+
"""What needs the scientist right now."""
|
|
525
|
+
pending_approvals: int
|
|
526
|
+
abstentions: list[AbstentionNote]
|
|
527
|
+
running: int
|
|
528
|
+
halted: bool
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
class Today(BaseModel):
|
|
532
|
+
attention: Attention
|
|
533
|
+
programs: list[ProgramSummary]
|
|
534
|
+
standalone: list[CampaignDigest]
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
class AgentSummary(BaseModel):
|
|
538
|
+
id: str
|
|
539
|
+
kind: str
|
|
540
|
+
role: str
|
|
541
|
+
model_version: str | None = None
|
|
542
|
+
events: int
|
|
543
|
+
last_ts: float | None = None
|
|
544
|
+
last_text: str = ""
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
class ReviewIn(BaseModel):
|
|
548
|
+
decision: Literal["follow_up", "accept", "drop"]
|
|
549
|
+
note: str = ""
|
|
550
|
+
follow_up_campaign_id: str | None = None
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
InboxKind = Literal["approval", "review"]
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
class InboxItem(BaseModel):
|
|
557
|
+
id: str
|
|
558
|
+
kind: InboxKind
|
|
559
|
+
title: str
|
|
560
|
+
detail: str = ""
|
|
561
|
+
ts: float | None = None
|
|
562
|
+
status: str = "pending"
|
|
563
|
+
decided_by: str | None = None
|
|
564
|
+
campaign_id: str | None = None
|
|
565
|
+
campaign_title: str | None = None
|
|
566
|
+
program: ProgramRef | None = None
|
|
567
|
+
hypothesis_id: str | None = None
|
|
568
|
+
candidate: str | None = None
|
|
569
|
+
decision: str | None = None
|
|
570
|
+
follow_up_campaign_id: str | None = None
|
|
571
|
+
plan: Plan | None = None
|
|
572
|
+
suggestion: Suggestion | None = None
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
class DecisionIn(BaseModel):
|
|
576
|
+
approve: bool
|
|
577
|
+
note: str = ""
|
|
578
|
+
exclude: list[str] = Field([], description="for a research plan: hypothesis ids the person removed")
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
class ProgramCreate(BaseModel):
|
|
582
|
+
limits: Limits = Limits()
|
|
583
|
+
name: str
|
|
584
|
+
objective: str = ""
|
|
585
|
+
modality: str = "small molecule"
|
|
586
|
+
metric: str = "ic50_um"
|
|
587
|
+
direction: Literal["min", "max"] = "min"
|
|
588
|
+
gate_value: float = 20.0
|
|
589
|
+
unit: str = "µM"
|
|
590
|
+
|
|
591
|
+
@field_validator("unit", "name", "metric", "modality", mode="before")
|
|
592
|
+
@classmethod
|
|
593
|
+
def _tidy(cls, v):
|
|
594
|
+
"""A unit typed as 'mS/cm.' must not carry the sentence's full stop into every gate label."""
|
|
595
|
+
return v.strip().rstrip(".").strip() if isinstance(v, str) else v
|
|
596
|
+
|
|
597
|
+
@field_validator("modality")
|
|
598
|
+
@classmethod
|
|
599
|
+
def _known_modality(cls, v):
|
|
600
|
+
"""An unknown modality must not fall back to small molecule silently: a typo ("materials") would give a
|
|
601
|
+
materials program drug-discovery wording and dose-response rules. Case-insensitive, stored as the pack's name."""
|
|
602
|
+
from proef.modality import PACKS, get_pack
|
|
603
|
+
pack = get_pack(v)
|
|
604
|
+
if pack is None:
|
|
605
|
+
raise ValueError(f"unknown modality {v!r}. Choose one of: {', '.join(PACKS)}")
|
|
606
|
+
return pack.name
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
class SubProblem(BaseModel):
|
|
610
|
+
"""One independently testable question a model split the objective into."""
|
|
611
|
+
objective: str = Field(..., min_length=3, max_length=200)
|
|
612
|
+
metric: str | None = None
|
|
613
|
+
direction: Literal["min", "max"] = "min"
|
|
614
|
+
gate: float | None = None
|
|
615
|
+
unit: str | None = None
|
|
616
|
+
priority: float = 1.0
|
|
617
|
+
rationale: str = ""
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
class TreeNode(BaseModel):
|
|
621
|
+
"""One sub-problem in a research tree. `parent` is another node's id, or null for a direct child of the objective."""
|
|
622
|
+
id: str = Field(..., min_length=1, max_length=40)
|
|
623
|
+
parent: str | None = None
|
|
624
|
+
objective: str = Field(..., min_length=3, max_length=200)
|
|
625
|
+
metric: str | None = None
|
|
626
|
+
direction: Literal["min", "max"] = "min"
|
|
627
|
+
gate: float | None = None
|
|
628
|
+
unit: str | None = None
|
|
629
|
+
priority: float = Field(1.0, gt=0, le=100)
|
|
630
|
+
rationale: str = ""
|
|
631
|
+
depth: int = 1
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
class Decomposition(BaseModel):
|
|
635
|
+
objective: str
|
|
636
|
+
nodes: list[TreeNode]
|
|
637
|
+
model: str
|
|
638
|
+
max_depth: int
|
|
639
|
+
max_subproblems: int
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
class TreeCreate(BaseModel):
|
|
643
|
+
objective: str = Field(..., min_length=3, max_length=300)
|
|
644
|
+
nodes: list[TreeNode] = Field(..., min_length=1, max_length=40)
|
|
645
|
+
autonomy: Literal["observe", "gate", "act"] = "gate"
|
|
646
|
+
rounds: int | None = Field(None, ge=1, le=8)
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
class TreeNodeView(TreeNode):
|
|
650
|
+
status: str = Field("open", description="open | in lab | achieved | partial | failed | inconclusive")
|
|
651
|
+
runs: int | None = Field(None, description="lab runs allocated to this leaf")
|
|
652
|
+
campaign_id: str | None = None
|
|
653
|
+
verdicts: dict[str, str] = {}
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
class TreeView(BaseModel):
|
|
657
|
+
id: str
|
|
658
|
+
objective: str
|
|
659
|
+
by: str
|
|
660
|
+
ts: float | None = None
|
|
661
|
+
status: str
|
|
662
|
+
nodes: list[TreeNodeView]
|
|
663
|
+
run_budget: int
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
class CampaignCreate(BaseModel):
|
|
667
|
+
sub_problem: SubProblem | None = Field(None, description="judged against this sub-problem's own gate instead of the program's")
|
|
668
|
+
objective: str | None = None
|
|
669
|
+
candidates: list[str] = []
|
|
670
|
+
mode: Literal["agent", "hand"] = Field(
|
|
671
|
+
"agent", description="'hand': the plate is run by hand and submitted; candidates are required")
|
|
672
|
+
autonomy: Literal["observe", "gate", "act"] = "gate"
|
|
673
|
+
k: int | None = Field(None, ge=1, le=12, description="per round; defaults to, and is capped by, the program's limit")
|
|
674
|
+
rounds: int | None = Field(None, ge=1, le=8, description="defaults to 2, and is capped by the program's limit")
|
|
675
|
+
orchestrator: Literal["fixed", "model"] = Field("fixed", description="'model': after each round a model chooses among the actions the engine allows (follow up, re-plan, next round, stop). The follow-up and re-plan switches become what it MAY choose. Every choice is recorded, an invalid one falls back to the fixed order, and a replay plays the choices back. Needs a model")
|
|
676
|
+
followups: bool = Field(False, description="after each round the model suggests what to do with each abstained hypothesis. A follow-up it suggests runs only if valid, under 'act' or after approval under 'gate'. Accept and drop stay a person's decision. Needs a model")
|
|
677
|
+
replan: bool = Field(False, description="after each round the model proposes the next hypotheses from the results; they require approval")
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
class HaltState(BaseModel):
|
|
681
|
+
halted: bool
|
|
682
|
+
reason: str | None = None
|
|
683
|
+
history: list[dict[str, Any]] = []
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
class HaltIn(BaseModel):
|
|
687
|
+
halted: bool
|
|
688
|
+
reason: str = ""
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
class BranchInfo(BaseModel):
|
|
692
|
+
id: str
|
|
693
|
+
kind: Literal["campaign", "program", "other"]
|
|
694
|
+
records: int
|
|
695
|
+
verified: bool
|
|
696
|
+
campaign_id: str | None = None
|
|
697
|
+
campaign_title: str | None = None
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
class LedgerView(BaseModel):
|
|
701
|
+
chain: ChainStatus
|
|
702
|
+
branches: list[BranchInfo]
|
|
703
|
+
verified_in_ms: int = Field(description="how long the full re-hash took")
|
|
704
|
+
checked_at: float
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
class AnchorEntry(BaseModel):
|
|
708
|
+
ts: float
|
|
709
|
+
records: int
|
|
710
|
+
merkle_root: str
|
|
711
|
+
published: bool | None = None
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
class AnchorCheck(BaseModel):
|
|
715
|
+
"""The ledger measured against the latest anchor."""
|
|
716
|
+
match: bool = Field(description="everything the anchor committed to is unchanged")
|
|
717
|
+
appended_since_anchor: int
|
|
718
|
+
content_tampered: bool
|
|
719
|
+
current_root: str
|
|
720
|
+
anchored_root: str | None = None
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
class AnchorView(BaseModel):
|
|
724
|
+
anchors: list[AnchorEntry]
|
|
725
|
+
check: AnchorCheck | None = None
|
|
726
|
+
note: str = ""
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
class Instrument(BaseModel):
|
|
730
|
+
id: str
|
|
731
|
+
name: str
|
|
732
|
+
kind: str
|
|
733
|
+
vendor: str | None = None
|
|
734
|
+
simulated: bool = Field(description="ALL output is synthetic")
|
|
735
|
+
hardware_validated: bool = Field(description="verified against a physical device")
|
|
736
|
+
installed: bool = True
|
|
737
|
+
requires_network: bool | None = None
|
|
738
|
+
assay_types: list[str] = []
|
|
739
|
+
readouts: list[str] = []
|
|
740
|
+
note: str | None = None
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
class DriverCheck(BaseModel):
|
|
744
|
+
"""What a driver check found. It never changes an instrument's validation status: only verification
|
|
745
|
+
against a physical device does that."""
|
|
746
|
+
id: str
|
|
747
|
+
status: Literal["ready", "not-installed", "needs-configuration", "failed"]
|
|
748
|
+
detail: str
|
|
749
|
+
tools: list[str] = []
|
|
750
|
+
checked_at: float
|
|
751
|
+
simulation_only: bool = Field(True, description="the check ran the driver in simulation mode; no physical device was addressed")
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
class AuthorityRule(BaseModel):
|
|
755
|
+
column: Literal["autonomous", "human", "never"]
|
|
756
|
+
when: str
|
|
757
|
+
custom: bool = False
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
class Sop(BaseModel):
|
|
761
|
+
id: str
|
|
762
|
+
objective: str
|
|
763
|
+
assay: str | None = None
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
class Authority(BaseModel):
|
|
767
|
+
rules: list[AuthorityRule]
|
|
768
|
+
sops_pending: list[Sop]
|
|
769
|
+
halt: HaltState
|
|
770
|
+
safety_rules: str = Field("", description="the toxicophore rule-set version the gate cites")
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
# ------------------------------------------------------------------ analyze
|
|
774
|
+
class AnalysisDiagnostic(BaseModel):
|
|
775
|
+
severity: Literal["info", "warning", "blocker"]
|
|
776
|
+
code: str
|
|
777
|
+
message: str
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
class MeasurementColumns(BaseModel):
|
|
781
|
+
sample: str | None = None
|
|
782
|
+
value: str | None = None
|
|
783
|
+
candidates: list[str] = []
|
|
784
|
+
all: list[str] = []
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
class AnalysisPreview(BaseModel):
|
|
788
|
+
"""What the system understood from the file, before any fit."""
|
|
789
|
+
kind: Literal["plate", "measurements"] = "plate"
|
|
790
|
+
columns: MeasurementColumns | None = Field(None, description="measurements tables: the columns understood")
|
|
791
|
+
n_measurements: int = 0
|
|
792
|
+
format: str | None = None
|
|
793
|
+
n_wells: int = 0
|
|
794
|
+
n_controls: int = 0
|
|
795
|
+
z_prime: float | None = None
|
|
796
|
+
z_kind: str | None = None
|
|
797
|
+
samples: list[str] = []
|
|
798
|
+
has_doses: bool = False
|
|
799
|
+
evidence_origin: str = "unknown"
|
|
800
|
+
needs_confirmation: list[str] = []
|
|
801
|
+
diagnostics: list[AnalysisDiagnostic] = []
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
class AnalysisCompound(BaseModel):
|
|
805
|
+
entity: str
|
|
806
|
+
call: Literal["validated", "invalidated", "inconclusive", "no_call"] | None = None
|
|
807
|
+
reason: str | None = None
|
|
808
|
+
ic50_um: float | None = None
|
|
809
|
+
ci: Interval | None = None
|
|
810
|
+
n_points: int | None = None
|
|
811
|
+
estimate: float | None = Field(None, description="measurements: the mean")
|
|
812
|
+
n: int | None = None
|
|
813
|
+
sd: float | None = None
|
|
814
|
+
values: list[float] = []
|
|
815
|
+
top_known: bool | None = Field(None, description="False: the plateau was inferred from the data, so the call depends on that assumption")
|
|
816
|
+
curve: Curve | None = None
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
class AnalysisResult(BaseModel):
|
|
820
|
+
kind: Literal["plate", "measurements"] = "plate"
|
|
821
|
+
metric: str | None = None
|
|
822
|
+
unit: str | None = None
|
|
823
|
+
method: str | None = None
|
|
824
|
+
state: str
|
|
825
|
+
z_prime: float | None = None
|
|
826
|
+
z_kind: str | None = None
|
|
827
|
+
z_note: str | None = None
|
|
828
|
+
qc_hold: bool = False
|
|
829
|
+
refused: bool = Field(False, description="regime or normalization refusal: no numbers are claimed")
|
|
830
|
+
note: str | None = None
|
|
831
|
+
gate: Gate | None = None
|
|
832
|
+
compounds: list[AnalysisCompound] = []
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
class AnalysisReviewEntry(BaseModel):
|
|
836
|
+
action: Literal["acknowledge", "comment", "override"]
|
|
837
|
+
reason: str = ""
|
|
838
|
+
target: str = ""
|
|
839
|
+
by: str
|
|
840
|
+
ts: float
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
class AnalysisAttachment(BaseModel):
|
|
844
|
+
campaign_id: str
|
|
845
|
+
candidate: str | None = None
|
|
846
|
+
by: str
|
|
847
|
+
ts: float
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
class AnalysisSummary(BaseModel):
|
|
851
|
+
id: str
|
|
852
|
+
filename: str | None = None
|
|
853
|
+
state: str
|
|
854
|
+
updated_at: float | None = None
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
class AnalysisView(BaseModel):
|
|
858
|
+
profile: str = "plate_assay"
|
|
859
|
+
id: str
|
|
860
|
+
filename: str | None = None
|
|
861
|
+
sha256: str | None = None
|
|
862
|
+
state: str
|
|
863
|
+
revision: int
|
|
864
|
+
preview: AnalysisPreview
|
|
865
|
+
result: AnalysisResult | None = None
|
|
866
|
+
reviews: list[AnalysisReviewEntry] = []
|
|
867
|
+
attachments: list[AnalysisAttachment] = []
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
class AnalysisRun(BaseModel):
|
|
871
|
+
"""What the scientist confirms before the fit. Without a threshold the run
|
|
872
|
+
is estimate-only: intervals are drawn, no verdict is claimed."""
|
|
873
|
+
metric: str | None = Field(None, description="measurements tables: what the values are, e.g. ionic_conductivity_mS_cm")
|
|
874
|
+
unit: str | None = None
|
|
875
|
+
sample_column: str | None = None
|
|
876
|
+
value_column: str | None = None
|
|
877
|
+
threshold: float | None = Field(None, description="the gate: IC50 in the data's concentration unit for a plate; the value itself for a measurements table")
|
|
878
|
+
direction: Literal["min", "max"] = "min"
|
|
879
|
+
max_response: float | None = Field(None, description="known assay ceiling, if the top plateau is known")
|
|
880
|
+
evidence_origin: Literal["measured", "historical", "simulated", "predicted", "unknown"] | None = None
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
class AnalysisReviewIn(BaseModel):
|
|
884
|
+
action: Literal["acknowledge", "comment", "override"]
|
|
885
|
+
reason: str = Field("", max_length=1000)
|
|
886
|
+
target: str = ""
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
class AnalysisAttachIn(BaseModel):
|
|
890
|
+
campaign_id: str
|
|
891
|
+
candidate: str | None = None
|
|
892
|
+
note: str = Field("", max_length=500)
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
# ------------------------------------------------------------ submit results
|
|
896
|
+
class ResultMatch(BaseModel):
|
|
897
|
+
hypothesis_id: str
|
|
898
|
+
candidate: str
|
|
899
|
+
statement: str
|
|
900
|
+
gate: str = Field(description="the pre-registered criterion this plate will be judged against")
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
class ResultsPreview(BaseModel):
|
|
904
|
+
"""What submitting this file to the campaign WOULD do. Nothing is written."""
|
|
905
|
+
kind: Literal["plate", "measurements"] = "plate"
|
|
906
|
+
run_id: str
|
|
907
|
+
filename: str
|
|
908
|
+
sha256: str
|
|
909
|
+
n_wells: int
|
|
910
|
+
z_prime: float | None = None
|
|
911
|
+
z_kind: str | None = None
|
|
912
|
+
qc_ok: bool = True
|
|
913
|
+
failure: str | None = Field(None, description="a physical failure mode: no verdicts will be derived")
|
|
914
|
+
matches: list[ResultMatch] = []
|
|
915
|
+
in_file_only: list[str] = Field([], description="samples in the file with no open hypothesis")
|
|
916
|
+
waiting_for_data: list[str] = Field([], description="open hypotheses this file has no data for")
|
|
917
|
+
already_judged: list[str] = Field([], description="candidates that already have a verdict and are left alone")
|
|
918
|
+
already_submitted: bool = False
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
class ResultVerdict(BaseModel):
|
|
922
|
+
hypothesis_id: str
|
|
923
|
+
candidate: str
|
|
924
|
+
status: str
|
|
925
|
+
observed: float | None = None
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
class ResultsOutcome(BaseModel):
|
|
929
|
+
run_id: str
|
|
930
|
+
verdicts: list[ResultVerdict] = []
|
|
931
|
+
failure: str | None = None
|
|
932
|
+
messages: list[str] = []
|