Skip to main content
Get up and running with the OMOPHub API in 5 minutes.

Prerequisites

You’ll need:

Step 1: Install the SDK

pip install omophub

Step 2: Set Up Authentication

import omophub

# Option 1: environment variable (recommended)
# export OMOPHUB_API_KEY="oh_xxxxxxxxx"
client = omophub.OMOPHub()

# Option 2: pass directly
client = omophub.OMOPHub(api_key="oh_xxxxxxxxx")
Never hardcode your API key in source code. Use environment variables or a secrets manager in production.

Step 3: Search for Concepts

Search across 11M+ concepts by keyword, then by meaning:
# Keyword search
results = client.search.basic("hypertension", page_size=5)
for concept in results["concepts"]:
    print(f"{concept['concept_id']}: {concept['concept_name']} ({concept['vocabulary_id']})")

# Semantic search - find concepts by clinical meaning, not just keyword match
results = client.search.semantic("high blood pressure that comes and goes", page_size=5)
for concept in results["concepts"]:
    print(f"{concept['concept_id']}: {concept['concept_name']}")
Semantic search uses neural embeddings to match by clinical meaning. Try it when keyword search doesn’t find what you need - it handles synonyms, abbreviations, and natural-language descriptions.

Step 4: Get Concept Details

Look up a specific concept by its OMOP concept_id:
concept = client.concepts.get(201826)
print(f"Name:       {concept['concept_name']}")        # Type 2 diabetes mellitus
print(f"Code:       {concept['concept_code']}")         # 44054006
print(f"Vocabulary: {concept['vocabulary_id']}")        # SNOMED
print(f"Domain:     {concept['domain_id']}")            # Condition
print(f"Standard:   {concept['standard_concept']}")     # S

Step 5: Navigate Hierarchies

Walk the ancestor / descendant tree to expand a concept set:
# Ancestors (parents)
result = client.hierarchy.ancestors(201826, max_levels=2)
for ancestor in result["ancestors"]:
    level = ancestor.get("hierarchy_level", 0)
    print(f"{'  ' * level}{ancestor['concept_name']}")

# Descendants (children)
result = client.hierarchy.descendants(201826, max_levels=1)
print(f"\n{len(result['descendants'])} child concepts")

Step 6: Map Between Vocabularies

Translate codes across SNOMED, ICD-10, LOINC, RxNorm, and every other OMOP vocabulary:
# Map SNOMED "Type 2 diabetes" to ICD-10-CM
result = client.mappings.get(201826, target_vocabulary="ICD10CM")
for m in result["data"]["mappings"]:
    print(f"{m['relationship_id']}: {m['target_concept_name']} "
          f"({m['target_vocabulary_id']}: {m['target_concept_code']})")
For ETL workloads, the batch endpoint client.mappings.map(target_vocabulary="...", source_concepts=[...]) maps up to 100 concepts per request and counts as a single API call against your quota.

Step 7: Resolve a FHIR Code to OMOP

This is the single call no other terminology server offers - send a FHIR Coding (system URI + code), get back the OMOP standard concept, domain, mapping type, and the exact CDM target table for ETL placement:
result = client.fhir.resolve(
    system="http://snomed.info/sct",
    code="44054006",
    resource_type="Condition",
)
res = result["resolution"]
print(f"Standard concept: {res['standard_concept']['concept_id']} - {res['standard_concept']['concept_name']}")
print(f"Domain:           {res['standard_concept']['domain_id']}")
print(f"Target table:     {res['target_table']}")         # condition_occurrence
print(f"Mapping type:     {res['mapping_type']}")         # direct
The Resolver handles URI → OMOP vocabulary lookup, Maps to traversal for non-standard codes, and semantic fallback for display-text-only inputs in a single call. For the full response shape, batch variants, and the CodeableConcept endpoint, see the FHIR Integration guide.

Next Steps

FHIR Integration

The complete FHIR story - Resolver for ETL, Terminology Service for clients, and when to use which.

FHIR Terminology Service

$lookup, $translate, $validate-code, $expand, $subsumes reference.

AI & MCP Server

Connect Claude, Cursor, or VS Code to medical vocabularies via the MCP Server.

Python SDK

Full SDK reference: search, concepts, hierarchy, mappings, FHIR resolver.

R SDK

R6 client for vocabulary access in R workflows.

API Reference

Complete endpoint documentation with request / response schemas.

Workflows

Real-world workflows: clinical coding, phenotype development, lab normalization, and more.

Common Issues

  • Check that your API key is correct and starts with oh_
  • Ensure the Authorization: Bearer <key> header format is exact
  • Verify the key at dashboard.omophub.com/api-keys
  • Free tier: 2 requests per second, monthly call quota per plan
  • Use batch endpoints (concepts, mappings, semantic search) to reduce call count - each batch counts as one API call
  • Respect the Retry-After response header
  • See Rate Limits for plan-specific limits
  • Try broader search terms or remove filters
  • Use semantic search for natural-language queries (Step 3)
  • Check vocabulary_id spelling - it’s SNOMED, not SNOMED-CT; ICD10CM, not ICD-10-CM
  • Confirm the target vocabulary is currently supported via client.vocabularies.list()