Logo van Scaffolding Smart On Fhir

Scaffolding Smart On Fhir

CommunityPopulair
maziyarpanahi
scaffolding-smart-on-fhir

Zet een SMART-on-FHIR-app op (SMART App Launch v2 — EHR-launch en standalone launch, OAuth2 PKCE, scopes, tokenverwerking, fhirContext), zodat een tool op basis van OpenMed in Epic of Cerner/Oracle Health kan draaien. Omvat het ontdekken van .well-known/smart-configuration, de authorize/token-volgorde, scopes zoals patient/DocumentReference.rs en launch/patient, en het ophalen van klinische notities die de app vervolgens lokaal de-identificeert en met OpenMed op NER verwerkt. Gebruik deze skill als je OpenMed in een EHR wilt integreren, of het hebt over SMART on FHIR, OAuth2-launch, scopes, een Epic/Cerner-app of een FHIR-app voor clinici. Sluit aan op andere skills.

Add to TypingMind

Overzicht

Uitgevermaziyarpanahi
Repositoryopenmed
Skillnaamscaffolding-smart-on-fhir
Sterren
5.6K
Forks
708
Meegeleverde bestanden
Alleen instructies
LicentieApache-2.0
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Compleet zonder extra bestanden

    Alles wat het model nodig heeft, staat in de instructies — geen extra bestanden om te synchroniseren.

  • Open source

    Gepubliceerd door maziyarpanahi op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Scaffolding Smart On Fhir in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/maziyarpanahi/openmed/tree/master/skills/scaffolding-smart-on-fhir
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/maziyarpanahi/openmed.git /tmp/openmed
mkdir -p .claude/skills
cp -r /tmp/openmed/skills/scaffolding-smart-on-fhir .claude/skills/scaffolding-smart-on-fhir
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Scaffolding Smart On Fhir in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Scaffolding Smart On Fhir automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Scaffolding Smart On Fhir niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

Scaffolding SMART on FHIR

To put an OpenMed-powered tool inside a clinician's EHR (Epic, Cerner/Oracle Health), you build a SMART on FHIR app: a web app the EHR launches with an OAuth2 flow, granting scoped, time-limited access to the patient's FHIR data. The app fetches the clinical notes, then runs OpenMed on-device (de-id + NER) — so PHI is processed locally and only de-identified output, if anything, leaves the browser/host.

When to use

Reach for this when the deliverable is a clinician-facing app embedded in an EHR, or a standalone app authorizing against an EHR's FHIR endpoint. Triggers: "SMART on FHIR", "EHR launch", "OAuth2 scopes", "Epic/Cerner app", "embed OpenMed in the chart". For pulling notes at cohort scale (no UI), use exporting-bulk-fhir instead.

Two launch flows

  • EHR launch — clinician clicks your app in the chart. The EHR opens your launch_uri?iss=<fhir-base>&launch=<opaque>; you complete OAuth2 and inherit the current patient/encounter context.
  • Standalone launch — user opens your app directly; it discovers the FHIR server and runs OAuth2, and the user/EHR picks the patient.

Both use SMART App Launch v2: OAuth2 authorization code flow with PKCE (required in v2), discovered via .well-known/smart-configuration.

Quick start: the launch sequence

1. EHR launch URL:
   GET https://app.example/launch?iss=https://ehr.example/fhir&launch=abc123

2. Discover endpoints:
   GET https://ehr.example/fhir/.well-known/smart-configuration
   -> { "authorization_endpoint": ".../authorize",
        "token_endpoint": ".../token",
        "code_challenge_methods_supported": ["S256"],
        "capabilities": ["launch-ehr","client-public","context-ehr-patient", ...] }

3. Redirect the browser to authorize (PKCE + the launch token):
   GET .../authorize?
       response_type=code&
       client_id=YOUR_CLIENT_ID&
       redirect_uri=https://app.example/callback&
       scope=launch openid fhirUser patient/DocumentReference.rs patient/Patient.r&
       state=RANDOM&
       aud=https://ehr.example/fhir&
       launch=abc123&
       code_challenge=BASE64URL(SHA256(verifier))&
       code_challenge_method=S256

4. Callback -> exchange code for token:
   POST .../token
       grant_type=authorization_code&code=...&redirect_uri=...&
       client_id=...&code_verifier=ORIGINAL_VERIFIER
   -> { "access_token": "...", "token_type": "Bearer", "expires_in": 3600,
        "scope": "patient/DocumentReference.rs ...",
        "patient": "Patient-123", "encounter": "Encounter-9",
        "id_token": "..." }

