---
name: OMOPHub
description: Use OMOPHub when building ETL pipelines to standardize healthcare
  data into OMOP CDM tables, resolving FHIR codes to standard concepts, mapping
  between medical vocabularies, or integrating with FHIR-based systems. Agents
  should reach for this skill when working with clinical data transformation,
  vocabulary mapping, phenotype development, or grounding AI systems against
  medical terminology.
metadata:
  mintlify-proj: omophub
  version: "1.0"
---

# OMOPHub Skill Reference

## Product Summary

OMOPHub is a REST API platform providing programmatic access to 11M+ OMOP (Observational Medical Outcomes Partnership) concepts across 120+ medical vocabularies including SNOMED CT, ICD-10, LOINC, RxNorm, NDC, HCPCS, and ATC. It eliminates the need to download and maintain local vocabulary databases. The platform exposes three primary surfaces: a REST API for vocabulary operations, a FHIR Terminology Service (R4/R4B/R5/R6), and an MCP Server for AI agent integration.

**Key endpoints:**
- REST API: `https://api.omophub.com/v1`
- FHIR Terminology Service: `https://fhir.omophub.com/fhir/{r4,r4b,r5,r6}`
- Authentication: Bearer token in `Authorization` header (API key starts with `oh_`)

**SDKs available:** Python (`pip install omophub`), Node.js/TypeScript (`npm install @omophub/omophub-node`), R (`install.packages("omophub")`), MCP Server (`npx @omophub/omophub-mcp`)

**Primary docs:** https://docs.omophub.com

## When to Use

Reach for OMOPHub when:

- **ETL pipelines:** Mapping source system codes (local, ICD-10, LOINC, NDC) to OMOP standard concepts for CDM loading
- **FHIR integration:** Resolving FHIR `Coding` or `CodeableConcept` to OMOP concepts + CDM target tables in a single call
- **Vocabulary mapping:** Translating codes between any two OMOP vocabularies (e.g., ICD-10 → SNOMED)
- **Phenotype development:** Building concept sets by traversing hierarchies and exploring relationships
- **FHIR-native systems:** Integrating with HAPI FHIR, EHRbase, or other FHIR servers that need a remote terminology backend
- **Clinical AI/LLM grounding:** Eliminating hallucinated medical codes by validating against OMOP source of truth
- **Lab/medication normalization:** Mapping local lab codes to LOINC or drug codes to RxNorm
- **Data quality:** Checking for deprecated concepts, validating code existence, or analyzing mapping coverage

Do NOT use OMOPHub for: account management, billing, dashboard operations, or non-medical vocabulary lookups.

## Quick Reference

### Authentication
```bash
# All requests require Bearer token
Authorization: Bearer oh_your_api_key

# Set environment variable (recommended)
export OMOPHUB_API_KEY="oh_xxxxxxxxx"
```

### Core API Patterns

| Task | Endpoint | Method | Use case |
|------|----------|--------|----------|
| Search concepts | `GET /v1/search/concepts?query=...` | GET | Keyword search across vocabularies |
| Semantic search | `GET /v1/search/semantic?query=...` | GET | Natural-language matching via embeddings |
| Get concept | `GET /v1/concepts/{concept_id}` | GET | Fetch by OMOP concept ID |
| Resolve FHIR code | `POST /v1/fhir/resolve` | POST | Single FHIR Coding → OMOP concept + CDM table |
| Batch resolve | `POST /v1/fhir/resolve/batch` | POST | Up to 100 FHIR codings in one call |
| Map concepts | `POST /v1/concepts/map` | POST | Translate between vocabularies |
| Batch map | `POST /v1/concepts/map/batch` | POST | Up to 50 mapping requests per call |
| Ancestors/descendants | `GET /v1/concepts/{id}/ancestors` | GET | Walk hierarchy trees |
| Relationships | `GET /v1/concepts/{id}/relationships` | GET | Non-hierarchical relationships (e.g., "Has ingredient") |
| FHIR $lookup | `GET /fhir/r4/CodeSystem/$lookup?...` | GET | FHIR-native concept details |
| FHIR $translate | `GET /fhir/r4/ConceptMap/$translate?...` | GET | FHIR-native vocabulary mapping |

### SDK Quick Start

**Python:**
```python
import omophub
client = omophub.OMOPHub()  # reads OMOPHUB_API_KEY env var
result = client.search.basic("diabetes", vocabulary_ids=["SNOMED"])
resolved = client.fhir.resolve(system="http://snomed.info/sct", code="44054006", resource_type="Condition")
```

**Node.js/TypeScript:**
```typescript
import { OMOPHub } from '@omophub/omophub-node';
const client = new OMOPHub();
const { data, error } = await client.search.basic("diabetes");
const { data: resolved } = await client.fhir.resolve({...});
```

