gating-deid-leakage
하는 일
이 스킬은 빌드 파이프라인에 자동 점검을 추가합니다. 비식별화 모델이 식별자를 너무 많이 놓치거나 중요한 식별자를 누출하면 빌드가 실패합니다. 모든 변경을 보류된 합성 환자 정보 세트로 검사하려는 팀을 위한 스킬입니다.
사용하는 경우
- ✓비식별화 재현율이 최저 기준 아래로 떨어지면 빌드를 실패시키는 테스트가 필요할 때.
- ✓개인 식별자가 새는 풀 리퀘스트를 막고 싶을 때.
- ✓CI 파이프라인에서 릴리스 관문을 자동으로 적용하고 싶을 때.
스킬 링크
https://github.com/maziyarpanahi/openmed/blob/master/skills/gating-deid-leakage/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“합성 PHI 세트의 재현율이 99% 아래로 떨어지거나 SSN이 새면 빌드가 실패하도록 CI 파이프라인에 테스트를 추가해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 커밋된 합성 데이터 세트로 평가를 실행하는 테스트를 작성하고, 재현율 최저 기준과 치명적 누출 0건을 확인하며, 둘 중 하나라도 충족되지 않으면 실패 상태를 돌려줍니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Gating De-id Leakage in CI
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.
When to use this skill
- You want a pytest test or CLI step that exits nonzero on de-id regression.
- You need to block PRs that drop PHI recall or introduce a leak.
- You want OpenMed's release gates (
ReleaseGate, G1a–G8) enforced in CI. - You maintain a synthetic held-out PHI set and want it checked automatically.
For the full gate semantics see evaluating-with-leakage-gates; this skill is
about wiring it into CI so it fails the build.
Quick start — a pytest gate
# 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.
Quick start — a CLI gate
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.
Wire it into GitHub Actions
# .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.
Workflow
- 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. - Pick the floor from policy. Don't hardcode a magic number you invented —
align to the gate's published floors (
G1A_V16_RECALL_FLOORetc. inopenmed.eval.release_gates) and the active policy profile. - Run the suite → gate the report (pytest fixture above).
- Assert two invariants:
critical_leakage_count == 0and per-label recall ≥ floor. Optionally assertdecision == RELEASABLEfor the full G1a–G8 check. - Make it required. Mark the job a required status check so a red gate blocks merge — a passing-but-not-required gate protects nothing.
- On failure, the harness CLI can open/refresh a tracking issue
(
--issue-on-failure) so the regression is visible, not silently retried.
Hand-off to / from OpenMed
- From
evaluating-with-leakage-gates: this skill is the CI wrapper around the sameReleaseGate.evaluate(...)call — reuse its gate semantics. - From
building-gold-corpus: supplies the synthetic held-out fixtures the gate runs against. - To
authoring-model-cards: a green gate'sGateReportis the
자주 묻는 질문
실제 환자 데이터를 쓰나요?
아니요. 점검은 커밋된 합성 보류(held-out) 세트를 사용합니다.
평가 스킬과 같은 것인가요?
아닙니다. 평가 스킬은 관문을 설명하고, 이 스킬은 빌드가 실패하도록 CI에 연결합니다.
어떤 CI 시스템에 맞나요?
pytest 테스트와 GitHub Actions를 포함한 명령줄 단계를 다룹니다.
상세 정보
작성자의 원본 설명
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\",
repo: maziyarpanahi/openmed
인기도
- GitHub 스타
- 5.8k
- 순위
- #14705
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
annotating-variants
5.8k에이전트가 유전 변이의 효과를 예측하고, HGVS 이름을 게놈 위치로 바꾸고, 무료 공개 주석 도구를 사용해 인구 빈도를 붙이도록 돕습니다.
ask-openmed
5.8k에이전트가 임상 텍스트 요청에 맞는 OpenMed 워크플로를 고르도록 돕되, 환자 데이터가 있을 수 있으면 먼저 개인 정보 확인을 거치게 합니다.
assembling-fhir-bundles
5.8k여러 FHIR 건강 기록을 EHR로 보낼 수 있도록 하나의 트랜잭션 Bundle로 묶고, 내부 참조를 올바르게 연결하도록 에이전트를 돕습니다.
auditing-deid-leakage
5.8k비식별화된 임상 텍스트에 남은 SSN, 카드 번호, 이메일, 날짜 같은 식별자를 검사하고, 남은 것이 있으면 공개를 막도록 돕습니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.