Skip to main content
Glama
sap2409

Clinical MCP Server

by sap2409
README.md
# Clinical Supply Chain Agentic Data Platform

AI-powered platform that **validates, explains, and remediates** clinical supply data quality across Bronze → Silver → Gold on **Azure Databricks**, with governed **MCP tools**, **data contracts**, and an **evaluation harness** mapped to G7 Engineer II criteria **T1 / T2 / T3**.

**Storage:** Databricks only — Unity Catalog **Volumes** for landing files and **managed Delta tables** for Bronze/Silver/Gold. No separate Azure Data Lake / ADLS account in this design.

## Quick start (local)

```bash
python -m venv .venv
# Windows
.venv\Scripts\activate
pip install -r requirements.txt

# List contracts
python -m clinical_platform.cli list-contracts

# Happy-path validation
python -m clinical_platform.cli validate sap_batch_raw

# Portfolio demo — schema drift
python -m clinical_platform.cli demo-drift

# Agents
python -m agents.cli dq --drift
python -m agents.cli rca
python -m agents.cli ask "Why did Gold trial inventory fail today?"

# T3 evaluation
python -m eval.harness
```

Copy `.env.example` → `.env` when you wire Azure OpenAI (offline fallback works without it).

## Repository layout

```
contracts/              # Unity Catalog contracts (catalog.schema.table)
hive_metastore/         # Hive metastore track (database.table) — use if no UC create permission
clinical_platform/      # validate_table, expectations, local engine
mcp_server/             # Governed tools for agents
agents/                 # DQ, RCA, Q&A
...
metadata/ddl.sql        # Unity Catalog DDL
hive_metastore/ddl.sql  # Hive metastore DDL
```

**No Unity Catalog create rights?** Use [`hive_metastore/README.md`](hive_metastore/README.md).

## Mapping to assessment criteria

| Criterion | What this repo proves |
|-----------|------------------------|
| **T1** | MCP tool server, reusable agent skills, prompt-backed RCA/Q&A, knowledge via contracts/lineage |
| **T2** | Contract-driven validation, quality reports, lineage stubs, GxP-gated remediation proposals |
| **T3** | Golden eval set, keyword/tool groundedness scores, versioned prompts, nightly job stub |

## Databricks next steps

1. Run `metadata/ddl.sql` in your workspace (creates catalogs, schemas, **Volumes**, metadata tables).
2. Sync contracts into `clinical_supply.metadata.table_contracts`.
3. Land source files in `/Volumes/clinical_supply/bronze/landing/` (not ADLS).
4. Point notebooks at cluster libraries (`pip install -e .`).
5. Deploy `workflows/databricks.yml` with Databricks Asset Bundles.
6. Replace local engine with Spark/Great Expectations runner when ready.