annotating-variants
Annotates VCF variants and normalizes HGVS nomenclature with public, license-free annotators…
Add a CI gate that fails the build when an OpenMed de-identification model's recall on a held-out PHI set drops below threshold or any critical identifier leaks. Use when the user wants a pytest test or CLI step that exits nonzero on de-id regression, wants to wire OpenMed's
$ npx -y skills add maziyarpanahi/openmed --skill gating-deid-leakage --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/gating-deid-leakageContext preview
The summary Claude sees to decide when to auto-load this skill.
Add a CI gate that fails the build when an OpenMed de-identification model's recall on a held-out PHI set drops below threshold or any critical identifier leaks. Use when the user wants a pytest test or CLI step that exits nonzero on de-id regression, wants to wire OpenMed's
name: gating-deid-leakage description: "Add a CI gate that fails the build when an OpenMed de-identification model's recall on a held-out PHI set drops below threshold or any critical identifier leaks. Use when the user wants a pytest test or CLI step that exits nonzero on de-id regression, wants to wire OpenMed's leakage-first release gates into GitHub Actions / CI, needs a recall floor plus zero-leakage assertion against a synthetic held-out set, or wants to block merges that weaken de-identification. Trigger on \"CI gate\", \"fail the build\", \"regression test\", \"de-id recall threshold\", \"block the merge\", \"exit nonzero\", or \"leakage check in CI\" for OpenMed." license: Apache-2.0 metadata: project: OpenMed category: evaluation-quality pairs: adjacent version: "1.0"
Logs, baselines, and models drift. The only durable defense is a gate that runs on every change and **fails closed** when de-identification regresses. This skill operationalizes OpenMed's leakage-first ethos into a CI check: recall must stay above the floor and **critical leakage must be exactly zero**, or the build goes red.
For the full gate semantics see `evaluating-with-leakage-gates`; this skill is about *wiring it into CI so it fails the build*.
# tests/eval/test_deid_leakage_gate.py
import pytest
from openmed.eval import run_suite, ReleaseGate, RELEASABLE
RECALL_FLOOR = 0.99 # direct-identifier recall floor
HELD_OUT = "eval/heldout/phi_synthetic.json" # SYNTHETIC, committed
@pytest.fixture(scope="module")
def gate_report():
report = run_suite(
HELD_OUT,
suite="golden",
model_name="OpenMed/Privacy-PII-Detection",
device="cpu",
metadata={"family": "PII", "tier": "base", "policy": "hipaa_safe_harbor"},
)
return ReleaseGate(milestone="v1.6", policy="hipaa_safe_harbor").evaluate(report)
def test_no_critical_leakage(gate_report):
# Hard zero: one leaked SSN/credit-card is a breach, full stop.
assert gate_report.critical_leakage_count == 0, "critical PHI leaked"
def test_recall_floor(gate_report):
low = {
label: r
for label, r in gate_report.per_label_recall.items()
if r < RECALL_FLOOR
}
assert not low, f"recall below floor: {low}"
def test_releasable(gate_report):
# The structural decision: any failed gate -> QUARANTINED -> red build.
failed = [c.gate for c in gate_report.gate_results if not c.passed]
assert gate_report.decision == RELEASABLE, f"quarantined; failed gates: {failed}"`pytest` exits nonzero on any failure, so CI turns red automatically.
The harness ships a `main()` that **fails closed** (exit 1 on quarantine):
# Produce a candidate report, then gate it. Nonzero exit blocks the job. python -m openmed.eval.release_gates \ --candidate eval/out/candidate_report.json \ --baseline-store eval/baselines/last_green.json \ --milestone v1.6 --policy hipaa_safe_harbor \ --output release-gate-report.json
Exit codes: `0` RELEASABLE, `1` QUARANTINED, `2` evaluation error before a report. CI should treat `1` and `2` as failures.
# .github/workflows/deid-gate.yml
name: de-id leakage gate
on: [pull_request]
jobs:
gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv pip install --system -e ".[hf]"
- name: Run de-id leakage gate
run: uv run pytest tests/eval/test_deid_leakage_gate.py -q
# The job fails (red) automatically if pytest exits nonzero.1. **Curate a synthetic held-out PHI set** and commit it (offsets + labels, no real patient text). Use `building-gold-corpus`. It must be disjoint from any calibration/training data. 2. **Pick the floor from policy.** Don't hardcode a magic number you invented — align to the gate's published floors (`G1A_V16_RECALL_FLOOR` etc. in `openmed.eval.release_gates`) and the active policy profile. 3. **Run the suite → gate the report** (pytest fixture above). 4. **Assert two invariants**: `critical_leakage_count == 0` and per-label recall ≥ floor. Optionally assert `decision == RELEASABLE` for the full G1a–G8 check. 5. **Make it required.** Mark the job a required status check so a red gate blocks merge — a passing-but-not-required gate protects nothing. 6. **On failure, the harness CLI can open/refresh a tracking issue** (`--issue-on-failure`) so the regression is visible, not silently retried.
the same `ReleaseGate.evaluate(...)` call — reuse its gate semantics.
gate runs against.
model card cites under "evaluation".
leak; the logging guard proves your *runtime* doesn't leak.
errors, treat it as a failure. Don't `|| true` the step.
the load-bearing assertions; assert them explicitly even if you also check `decision`.
training, the gate measures memorization, not generalization. Keep splits disjoint
Local-first healthcare AI: clinical NER and HIPAA PII de-identification on hardware you control. 2,200+ medical models, 35 model-backed PII languages, and Python, MLX, Android and browser runtimes. Apache-2.0 SDK.
Repo: maziyarpanahi/openmed
Annotates VCF variants and normalizes HGVS nomenclature with public, license-free annotators…
Choose the first OpenMed workflow skill for an intake, privacy, extraction, exchange, or…
Package multiple FHIR R4 resources produced from OpenMed output into a single valid…
Adversarially scan already-de-identified clinical text for residual identifiers and emit a…
Produce a signed, reproducible, no-PHI audit trail for an OpenMed de-identification run via…
Generates and verifies 21 CFR Part 11-style audit trails — who/what/when, electronic…