Skip to main content

Prerequisites

Installation

# Install from CRAN (recommended)
install.packages("omophub")

Quick Start

library(omophub)

client <- OMOPHubClient$new(api_key = "oh_xxxxxxxxx")

# Get a concept
concept <- client$concepts$get(201826)
print(concept$concept_name)  # "Type 2 diabetes mellitus"

# Search concepts
results <- client$search$basic("diabetes", page_size = 5)
for (concept in results$data) {
  cat(sprintf("%s: %s\n", concept$concept_id, concept$concept_name))
}

Configuration

client <- OMOPHubClient$new(
  api_key = "oh_xxx",
  timeout = 30,
  max_retries = 3,
  vocab_version = "2025.1"
)
You can also set your API key via environment variable:
export OMOPHUB_API_KEY=oh_xxxxxxxxx
# API key is read from environment
client <- OMOPHubClient$new()

Features

  • R6 Class Design - Familiar object-oriented interface for R users
  • Automatic Rate Limiting - Built-in request throttling to respect API limits
  • Automatic Retries - Transient errors are automatically retried with exponential backoff
  • Pagination Helpers - Easy iteration through large result sets
  • Tibble Integration - Results can be converted to tibbles for tidyverse workflows

Next Steps

Concepts

Get, batch, and explore concepts

Search

Search and autocomplete

Mappings

Map between vocabularies

Error Handling

Handle API errors gracefully