Skip to main content
Glama
kyb8801

MetroAI β€” KOLAS Compliance OS

by kyb8801
README.md
# πŸ“ MetroAI β€” KOLAS Compliance OS + Inverse Metrology Engine

> **Measurement uncertainty MCP server + 6 AI agents + verifiable audit trail + uncertainty-aware ML inverse metrology (11 instruments).**
> ISO/IEC 17025 + KOLAS-accredited laboratories.

[![CI](https://github.com/kyb8801/metroai/actions/workflows/tests.yml/badge.svg)](https://github.com/kyb8801/metroai/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org)
[![Version](https://img.shields.io/badge/version-v0.8.0-1E40AF)](https://github.com/kyb8801/metroai/releases)
[![Tests](https://img.shields.io/badge/tests-243%20passing-10B981)](https://github.com/kyb8801/metroai/actions)
[![Demo](https://img.shields.io/badge/Demo-Streamlit%20(sleeps%20when%20idle)-FF4B4B)](https://metroai-gnbdv7pqq3quqsudb5pwvj.streamlit.app)
[![Awesome MCP](https://img.shields.io/badge/Awesome%20MCP-PR%20%236980%20in%20review-orange)](https://github.com/punkpeye/awesome-mcp-servers/pull/6980)
[![MCPize](https://img.shields.io/badge/MCPize-live-06B6D4)](https://mcpize.com/mcp/measurement-uncertainty)
[![Glama Maintenance](https://img.shields.io/badge/Glama%20Maintenance-B-06B6D4)](https://glama.ai/mcp/servers/kyb8801/metroai)

---

> **πŸ‡°πŸ‡· ν•œκ΅­μ–΄ μš”μ•½** β€” MetroAIλŠ” ν•œκ΅­ KOLAS 인정기관(1,200+)의 μ‹œν—˜Β·κ΅μ •Β·ν‘œμ€€λ¬Όμ§ˆ 업무λ₯Ό μœ„ν•œ
> **AI μ»΄ν”ŒλΌμ΄μ–ΈμŠ€ OS + μΈ‘μ •λΆˆν™•λ„ MCP μ„œλ²„**μž…λ‹ˆλ‹€. GUM/MCM λΆˆν™•λ„ μ—”μ§„, 6μ’… AI μ—μ΄μ „νŠΈ,
> Ed25519+PROV-O 검증가λŠ₯ 감사좔적, 역계츑 μ—”μ§„(11개 μž₯λΉ„)을 μ œκ³΅ν•˜λ©°, μžλ™ν™” ν…ŒμŠ€νŠΈ 243건과
> [정직성 κ·œμΉ™](docs/HONESTY_NOTES.md)Β·[Trustworthy AI μ •μ±…](docs/TRUSTWORTHY_AI.md)으둜 AI μ‚°μΆœλ¬Όμ˜ 신뒰성을 κ΄€λ¦¬ν•©λ‹ˆλ‹€.
> 상세 ν•œκ΅­μ–΄ μ•ˆλ‚΄λŠ” [μ•„λž˜ μ„Ήμ…˜](#ν•œκ΅­μ–΄-μ‚¬μš©μžλ₯Ό-μœ„ν•œ-μ•ˆλ‚΄) μ°Έκ³ .

## What is this?

A **compliance operating system** for Korea's 1,200+ KOLAS-accredited testing,
calibration, RMP, and inspection institutions β€” and a **measurement
uncertainty MCP server** that any MCP-compatible AI client (Claude Desktop,
Cursor, VS Code, etc.) can call directly.

As of v0.8.0 it also ships an **inverse metrology engine** (`metroai.inverse`):
where the calibration templates compute uncertainty *forward* (inputs β†’ U),
the inverse engine recovers a **parameter and its uncertainty from a measured
signal** (spectrum / image / diffraction) across 11 instruments, all sharing
one GUM core and one ML-uncertainty core.

Built solo by **Youngbum Kim** (Ph.D.) β€” a practitioner from a KOLAS-accredited ISO 17034
reference-material producer who supported accreditation audits and got
tired of redoing everything in Excel and email every quarter.

---

## Quickstart β€” 30 seconds

### As an MCP server (Claude Desktop, Cursor, etc.)

```bash
claude mcp add --transport http measurement-uncertainty \
  https://measurement-uncertainty.mcpize.run
```

β†’ then ask your AI: *"Compute the GUM uncertainty for this voltage divider"*
or *"Apply the TEM lattice template at 95% confidence"*.

### As a web app (Streamlit)

```bash
pip install -e ".[dev,ml]"
streamlit run app.py
```

Live demo: [metroai-gnbdv7pqq3quqsudb5pwvj.streamlit.app](https://metroai-gnbdv7pqq3quqsudb5pwvj.streamlit.app) β€” hosted on Streamlit Community Cloud, which puts the app to sleep after inactivity; the first visit may ask for a one-click wake-up and take about a minute. A Hugging Face Spaces migration is planned (Roadmap P2). Or run locally with the two commands above.

### As a Python library

```bash
pip install git+https://github.com/kyb8801/metroai.git
```

```python
from metroai.templates import create_tem_lattice_calculator

calc = create_tem_lattice_calculator()
result = calc.calculate()
print(f"d = {result.measurand_value:.6f} nm "
      f"Β± {result.expanded_uncertainty:.4e} (k={result.coverage_factor:.2f})")
```

### Inverse engine (NEW in v0.8.0)

```python
from metroai.inverse import uncertainty, ml_inverse, INSTRUMENTS

# unified GUM budget β€” every instrument calls this
uc, rows = uncertainty.budget([("scan_calib", 1, 0.0016), ("noise", 1, 0.0001)])
print(uc, uncertainty.expand(uc, k=2))           # u_c, U(k=2)

# ML inverse + ML uncertainty (instruments that have a forward library)
mdl = ml_inverse.MLInverse().fit(X_train, y_train)
out = mdl.predict(X_query)                        # pred + epistemic std + conformal half-width
```

---

## What MetroAI does

### 0. User-fit features (NEW in v0.7.0) β€” for KOLAS lab operators

After surveying the SEM-lab-operator journey end-to-end, four new features
landed in v0.7.0 specifically to cover the **applicant** side of the
accreditation workflow:

- **πŸ”¬ Domain-specific entry wizard** β€” Landing page asks "Which instrument are
  you accrediting?" Five paths: SEM / TEM / AFM / OCD / general measurement.
  Each one routes to a domain dashboard with only the standards, KOLAS steps,
  uncertainty templates, and SOP checks that matter for that domain.
- **πŸ“š Domain-specific KOLAS guides** β€” Per-domain content: applicable ISO
  standards (4–6 per domain), six-step KOLAS accreditation process with
  typical pitfalls, 3–4 common nonconformities with root cause + MetroAI fix,
  and the typical uncertainty budget components. Content sourced from public
  ISO/SEMI/KOLAS-G-002 documents.
- **πŸ“ KOLAS application form auto-generator** β€” Fill an organization profile
  once β†’ ReportLab generates a 7-section ISO/IEC 17025-style accreditation
  application PDF (organization info, scope, personnel, equipment, reference
  standards, environmental control, quality system). Generic template; final
  submission should be cross-checked against KAB's latest official form.
- **πŸ“‹ Domain SOP rule-based checklist** β€” Each domain ships with a 10-item
  SOP checklist derived from KOLAS-evaluator-perspective common findings.
  Real-time gap score and 1-click "add to orchestrator queue" for remediation.

End-to-end, the v0.7.0 changes raised our internal "lab-operator journey
fit score" from **45% β†’ 68%** on a 7-stage scenario (entry β†’ guide β†’ form β†’
KOLAS process β†’ SOP check β†’ simulation β†’ end-to-end). The final 32% includes
stages we can't automate ourselves (the "consulting + on-site evaluator
hand-holding" piece of the journey).

### 1. Compliance OS β€” 6 AI agents (since v0.6.0)

![6-agent architecture](docs/figure_6_agents_architecture.svg)

| Agent | Role | Data source |
|---|---|---|
| `semi-intel` | Semiconductor industry signals | DART (Korea FSS) + NTIS R&D feeds |
| `job-scout` | Personnel turnover signal | Public job postings (baseline stub) |
| `kolas-monitor` | KOLAS / KAB / KTR notice scan | knab.go.kr live fetch (with stub fallback) |
| `kolas-audit-predictor` | Next-audit risk prediction | Rule baseline + optional GBT model |
| `orchestrator` | Integrated P0/P1/P2 task queue | All other agents |
| `schedule` | Calibration / audit / review calendar | Internal events DB |

**Every agent output carries `is_live` / `data_origin` flags** (live Β· stub Β·
synthetic), so the UI can clearly distinguish authoritative data from
heuristics.

### 2. Measurement uncertainty engine (since v0.5.0)

- **GUM** (ISO/IEC Guide 98-3) β€” symbolic partial derivatives, Welch–Satterthwaite, expanded U
- **MCM** (ISO/IEC Guide 98-3 Suppl. 1) β€” Monte Carlo with configurable n
- **QMC** β€” Sobol low-discrepancy sequence (verified Β±0.003% agreement with GUM analytic on simple linear models)
- **`reverse_uncertainty`** β€” *novel within prior-art search.* Given a target combined U, compute the maximum allowed standard uncertainty per component. Not found in GUM Workbench, NIST Uncertainty Machine, or major open-source GUM tools as of 2026-05.

### 3. Nine calibration templates

| Template | Domain | Standard |
|---|---|---|
| `gauge_block` | Length | KOLAS-G-002 |
| `mass` | Mass (weights) | OIML R 111 |
| `temperature` | Temperature (PRT) | ITS-90 |
| `pressure` | Pressure | KOLAS-G-002 |
| `dc_voltage` | DC voltage | KOLAS-G-002 |
| `tem_lattice` (v0.6 new) | TEM d-spacing | Si CRM reference |
| `sem_eds` (v0.6 new) | SEM-EDS quantitative | ZAF, ISO 22489 |
| `afm_roughness` (v0.6 new) | AFM surface roughness Sa/Sq | ISO 25178-2 |
| `ocd_scatterometry` (v0.6 new) | OCD CD measurement | RCWA, SEMI MF-1789 |

### 4. Verifiable audit trail (NEW in v0.6.0)

- **Ed25519** digital signatures (RFC 8032) β€” tamper-evident outputs
- **W3C PROV-O** provenance graphs (JSON-LD) β€” full input β†’ model β†’ output lineage
- Designed so a KOLAS auditor can verify no post-hoc tampering

### 5. Three MCP tools

| Tool | Use case |
|---|---|
| `calculate_uncertainty` | GUM calculation across the 9 templates |
| `pt_analysis` | Proficiency Testing β€” z-score / En / zeta per ISO 13528 + 17043 |
| `reverse_uncertainty` | Target-U β†’ per-component limit allocation |

### 6. Inverse metrology engine (NEW in v0.8.0) β€” `metroai.inverse`

The calibration templates (Β§3) run *forward*: given inputs, compute the
uncertainty. The **inverse engine** runs the harder direction β€” **given a
measured signal (spectrum / image / diffraction), recover the parameter AND
its uncertainty** β€” across 11 instruments, all calling **two shared cores** so
uncertainty and "AI" are consistent instead of ad-hoc per module.

**Two shared cores**

| Core | File | Role | Verified (sandbox) |
|---|---|---|---|
| β‘  Unified GUM | `inverse/uncertainty.py` | `combine_gum` Β· `expand` Β· `monte_carlo` Β· `budget` Β· `sensitivity_fd` | block-gauge u_c = 0.0594 mm, U(k=2) = 0.1189; MC cross-check 0.0595 (match) |
| β‘‘β‘’ ML inverse + ML uncertainty | `inverse/ml_inverse.py` | RandomForest ensemble (epistemic std) + conformal (distribution-free) + `combine_with_gum` | conformal 90% target β†’ 89% empirical coverage |

**11 instrument modules** (each calls the cores; ⟢ = ML hookup pending)

| Instrument | Method | Uncertainty | AI | Grade | Data |
|---|---|:---:|:---:|:---:|---|
| OCD scatterometry | RCWA (Meent) + library | βœ… GUM | βœ… KNN/GPR + conformal | β˜…β˜…β˜… | NIST L100P300 (real) |
| PL / exciton | peak fit | βœ… curve_fit | peak fit | β˜…β˜…β˜… | PhD Valley data (real) |
| XRR | Parratt/AbelΓ¨s (refnx) | βœ… covariance | ⟢ | β˜…β˜… | synthetic |
| TEM lattice | windowed FFT + subpixel | βœ… GUM budget | ⟢ | β˜…β˜… | HRTEM |
| TEM strain | Geometric Phase Analysis | βœ… | ⟢ | β˜…β˜… | GPA |
| SEM CD | threshold + PSF | βœ… | ⟢ | β˜…β˜… | synthetic |
| AFM roughness | ISO 25178 Sa/Sq/Sz | βœ… GUM budget | ⟢ | β˜…β˜… | real .spm |
| NSOM | hyperspectral + k-means | βœ… GUM budget | βœ… k-means | β˜…β˜… | PhD ipynb |
| Lamb acoustic | breathing-mode fβ‚€ + 4D | βœ… GUM budget | βœ… Mahalanobis | β˜…β˜… | public physics only* |
| Raman | Lorentzian quant | βœ… curve_fit | ⟢ | β˜…β˜… | synthetic |

\* The Lamb/acoustic module codes **only public physics** (e.g. Saviot & Murray
2009 breathing-mode relation); the inventive specifics live in a patent under
KIPO review, not in this repo.

**Honest scope** (synthetic β‰  real; the figures are not inflated):

- β˜…β˜…β˜… = real measured data. OCD on NIST L100P300; PL on MoSβ‚‚ A-exciton
  **1.850 Β± 0.001 eV** vs literature 1.85 eV. β˜…β˜… = synthetic or method-verified.
- OCD library inverse: error **< 2 nm** on NIST dies; **naive and differential-
  evolution optimizers fail** on the non-convex landscape (documented in
  `flagship_v0_forward_inverse.py`, not hidden).
- GPR reaches 0.19 nm noise-free but **collapses to ~12.8 nm at 0.5 % noise**
  (an overfit illusion, exposed in `ocd_depth2p5_noise.py`); KNN stays
  3.5–3.8 nm across noise and is the robust choice.
- ML inverse needs a forward library (training data): strong for OCD/synthetic;
  PL and NSOM use peak-fit / clustering **by design** β€” the core picks the
  right tool per instrument rather than forcing a neural net everywhere.
- Inverse modules currently **self-verify via `__main__`**; pytest integration
  into the main CI suite is pending (tracked in the roadmap).

---

## Honest metrics β€” `kolas-audit-predictor`

> **5-fold CV on synthetic data: accuracy 60.6% Β± 3.1pp Β· ROC-AUC 0.628 Β± 0.038
> Β· Brier 0.241 Β· F1 0.636** (n=2000 Γ— 6 features, label noise 0.15)

- GradientBoostingClassifier (n_estimators=200, depth=3, lr=0.05)
- Top 3 feature importances: `months_since_last_audit` (0.34) Β· `personnel_turnover` (0.25) Β· `sop_completeness` (0.24) β€” aligned with domain intuition.
- **External validation on real KOLAS audit outcomes is pending.** Synthetic-data metrics do not imply real-world accuracy.
- A prior sandbox figure of *87.1%* has been **removed from all artifacts**. See [`docs/HONESTY_NOTES.md`](docs/HONESTY_NOTES.md) for citation rules.

---

## Trustworthy AI

MetroAI treats AI-output trust as a first-class engineering problem β€” full policy in
[`docs/TRUSTWORTHY_AI.md`](docs/TRUSTWORTHY_AI.md):

- **Data-origin labels** β€” every dataset and metric tagged real / synthetic / stub
- **Honest metrics** β€” publication rules in [`docs/HONESTY_NOTES.md`](docs/HONESTY_NOTES.md) (see synthetic-data caveats above)
- **Verifiable audit trail** β€” Ed25519 signatures + W3C PROV-O provenance graphs
- **Uncertainty quantification** β€” every inverse-engine estimate ships with its uncertainty

---

## Standards compliance

- ISO/IEC 17025:2017 (testing & calibration laboratories)
- ISO/IEC Guide 98-3 (GUM) + Suppl. 1 (MCM)
- ISO 13528 + ISO 17043 (proficiency testing)
- ISO 18516 (microscope methods)
- ISO 25178-2 (areal surface texture)
- ISO 22489 (SEM-EDS quantitative)
- KOLAS-G-001 / G-002 (Korean accreditation guidelines)
- SEMI MF-1789 (OCD scatterometry)
- W3C PROV-O (audit provenance)
- PTB DCC 3.3.0 + D-SI 2.2.1 (digital calibration certificate β€” experimental `dcc` module)
- RFC 8032 (Ed25519 signatures)

---

## DCC β€” Digital Calibration Certificate (experimental)

`metroai.dcc` is a first-pass (v1) toolkit for the PTB-led **Digital Calibration
Certificate** XML standard (schema 3.3.0, [wiki.dcc.ptb.de](https://wiki.dcc.ptb.de))
in a KOLAS / ISO 17025 context.

What it does today β€” honest scope:

- **`dcc.parser`** β€” reads DCC XML: `administrativeData` (core data, items, lab,
  responsible persons, customer, statements) and `measurementResults` with D-SI
  values (`si:real`, `si:realListXMLList`, `si:hybrid`) and uncertainty in both
  the current `measurementUncertaintyUnivariate` form and the legacy
  `expandedUnc` form. Parsing is verified against an official PTB Good Practice
  example (bundled as a test fixture with its LGPL-3.0 notice retained).
- **`dcc.builder`** β€” turns a MetroAI `GUMResult` + certificate metadata
  (same `cert_info` keys as the KOLAS PDF exporter) into a schema-3.3.0 DCC
  **draft**: all schema-required elements, expanded uncertainty as the
  non-deprecated `expandedMU`, and an optional per-component uncertainty-budget
  table. Builder output validates against the official 3.3.0 XSD (checked with
  `xmlschema` in an optional test). Missing inputs become placeholders and are
  recorded in `DCCBuilder.warnings` β€” a draft with warnings is not a certificate.
- **`dcc.units`** β€” common unit strings β†’ D-SI notation (`"mm"` β†’ `\milli\metre`,
  `"Β°C"` β†’ `\degreecelsius`); unmapped units are kept verbatim with a warning.
- **`metroai/dcc/kolas_map.md`** β€” mapping table: KOLAS / ISO 17025 Β§7.8
  certificate content requirements ↔ DCC 3.3.0 elements, including known gaps.

```python
from metroai.dcc import export_dcc_xml, parse_dcc

xml = export_dcc_xml(result, {"cert_number": "KOLAS-2026-...", "cal_org": "..."})
doc = parse_dcc(xml)          # round-trips: values, units, U, k, p survive
```

**Not implemented yet (roadmap):** XML-DSig signatures (a DCC without a
signature is only a draft), alignment with the PTB `basic_*`/`gp_*` refType
vocabulary, multi-item / before-after adjustment results, attachments
(`byteData`), DCC 3.4 (release candidate as of 2026-07). Optional XSD
validation needs `pip install -e ".[dcc]"` (installs `xmlschema`).

---

## Streamlit app β€” v2-spec pages

**v2 backbone (since v0.6.0):**

1. **🏠 Landing** (`app.py`) β€” KOLAS Compliance OS positioning + domain wizard
2. **πŸ€– 6 Agents Dashboard** (`pages/11`) β€” Quality Manager daily view, KPI strip + task queue
3. **πŸ“‹ SOP Gap Analyzer** (`pages/12`) β€” Technical Manager work surface, AI-detected gaps + **v0.7 domain-specific checklist**
4. **πŸ“° KOLAS Feed** (`pages/13`) β€” kolas-monitor regulatory news
5. **🎯 Audit Risk Detail** (`pages/14`) β€” explainability, waterfall + AI reasoning + what-if
6. **πŸ“… Ops Backbone** (`pages/15`) β€” certificates / personnel / schedule

**v0.7.0 P0 β€” lab-operator journey (NEW):**

7. **πŸ”¬ SEM domain dashboard** (`pages/16`) β€” SEM-EDS standards + KOLAS process + nonconformities + SOP checklist
8. **βš›οΈ TEM domain dashboard** (`pages/17`) β€” lattice constant, ISO 29301 + Cs-corrector spec
9. **πŸ“ AFM domain dashboard** (`pages/18`) β€” surface roughness Sa/Sq/Sz per ISO 25178-2
10. **πŸ“ OCD domain dashboard** (`pages/19`) β€” Scatterometry / RCWA library matching per SEMI MF-1789
11. **πŸ“ KOLAS application form** (`pages/20`) β€” Fill-once β†’ 7-section ISO 17025-style PDF (KAB-F-21 reference)

Plus the legacy v0.5 calibration / PT / certificate pages (`pages/1`–`10`).

---

## Repository layout

```
metroai/
β”œβ”€β”€ app.py                     ← v2-spec landing page (Streamlit entry)
β”œβ”€β”€ pages/                     ← Streamlit multi-page
β”‚   β”œβ”€β”€ 1_πŸ“_λΆˆν™•λ„_계산.py     ← Uncertainty calculator (KR)
β”‚   β”œβ”€β”€ 2_πŸ“Š_PT_뢄석.py         ← PT analysis (KR)
β”‚   β”œβ”€β”€ 3_πŸ“„_κ΅μ •μ„±μ μ„œ.py      ← Calibration certificate PDF
β”‚   β”œβ”€β”€ 4_πŸ”„_λΆˆν™•λ„_역섀계.py    ← Reverse uncertainty (novel)
β”‚   β”œβ”€β”€ 11_πŸ€–_6_Agents.py       ← v2 block 2: main dashboard
β”‚   β”œβ”€β”€ 12_πŸ“‹_SOP_κ°­_뢄석.py     ← v2 block 4: SOP gap analyzer
β”‚   β”œβ”€β”€ 13_πŸ“°_KOLAS_ν”Όλ“œ.py      ← v2 block 5: regulatory feed
β”‚   β”œβ”€β”€ 14_🎯_감사_μœ„ν—˜_상세.py   ← v2 block 3: risk explainability
β”‚   └── 15_πŸ“…_μΈμ¦μ„œ_인λ ₯_일정.py ← v2 block 6: operations
β”œβ”€β”€ metroai/
β”‚   β”œβ”€β”€ core/                  ← GUM / MCM / model parsing
β”‚   β”œβ”€β”€ agents/                ← 6 AI agents backbone
β”‚   β”œβ”€β”€ audit/                 ← Ed25519 + PROV-O
β”‚   β”œβ”€β”€ connectors/            ← KOLAS / DART / NTIS live fetch + stub fallback
β”‚   β”œβ”€β”€ math/                  ← Sobol QMC
β”‚   β”œβ”€β”€ ml/                    ← GBT audit-risk model + synthetic data
β”‚   β”œβ”€β”€ templates/             ← 9 calibration templates
β”‚   β”œβ”€β”€ dcc/                   ← NEW v0.8.x: DCC (digital calibration
β”‚   β”‚                              certificate) parser/builder β€” experimental
β”‚   β”œβ”€β”€ inverse/               ← NEW v0.8.0: uncertainty-aware ML inverse metrology
β”‚   β”‚   β”œβ”€β”€ __init__.py        ←   package: cores + INSTRUMENTS map (11)
β”‚   β”‚   β”œβ”€β”€ uncertainty.py     ←   β‘  unified GUM core
β”‚   β”‚   β”œβ”€β”€ ml_inverse.py      ←   β‘‘β‘’ ML inverse + ML uncertainty core
β”‚   β”‚   β”œβ”€β”€ metrology_module_2..10_*.py ← 9 instrument modules
β”‚   β”‚   β”‚                           (XRR/TEM lattice/Raman/TEM strain/SEM/AFM/PL/NSOM/Lamb)
β”‚   β”‚   β”œβ”€β”€ flagship_v0_forward_inverse.py ← OCD forward+library inverse (R+T=1, err<2nm)
β”‚   β”‚   β”œβ”€β”€ flagship_v1_autodiff_gpu.py    ← OCD autodiff inverse (Meent torch)
β”‚   β”‚   β”œβ”€β”€ ocd_depth1..2p6_*.py  ←   OCD accuracy / GPR / noise-robustness deep-dive
β”‚   β”‚   β”œβ”€β”€ nist_real_data_inverse.py ← NIST L100P300 real-die inverse
β”‚   β”‚   └── PLATFORM_INDEX.md   ←   inverse engine map + honest status
β”‚   β”œβ”€β”€ schemas.py             ← Pydantic v2 input validation
β”‚   β”œβ”€β”€ exceptions.py          ← MetroAIError hierarchy
β”‚   └── mcp_server.py          ← MCP stdio server
β”œβ”€β”€ tests/                     ← 243 unit tests (pytest)
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ HONESTY_NOTES.md       ← Citation rules
β”‚   β”œβ”€β”€ TRUSTWORTHY_AI.md      ← Trust & governance policy
β”‚   β”œβ”€β”€ v0.7.0_ROADMAP.md      ← Next 3 months
β”‚   └── RELEASE_NOTES_v0.6.0.md
β”œβ”€β”€ mcp_manifest.json          ← MCPize manifest (v0.6.0)
└── pyproject.toml
```

---

## Roadmap (v0.7.0 β†’ v0.8.0 β€” 2026-05 β†’ 2026-08)

Reordered 5/19 around the lab-operator journey (after a virtual-user audit
revealed v0.6.0 covered only 45% of the path-to-accreditation). Philosophy
shifted from **outbound-first β†’ user-fit-first**.

| Priority | Item | Status | Goal |
|---|---|---|---|
| **P0** | Domain-specific entry wizard (SEM/TEM/AFM/OCD/general) | βœ… shipped v0.7.0 | Stage 1 of journey |
| **P0** | Domain-specific KOLAS guides | βœ… shipped v0.7.0 | Stage 2, 4 |
| **P0** | KOLAS application form auto-generator | βœ… shipped v0.7.0 | Stage 3 |
| **P0** | Domain SOP rule-based checklist | βœ… shipped v0.7.0 | Stage 5 |
| **P0** | Inverse engine: 2 shared cores (GUM + ML uncertainty) + 11 instrument modules | βœ… shipped v0.8.0 | Forward U β†’ inverse param+U |
| P1 | Inverse engine: real-data benchmark expansion (XRR / TEM / AFM measured) + pytest in CI | in progress | Lift β˜…β˜… β†’ β˜…β˜…β˜… |
| P1 | Real KOLAS audit data + GBT retrain | pending | Replace synthetic 60.6% |
| P2 | HF Spaces migration | planned | Eliminate Streamlit Cloud sleep |
| P3 | Consulting SOP guide (per-domain on-site eval prep) | needs author | Cover stage 7 partially |
| P3 | LLM-assisted kolas-monitor (real inference) | stub now | Clear AI differentiation |

See [`docs/v0.7.0_ROADMAP.md`](docs/v0.7.0_ROADMAP.md) for the full plan.

---

## Tech stack

- **Python 3.10+** (tested on 3.10 / 3.11 / 3.12)
- Streamlit (web UI)
- sympy / numpy / scipy (numerical)
- Pydantic v2 (input validation)
- cryptography (Ed25519)
- scikit-learn (GBT model + inverse ML cores, optional `[ml]` extra)
- refnx / meent (XRR / OCD inverse, optional)
- reportlab + openpyxl (PDF + Excel export)
- altair / plotly (visualizations)

---

## Tests

```bash
pip install -e ".[dev,ml]"
pytest tests/ -v
```

Latest CI on Python 3.10 / 3.11 / 3.12 β€” **243 passing tests** across
the v0.5 β†’ v0.8 suites (+1 optional DCC XSD-validation test that runs only
when `xmlschema` and a local copy of the official schema are present). Inverse modules (`metroai/inverse/`) currently
self-verify via their `__main__` blocks; folding them into the pytest CI suite
is a P1 roadmap item.

---

## License

MIT License. See [LICENSE](LICENSE).

---

## Community

- **GitHub Issues** β€” bug reports, feature requests
- **GitHub Discussions** β€” Q&A, design discussion
- **MCPize page** β€” install + reviews: [mcpize.com/mcp/measurement-uncertainty](https://mcpize.com/mcp/measurement-uncertainty)
- **Glama listing** β€” [glama.ai/mcp/servers?query=metroai](https://glama.ai/mcp/servers?query=metroai)
- **Email** β€” kyb8801@gmail.com (KOLAS-side feedback especially welcome)

---

## ν•œκ΅­μ–΄ μ‚¬μš©μžλ₯Ό μœ„ν•œ μ•ˆλ‚΄

λ³Έ ν”„λ‘œμ νŠΈλŠ” ν•œκ΅­ KOLAS 인정 κΈ°κ΄€ μ‹€λ¬΄μžκ°€ 직접 μ‚¬μš©ν•  수 μžˆλ„λ‘ ν•œκ΅­μ–΄ νŽ˜μ΄μ§€μ™€
ν•œκ΅­μ–΄ UI λ₯Ό μ§€μ›ν•©λ‹ˆλ‹€. μžμ„Έν•œ ν•œκ΅­μ–΄ κ°€μ΄λ“œλŠ” [`docs/RELEASE_NOTES_v0.6.0.md`](docs/RELEASE_NOTES_v0.6.0.md)
및 Streamlit μ•±μ˜ ν•œκ΅­μ–΄ νŽ˜μ΄μ§€λ“€ (λΆˆν™•λ„ 계산 / PT 뢄석 / κ΅μ •μ„±μ μ„œ / λΆˆν™•λ„ 역섀계
/ KOLAS λ‘œλ“œλ§΅ / 6 Agents λŒ€μ‹œλ³΄λ“œ / SOP κ°­ 뢄석 / KOLAS ν”Όλ“œ / 감사 μœ„ν—˜ 상세 /
운영 λ°±λ³Έ) 을 μ°Έκ³ ν•΄μ£Όμ„Έμš”. cold-feedback ν™˜μ˜ν•©λ‹ˆλ‹€ β€” `kyb8801@gmail.com`.

v0.8.0 λΆ€ν„°λŠ” **역계츑 μ—”μ§„**(`metroai.inverse`)이 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€ β€” μΈ‘μ • μ‹ ν˜Έ(μŠ€νŽ™νŠΈλŸΌΒ·
μ΄λ―Έμ§€Β·νšŒμ ˆ)λ‘œλΆ€ν„° νŒŒλΌλ―Έν„°μ™€ κ·Έ λΆˆν™•λ„λ₯Ό λ™μ‹œμ— λ³΅μ›ν•˜λ©°, 11개 μž₯λΉ„κ°€ 곡용 GUM 코어와
ML-λΆˆν™•λ„ μ½”μ–΄λ₯Ό ν•¨κ»˜ ν˜ΈμΆœν•©λ‹ˆλ‹€. ν•©μ„±Β·μ‹€μΈ‘ λ“±κΈ‰(β˜…)κ³Ό ν•œκ³„(GPR λ…Έμ΄μ¦ˆ λΆ•κ΄΄, ML 적용
λ²”μœ„)λ₯Ό README 에 μ •μ§ν•˜κ²Œ ν‘œκΈ°ν–ˆμŠ΅λ‹ˆλ‹€.

---

> Built with care by [@kyb8801](https://github.com/kyb8801) Β· KOLAS RMP operations background.