> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omophub.com/llms.txt
> Use this file to discover all available pages before exploring further.

# R SDK - Working with OMOP domains

> Work with OMOP domains in the OMOPHub R SDK - list Condition, Drug, Measurement, and Procedure domains and pull their concepts directly into R tibbles.

## List All Domains

Get a list of all available OMOP domains:

```r theme={null}
# Basic list
result <- client$domains$list()
for (domain in result$data$domains) {
  print(domain$domain_id)
}

# Include concept counts and statistics
result <- client$domains$list(include_stats = TRUE)
for (domain in result$data$domains) {
  cat(sprintf("%s: %d concepts\n", domain$domain_id, domain$concept_count))
}
```

## Get Domain Concepts

Retrieve all concepts within a specific domain:

```r theme={null}
# Basic usage
result <- client$domains$concepts("Condition", page_size = 100)
for (concept in result$data$concepts) {
  cat(sprintf("%s (%d)\n", concept$concept_name, concept$concept_id))
}

# Filter by vocabulary
result <- client$domains$concepts(
  "Condition",
  vocabulary_ids = c("SNOMED", "ICD10CM"),
  page_size = 50
)

# Standard concepts only
result <- client$domains$concepts(
  "Drug",
  vocabulary_ids = "RxNorm",
  standard_only = TRUE,
  page_size = 100
)

# Include invalid/deprecated concepts
result <- client$domains$concepts(
  "Procedure",
  include_invalid = TRUE,
  page = 1,
  page_size = 50
)

# Pagination
cat(sprintf("Page %d of %d\n",
  result$meta$pagination$page,
  result$meta$pagination$total_pages
))
cat(sprintf("Total: %d concepts\n", result$meta$pagination$total_items))
```

### Parameters

| Parameter         | Type      | Default  | Description                                   |
| ----------------- | --------- | -------- | --------------------------------------------- |
| `domain_id`       | character | required | Domain identifier (e.g., "Condition", "Drug") |
| `vocabulary_ids`  | character | NULL     | Filter to specific vocabularies               |
| `standard_only`   | logical   | FALSE    | Return only standard concepts                 |
| `include_invalid` | logical   | TRUE     | Include deprecated concepts                   |
| `page`            | integer   | 1        | Page number                                   |
| `page_size`       | integer   | 50       | Results per page (max 1000)                   |
