shifting-clinical-dates
하는 일
이 스킬은 의료 텍스트에서 실제 달력 날짜를 숨기면서 사건 사이의 간격은 유지하는 방법을 에이전트에게 가르칩니다. 날짜가 가려진 뒤에도 재입원까지의 일수처럼 간격이 필요한 연구자를 위한 스킬입니다.
사용하는 경우
- ✓날짜를 숨긴 뒤에도 재입원까지 일수처럼 사건 사이의 시간이 필요한 연구자일 때.
- ✓환자마다 같은 간격을 쓰도록 날짜를 환자별로 옮겨야 할 때.
- ✓89세를 넘는 나이를 제한하고 Safe Harbor가 허용하는 수준으로 날짜를 줄여야 할 때.
스킬 링크
https://github.com/maziyarpanahi/openmed/blob/master/skills/shifting-clinical-dates/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 환자 노트에서 실제 날짜는 숨기되, 각 방문 사이의 일수는 유지해 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 환자마다 하나의 간격을 고르고, 그 기록의 모든 날짜에 더합니다. 실제 날짜는 사라지지만 날짜 사이의 간격은 그대로 유지됩니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Shifting clinical dates
HIPAA Safe Harbor forbids keeping dates more specific than the year. But naively
deleting dates destroys the temporal structure research depends on — time to
event, length of stay, intervals between visits. Date shifting is the
compromise: move every date by a single random offset so the absolute dates
become meaningless while the intervals between them are preserved exactly.
OpenMed does this on-device with deidentify(method="shift_dates", ...).
When to use this skill
Use it when downstream analysis needs temporal relationships (survival curves,
sepsis-to-antibiotic time, readmission gaps) but the calendar dates must be
de-identified. If you can throw dates away entirely, plain method="mask" is
simpler — reach for shifting only when intervals matter.
Quick start
import openmed
note = (
"Admitted 2024-03-02, started antibiotics 2024-03-04, discharged 2024-03-09. "
"Follow-up scheduled 2024-04-02."
)
# Shift every date by the SAME offset -> intervals preserved, dates obscured.
result = openmed.deidentify(
note,
method="shift_dates",
consistent=True, # one stable offset for this run
seed=20240519, # reproducible per-patient offset (use a per-patient key)
keep_year=False, # do NOT retain the year (Safe Harbor: year-only is the max)
)
print(result.deidentified_text)
# Admit -> antibiotics is still 2 days; admit -> discharge still 7 days; etc.
How interval preservation works
All dates in the document are moved by one offset (auto-selected as a random
non-zero value in roughly ±1 year, or fixed with date_shift_days=). Because
the offset is identical for every date, the difference between any two dates is
unchanged:
real: Mar 2 ──2d──▶ Mar 4 ──5d──▶ Mar 9
shifted: Jul 18 ──2d──▶ Jul 20 ──5d──▶ Jul 25 (offset = +138 days, intervals intact)
That is why survival time, length of stay, and visit gaps survive de-identification while the actual calendar is destroyed.
Per-patient consistent offsets
Each patient should get their own offset, and that offset should be
stable across documents and reproducible across runs. Derive a per-patient
seed (e.g. from a secret keyed hash of the patient ID — never the raw MRN) and
pass it as seed=:
def patient_offset_seed(patient_key: str) -> int:
import hashlib, hmac
# keyed so the mapping from patient -> offset is itself a secret
digest = hmac.new(b"<vault-secret>", patient_key.encode(), hashlib.sha256).digest()
return int.from_bytes(digest[:8], "big")
for doc in patient_documents:
openmed.deidentify(
doc, method="shift_dates",
consistent=True, seed=patient_offset_seed(patient_id),
keep_year=False,
)
Same patient → same offset everywhere (their notes stay internally consistent); different patients → different offsets (cross-patient dates cannot be aligned).
Workflow
- Decide the offset policy. Per-patient is standard for clinical research.
Use
consistent=True+ a per-patientseed. Use a fixeddate_shift_days=only when a deterministic, externally-managed offset is required. - Set
keep_year=Falsefor Safe Harbor. (keep_year=Trueretains the year, which is permissible only if dates aren't tied to an individual's care.) - Cap ages over 89 separately. Date shifting moves dates; it does not
aggregate ages. Safe Harbor requires ages >89 and any date implying age >89
to collapse to a single "90+" — handle
AGEspans explicitly (auditing-safe-harbor-checklist). - Keep names/IDs handled too.
shift_datesonly touches dates. Run a normal redaction pass (or a policy) forPERSON,ID_NUM, etc. - Verify intervals are preserved and no calendar leaked via
audit=True.
Hand-off to / from OpenMed
- Core de-id:
deidentifying-clinical-text— combine date shifting with apolicy=so names/IDs are redacted in the same pipeline. - Safe Harbor checklist:
auditing-safe-harbor-checklist— the date rule and the age-90 cap are categories C in the 18. - Audit:
auditing-deidentification-runsrecords the method and per-span actions (offsets/hashes, not raw dates). - Other surfaces: MCP
openmed_deidentify/ RESTPOST /pii/deidentifyaccept the same method and parameters.
Edge cases & gotchas
- Offset 0 is forbidden. An auto-selected offset is always non-zero — a zero shift would si
자주 묻는 질문
날짜를 그냥 지우는 것이 더 간단한 경우는 언제인가요?
날짜가 중요하지 않다면 단순 마스킹이 간격 이동보다 쉽다고 스킬이 설명합니다.
환자별로 간격을 왜 다르게 하나요?
각 환자의 시간 순서를 일관되게 유지하면서 실제 날짜는 숨기기 위해서입니다.
간격을 반복해서 사용할 수 있나요?
네. 스킬은 고정된 시드를 설정해 같은 환자가 매번 같은 간격을 받도록 합니다.
상세 정보
작성자의 원본 설명
Apply consistent per-patient date shifting in OpenMed that preserves intervals between events while satisfying HIPAA Safe Harbor's date rule. Use when the user needs to de-identify dates but keep temporal structure for research, shift all dates by the same offset per patient, preserve days-between-events for survival or longitudinal analysis, cap ages over 89, or strip everything but the year. Covers deidentify(method=\"shift_dates\", date_shift_days=..., keep_year=...) and per-patient reproducible offsets via consistent=True, seed=.... Pairs with OpenMed deidentifying-clinical-text and auditi
repo: maziyarpanahi/openmed
인기도
- GitHub 스타
- 5.8k
- 순위
- #14735
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
annotating-variants
5.8k에이전트가 유전 변이의 효과를 예측하고, HGVS 이름을 게놈 위치로 바꾸고, 무료 공개 주석 도구를 사용해 인구 빈도를 붙이도록 돕습니다.
ask-openmed
5.8k에이전트가 임상 텍스트 요청에 맞는 OpenMed 워크플로를 고르도록 돕되, 환자 데이터가 있을 수 있으면 먼저 개인 정보 확인을 거치게 합니다.
assembling-fhir-bundles
5.8k여러 FHIR 건강 기록을 EHR로 보낼 수 있도록 하나의 트랜잭션 Bundle로 묶고, 내부 참조를 올바르게 연결하도록 에이전트를 돕습니다.
auditing-deid-leakage
5.8k비식별화된 임상 텍스트에 남은 SSN, 카드 번호, 이메일, 날짜 같은 식별자를 검사하고, 남은 것이 있으면 공개를 막도록 돕습니다.
비슷한 스킬
gitcrawl
394k에이전트가 저장된 GitHub 이슈와 풀 리퀘스트 보관본을 검색하고, 중복 항목을 묶고, GitHub에서 현재 상태를 확인하도록 돕습니다.
slacrawl
394k에이전트가 로컬 Slack 보관본에서 메시지를 검색하고 개수를 세며, 보관본이 얼마나 최신인지 확인하고 필요할 때 새로 고치도록 돕습니다.
goplaces
394k에이전트가 Google Places로 장소를 검색하고, 세부 정보와 리뷰를 가져오고, 장소 이름을 확인하며, 스크립트용 JSON을 출력하도록 돕습니다.