Agent skill

Shifting Clinical Dates

by maziyarpanahi in maziyarpanahi/openmed

Apply consistent per-patient date shifting in OpenMed that preserves intervals between events while satisfying HIPAA Safe Harbor's date rule.

Apache-2.0Auto-check passedLegal & Compliance

Install Shifting Clinical Dates

skills CLI
$ npx skills add maziyarpanahi/openmed --skill shifting-clinical-dates -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install maziyarpanahi/openmed shifting-clinical-dates --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/maziyarpanahi/openmed.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/shifting-clinical-dates .claude/skills/shifting-clinical-dates && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
shifting-clinical-dates
GitHub stars
5.5k
Token cost
~1.7k tokens
SKILL.md length
592 words
Files
1
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

Apply consistent per-patient date shifting in OpenMed that preserves intervals between events while satisfying HIPAA Safe Harbor's date rule.

  • Works in 5 steps: Decide the offset policy. Per-patient is… → Set keep_year=False for Safe Harbor.… → Cap ages over 89 separately. Date… → …
  • The user needs to de-identify dates but keep temporal structure for research
  • SKILL.md covers When to use this skill, Quick start, How interval preservation works and Per-patient consistent offsets, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Shifting Clinical Dates is an agent skill from maziyarpanahi/openmed. 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="shiftdates", dateshiftdays=..., keepyear=...) and per-patient reproducible offsets via…

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Legal & Compliance, covering Clinical and healthcare research and Healthcare and finance regulation. The repository describes itself as: Local-first healthcare AI: clinical NER and HIPAA PII de-identification on hardware you control. 2,200+ medical models, 35 model-backed PII languages, and Python, MLX, Android… The licence is Apache-2.0.

When your agent uses it

  • 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
  • Longitudinal analysis

