跳到正文
Skillpedia
安全5.8k · #14688

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/maziyarpanahi/openmed/blob/master/skills/deidentify-a-dataset/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

  1. Confirm that the input is CSV, JSONL/NDJSON, or Parquet.
  2. Confirm which columns contain free text. Do not scan or log values to guess.
  3. Choose a policy and language. Prefer strict_no_leak when recall is the governing safety requirement.
  4. Write to a new path; never overwrite the input.
  5. Inspect only result.summary, which contains aggregate counts and rates.
  6. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能