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

# Get Domains

> Retrieve all OMOP domains - Condition, Drug, Measurement, Observation, Procedure - that group medical concepts into high-level semantic categories.

This endpoint provides information about all domains available in the OMOP vocabulary system. Domains represent high-level categorizations that group medical concepts by their semantic meaning, such as Condition, Drug, Procedure, and others.

## Query Parameters

<ParamField query="include_stats" type="boolean" optional default="false">
  Include concept counts and vocabulary coverage for each domain
</ParamField>

<ParamField query="vocab_release" type="string" optional>
  Specific vocabulary release version to query

  <br />

  **Example:** `2025.1`
</ParamField>

## Response

<ResponseField name="domains" type="array">
  Array of domain objects with their properties

  <Expandable title="Domain Object">
    <ResponseField name="domain_id" type="string">
      Unique identifier for the domain (e.g., "Condition", "Drug", "Procedure")
    </ResponseField>

    <ResponseField name="domain_name" type="string">
      Human-readable name of the domain
    </ResponseField>

    <ResponseField name="domain_concept_id" type="integer">
      OMOP concept ID representing this domain
    </ResponseField>

    <ResponseField name="concept_count" type="integer" optional>
      Total number of concepts in this domain (when `include_stats=true`)
    </ResponseField>

    <ResponseField name="standard_concept_count" type="integer" optional>
      Number of standard concepts in this domain (when `include_stats=true`)
    </ResponseField>

    <ResponseField name="vocabulary_coverage" type="array" optional>
      List of vocabularies that contribute concepts to this domain (when `include_stats=true`)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="meta" type="object">
  Response metadata

  <Expandable title="Metadata Object">
    <ResponseField name="request_id" type="string">
      Unique identifier for this request
    </ResponseField>

    <ResponseField name="vocab_release" type="string">
      Vocabulary release version used for this response
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.omophub.com/v1/domains?include_stats=true" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.omophub.com/v1/domains?include_stats=true', {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const data = await response.json();
  console.log(`Found ${data.data.domains.length} domains`);

  // Display domains with concept counts
  data.data.domains.forEach(domain => {
    const count = domain.concept_count || 'N/A';
    console.log(`${domain.domain_name}: ${count} concepts`);
  });
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.omophub.com/v1/domains"
  params = {"include_stats": "true"}
  headers = {"Authorization": "Bearer YOUR_API_KEY"}

  response = requests.get(url, params=params, headers=headers)
  data = response.json()

  print(f"Found {len(data['data']['domains'])} domains")

  # Display domains sorted by concept count
  domains = data['data']['domains']
  for domain in sorted(domains, key=lambda d: d.get('concept_count', 0), reverse=True):
      count = domain.get('concept_count', 0)
      standard = domain.get('standard_concept_count', 0)
      print(f"{domain['domain_name']}: {count:,} total, {standard:,} standard")
  ```

  ```r R theme={null}
  library(omophub)

  client <- omophub_client()
  domains <- client$domains$list(include_stats = TRUE)

  # Display domains
  for (domain in domains$domains) {
    cat(sprintf("%s: %d concepts\n",
        domain$domain_name,
        domain$concept_count %||% 0))
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Basic Response theme={null}
  {
    "success": true,
    "data": {
      "domains": [
        {
          "domain_id": "Condition",
          "domain_name": "Condition",
          "domain_concept_id": 19
        },
        {
          "domain_id": "Drug",
          "domain_name": "Drug",
          "domain_concept_id": 13
        },
        {
          "domain_id": "Procedure",
          "domain_name": "Procedure",
          "domain_concept_id": 10
        },
        {
          "domain_id": "Measurement",
          "domain_name": "Measurement",
          "domain_concept_id": 21
        },
        {
          "domain_id": "Observation",
          "domain_name": "Observation",
          "domain_concept_id": 27
        }
      ]
    },
    "meta": {
      "request_id": "req_abc123",
      "vocab_release": "2025.1"
    }
  }
  ```

  ```json With Statistics (include_stats=true) theme={null}
  {
    "success": true,
    "data": {
      "domains": [
        {
          "domain_id": "Condition",
          "domain_name": "Condition",
          "domain_concept_id": 19,
          "concept_count": 845672,
          "standard_concept_count": 423891,
          "vocabulary_coverage": ["SNOMED", "ICD10CM", "ICD10", "ICD9CM", "Read"]
        },
        {
          "domain_id": "Drug",
          "domain_name": "Drug",
          "domain_concept_id": 13,
          "concept_count": 652341,
          "standard_concept_count": 198765,
          "vocabulary_coverage": ["RxNorm", "RxNorm Extension", "NDC", "SNOMED"]
        },
        {
          "domain_id": "Procedure",
          "domain_name": "Procedure",
          "domain_concept_id": 10,
          "concept_count": 456789,
          "standard_concept_count": 234561,
          "vocabulary_coverage": ["SNOMED", "ICD10PCS", "HCPCS"]
        },
        {
          "domain_id": "Measurement",
          "domain_name": "Measurement",
          "domain_concept_id": 21,
          "concept_count": 234567,
          "standard_concept_count": 156789,
          "vocabulary_coverage": ["LOINC", "SNOMED"]
        },
        {
          "domain_id": "Observation",
          "domain_name": "Observation",
          "domain_concept_id": 27,
          "concept_count": 123456,
          "standard_concept_count": 87654,
          "vocabulary_coverage": ["SNOMED", "LOINC"]
        }
      ]
    },
    "meta": {
      "request_id": "req_xyz789",
      "vocab_release": "2025.1"
    }
  }
  ```
</ResponseExample>

## Usage Examples

### Basic Domain List

Get all available domains:

```javascript theme={null}
const response = await fetch('/v1/domains', {
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});

const { data } = await response.json();
console.log(data.domains);
```

### Domains with Statistics

Get domains with concept counts and vocabulary coverage:

```javascript theme={null}
const response = await fetch('/v1/domains?include_stats=true', {
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});

const { data } = await response.json();

// Find the domain with the most concepts
const largestDomain = data.domains.reduce((max, domain) =>
  (domain.concept_count > (max.concept_count || 0)) ? domain : max
, {});

console.log(`Largest domain: ${largestDomain.domain_name} with ${largestDomain.concept_count} concepts`);
```

### Filter by Vocabulary Coverage

Find domains that include concepts from a specific vocabulary:

```javascript theme={null}
const response = await fetch('/v1/domains?include_stats=true', {
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});

const { data } = await response.json();

// Find domains with SNOMED concepts
const snomedDomains = data.domains.filter(domain =>
  domain.vocabulary_coverage?.includes('SNOMED')
);

console.log('Domains with SNOMED concepts:', snomedDomains.map(d => d.domain_name));
```

## Related Endpoints

* [Get Domain Concepts](/api-reference/domains/get-domain-concepts) - Concepts within a specific domain
* [Get Concept Classes](/api-reference/domains/get-concept-classes) - Concept class classifications
* [Search Concepts](/api-reference/search/basic-search) - Search within specific domains
* [Get Vocabularies](/api-reference/vocabulary/get-vocabularies) - Available vocabularies

## Notes

* Domains provide the highest level of semantic categorization in OMOP
* The most commonly used clinical domains are Condition, Drug, Procedure, and Measurement
* Use `include_stats=true` to get concept counts for capacity planning and analysis
* The `vocabulary_coverage` field shows which vocabularies contribute concepts to each domain
