fetching-fhir-resources
यह क्या करती है
यह स्किल इलेक्ट्रॉनिक हेल्थ रिकॉर्ड के FHIR API से मरीज़ के दस्तावेज़ और रिपोर्ट लाती है, संलग्न नोट टेक्स्ट डिकोड करती है, और कई पेजों वाले नतीजे संभालती है। यह उन डेवलपर्स के लिए है जो क्लिनिकल टेक्स्ट कार्य को लाइव EHR से जोड़ते हैं।
कब इस्तेमाल करें
- ✓जब आपको विश्लेषण के लिए EHR के FHIR API से मरीज़ के दस्तावेज़ या रिपोर्ट चाहिए।
- ✓जब FHIR खोज कई पेज लौटाए और आपको सभी चाहिए।
- ✓जब नोट का टेक्स्ट base64 सामग्री के रूप में संलग्न हो और विश्लेषण से पहले डिकोड करना हो।
Skill का लिंक
https://github.com/maziyarpanahi/openmed/blob/master/skills/fetching-fhir-resources/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“हमारे FHIR सर्वर से मरीज़ abc के सभी क्लिनिकल नोट्स लाइए, संलग्नक डिकोड कीजिए और मुझे नोट्स का टेक्स्ट दीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट FHIR खोज अनुरोध भेजता है, अगले पेज के लिंक का अनुसरण करता है, base64 संलग्नक डिकोड करता है, और डी-आइडेंटिफ़िकेशन और विश्लेषण के लिए नोट्स का टेक्स्ट लौटाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Fetching FHIR R4 Resources for OpenMed
FHIR R4 is the modern EHR API: a RESTful, JSON-or-XML interface over resources
like Patient, Encounter, Condition, Observation, DiagnosticReport,
and DocumentReference. The unstructured clinical text you want for NLP lives
in DocumentReference.content.attachment and
DiagnosticReport.presentedForm — usually base64-encoded PDF, RTF, or
plain text. This skill pulls those resources, pages through results, decodes the
attachments, and hands the narrative to OpenMed.
When to use
- You have FHIR R4 access to an EHR (Epic, Oracle Health/Cerner, HAPI, Medplum, Azure/Google/AWS HealthLake) and want note text for de-id and NER.
- You need to page a large search result set safely (
Bundle.link[next]). - You want to pull a patient's documents/reports and rejoin NLP output by patient and encounter.
FHIR REST in one minute
Search is GET [base]/[Type]?param=value. Results come back as a
searchset Bundle; the next page is the URL in Bundle.link where
relation == "next". Use _count to size pages, _revinclude to pull related
resources in one round trip, and _since/_lastUpdated for incremental sync.
GET /Patient?identifier=http://hospital.org/mrn|12345
GET /DocumentReference?patient=Patient/abc&category=clinical-note&_count=50
GET /DiagnosticReport?patient=Patient/abc&_revinclude=Observation:related
Quick start
Page a search, decode attachments, hand narrative to OpenMed:
import base64
import requests
import openmed
BASE = "https://fhir.example.org/r4"
HEADERS = {"Accept": "application/fhir+json", "Authorization": "Bearer <token>"}
def iter_bundle(url, params=None):
"""Yield resources across all pages following Bundle.link[next]."""
while url:
bundle = requests.get(url, params=params, headers=HEADERS, timeout=30).json()
for entry in bundle.get("entry", []):
yield entry.get("resource", {})
params = None # next links are fully-qualified
url = next(
(l["url"] for l in bundle.get("link", []) if l.get("relation") == "next"),
None,
)
def attachment_text(att):
"""Decode a FHIR Attachment to text (handles base64 and inline text/plain)."""
if att.get("data"):
raw = base64.b64decode(att["data"])
if att.get("contentType", "").startswith("text/"):
return raw.decode("utf-8", "replace")
return "" # PDF/RTF: route to OpenMed multimodal/OCR intake instead
return ""
# Pull a patient's clinical notes and analyze each.
for doc in iter_bundle(f"{BASE}/DocumentReference",
{"patient": "Patient/abc",
"category": "clinical-note", "_count": 50}):
for content in doc.get("content", []):
text = attachment_text(content.get("attachment", {}))
if not text.strip():
continue
deid = openmed.deidentify(text, method="replace", policy="hipaa_safe_harbor")
result = openmed.analyze_text(deid.text, output_format="dict")
patient_ref = doc.get("subject", {}).get("reference") # rejoin key
Workflow
- Authenticate. Most production FHIR endpoints use SMART-on-FHIR OAuth2
(client-credentials for backend services). Scope to the minimum
(
system/DocumentReference.read,system/DiagnosticReport.read). - Search narrowly. Filter by
patient,category,type(LOINC),date, and_count. Prefer server-side filtering over client-side. - Page via
Bundle.link[next]until exhausted. Never assume one page. - Extract narrative:
DocumentReference.content.attachmentandDiagnosticReport.presentedForm. Decode base64; for PDF/RTF/scanned content, route bytes to OpenMed's document intake (multimodal/ocr) rather than decoding as UTF-8. - De-identify → analyze each narrative with OpenMed.
- Rejoin results to
subject.reference(patient) andcontext.encounterso downstream consumers can group by patient/encounter — storing hashed, not raw, identifiers.
Hand-off to / from OpenMed
- To OpenMed (client-side): decoded narrative →
openmed.deidentify→openmed.analyze_text. Carrysubject.referenceas the rejoin key. - Server-side
$de-identify:openmed.interop.fhir_operationsimplements the FHIR$de-identifyoperation logic over the OpenMed privacy pipeline:de_identify_resource(resource, policy=..., method=...)- `de_identi
अक्सर पूछे जाने वाले सवाल
यह किन EHR के साथ काम करती है?
यह किसी भी FHIR R4 सर्वर के साथ काम करती है, जैसे Epic, Oracle Health, HAPI या US Core सर्वर।
क्या यह नोट्स डी-आइडेंटिफ़ाई करती है?
नोट्स विश्लेषण से पहले एक अलग डी-आइडेंटिफ़िकेशन चरण में जाते हैं।
क्या यह केवल नए रिकॉर्ड सिंक कर सकती है?
हाँ। यह समय-आधारित फ़िल्टर के साथ इंक्रीमेंटल सिंक कवर करती है।
जानकारी
लेखक का मूल विवरण
Fetches and pages FHIR R4 resources (Patient, DocumentReference, DiagnosticReport, Observation, Condition) from a FHIR REST server, decodes base64 attachments, and extracts clinical narrative for OpenMed. Use before OpenMed processing when pulling charts from an EHR FHIR API (Epic, Cerner/Oracle, HAPI, or any US Core server) and you need the note text de-identified and analyzed, then results rejoined by patient. Hand narrative to openmed.deidentify and openmed.analyze_text; openmed.interop.fhir_operations implements a $de-identify operation over Bundles. Trigger keywords: FHIR, R4, US Core, Do
repo: maziyarpanahi/openmed
लोकप्रियता
- GitHub स्टार
- 5.8k
- रैंकिंग में स्थान
- #14704
- लाइसेंस
- 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
discrawl
394kयह आपके एजेंट को Discord संदेशों के सेव किए गए स्थानीय आर्काइव में खोजने, उसका सारांश बनाने और उसकी ताज़गी जांचने में मदद करती है।
clickhouse-io
280kआपके एजेंट को ClickHouse databases में queries और schemas optimize करने में मदद करता है। high-performance analytical workloads के लिए best practices लागू करता है। जब analytical queries बहुत धीमी हों, तब इसका उपयोग करें।
scientific-db-pubmed-database
280kआपके एजेंट को बायोमेडिकल क्षेत्र के वैज्ञानिक लेख खोजने में मदद करता है। जिस रिसर्च में खास मेडिकल जानकारी चाहिए, उसके लिए यह काम का है।