**R:**
```r
library(omophub)
client <- OMOPHubClient$new()
results <- client$search$basic("diabetes", vocabulary_ids = "SNOMED")
resolved <- client$fhir$resolve(system = "http://snomed.info/sct", code = "44054006")
```

### Batch Limits & Metering

| Endpoint | Max items | Counts as |
|----------|-----------|-----------|
| `/v1/concepts/batch` | 100 | 1 API call |
| `/v1/concepts/map/batch` | 50 | 1 API call |
| `/v1/concepts/hierarchy/batch` | 100 | 1 API call |
| `/v1/search/bulk` | 50 | 1 API call |
| `/v1/search/semantic-bulk` | 25 | 1 API call |
| `/v1/fhir/resolve/batch` | 100 | 1 API call |

**Critical:** Batch requests meter **per item**, not per HTTP call. A 100-item batch counts as 100 API calls against your quota.

### Rate Limits (Free Tier)
- **Sustained:** 120 requests per 60 seconds (2 req/sec average)
- **Burst:** 20 requests per 10 seconds
- **Response headers:** `ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`, `retry-after`
- **On 429:** Honor the `retry-after` header and back off exponentially

### Response Envelope (REST API)
```json
{
  "success": true,
  "data": { /* payload */ },
  "meta": {
    "request_id": "req_...",
    "timestamp": "2026-04-14T10:30:00Z",
    "vocab_release": "2025.2"
  }
}
```

### Common Vocabulary IDs
`SNOMED`, `ICD10CM`, `ICD10`, `LOINC`, `RxNorm`, `NDC`, `HCPCS`, `ATC`, `CVX`, `UMLS`

### Common Domains (CDM Table Assignment)
`Condition` → `condition_occurrence`, `Drug` → `drug_exposure`, `Measurement` → `measurement`, `Observation` → `observation`, `Procedure` → `procedure_occurrence`, `Device` → `device_exposure`

## Decision Guidance

### When to Use FHIR Resolver vs FHIR Terminology Service

| Scenario | Use | Endpoint |
|----------|-----|----------|
| ETL: map FHIR code to OMOP + CDM table | **FHIR Resolver** | `POST /v1/fhir/resolve` |
| FHIR client needs spec-conformant operations | **FHIR Terminology Service** | `https://fhir.omophub.com/fhir/r4/*` |
| HAPI FHIR server needs remote backend | **FHIR Terminology Service** | Configure as remote provider |
| Batch resolve 100+ codings | **FHIR Resolver batch** | `POST /v1/fhir/resolve/batch` |
| Need raw FHIR Parameters response | **FHIR Terminology Service** | Use `$lookup`, `$translate`, etc. |

**Key difference:** Resolver returns OMOP-enriched JSON with CDM target table. Terminology Service returns spec-conformant FHIR `Parameters` / `OperationOutcome`.

### When to Use Search Endpoints

| Input | Use | Endpoint |
|-------|-----|----------|
| Have OMOP concept ID | Direct lookup | `GET /v1/concepts/{id}` |
| Have exact vocabulary code | Code lookup | `GET /v1/concepts/by-code?vocabulary_id=...&concept_code=...` |
| Keyword search (e.g., "diabetes") | Keyword search | `GET /v1/search/concepts?query=...` |
| Natural language (e.g., "high blood sugar") | Semantic search | `GET /v1/search/semantic?query=...` |
| Prefix matching for UI autocomplete | Autocomplete | `GET /v1/search/autocomplete?query=...` |

### When to Cache vs Call API

| Scenario | Action |
|----------|--------|
| First ETL run, new source codes | Call API, build mapping cache |
| Subsequent ETL runs, same codes | Use local cache (zero API calls) |
| New source codes appear | Detect unmapped, queue for API lookup, update cache |
| Vocabulary release changes (every 2-3 months) | Invalidate cache, re-run API lookups |
| Production ETL with millions of rows | Deduplicate codes first, batch-map unique codes, apply cache via local join |

## Workflow

### Typical ETL: FHIR to OMOP

1. **Extract unique source codes** from your FHIR dataset (e.g., 500K records → 2K unique codes)
2. **Check local mapping cache** for codes already resolved
3. **Batch-resolve cache misses** via `POST /v1/fhir/resolve/batch` (chunk into groups of 100)
4. **Update local cache** with new mappings
5. **Apply cache to full dataset** via pandas merge / SQL JOIN (zero API calls)
6. **Flag unmapped codes** for manual review
7. **Load OMOP CDM tables** using resolved concept IDs and target tables

### Typical Mapping: Local Code to Standard

