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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
41 changes: 38 additions & 3 deletions Concordia_Design/USAGE_AND_INTEGRATION.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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.
Expand All @@ -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

Expand Down
5 changes: 5 additions & 0 deletions Concordia_Design/architecture/API_CONTRACTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Concordia_Design/architecture/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions Concordia_Design/docs/RELEASE_NOTES_PHASE7.md
Original file line number Diff line number Diff line change
@@ -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.
22 changes: 22 additions & 0 deletions Concordia_Design/docs/REPRODUCIBILITY.md
Original file line number Diff line number Diff line change
@@ -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 <bundle> --artifact-root .concordia/artifacts
```

No GPU, paid API, cloud model, raw sequence, or external LLM is required.
9 changes: 9 additions & 0 deletions Concordia_Design/docs/RESEARCH_LIMITATIONS.md
Original file line number Diff line number Diff line change
@@ -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.
Loading
Loading