Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help demo test lint ci clean bench-leakage bench-multi-negatives bench-baseline bench-hidden-active bench-cluster-split bench-expert-ablation bench-expert-ablation-500 bench-selectivity bench-feature-decomp bench-gate bench-easy-baseline bench-charge-matched bench-order-dependent bench-precision-at-k bench-per-family bench-simulation-ablation bench-simulation-ablation-within-amp simulation-gate bench-strategy-compare regenerate-all generate phase3 pilot validate-scoring validate-scoring-phase3 validate-scoring-strict external-pilot pilot-confident presynth-qc gold-standard diversity synthesis-order novelty-broad external-consensus questionnaire gate-check ip-report benchmark-card wave0-5-gate-check wave0-5-novelty-audit wave0-5-novelty-audit-v2 wave0-5-panel wave0-5-evidence wave0-5-fill-external wave0-5b-generate wave0-5b-filter recalibration-engine recalibration-engine-dry-run validate-policy-version generate-synthetic-lab-results bump-policy-version generate-review-packet failed-candidate-report safe-publication-filter classify-negative-informativeness validate-rejection-events negative-result-dashboard calibration-audit calibration-audit-example calibration-overfit-check result-quality-filter synthetic-result-policy-check calibration-decision-checklist calibration-rollback-plan simulation-registry validate-simulation-result-schema simulation-baseline-check adapter-gate-check simulation-provenance simulation-ensemble-check simulation-ci-report simulation-deprecation-check simulation-scope-check simulation-evidence-packet artifact-version candidate-manifest artifact-changelog integration-check adapter-author-check license-check artifact-compat-check contribution-check adoption-scorecard release-gate-check decision-log release-request-check coi-check rotation-plan-check security-report-check citation-check roadmap-sync-check advisory-review-check annual-review-check selection-rationale-check batch-priority-check pilot-package-check calibration-intake-check
.PHONY: help demo test lint ci clean bench-leakage bench-multi-negatives bench-baseline bench-hidden-active bench-cluster-split bench-expert-ablation bench-expert-ablation-500 bench-selectivity bench-feature-decomp bench-gate bench-easy-baseline bench-charge-matched bench-order-dependent bench-precision-at-k bench-per-family bench-simulation-ablation bench-simulation-ablation-within-amp simulation-gate bench-strategy-compare regenerate-all generate phase3 pilot validate-scoring validate-scoring-phase3 validate-scoring-strict external-pilot pilot-confident presynth-qc gold-standard diversity synthesis-order novelty-broad external-consensus questionnaire gate-check ip-report benchmark-card wave0-5-gate-check wave0-5-novelty-audit wave0-5-novelty-audit-v2 wave0-5-panel wave0-5-evidence wave0-5-fill-external wave0-5b-generate wave0-5b-filter recalibration-engine recalibration-engine-dry-run validate-policy-version generate-synthetic-lab-results bump-policy-version generate-review-packet failed-candidate-report safe-publication-filter classify-negative-informativeness validate-rejection-events negative-result-dashboard calibration-audit calibration-audit-example calibration-overfit-check result-quality-filter synthetic-result-policy-check calibration-decision-checklist calibration-rollback-plan simulation-registry validate-simulation-result-schema simulation-baseline-check adapter-gate-check simulation-provenance simulation-ensemble-check simulation-ci-report simulation-deprecation-check simulation-scope-check simulation-evidence-packet artifact-version candidate-manifest artifact-changelog integration-check adapter-author-check license-check artifact-compat-check contribution-check adoption-scorecard release-gate-check decision-log release-request-check coi-check rotation-plan-check security-report-check citation-check roadmap-sync-check advisory-review-check annual-review-check selection-rationale-check batch-priority-check pilot-package-check calibration-intake-check uncertainty-report-check

PYTHON := $(shell [ -f .venv/bin/python ] && echo .venv/bin/python || echo python3)
PYTEST := $(shell [ -f .venv/bin/pytest ] && echo .venv/bin/pytest || echo pytest)
Expand Down Expand Up @@ -905,3 +905,8 @@ calibration-intake-check:
.venv/bin/openamp-foundry calibration-intake-check \
--entry-json '{"intake_id":"CAL-001","batch_id":"BATCH-001","candidate_id":"AMP-001","pipeline_version":"0.8.1","assay_type":"mic_assay","predicted_outcome":"active","observed_outcome":"active","predicted_confidence":0.85,"intake_date":"2026-07-09","reviewer":"alice","dry_lab_only":false}' \
--format text

uncertainty-report-check:
.venv/bin/openamp-foundry uncertainty-report-check \
--entry-json '{"report_id":"UQ-001","batch_id":"BATCH-001","candidate_id":"AMP-001","pipeline_version":"0.8.3","metric_name":"mic","point_estimate":4.0,"lower_bound":2.0,"upper_bound":8.0,"confidence_level":0.90,"calibration_source":"historical_holdout_v2","reviewer":"alice","dry_lab_only":true}' \
--format text
3 changes: 2 additions & 1 deletion docs/evidence/METRICS_CURRENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Machine-readable snapshot: `outputs/metrics_snapshot.json` regenerated with `mak
> **Purpose:** One authoritative table of current pipeline metrics. If any doc disagrees
> with this file, this file wins. Updated whenever benchmark/benchmark config changes.
>
> **Last updated:** 2026-07-09 (Phase K K4 — post-experiment calibration intake schema — v0.8.2)
> **Last updated:** 2026-07-09 (Phase K K5 — uncertainty quantification report schema — v0.8.3)
> **New in v0.8.3:** Uncertainty quantification report schema (K5 — Loop 123) — docs/evidence/UNCERTAINTY_REPORT_GUIDE.md with purpose, required field table (12 fields), valid metric names (5), warnings, validation workflow, honest-use boundary. src/openamp_foundry/evidence/uncertainty_report.py with UncertaintyReportEntry dataclass (12 fields: report_id, batch_id, candidate_id, pipeline_version, metric_name, point_estimate, lower_bound, upper_bound, confidence_level, calibration_source, reviewer, dry_lab_only), UncertaintyReportResult dataclass (6 fields: report_id, candidate_id, interval_width, passed, errors, warnings, dry_lab_only=True), VALID_METRIC_NAMES (5: cytotoxicity_score, hemolysis_fraction, mic, selectivity_index, stability_score), WIDE_INTERVAL_THRESHOLD (10.0), validate_uncertainty_report() (11 checks: UQ- prefix, non-empty batch_id/candidate_id/pipeline_version/calibration_source/reviewer, valid metric_name, lower_bound<=point_estimate, upper_bound>=point_estimate, confidence_level 0.0-1.0, dry_lab_only must be True; wide interval warns, confidence<0.80 warns, confidence>0.99 warns), validate_uncertainty_report_dict() (11 required fields guard). CLI (openamp-foundry uncertainty-report-check) with --entry-json, --format text|json. make uncertainty-report-check target. Phase K K5: prediction intervals for external reviewers are now machine-validated.
> **New in v0.8.2:** Post-experiment calibration intake schema (K4 — Loop 122) — docs/evidence/CALIBRATION_INTAKE_GUIDE.md with purpose, required field table (11 fields), note on dry_lab_only=False (real lab results), valid assay types (5), valid outcome values (4), warnings, validation workflow, honest-use boundary. src/openamp_foundry/evidence/calibration_intake.py with CalibrationIntakeEntry dataclass (11 fields: intake_id, batch_id, candidate_id, pipeline_version, assay_type, predicted_outcome, observed_outcome, predicted_confidence, intake_date, reviewer, dry_lab_only=False), CalibrationIntakeResult dataclass (6 fields: intake_id, candidate_id, prediction_correct, passed, errors, warnings, dry_lab_only=False), VALID_ASSAY_TYPES (5: cytotoxicity_assay, hemolysis_assay, membrane_disruption_assay, mic_assay, stability_assay), VALID_OUTCOME_VALUES (4: active, inactive, inconclusive, not_tested), validate_calibration_intake() (11 checks: CAL- prefix, non-empty batch_id/candidate_id/pipeline_version/reviewer, valid assay_type, valid predicted_outcome, valid observed_outcome, confidence 0.0-1.0, YYYY-MM-DD date, dry_lab_only must be False; high-confidence misprediction warns, inconclusive observed warns), validate_calibration_intake_dict() (10 required fields guard). CLI (openamp-foundry calibration-intake-check) with --entry-json, --format text|json. make calibration-intake-check target. Phase K K4: prediction-vs-outcome comparisons are now machine-validated with honest dry_lab_only=False enforcement.
> **New in v0.8.1:** Pilot package completeness checker (K3 — Loop 121) — docs/evidence/PILOT_PACKAGE_GUIDE.md with purpose, required field table (11 fields), mandatory artifact types table (3 types), valid artifact types, warnings, validation workflow, honest-use boundary. src/openamp_foundry/evidence/pilot_package.py with PilotPackageEntry dataclass (11 fields: package_id, batch_id, submission_date, pipeline_version, included_artifacts, missing_artifacts, reviewer, approver, completeness_score, ready_to_submit, dry_lab_only), PilotPackageResult dataclass (5 fields, dry_lab_only=True), MINIMUM_REQUIRED_ARTIFACTS (3), READINESS_SCORE_THRESHOLD (0.80), MANDATORY_ARTIFACT_TYPES (3: batch_priority, evidence_certificate, selection_rationale), VALID_ARTIFACT_TYPES (8 types), validate_pilot_package() (11 checks: PKG- prefix, non-empty batch_id/pipeline_version/reviewer/approver, YYYY-MM-DD submission_date, included_artifacts>=3, mandatory types covered, completeness_score 0.0-1.0, ready_to_submit must be False when score<0.80, dry_lab_only must be True; missing_artifacts non-empty warns, score<0.90 warns, same reviewer/approver warns), validate_pilot_package_dict() (10 required fields guard). CLI (openamp-foundry pilot-package-check) with --entry-json, --format text|json. make pilot-package-check target. Phase K K3: every pilot submission is now machine-validated for completeness.
>
Expand Down
55 changes: 55 additions & 0 deletions docs/evidence/UNCERTAINTY_REPORT_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Uncertainty Quantification Report Guide

An *uncertainty quantification (UQ) report* communicates the prediction-interval width,
calibration status, and confidence bounds for each computational candidate recommendation.
This guide defines the required format, validation rules, and honest-use constraints.

## Purpose

External reviewers need honest uncertainty estimates to:
- judge whether a high-confidence prediction is trustworthy or over-confident,
- compare interval width against historical calibration error,
- decide whether uncertainty is small enough to justify synthesis cost.

## Required fields

| Field | Type | Constraint |
|---|---|---|
| `report_id` | str | Must start with `"UQ-"` |
| `batch_id` | str | Non-empty |
| `candidate_id` | str | Non-empty |
| `pipeline_version` | str | Non-empty |
| `metric_name` | str | One of `VALID_METRIC_NAMES` |
| `point_estimate` | float | Any finite float |
| `lower_bound` | float | Must be ≤ `point_estimate` |
| `upper_bound` | float | Must be ≥ `point_estimate` |
| `confidence_level` | float | 0.0 – 1.0 (e.g. 0.90 for 90%) |
| `calibration_source` | str | Non-empty (e.g. `"historical_holdout_v2"`) |
| `reviewer` | str | Non-empty |
| `dry_lab_only` | bool | Must be `True` |

## Valid metric names

`mic`, `hemolysis_fraction`, `cytotoxicity_score`, `selectivity_index`, `stability_score`

## Warnings

- `upper_bound - lower_bound > WIDE_INTERVAL_THRESHOLD` — warning: interval is wide; low predictive precision.
- `confidence_level < 0.80` — warning: confidence level below 80%; results may be unreliable.
- `confidence_level > 0.99` — warning: confidence level above 99%; verify calibration method.

## How to validate

```bash
make uncertainty-report-check
# or
openamp-foundry uncertainty-report-check \
--entry-json '{"report_id":"UQ-001","batch_id":"BATCH-001","candidate_id":"AMP-001","pipeline_version":"0.8.3","metric_name":"mic","point_estimate":4.0,"lower_bound":2.0,"upper_bound":8.0,"confidence_level":0.90,"calibration_source":"historical_holdout_v2","reviewer":"alice","dry_lab_only":true}' \
--format text
```

## Honest-use boundary

UQ reports are dry-lab outputs. Prediction intervals reflect model uncertainty,
not biological variability. A narrow interval does not guarantee experimental success.
Never present these bounds as experimental measurements.
2 changes: 1 addition & 1 deletion docs/research/NEXT_100_PR_MAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Build the evidence and accountability artifacts needed for credible external val
| K2 | Add batch experiment priority ranker. | Rank candidates for next synthesis wave. | B |
| K3 | Add pilot package completeness checker. | All components present before submission. | B |
| K4 | Add post-experiment calibration intake schema. | Structured result-to-prediction comparison. | B/D |
| K5 | Add uncertainty quantification report schema. | Honest prediction intervals for reviewers. | B |
| K5 | Add uncertainty quantification report schema (complete — Loop 123). | Honest prediction intervals for reviewers. | B |


## Prioritization rule
Expand Down
3 changes: 3 additions & 0 deletions docs/research/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Roadmap

### v0.8.3
- Phase K K5: uncertainty quantification report schema — validates prediction intervals, confidence levels, and calibration source for dry-lab candidate recommendations. UncertaintyReportEntry dataclass, validate_uncertainty_report(), CLI uncertainty-report-check.

### v0.8.2
- Phase K K4: post-experiment calibration intake schema — captures structured comparison of pipeline dry-lab prediction against actual experimental outcome. CalibrationIntakeEntry dataclass (dry_lab_only=False enforced), validate_calibration_intake(), CLI calibration-intake-check.

Expand Down
34 changes: 34 additions & 0 deletions src/openamp_foundry/cli/commands/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -2954,3 +2954,37 @@ def _run_calibration_intake_check(args: argparse.Namespace) -> int:
print(" Calibration intake validated. Prediction-vs-outcome comparison is recorded.")

return 0 if result.passed else 3


def _run_uncertainty_report_check(args: argparse.Namespace) -> int:
"""Validate an uncertainty quantification report entry."""
import json as _json
from openamp_foundry.evidence.uncertainty_report import validate_uncertainty_report_dict

try:
d = _json.loads(args.entry_json)
except _json.JSONDecodeError as exc:
print(_json.dumps({"status": "error", "error": f"Invalid JSON: {exc}"}))
return 2

if not isinstance(d, dict):
print(_json.dumps({"status": "error", "error": "--entry-json must be a JSON object"}))
return 2

result = validate_uncertainty_report_dict(d)
output_format = getattr(args, "format", "text")

if output_format == "json":
import dataclasses
print(_json.dumps(dataclasses.asdict(result), indent=2))
else:
status = "PASS" if result.passed else "FAIL"
print(f"Uncertainty report {result.report_id} (candidate {result.candidate_id}, width {result.interval_width:.2f}): {status}")
for e in result.errors:
print(f" ERROR: {e}")
for w in result.warnings:
print(f" WARN: {w}")
if result.passed:
print(" Uncertainty report validated. Prediction intervals are documented.")

return 0 if result.passed else 3
23 changes: 22 additions & 1 deletion src/openamp_foundry/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from openamp_foundry.cli.commands.reports import _run_security_report_check
from openamp_foundry.cli.commands.reports import _run_citation_check
from openamp_foundry.cli.commands.reports import _run_roadmap_sync_check
from openamp_foundry.cli.commands.reports import _run_advisory_review_check, _run_annual_review_check, _run_selection_rationale_check, _run_batch_priority_check, _run_pilot_package_check, _run_calibration_intake_check
from openamp_foundry.cli.commands.reports import _run_advisory_review_check, _run_annual_review_check, _run_selection_rationale_check, _run_batch_priority_check, _run_pilot_package_check, _run_calibration_intake_check, _run_uncertainty_report_check

import argparse
import json
Expand Down Expand Up @@ -2053,6 +2053,24 @@ def build_parser() -> argparse.ArgumentParser:
help="Output format (default: text).",
)

# ── Uncertainty report check (Phase K K5) ────────────────────────
urc = sub.add_parser(
"uncertainty-report-check",
help=(
"Validate an uncertainty quantification report. Checks prediction "
"intervals, confidence levels, and calibration source. Dry-lab only."
),
)
urc.add_argument(
"--entry-json", type=str, required=True,
help="JSON string of an UncertaintyReportEntry dict (required).",
)
urc.add_argument(
"--format", type=str, default="text",
choices=["text", "json"],
help="Output format (default: text).",
)

# ── Selection rationale check (Phase K K1) ───────────────────────
src2 = sub.add_parser(
"selection-rationale-check",
Expand Down Expand Up @@ -2370,6 +2388,9 @@ def main(argv: list[str] | None = None) -> int:
if args.command == "calibration-intake-check":
return _run_calibration_intake_check(args)

if args.command == "uncertainty-report-check":
return _run_uncertainty_report_check(args)

parser.error("unknown command")
return 2

Expand Down
Loading
Loading