5. Call FHIR with the token:
   GET https://ehr.example/fhir/DocumentReference?patient=Patient-123&type=clinical-note
       Authorization: Bearer <access_token>

The token response carries the launch context (patient, sometimes encounter, and in v2 a fhirContext array). Use patient to scope every subsequent query.

Scopes you actually need

SMART v2 scopes are <level>/<Resource>.<permissions> where permissions are a subset of c r u d s (create/read/update/delete/search) — .rs = read + search. Request the minimum:

ScopeWhy
launchEHR launch context (omit for standalone; use launch/patient)
openid fhirUserIdentify the launching user
patient/Patient.rThe in-context patient demographics
patient/DocumentReference.rsRead + search the patient's clinical notes
patient/Condition.rs(optional) reconcile against existing problems
offline_access(optional) refresh token for background work

Prefer patient/… (current-patient) over user/… (everything the user can see) to keep the blast radius small. Granular v2 scopes (.rs) are stricter than the v1 .read/.write forms — use them.

Where OpenMed runs

Notes arrive as DocumentReference → content.attachment (often base64 or a url to a Binary). Decode, then process locally:

python
import base64, openmed

note_b64 = document_reference["content"][0]["attachment"]["data"]
note = base64.b64decode(note_b64).decode("utf-8")

# De-identify on-device before anything else touches it
deid = openmed.deidentify(note, method="replace", policy="hipaa_safe_harbor")

# Clinical NER on the (de-identified or raw, per your IRB) text
entities = openmed.analyze_text(deid.text, model_name="disease_detection_superclinical")
# -> render highlights in the SMART app UI, or export FHIR (exporting-to-fhir)

OpenMed models run on-device after a one-time download — no note text is sent to a third party by OpenMed. Keep the access token and any PHI in memory only; do not log them.

Hand-off to / from OpenMed

  • From the EHR to OpenMed: fetched DocumentReference notes → openmed.deidentify → openmed.analyze_text.
  • From OpenMed back to the EHR: built FHIR resources (exporting-to-fhir) → to_bundle (assembling-fhir-bundles) → write back with a write scope (e.g. patient/Condition.c) if your use case persists findings. Validate first (validating-us-core).
  • MCP option: if the app calls a local OpenMed MCP server, the tools are openmed_analyze_text and openmed_deidentify — same on-device guarantees.

Edge cases & gotchas

  • PKCE is mandatory in v2 and for public (browser) clients always. Generate a fresh code_verifier per launch; never reuse.
  • Validate state and aud. Reject the callback if state does not match; set aud to the FHIR base or the EHR will reject the authorize request.
  • Tokens are short-lived. Handle expires_in; use offline_access + refresh tokens only if you genuinely need background access, and store them securely (never client-side for confidential clients).
  • Scope down-grade is normal. The EHR may grant fewer scopes than requested; read the returned scope and degrade gracefully.
  • Don't persist PHI in the browser. Process in memory; if you must cache, cache the de-identified output only.
  • App registration is per-EHR. Epic (fhir.epic.com) and Cerner each have their own developer portals, client registration, and sandbox FHIR endpoints; test against the sandbox before go-live.
  • OpenMed stays local. The OAuth2 token authorizes FHIR calls to the EHR; it has nothing to do with OpenMed, which needs no network at inference time.

Standards & references

Veelgestelde vragen

Wat doet de AI-skill Scaffolding Smart On Fhir?

Zet een SMART-on-FHIR-app op (SMART App Launch v2 — EHR-launch en standalone launch, OAuth2 PKCE, scopes, tokenverwerking, fhirContext), zodat een tool op basis van OpenMed in Epic of Cerner/Oracle Health kan draaien. Omvat het ontdekken van .well-known/smart-configuration, de authorize/token-volgorde, scopes zoals patient/DocumentReference.rs en launch/patient, en het ophalen van klinische notities die de app vervolgens lokaal de-identificeert en met OpenMed op NER verwerkt. Gebruik deze skill als je OpenMed in een EHR wilt integreren, of het hebt over SMART on FHIR, OAuth2-launch, scopes,...

Waarom Scaffolding Smart On Fhir gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Scaffolding Smart On Fhir bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Scaffolding Smart On Fhir in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/maziyarpanahi/openmed/tree/master/skills/scaffolding-smart-on-fhir. TypingMind leest het bestand SKILL.md en installeert het als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Scaffolding Smart On Fhir gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Scaffolding Smart On Fhir gebruiken?

Zoveel als je wilt. Je kunt Scaffolding Smart On Fhir gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Scaffolding Smart On Fhir gratis?

Ja. Deze skill is door maziyarpanahi op GitHub gepubliceerd onder de licentie Apache-2.0. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