Langsung ke konten
Skillpedia
Database5.8k ยท #14704

fetching-fhir-resources

Fungsinya

Skill ini mengambil dokumen dan laporan pasien dari API FHIR sistem rekam kesehatan elektronik, mendekode teks catatan yang dilampirkan, dan menangani hasil dengan banyak halaman. Skill ini untuk pengembang yang menghubungkan pekerjaan teks klinis ke EHR yang berjalan.

Kapan dipakai

  • โœ“Saat Anda membutuhkan dokumen atau laporan pasien dari API FHIR EHR untuk analisis teks.
  • โœ“Saat pencarian FHIR mengembalikan banyak halaman dan Anda membutuhkan semuanya.
  • โœ“Saat teks catatan dilampirkan sebagai konten base64 dan harus didekode sebelum analisis.

Link skill

https://github.com/maziyarpanahi/openmed/blob/master/skills/fetching-fhir-resources/SKILL.md

Salin 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

Gunakan skill ini untuk membantu saya: https://github.com/maziyarpanahi/openmed/blob/master/skills/fetching-fhir-resources/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œAmbil semua catatan klinis untuk pasien abc dari server FHIR kami, dekode lampirannya, dan berikan teks catatannya.โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent mengirim permintaan pencarian FHIR, mengikuti tautan halaman berikutnya, mendekode lampiran base64, lalu mengembalikan teks catatan untuk penghapusan identitas dan analisis.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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

  1. 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).
  2. Search narrowly. Filter by patient, category, type (LOINC), date, and _count. Prefer server-side filtering over client-side.
  3. Page via Bundle.link[next] until exhausted. Never assume one page.
  4. Extract narrative: DocumentReference.content.attachment and DiagnosticReport.presentedForm. Decode base64; for PDF/RTF/scanned content, route bytes to OpenMed's document intake (multimodal/ocr) rather than decoding as UTF-8.
  5. De-identify โ†’ analyze each narrative with OpenMed.
  6. Rejoin results to subject.reference (patient) and context.encounter so 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. Carry subject.reference as the rejoin key.
  • Server-side $de-identify: openmed.interop.fhir_operations implements the FHIR $de-identify operation logic over the OpenMed privacy pipeline:
    • de_identify_resource(resource, policy=..., method=...)
    • `de_identi
Pertanyaan umum

EHR mana yang didukung?

Skill bekerja dengan server FHIR R4 mana pun, seperti Epic, Oracle Health, HAPI, atau server US Core.

Apakah skill ini menghapus identitas catatannya?

Catatan diteruskan ke langkah penghapusan identitas terpisah sebelum analisis.

Apakah bisa hanya menyinkronkan catatan baru?

Bisa. Skill mencakup sinkronisasi inkremental dengan filter berbasis waktu.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
5.8k
Peringkat
#14704
Lisensi
Apache-2.0
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa