From abcd4c19010814f1151045332db65677f2800ea7 Mon Sep 17 00:00:00 2001 From: srikar jy Date: Wed, 2 Dec 2026 14:10:30 -0500 Subject: [PATCH 1/3] feat: complete phase 6 scientific integrations --- Concordia_Design/USAGE_AND_INTEGRATION.md | 41 +- .../architecture/API_CONTRACTS.md | 5 + Concordia_Design/architecture/SECURITY.md | 2 + Concordia_Design/docs/STATUS.md | 40 +- Concordia_Design/phases/06-integration.md | 8 +- README.md | 174 +- apps/web/src/openapi.json | 170 ++ packages/sdk/src/concordia_sdk/__init__.py | 22 +- packages/sdk/src/concordia_sdk/client.py | 248 ++- packages/sdk/src/concordia_sdk/models.py | 61 + scripts/export_openapi.py | 1 + services/api/src/concordia_api/main.py | 23 +- services/cli/src/concordia_cli/main.py | 173 +- services/mcp/src/concordia_mcp/server.py | 128 +- tests/fixtures/openapi.json | 1872 ++++++++++++++++- tests/fixtures/phase6_synthetic.csv | 7 + tests/test_integrations.py | 15 +- tests/test_phase6_integrations.py | 60 + 18 files changed, 2859 insertions(+), 191 deletions(-) create mode 100644 packages/sdk/src/concordia_sdk/models.py create mode 100644 tests/fixtures/phase6_synthetic.csv create mode 100644 tests/test_phase6_integrations.py diff --git a/Concordia_Design/USAGE_AND_INTEGRATION.md b/Concordia_Design/USAGE_AND_INTEGRATION.md index b8d19b5..591747e 100644 --- a/Concordia_Design/USAGE_AND_INTEGRATION.md +++ b/Concordia_Design/USAGE_AND_INTEGRATION.md @@ -1,6 +1,6 @@ # Product scope, user guide and AI integration -Concordia is a proposed local research workbench; commands and screens in this guide are target interfaces, not already implemented functionality. +Concordia is a local research workbench. The web UI, Python SDK, CLI, and read-only MCP server call the same authenticated FastAPI contracts; the backend remains authoritative for scientific state and evidence. ## Three user journeys @@ -10,7 +10,7 @@ Concordia is a proposed local research workbench; commands and screens in this g | PhD student | a retrospective research question and eligible summary dataset | register assumptions, run versioned analysis, inspect limitations, compare permitted descriptive summaries, archive artifact | reproducible thesis/paper supplementary material | | Student | supplied synthetic example and tutorial | follow guided workflow, inspect missingness and uncertainty, compare output to hand calculation | learn reproducibility and cautious interpretation | -## Guided local steps (target) +## Guided local steps 1. Install via release instructions and start the app on loopback. Start with included synthetic example. 2. Create a project, document question and license, select scope category and import a derived multi-omics CSV or Parquet table; aggregate tables remain supported where appropriate. @@ -20,13 +20,48 @@ Concordia is a proposed local research workbench; commands and screens in this g 6. Review chart, denominator, uncertainty, findings, evidence IDs and provenance. Interpret only within stated assumptions. 7. Export report and bundle; keep manifest and input digest alongside research record. No causal or clinical conclusions. +## Python SDK and CLI + +The SDK is available as `concordia_sdk.ConcordiaClient` and supports context-manager cleanup, bounded timeouts, typed contract responses, stable exception classes, and GET-only retries. A minimal read-only call is: + +```python +from concordia_sdk import ConcordiaClient + +with ConcordiaClient() as concordia: + for project in concordia.list_projects(): + print(project.project_id, project.name) +``` + +The CLI uses the same client and local token environment: + +```bash +export CONCORDIA_API_URL=http://127.0.0.1:8000 +export CONCORDIA_LOCAL_TOKEN=local-dev-token +concordia projects list --json +concordia datasets quality DATASET_ID --json +concordia runs status RUN_ID --json +concordia evidence verify bundle.json --artifact-root .concordia/artifacts +``` + +State-changing commands require confirmation, or `--yes` in a deliberately noninteractive local workflow. No CLI command computes statistics or bypasses approval. + ## Claude and ChatGPT The same read-only MCP server exposes authorized summaries to both. A local Claude client launches `concordia-mcp` using stdio; use an installed SDK/client version and verify capability discovery. Claude Code can register a local MCP server using its documented `claude mcp add` interface; verify exact arguments against installed `claude mcp add --help`. Claude Desktop may be configured using its supported local MCP configuration. Supply scoped project access through a secure credential mechanism; never paste secrets into prompts. Test `get_run_status` and `get_report_summary` with synthetic runs before use. For ChatGPT, a compatible hosted custom MCP connection requires HTTPS and configured authentication; eligibility depends on subscription and workspace settings. Follow [OpenAI’s custom MCP connection instructions](https://help.openai.com/en/articles/12584461-connecting-custom-mcp-servers-in-chatgpt). Do not claim that a Plus account or localhost connector necessarily supports this setup. Where native custom MCP is unavailable, export the permitted report for upload into chat, or use the separately authorized application/API integration. Never expose local data through a public unauthenticated tunnel. -MCP uses supported negotiated stdio/Streamable HTTP protocol versions; check [the protocol specification](https://modelcontextprotocol.io/specification/). Clients receive only evidence summaries and cannot start compute or change plans. Tool schemas are identical across client adapters. A tool error should be explained, not bypassed. +MCP uses the installed FastMCP stdio transport for local clients. The registered read-only tools are `get_capabilities`, `list_projects`, `list_datasets`, `get_dataset_quality`, `list_analysis_runs`, `get_run_status`, `get_run_results`, `get_run_findings`, `get_run_manifest`, `get_evidence_summary`, `search_evidence`, and `get_report_summary`. Clients receive only API-authorized evidence and cannot start compute or change plans. Tool schemas are tested locally; a tool error should be explained, not bypassed. + +Run the local server with: + +```bash +CONCORDIA_API_URL=http://127.0.0.1:8000 \ +CONCORDIA_LOCAL_TOKEN=local-dev-token \ +uv run python -m concordia_mcp.server +``` + +Claude Code/Desktop configuration is local-client specific and should use the installed client’s documented MCP registration command/configuration. ChatGPT custom MCP requires an HTTPS endpoint and account/workspace eligibility; Concordia does not claim localhost or Plus-plan support. If that connection is unavailable, use the deterministic report or SDK/CLI export instead. ### Example user prompts diff --git a/Concordia_Design/architecture/API_CONTRACTS.md b/Concordia_Design/architecture/API_CONTRACTS.md index 8221d55..250dcfa 100644 --- a/Concordia_Design/architecture/API_CONTRACTS.md +++ b/Concordia_Design/architecture/API_CONTRACTS.md @@ -10,11 +10,14 @@ All identifiers are opaque UUIDs, timestamps UTC ISO-8601, byte digests SHA-256 | GET `/api/v1/capabilities` | none | supported schema/methods 200 | authenticated | | POST `/api/v1/projects` | name, purpose, data policy | project 201 | owner create | | GET `/api/v1/projects` | cursor, limit | permitted page 200 | membership | +| GET `/api/v1/projects/{id}/datasets` | none | permitted dataset manifests 200 | membership | +| GET `/api/v1/projects/{id}/runs` | none | permitted run summaries 200 | membership | | POST `/api/v1/projects/{id}/datasets` | multipart, metadata | manifest 201 | editor | | GET `/api/v1/datasets/{id}` | none | manifest 200 | member | | GET `/api/v1/datasets/{id}/quality` | none | QC report 200 | member | | POST `/api/v1/datasets/{id}/acknowledgements` | warning IDs, digest | `QualityAcknowledgement` 201 | human editor | | POST `/api/v1/analysis-plans` | dataset ID, operation ID, approved options | plan preview 201 | editor | +| GET `/api/v1/analysis-plans/{id}` | none | immutable plan 200 | membership | | POST `/api/v1/analysis-plans/{id}/approve` | digest, confirmation | approved plan 200 | human editor | | POST `/api/v1/runs` | plan ID, idempotency key header | run 202 | human editor | | GET `/api/v1/runs/{id}` | none | run status 200 | member | @@ -53,6 +56,8 @@ All identifiers are opaque UUIDs, timestamps UTC ISO-8601, byte digests SHA-256 `RunManifest`: run and plan IDs, input artifact ID/hash, plan hash, registered method ID/version, source commit, lock digest, runtime, peak memory, terminal status, result/diagnostic artifact IDs and hashes, split/calibration/missing-modality manifests, limitations, manifest digest, and creation time. `RunManifest` is published only after result and diagnostic artifacts are written and verified. +Phase 6 clients use the same `/api/v1` routes and `X-Concordia-Token` local authentication header. GET/HEAD requests may be retried by clients after transport or 502/503/504 failures; mutations are never silently retried. `POST /api/v1/runs` accepts an optional `Idempotency-Key` header and the server returns the existing run for the same approved plan/key. Clients must treat `401`, `403`, `404`, `409`, `413`, and `422` as explicit failures and must not infer scientific state from HTTP success alone. + `ResultRow`: evidence ID, metric, value or null, unit, denominator or null, uncertainty bounds or null, uncertainty method or null, calibration status or null, modality mask or null, applicability status, evidence artifact ID. Never substitute zero for missing. `Finding`: stable finding ID, check ID/version, severity, reason, evidence references, limitation, and suggested review. Acknowledgement of a Phase 1 warning never changes a Phase 3 finding to a pass. `EvidenceBundle`: bundle ID, run ID, manifest digest, source and result refs, findings, provenance, calibration and missing-modality summaries, limitations, bundle digest, bundle/report artifact IDs and hashes. Evidence payloads are canonical JSON and are verified against every referenced artifact before export. `EvaluationResult`: frozen protocol ID/version, fixture set, precision/recall, false positives, missed blocking cases, runtime, memory, limitations, and result digest. `Explanation`: source bundle ID, provider/model version, claim array, verified evidence IDs, validation status, source status, and fallback status. Reports are deterministic and offline. ## Error envelope diff --git a/Concordia_Design/architecture/SECURITY.md b/Concordia_Design/architecture/SECURITY.md index 686b6b8..117f88f 100644 --- a/Concordia_Design/architecture/SECURITY.md +++ b/Concordia_Design/architecture/SECURITY.md @@ -18,6 +18,8 @@ Untrusted sources: uploaded tables, documents, user text, remote model output, M Local single-user mode bound to loopback with explicit local token/session; do not mistake localhost access for multi-user auth. Hosted: user OIDC identity, project roles owner/editor/viewer, service identity limited by role and operation. Deny default, reauthorize every object even if UUID known, short-lived tokens, no secrets in URLs or logs. Use TLS and restricted private network; no unrestricted external fetch, credentials or shell in worker/model. Limit outbound model traffic to explicitly configured destinations; default offline. Revoke access and expire sessions; separate development and production. +Phase 6 SDK and CLI keep the token in process memory and use bounded HTTPX timeouts. Only idempotent reads may be retried. Mutations require explicit CLI confirmation unless `--yes` is supplied for a scripted local workflow; no client can approve or execute without the API state gate. The MCP facade is read-only and calls the API rather than the database. MCP output is bounded, evidence text is untrusted content, and no tool accepts filesystem paths, SQL, code, credentials, or model-execution requests. + ## Privacy and biological scope MVP accepts synthetic, public, appropriately licensed, de-identified or aggregate human noninfectious observational information with derived multi-omics feature blocks. Reject raw genomes, biological sequences, direct identifiers, pathogenic-agent information, experimental design or optimization, reidentification requests and sensitive individual-level clinical records; do not add unrestricted plugins, model tools or user-provided code. No wet-lab instructions, intervention recommendations, sequences, clinical actions or causal claims. Any new data category requires documented scope and independent review; no model can change policy or approvals. Suppress small groups on exports under defined policy (choose threshold with owner review; not a claim of differential privacy). Treat data-use terms and consent as prerequisites. Do not send confidential inputs to third parties by default. diff --git a/Concordia_Design/docs/STATUS.md b/Concordia_Design/docs/STATUS.md index b6d2f33..7f167bd 100644 --- a/Concordia_Design/docs/STATUS.md +++ b/Concordia_Design/docs/STATUS.md @@ -17,8 +17,8 @@ Concordia is a CPU-first observational multi-omics cohort analysis product for p - Phase 2: implemented and audited on 2026-11-29. Phase 3 and later remain unadvanced. - Phase 3: implemented and audited on 2026-11-29. Versioned checks gate publication and the operator-only evaluation endpoint uses frozen development and held-out synthetic fixtures. - Phase 4: implemented and audited on 2026-12-02; optional external model execution remains disabled by design. -- Phase 5: not advanced; Phase 1 upload/project boundary was corrected in the existing static workflow. -- Phase 6: not audited or advanced in this Phase 1 change. +- Phase 5: implemented and merged in `1d11e5b`; the React/Vite scientist workbench uses the canonical API and generated OpenAPI client schema. +- Phase 6: implemented on `feat/phase-6-integration`; final verification evidence is recorded below. No Phase 7 work is included. - Phase 7: not audited or advanced in this Phase 1 change. ## Phase 1 acceptance audit @@ -147,4 +147,38 @@ Reports contain computed summaries only. Synthetic fixtures are not biological v ## Next ticket -P5-01 — guided UI and charts. Phase 5 was not started in this change. +P7-01 — release and research package after owner review of Phase 6 evidence. + +## Phase 6 integration audit and acceptance + +### Baseline audit + +At the Phase 6 branch start, the API already owned all scientific state transitions, credibility gates, and evidence verification. The SDK had only capabilities, project creation/listing, upload, quality, acknowledgement, plan creation/approval, run start, and Markdown report methods with untyped `Any` responses and no exception taxonomy. The CLI exposed four flat commands. The MCP server exposed four direct `httpx` read tools and had no bounded collection, quality, result, manifest, evidence, or search tools. Existing MCP registration coverage asserted only tool names. + +### Implemented + +- Typed SDK transport with context-manager cleanup, bounded timeouts, GET-only retries, stable exception classes, typed contract parsing, safe idempotency-key run starts, report/artifact export, and evidence retrieval. +- Canonical API collection/read routes for project datasets, project runs, and analysis-plan retrieval. +- Hierarchical CLI commands for projects, datasets, plans, runs, evidence export, and offline bundle verification; JSON output and explicit mutation confirmation are supported. +- Read-only MCP tools for capabilities, projects, datasets, quality, runs, results, findings, manifests, evidence summaries, bounded search, and deterministic report summaries. +- Cross-client contract tests for authentication errors, mutation retry behavior, collection authorization, CLI discovery, and MCP tool registration. +- README, usage, API contract, security, phase, and status documentation updated without changing the scientific scope. + +### Verification record + +- `UV_CACHE_DIR="$PWD/.uv-cache" uv sync --locked`: passed. +- `uv run pytest -q`: 49 passed, 3 existing FastAPI/Starlette deprecation warnings. +- `uv run ruff check packages services tests scripts`: passed. +- `uv run mypy packages services`: passed with no issues in 21 source files. +- `git diff --check`: passed. +- `uv run alembic upgrade head && uv run alembic current`: passed; `0003_evidence_fts (head)`. +- `uv run pip-audit --strict`: passed; no known vulnerabilities. The first sandboxed attempt was DNS-blocked and was rerun with network permission. +- `docker build --tag concordia:phase6-local .`: passed on the local CPU container runtime. +- `cd apps/web && npm ci && npm test -- --run && npm run build`: passed; 2 frontend tests and production build passed. Existing jsdom canvas and Rollup bundle-size warnings remain non-failing. +- `uv run python -m concordia_cli.main --help`: passed and displayed the hierarchical Phase 6 command tree. +- `uv run python -m concordia_cli.main evidence verify /private/tmp/concordia-phase6-inprocess-bundle-2.json --json`: passed; 3 artifacts verified. +- MCP stdio protocol harness: initialized successfully with protocol `2025-11-25`, discovered 12 read-only tools. +- `CONCORDIA_INPROCESS=1 CONCORDIA_DATA_ROOT=/private/tmp/concordia-phase6-inprocess-2 CONCORDIA_PHASE6_OUTPUT=/private/tmp/concordia-phase6-inprocess-bundle-2.json uv run python scripts/run_phase6_integration.py`: passed against the real FastAPI application. One warning, published run, 2 SDK result rows, 2 MCP result rows, 3 SDK findings, 3 MCP findings, 2,071-character report, and independent bundle verification `verified: true` over 3 artifacts. +- A separate live Uvicorn/HTTPX replay was attempted, but this execution environment terminated or isolated loopback server processes after health probing. No live-network success is claimed; the recorded cross-client replay uses FastAPI TestClient against the actual routes and schemas. + +Hosted Claude, ChatGPT, and remote MCP connections remain unverified and are not advertised as supported integrations. diff --git a/Concordia_Design/phases/06-integration.md b/Concordia_Design/phases/06-integration.md index 8bb1f12..aa3945c 100644 --- a/Concordia_Design/phases/06-integration.md +++ b/Concordia_Design/phases/06-integration.md @@ -2,12 +2,14 @@ **Entry:** published API contracts and evidence bundles. **Exit:** approved clients retrieve the same evidence without direct data-store access. -1. Implement `concordia` CLI for project owner local flows: capabilities, validate, plan preview, approved run, status, report, export. All actions pass canonical backend policies; CLI is not a privileged bypass. -2. Add read-only MCP facade using official Python MCP SDK or FastMCP after compatibility verification. Tools: `list_projects`, `get_dataset_quality`, `get_run_status`, `get_run_findings`, `search_evidence`, `get_report_summary`. Do not expose arbitrary query/SQL, file read, execution, write tools or run initiation to LLM clients. +1. Implement `concordia` CLI for project owner local flows: capabilities, projects, datasets, plans, runs, report, export and offline verification. All actions pass canonical backend policies; CLI is not a privileged bypass. +2. Add read-only MCP facade using the installed FastMCP SDK. Tools expose project, dataset quality, run, findings, evidence and report summaries. Do not expose arbitrary query/SQL, file read, execution, write tools or run initiation to LLM clients. 3. Implement server tool schemas with project-scoped access and output byte limits. For local Claude clients use stdio; hosted eligible clients use Streamable HTTP and negotiated protocol version with separately configured authentication. 4. Test tool discovery, invalid IDs, scope denial, revoked token, malformed arguments, untrusted evidence, output truncation, and client-version compatibility. All tools return stable IDs, units and limitations. -5. Document Claude Code, Claude Desktop, ChatGPT custom-MCP eligibility and API/export fallbacks. Do not assume every subscription permits custom MCP; test on actual target account before claiming support. +5. Document Claude Code, Claude Desktop, ChatGPT custom-MCP eligibility and API/export fallbacks. This repository verifies local protocol registration; hosted client eligibility remains account- and configuration-dependent. **Stack:** Typer, HTTPX, Python MCP SDK/FastMCP, OAuth-compatible authorization gateway for remote, FastAPI API client. stdio JSON-RPC local; HTTPS Streamable HTTP remote; API is authoritative; no database port exposed. No public unauthenticated endpoint. +**Phase 6 status:** local SDK, CLI, and read-only MCP adapters are implemented against the canonical API. A local MCP protocol harness and synthetic cross-client evidence replay are required release evidence; remote hosted MCP clients are not claimed. + **Handoff:** Phase 7 validates local and tested remote adapters against identical evidence fixtures; unsupported client integrations remain clearly labeled. diff --git a/README.md b/README.md index d15d593..027fec4 100644 --- a/README.md +++ b/README.md @@ -1,100 +1,145 @@ # Concordia -![Phase 4](https://img.shields.io/badge/phase-4%20complete-2ea44f) +![Phase 6](https://img.shields.io/badge/phase-6%20integration-2ea44f) ![Python](https://img.shields.io/badge/Python-3.12%2B-3776ab?logo=python&logoColor=white) -![FastAPI](https://img.shields.io/badge/FastAPI-API-009688?logo=fastapi&logoColor=white) +![FastAPI](https://img.shields.io/badge/FastAPI-canonical%20API-009688?logo=fastapi&logoColor=white) ![CPU first](https://img.shields.io/badge/compute-CPU--first-6f42c1) -![Tests](https://img.shields.io/badge/tests-45%20passing-2ea44f) -![License](https://img.shields.io/badge/license-research%20prototype-orange) +![Local verification](https://img.shields.io/badge/verification-local%20tests%20recorded-2ea44f) -Concordia is a CPU-first, observational multi-omics workbench for analyzing permitted derived feature tables with explicit data-quality, missingness, provenance, credibility, and evidence controls. +Concordia is a CPU-first observational multi-omics workbench for permitted derived feature tables. It connects bounded intake, missingness-aware analysis, independent credibility checks, and verifiable evidence through a React workbench, Python SDK, CLI, and read-only MCP server. ## About -Concordia is designed for researchers who need to understand how a multi-omics analysis was performed and whether its outputs are suitable for review. It guides a dataset from bounded intake through quality review, human-approved analysis planning, deterministic CPU execution, credibility checks, and independently verifiable evidence reporting. +Researchers can inspect how an observational multi-omics analysis was performed and whether its outputs are suitable for review. Concordia preserves modality availability masks, frozen plans, registered method versions, calibration and uncertainty fields, provenance hashes, credibility findings, and limitations from the API through every client. -The project’s research hypothesis is modality-adaptive gated fusion under missing modalities with calibrated uncertainty. Concordia makes that hypothesis inspectable by preserving modality masks, split information, method versions, units, denominators, uncertainty, input hashes, and limitations alongside computed results. +The research direction is a modality-adaptive gated model under missing modalities with calibrated uncertainty. It remains an engineering hypothesis, not a novelty or biological-validation claim. Concordia is not a clinical decision system, causal inference engine, pathogen tool, sequence-design system, or unrestricted execution platform. -Concordia is an observational research workbench—not a clinical decision system, causal inference engine, biological execution platform, or claims-generation system. +## Features -## Current status +- Bounded CSV/Parquet intake for synthetic, public-derived, or de-identified derived multi-omics data. +- Quality and missingness reports with explicit warning acknowledgement and blocked states. +- Human-approved immutable analysis plans and deterministic CPU execution with idempotent run starts. +- Phase 3 credibility findings and Phase 4 hash-verified evidence bundles, Markdown/HTML reports, retrieval, and offline verification. +- Phase 5 React/TypeScript workbench with accessible tables, charts, provenance, findings, and exports. +- Phase 6 typed Python SDK, hierarchical CLI, and read-only MCP tools backed by the same FastAPI contracts. -Phase 4 is complete on the `phases-1-5-workflow` branch. The release includes: +## Architecture -- Phase 1 — authenticated project and dataset intake for bounded CSV/Parquet files, modality contracts, explicit missingness masks, quality reports, provenance hashes, and restart-safe artifacts. -- Phase 2 — immutable dataset eligibility, plan preview and approval, registered CPU methods, deterministic runs, resource limits, durable results, and reproducible manifests. -- Phase 3 — versioned credibility findings, fail-closed publication, hash/version/leakage/metadata/denominator checks, missingness disclosure, and frozen development/held-out evaluations. -- Phase 4 — immutable evidence bundles, deterministic Markdown and HTML reports, SQLite FTS5 retrieval, verified artifact export, and grounded deterministic explanation fallback. +```mermaid +flowchart LR + UI[React researcher workbench] --> API[FastAPI /api/v1 canonical contracts] + SDK[Python SDK] --> API + CLI[Typer CLI] --> SDK + MCP[Read-only MCP server] --> SDK + API --> WF[Workflow and credibility gates] + WF --> STORE[(SQLite metadata + managed artifacts)] + WF --> EVID[Verified evidence and deterministic reports] +``` -Phase 5 and later work are intentionally not included. +Clients do not calculate scientific results or access the database directly. The API reauthorizes object access, enforces scope and approval state, verifies artifacts, and returns stable error envelopes. -## Registered methods +## Quick start -- `cohort_summary_v1` — descriptive cohort summaries. -- `complete_modality_logistic_v1` — complete-modality CPU baseline. -- `modality_adaptive_gated_linear_v1` — mask-aware multi-omics analysis with explicit modality availability masks. +Requirements: Python 3.12 or 3.13, `uv`, Node.js/npm for the frontend, and Docker only for the optional image check. -## Evidence and reporting +```bash +export UV_CACHE_DIR="$PWD/.uv-cache" +uv sync --locked +uv run alembic upgrade head +CONCORDIA_LOCAL_TOKEN=local-dev-token \ + uv run uvicorn concordia_api.main:app --host 127.0.0.1 --port 8000 +``` -Published runs produce canonical evidence bundles containing the approved plan, dataset metadata, quality review, provenance, method and version, missingness and calibration summaries, credibility findings, permitted result summaries, limitations, source identifiers, and artifact hashes. +In another shell: -Reports are generated offline and deterministically. Evidence retrieval uses SQLite FTS5 over permitted report and finding fragments. Optional language explanations are bounded, citation-checked, and unable to alter results or initiate computation. The deterministic report remains the required fallback. +```bash +cd apps/web +npm ci +npm run dev +``` -## Safety and research boundaries +Open the Vite URL or `http://127.0.0.1:8000/`. Local authentication uses the process-configured `X-Concordia-Token`; it is not hosted multi-user authorization. -Concordia reports descriptive and associational results. It does not establish causation, clinical utility, treatment recommendations, or scientific novelty. +## Python SDK -The local MVP rejects raw genomes and sequences, pathogen data, direct identifiers, sensitive individual-level clinical records, interventions, reidentification requests, arbitrary user code, filesystem paths, SQL, unrestricted model access, and GPU-only workflows. Synthetic results are engineering fixtures, not biological validation. +```python +from concordia_sdk import ConcordiaClient -## Quick start +with ConcordiaClient("http://127.0.0.1:8000", "local-dev-token") as concordia: + capabilities = concordia.capabilities() + projects = concordia.list_projects() + print(capabilities.schema_version, [project.name for project in projects]) +``` -Requirements: Python 3.12 or 3.13 and [`uv`](https://docs.astral.sh/uv/). +The SDK exposes typed project, dataset, quality, plan, run, result, finding, manifest, evidence, report, artifact, and search operations. It has explicit authentication, authorization, validation, conflict, not-found, timeout, and transport exceptions. Only idempotent reads retry. + +## CLI ```bash -export UV_CACHE_DIR="$PWD/.uv-cache" -uv sync --locked +export CONCORDIA_API_URL=http://127.0.0.1:8000 +export CONCORDIA_LOCAL_TOKEN=local-dev-token +concordia --help +concordia projects list --json +concordia datasets quality DATASET_ID --json +concordia plans show PLAN_ID --json +concordia runs status RUN_ID --json +concordia evidence export RUN_ID --output bundle.json --yes +concordia evidence verify bundle.json --artifact-root .concordia/artifacts +``` + +Mutating commands require explicit confirmation unless `--yes` is supplied. The CLI never approves or executes an analysis automatically and does not perform scientific calculations. + +## MCP + +The MCP server is local and read-only. It calls the canonical API through the SDK and exposes capabilities, projects, datasets, quality, runs, results, findings, manifests, evidence summaries, bounded evidence search, and deterministic report summaries. It cannot create or approve plans, start or cancel runs, modify datasets, execute code or SQL, read arbitrary paths, or bypass suppressed evidence. + +```bash +CONCORDIA_API_URL=http://127.0.0.1:8000 \ CONCORDIA_LOCAL_TOKEN=local-dev-token \ - uv run uvicorn concordia_api.main:app --host 127.0.0.1 --port 8000 +uv run python -m concordia_mcp.server ``` -Open `http://127.0.0.1:8000/`. Authenticated requests use `X-Concordia-Token: local-dev-token`. This is a single-user local development boundary, not hosted multi-user authorization. +Local MCP protocol registration is tested in this repository. Claude Code/Desktop configuration must follow the installed client’s documented local MCP settings. ChatGPT custom MCP requires an eligible account/workspace and an authenticated HTTPS endpoint; localhost support is not claimed. Use the SDK/CLI report export when hosted MCP is unavailable. + +## Reproducible example -## Reproduce the workflow +The synthetic fixture is `tests/fixtures/synthetic_multiomics.json`. The deterministic workflow demonstration is: ```bash export UV_CACHE_DIR="$PWD/.uv-cache" uv run python scripts/run_synthetic_demo.py +uv run pytest -q uv run python -c 'from concordia_core import run_frozen_evaluation; import json; print(json.dumps({k: run_frozen_evaluation(k) for k in ("development", "held_out")}, indent=2, sort_keys=True))' ``` -To independently verify a saved bundle, substitute the artifact ID returned by the evidence API: +For a published run, `concordia evidence export` downloads the API-authorized bundle and `concordia evidence verify` independently checks its canonical digest and referenced artifact hashes. Synthetic values are engineering fixtures, not biological evidence. -```bash -uv run python scripts/verify_evidence_bundle.py \ - .concordia/artifacts/.bin \ - --artifact-root .concordia/artifacts -``` +## Scientific evaluation -## API surface +The frozen credibility evaluation reports development and held-out fault fixtures separately. The recorded Phase 3 result was precision 1.0 and recall 1.0 for both fixture sets, with no false positives or missed blocking cases. The deterministic baseline detected development faults but missed held-out blocking faults. These are small synthetic rule-check evaluations, not population performance, clinical validation, causality, or proof of model superiority. + +## Limitations -- `POST /api/v1/projects` -- `POST /api/v1/projects/{project_id}/datasets` -- `GET /api/v1/datasets/{dataset_id}/quality` -- `POST /api/v1/analysis-plans` -- `POST /api/v1/analysis-plans/{plan_id}/approve` -- `POST /api/v1/runs` -- `GET /api/v1/runs/{run_id}/results` -- `GET /api/v1/runs/{run_id}/manifest` -- `GET /api/v1/runs/{run_id}/findings` -- `GET /api/v1/runs/{run_id}/evidence` -- `GET /api/v1/runs/{run_id}/report?format=markdown|html` -- `GET /api/v1/evidence/search?q=...` -- `GET /api/v1/artifacts/{artifact_id}` -- `POST /api/v1/runs/{run_id}/explanations` +- Fixtures are small and synthetic; no biological or clinical validation is claimed. +- The product is associational and cannot establish causation or recommend treatment. +- Local authentication is a single-user token boundary; hosted RBAC/OIDC is not implemented. +- Execution is local and CPU-first; distributed scheduling and hard-kill recovery are outside this phase. +- Optional language explanations remain deterministic and evidence-bound; no external model is required. +- MCP remote/hosted client compatibility depends on the actual client, account, HTTPS, and authorization configuration. -Blocked, failed, incomplete, or corrupted runs cannot expose evidence. Acknowledgements preserve review provenance and never convert a blocked finding into an approval. +## Roadmap -## Verification +- Phase 1 — ingestion and quality ledger: complete. +- Phase 2 — approved deterministic analysis runtime: complete. +- Phase 3 — credibility checks and frozen evaluation: complete. +- Phase 4 — evidence, reports, retrieval, and verification: complete. +- Phase 5 — scientist-facing workbench: complete. +- Phase 6 — SDK, CLI, and read-only MCP integrations: complete locally; hosted/remote MCP clients remain unverified. +- Phase 7 — release and research package: not started. + +## Contributing and license + +Run the verification commands below before submitting changes. Preserve scope boundaries, evidence provenance, and explicit blocked states. Do not add raw sequence, pathogen, clinical-action, causal, arbitrary-code, or unrestricted model functionality. ```bash export UV_CACHE_DIR="$PWD/.uv-cache" @@ -105,22 +150,7 @@ uv run mypy packages services uv run alembic upgrade head uv run alembic current uv run pip-audit --strict -docker build --tag concordia:phase4-local . +docker build --tag concordia:phase6-local . ``` -Phase 4 verification recorded 45 passing tests, clean Ruff and mypy checks, migration head `0003_evidence_fts`, no known dependency vulnerabilities, and a successful Docker build. FastAPI/Starlette emit non-failing deprecation warnings in the current environment. - -## Documentation - -- [`Concordia_Design/docs/STATUS.md`](Concordia_Design/docs/STATUS.md) — acceptance evidence, verification results, and limitations. -- [`Concordia_Design/phases/04-evidence-llm.md`](Concordia_Design/phases/04-evidence-llm.md) — approved Phase 4 scope. -- [`Concordia_Design/docs/adr/`](Concordia_Design/docs/adr/) — architectural decisions and scope boundaries. -- [`Concordia_Design/IMPLEMENTATION_BACKLOG.md`](Concordia_Design/IMPLEMENTATION_BACKLOG.md) — roadmap and phase backlog. - -## Topics - -`multi-omics` · `bioinformatics` · `scientific-software` · `reproducible-research` · `data-provenance` · `quality-control` · `missing-data` · `FastAPI` · `SQLite` · `Python` · `CPU-first` - -## Limitations - -The current fixtures are synthetic and small. They demonstrate engineering behavior, reproducibility, and safety controls; they do not establish biological validity, population performance, causality, or clinical utility. Hosted RBAC, distributed execution, model-based explanations, and later frontend phases remain outside this release. +No license file is currently present in the repository. Add an owner-approved license before redistributing the project. diff --git a/apps/web/src/openapi.json b/apps/web/src/openapi.json index 47603ac..1743218 100644 --- a/apps/web/src/openapi.json +++ b/apps/web/src/openapi.json @@ -382,6 +382,62 @@ "summary": "Create Plan" } }, + "/api/v1/analysis-plans/{plan_id}": { + "get": { + "operationId": "get_plan_api_v1_analysis_plans__plan_id__get", + "parameters": [ + { + "in": "path", + "name": "plan_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Plan Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Get Plan Api V1 Analysis Plans Plan Id Get" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Plan" + } + }, "/api/v1/analysis-plans/{plan_id}/approve": { "post": { "operationId": "approve_plan_api_v1_analysis_plans__plan_id__approve_post", @@ -1000,6 +1056,62 @@ } }, "/api/v1/projects/{project_id}/datasets": { + "get": { + "operationId": "list_datasets_api_v1_projects__project_id__datasets_get", + "parameters": [ + { + "in": "path", + "name": "project_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Project Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": {}, + "title": "Response List Datasets Api V1 Projects Project Id Datasets Get", + "type": "array" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "List Datasets" + }, "post": { "operationId": "upload_dataset_api_v1_projects__project_id__datasets_post", "parameters": [ @@ -1065,6 +1177,64 @@ "summary": "Upload Dataset" } }, + "/api/v1/projects/{project_id}/runs": { + "get": { + "operationId": "list_runs_api_v1_projects__project_id__runs_get", + "parameters": [ + { + "in": "path", + "name": "project_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Project Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": {}, + "title": "Response List Runs Api V1 Projects Project Id Runs Get", + "type": "array" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "List Runs" + } + }, "/api/v1/runs": { "post": { "operationId": "start_run_api_v1_runs_post", diff --git a/packages/sdk/src/concordia_sdk/__init__.py b/packages/sdk/src/concordia_sdk/__init__.py index c4053a8..fb4f2b5 100644 --- a/packages/sdk/src/concordia_sdk/__init__.py +++ b/packages/sdk/src/concordia_sdk/__init__.py @@ -1,3 +1,21 @@ -from .client import ConcordiaClient +from .client import ( + AuthenticationError, + AuthorizationError, + ConcordiaClient, + ConcordiaError, + ConflictError, + NotFoundError, + TransportError, + ValidationError, +) -__all__ = ["ConcordiaClient"] +__all__ = [ + "AuthenticationError", + "AuthorizationError", + "ConcordiaClient", + "ConcordiaError", + "ConflictError", + "NotFoundError", + "TransportError", + "ValidationError", +] diff --git a/packages/sdk/src/concordia_sdk/client.py b/packages/sdk/src/concordia_sdk/client.py index d732ec1..b8840b8 100644 --- a/packages/sdk/src/concordia_sdk/client.py +++ b/packages/sdk/src/concordia_sdk/client.py @@ -2,63 +2,233 @@ import json from pathlib import Path -from typing import Any +from time import sleep +from typing import Any, TypeVar, cast from uuid import UUID import httpx +from concordia_contracts import ( + AnalysisPlan, + DatasetManifest, + EvidenceSearchResult, + Finding, + Project, + QualityAcknowledgement, + QualityReport, + Run, + RunManifest, +) +from pydantic import TypeAdapter +from .models import Capabilities, EvidenceResponse, ResultsResponse -class ConcordiaClient: - """Small authenticated REST client; the API remains the policy authority.""" +T = TypeVar("T") + + +class ConcordiaError(RuntimeError): + """Base error for failed Concordia API calls.""" + + def __init__(self, message: str, *, status_code: int | None = None, code: str = "HTTP_ERROR", request_id: str | None = None, retryable: bool = False) -> None: + super().__init__(message) + self.status_code = status_code + self.code = code + self.request_id = request_id + self.retryable = retryable + + +class AuthenticationError(ConcordiaError): + pass + + +class AuthorizationError(ConcordiaError): + pass + + +class NotFoundError(ConcordiaError): + pass + + +class ConflictError(ConcordiaError): + pass + + +class ValidationError(ConcordiaError): + pass - def __init__(self, base_url: str = "http://127.0.0.1:8000", token: str = "local-dev-token") -> None: - self.base_url = base_url.rstrip("/") - self.headers = {"X-Concordia-Token": token} - def _request(self, method: str, path: str, **kwargs: Any) -> Any: - response = httpx.request(method, f"{self.base_url}{path}", headers=self.headers, **kwargs) - response.raise_for_status() - return response.json() if response.headers.get("content-type", "").startswith("application/json") else response.text +class TransportError(ConcordiaError): + pass - def capabilities(self) -> Any: - return self._request("GET", "/api/v1/capabilities") - def list_projects(self) -> Any: - return self._request("GET", "/api/v1/projects") +class ConcordiaClient: + """Typed client for the canonical Concordia API. - def create_project(self, name: str, purpose: str, data_category: str = "synthetic_multiomics") -> Any: - return self._request("POST", "/api/v1/projects", json={"name": name, "purpose": purpose, "data_category": data_category}) + Scientific computation, authorization, state transitions, and evidence + verification remain server-side. + """ - def upload_dataset(self, project_id: UUID | str, dataset_path: Path, modalities: list[dict[str, str]], source_label: str = "local", license_name: str = "user-declared") -> Any: - suffix = dataset_path.suffix.lower() - content_type = { - ".csv": "text/csv", - ".parquet": "application/octet-stream", - }.get(suffix) + def __init__(self, base_url: str = "http://127.0.0.1:8000", token: str = "local-dev-token", *, timeout: float = 10.0, max_retries: int = 2, http_client: httpx.Client | None = None) -> None: + if timeout <= 0: + raise ValueError("timeout must be positive") + if not 0 <= max_retries <= 3: + raise ValueError("max_retries must be between 0 and 3") + self.base_url = base_url.rstrip("/") + self._http = http_client or httpx.Client(timeout=timeout, headers={"Accept": "application/json", "X-Concordia-Token": token}) + self._http.headers.update({"Accept": "application/json", "X-Concordia-Token": token}) + self._max_retries = max_retries + + def __enter__(self) -> ConcordiaClient: + return self + + def __exit__(self, *_: object) -> None: + self.close() + + def close(self) -> None: + self._http.close() + + def _url(self, path: str) -> str: + return f"{self.base_url}/api/v1{path}" + + def _raise_for_error(self, response: httpx.Response) -> None: + try: + payload = response.json() + except ValueError: + payload = {} + error = payload.get("error", {}) if isinstance(payload, dict) else {} + detail = payload.get("detail") if isinstance(payload, dict) else None + message = str(error.get("message") or detail or response.text or "API request failed") + code = str(error.get("code") or "HTTP_ERROR") + request_id = str(error.get("request_id")) if error.get("request_id") else None + retryable = bool(error.get("retryable", False)) + error_type: type[ConcordiaError] = ConcordiaError + if response.status_code == 401: + error_type = AuthenticationError + elif response.status_code == 403: + error_type = AuthorizationError + elif response.status_code == 404: + error_type = NotFoundError + elif response.status_code == 409: + error_type = ConflictError + elif response.status_code in (400, 413, 422): + error_type = ValidationError + raise error_type(message, status_code=response.status_code, code=code, request_id=request_id, retryable=retryable) + + def _request(self, method: str, path: str, *, response_type: type[T] | None = None, **kwargs: Any) -> T: + attempts = self._max_retries + 1 if method.upper() in {"GET", "HEAD"} else 1 + for attempt in range(attempts): + try: + response = self._http.request(method, self._url(path), **kwargs) + except httpx.TimeoutException as exc: + if attempt + 1 == attempts: + raise TransportError("request timed out", code="REQUEST_TIMEOUT", retryable=True) from exc + sleep(0.05 * (attempt + 1)) + continue + except httpx.HTTPError as exc: + if attempt + 1 == attempts: + raise TransportError("request failed", code="TRANSPORT_ERROR", retryable=True) from exc + sleep(0.05 * (attempt + 1)) + continue + if response.status_code in {502, 503, 504} and attempt + 1 < attempts: + sleep(0.05 * (attempt + 1)) + continue + if not response.is_success: + self._raise_for_error(response) + if response_type is None: + return response # type: ignore[return-value] + if response_type is str: + return response.text # type: ignore[return-value] + validator = response_type.model_validate # type: ignore[attr-defined] + return cast(T, validator(response.json())) + raise TransportError("request failed", code="TRANSPORT_ERROR", retryable=True) + + def capabilities(self) -> Capabilities: + return self._request("GET", "/capabilities", response_type=Capabilities) + + def list_projects(self) -> list[Project]: + response: httpx.Response = self._request("GET", "/projects") + return TypeAdapter(list[Project]).validate_python(response.json()) + + def create_project(self, name: str, purpose: str, data_category: str = "synthetic_multiomics", *, data_policy: str = "permitted_derived_features") -> Project: + return self._request("POST", "/projects", response_type=Project, json={"name": name, "purpose": purpose, "data_category": data_category, "data_policy": data_policy, "storage_profile": "local_managed"}) + + def list_datasets(self, project_id: UUID | str) -> list[DatasetManifest]: + response: httpx.Response = self._request("GET", f"/projects/{project_id}/datasets") + return TypeAdapter(list[DatasetManifest]).validate_python(response.json()) + + def upload_dataset(self, project_id: UUID | str, dataset_path: Path, modalities: list[dict[str, str]], *, source_label: str = "local", license_name: str = "user-declared") -> DatasetManifest: + content_type = {".csv": "text/csv", ".parquet": "application/octet-stream"}.get(dataset_path.suffix.lower()) if content_type is None: raise ValueError("dataset_path must have a .csv or .parquet suffix") with dataset_path.open("rb") as handle: - files = {"file": (dataset_path.name, handle, content_type)} - data = {"source_label": source_label, "license_name": license_name, "modalities": json.dumps(modalities)} - return self._request("POST", f"/api/v1/projects/{project_id}/datasets", files=files, data=data) + return self._request("POST", f"/projects/{project_id}/datasets", response_type=DatasetManifest, files={"file": (dataset_path.name, handle, content_type)}, data={"source_label": source_label, "license_name": license_name, "modalities": json.dumps(modalities)}) + + def quality(self, dataset_id: UUID | str) -> QualityReport: + return self._request("GET", f"/datasets/{dataset_id}/quality", response_type=QualityReport) + + def acknowledge(self, dataset_id: UUID | str, digest: str, warning_ids: list[str]) -> QualityAcknowledgement: + return self._request("POST", f"/datasets/{dataset_id}/acknowledgements", response_type=QualityAcknowledgement, json={"digest": digest, "warning_ids": warning_ids}) + + def create_plan(self, *, dataset_id: UUID | str, quality_acknowledgement_id: UUID | str, modality_ids: list[str], operation_id: str = "modality_adaptive_gated_linear_v1", declared_target: str = "outcome", missing_modality_policy: str = "explicit_mask", calibration_policy: str = "held_out", seed: int = 17, groups: list[str] | None = None, inclusion_criteria: str = "all_eligible_rows", deadline_seconds: int = 60, memory_mb: int = 2048) -> AnalysisPlan: + payload = {"dataset_id": str(dataset_id), "quality_acknowledgement_id": str(quality_acknowledgement_id), "operation_id": operation_id, "declared_target": declared_target, "modality_ids": modality_ids, "missing_modality_policy": missing_modality_policy, "calibration_policy": calibration_policy, "seed": seed, "groups": groups or [], "inclusion_criteria": inclusion_criteria, "deadline_seconds": deadline_seconds, "memory_mb": memory_mb} + return self._request("POST", "/analysis-plans", response_type=AnalysisPlan, json=payload) + + def get_plan(self, plan_id: UUID | str) -> AnalysisPlan: + return self._request("GET", f"/analysis-plans/{plan_id}", response_type=AnalysisPlan) + + def approve_plan(self, plan_id: UUID | str, plan_hash: str) -> AnalysisPlan: + return self._request("POST", f"/analysis-plans/{plan_id}/approve", response_type=AnalysisPlan, json={"digest": plan_hash, "confirmation": True}) + + def start_run(self, plan_id: UUID | str, *, idempotency_key: str | None = None) -> Run: + headers = {"Idempotency-Key": idempotency_key} if idempotency_key else None + return self._request("POST", "/runs", response_type=Run, headers=headers, json={"plan_id": str(plan_id)}) + + def list_runs(self, project_id: UUID | str) -> list[Run]: + response: httpx.Response = self._request("GET", f"/projects/{project_id}/runs") + return TypeAdapter(list[Run]).validate_python(response.json()) + + def run_status(self, run_id: UUID | str) -> Run: + return self._request("GET", f"/runs/{run_id}", response_type=Run) + + def cancel_run(self, run_id: UUID | str) -> Run: + return self._request("POST", f"/runs/{run_id}/cancel", response_type=Run) + + def results(self, run_id: UUID | str) -> ResultsResponse: + return self._request("GET", f"/runs/{run_id}/results", response_type=ResultsResponse) + + def findings(self, run_id: UUID | str) -> list[Finding]: + response: httpx.Response = self._request("GET", f"/runs/{run_id}/findings") + return TypeAdapter(list[Finding]).validate_python(response.json()) + + def manifest(self, run_id: UUID | str) -> dict[str, Any]: + response: httpx.Response = self._request("GET", f"/runs/{run_id}/manifest") + return cast(dict[str, Any], response.json()) + + def run_manifest(self, run_id: UUID | str) -> RunManifest: + return RunManifest.model_validate(self.manifest(run_id)["manifest"]) - def upload_csv(self, project_id: UUID | str, csv_path: Path, modalities: list[dict[str, str]], source_label: str = "local", license_name: str = "user-declared") -> Any: - return self.upload_dataset(project_id, csv_path, modalities, source_label, license_name) + def evidence(self, run_id: UUID | str) -> EvidenceResponse: + return self._request("GET", f"/runs/{run_id}/evidence", response_type=EvidenceResponse) - def quality(self, dataset_id: UUID | str) -> Any: - return self._request("GET", f"/api/v1/datasets/{dataset_id}/quality") + def search_evidence(self, query: str, limit: int = 20) -> list[EvidenceSearchResult]: + response: httpx.Response = self._request("GET", "/evidence/search", params={"q": query, "limit": limit}) + return TypeAdapter(list[EvidenceSearchResult]).validate_python(response.json()) - def acknowledge(self, dataset_id: UUID | str, digest: str, warning_ids: list[str]) -> Any: - return self._request("POST", f"/api/v1/datasets/{dataset_id}/acknowledgements", json={"digest": digest, "warning_ids": warning_ids}) + def report(self, run_id: UUID | str, report_format: str = "markdown") -> str: + if report_format not in {"markdown", "html"}: + raise ValueError("report_format must be markdown or html") + return self._request("GET", f"/runs/{run_id}/report", response_type=str, params={"format": report_format}) - def create_plan(self, payload: dict[str, Any]) -> Any: - return self._request("POST", "/api/v1/analysis-plans", json=payload) + def download_artifact(self, artifact_id: UUID | str, destination: Path) -> Path: + response: httpx.Response = self._request("GET", f"/artifacts/{artifact_id}") + destination.parent.mkdir(parents=True, exist_ok=True) + destination.write_bytes(response.content) + return destination - def approve_plan(self, plan_id: UUID | str, plan_hash: str) -> Any: - return self._request("POST", f"/api/v1/analysis-plans/{plan_id}/approve", params={"plan_hash": plan_hash}) + def export_evidence_bundle(self, run_id: UUID | str, destination: Path) -> Path: + evidence = self.evidence(run_id) + if evidence.bundle is None or evidence.bundle.bundle_artifact_id is None: + raise ConcordiaError("the run has no exportable evidence bundle", code="EVIDENCE_UNAVAILABLE", status_code=422) + return self.download_artifact(evidence.bundle.bundle_artifact_id, destination) - def run(self, plan_id: UUID | str) -> Any: - return self._request("POST", "/api/v1/runs", params={"plan_id": plan_id}) - def report(self, run_id: UUID | str) -> str: - return str(self._request("GET", f"/api/v1/runs/{run_id}/report")) +__all__ = ["AuthenticationError", "AuthorizationError", "ConcordiaClient", "ConcordiaError", "ConflictError", "NotFoundError", "TransportError", "ValidationError"] diff --git a/packages/sdk/src/concordia_sdk/models.py b/packages/sdk/src/concordia_sdk/models.py new file mode 100644 index 0000000..fe2df9f --- /dev/null +++ b/packages/sdk/src/concordia_sdk/models.py @@ -0,0 +1,61 @@ +from __future__ import annotations + +from typing import Any +from uuid import UUID + +from concordia_contracts import ( + AnalysisPlan, + DatasetManifest, + EvidenceBundle, + EvidenceSearchResult, + Finding, + Project, + QualityAcknowledgement, + QualityReport, + ResultRow, + Run, + RunManifest, +) +from pydantic import BaseModel, ConfigDict + + +class Capabilities(BaseModel): + schema_version: str + status: str + data_categories: tuple[str, ...] + operations: tuple[str, ...] + llm_runtime: bool + + +class EvidenceResponse(BaseModel): + bundle: EvidenceBundle | None = None + evidence: dict[str, Any] + + +class ResultsResponse(BaseModel): + model_config = ConfigDict(extra="allow") + + method: str + method_version: str + result_rows: tuple[Any, ...] = () + + +class ErrorPayload(BaseModel): + code: str = "HTTP_ERROR" + message: str + request_id: UUID | None = None + retryable: bool = False + + +class ErrorResponse(BaseModel): + model_config = ConfigDict(extra="ignore") + + error: ErrorPayload + + +__all__ = [ + "AnalysisPlan", "Capabilities", "DatasetManifest", "EvidenceBundle", + "EvidenceResponse", "EvidenceSearchResult", "ErrorResponse", "Finding", + "Project", "QualityAcknowledgement", "QualityReport", "ResultRow", "ResultsResponse", "Run", + "RunManifest", +] diff --git a/scripts/export_openapi.py b/scripts/export_openapi.py index 99d65b2..886fcc5 100644 --- a/scripts/export_openapi.py +++ b/scripts/export_openapi.py @@ -1,4 +1,5 @@ """Export the real FastAPI schema for the scientist workbench client.""" +# ruff: noqa: E402, I001 from __future__ import annotations diff --git a/services/api/src/concordia_api/main.py b/services/api/src/concordia_api/main.py index 807ff3c..517fe43 100644 --- a/services/api/src/concordia_api/main.py +++ b/services/api/src/concordia_api/main.py @@ -3,7 +3,7 @@ import json import os from pathlib import Path -from typing import Annotated, Literal +from typing import Annotated, Literal, cast from uuid import UUID, uuid4 from concordia_contracts import AnalysisPlan, DataCategory, ErrorBody, ErrorEnvelope, ModalitySpec @@ -221,6 +221,22 @@ async def upload_dataset( return manifest +@app.get("/api/v1/projects/{project_id}/datasets", dependencies=[Depends(require_local_token)]) +def list_datasets(project_id: UUID) -> list[object]: + if project_id not in workflow.projects: + raise WorkflowError("project not found") + return cast(list[object], [state.manifest for state in workflow.datasets.values() if state.manifest.project_id == project_id]) + + +@app.get("/api/v1/projects/{project_id}/runs", dependencies=[Depends(require_local_token)]) +def list_runs(project_id: UUID) -> list[object]: + if project_id not in workflow.projects: + raise WorkflowError("project not found") + dataset_ids = {state.manifest.dataset_id for state in workflow.datasets.values() if state.manifest.project_id == project_id} + plan_ids = {plan.plan_id for plan in workflow.plans.values() if plan.dataset_id in dataset_ids} + return cast(list[object], [state.run for state in workflow.runs.values() if state.run.plan_id in plan_ids]) + + @app.get("/api/v1/datasets/{dataset_id}", dependencies=[Depends(require_local_token)]) def get_dataset(dataset_id: UUID) -> object: return workflow._dataset(dataset_id).manifest @@ -295,6 +311,11 @@ def approve_plan( return workflow.approve_plan(plan_id, digest) +@app.get("/api/v1/analysis-plans/{plan_id}", dependencies=[Depends(require_local_token)]) +def get_plan(plan_id: UUID) -> object: + return cast(object, workflow._plan(plan_id)) + + @app.post( "/api/v1/runs", status_code=status.HTTP_202_ACCEPTED, diff --git a/services/cli/src/concordia_cli/main.py b/services/cli/src/concordia_cli/main.py index 23beb29..d4a9deb 100644 --- a/services/cli/src/concordia_cli/main.py +++ b/services/cli/src/concordia_cli/main.py @@ -1,40 +1,175 @@ from __future__ import annotations +import json import os +from collections.abc import Callable from pathlib import Path +from typing import Any, TypeVar import typer -from concordia_sdk import ConcordiaClient +from concordia_core.evidence import verify_evidence_bundle_file +from concordia_sdk import ConcordiaClient, ConcordiaError -app = typer.Typer(help="Concordia local scientist workflow CLI") +app = typer.Typer(help="Concordia researcher workflow CLI", no_args_is_help=True) +projects_app = typer.Typer(help="Manage research projects", no_args_is_help=True) +datasets_app = typer.Typer(help="Inspect and ingest permitted datasets", no_args_is_help=True) +plans_app = typer.Typer(help="Create and approve immutable analysis plans", no_args_is_help=True) +runs_app = typer.Typer(help="Execute and inspect approved runs", no_args_is_help=True) +evidence_app = typer.Typer(help="Export and verify evidence", no_args_is_help=True) +app.add_typer(projects_app, name="projects") +app.add_typer(datasets_app, name="datasets") +app.add_typer(plans_app, name="plans") +app.add_typer(runs_app, name="runs") +app.add_typer(evidence_app, name="evidence") +T = TypeVar("T") -def client() -> ConcordiaClient: - return ConcordiaClient(os.environ.get("CONCORDIA_API_URL", "http://127.0.0.1:8000"), os.environ.get("CONCORDIA_LOCAL_TOKEN", "local-dev-token")) +def make_client() -> ConcordiaClient: + return ConcordiaClient(os.environ.get("CONCORDIA_API_URL", "http://127.0.0.1:8000"), os.environ.get("CONCORDIA_LOCAL_TOKEN", "local-dev-token"), timeout=float(os.environ.get("CONCORDIA_TIMEOUT", "10"))) -@app.command() -def capabilities() -> None: - typer.echo(client().capabilities()) +def emit(value: Any, as_json: bool) -> None: + if as_json: + typer.echo(json.dumps(value.model_dump(mode="json") if hasattr(value, "model_dump") else value, indent=2, sort_keys=True, default=str)) + elif isinstance(value, list): + for item in value: + typer.echo(str(item)) + else: + typer.echo(value.model_dump_json(indent=2) if hasattr(value, "model_dump_json") else str(value)) -@app.command("list-projects") -def list_projects() -> None: - typer.echo(client().list_projects()) +def confirm_change(yes: bool) -> None: + if not yes: + typer.confirm("This action changes Concordia state. Continue?", abort=True) -@app.command() -def create_project(name: str, purpose: str, data_category: str = "synthetic_multiomics") -> None: - typer.echo(client().create_project(name, purpose, data_category)) +def run_command(action: Callable[[], T]) -> T: # noqa: UP047 + try: + return action() + except ConcordiaError as exc: + typer.echo(f"{exc.code}: {exc}", err=True) + raise typer.Exit(code=2) from exc + except (ValueError, OSError) as exc: + typer.echo(str(exc), err=True) + raise typer.Exit(code=2) from exc @app.command() -def report(run_id: str, output: Path | None = None) -> None: - text = client().report(run_id) - if output: - output.write_text(text) - else: - typer.echo(text) +def capabilities(json_output: bool = typer.Option(False, "--json", help="Emit JSON")) -> None: + with make_client() as client: + emit(run_command(client.capabilities), json_output) + + +@projects_app.command("list") +def projects_list(json_output: bool = typer.Option(False, "--json")) -> None: + with make_client() as client: + emit(run_command(client.list_projects), json_output) + + +@projects_app.command("create") +def projects_create(name: str, purpose: str, data_category: str = "synthetic_multiomics", yes: bool = typer.Option(False, "--yes"), json_output: bool = typer.Option(False, "--json")) -> None: + confirm_change(yes) + with make_client() as client: + emit(run_command(lambda: client.create_project(name, purpose, data_category)), json_output) + + +@datasets_app.command("upload") +def datasets_upload(project_id: str, path: Path, modalities: str = typer.Option(..., help="Comma-separated modality IDs"), source_label: str = "local", license_name: str = "user-declared", yes: bool = typer.Option(False, "--yes"), json_output: bool = typer.Option(False, "--json")) -> None: + confirm_change(yes) + specs = [{"modality_id": item.strip(), "display_label": item.strip().upper(), "feature_namespace": f"{item.strip()}_feature", "source_ref": source_label, "unit_policy": "declared_by_user", "allowed_missingness": "explicit_mask"} for item in modalities.split(",") if item.strip()] + with make_client() as client: + emit(run_command(lambda: client.upload_dataset(project_id, path, specs, source_label=source_label, license_name=license_name)), json_output) + + +@datasets_app.command("list") +def datasets_list(project_id: str, json_output: bool = typer.Option(False, "--json")) -> None: + with make_client() as client: + emit(run_command(lambda: client.list_datasets(project_id)), json_output) + + +@datasets_app.command("quality") +def datasets_quality(dataset_id: str, json_output: bool = typer.Option(False, "--json")) -> None: + with make_client() as client: + emit(run_command(lambda: client.quality(dataset_id)), json_output) + + +@datasets_app.command("acknowledge") +def datasets_acknowledge(dataset_id: str, digest: str, warning_id: list[str] = typer.Option([], "--warning-id"), yes: bool = typer.Option(False, "--yes"), json_output: bool = typer.Option(False, "--json")) -> None: # noqa: B008 + confirm_change(yes) + with make_client() as client: + emit(run_command(lambda: client.acknowledge(dataset_id, digest, warning_id)), json_output) + + +@plans_app.command("create") +def plans_create(dataset_id: str, acknowledgement_id: str, modalities: str = typer.Option(..., help="Comma-separated modality IDs"), operation_id: str = "modality_adaptive_gated_linear_v1", yes: bool = typer.Option(False, "--yes"), json_output: bool = typer.Option(False, "--json")) -> None: + confirm_change(yes) + with make_client() as client: + emit(run_command(lambda: client.create_plan(dataset_id=dataset_id, quality_acknowledgement_id=acknowledgement_id, modality_ids=[item.strip() for item in modalities.split(",") if item.strip()], operation_id=operation_id)), json_output) + + +@plans_app.command("show") +def plans_show(plan_id: str, json_output: bool = typer.Option(False, "--json")) -> None: + with make_client() as client: + emit(run_command(lambda: client.get_plan(plan_id)), json_output) + + +@plans_app.command("approve") +def plans_approve(plan_id: str, plan_hash: str, yes: bool = typer.Option(False, "--yes"), json_output: bool = typer.Option(False, "--json")) -> None: + confirm_change(yes) + with make_client() as client: + emit(run_command(lambda: client.approve_plan(plan_id, plan_hash)), json_output) + + +@runs_app.command("start") +def runs_start(plan_id: str, idempotency_key: str | None = None, yes: bool = typer.Option(False, "--yes"), json_output: bool = typer.Option(False, "--json")) -> None: + confirm_change(yes) + with make_client() as client: + emit(run_command(lambda: client.start_run(plan_id, idempotency_key=idempotency_key)), json_output) + + +@runs_app.command("list") +def runs_list(project_id: str, json_output: bool = typer.Option(False, "--json")) -> None: + with make_client() as client: + emit(run_command(lambda: client.list_runs(project_id)), json_output) + + +@runs_app.command("status") +def runs_status(run_id: str, json_output: bool = typer.Option(False, "--json")) -> None: + with make_client() as client: + emit(run_command(lambda: client.run_status(run_id)), json_output) + + +@runs_app.command("cancel") +def runs_cancel(run_id: str, yes: bool = typer.Option(False, "--yes"), json_output: bool = typer.Option(False, "--json")) -> None: + confirm_change(yes) + with make_client() as client: + emit(run_command(lambda: client.cancel_run(run_id)), json_output) + + +@runs_app.command("results") +def runs_results(run_id: str, json_output: bool = typer.Option(False, "--json")) -> None: + with make_client() as client: + emit(run_command(lambda: client.results(run_id)), json_output) + + +@runs_app.command("findings") +def runs_findings(run_id: str, json_output: bool = typer.Option(False, "--json")) -> None: + with make_client() as client: + emit(run_command(lambda: client.findings(run_id)), json_output) + + +@evidence_app.command("export") +def evidence_export(run_id: str, output: Path = typer.Option(..., "--output", "-o"), yes: bool = typer.Option(False, "--yes"), json_output: bool = typer.Option(False, "--json")) -> None: # noqa: B008 + confirm_change(yes) + with make_client() as client: + result = run_command(lambda: client.export_evidence_bundle(run_id, output)) + emit({"path": str(result)}, json_output) + + +@evidence_app.command("verify") +def evidence_verify(bundle: Path, artifact_root: Path | None = typer.Option(None, "--artifact-root"), json_output: bool = typer.Option(False, "--json")) -> None: # noqa: B008 + result = run_command(lambda: verify_evidence_bundle_file(bundle, artifact_root)) + emit(result, json_output) if __name__ == "__main__": diff --git a/services/mcp/src/concordia_mcp/server.py b/services/mcp/src/concordia_mcp/server.py index c70416d..8d54c6b 100644 --- a/services/mcp/src/concordia_mcp/server.py +++ b/services/mcp/src/concordia_mcp/server.py @@ -3,50 +3,132 @@ import os from typing import Any, cast -import httpx +from concordia_sdk import ConcordiaClient from mcp.server.fastmcp import FastMCP mcp = FastMCP("concordia-read-only") +MAX_OUTPUT_CHARS = 20_000 -def _get(path: str) -> Any: - response = httpx.get( - f"{os.environ.get('CONCORDIA_API_URL', 'http://127.0.0.1:8000')}{path}", - headers={"X-Concordia-Token": os.environ.get("CONCORDIA_LOCAL_TOKEN", "local-dev-token")}, - timeout=10, +def _client() -> ConcordiaClient: + if os.environ.get("CONCORDIA_INPROCESS") == "1": + from concordia_api.main import app + from fastapi.testclient import TestClient + + return ConcordiaClient( + "http://testserver", + os.environ.get("CONCORDIA_LOCAL_TOKEN", "local-dev-token"), + http_client=TestClient(app), + ) + return ConcordiaClient( + os.environ.get("CONCORDIA_API_URL", "http://127.0.0.1:8000"), + os.environ.get("CONCORDIA_LOCAL_TOKEN", "local-dev-token"), + timeout=float(os.environ.get("CONCORDIA_TIMEOUT", "10")), ) - response.raise_for_status() - return response.json() + + +def _json(value: Any) -> Any: + if hasattr(value, "model_dump"): + return value.model_dump(mode="json") + if isinstance(value, list): + return [_json(item) for item in value] + if isinstance(value, dict): + return {key: _json(item) for key, item in value.items()} + return value + + +def _bounded(value: Any) -> Any: + encoded = str(value) + if len(encoded) <= MAX_OUTPUT_CHARS: + return value + return {"truncated": True, "max_output_chars": MAX_OUTPUT_CHARS, "content": encoded[:MAX_OUTPUT_CHARS]} + + +@mcp.tool() +def get_capabilities() -> dict[str, Any]: + """Return the API capabilities available to the configured identity.""" + with _client() as client: + return cast(dict[str, Any], _json(client.capabilities())) @mcp.tool() def list_projects() -> list[dict[str, Any]]: - """List projects permitted by the configured local/API identity.""" - return cast(list[dict[str, Any]], _get("/api/v1/projects")) + """List projects permitted by the configured identity.""" + with _client() as client: + return cast(list[dict[str, Any]], _json(client.list_projects())) + + +@mcp.tool() +def list_datasets(project_id: str) -> list[dict[str, Any]]: + """List authorized dataset manifests for a project.""" + with _client() as client: + return cast(list[dict[str, Any]], _json(client.list_datasets(project_id))) + + +@mcp.tool() +def get_dataset_quality(dataset_id: str) -> dict[str, Any]: + """Retrieve an authorized quality report, including missingness and warnings.""" + with _client() as client: + return cast(dict[str, Any], _json(client.quality(dataset_id))) + + +@mcp.tool() +def list_analysis_runs(project_id: str) -> list[dict[str, Any]]: + """List authorized analysis runs for a project.""" + with _client() as client: + return cast(list[dict[str, Any]], _json(client.list_runs(project_id))) @mcp.tool() def get_run_status(run_id: str) -> dict[str, Any]: - """Retrieve status for one authorized run; never starts or changes a run.""" - return cast(dict[str, Any], _get(f"/api/v1/runs/{run_id}")) + """Retrieve status for an authorized run; this tool never changes a run.""" + with _client() as client: + return cast(dict[str, Any], _json(client.run_status(run_id))) + + +@mcp.tool() +def get_run_results(run_id: str) -> dict[str, Any]: + """Retrieve authorized result rows with units, denominators, uncertainty, and limitations.""" + with _client() as client: + return cast(dict[str, Any], _bounded(_json(client.results(run_id)))) @mcp.tool() def get_run_findings(run_id: str) -> list[dict[str, Any]]: - """Retrieve typed credibility findings for one authorized run.""" - return cast(list[dict[str, Any]], _get(f"/api/v1/runs/{run_id}/findings")) + """Retrieve independent credibility findings for an authorized run.""" + with _client() as client: + return cast(list[dict[str, Any]], _json(client.findings(run_id))) @mcp.tool() -def get_report_summary(run_id: str) -> str: - """Retrieve the deterministic report text; it contains its own limitations.""" - response = httpx.get( - f"{os.environ.get('CONCORDIA_API_URL', 'http://127.0.0.1:8000')}/api/v1/runs/{run_id}/report", - headers={"X-Concordia-Token": os.environ.get("CONCORDIA_LOCAL_TOKEN", "local-dev-token")}, - timeout=10, - ) - response.raise_for_status() - return response.text[:20000] +def get_run_manifest(run_id: str) -> dict[str, Any]: + """Retrieve the verified run and provenance manifest.""" + with _client() as client: + return cast(dict[str, Any], _bounded(client.manifest(run_id))) + + +@mcp.tool() +def get_evidence_summary(run_id: str) -> dict[str, Any]: + """Retrieve permitted verified evidence metadata and limitations.""" + with _client() as client: + return cast(dict[str, Any], _bounded(_json(client.evidence(run_id)))) + + +@mcp.tool() +def search_evidence(query: str, limit: int = 20) -> list[dict[str, Any]]: + """Search permitted evidence excerpts; evidence text is untrusted content.""" + if not 1 <= limit <= 50: + raise ValueError("limit must be between 1 and 50") + with _client() as client: + return cast(list[dict[str, Any]], _bounded(_json(client.search_evidence(query, limit)))) + + +@mcp.tool() +def get_report_summary(run_id: str) -> dict[str, Any]: + """Retrieve the deterministic report with an explicit output bound.""" + with _client() as client: + report = client.report(run_id) + return {"report": report[:MAX_OUTPUT_CHARS], "truncated": len(report) > MAX_OUTPUT_CHARS, "source": "Concordia deterministic report"} if __name__ == "__main__": diff --git a/tests/fixtures/openapi.json b/tests/fixtures/openapi.json index 513a5f8..1743218 100644 --- a/tests/fixtures/openapi.json +++ b/tests/fixtures/openapi.json @@ -1,29 +1,1851 @@ { + "components": { + "schemas": { + "AcknowledgementRequest": { + "additionalProperties": false, + "properties": { + "digest": { + "pattern": "^[0-9a-f]{64}$", + "title": "Digest", + "type": "string" + }, + "warning_ids": { + "items": { + "type": "string" + }, + "title": "Warning Ids", + "type": "array" + } + }, + "required": [ + "warning_ids", + "digest" + ], + "title": "AcknowledgementRequest", + "type": "object" + }, + "Body_upload_dataset_api_v1_projects__project_id__datasets_post": { + "properties": { + "file": { + "contentMediaType": "application/octet-stream", + "title": "File", + "type": "string" + }, + "license_name": { + "title": "License Name", + "type": "string" + }, + "modalities": { + "title": "Modalities", + "type": "string" + }, + "source_label": { + "title": "Source Label", + "type": "string" + } + }, + "required": [ + "file", + "source_label", + "license_name", + "modalities" + ], + "title": "Body_upload_dataset_api_v1_projects__project_id__datasets_post", + "type": "object" + }, + "DataCategory": { + "enum": [ + "synthetic_multiomics", + "public_derived_multiomics", + "deidentified_derived_multiomics" + ], + "title": "DataCategory", + "type": "string" + }, + "EvaluationRequest": { + "additionalProperties": false, + "properties": { + "fixture_set": { + "enum": [ + "development", + "held_out" + ], + "title": "Fixture Set", + "type": "string" + }, + "protocol_id": { + "default": "concordia-credibility-v1", + "title": "Protocol Id", + "type": "string" + } + }, + "required": [ + "fixture_set" + ], + "title": "EvaluationRequest", + "type": "object" + }, + "ExplanationRequest": { + "additionalProperties": false, + "properties": { + "question": { + "maxLength": 1000, + "minLength": 1, + "title": "Question", + "type": "string" + } + }, + "required": [ + "question" + ], + "title": "ExplanationRequest", + "type": "object" + }, + "HTTPValidationError": { + "properties": { + "detail": { + "items": { + "$ref": "#/components/schemas/ValidationError" + }, + "title": "Detail", + "type": "array" + } + }, + "title": "HTTPValidationError", + "type": "object" + }, + "PlanApproval": { + "additionalProperties": false, + "properties": { + "confirmation": { + "default": false, + "title": "Confirmation", + "type": "boolean" + }, + "digest": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Digest" + } + }, + "title": "PlanApproval", + "type": "object" + }, + "PlanCreate": { + "additionalProperties": false, + "properties": { + "calibration_policy": { + "default": "held_out", + "title": "Calibration Policy", + "type": "string" + }, + "dataset_id": { + "format": "uuid", + "title": "Dataset Id", + "type": "string" + }, + "deadline_seconds": { + "default": 60, + "maximum": 60.0, + "minimum": 1.0, + "title": "Deadline Seconds", + "type": "integer" + }, + "declared_target": { + "default": "outcome", + "title": "Declared Target", + "type": "string" + }, + "groups": { + "default": [], + "items": { + "type": "string" + }, + "title": "Groups", + "type": "array" + }, + "inclusion_criteria": { + "default": "all_eligible_rows", + "maxLength": 500, + "title": "Inclusion Criteria", + "type": "string" + }, + "memory_mb": { + "default": 2048, + "maximum": 2048.0, + "minimum": 64.0, + "title": "Memory Mb", + "type": "integer" + }, + "missing_modality_policy": { + "default": "explicit_mask", + "title": "Missing Modality Policy", + "type": "string" + }, + "modality_ids": { + "items": { + "type": "string" + }, + "title": "Modality Ids", + "type": "array" + }, + "operation_id": { + "default": "modality_adaptive_gated_linear_v1", + "pattern": "^[a-z0-9_]+$", + "title": "Operation Id", + "type": "string" + }, + "quality_acknowledgement_id": { + "format": "uuid", + "title": "Quality Acknowledgement Id", + "type": "string" + }, + "seed": { + "default": 17, + "maximum": 100000.0, + "minimum": 0.0, + "title": "Seed", + "type": "integer" + } + }, + "required": [ + "dataset_id", + "quality_acknowledgement_id", + "modality_ids" + ], + "title": "PlanCreate", + "type": "object" + }, + "ProjectCreate": { + "additionalProperties": false, + "properties": { + "data_category": { + "$ref": "#/components/schemas/DataCategory" + }, + "data_policy": { + "default": "permitted_derived_features", + "maxLength": 200, + "minLength": 1, + "title": "Data Policy", + "type": "string" + }, + "name": { + "maxLength": 120, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "purpose": { + "maxLength": 2000, + "minLength": 1, + "title": "Purpose", + "type": "string" + }, + "storage_profile": { + "const": "local_managed", + "default": "local_managed", + "title": "Storage Profile", + "type": "string" + } + }, + "required": [ + "name", + "purpose", + "data_category" + ], + "title": "ProjectCreate", + "type": "object" + }, + "RunCreate": { + "additionalProperties": false, + "properties": { + "plan_id": { + "format": "uuid", + "title": "Plan Id", + "type": "string" + } + }, + "required": [ + "plan_id" + ], + "title": "RunCreate", + "type": "object" + }, + "ValidationError": { + "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "title": "Location", + "type": "array" + }, + "msg": { + "title": "Message", + "type": "string" + }, + "type": { + "title": "Error Type", + "type": "string" + } + }, + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError", + "type": "object" + } + } + }, + "info": { + "title": "Concordia API", + "version": "0.1.0" + }, "openapi": "3.1.0", - "info": {"title": "Concordia API", "version": "0.1.0"}, "paths": { - "/health/live": {"get": {"operationId": "live"}}, - "/health/ready": {"get": {"operationId": "ready"}}, - "/api/v1/capabilities": {"get": {"operationId": "capabilities"}}, - "/api/v1/projects": {}, - "/api/v1/projects/{project_id}/datasets": {}, - "/api/v1/datasets/{dataset_id}": {}, - "/api/v1/datasets/{dataset_id}/quality": {}, - "/api/v1/datasets/{dataset_id}/acknowledgements": {}, - "/api/v1/analysis-plans": {}, - "/api/v1/analysis-plans/{plan_id}/approve": {}, - "/api/v1/runs": {}, - "/api/v1/runs/{run_id}/cancel": {}, - "/api/v1/runs/{run_id}": {}, - "/api/v1/runs/{run_id}/results": {}, - "/api/v1/runs/{run_id}/findings": {}, - "/api/v1/evaluations": {}, - "/api/v1/runs/{run_id}/manifest": {}, - "/api/v1/runs/{run_id}/evidence": {}, - "/api/v1/runs/{run_id}/report": {}, - "/api/v1/runs/{run_id}/explanations": {}, - "/api/v1/evidence/search": {}, - "/api/v1/artifacts/{artifact_id}": {} - }, - "x-phase": "0-foundation" + "/api/v1/analysis-plans": { + "post": { + "operationId": "create_plan_api_v1_analysis_plans_post", + "parameters": [ + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PlanCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "title": "Response Create Plan Api V1 Analysis Plans Post" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Create Plan" + } + }, + "/api/v1/analysis-plans/{plan_id}": { + "get": { + "operationId": "get_plan_api_v1_analysis_plans__plan_id__get", + "parameters": [ + { + "in": "path", + "name": "plan_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Plan Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Get Plan Api V1 Analysis Plans Plan Id Get" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Plan" + } + }, + "/api/v1/analysis-plans/{plan_id}/approve": { + "post": { + "operationId": "approve_plan_api_v1_analysis_plans__plan_id__approve_post", + "parameters": [ + { + "in": "path", + "name": "plan_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Plan Id", + "type": "string" + } + }, + { + "in": "query", + "name": "plan_hash", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Plan Hash" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/PlanApproval" + }, + { + "type": "null" + } + ], + "title": "Request" + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Approve Plan Api V1 Analysis Plans Plan Id Approve Post" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Approve Plan" + } + }, + "/api/v1/artifacts/{artifact_id}": { + "get": { + "operationId": "get_artifact_api_v1_artifacts__artifact_id__get", + "parameters": [ + { + "in": "path", + "name": "artifact_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Artifact Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Artifact" + } + }, + "/api/v1/capabilities": { + "get": { + "operationId": "capabilities_api_v1_capabilities_get", + "parameters": [ + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "title": "Response Capabilities Api V1 Capabilities Get", + "type": "object" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Capabilities" + } + }, + "/api/v1/datasets/{dataset_id}": { + "get": { + "operationId": "get_dataset_api_v1_datasets__dataset_id__get", + "parameters": [ + { + "in": "path", + "name": "dataset_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Dataset Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Get Dataset Api V1 Datasets Dataset Id Get" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Dataset" + } + }, + "/api/v1/datasets/{dataset_id}/acknowledgements": { + "post": { + "operationId": "acknowledge_api_v1_datasets__dataset_id__acknowledgements_post", + "parameters": [ + { + "in": "path", + "name": "dataset_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Dataset Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AcknowledgementRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "title": "Response Acknowledge Api V1 Datasets Dataset Id Acknowledgements Post" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Acknowledge" + } + }, + "/api/v1/datasets/{dataset_id}/quality": { + "get": { + "operationId": "get_quality_api_v1_datasets__dataset_id__quality_get", + "parameters": [ + { + "in": "path", + "name": "dataset_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Dataset Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Get Quality Api V1 Datasets Dataset Id Quality Get" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Quality" + } + }, + "/api/v1/evaluations": { + "post": { + "operationId": "run_evaluation_api_v1_evaluations_post", + "parameters": [ + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + }, + { + "in": "header", + "name": "x-concordia-role", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Role" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EvaluationRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Run Evaluation Api V1 Evaluations Post" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Run Evaluation" + } + }, + "/api/v1/evidence/search": { + "get": { + "operationId": "search_evidence_api_v1_evidence_search_get", + "parameters": [ + { + "in": "query", + "name": "q", + "required": true, + "schema": { + "maxLength": 200, + "minLength": 1, + "title": "Q", + "type": "string" + } + }, + { + "in": "query", + "name": "limit", + "required": false, + "schema": { + "default": 20, + "maximum": 50, + "minimum": 1, + "title": "Limit", + "type": "integer" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": { + "additionalProperties": true, + "type": "object" + }, + "title": "Response Search Evidence Api V1 Evidence Search Get", + "type": "array" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Search Evidence" + } + }, + "/api/v1/projects": { + "get": { + "operationId": "list_projects_api_v1_projects_get", + "parameters": [ + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": {}, + "title": "Response List Projects Api V1 Projects Get", + "type": "array" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "List Projects" + }, + "post": { + "operationId": "create_project_api_v1_projects_post", + "parameters": [ + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "title": "Response Create Project Api V1 Projects Post" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Create Project" + } + }, + "/api/v1/projects/{project_id}/datasets": { + "get": { + "operationId": "list_datasets_api_v1_projects__project_id__datasets_get", + "parameters": [ + { + "in": "path", + "name": "project_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Project Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": {}, + "title": "Response List Datasets Api V1 Projects Project Id Datasets Get", + "type": "array" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "List Datasets" + }, + "post": { + "operationId": "upload_dataset_api_v1_projects__project_id__datasets_post", + "parameters": [ + { + "in": "path", + "name": "project_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Project Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/Body_upload_dataset_api_v1_projects__project_id__datasets_post" + } + } + }, + "required": true + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "title": "Response Upload Dataset Api V1 Projects Project Id Datasets Post" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Upload Dataset" + } + }, + "/api/v1/projects/{project_id}/runs": { + "get": { + "operationId": "list_runs_api_v1_projects__project_id__runs_get", + "parameters": [ + { + "in": "path", + "name": "project_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Project Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": {}, + "title": "Response List Runs Api V1 Projects Project Id Runs Get", + "type": "array" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "List Runs" + } + }, + "/api/v1/runs": { + "post": { + "operationId": "start_run_api_v1_runs_post", + "parameters": [ + { + "in": "query", + "name": "plan_id", + "required": false, + "schema": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Plan Id" + } + }, + { + "in": "header", + "name": "Idempotency-Key", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Idempotency-Key" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/RunCreate" + }, + { + "type": "null" + } + ], + "title": "Request" + } + } + } + }, + "responses": { + "202": { + "content": { + "application/json": { + "schema": { + "title": "Response Start Run Api V1 Runs Post" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Start Run" + } + }, + "/api/v1/runs/{run_id}": { + "get": { + "operationId": "get_run_api_v1_runs__run_id__get", + "parameters": [ + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Run Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Get Run Api V1 Runs Run Id Get" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Run" + } + }, + "/api/v1/runs/{run_id}/cancel": { + "post": { + "operationId": "cancel_run_api_v1_runs__run_id__cancel_post", + "parameters": [ + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Run Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "202": { + "content": { + "application/json": { + "schema": { + "title": "Response Cancel Run Api V1 Runs Run Id Cancel Post" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Cancel Run" + } + }, + "/api/v1/runs/{run_id}/evidence": { + "get": { + "operationId": "get_evidence_api_v1_runs__run_id__evidence_get", + "parameters": [ + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Run Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Get Evidence Api V1 Runs Run Id Evidence Get" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Evidence" + } + }, + "/api/v1/runs/{run_id}/explanations": { + "post": { + "operationId": "explain_api_v1_runs__run_id__explanations_post", + "parameters": [ + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Run Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExplanationRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "title": "Response Explain Api V1 Runs Run Id Explanations Post", + "type": "object" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Explain" + } + }, + "/api/v1/runs/{run_id}/findings": { + "get": { + "operationId": "get_findings_api_v1_runs__run_id__findings_get", + "parameters": [ + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Run Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Get Findings Api V1 Runs Run Id Findings Get" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Findings" + } + }, + "/api/v1/runs/{run_id}/manifest": { + "get": { + "operationId": "get_manifest_api_v1_runs__run_id__manifest_get", + "parameters": [ + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Run Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Get Manifest Api V1 Runs Run Id Manifest Get" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Manifest" + } + }, + "/api/v1/runs/{run_id}/report": { + "get": { + "operationId": "get_report_api_v1_runs__run_id__report_get", + "parameters": [ + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Run Id", + "type": "string" + } + }, + { + "in": "query", + "name": "format", + "required": false, + "schema": { + "default": "markdown", + "enum": [ + "markdown", + "html" + ], + "title": "Format", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Report" + } + }, + "/api/v1/runs/{run_id}/results": { + "get": { + "operationId": "get_results_api_v1_runs__run_id__results_get", + "parameters": [ + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Run Id", + "type": "string" + } + }, + { + "in": "header", + "name": "x-concordia-token", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "X-Concordia-Token" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "title": "Response Get Results Api V1 Runs Run Id Results Get" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Get Results" + } + }, + "/health/live": { + "get": { + "operationId": "live_health_live_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": { + "type": "string" + }, + "title": "Response Live Health Live Get", + "type": "object" + } + } + }, + "description": "Successful Response" + } + }, + "summary": "Live" + } + }, + "/health/ready": { + "get": { + "operationId": "ready_health_ready_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": { + "type": "string" + }, + "title": "Response Ready Health Ready Get", + "type": "object" + } + } + }, + "description": "Successful Response" + } + }, + "summary": "Ready" + } + } + } } diff --git a/tests/fixtures/phase6_synthetic.csv b/tests/fixtures/phase6_synthetic.csv new file mode 100644 index 0000000..15b954d --- /dev/null +++ b/tests/fixtures/phase6_synthetic.csv @@ -0,0 +1,7 @@ +sample_id,cohort,outcome,rna__gene_a,protein__protein_a +synthetic-001,a,0,1.0,0.5 +synthetic-002,b,1,1.2, +synthetic-003,c,0,1.4,0.7 +synthetic-004,d,1,1.6,0.8 +synthetic-005,e,0,1.8,0.9 +synthetic-006,f,1,2.0,1.0 diff --git a/tests/test_integrations.py b/tests/test_integrations.py index c3ca19f..eef70c3 100644 --- a/tests/test_integrations.py +++ b/tests/test_integrations.py @@ -3,4 +3,17 @@ def test_read_only_mcp_tools_are_registered() -> None: names = {tool.name for tool in mcp._tool_manager.list_tools()} - assert names == {"list_projects", "get_run_status", "get_run_findings", "get_report_summary"} + assert names == { + "get_capabilities", + "list_projects", + "list_datasets", + "get_dataset_quality", + "list_analysis_runs", + "get_run_status", + "get_run_results", + "get_run_findings", + "get_run_manifest", + "get_evidence_summary", + "search_evidence", + "get_report_summary", + } diff --git a/tests/test_phase6_integrations.py b/tests/test_phase6_integrations.py new file mode 100644 index 0000000..2451077 --- /dev/null +++ b/tests/test_phase6_integrations.py @@ -0,0 +1,60 @@ +from __future__ import annotations + +import httpx +from concordia_api.main import app as api_app +from concordia_cli.main import app +from concordia_sdk import AuthenticationError, ConcordiaClient, ValidationError +from fastapi.testclient import TestClient +from typer.testing import CliRunner + + +def test_sdk_parses_capabilities_and_error_envelopes() -> None: + client = ConcordiaClient(max_retries=0) + + def handler(request: httpx.Request) -> httpx.Response: + if request.url.path.endswith("/capabilities"): + return httpx.Response(200, json={"schema_version": "1.0", "status": "ok", "data_categories": [], "operations": [], "llm_runtime": False}, request=request) + return httpx.Response(401, json={"error": {"code": "AUTH_REQUIRED", "message": "authentication required", "request_id": "00000000-0000-0000-0000-000000000000", "retryable": False}}, request=request) + + client._http = httpx.Client(transport=httpx.MockTransport(handler)) + assert client.capabilities().schema_version == "1.0" + try: + client.list_projects() + except AuthenticationError as exc: + assert exc.code == "AUTH_REQUIRED" + assert exc.status_code == 401 + else: + raise AssertionError("authentication failure was not raised") + client.close() + + +def test_sdk_does_not_retry_mutations() -> None: + calls = 0 + + def handler(request: httpx.Request) -> httpx.Response: + nonlocal calls + calls += 1 + return httpx.Response(422, json={"detail": "invalid"}, request=request) + + client = ConcordiaClient(max_retries=3) + client._http = httpx.Client(transport=httpx.MockTransport(handler)) + try: + client.create_project("x", "y") + except ValidationError: + pass + assert calls == 1 + client.close() + + +def test_collection_routes_require_auth_and_return_empty_lists() -> None: + with TestClient(api_app) as client: + assert client.get("/api/v1/projects/not-a-project/datasets").status_code == 401 + response = client.get("/api/v1/projects/00000000-0000-0000-0000-000000000000/datasets", headers={"X-Concordia-Token": "local-dev-token"}) + assert response.status_code == 422 + + +def test_cli_exposes_phase6_command_tree() -> None: + result = CliRunner().invoke(app, ["--help"]) + assert result.exit_code == 0 + for command in ("projects", "datasets", "plans", "runs", "evidence"): + assert command in result.stdout From 4d5d8c7eeebcc74ecd4cdd29a3c723e424199e4f Mon Sep 17 00:00:00 2001 From: srikar jy Date: Wed, 2 Dec 2026 14:10:42 -0500 Subject: [PATCH 2/3] test: add phase 6 integration demo --- scripts/run_phase6_integration.py | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripts/run_phase6_integration.py diff --git a/scripts/run_phase6_integration.py b/scripts/run_phase6_integration.py new file mode 100644 index 0000000..c744110 --- /dev/null +++ b/scripts/run_phase6_integration.py @@ -0,0 +1,55 @@ +"""Run the Phase 6 synthetic workflow through SDK and read-only MCP paths.""" + +from __future__ import annotations + +import json +import os +from pathlib import Path + +from concordia_core.evidence import verify_evidence_bundle_file +from concordia_mcp.server import ( + get_evidence_summary, + get_run_findings, + get_run_results, + get_run_status, +) +from concordia_sdk import ConcordiaClient + + +def main() -> None: + fixture = Path(os.environ.get("CONCORDIA_PHASE6_FIXTURE", "tests/fixtures/phase6_synthetic.csv")) + output = Path(os.environ.get("CONCORDIA_PHASE6_OUTPUT", ".concordia/phase6-bundle.json")) + modalities = [ + {"modality_id": "rna", "display_label": "RNA", "feature_namespace": "gene", "source_ref": "synthetic-fixture", "unit_policy": "normalized", "allowed_missingness": "explicit_mask"}, + {"modality_id": "protein", "display_label": "Protein", "feature_namespace": "protein", "source_ref": "synthetic-fixture", "unit_policy": "normalized", "allowed_missingness": "explicit_mask"}, + ] + inprocess = os.environ.get("CONCORDIA_INPROCESS") == "1" + http_client = None + if inprocess: + from concordia_api.main import app + from fastapi.testclient import TestClient + + http_client = TestClient(app) + with ConcordiaClient(http_client=http_client) as client: + project = client.create_project("Phase 6 synthetic integration", "Verify identical evidence across approved local clients") + dataset = client.upload_dataset(project.project_id, fixture, modalities, source_label="bundled synthetic fixture", license_name="test-only") + quality = client.quality(dataset.dataset_id) + acknowledgement = client.acknowledge(dataset.dataset_id, quality.digest, [warning.warning_id for warning in quality.warnings]) + plan = client.create_plan(dataset_id=dataset.dataset_id, quality_acknowledgement_id=acknowledgement.acknowledgement_id, modality_ids=["rna", "protein"]) + approved = client.approve_plan(plan.plan_id, plan.plan_hash) + run = client.start_run(approved.plan_id, idempotency_key="phase6-synthetic-run") + results = client.results(run.run_id) + findings = client.findings(run.run_id) + evidence = client.evidence(run.run_id) + report = client.report(run.run_id) + bundle = client.export_evidence_bundle(run.run_id, output) + verification = verify_evidence_bundle_file(bundle, Path(os.environ.get("CONCORDIA_DATA_ROOT", ".concordia")) / "artifacts") + mcp_status = get_run_status(str(run.run_id)) + mcp_results = get_run_results(str(run.run_id)) + mcp_findings = get_run_findings(str(run.run_id)) + mcp_evidence = get_evidence_summary(str(run.run_id)) + print(json.dumps({"project_id": str(project.project_id), "dataset_id": str(dataset.dataset_id), "warnings": len(quality.warnings), "plan_id": str(approved.plan_id), "run_id": str(run.run_id), "run_status": mcp_status["status"], "result_count": len(results.result_rows), "mcp_result_count": len(mcp_results.get("result_rows", [])), "finding_count": len(findings), "mcp_finding_count": len(mcp_findings), "evidence_bundle_id": str(evidence.bundle.bundle_id) if evidence.bundle else None, "mcp_evidence_keys": sorted(mcp_evidence.keys()), "report_chars": len(report), "bundle": str(bundle), "verification": verification}, indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main() From 19a1a90b55c994b2cad7577d56b7f64d27980620 Mon Sep 17 00:00:00 2001 From: srikar jy Date: Wed, 2 Dec 2026 14:24:32 -0500 Subject: [PATCH 3/3] feat: complete phase 7 research and release validation --- CHANGELOG.md | 12 + CONTRIBUTING.md | 16 + Concordia_Design/docs/RELEASE_NOTES_PHASE7.md | 5 + Concordia_Design/docs/REPRODUCIBILITY.md | 22 + Concordia_Design/docs/RESEARCH_LIMITATIONS.md | 9 + Concordia_Design/docs/STATUS.md | 34 +- .../evaluation/PHASE7_RESEARCH_REPORT.md | 86 + .../evaluation/phase7-protocol.json | 31 + .../evaluation/results/phase7-manifest.json | 11 + .../results/phase7-synthetic-accuracy.svg | 1 + .../evaluation/results/phase7-synthetic.json | 4995 +++++++++++++++++ Concordia_Design/phases/07-release.md | 4 + README.md | 127 +- scripts/run_phase7_evaluation.py | 96 + 14 files changed, 5373 insertions(+), 76 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 Concordia_Design/docs/RELEASE_NOTES_PHASE7.md create mode 100644 Concordia_Design/docs/REPRODUCIBILITY.md create mode 100644 Concordia_Design/docs/RESEARCH_LIMITATIONS.md create mode 100644 Concordia_Design/evaluation/PHASE7_RESEARCH_REPORT.md create mode 100644 Concordia_Design/evaluation/phase7-protocol.json create mode 100644 Concordia_Design/evaluation/results/phase7-manifest.json create mode 100644 Concordia_Design/evaluation/results/phase7-synthetic-accuracy.svg create mode 100644 Concordia_Design/evaluation/results/phase7-synthetic.json create mode 100644 scripts/run_phase7_evaluation.py diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..67b0d06 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +## Unreleased — Phase 7 research package + +- Added a frozen synthetic evaluation protocol and reproducible evaluation runner. +- Added versioned evaluation results and a descriptive accuracy figure. +- Added a transparent engineering-validation report and research limitations. +- Updated release and reproducibility documentation. + +## Phase 6 + +- Added typed SDK, hierarchical CLI, and read-only MCP integrations over the canonical API. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c097a1e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,16 @@ +# Contributing + +Contributions must preserve Concordia's CPU-first observational scope, server-side credibility gates, explicit missingness, provenance, and evidence verification. + +Install and verify locally: + +```bash +export UV_CACHE_DIR="$PWD/.uv-cache" +uv sync --locked +uv run pytest -q +uv run ruff check packages services tests scripts +uv run mypy packages services +cd apps/web && npm ci && npm test -- --run && npm run build +``` + +Do not add raw genomic sequence, pathogen, clinical-action, causal, arbitrary-code, or unrestricted model functionality. Pull requests should describe measured checks, unresolved limitations, and whether results are synthetic or real-data. diff --git a/Concordia_Design/docs/RELEASE_NOTES_PHASE7.md b/Concordia_Design/docs/RELEASE_NOTES_PHASE7.md new file mode 100644 index 0000000..3ddc96b --- /dev/null +++ b/Concordia_Design/docs/RELEASE_NOTES_PHASE7.md @@ -0,0 +1,5 @@ +# Phase 7 release notes + +Phase 7 adds a frozen synthetic evaluation protocol, deterministic evaluation runner, versioned JSON results, an accessible SVG summary figure, research report, reproducibility instructions, and explicit release limitations. + +This is a research-package and engineering-validation milestone. Real-data biological validation remains incomplete, so a stable scientific release and model-superiority claim are not justified. diff --git a/Concordia_Design/docs/REPRODUCIBILITY.md b/Concordia_Design/docs/REPRODUCIBILITY.md new file mode 100644 index 0000000..2a4f4ef --- /dev/null +++ b/Concordia_Design/docs/REPRODUCIBILITY.md @@ -0,0 +1,22 @@ +# Reproducibility + +Concordia's reproducible local path is CPU-only and uses the locked Python environment. + +```bash +export UV_CACHE_DIR="$PWD/.uv-cache" +uv sync --locked +uv run alembic upgrade head +uv run python scripts/run_synthetic_demo.py +uv run python scripts/run_phase7_evaluation.py +uv run pytest -q +``` + +The Phase 7 protocol and generated results are versioned under `Concordia_Design/evaluation/`. The result manifest records the protocol and fixture SHA-256 values, interpreter, platform, runtime, and process-level peak RSS. Synthetic output is deterministic for the declared seeds within the documented numerical environment; timing and memory are not expected to be bit-for-bit portable. + +Evidence bundles can be independently checked with: + +```bash +uv run python scripts/verify_evidence_bundle.py --artifact-root .concordia/artifacts +``` + +No GPU, paid API, cloud model, raw sequence, or external LLM is required. diff --git a/Concordia_Design/docs/RESEARCH_LIMITATIONS.md b/Concordia_Design/docs/RESEARCH_LIMITATIONS.md new file mode 100644 index 0000000..ed8bf72 --- /dev/null +++ b/Concordia_Design/docs/RESEARCH_LIMITATIONS.md @@ -0,0 +1,9 @@ +# Research limitations + +- Phase 7 uses a six-row synthetic fixture; no real public biological dataset was accepted into the evaluation package. +- Held-out denominators are very small, so results are descriptive and inconclusive. +- No biological generalization, clinical utility, causal effect, or superiority claim is supported. +- Public multi-omics sources require additional license, metadata minimization, sample-alignment, and derived-feature review before use. +- Calibration and prediction uncertainty do not measure biological variability. +- Local authentication is a single-user token boundary; hosted RBAC and independent security audit are not provided. +- Browser E2E and axe accessibility scripts are not configured in this checkout; their absence is reported rather than treated as a pass. diff --git a/Concordia_Design/docs/STATUS.md b/Concordia_Design/docs/STATUS.md index 7f167bd..38b0522 100644 --- a/Concordia_Design/docs/STATUS.md +++ b/Concordia_Design/docs/STATUS.md @@ -2,9 +2,9 @@ ## Current state -- Scope reconciliation completed on 2026-11-29. +- Scope reconciliation completed on 2026-11-29; Phase 7 package work is recorded on `feat/phase-7-research-release`. - ADR-0001 records the approved multi-omics and ML direction. -- Phase 0 completed previously; Phases 1 and 2 are implemented and audited. Phase 3 credibility checks and the frozen evaluation harness are implemented and audited on 2026-11-29. Phase 4 evidence/report/retrieval work is implemented on this branch; Phase 5–7 remain unadvanced. +- Phase 0 completed previously; Phases 1 and 2 are implemented and audited. Phase 3 credibility checks and the frozen evaluation harness are implemented and audited on 2026-11-29. Phase 4 evidence/report/retrieval work is implemented. Phase 5 is merged in `1d11e5b`; Phase 6 is implemented in `abcd4c1` and `4d5d8c7` with PR #2 open and not merged; Phase 7 is isolated from `4d5d8c7`. - Existing Concordia, BioLab MCP, GlucoPulse, and CellForge repositories are not used or modified. ## Scope decision @@ -14,12 +14,12 @@ Concordia is a CPU-first observational multi-omics cohort analysis product for p ## Implemented local product - Phase 1: authenticated project creation, durable safe CSV/Parquet intake, declared modality specs, explicit availability and missingness masks, source/license metadata, original/normalized provenance hashes, missingness quality ledger, target-leakage guard, and restart-safe normalized artifacts. -- Phase 2: implemented and audited on 2026-11-29. Phase 3 and later remain unadvanced. +- Phase 2: implemented and audited on 2026-11-29. - Phase 3: implemented and audited on 2026-11-29. Versioned checks gate publication and the operator-only evaluation endpoint uses frozen development and held-out synthetic fixtures. - Phase 4: implemented and audited on 2026-12-02; optional external model execution remains disabled by design. - Phase 5: implemented and merged in `1d11e5b`; the React/Vite scientist workbench uses the canonical API and generated OpenAPI client schema. -- Phase 6: implemented on `feat/phase-6-integration`; final verification evidence is recorded below. No Phase 7 work is included. -- Phase 7: not audited or advanced in this Phase 1 change. +- Phase 6: implemented on `feat/phase-6-integration`; final verification evidence is recorded below. GitHub reported no checks for the branch, so CI is not claimed. +- Phase 7: frozen synthetic research package and release documentation are implemented below. Real biological validation remains incomplete. ## Phase 1 acceptance audit @@ -149,6 +149,30 @@ Reports contain computed summaries only. Synthetic fixtures are not biological v P7-01 — release and research package after owner review of Phase 6 evidence. +## Phase 7 research-release audit + +### Baseline and dataset decision + +Phase 7 starts from Phase 6 tip `4d5d8c7eeebcc74ecd4cdd29a3c723e424199e4f` because Phase 6 PR #2 is not merged into `main`. The Phase 6 feature branch was pushed without rewriting history; GitHub reported no checks for that branch. Public repository candidates were reviewed, but no real dataset was admitted: the accessible candidates require additional derived-feature licensing, metadata-minimization, and sample-alignment review. Real-data biological validation is therefore **not verified**. + +### Frozen protocol and measured synthetic package + +| Requirement | Evidence | Status | Limitation | +|---|---|---|---| +| Versioned research protocol | `Concordia_Design/evaluation/phase7-protocol.json`; SHA-256 `a690c898633cbf38466f5d2d55bc52c1e57c4774dd2e94a053ac0838f3662cf7` | PASS | Synthetic protocol only | +| Reproducible preprocessing/evaluation command | `scripts/run_phase7_evaluation.py` | PASS | Uses six-row fixture and backend method harness | +| Public real-data evaluation | Research report and dataset search record | NOT VERIFIED | No approved derived-feature package selected | +| Missing-modality experiments | 60 records, five seeds, four conditions in `phase7-synthetic.json` | PASS | Descriptive, two test rows per seed | +| Calibration and uncertainty fields | Backend Brier/ECE, probabilities, masks, denominators | PARTIAL | No inferential intervals justified at n=6 | +| Artifact/provenance preservation | Versioned result hashes and existing evidence verifier | PASS | Timing/RSS are machine-specific | +| Cross-client Phase 6 contracts | Phase 6 SDK/CLI/MCP tests and in-process integration | PASS | Hosted MCP and live cross-process loopback remain unverified | +| Browser E2E and axe checks | Repository inspection | NOT VERIFIED | No configured Playwright/axe execution script | +| Release licensing | Repository inspection | PARTIAL | No repository license file; third-party data rights not inferred | + +### Release decision + +Software engineering readiness is **PARTIAL/PASS for local review**: the existing Phase 1–6 checks pass on their recorded commits and Phase 7 adds a reproducible synthetic package. Scientific validation readiness is **PARTIAL** because no real biological dataset was admitted and the synthetic result is inconclusive. A stable `v1.0.0` release is not justified; if the isolated branch is accepted, a prerelease research-package version such as `0.7.0-rc.1` is more accurate. + ## Phase 6 integration audit and acceptance ### Baseline audit diff --git a/Concordia_Design/evaluation/PHASE7_RESEARCH_REPORT.md b/Concordia_Design/evaluation/PHASE7_RESEARCH_REPORT.md new file mode 100644 index 0000000..5b12cef --- /dev/null +++ b/Concordia_Design/evaluation/PHASE7_RESEARCH_REPORT.md @@ -0,0 +1,86 @@ +# Concordia Phase 7 Research and Engineering Validation Report + +## Abstract + +This report evaluates the reproducibility and scientific guardrails of Concordia's CPU-first observational multi-omics workbench. A frozen protocol was executed on the existing six-row synthetic fixture across five fixed seeds and four modality-availability conditions. The experiment is an engineering validation package, not biological validation: no real public dataset was selected because the reviewed candidates did not yet provide a verified, minimal, aligned derived-feature package within the approved scope. + +## Introduction + +Concordia studies whether a modality-adaptive gated linear method can operate when derived omics modalities are unavailable. The software keeps missingness masks, calibration fields, credibility findings, provenance, and artifact hashes explicit across the API, web workbench, SDK, CLI, and read-only MCP server. + +## Related Work + +The implementation is intentionally limited to registered linear methods and explicit data-quality controls. Public repository candidates were reviewed, including the NCI Proteomic Data Commons (PDC), LinkedOmics TCGA-STAD, GEO, and a multi-omics dataset record found through Dataverse. These sources require a separate provenance, licensing, sample-alignment, and data-minimization review before use as a confirmatory evaluation dataset. This report therefore makes no biological or novelty claim. + +## Research Question + +Can a CPU-efficient modality-adaptive fusion model maintain useful predictive performance and calibration when one or more omics modalities are missing? + +The Phase 7 result is inconclusive for this question because the only executed evaluation uses six synthetic rows. The protocol and results are preserved so that a future approved dataset can be evaluated without changing the predeclared analysis plan. + +## Dataset and Methods + +The executed corpus is `tests/fixtures/phase6_synthetic.csv`, a six-row synthetic multi-omics fixture with RNA, protein, cohort, and binary target fields. Its SHA-256 is recorded in `results/phase7-synthetic.json`. No direct identifiers, raw sequences, pathogens, interventions, or clinical records are used. + +The evaluated registered methods are: + +- `cohort_summary_v1`, descriptive only and not treated as a predictive competitor. +- `complete_modality_logistic_v1`, a complete-case predictor. +- `modality_adaptive_gated_linear_v1`, the existing missingness-aware registered method. +- A single-RNA exploratory invocation of the adaptive method. + +The majority-class result is reported by the registered backend as the simple predictive baseline. All methods use the same workflow fixture and cohort-level split implementation. + +## Evaluation Protocol + +The frozen protocol is `Concordia_Design/evaluation/phase7-protocol.json`, protocol hash `a690c898633cbf38466f5d2d55bc52c1e57c4774dd2e94a053ac0838f3662cf7`. It defines five seeds (17, 23, 31, 47, 59), a 60/20/20 cohort split, observed masks, fixed simulated protein-missing, RNA-missing, and both-missing conditions, accuracy as the primary metric, Brier score and ECE as calibration metrics, and descriptive runtime and process-level peak RSS. There are no inferential p-values because the fixture has only six rows and two held-out rows per split. + +## Baseline Comparisons + +Across the five seeds in the observed condition, adaptive accuracy had mean 0.50 with range 0.00–1.00. The complete-case logistic method also had mean accuracy 0.50 over four estimable runs; one run was not estimable. The majority baseline had mean accuracy 0.30 in the adaptive result records. The small sample and seed variability prevent a superiority conclusion. + +The complete-case method was not estimable under simulated missingness. This is reported as unavailable, not as zero performance. + +## Missing-Modality Experiments + +The adaptive method's mean accuracy was 0.20 with protein missing, 0.30 with RNA missing, and 0.30 with both modalities missing. These values are descriptive outcomes on two test rows per seed and should not be interpreted as biological robustness. The fixed masks are visible in the JSON result and are not silently imputed as observed measurements. + +## Calibration and Uncertainty + +The backend records Brier score, ECE, calibration threshold, prediction probabilities, and held-out denominators. The result artifact preserves per-seed predictions and modality masks. No confidence interval is reported because the declared protocol treats this six-row fixture as an engineering check rather than a statistically powered biological study. Predictive uncertainty is kept separate from biological variability and credibility findings. + +## Results + +The reproducible output is `results/phase7-synthetic.json`; the accompanying descriptive figure is `results/phase7-synthetic-accuracy.svg`. The output contains 60 method-condition-seed records, the protocol hash, fixture hash, interpreter/platform metadata, runtime, and process-level peak memory. The adaptive method did not demonstrate consistent improvement over the simple baseline, and the result is therefore inconclusive. + +## Failure Analysis + +The principal limitation is the tiny synthetic fixture: held-out denominators are two rows, complete-case execution becomes unavailable when required modalities are absent, and repeated seeds vary substantially. The real-data gate remains open. No failed result was converted into a successful measurement, and no blocked credibility state was suppressed. + +## Scientific Limitations + +This package does not establish biological validity, generalization, causal relationships, clinical utility, or model superiority. Public repository records can contain case-linked metadata or raw/processed data combinations that require careful review; a future dataset must be approved only after derived-feature scope, alignment, reuse permission, and privacy boundaries are verified. The current evaluation is an engineering-validation report. + +## Reproducibility + +From a clean checkout: + +```bash +export UV_CACHE_DIR="$PWD/.uv-cache" +uv sync --locked +uv run python scripts/run_phase7_evaluation.py +uv run python scripts/verify_evidence_bundle.py --artifact-root .concordia/artifacts +``` + +The full software checks are listed in `Concordia_Design/docs/REPRODUCIBILITY.md`. The evaluation is CPU-only and does not call a paid API or external model. Runtime and memory are machine-specific; `ru_maxrss` is process-level and not an isolated allocation profile. + +## Conclusion + +Phase 7 provides a versioned, repeatable synthetic research package and exposes the remaining scientific-validation gap. Concordia is suitable for continued software review and future dataset onboarding, but it is not scientifically validated on real biological data. + +## References + +1. NCI Proteomic Data Commons, usage and data-access documentation: +2. NCI Proteomic Data Commons, example study metadata: +3. LinkedOmics TCGA-STAD data download page: +4. NCBI Gene Expression Omnibus FAQ: diff --git a/Concordia_Design/evaluation/phase7-protocol.json b/Concordia_Design/evaluation/phase7-protocol.json new file mode 100644 index 0000000..71c81ee --- /dev/null +++ b/Concordia_Design/evaluation/phase7-protocol.json @@ -0,0 +1,31 @@ +{ + "protocol_id": "concordia-phase7-synthetic-v1", + "protocol_version": "1.0.0", + "date_frozen": "2026-12-02", + "status": "frozen_engineering_validation", + "primary_hypothesis": "A modality-adaptive CPU model with explicit availability masks can preserve useful predictive performance and report calibration when an input modality is unavailable on a small synthetic observational fixture.", + "primary_task": "Binary outcome prediction at the cohort-row level.", + "primary_metric": "accuracy on the fixed held-out cohort split", + "secondary_metrics": ["Brier score", "three-bin expected calibration error", "abstain rate", "missing-modality degradation", "runtime_ms", "peak_memory_kb"], + "dataset_eligibility": ["versioned synthetic fixture", "derived numeric modality blocks", "declared outcome", "no direct identifiers", "explicit modality metadata"], + "biological_unit": "synthetic cohort row; not a biological replicate claim", + "splits": "For each predeclared seed, shuffle cohort labels with a local seeded PRNG and assign 60% train, 20% calibration, and 20% held-out test cohorts. No row from a held-out cohort is used for fitting or calibration.", + "missing_modality_protocol": "Evaluate the observed fixture and fixed synthetic masks removing RNA, protein, or both before evaluation. Use identical masks for all predictive methods. Distinguish observed missingness from simulated removal.", + "methods": { + "cohort_summary_v1": "descriptive-only; not a predictive competitor", + "majority_class": "training-set prevalence baseline", + "complete_modality_logistic_v1": "registered CPU logistic baseline; not estimable when the held-out condition is incomplete", + "modality_adaptive_gated_linear_v1": "registered CPU mask-aware logistic model with explicit availability features", + "single_modality": "exploratory invocation using one declared modality; not a separate registered method" + }, + "calibration": "Calibration threshold is fit on the calibration cohort only; ECE uses confidence bins [0,0.5), [0.5,0.75), [0.75,1.01).", + "uncertainty": "The registered result reports Brier/ECE and abstention summaries. No population confidence interval is claimed for the six-row fixture.", + "statistical_comparison": "Report per-seed descriptive values and ranges; do not run significance tests or claim superiority because the fixture is too small.", + "leakage_safeguards": ["cohort-level split", "training-only model fitting", "calibration-only threshold fitting", "no held-out transformation fitting", "credibility hash and split checks"], + "exclusion_criteria": ["missing outcome", "invalid modality declaration", "duplicate sample identifier", "blocked quality report", "any raw sequence or sensitive clinical record"], + "random_seeds": [17, 23, 31, 47, 59], + "hardware_record": "Record Python version, platform, CPU, and measured runtime/memory at execution.", + "stopping_rules": "Run all five seeds and all predeclared conditions; do not stop after favorable results.", + "inconclusive_criteria": ["fewer than three cohorts", "empty train/calibration/test split", "complete-case method not estimable", "any metric unavailable", "any credibility block", "results differ outside documented deterministic behavior"], + "real_data_status": "not_selected; public candidates require further licensing, metadata minimization, and aligned derived-feature review" +} diff --git a/Concordia_Design/evaluation/results/phase7-manifest.json b/Concordia_Design/evaluation/results/phase7-manifest.json new file mode 100644 index 0000000..50dabbd --- /dev/null +++ b/Concordia_Design/evaluation/results/phase7-manifest.json @@ -0,0 +1,11 @@ +{ + "protocol_id": "concordia-phase7-synthetic-v1", + "protocol_sha256": "a690c898633cbf38466f5d2d55bc52c1e57c4774dd2e94a053ac0838f3662cf7", + "fixture": "tests/fixtures/phase6_synthetic.csv", + "fixture_sha256": "0c5ed7913ceb3f341236dcf95647d2befc7c2179612b57ff2224730d2628a9db", + "result": "phase7-synthetic.json", + "figure": "phase7-synthetic-accuracy.svg", + "status": "engineering_validation_only", + "real_data_validation": "not_completed", + "reproduction_command": "UV_CACHE_DIR=.uv-cache uv run python scripts/run_phase7_evaluation.py" +} diff --git a/Concordia_Design/evaluation/results/phase7-synthetic-accuracy.svg b/Concordia_Design/evaluation/results/phase7-synthetic-accuracy.svg new file mode 100644 index 0000000..77c0508 --- /dev/null +++ b/Concordia_Design/evaluation/results/phase7-synthetic-accuracy.svg @@ -0,0 +1 @@ +Mean held-out accuracy across five seedsDescriptive synthetic engineering evaluation; not biological validation.Mean held-out accuracy by condition and methodFive fixed seeds; six-row synthetic fixture; bars are descriptive only.observed0.50observed0.50observed0.20both_missing0.30both_missing0.30protein_missi0.20protein_missi0.20rna_missing0.30rna_missing0.30Accuracy (0–1); method identity is encoded in the underlying JSON manifest. \ No newline at end of file diff --git a/Concordia_Design/evaluation/results/phase7-synthetic.json b/Concordia_Design/evaluation/results/phase7-synthetic.json new file mode 100644 index 0000000..52077cd --- /dev/null +++ b/Concordia_Design/evaluation/results/phase7-synthetic.json @@ -0,0 +1,4995 @@ +{ + "fixture_sha256": "0c5ed7913ceb3f341236dcf95647d2befc7c2179612b57ff2224730d2628a9db", + "limitations": [ + "Synthetic six-row fixture only.", + "No real-data biological validation.", + "Per-seed values are descriptive and not inferential." + ], + "memory_measurement": "process-level ru_maxrss; not an isolated method allocation", + "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "protocol_id": "concordia-phase7-synthetic-v1", + "protocol_sha256": "a690c898633cbf38466f5d2d55bc52c1e57c4774dd2e94a053ac0838f3662cf7", + "python": "3.13.12 (main, Mar 25 2026, 02:48:22) [Clang 22.1.1 ]", + "records": [ + { + "condition": "observed", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45072, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.486367, + "ece": 0.479894, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.478339, + "ece": 0.47772, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.6685955495339011, + "sample_id": "synthetic-004", + "y": 1.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.793226261240019, + "sample_id": "synthetic-005", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.369518, + "ece": 0.562315, + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 5.89, + "seed": 17, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45072, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.486367, + "ece": 0.479894, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.478339, + "ece": 0.47772, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.6685955495339011, + "sample_id": "synthetic-004", + "y": 1.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.793226261240019, + "sample_id": "synthetic-005", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.369518, + "ece": 0.562315, + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 5.701, + "seed": 17, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45072, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.367255, + "ece": 0.342425, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.8240386517177101, + "sample_id": "synthetic-004", + "y": 1.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.8886699109414308, + "sample_id": "synthetic-005", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.410348, + "ece": 0.356354, + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 5.776, + "seed": 17, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45072, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 1.0, + "ece": 1.0, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.968345, + "ece": 0.984037, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.816968, + "ece": 0.903859, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.9879762345094455, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.9932239678488268, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.981295, + "ece": 0.9906, + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 6.033, + "seed": 23, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45072, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 1.0, + "ece": 1.0, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.968345, + "ece": 0.984037, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.816968, + "ece": 0.903859, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.9879762345094455, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.9932239678488268, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.981295, + "ece": 0.9906, + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 5.792, + "seed": 23, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45072, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 1.0, + "ece": 1.0, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.72807, + "ece": 0.85327, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.9836005596250379, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.9905505744985785, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.97433, + "ece": 0.987076, + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 5.573, + "seed": 23, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45072, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.397123, + "ece": 0.377243, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.473409, + "ece": 0.457564, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.10191461825550265, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.0487230555445839, + "sample_id": "synthetic-004", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.457657, + "ece": 0.424681, + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 5.953, + "seed": 31, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45072, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.397123, + "ece": 0.377243, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.473409, + "ece": 0.457564, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.10191461825550265, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.0487230555445839, + "sample_id": "synthetic-004", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.457657, + "ece": 0.424681, + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 6.031, + "seed": 31, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45072, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.36478, + "ece": 0.338792, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.5748195141748487, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.2397671807294721, + "sample_id": "synthetic-004", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.5, + "accuracy": 0.0, + "brier": 0.454186, + "ece": 0.667526, + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 5.804, + "seed": 31, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45088, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.840589, + "ece": 0.916712, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 1.0, + "brier": 0.02029, + "ece": 0.141962, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.4240981151181926, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.4754044875915246, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 1.0, + "accuracy": 1.0, + "brier": 0.202934, + "ece": 0.449751, + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 6.008, + "seed": 47, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45088, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.840589, + "ece": 0.916712, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 1.0, + "brier": 0.02029, + "ece": 0.141962, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.4240981151181926, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.4754044875915246, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 1.0, + "accuracy": 1.0, + "brier": 0.202934, + "ece": 0.449751, + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 5.997, + "seed": 47, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45104, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.592352, + "ece": 0.769644, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.7634627966667853, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.7047697628436881, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.539788, + "ece": 0.734116, + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 5.602, + "seed": 47, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45104, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.30546, + "ece": 0.291164, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.395904, + "ece": 0.41823, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 1 + }, + "p": 0.08643568482939902, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.2390664429124314, + "sample_id": "synthetic-002", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.293246, + "ece": 0.337249, + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 5.725, + "seed": 59, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45104, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 0.022, + "seed": 59, + "status": "measured" + }, + { + "condition": "observed", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45120, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.420022, + "ece": 0.412337, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.12146862409879979, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.16605745675220657, + "sample_id": "synthetic-002", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.355107, + "ece": 0.356237, + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 5.914, + "seed": 59, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45136, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.410348, + "ece": 0.356354, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.367255, + "ece": 0.342425, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.8240386517177101, + "sample_id": "synthetic-004", + "y": 1.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.8886699109414308, + "sample_id": "synthetic-005", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.410348, + "ece": 0.356354, + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 5.751, + "seed": 17, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45136, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 0.022, + "seed": 17, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45136, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.367255, + "ece": 0.342425, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.8240386517177101, + "sample_id": "synthetic-004", + "y": 1.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.8886699109414308, + "sample_id": "synthetic-005", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.410348, + "ece": 0.356354, + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 6.007, + "seed": 17, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45136, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 1.0, + "ece": 1.0, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.97433, + "ece": 0.987076, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.72807, + "ece": 0.85327, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.9836005596250379, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.9905505744985785, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.97433, + "ece": 0.987076, + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 5.833, + "seed": 23, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45136, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 0.022, + "seed": 23, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45136, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 1.0, + "ece": 1.0, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.72807, + "ece": 0.85327, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.9836005596250379, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.9905505744985785, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.97433, + "ece": 0.987076, + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 5.614, + "seed": 23, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45168, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.5, + "accuracy": 0.0, + "brier": 0.454186, + "ece": 0.667526, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.36478, + "ece": 0.338792, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.5748195141748487, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.23976718072947223, + "sample_id": "synthetic-004", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.5, + "accuracy": 0.0, + "brier": 0.454186, + "ece": 0.667526, + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 6.321, + "seed": 31, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45168, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 0.022, + "seed": 31, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.36478, + "ece": 0.338792, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.5748195141748487, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.2397671807294721, + "sample_id": "synthetic-004", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.5, + "accuracy": 0.0, + "brier": 0.454186, + "ece": 0.667526, + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 5.721, + "seed": 31, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.539788, + "ece": 0.734116, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.592352, + "ece": 0.769644, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.7634627966667853, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.7047697628436881, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.539788, + "ece": 0.734116, + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 5.748, + "seed": 47, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 0.017, + "seed": 47, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.592352, + "ece": 0.769644, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.7634627966667853, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.7047697628436881, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.539788, + "ece": 0.734116, + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 5.566, + "seed": 47, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.355107, + "ece": 0.356237, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.420022, + "ece": 0.412337, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.12146862409879976, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 1 + }, + "p": 0.16605745675220654, + "sample_id": "synthetic-002", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.355107, + "ece": 0.356237, + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 5.702, + "seed": 59, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 0.021, + "seed": 59, + "status": "measured" + }, + { + "condition": "simulated_protein_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.420022, + "ece": 0.412337, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 1 + }, + "p": 0.12146862409879979, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 1 + }, + "p": 0.16605745675220657, + "sample_id": "synthetic-002", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.355107, + "ece": 0.356237, + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 5.588, + "seed": 59, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.37822, + "ece": 0.358078, + "n": 2 + }, + "rna": { + "abstain_rate": 0.5, + "accuracy": 0.5, + "brier": 0.286878, + "ece": 0.115405, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 0 + }, + "p": 0.5923758512070683, + "sample_id": "synthetic-004", + "y": 1.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 0 + }, + "p": 0.638434177671015, + "sample_id": "synthetic-005", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.5, + "accuracy": 0.5, + "brier": 0.286878, + "ece": 0.115405, + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 5.63, + "seed": 17, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 0.014, + "seed": 17, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-004", + "y": 1.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-005", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 5.614, + "seed": 17, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 1.0, + "ece": 1.0, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.954325, + "ece": 0.976896, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.985083, + "ece": 0.992513, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 0 + }, + "p": 0.9920185791179377, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 0 + }, + "p": 0.9930076255218493, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.985083, + "ece": 0.992513, + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 5.621, + "seed": 23, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 0.017, + "seed": 23, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 1.0, + "ece": 1.0, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.977356, + "ece": 0.988613, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.9886131966885418, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.9886131966885418, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.977356, + "ece": 0.988613, + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 6.131, + "seed": 23, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.392641, + "ece": 0.377678, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.454861, + "ece": 0.424889, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 0 + }, + "p": 0.09887638475340241, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 0 + }, + "p": 0.05134548100475182, + "sample_id": "synthetic-004", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.454861, + "ece": 0.424889, + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 5.864, + "seed": 31, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 0.021, + "seed": 31, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-004", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 5.85, + "seed": 31, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.834151, + "ece": 0.913319, + "n": 2 + }, + "rna": { + "abstain_rate": 1.0, + "accuracy": 0.0, + "brier": 0.342045, + "ece": 0.584677, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 0 + }, + "p": 0.598748495703908, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 1, + "rna": 0 + }, + "p": 0.5706047658073349, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 1.0, + "accuracy": 0.0, + "brier": 0.342045, + "ece": 0.584677, + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 6.037, + "seed": 47, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 0.028, + "seed": 47, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 5.831, + "seed": 47, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.336037, + "ece": 0.293321, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.33801, + "ece": 0.288654, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 1, + "rna": 0 + }, + "p": 0.21601254443565682, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.2066793129530436, + "sample_id": "synthetic-002", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.33801, + "ece": 0.288654, + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 5.929, + "seed": 59, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 0.026, + "seed": 59, + "status": "measured" + }, + { + "condition": "simulated_rna_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-002", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 5.946, + "seed": 59, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-004", + "y": 1.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-005", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 6.103, + "seed": 17, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 0.023, + "seed": 17, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-004", + "y": 1.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-005", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "seed": 17, + "split": { + "calibration_cohorts": [ + "c" + ], + "test_cohorts": [ + "d", + "e" + ], + "train_cohorts": [ + "a", + "b", + "f" + ] + } + }, + "runtime_ms": 5.799, + "seed": 17, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 1.0, + "ece": 1.0, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.977356, + "ece": 0.988613, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.977356, + "ece": 0.988613, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.9886131966885418, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.9886131966885418, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.977356, + "ece": 0.988613, + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 5.637, + "seed": 23, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 0.02, + "seed": 23, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 1.0, + "ece": 1.0, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.977356, + "ece": 0.988613, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.9886131966885418, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.9886131966885418, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.977356, + "ece": 0.988613, + "n": 2 + }, + "seed": 23, + "split": { + "calibration_cohorts": [ + "e" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "d", + "f" + ] + } + }, + "runtime_ms": 5.993, + "seed": 23, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-004", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 5.947, + "seed": 31, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 0.024, + "seed": 31, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-004", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "seed": 31, + "split": { + "calibration_cohorts": [ + "f" + ], + "test_cohorts": [ + "a", + "d" + ], + "train_cohorts": [ + "b", + "c", + "e" + ] + } + }, + "runtime_ms": 5.749, + "seed": 31, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 5.641, + "seed": 47, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 0.018, + "seed": 47, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.6666666664620965, + "sample_id": "synthetic-003", + "y": 0.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.0, + "brier": 0.444444, + "ece": 0.666667, + "n": 2 + }, + "seed": 47, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "c" + ], + "train_cohorts": [ + "b", + "e", + "f" + ] + } + }, + "runtime_ms": 5.826, + "seed": 47, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "modality_adaptive_gated_linear_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "protein": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "protein": 0, + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-002", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 5.785, + "seed": 59, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "complete_modality_logistic_v1", + "modalities": [ + "rna", + "protein" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "complete_modality": { + "applicability_status": "not_estimable", + "n": 2 + } + }, + "limitations": [ + "Complete-modality baseline is not estimable because test rows are missing a modality." + ], + "method": "complete_modality_logistic_v1", + "missing_modality": { + "protein": { + "applicability_status": "not_estimable" + }, + "rna": { + "applicability_status": "not_estimable" + } + }, + "modalities": [ + "rna", + "protein" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "proposed": { + "applicability_status": "not_estimable", + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 0.022, + "seed": 59, + "status": "measured" + }, + { + "condition": "simulated_both_missing", + "error": null, + "method": "single_modality_rna_exploratory", + "modalities": [ + "rna" + ], + "peak_process_memory_kb": 45184, + "result": { + "baselines": { + "majority": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "calibration_threshold": 0.6, + "limitations": [ + "Synthetic and small-fixture metrics are not evidence of superiority or biological validity." + ], + "method": "modality_adaptive_gated_linear_v1", + "missing_modality": { + "rna": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + } + }, + "modalities": [ + "rna" + ], + "n_rows": { + "calibration": 1, + "test": 2, + "train": 3 + }, + "predictions": [ + { + "modality_mask": { + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-001", + "y": 0.0 + }, + { + "modality_mask": { + "rna": 0 + }, + "p": 0.33333333353790345, + "sample_id": "synthetic-002", + "y": 1.0 + } + ], + "proposed": { + "abstain_rate": 0.0, + "accuracy": 0.5, + "brier": 0.277778, + "ece": 0.166667, + "n": 2 + }, + "seed": 59, + "split": { + "calibration_cohorts": [ + "d" + ], + "test_cohorts": [ + "a", + "b" + ], + "train_cohorts": [ + "c", + "e", + "f" + ] + } + }, + "runtime_ms": 5.573, + "seed": 59, + "status": "measured" + } + ] +} diff --git a/Concordia_Design/phases/07-release.md b/Concordia_Design/phases/07-release.md index b5b19ef..4beac51 100644 --- a/Concordia_Design/phases/07-release.md +++ b/Concordia_Design/phases/07-release.md @@ -12,3 +12,7 @@ **Stack:** GitHub Actions, Docker/Compose, pytest, Playwright, Ruff, mypy, dependency audit/SBOM tools (pip-audit, CycloneDX, Trivy), OpenTelemetry, structured logs, optional Prometheus/Grafana. Hosted deployment uses TLS boundary and private network. **Acceptance:** a clean checkout can run the synthetic workflow without GPU; all artifact hashes validate; reproducibility test passed; documented client compatibility; defect/benchmark outcomes recorded; release notes distinguish validated from planned claims. + +## Phase 7 implementation record + +The current Phase 7 branch freezes a synthetic engineering-validation protocol and records its exact fixture/protocol hashes, 60 method-condition-seed records, a deterministic SVG summary, a research report, reproducibility instructions, release notes, and explicit limitations. No public biological dataset was selected because the reviewed candidates still require a separate derived-feature, licensing, metadata-minimization, and alignment review. Consequently, real-data scientific validation is not claimed and the release recommendation is a prerelease research package rather than `v1.0.0`. diff --git a/README.md b/README.md index 027fec4..babb3e5 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,44 @@ # Concordia -![Phase 6](https://img.shields.io/badge/phase-6%20integration-2ea44f) ![Python](https://img.shields.io/badge/Python-3.12%2B-3776ab?logo=python&logoColor=white) -![FastAPI](https://img.shields.io/badge/FastAPI-canonical%20API-009688?logo=fastapi&logoColor=white) ![CPU first](https://img.shields.io/badge/compute-CPU--first-6f42c1) -![Local verification](https://img.shields.io/badge/verification-local%20tests%20recorded-2ea44f) +![Status](https://img.shields.io/badge/status-research%20package-orange) +![FastAPI](https://img.shields.io/badge/API-FastAPI-009688?logo=fastapi&logoColor=white) -Concordia is a CPU-first observational multi-omics workbench for permitted derived feature tables. It connects bounded intake, missingness-aware analysis, independent credibility checks, and verifiable evidence through a React workbench, Python SDK, CLI, and read-only MCP server. +Concordia is a CPU-first observational multi-omics research workbench for permitted derived feature tables. It connects bounded ingestion, missingness-aware analysis, credibility checks, verified evidence, and researcher-facing integrations without making clinical, causal, or biological-generalization claims. ## About -Researchers can inspect how an observational multi-omics analysis was performed and whether its outputs are suitable for review. Concordia preserves modality availability masks, frozen plans, registered method versions, calibration and uncertainty fields, provenance hashes, credibility findings, and limitations from the API through every client. +Concordia keeps modality availability, missingness masks, frozen analysis plans, registered method versions, calibration fields, provenance hashes, credibility findings, and artifact limitations visible from the FastAPI service through the React workbench, Python SDK, CLI, and read-only MCP server. -The research direction is a modality-adaptive gated model under missing modalities with calibrated uncertainty. It remains an engineering hypothesis, not a novelty or biological-validation claim. Concordia is not a clinical decision system, causal inference engine, pathogen tool, sequence-design system, or unrestricted execution platform. +## Research question + +Can a CPU-efficient modality-adaptive fusion model maintain useful predictive performance and calibration when one or more omics modalities are missing? The Phase 7 package freezes this question and its protocol, but the executed six-row synthetic evaluation is inconclusive and is not biological validation. ## Features -- Bounded CSV/Parquet intake for synthetic, public-derived, or de-identified derived multi-omics data. -- Quality and missingness reports with explicit warning acknowledgement and blocked states. -- Human-approved immutable analysis plans and deterministic CPU execution with idempotent run starts. -- Phase 3 credibility findings and Phase 4 hash-verified evidence bundles, Markdown/HTML reports, retrieval, and offline verification. -- Phase 5 React/TypeScript workbench with accessible tables, charts, provenance, findings, and exports. -- Phase 6 typed Python SDK, hierarchical CLI, and read-only MCP tools backed by the same FastAPI contracts. +- Bounded CSV/Parquet intake with declared modality and data-policy metadata. +- Quality, missingness, provenance, acknowledgement, and blocked-state handling. +- Human-approved immutable plans and deterministic CPU execution. +- Independent credibility findings and hash-verified evidence bundles/reports. +- React/TypeScript scientist workbench with accessible tables and exports. +- Typed Python SDK, hierarchical CLI, and read-only MCP tools using canonical API contracts. +- Frozen synthetic evaluation protocol, versioned results, and reproducibility report. ## Architecture ```mermaid flowchart LR - UI[React researcher workbench] --> API[FastAPI /api/v1 canonical contracts] + UI[React workbench] --> API[FastAPI canonical API] SDK[Python SDK] --> API CLI[Typer CLI] --> SDK - MCP[Read-only MCP server] --> SDK + MCP[Read-only MCP] --> SDK API --> WF[Workflow and credibility gates] - WF --> STORE[(SQLite metadata + managed artifacts)] - WF --> EVID[Verified evidence and deterministic reports] + WF --> DB[(SQLite metadata)] + WF --> EV[Verified evidence and reports] ``` -Clients do not calculate scientific results or access the database directly. The API reauthorizes object access, enforces scope and approval state, verifies artifacts, and returns stable error envelopes. +Clients do not calculate scientific results or access storage directly. The server authorizes objects, enforces approvals and policy, verifies artifacts, and preserves blocked results. ## Quick start @@ -46,8 +48,7 @@ Requirements: Python 3.12 or 3.13, `uv`, Node.js/npm for the frontend, and Docke export UV_CACHE_DIR="$PWD/.uv-cache" uv sync --locked uv run alembic upgrade head -CONCORDIA_LOCAL_TOKEN=local-dev-token \ - uv run uvicorn concordia_api.main:app --host 127.0.0.1 --port 8000 +CONCORDIA_LOCAL_TOKEN=local-dev-token uv run uvicorn concordia_api.main:app --host 127.0.0.1 --port 8000 ``` In another shell: @@ -58,40 +59,52 @@ npm ci npm run dev ``` -Open the Vite URL or `http://127.0.0.1:8000/`. Local authentication uses the process-configured `X-Concordia-Token`; it is not hosted multi-user authorization. +Authentication is the documented local single-user token boundary; hosted RBAC/OIDC is not implemented. + +## Reproducible example + +```bash +export UV_CACHE_DIR="$PWD/.uv-cache" +uv run python scripts/run_synthetic_demo.py +uv run python scripts/run_phase7_evaluation.py +uv run pytest -q +``` + +The evidence verifier independently checks a downloaded bundle and its referenced artifact hashes: + +```bash +uv run python scripts/verify_evidence_bundle.py --artifact-root .concordia/artifacts +``` ## Python SDK ```python from concordia_sdk import ConcordiaClient -with ConcordiaClient("http://127.0.0.1:8000", "local-dev-token") as concordia: - capabilities = concordia.capabilities() - projects = concordia.list_projects() - print(capabilities.schema_version, [project.name for project in projects]) +with ConcordiaClient("http://127.0.0.1:8000", "local-dev-token") as client: + print(client.capabilities().schema_version) + print([project.name for project in client.list_projects()]) ``` -The SDK exposes typed project, dataset, quality, plan, run, result, finding, manifest, evidence, report, artifact, and search operations. It has explicit authentication, authorization, validation, conflict, not-found, timeout, and transport exceptions. Only idempotent reads retry. +The SDK exposes typed project, dataset, quality, plan, run, finding, manifest, evidence, report, artifact, and search operations. Reads retry within bounded limits; mutations require explicit caller actions. ## CLI ```bash export CONCORDIA_API_URL=http://127.0.0.1:8000 export CONCORDIA_LOCAL_TOKEN=local-dev-token -concordia --help concordia projects list --json concordia datasets quality DATASET_ID --json -concordia plans show PLAN_ID --json concordia runs status RUN_ID --json concordia evidence export RUN_ID --output bundle.json --yes concordia evidence verify bundle.json --artifact-root .concordia/artifacts ``` -Mutating commands require explicit confirmation unless `--yes` is supplied. The CLI never approves or executes an analysis automatically and does not perform scientific calculations. +Mutations require explicit confirmation or `--yes`; the CLI cannot approve or execute an analysis automatically. ## MCP -The MCP server is local and read-only. It calls the canonical API through the SDK and exposes capabilities, projects, datasets, quality, runs, results, findings, manifests, evidence summaries, bounded evidence search, and deterministic report summaries. It cannot create or approve plans, start or cancel runs, modify datasets, execute code or SQL, read arbitrary paths, or bypass suppressed evidence. +The local MCP server is read-only and exposes authorized project, dataset, quality, run, result, finding, manifest, evidence-summary, search, report-summary, and capability tools. It cannot create or approve plans, start or cancel runs, modify datasets, execute code or SQL, read arbitrary paths, or bypass suppressed evidence. ```bash CONCORDIA_API_URL=http://127.0.0.1:8000 \ @@ -99,58 +112,30 @@ CONCORDIA_LOCAL_TOKEN=local-dev-token \ uv run python -m concordia_mcp.server ``` -Local MCP protocol registration is tested in this repository. Claude Code/Desktop configuration must follow the installed client’s documented local MCP settings. ChatGPT custom MCP requires an eligible account/workspace and an authenticated HTTPS endpoint; localhost support is not claimed. Use the SDK/CLI report export when hosted MCP is unavailable. +Local protocol registration is tested in-repository. Remote Claude or ChatGPT connector support is not claimed; use an installed client’s current documentation and an authorized HTTPS deployment when available. -## Reproducible example +## Scientific methods and evaluation -The synthetic fixture is `tests/fixtures/synthetic_multiomics.json`. The deterministic workflow demonstration is: +Registered methods include `cohort_summary_v1` (descriptive), `complete_modality_logistic_v1`, and `modality_adaptive_gated_linear_v1`. Phase 7 ran 60 records across five fixed seeds and four modality conditions on the six-row synthetic fixture. In the observed condition, adaptive accuracy averaged 0.50 (range 0.00–1.00); under simulated protein, RNA, and both-modality missingness it averaged 0.20, 0.30, and 0.30 respectively. The complete-case method was unavailable under simulated missingness. These results are descriptive engineering checks, not evidence of superiority or biological validity. -```bash -export UV_CACHE_DIR="$PWD/.uv-cache" -uv run python scripts/run_synthetic_demo.py -uv run pytest -q -uv run python -c 'from concordia_core import run_frozen_evaluation; import json; print(json.dumps({k: run_frozen_evaluation(k) for k in ("development", "held_out")}, indent=2, sort_keys=True))' -``` +See [the research report](Concordia_Design/evaluation/PHASE7_RESEARCH_REPORT.md), [the frozen protocol](Concordia_Design/evaluation/phase7-protocol.json), and [the reproducibility guide](Concordia_Design/docs/REPRODUCIBILITY.md). -For a published run, `concordia evidence export` downloads the API-authorized bundle and `concordia evidence verify` independently checks its canonical digest and referenced artifact hashes. Synthetic values are engineering fixtures, not biological evidence. - -## Scientific evaluation +## Limitations -The frozen credibility evaluation reports development and held-out fault fixtures separately. The recorded Phase 3 result was precision 1.0 and recall 1.0 for both fixture sets, with no false positives or missed blocking cases. The deterministic baseline detected development faults but missed held-out blocking faults. These are small synthetic rule-check evaluations, not population performance, clinical validation, causality, or proof of model superiority. +No real public dataset is included in the Phase 7 evaluation. The six-row fixture has very small held-out denominators, and no confidence interval or inferential claim is justified. Local authentication, distributed execution, hosted RBAC, browser E2E, and axe accessibility automation remain limited or unconfigured. Concordia does not support raw sequence, pathogen, clinical-action, causal, or unrestricted model workflows. -## Limitations +## Project structure -- Fixtures are small and synthetic; no biological or clinical validation is claimed. -- The product is associational and cannot establish causation or recommend treatment. -- Local authentication is a single-user token boundary; hosted RBAC/OIDC is not implemented. -- Execution is local and CPU-first; distributed scheduling and hard-kill recovery are outside this phase. -- Optional language explanations remain deterministic and evidence-bound; no external model is required. -- MCP remote/hosted client compatibility depends on the actual client, account, HTTPS, and authorization configuration. +- `packages/`: contracts, workflow, SDK, CLI, and MCP packages. +- `services/`: FastAPI service and migrations. +- `apps/web/`: React/Vite workbench. +- `Concordia_Design/`: scope, architecture, protocols, reports, and status. +- `scripts/`: reproducible demos, evaluation, and evidence verification. ## Roadmap -- Phase 1 — ingestion and quality ledger: complete. -- Phase 2 — approved deterministic analysis runtime: complete. -- Phase 3 — credibility checks and frozen evaluation: complete. -- Phase 4 — evidence, reports, retrieval, and verification: complete. -- Phase 5 — scientist-facing workbench: complete. -- Phase 6 — SDK, CLI, and read-only MCP integrations: complete locally; hosted/remote MCP clients remain unverified. -- Phase 7 — release and research package: not started. +Phases 1–5 are implemented locally, Phase 6 is implemented on its feature branch with PR #2 awaiting merge, and Phase 7 is an isolated research-package branch. Stable `v1.0.0` readiness is not claimed because real biological validation is incomplete. ## Contributing and license -Run the verification commands below before submitting changes. Preserve scope boundaries, evidence provenance, and explicit blocked states. Do not add raw sequence, pathogen, clinical-action, causal, arbitrary-code, or unrestricted model functionality. - -```bash -export UV_CACHE_DIR="$PWD/.uv-cache" -uv sync --locked -uv run pytest -q -uv run ruff check packages services tests scripts -uv run mypy packages services -uv run alembic upgrade head -uv run alembic current -uv run pip-audit --strict -docker build --tag concordia:phase6-local . -``` - -No license file is currently present in the repository. Add an owner-approved license before redistributing the project. +See [CONTRIBUTING.md](CONTRIBUTING.md). Run the locked Python and frontend checks before submitting changes. No license file is currently present; redistribution rights for third-party data must not be inferred. diff --git a/scripts/run_phase7_evaluation.py b/scripts/run_phase7_evaluation.py new file mode 100644 index 0000000..803b875 --- /dev/null +++ b/scripts/run_phase7_evaluation.py @@ -0,0 +1,96 @@ +"""Run the frozen Phase 7 synthetic evaluation without changing backend methods.""" + +from __future__ import annotations + +import copy +import hashlib +import json +import platform +import resource +import sys +import time +from pathlib import Path +from typing import Any + +from concordia_contracts import DataCategory, ModalitySpec +from concordia_core import ConcordiaWorkflow + +PROTOCOL = Path("Concordia_Design/evaluation/phase7-protocol.json") +FIXTURE = Path("tests/fixtures/phase6_synthetic.csv") +OUTPUT = Path("Concordia_Design/evaluation/results/phase7-synthetic.json") +FIGURE = Path("Concordia_Design/evaluation/results/phase7-synthetic-accuracy.svg") + + +def _peak_memory_kb() -> int: + value = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss + return int(value / 1024) if sys.platform == "darwin" else int(value) + + +def _mask(rows: list[dict[str, Any]], modalities: tuple[str, ...]) -> list[dict[str, Any]]: + result = copy.deepcopy(rows) + for row in result: + for modality in modalities: + row["modalities"][modality] = [None] + row["availability"][modality] = False + row["missingness_mask"][modality] = 1 + return result + + +def main() -> None: + protocol_bytes = PROTOCOL.read_bytes() + workflow = ConcordiaWorkflow() + project = workflow.create_project("Phase 7 synthetic evaluation", "Frozen engineering validation", DataCategory.SYNTHETIC_MULTIOMICS) + modalities = [ + ModalitySpec(modality_id="rna", display_label="RNA", feature_namespace="gene", source_ref="phase6-fixture", unit_policy="normalized", allowed_missingness="explicit_mask"), + ModalitySpec(modality_id="protein", display_label="Protein", feature_namespace="protein", source_ref="phase6-fixture", unit_policy="normalized", allowed_missingness="explicit_mask"), + ] + manifest, quality = workflow.register_dataset(project.project_id, FIXTURE.name, FIXTURE.read_bytes(), "phase6-fixture", "test-only", modalities) + if not quality.eligible: + raise RuntimeError(f"fixture is not eligible: {quality.blocked_reasons}") + rows = workflow.datasets[manifest.dataset_id].rows + seeds = [17, 23, 31, 47, 59] + conditions = { + "observed": rows, + "simulated_protein_missing": _mask(rows, ("protein",)), + "simulated_rna_missing": _mask(rows, ("rna",)), + "simulated_both_missing": _mask(rows, ("rna", "protein")), + } + records: list[dict[str, Any]] = [] + for condition, condition_rows in conditions.items(): + for seed in seeds: + for method, declared_modalities in ( + ("modality_adaptive_gated_linear_v1", ("rna", "protein")), + ("complete_modality_logistic_v1", ("rna", "protein")), + ("single_modality_rna_exploratory", ("rna",)), + ): + operation = "modality_adaptive_gated_linear_v1" if method == "single_modality_rna_exploratory" else method + started = time.perf_counter() + try: + result = workflow._execute_registered_method(condition_rows, declared_modalities, operation, {"seed": seed}) + status = "measured" + error = None + except Exception as exc: + result = {} + status = "inconclusive" + error = f"{type(exc).__name__}: {exc}" + records.append({"condition": condition, "seed": seed, "method": method, "modalities": list(declared_modalities), "status": status, "error": error, "runtime_ms": round((time.perf_counter() - started) * 1000, 3), "peak_process_memory_kb": _peak_memory_kb(), "result": result}) + OUTPUT.parent.mkdir(parents=True, exist_ok=True) + payload = {"protocol_id": json.loads(protocol_bytes)["protocol_id"], "protocol_sha256": hashlib.sha256(protocol_bytes).hexdigest(), "fixture_sha256": hashlib.sha256(FIXTURE.read_bytes()).hexdigest(), "python": sys.version, "platform": platform.platform(), "records": records, "memory_measurement": "process-level ru_maxrss; not an isolated method allocation", "limitations": ["Synthetic six-row fixture only.", "No real-data biological validation.", "Per-seed values are descriptive and not inferential."]} + OUTPUT.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n") + summary: dict[tuple[str, str], list[float]] = {} + for record in records: + metric = record["result"].get("proposed") or {} + if metric.get("accuracy") is not None: + summary.setdefault((record["condition"], record["method"]), []).append(float(metric["accuracy"])) + width, height = 920, 360 + bars = [] + for index, ((condition, _method), values) in enumerate(sorted(summary.items())): + x = 30 + index * 95 + bar_height = int(sum(values) / len(values) * 220) + bars.append(f'{condition.replace("simulated_", "")[:13]}{sum(values) / len(values):.2f}') + FIGURE.write_text(f'Mean held-out accuracy across five seedsDescriptive synthetic engineering evaluation; not biological validation.Mean held-out accuracy by condition and methodFive fixed seeds; six-row synthetic fixture; bars are descriptive only.{"".join(bars)}Accuracy (0–1); method identity is encoded in the underlying JSON manifest.') + print(json.dumps({"output": str(OUTPUT), "figure": str(FIGURE), "protocol_sha256": payload["protocol_sha256"], "fixture_sha256": payload["fixture_sha256"], "records": len(records)}, indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main()