serving-openmed-rest-api
यह क्या करती है
यह स्किल एजेंट को सिखाती है कि मेडिकल टेक्स्ट विश्लेषण की ऐसी वेब सेवा कैसे चलाएँ जिसे दूसरे प्रोग्राम वेब पर कॉल कर सकें। यह उन टीमों के लिए है जो व्यक्तिगत विवरण खोजने और मास्क करने के लिए आंतरिक सेवा चाहती हैं।
कब इस्तेमाल करें
- ✓जब कोई टीम टेक्स्ट में मेडिकल शब्द खोजने वाली निजी आंतरिक वेब सेवा चाहती है।
- ✓जब डेवलपर को ऐसा डी-आइडेंटिफ़िकेशन रूट चाहिए जिसे दूसरे ऐप HTTP पर कॉल कर सकें।
- ✓जब उपयोगकर्ता तैनाती के लिए सेवा को कंटेनर में पैक करना चाहता है।
Skill का लिंक
https://github.com/maziyarpanahi/openmed/blob/master/skills/serving-openmed-rest-api/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे लिए एक आंतरिक वेब सेवा सेट अप कीजिए, जिसे हमारे ऐप नोट्स से मरीज़ों के नाम हटाने के लिए कॉल कर सकें।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट FastAPI सेवा इंस्टॉल करता है, उसे शुरू करता है, और analyze तथा deidentify जैसे रूट जोड़ता है। स्किल कहती है कि सेवा स्वयं-होस्टेड है और उसके मॉडल डिवाइस पर चलते हैं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Serving OpenMed over REST
openmed.service is a hardened FastAPI app exposing OpenMed's NER, PII
extraction, and de-identification over HTTP. It is built to be self-hosted:
models run on-device, there's no telemetry, and the request schemas reject raw
PHI from spilling into errors. Use it when callers need request/response
inference; use batch-processing-clinical-text for corpora.
When to use this skill
To put OpenMed behind an HTTP endpoint your own apps call — an internal de-id
microservice, an NER backend, a containerized inference tier. For agent/tool
integration prefer the MCP server (deploying-openmed-mcp); for offline bulk
work use batch processing.
Quick start
pip install "openmed[service]" # FastAPI + uvicorn + pydantic
# Launch the ASGI app (factory create_app, or the module-level `app`)
python -m openmed.service.logging --host 127.0.0.1 --port 8000
# Or build it in-process (e.g. to mount under a parent app / add middleware):
from openmed.service import create_app
app = create_app()
curl -s localhost:8000/health
# {"status":"ok","service":"openmed-rest","version":"...","profile":"prod"}
curl -s localhost:8000/analyze -H 'content-type: application/json' -d '{
"text": "Patient received 75mg clopidogrel for NSTEMI.",
"model_name": "disease_detection_superclinical"
}'
curl -s localhost:8000/pii/deidentify -H 'content-type: application/json' -d '{
"text": "John Doe called 555-123-4567 on 01/15/2020.",
"method": "mask"
}'
Endpoints (confirmed in openmed/service/app.py)
| Method & path | Purpose | Request schema |
|---|---|---|
GET /health |
liveness + version + active profile | — |
GET /models/loaded |
cache/keep-alive status of resident models | — |
POST /models/unload |
unload one model or all inactive models | ModelUnloadRequest (model_name or all=true) |
POST /analyze |
clinical NER | AnalyzeRequest |
POST /pii/extract |
detect PII/PHI spans | PIIExtractRequest |
POST /pii/deidentify |
mask/remove/replace/hash/shift-dates PHI | PIIDeidentifyRequest |
Request fields (from openmed/service/schemas.py, strict — unknown fields are
rejected):
AnalyzeRequest:text(required),model_name("disease_detection_superclinical"),confidence_threshold(0.0),group_entities,aggregation_strategy(simple|first|average|max),sentence_detection,sentence_language,sentence_clean,use_fast_tokenizer,keep_alive.PIIExtractRequest:text,model_name(defaultOpenMed/OpenMed-PII-SuperClinical-Small-44M-v1),confidence_threshold(0.5),use_smart_merging,lang(en/fr/de/it/es/nl/hi/te/pt/ar/ja/tr),normalize_accents,keep_alive.PIIDeidentifyRequest: same base plusmethod(mask|remove|replace|hash|shift_dates, defaultmask),confidence_threshold(0.7),keep_year,shift_dates,date_shift_days,keep_mapping,policy,use_smart_merging,use_safety_sweep.
Responses are the OpenMed result to_dict() (e.g. {text, entities[...], ...}).
Errors use a stable envelope: {"error": {"code", "message", "details"}} with
422 validation_error, 400 bad_request, 504 timeout, 500 internal_error.
Configuring the runtime (env vars)
ServiceRuntime.from_env() reads the process environment at startup
(openmed/service/runtime.py):
| Env var | Effect |
|---|---|
OPENMED_PROFILE |
config profile (prod default) |
OPENMED_SERVICE_PRELOAD_MODELS |
comma list of models to warm at startup |
OPENMED_SERVICE_KEEP_ALIVE |
default idle keep-alive before unload |
OPENMED_SERVICE_MAX_RESIDENT_MODELS |
cap resident models (warm pool) |
OPENMED_SERVICE_BATCHING_ENABLED |
enable dynamic request batching |
OPENMED_SERVICE_BATCH_MAX_SIZE |
max dynamic batch size (default 8) |
OPENMED_SERVICE_BATCH_MAX_WAIT_MS |
batch-collection window (default 5ms) |
OPENMED_SERVICE_PRELOAD_MODELS="disease_detection_superclinical" \
OPENMED_SERVICE_BATCHING_ENABLED=true \
python -m openmed.service.logging --host 0.0.0.0 --port 8000
Preloading avoids first-request latency; the warm pool keeps hot models resident
and idle-unloads the rest. /analyze and /pii/extract coalesce concurrent
requests when batching is enabled.
Workflow
- Install + launch.
pip install "openmed[service]", then runpython -m openmed.service.logging(or build withcreate_app()). - **Config
अक्सर पूछे जाने वाले सवाल
क्या सेवा डेटा कहीं और भेजती है?
स्किल कहती है कि इसमें कोई टेलीमेट्री नहीं है और मॉडल डिवाइस पर चलते हैं।
क्या स्वास्थ्य जाँच है?
हाँ। स्किल एक हेल्थ एंडपॉइंट दिखाती है जो सेवा की स्थिति बताता है।
क्या बहुत सारे दस्तावेज़ों के लिए इसे इस्तेमाल करूँ?
बड़े संग्रहों के लिए स्किल एक अलग बैच प्रोसेसिंग स्किल की ओर इशारा करती है।
जानकारी
लेखक का मूल विवरण
Stand up OpenMed's FastAPI REST service for clinical NER, PII extraction, and de-identification, with health checks, model keep-alive/unload, optional dynamic batching, and no-PHI logging. Use when the user wants to serve OpenMed over HTTP, deploy a de-id/NER REST API, run an inference endpoint for clinical text, add a /analyze or /pii/deidentify route, or containerize OpenMed as a service. Covers the service extra, launching create_app with uvicorn, the real endpoints (/health, /analyze, /pii/extract, /pii/deidentify, /models/loaded, /models/unload), request/response shapes, ServiceRuntime en
repo: maziyarpanahi/openmed
लोकप्रियता
- GitHub स्टार
- 5.8k
- रैंकिंग में स्थान
- #14733
- लाइसेंस
- 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
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।