auditing-deid-leakage
하는 일
이 스킬은 이미 비식별화된 임상 텍스트를 다시 확인해서 놓친 식별자를 찾습니다. 데이터 세트를 공유하기 전에 개인 정보가 남아 있지 않다는 것을 증명해야 하는 팀을 위한 스킬입니다.
사용하는 경우
- ✓비식별화된 노트가 공유, 내보내기, 공개처럼 신뢰 경계를 넘기 직전일 때.
- ✓개인 식별자가 남아 있지 않다는 증거나 데이터 세트의 공개 관문이 필요할 때.
- ✓비식별화를 수행한 모델과 독립적인 확인을 원할 때.
스킬 링크
https://github.com/maziyarpanahi/openmed/blob/master/skills/auditing-deid-leakage/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 임상 노트를 비식별화했습니다. 비식별화된 결과에서 남은 식별자를 검사하고, 발견되면 공개를 막아 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 비식별화된 텍스트에 패턴 및 체크섬 탐지기를 실행하고 두 번째 모델 검사도 추가합니다. 식별자가 하나라도 남으면 실패하는 누출 보고서를 만듭니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Auditing de-id leakage
De-identification is verified, not assumed. A model-driven redaction can miss a structured identifier (an SSN typo'd with spaces, an account number in a footer, a date in an odd format) — and a single residual identifier defeats the whole release. This skill is the adversarial second pass: scan the output of de-identification for anything that still looks like an identifier, score it, and block release on any leak. It is the verification half of OpenMed's leakage-first ethos — gate on leakage, not on F1.
When to use
- Right after
deidentifying-clinical-text, before the de-identified text leaves a trust boundary (export, share, train, publish). - When the user wants proof that "no PHI leaked," a release gate, or a CI check that fails the build if any identifier survives.
- As a belt-and-suspenders detector independent of the model that produced the redaction — a deterministic checker catches different failures than the NER.
Run this on the de-identified text, not the original. The original is expected to be full of identifiers.
Quick start
Two complementary passes — a deterministic structural scan plus a model second-pass diff:
import re
import openmed
# Synthetic — the de-identified OUTPUT we are auditing for residual leaks.
deid_text = "Patient [NAME] seen on [DATE]. Backup contact 415-555-0184; acct 4111111111111111."
def luhn_ok(digits: str) -> bool:
nums = [int(d) for d in digits]
nums[-2::-2] = [(2 * d - 9 if 2 * d > 9 else 2 * d) for d in nums[-2::-2]]
return sum(nums) % 10 == 0
DETECTORS = {
"SSN": (r"\b\d{3}-\d{2}-\d{4}\b", "critical", None),
"EMAIL": (r"\b[\w.+-]+@[\w-]+\.[\w.-]+\b", "high", None),
"PHONE": (r"\b(?:\+?1[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}\b", "high", None),
"DATE": (r"\b\d{1,2}[/-]\d{1,2}[/-]\d{2,4}\b", "medium", None),
"MRN": (r"\bMRN[:#\s]*\d{5,}\b", "high", None),
"CARD": (r"\b(?:\d[ -]?){13,19}\b", "critical", luhn_ok), # checksum-gated
}
findings = []
for label, (pattern, severity, checksum) in DETECTORS.items():
for m in re.finditer(pattern, deid_text, flags=re.IGNORECASE):
token = m.group()
if checksum and not checksum(re.sub(r"\D", "", token)):
continue # fails Luhn -> not a real card number, skip
findings.append({"label": label, "severity": severity,
"start": m.start(), "end": m.end()}) # offsets, not text
# Second-pass model detector: re-run PII extraction on the de-id output.
residual = openmed.extract_pii(deid_text) # PredictionResult
for ent in residual.entities:
findings.append({"label": ent.label, "severity": "high",
"start": ent.start, "end": ent.end})
leaked = bool(findings)
print({"leak": leaked, "count": len(findings)}) # report carries NO plaintext
assert not leaked, "Release BLOCKED: residual identifiers detected."
Note what the report records: labels, severities, and offsets — never the leaked plaintext. Echoing the leaked identifier into a report or log re-creates the exact PHI exposure you are auditing for.
Workflow
- Run deterministic format + checksum detectors on the de-identified text: SSN, email, phone, dates, MRN/account/ID patterns, and card numbers gated by the Luhn checksum so random 16-digit strings don't false-positive. These catch structured identifiers a model may skip.
- Add an entropy heuristic for high-randomness tokens (long base36/base64 strings, hex blobs) that match no known format but look like keys, tokens, or record locators. Flag for review rather than auto-block; entropy is noisy.
- Run a model second-pass: re-run
openmed.extract_piion the output and treat any returned entity as a residual leak. Because it's a different detector than the one that did the redaction, it catches different misses. - Score severity. critical (SSN, card, full DOB+name co-occurrence) > high (email, phone, MRN, names) > medium (partial dates) > low (entropy-only).
- Block on any leak. The gate is binary for release: if
findingsis non-empty at high/critical, fail the export. Surface a no-PHI report (counts + offsets + severities) so a reviewer can locate and re-redact.
Hand-off to / from OpenMed
- From
deidentifying-clinical-text: this skill consumesresult.deidentified_text. Never auditresult.original_text. - OpenMed second-pass detector: `
자주 묻는 질문
원본 노트에서 실행해야 하나요?
아니요. 원본에는 식별자가 있을 것으로 예상되므로, 비식별화된 결과에서 실행해야 합니다.
어떤 종류의 식별자를 잡아내나요?
SSN, Luhn 검사를 거친 카드 번호, 이메일, 진료기록번호 패턴 같은 구조화된 식별자를 확인합니다.
비식별화를 대신하나요?
아니요. 비식별화 실행 결과를 검증하는 것이므로, 두 번째 검사 역할을 합니다.
상세 정보
작성자의 원본 설명
Adversarially scan already-de-identified clinical text for residual identifiers and emit a leakage report that blocks release on any hit. Use after OpenMed de-identification when the user asks to verify a redaction, prove no PHI/PII leaked, gate a dataset before sharing, or run a second-pass detector. Covers format and checksum detectors (SSN, Luhn for card numbers, MRN/account patterns, emails, phones, dates), entropy heuristics for high-randomness tokens, severity scoring, and a hard block-on-leak rule. This is the verification half of OpenMed's leakage-first ethos. Hand-off: re-run openmed.
repo: maziyarpanahi/openmed
인기도
- GitHub 스타
- 5.8k
- 순위
- #14668
- 라이선스
- 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-deidentification-runs
5.8k비식별화 실행마다 무엇을 가렸고 왜 가렸는지 보여 주는 서명된 재현 가능한 기록을 만들며, 기록 안에는 환자 데이터가 없습니다.