auditing-deid-leakage
Skill này làm gì
Skill này là lần kiểm tra thứ hai cho văn bản lâm sàng đã được khử nhận dạng, tìm các định danh có thể đã bị bỏ sót. Dành cho các nhóm cần chứng minh không còn thông tin cá nhân trước khi chia sẻ một bộ dữ liệu.
Khi nào nên dùng
- ✓Khi các ghi chú đã khử nhận dạng sắp rời khỏi ranh giới tin cậy, như được chia sẻ, xuất hoặc công bố.
- ✓Khi bạn cần bằng chứng rằng không còn định danh cá nhân nào, hoặc một cổng phát hành cho bộ dữ liệu.
- ✓Khi bạn muốn một kiểm tra độc lập với mô hình đã thực hiện việc che thông tin.
Liên kết skill
https://github.com/maziyarpanahi/openmed/blob/master/skills/auditing-deid-leakage/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi đã khử nhận dạng các ghi chú lâm sàng này. Hãy quét đầu ra đã che để tìm định danh còn sót và chặn phát hành nếu có.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent chạy các bộ phát hiện theo mẫu và checksum trên văn bản đã che, cộng thêm kiểm tra của một mô hình thứ hai, rồi tạo báo cáo rò rỉ sẽ thất bại nếu còn định danh nào sót lại.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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: `
Câu hỏi thường gặp
Tôi có nên chạy trên ghi chú gốc không?
Không. Hãy chạy trên đầu ra đã khử nhận dạng, vì bản gốc được cho là chứa định danh.
Nó bắt được những loại định danh nào?
Nó kiểm tra các định danh có cấu trúc như SSN, số thẻ đã kiểm tra Luhn, email và các mẫu số hồ sơ.
Nó có thay thế việc khử nhận dạng không?
Không. Nó kiểm tra đầu ra của một lần khử nhận dạng, nên hoạt động như lượt thứ hai.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 5.8k
- Vị trí xếp hạng
- #14668
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
annotating-variants
5.8kGiúp agent dự đoán tác động của biến thể di truyền, đổi tên HGVS sang vị trí bộ gen và gắn tần suất quần thể bằng công cụ chú giải miễn phí.
ask-openmed
5.8kGiúp agent chọn đúng quy trình OpenMed cho yêu cầu về văn bản lâm sàng, luôn kiểm tra quyền riêng tư trước khi có thể có dữ liệu bệnh nhân.
assembling-fhir-bundles
5.8kGói nhiều bản ghi y tế FHIR thành một Bundle giao dịch để gửi tới EHR, với các tham chiếu nội bộ được liên kết đúng.
auditing-deidentification-runs
5.8kTạo bản ghi có chữ ký và tái lập được cho một lần khử nhận dạng, cho biết đã che gì và vì sao, không chứa dữ liệu bệnh nhân bên trong.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.