auditing-deidentification-runs
它能做什么
这项技能为每次去标识化运行生成合规记录,列出修改的内容及原因,但不保存患者数据本身。适合需要向监管机构或内部审查提供审计证据的团队。
适用场景
- ✓当你需要合规证据,证明一次去标识化运行做了哪些改动的时候。
- ✓当你必须为 HIPAA 或 GDPR 审计保存防篡改记录的时候。
- ✓当审查人员需要检查去标识化决定,又无需看到原始个人数据的时候。
技能链接
https://github.com/maziyarpanahi/openmed/blob/master/skills/auditing-deidentification-runs/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请对这些记录进行去标识化,并生成一份可保存用于我们 HIPAA 审查的审计记录,同时签名,以便发现任何改动。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会以审计模式运行去标识化,使用你控制的密钥对生成的报告签名,并保存下来,以便之后检查其完整性。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Auditing de-identification runs
deidentify(..., audit=True) returns an AuditReport instead of the rewritten
text: a deterministic, PHI-free record of every redaction decision —
offsets, label, detector confidence and threshold, the action taken, content
hashes, model provenance, and projected residual risk. Sign it to make it
tamper-evident, retain it as compliance evidence, and verify it later without
ever touching the original text. Runs on-device.
When to use this skill
Use it whenever a de-identification needs to be defensible: regulatory retention, internal review, reproducibility checks, or proving to an auditor that identifiers were detected and handled — all without storing or exposing the PHI itself.
Quick start
import openmed
note = "Patient John Doe (MRN 1234567) seen 2024-03-02. SSN 123-45-6789."
# Returns an AuditReport, NOT a DeidentificationResult, when audit=True.
report = openmed.deidentify(note, policy="hipaa_safe_harbor", audit=True)
# Make it tamper-evident with a release HMAC key (keep the key in a vault).
report.sign(b"my-release-hmac-key", key_id="release-2026")
# Persist the no-PHI report (no plaintext identifiers inside).
import json
with open("deid_audit.json", "w") as fh:
json.dump(report.to_dict(), fh, indent=2)
# Later: verify integrity. Optionally bind to the exact texts via their hashes.
ok = report.verify(b"my-release-hmac-key", original_text=note)
assert ok
What an AuditReport contains
AuditReport (from openmed.core.audit) carries no plaintext PHI. Key fields:
| Field | Meaning |
|---|---|
policy |
policy profile name in effect |
resolved_profile |
the concrete settings applied (method, model, thresholds, language, sweep flags) |
detectors |
list[DetectorInfo] — provenance of each detector |
safety_sweep |
structured-ID sweep metadata (patterns version, source) |
spans |
list[AuditSpan] — one entry per detected identifier |
thresholds |
per-label confidence thresholds used |
residual_risk |
projected leakage / re-identification risk summary |
openmed_version |
library version that produced the report |
manifest_hash |
hash of the model manifest used |
document_length |
character length of the input |
input_hash |
sha256: hash of the original text |
deidentified_text_hash |
sha256: hash of the de-identified output |
repro_hash |
deterministic hash over the canonical payload |
signature |
AuditSignature once .sign() is called (else None) |
AuditSpan (per identifier, no plaintext): start, end, label,
canonical_label, sources, confidence, threshold, action, surrogate,
text_hash (hash of the span text), plus evidence and a redacted context.
DetectorInfo: source, model_id, model_format, commit, metadata.
AuditSignature: key_id, algorithm (HMAC-SHA256), value (hex digest).
Why audits store offsets + hashes + provenance, never plaintext
The whole point of de-identification is to not retain identifiers. An audit log full of raw names and MRNs would itself be a PHI breach. So OpenMed records:
- offsets (
start/end) — where an identifier was, not what it was; - hashes (
input_hash,deidentified_text_hash, per-spantext_hash) — prove what was processed without revealing it; - provenance (
detectors,manifest_hash,openmed_version) — which model/version made each call, for reproducibility; - residual risk (
residual_risk) — projected leakage so a reviewer can judge whether the output is safe to release.
This lets an auditor confirm coverage and integrity while the report stays shareable.
Workflow
- Run with
audit=Trueand apolicy=to get anAuditReport. - Inspect
residual_riskbefore releasing the output — non-zero projected leakage means review (cross-check withauditing-safe-harbor-checklist). - Sign with
report.sign(key, key_id=...)using a secret release HMAC key stored in a vault (never in the repo). - Persist
report.to_dict()(JSON). For a reviewer view without full context, usereport.export_review_bundle(). - Verify on retrieval with
report.verify(key). Passoriginal_text=/deidentified_text=to also confirm the texts match the recorded hashes. - Retain per your retention schedule alongside the de-identified output (but keep any reversible mapping separate and encrypted).
Hand-off to /
常见问题
记录中包含患者姓名吗?
不包含。报告设计上不含明文标识符,因此可以安全保存。
之后如何检查这份记录?
签名报告之后可以验证完整性,也可以选择链接到对应的确切文本。
它在哪里运行?
这项技能在使用它的设备上运行,因此审计不依赖云服务。
详情
作者的原始描述
Produce a signed, reproducible, no-PHI audit trail for an OpenMed de-identification run via deidentify(audit=True). Use when the user needs compliance evidence, a tamper-evident record of what was redacted and why, to verify nothing was changed, to retain proof for HIPAA/GDPR audits, or to review de-id decisions without exposing plaintext PHI. Covers the AuditReport / AuditSignature / AuditSpan / DetectorInfo fields, why audits store offsets+hashes+provenance+residual-risk and never plaintext, signing with .sign(key), and verifying with .verify(key). Pairs with OpenMed deidentifying-clinical-t
repo: maziyarpanahi/openmed
热度
- GitHub 星标
- 5.8k
- 排名
- #14669
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
annotating-variants
5.8k帮你的智能体预测基因变异的作用,把 HGVS 名称转换为基因组位置,并使用免费的公共注释工具添加人群频率。
ask-openmed
5.8k帮你的智能体为临床文本请求选择合适的 OpenMed 工作流程,并在可能涉及患者数据时,先进行隐私检查。
assembling-fhir-bundles
5.8k把多份 FHIR 健康记录打包成一个事务 Bundle,可直接发送给 EHR 系统,并正确链接其中的内部引用。
auditing-deid-leakage
5.8k扫描已去标识化的临床文本,查找残留的标识符,例如社会安全号、银行卡号、电子邮件地址和日期,若仍有残留则阻止发布。