Example prompts

  • “shiftdates”
  • “/shifting-clinical-dates”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Decide the offset policy. Per-patient is standard for clinical research.
  2. Set keep_year=False for Safe Harbor. (keep_year=True retains the year,
  3. Cap ages over 89 separately. Date shifting moves dates; it does not
  4. Keep names/IDs handled too. shift_dates only touches dates. Run a normal
  5. Verify intervals are preserved and no calendar leaked via audit=True.

What it can do on your machine

Read from SKILL.md and the folder at commit 34d7b8c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • ecfr.gov
    • hhs.gov

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Shifting Clinical Dates loads about 1.7k tokens when it runs. Until then it costs about 162 tokens; SKILL.md has 592 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~162
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from maziyarpanahi/openmed at commit 34d7b8c, republished under its Apache-2.0 licence (© maziyarpanahi). 592 words, ~1,652 tokens.

Download SKILL.mdSave it as .claude/skills/shifting-clinical-dates/SKILL.md (or your agent's skills folder).
name
shifting-clinical-dates
description
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 auditing-safe-harbor-checklist.
license
Apache-2.0
metadata.project
OpenMed
metadata.category
de-identification
metadata.pairs
after
metadata.version
1.0

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

python
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=:

python
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

  1. Decide the offset policy. Per-patient is standard for clinical research. Use consistent=True + a per-patient seed. Use a fixed date_shift_days= only when a deterministic, externally-managed offset is required.
  2. Set keep_year=False for Safe Harbor. (keep_year=True retains the year, which is permissible only if dates aren't tied to an individual's care.)
  3. 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 AGE spans explicitly (auditing-safe-harbor-checklist).
  4. Keep names/IDs handled too. shift_dates only touches dates. Run a normal redaction pass (or a policy) for PERSON, ID_NUM, etc.
  5. Verify intervals are preserved and no calendar leaked via audit=True.
Show full SKILL.md (232 more words)Show less

Hand-off to / from OpenMed

  • Core de-id: deidentifying-clinical-text — combine date shifting with a policy= 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-runs records the method and per-span actions (offsets/hashes, not raw dates).
  • Other surfaces: MCP openmed_deidentify / REST POST /pii/deidentify accept the same method and parameters.

Edge cases & gotchas

  • Offset 0 is forbidden. An auto-selected offset is always non-zero — a zero shift would silently leave dates unchanged and defeat de-identification.
  • Reuse the seed per patient, not globally. A single global offset lets an attacker re-align all patients to a real anchor date; per-patient offsets break that. Derive seeds from a secret, not the plaintext MRN.
  • keep_year=True is not Safe Harbor by itself when the year reveals the age of someone >89 or ties to care episodes — pair with age capping.
  • Shifting does not cap ages. Age >89 is a separate transformation; date shifting won't fix an explicit "age 94" in the text.
  • Day-first locales. For non-English notes set lang= so 11/04/2024 is parsed in the right order before shifting (deidentifying-multilingual-text).
  • Store the per-patient seed/offset like PHI — it re-identifies the calendar if leaked. Keep it in a vault, separate from the output.

Standards & references

© maziyarpanahi, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/shifting-clinical-dates of maziyarpanahi/openmed.

Open the folder on GitHubat commit 34d7b8c

Compare with similar skills

Shifting Clinical Dates next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Shifting Clinical Dates compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Shifting Clinical Dates this skillmaziyarpanahi/openmed5.5k—~1.7kAutomated safety check: PassApache-2.0
Clinical Reportsdavila7/claude-code-templates33k11 repos~9.9kAutomated safety check: NotesMIT
Healthtech Advisorborghei/Claude-Skills891—~1.7kAutomated safety check: PassMIT
Hipaa Compliance Auditoraipoch/medical-research-skills1.9k—~2.9kAutomated safety check: PassMIT
Patient Consent Simplifieraipoch/medical-research-skills1.9k—~1.8kAutomated safety check: PassMIT
Health Data Dpiamukul975/Privacy-Data-Protection-Skills301—~2.4kAutomated safety check: PassApache-2.0

Similar skills

  • Clinical Reports

    davila7/claude-code-templates

    Write comprehensive clinical reports including case reports (CARE guidelines), diagnostic reports (radiology/pathology/lab), clinical trial reports (ICH-E3, SAE, CSR), and patient documentation…

    33k GitHub starsUsed in 11 repos~9.9k tokens
    Legal & ComplianceAuto-check: notes
  • Healthtech Advisor

    borghei/Claude-Skills

    Strategic advisory for digital health founders on HIPAA scope, FDA SaMD classification, EHR integration, and payor/provider GTM.

    891 GitHub stars~1.7k tokensUpdated 4 days ago
    Legal & ComplianceAuto-check passed
  • Hipaa Compliance Auditor

    aipoch/medical-research-skills

    Clinical-grade PII/PHI detection and de-identification for healthcare text data.

    1.9k GitHub stars~2.9k tokensUpdated 24 days ago
    Legal & ComplianceAuto-check passed
  • Patient Consent Simplifier

    aipoch/medical-research-skills

    Simplifies informed consent documents into patient-friendly language while maintaining regulatory compliance.

    1.9k GitHub stars~1.8k tokensUpdated 24 days ago
    Legal & ComplianceAuto-check passed
  • Health Data Dpia

    mukul975/Privacy-Data-Protection-Skills

    Guides DPIA for health and medical data processing covering Art.

    301 GitHub stars~2.4k tokensUpdated 6 mo ago
    Legal & ComplianceAuto-check passed
  • Healthcare AI Privacy

    mukul975/Privacy-Data-Protection-Skills

    Addresses healthcare AI privacy at the intersection of HIPAA and the EU AI Act for clinical decision support systems.

    301 GitHub stars~4.4k tokensUpdated 6 mo ago
    Legal & ComplianceAuto-check passed

More from maziyarpanahi/openmed

All 74 skills in this repo
  • Checks OpenMed de-identified clinical text against the 18 HIPAA Safe Harbor identifier categories and reports gaps and residual re-identification risk.

    5.5k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • OpenMed Model Card Writer

    maziyarpanahi/openmed

    Fills in a model card for an OpenMed clinical NER or de-identification model from its evaluation reports: intended use, metrics, subgroups and limitations.

    5.5k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Walks a data pipeline against the HIPAA Privacy and Security Rule checklist and produces a gap report before it processes patient data.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • ICD-10 Coding Assistant

    maziyarpanahi/openmed

    Suggests candidate ICD-10-CM diagnosis and ICD-10-PCS procedure codes for clinical text extracted by OpenMed, with rationale for a certified coder to review.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • OpenMed ETL to OMOP CDM

    maziyarpanahi/openmed

    Maps OpenMed-extracted, terminology-coded conditions, drugs and measurements into OMOP CDM v5.4 tables for OHDSI and ATLAS analytics.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Extracting SDOH and Z-Codes

    maziyarpanahi/openmed

    Finds social risks such as housing instability or food insecurity in clinical notes and proposes matching ICD-10-CM Z-codes for a coder to confirm.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed

Questions about Shifting Clinical Dates

What does Shifting Clinical Dates do?

Apply consistent per-patient date shifting in OpenMed that preserves intervals between events while satisfying HIPAA Safe Harbor's date rule. Shifting Clinical Dates is an agent skill from maziyarpanahi/openmed. Apply consistent per-patient date shifting in OpenMed that preserves intervals between events while satisfying HIPAA Safe Harbor's date rule.

When should I use Shifting Clinical Dates?

Shifting Clinical Dates fits situations like: 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; longitudinal analysis.

How do I install Shifting Clinical Dates in Claude Code?

Run `npx skills add maziyarpanahi/openmed --skill shifting-clinical-dates -a claude-code`. Or copy the skill folder (skills/shifting-clinical-dates in maziyarpanahi/openmed) into .claude/skills/shifting-clinical-dates in your project. Claude Code loads it when a task matches its description.

How do I install Shifting Clinical Dates in Codex?

Run `npx skills add maziyarpanahi/openmed --skill shifting-clinical-dates -a codex`. Or copy the skill folder (skills/shifting-clinical-dates in maziyarpanahi/openmed) into .agents/skills/shifting-clinical-dates in your project. Codex loads it when a task matches its description.

Can I use Shifting Clinical Dates in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add maziyarpanahi/openmed --skill shifting-clinical-dates -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/shifting-clinical-dates, .gemini/skills/shifting-clinical-dates, .github/skills/shifting-clinical-dates and .opencode/skills/shifting-clinical-dates in your project.

What does Shifting Clinical Dates need to run?

SKILL.md names no scripts, command-line tools or credentials: Shifting Clinical Dates is instructions for the agent only. Our summary lists: Python 3.

Does Shifting Clinical Dates access the network?

SKILL.md names 2 domains. As links in the text: ecfr.gov and hhs.gov. This is read from the text; nothing was executed.

Is Shifting Clinical Dates safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Shifting Clinical Dates use?

Shifting Clinical Dates is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Shifting Clinical Dates use?

About 1.7k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Shifting Clinical Dates?

Skills that share tags, products or a category with Shifting Clinical Dates: Clinical Reports (davila7/claude-code-templates, 33k stars), Healthtech Advisor (borghei/Claude-Skills, 891 stars), Hipaa Compliance Auditor (aipoch/medical-research-skills, 1.9k stars) and Patient Consent Simplifier (aipoch/medical-research-skills, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Shifting Clinical Dates?

maziyarpanahi (a GitHub user) maintains it in maziyarpanahi/openmed, which has 5,506 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on October 11, 2026.

Source: maziyarpanahi/openmed on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.