deidentify-a-dataset
它能做什么
这项技能从本地数据文件(例如 CSV)的自由文本列中去除个人信息,并生成一份单独的脱敏副本。适合必须安全地共享或分析临床数据的分析人员。
适用场景
- ✓当你需要在分析或共享之前,处理临床 CSV、JSONL 或 Parquet 数据集的时候。
- ✓当数据集中只有某些自由文本列包含患者信息的时候。
- ✓当你需要一份脱敏数量的摘要,同时又不想看到具体值的时候。
技能链接
https://github.com/maziyarpanahi/openmed/blob/master/skills/deidentify-a-dataset/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请对这个患者 CSV 中的记录列进行脱敏,并保存为一个新文件,不要修改原始文件。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会确认文件类型和指定的文本列,把脱敏后的数据写入新文件,并只报告汇总的数量和比例。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
De-identify a dataset
Keep the source local, name the free-text columns explicitly, and write to a different destination. Never infer columns or print source and redacted cell values.
Procedure
- Confirm that the input is CSV, JSONL/NDJSON, or Parquet.
- Confirm which columns contain free text. Do not scan or log values to guess.
- Choose a policy and language. Prefer
strict_no_leakwhen recall is the governing safety requirement. - Write to a new path; never overwrite the input.
- Inspect only
result.summary, which contains aggregate counts and rates. - Validate recall and residual leakage on representative synthetic or approved evaluation fixtures before releasing the output.
Runnable synthetic example
Install the model runtime first with python -m pip install "openmed[hf]".
import csv
from pathlib import Path
from openmed import redact_dataset
source = Path("synthetic-notes.csv")
destination = Path("synthetic-notes.redacted.csv")
with source.open("w", newline="", encoding="utf-8") as handle:
writer = csv.DictWriter(handle, fieldnames=["record_id", "note"])
writer.writeheader()
writer.writerows(
[
{
"record_id": "SYNTH-001",
"note": (
"Taylor Example called 212-555-0198 about a "
"metformin refill."
),
},
{
"record_id": "SYNTH-002",
"note": (
"Send the synthetic follow-up to "
"demo.patient@example.test."
),
},
]
)
result = redact_dataset(
source,
text_columns=["note"],
output_path=destination,
policy="strict_no_leak",
lang="en",
)
print(result.output_path)
print(result.summary.to_dict()) # Aggregate counts only; no cell contents.
Use the equivalent CLI for an existing dataset:
openmed redact-dataset notes.csv \
--text-columns note,comment \
--policy strict_no_leak \
--output notes.redacted.csv
Safety checks
- Keep model inference and files on infrastructure the user controls.
- Do not print input rows, detected entity surfaces, reversible mappings, or exception payloads that may contain source text.
- Keep source and output paths separate and access-controlled.
- Treat the aggregate summary as evidence, not as proof of compliance.
- Never commit real clinical data or restricted evaluation corpora.
Repository example
Read and run the offline dataset walkthrough when you need a bundled synthetic fixture and first-run download controls.
常见问题
它会覆盖我的原始文件吗?
不会。它写入新的路径,从不修改输入文件。
它会自行猜测要扫描哪些列吗?
不会。由你指定自由文本列,这项技能不会根据数值去推断。
支持哪些文件类型?
支持 CSV、JSONL 或 NDJSON,以及 Parquet 文件。
详情
作者的原始描述
De-identify selected free-text columns in a local CSV, JSONL, or Parquet dataset with OpenMed and produce a separate redacted dataset plus a PHI-free aggregate summary. Use when an agent must prepare a clinical dataset for analysis or sharing without overwriting the source or exposing cell values in logs.
repo: maziyarpanahi/openmed
热度
- GitHub 星标
- 5.8k
- 排名
- #14688
- 许可证
- 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扫描已去标识化的临床文本,查找残留的标识符,例如社会安全号、银行卡号、电子邮件地址和日期,若仍有残留则阻止发布。