shifting-clinical-dates
Fungsinya
Skill ini mengajari agent cara menyembunyikan tanggal kalender asli dalam teks medis sambil menjaga selisih waktu antar peristiwa. Skill ini untuk peneliti yang membutuhkan interval, seperti jumlah hari sampai rawat ulang, setelah tanggal disembunyikan.
Kapan dipakai
- βSaat peneliti membutuhkan selisih waktu antar peristiwa, seperti jumlah hari sampai rawat ulang, setelah tanggal disembunyikan.
- βSaat pengguna membutuhkan tanggal digeser per pasien sehingga selisih yang sama dipakai untuk setiap orang.
- βSaat pengguna membutuhkan usia di atas 89 dibatasi dan tanggal dikurangi sesuai yang diizinkan Safe Harbor.
Link skill
https://github.com/maziyarpanahi/openmed/blob/master/skills/shifting-clinical-dates/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βBisakah Anda menyembunyikan tanggal asli dalam catatan pasien saya tetapi menjaga jumlah hari di antara setiap kunjungan?β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent memilih satu selisih untuk setiap pasien dan menambahkannya ke setiap tanggal dalam catatan itu. Tanggal asli hilang, tetapi jarak antar tanggal tetap sama.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Kapan penghapusan biasa lebih sederhana?
Skill menyatakan bahwa jika tanggal tidak penting, metode penyamaran sederhana lebih mudah daripada menggeser tanggal.
Mengapa memakai selisih per pasien?
Itu menjaga linimasa setiap pasien tetap konsisten sambil menyembunyikan tanggal asli.
Apakah selisih itu bisa diulang?
Bisa. Skill menetapkan seed tetap sehingga pasien yang sama mendapat selisih yang sama setiap kali.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 5.8k
- Peringkat
- #14735
- Lisensi
- Apache-2.0
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
annotating-variants
5.8kMembantu agent Anda memperkirakan apa yang dilakukan varian genetik, mengubah nama HGVS menjadi posisi genom, dan menambahkan frekuensi populasi, dengan memakai anotator publik yang gratis.
ask-openmed
5.8kMembantu agent Anda memilih alur kerja OpenMed yang tepat untuk permintaan teks klinis, dimulai dengan pemeriksaan privasi setiap kali data pasien mungkin ada.
assembling-fhir-bundles
5.8kMengemas beberapa rekam kesehatan FHIR menjadi satu Bundle transaksi yang siap dikirim ke EHR, dengan referensi internal yang terhubung dengan benar.
auditing-deid-leakage
5.8kMemindai teks klinis yang sudah dihapus identitasnya untuk mencari pengenal yang tertinggal, seperti nomor SSN, nomor kartu, email, dan tanggal, dan memblokir rilis jika masih ada.
Skill serupa
gitcrawl
394kMemungkinkan agent Anda mencari arsip issue dan pull request GitHub yang tersimpan, mengelompokkan yang duplikat, dan memeriksa status terkininya di GitHub.
slacrawl
394kMemungkinkan agent Anda mencari dan menghitung pesan di arsip Slack lokal, memeriksa seberapa baru arsip itu, dan menyegarkannya bila diperlukan.
goplaces
394kMembantu agent Anda mencari tempat, mendapatkan detail dan ulasannya, serta menentukan nama tempat memakai Google Places, dengan keluaran JSON untuk skrip.