Native Medical Services¶
OpenMed operates across three boundaries:
- the local operator runtime
- the configured model-provider path for general agent reasoning
- the native medical services that power extraction, de-identification, terminology, and HCC/RAF work
The split lets long clinical text and coding work go to dedicated services instead of through the chat model on every pass. It does not make that work local. Text sent to a native medical service leaves your machine, and that service receives it.
By default, OpenMed binaries use the OpenMed-hosted medical services. You can point either service plane at your own compatible server; see Use your own service endpoints.
Local runtime. Separate medical services. Explicit boundary.
OpenMed keeps sessions, plans, workflow previews, and artifacts in the operator runtime while general agent reasoning uses the configured model provider. Clinical extraction and medical-coding services sit behind a separate native service plane, so page-heavy work does not all have to go through the chat model. Text sent to these services leaves your machine.
Operator runtime
CLI, TUI, sessions, plans, provenance, and workflow artifacts remain on the operator machine, with the review loop visible before teams depend on outputs.
Clinical extraction service
NER, PII detection, de-identification, and batch extraction run through the native service plane.
Medical coding and terminology service
ICD-10, CPT, SNOMED, LOINC, HCC mapping, and RAF scoring run through a separate service boundary. PubMed, MedlinePlus, and RxNorm lookups go from your machine to those public APIs by default.
Service planes¶
Clinical extraction plane¶
For practical prompts, language and redaction controls, document previews, batch processing and extraction exports, see the Clinical NLP guide.
The extraction plane is the native service boundary for clinical text processing.
It powers native OpenMed tools such as:
extract_entitiesextract_piideidentify_textdeidentify_batch- batch extraction workflows built on the same service
Operationally, this is where OpenMed handles:
- clinical NER
- billing-oriented entity extraction
- PII detection
- de-identification
Configuration:
- binaries use the OpenMed-hosted extraction service by default
OPENMED_INFERENCE_URLpoints this plane at your own compatible server- the service boundary can move without changing the local workflow surface
The extraction service receives the text or document bytes sent to it.
Coding and terminology plane¶
The coding plane is the native service boundary for terminology, education, and risk adjustment.
It powers native OpenMed tools such as:
- PubMed search and abstract retrieval
- ICD-10, CPT, SNOMED, and LOINC search / lookup / validation
- RxNorm medication normalization and related-concept lookup
- MedlinePlus patient-education topic lookup
- code crosswalks
- CCSR categories, Charlson and Elixhauser comorbidity indices, and Orphanet rare-disease lookups
- HCC, RxHCC, and ESRD mapping
- RAF, RxHCC, and ESRD score calculation
OpenMed can review a clinical note, extract coding candidates, and then pass those codes to the terminology and HCC service for checking.
Configuration:
- binaries use the OpenMed-hosted coding and terminology service by default
OPENMED_MED_CODES_API_URLpoints this plane at your own compatible server- PubMed, MedlinePlus, and RxNorm lookups run directly from your machine to those public APIs by default
- the service boundary can move without changing the local workflow surface
The coding service receives the codes, search text, and values such as age and sex sent to it.
Interpreting code validation and HCC results¶
For ICD-10 validation, valid describes the code's format. Check exists and
billable separately before accepting a coding candidate. A category such as
N18.3 can have an accepted format while being absent from the loaded billable
code set. Conversely, three-character codes such as I10 can be billable;
code length and the lookup's standalone sequencing flag are not billability
checks. Use the reference release appropriate to the encounter date.
For CPT validation, valid: null means the result is unconfirmed: the code
service does not list the code and the LCD cross-check was unavailable. It does
not mean the code is invalid. Try again in a few minutes.
For retrospective HCC work, pass the exact payment_year and model_segment,
and retain the service's reference provenance. If the service does not support
the requested year, OpenMed retries with a supported year and adds a warning, so
check the year the result used. A model's agreement with a tool result does not
verify the mapping table or RAF score. Treat missing reference data and service
errors as missing evidence requiring review.
RAF, RxHCC, and ESRD scores are estimates. Full parity with the official CMS risk-adjustment software has not been validated, so every score result and workflow artifact says so, names the model, payment year, and segment used, and lists submitted codes that received no HCC category. Verify scores before billing or submission.
Coding workflows score at most 50 submitted codes for HCC mapping and RAF. The report marks the run DEGRADED and lists any further codes as not scored, so the RAF does not include them.
When a service is unavailable¶
Hosted services can restart or have short outages, and they are provided as available: they may change, be interrupted, or be discontinued. See Long-Term Use for what depends on them. OpenMed reports an outage instead of guessing:
- Tools return an error saying the service is unavailable, instead of an empty result.
- Workflows that need reference data, such as prior authorization (LCD criteria) and appeal review (denial codes), stop with an error instead of producing a review against empty data.
- Coding workflows mark the artifact DEGRADED and name each service step that failed. RAF is reported as "not calculated" rather than estimated locally.
- Skill instructions report that they are temporarily unavailable, and come back without a restart once the service is reachable.
Re-run the request once the service is reachable again.
Why the split matters¶
The split has practical effects:
- extraction and de-identification can scale independently from coding and terminology lookup
- page-heavy clinical inputs do not need to consume chat-model context for every extraction or coding pass
- the model-provider path stays separate from the extraction and coding services
- either service can be replaced without changing the operator workflow surface
The split does not keep data away from the chat model by itself. Text in the conversation and many tool results reach the model, including sample entities from extract_entities. The dedicated privacy tools return summaries instead; see Clinical file review.
These service planes are native OpenMed backends. They are not remote MCP servers.
Deployment patterns¶
| Pattern | Runtime | Extraction / PII | Coding / HCC |
|---|---|---|---|
| Default (hosted) | Local operator machine | OpenMed-hosted native extraction endpoint | OpenMed-hosted native coding and terminology endpoint |
| Your own endpoints | Local operator machine | Compatible server you operate | Compatible server you operate |
You can mix the two: each plane is configured separately.
Security and access model¶
OpenMed does not claim that any deployment is compliant. What it does state is narrower:
- sessions, plans, tool calls, and review steps are visible to the operator
- the model-provider path and the medical-service tier are separate, explicit boundaries
- the actual privacy and compliance posture depends on where those services are hosted and governed
- no product telemetry is built into the runtime
By default, OpenMed serves the native medical-service tier so you do not need to deploy it yourself. The same workflow surface can target a compatible server you operate.
Use your own service endpoints¶
Standard binaries use OpenMed's native services without extra local setup. To run either service plane on your own infrastructure, point OpenMed at a compatible server you operate. Each plane is configured separately, so you can move one and keep the other hosted.
A custom service URL receives only the API key or token you configure for that service.
Built-in skills and workflow reference data still come from OpenMed-hosted services, even when both planes use your own servers.
Environment variables¶
| Variable | Purpose |
|---|---|
OPENMED_INFERENCE_URL |
Base URL of the extraction / PII / de-id service |
OPENMED_INFERENCE_API_KEY |
Sent as X-API-Key to the extraction service |
OPENMED_INFERENCE_HF_TOKEN |
Hugging Face token for a private Space, sent as X-HF-Authorization |
OPENMED_INFERENCE_TIMEOUT_SECONDS |
Request timeout for the extraction service |
OPENMED_MED_CODES_API_URL |
Base URL of the coding and terminology service |
OPENMED_MED_CODES_API_KEY |
Sent as X-API-Key to the coding service |
OPENMED_MED_CODES_HF_TOKEN |
Hugging Face token for a private Space, sent as Authorization: Bearer |
OPENMED_MED_CODES_TIMEOUT_SECONDS |
Request timeout for the coding service |
OPENMED_MED_CODES_EXECUTION_MODE |
client (default) runs PubMed, MedlinePlus, and RxNorm from your machine; server sends them through the coding service |
OPENMED_NCBI_API_KEY |
Your own NCBI E-utilities key for higher PubMed rate limits |
OPENMED_SHARED_API_KEY / OPENMED_SHARED_HF_TOKEN |
One key or token for both services |
OPENMED_SERVICE_SECRETS_PATH |
Read the file below from a different path |
Environment variables win over the file. Restart OpenMed after changing either.
~/.openmed/service_secrets.json¶
The same settings can live in a file, so they persist across shells:
{
"inference": {
"base_url": "https://nlp.internal.example.org",
"api_key": "{env:OPENMED_NLP_KEY}"
},
"med_codes": {
"base_url": "https://codes.internal.example.org",
"api_key": "{env:OPENMED_CODES_KEY}",
"ncbi_api_key": "{env:NCBI_API_KEY}"
}
}
- Every field is optional. A plane without
base_urlkeeps using the hosted default. hf_tokenis accepted in either section for a private Hugging Face Space.- A
sharedsection withapi_keyorhf_tokenapplies to both services. "{env:NAME}"reads the value from the environment variableNAME, so the file does not need to contain the secret itself.ncbi_api_keyis your own NCBI E-utilities key for higher PubMed rate limits.- Keep the file private:
chmod 600 ~/.openmed/service_secrets.json.
To check which endpoints are in use, run openmed env; it shows whether each service uses the OpenMed-hosted default or your custom URL, and never prints keys.
See Privacy & Security for the runtime-boundary explanation.