> ## 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.

# Working with OMOP domains

> Work with OMOP domains in the OMOPHub Node.js SDK - list Condition, Drug, Measurement, and Procedure domains and query their concepts from TypeScript.

## List All Domains

Get the OMOP domain catalog. The result is wrapped under `domains` and the endpoint is **not paginated server-side** - the full \~20-row catalog comes back in a single call:

```ts theme={null}
const { data, error } = await client.domains.list();
if (error) throw new Error(error.message);

for (const domain of data.domains) {
  console.log(domain.domain_id);
}
```

Include concept counts and stats:

```ts theme={null}
const { data } = await client.domains.list({ includeStats: true });
for (const domain of data?.domains ?? []) {
  console.log(`${domain.domain_id}: ${domain.stats?.total_concepts ?? 'N/A'} concepts`);
}
```

## Get Domain Concepts

Retrieve concepts within a specific domain. Wrapped under `concepts`; pagination on outer `meta`:

```ts theme={null}
const { data, error, meta } = await client.domains.concepts('Condition', {
  pageSize: 100,
});
if (error) throw new Error(error.message);

for (const concept of data.concepts) {
  console.log(`${concept.concept_name} (${concept.concept_id})`);
}

console.log(`Page ${meta?.pagination?.page} of ${meta?.pagination?.total_pages}`);
console.log(`Total: ${meta?.pagination?.total_items} concepts`);
```

Filter by vocabulary:

```ts theme={null}
await client.domains.concepts('Condition', {
  vocabularyIds: ['SNOMED', 'ICD10CM'],
  pageSize: 50,
});
```

Standard concepts only:

```ts theme={null}
await client.domains.concepts('Drug', {
  vocabularyIds: ['RxNorm'],
  standardOnly: true,
  pageSize: 100,
});
```

Include invalid / deprecated concepts:

```ts theme={null}
await client.domains.concepts('Procedure', {
  includeInvalid: true,
  page: 1,
  pageSize: 50,
});
```

### Parameters

| Parameter               | Type      | Default  | Description                                      |
| ----------------------- | --------- | -------- | ------------------------------------------------ |
| `domainId` (positional) | string    | required | Domain identifier (e.g. `'Condition'`, `'Drug'`) |
| `vocabularyIds`         | string\[] | -        | Filter to specific vocabularies                  |
| `standardOnly`          | boolean   | false    | Only return standard concepts                    |
| `includeInvalid`        | boolean   | false    | Include deprecated concepts                      |
| `page`                  | number    | 1        | Page number                                      |
| `pageSize`              | number    | 50       | Results per page (max 1000)                      |

<Note>
  `client.domains.list()` returns the canonical OMOP domain catalog from `GET /domains`. The vocabulary-scoped version `client.vocabularies.domains()` queries `GET /vocabularies/domains` - different endpoint, different shape.
</Note>