1. **Search for concept** by display name: `GET /v1/search/concepts?query=...&vocabulary_ids=LOINC`
2. **Verify match** against expected domain/vocabulary
3. **If non-standard, follow Maps to:** `GET /v1/concepts/{id}/mappings?target_vocabularies=SNOMED`
4. **Build mapping file** (CSV: source_code → omop_concept_id)
5. **Validate with domain expert** (human review step)
6. **Load into production ETL** as lookup table

### Typical Phenotype: Concept Set Expansion

1. **Start with seed concept** (e.g., "Type 2 diabetes" SNOMED 44054006)
2. **Get descendants** to include all subtypes: `GET /v1/concepts/{id}/descendants?max_levels=3`
3. **Inspect alternatives** for ambiguous codes: `GET /v1/concepts/{id}/mappings`
4. **Validate clinical relevance** with domain expert
5. **Export concept set** as list of OMOP concept IDs
6. **Use in cohort definition** for research

## Common Gotchas

- **Batch metering:** A 100-item batch counts as 100 API calls, not 1. Plan quota accordingly.
- **FHIR resource type ≠ OMOP domain:** A FHIR `Observation` carrying a blood glucose (LOINC) maps to `measurement` table, not `observation`. Always use the resolved concept's domain, not the FHIR resource type.
- **Non-standard concepts:** ICD-10 and NDC codes are non-standard in OMOP. The Resolver automatically follows `Maps to` to find the standard equivalent, but you must check `mapping_type` to understand what happened.
- **One-to-many mappings:** A single ICD-10 code can map to multiple SNOMED concepts (e.g., combination diagnosis splitting into separate Condition + Observation). The Resolver returns `alternative_standard_concepts` — inspect this array and decide whether to write one row per alternative or pick the highest-quality match.
- **Unmapped codes:** If a code doesn't map, set `*_concept_id` to `0` (OMOP convention) and log the code for manual review. Do not silently drop records.
- **Semantic search fallback:** When you pass `display` text with no `system`/`code`, the Resolver falls back to semantic search. Check `mapping_type: "semantic_match"` and the `similarity_score` to assess confidence.
- **Rate limit headers:** Always read `ratelimit-remaining` and `retry-after`. Free tier has a 10-second burst window — rapid requests can exhaust burst quota even if sustained quota remains.
- **Vocabulary versions:** Responses include `X-Vocab-Release` header. Pin a specific release via `X-Vocab-Release` header or `vocab_release` query parameter if you need reproducibility.
- **FHIR vs REST error shapes:** FHIR Terminology Service returns `OperationOutcome` resources; REST API returns `{success, error, meta}` envelope. Handle both shapes if you support both surfaces.
- **CPT4 access:** Requires annual UMLS validation in the Dashboard. GPI and MedDRA are unavailable.
- **Pagination:** Default page size is 20. GET endpoints clamp `page_size` to max 200. POST endpoints read `page_size` from body with higher limits per endpoint.

## Verification Checklist

Before submitting ETL or integration work:

- [ ] API key is valid and starts with `oh_`
- [ ] All requests use HTTPS (not HTTP)
- [ ] Bearer token is in `Authorization` header, not query parameter
- [ ] Batch requests are chunked to endpoint limits (100 for concepts/FHIR, 50 for mappings, 25 for semantic)
- [ ] Unmapped codes are logged, not silently dropped
- [ ] OMOP domain (not FHIR resource type) is used for CDM table assignment
- [ ] Mapping quality is assessed (check `mapping_type` and `similarity_score` for semantic matches)
- [ ] Rate limit headers are monitored; 429 responses are retried with exponential backoff
- [ ] Mapping cache is built during development and applied locally in production
- [ ] Vocabulary release is pinned if reproducibility is required
- [ ] Error handling distinguishes between 4xx (don't retry) and 5xx (retry with backoff)
- [ ] FHIR responses are parsed as `OperationOutcome` (not REST envelope)
- [ ] Batch metering is accounted for in quota planning (per-item, not per-call)

## Resources

**Comprehensive navigation:** https://docs.omophub.com/llms.txt

**Critical documentation pages:**
1. [FHIR-to-OMOP Standardization Workflow](https://docs.omophub.com/guides/workflows/fhir-to-omop) — End-to-end ETL pattern with four-step resolution flow
2. [Batch & Performance Best Practices](https://docs.omophub.com/guides/production/batch-performance) — Deduplication, caching, and quota optimization
3. [FHIR Integration Guide](https://docs.omophub.com/guides/integration/fhir-integration) — Resolver vs Terminology Service, response shapes, use cases

---

> For additional documentation and navigation, see: https://docs.omophub.com/llms.txt