본문으로 건너뛰기
Skillpedia
보안5.8k · #14689

deidentifying-clinical-text

하는 일

이 스킬은 사용자의 컴퓨터에서 임상 노트의 이름, 날짜, 진료기록번호 같은 환자 식별자를 제거하거나 가립니다. 환자를 노출하지 않고 의료 노트를 공유하거나 분석해야 하는 모든 사람을 위한 스킬입니다.

사용하는 경우

  • ✓공유하기 전에 의료 노트에서 환자 이름, 날짜, 진료기록번호를 가려야 할 때.
  • ✓노트를 읽기 좋게 유지하려고 식별자를 그럴듯한 가짜 값으로 바꾸고 싶을 때.
  • ✓마스킹, 제거, 날짜 이동 중 비식별화 방법을 골라야 할 때.

스킬 링크

https://github.com/maziyarpanahi/openmed/blob/master/skills/deidentifying-clinical-text/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/maziyarpanahi/openmed/blob/master/skills/deidentifying-clinical-text/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 퇴원 요약에서 환자 이름, 날짜, 전화번호를 제거한 뒤 연구팀과 공유하고 싶습니다.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 기기에서 탐지를 실행해 식별자를 찾고, 마스킹이나 대체 같은 선택한 방법을 적용하며, 무엇이 바뀌었는지 목록과 함께 정리된 텍스트를 돌려줍니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

De-identifying clinical text

openmed.deidentify detects PHI/PII and rewrites the text so it can be shared, stored, or analyzed without exposing patients. It runs fully on-device after a one-time model download — no network calls, no telemetry, no raw PHI leaving the process. This is the single most important OpenMed entry point for privacy work; everything else (policies, audit, multilingual, date-shifting) layers on top of it.

When to use this skill

Reach for deidentify when you need to transform text — replace, mask, remove, hash, or date-shift the identifiers. If you only need to locate PHI spans without changing the text, use extract_pii (see extracting-pii-entities). To restore masked text later, use reidentify (see reidentifying-text).

Quick start

import openmed

note = (
    "Patient John Doe (MRN 1234567) was seen on 2024-03-02 by Dr. Alice Reed. "
    "Contact: john.doe@example.com, 617-555-0142."
)

result = openmed.deidentify(
    note,
    method="mask",                 # mask | remove | replace | hash | shift_dates
    confidence_threshold=0.7,      # safety default; raise to reduce false negatives' impact
    policy="hipaa_safe_harbor",    # optional bundled profile (see below)
)

print(result.deidentified_text)
# Patient [NAME] (MRN [ID_NUM]) was seen on [DATE] by Dr. [NAME]. ...

for e in result.pii_entities:
    # NEVER log e.text / e.original_text — those are raw PHI. Use offsets + label.
    print(e.canonical_label, e.start, e.end, round(e.confidence, 3))

deidentify returns a DeidentificationResult with these fields (note the exact names):

Field What it holds
.deidentified_text the rewritten, PHI-safe string (your output)
.pii_entities list[PIIEntity] — each has start, end, canonical_label, confidence, action, surrogate; original_text/text hold raw PHI
.mapping redacted→original dict, only when keep_mapping=True (secret)
.method the method actually applied
.metadata run metadata (model, policy, counts)

The five methods

method= Effect Reversible? Use when
"mask" John Doe → [NAME] with keep_mapping=True default; clear that redaction happened
"remove" deletes the span entirely no minimal-footprint output
"replace" type-matched fake value (John Doe→Mark Lee) with keep_mapping=True keep notes readable/parseable (see generating-synthetic-surrogates)
"hash" stable hash per value, links repeats no (one-way) cohort linkage without revealing identity
"shift_dates" moves dates, preserves intervals n/a research needing temporal structure (see shifting-clinical-dates)

Workflow

  1. Pick a method and a policy. Start from a bundled policy= profile (hipaa_safe_harbor, gdpr_pseudonymization, research_limited_dataset, …) so per-label actions are set for you. See configuring-privacy-policies.
  2. Set confidence_threshold deliberately. Default is 0.7. For de-id, prefer over-redaction: a missed identifier is a breach, an over-redacted token is just noise. The bundled safety sweep catches structured IDs (SSN, MRN-like, emails) even below threshold.
  3. Run deidentify. Inspect result.pii_entities by offset and label, not raw text, to confirm coverage.
  4. For stable surrogates, pass consistent=True, seed=<int> so the same input maps to the same fake value every run (reproducible pipelines).
  5. For reversibility, pass keep_mapping=True and store result.mapping in a secured vault — never alongside the de-identified output.
  6. Verify, don't assume. Check residual risk with audit=True (auditing-deidentification-runs) and the 18-identifier checklist (auditing-safe-harbor-checklist).

Consistent surrogates and reversibility

# Same fake identity for every mention of the same person, reproducibly:
r = openmed.deidentify(note, method="replace", consistent=True, seed=42)

# Reversible de-id (keep the mapping secret and separate from output):
r = openmed.deidentify(note, method="mask", keep_mapping=True)
restored = openmed.reidentify(r.deidentified_text, r.mapping)
assert restored == note

Hand-off to / from OpenMed

  • Detect only: openmed.extract_pii(text) → PredictionResult with .entities (spans, no rewrite). Use it to preview coverage first.
  • Restore:
자주 묻는 질문

텍스트가 제 컴퓨터 밖으로 나가나요?

아니요. 한 번의 모델 다운로드 후 처리는 기기에서 실행되며 네트워크 호출은 없습니다.

나중에 원래 텍스트를 복원할 수 있나요?

일부 방법은 되돌릴 수 있습니다. 재식별 스킬이 가려진 텍스트를 복원하는 방법을 다룹니다.

안전 설정이 있나요?

네. 신뢰도 임계값이 안전을 우선하도록 설정되어 있으며, 조정할 수 있습니다.

상세 정보

작성자의 원본 설명

Remove, mask, or replace PHI/PII in clinical free text on-device with OpenMed's deidentify(). Use when the user needs to de-identify medical notes, strip patient identifiers, redact PHI before sharing or analysis, anonymize discharge summaries, or pick a de-id method (mask vs remove vs replace vs hash vs shift_dates). Covers confidence_threshold for safety, consistent+seed for stable surrogates, keep_mapping for reversible de-id, policy= profiles, and the DeidentificationResult fields. Pairs with OpenMed extract_pii (detect spans), reidentify (restore), configuring-privacy-policies, and auditi

repo: maziyarpanahi/openmed

인기도

GitHub 스타
5.8k
순위
#14689
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