building-patient-timelines
यह क्या करती है
यह स्किल एक या अधिक नोट्स की क्लिनिकल घटनाओं को समय के क्रम वाली मरीज़ टाइमलाइन में बदलती है। यह उन क्लिनिशियनों और विश्लेषकों के लिए है जिन्हें समय के साथ मरीज़ की देखभाल का साफ़ इतिहास चाहिए।
कब इस्तेमाल करें
- ✓जब आपको नोट्स से मरीज़ के निदान, दवाएँ और प्रक्रियाएँ तारीख के क्रम में चाहिए।
- ✓जब 'भर्ती के दो दिन बाद' जैसे सापेक्ष समय वाक्यांश असली तारीखें बनने चाहिए।
- ✓जब निर्यात या सारांश से पहले आपको तारीख-क्रमित मुलाकातों का क्रम चाहिए।
Skill का लिंक
https://github.com/maziyarpanahi/openmed/blob/master/skills/building-patient-timelines/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इन डिस्चार्ज नोट्स से निदान, दवाओं और प्रक्रियाओं की एक टाइमलाइन बनाइए, और हर घटना की तारीख दीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट टेक्स्ट में अपनी स्थिति के साथ क्लिनिकल घटनाएँ निकालता है, तारीखें सामान्य करता है और सापेक्ष समय अभिव्यक्तियाँ हल करता है, फिर सब कुछ एक क्रम में लगाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Building patient timelines
A patient timeline is a chronologically ordered list of clinical events —
diagnoses, medications, procedures, encounters — each carrying a normalized
date. OpenMed gives you the events (via analyze_text) and the clinical
temporality of each mention (current vs. historical, see
resolving-clinical-context); this skill turns those into a sorted timeline.
Everything runs on-device — de-identify first if the source notes contain
PHI, and keep raw identifiers out of logs.
When to use this skill
After you have extracted entities from one or more notes and want them ordered
in time: a longitudinal history, a "course of illness" view, a feed for a
summary card, or a pre-step before FHIR export. If you only need to extract
entities, use extracting-clinical-entities. If you need negation/temporality
on a single mention, use resolving-clinical-context.
Quick start
import datetime as dt
import openmed
note = (
"Discharge summary, 2024-03-12. Patient admitted 2024-03-08 with chest pain. "
"History of type 2 diabetes diagnosed in 2019. Started on metformin two days "
"after admission. Cardiac catheterization performed yesterday."
)
# 1) Extract clinical events (entities carry char offsets: start/end)
result = openmed.analyze_text(note, output_format="dict")
events = result["entities"] # each: {text, label, confidence, start, end}
# 2) Normalize the temporal frame: an explicit document/anchor date drives
# resolution of relative expressions ("two days after", "yesterday").
anchor = dt.date(2024, 3, 12) # parsed from the note header or document metadata
analyze_text returns {text, entities, model_name, timestamp, ...}; each
entity is {text, label, confidence, start, end}. Use start/end to locate
each event in the source and to find the nearest date expression.
Workflow
- De-identify if needed. If notes carry PHI, run
openmed.deidentify(...)first, or keep the timeline keyed by stable internal IDs — never log raw names/MRNs. - Extract events.
openmed.analyze_text(note)for conditions, drugs, procedures; pick the model that matches your target entities (choosing-openmed-models). - Resolve temporality. For each event, use
resolving-clinical-contextto tag itcurrent/historical/hypotheticaland to drop negated or family-history mentions that should not appear on the patient's own line. - Normalize dates. Map each event to a date:
- Absolute (
2024-03-08,March 2019) → parse directly. Record the granularity (day / month / year) — a year-only event sorts to a coarse bucket, not a fakeJan 1. - Relative (
two days after admission,yesterday,on POD 2) → resolve against an anchor: the document date, admission date, or a prior event's date. Without an anchor, relative expressions are unresolvable — flag them, don't guess.
- Absolute (
- Build event records. One record per event:
(date, granularity, label, surface_text, char_span, temporality, confidence, source_note_id). - Sort and de-duplicate. Sort by
(date, granularity); merge repeated mentions of the same event across notes (same label + overlapping date). - Emit. A sorted list for a UI, or FHIR resources (see hand-off).
Worked example: events → sorted timeline
def to_timeline(events, *, anchor, note_id):
"""events: list of {text,label,start,end,confidence}. anchor: date.
Returns sorted [(date, granularity, label, text, confidence)]."""
timeline = []
for e in events:
date, gran = resolve_event_date(e, note=note, anchor=anchor) # your resolver
if date is None:
continue # undated/unresolvable: route to an "undated" bucket, don't drop silently
timeline.append((date, gran, e["label"], e["text"], e["confidence"]))
# year-only ('Y') sorts before month ('M') before day ('D') on ties
order = {"Y": 0, "M": 1, "D": 2}
return sorted(timeline, key=lambda r: (r[0], order[r[1]]))
# resolve_event_date handles: ISO dates, "March 2019" (gran='M'),
# "yesterday"/"two days after admission" (relative to anchor/admission), POD-n, etc.
Hand-off to / from OpenMed
- From OpenMed:
analyze_textentities (extracting-clinical-entities) andclinicalcontext tags (resolving-clinical-context) are the inputs. Rundeidentifyupstream when notes carry PHI. - To OpenMed / interop: f
अक्सर पूछे जाने वाले सवाल
क्या यह पिछले इतिहास के ज़िक्र वाले नोट्स संभालती है?
हाँ। यह क्लिनिकल संदर्भ का उपयोग करके मौजूदा घटनाओं को पुराने ज़िक्र से अलग करती है।
क्या मुझे पहले पहचानकर्ता हटाने चाहिए?
हाँ, अगर नोट्स में व्यक्तिगत विवरण हैं। स्किल सलाह देती है कि पहले डी-आइडेंटिफ़ाई करें और पहचानकर्ता लॉग से बाहर रखें।
क्या यह केवल एंटिटी निकालती है?
नहीं। इसका लक्ष्य क्रमित टाइमलाइन है, जबकि सादा एंटिटी निष्कर्षण एक अलग चरण है।
जानकारी
लेखक का मूल विवरण
Assemble a chronological patient timeline from OpenMed-extracted clinical events, normalizing dates and resolving relative time expressions on-device. Use when the user wants to build a patient timeline, order events from clinical notes, reconstruct a longitudinal history, plot a course of illness, or turn analyze_text/deidentify output into a sorted sequence of dated encounters, diagnoses, medications, and procedures. Covers temporal normalization (absolute and relative), event modeling toward FHIR Encounter/Condition.onsetDateTime, anchoring to a document/admission date, and handling undated
repo: maziyarpanahi/openmed
लोकप्रियता
- GitHub स्टार
- 5.8k
- रैंकिंग में स्थान
- #14679
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
annotating-variants
5.8kआपके एजेंट को मुफ़्त सार्वजनिक एनोटेटर से जेनेटिक वेरिएंट का असर बताने, HGVS नामों को जीनोम पोज़िशन में बदलने और जनसंख्या आवृत्ति जोड़ने में मदद करती है।
ask-openmed
5.8kआपके एजेंट को क्लिनिकल टेक्स्ट अनुरोध के लिए सही OpenMed वर्कफ़्लो चुनने में मदद करती है, जहाँ मरीज़ का डेटा हो सकता है वहाँ पहले गोपनीयता जाँच से शुरू करके।
assembling-fhir-bundles
5.8kकई FHIR स्वास्थ्य रिकॉर्ड को एक ट्रांज़ैक्शन Bundle में पैक करती है, जो EHR को भेजने के लिए तैयार हो और आंतरिक संदर्भ सही जुड़े हों।
auditing-deid-leakage
5.8kडी-आइडेंटिफ़ाइड क्लिनिकल टेक्स्ट में बचे पहचानकर्ता जैसे SSN, कार्ड नंबर, ईमेल और तारीखें खोजती है, और कुछ बचा हो तो रिलीज़ रोक देती है।
मिलती-जुलती skills
gitcrawl
394kयह आपके एजेंट को GitHub issues और pull requests के सेव आर्काइव में खोजने, मिलते-जुलते मामलों को समूह में रखने और लाइव स्थिति जांचने देती है।
slacrawl
394kयह आपके एजेंट को स्थानीय Slack आर्काइव में संदेश खोजने और गिनने, उसकी ताज़गी जांचने और ज़रूरत पड़ने पर उसे ताज़ा करने देती है।
goplaces
394kयह आपके एजेंट को Google Places से जगहें खोजने, उनका विवरण और समीक्षाएं पाने, और जगह के नाम हल करने में मदद करती है, स्क्रिप्ट के लिए JSON आउटपुट के साथ।