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

# Check Concept Relations

> Check whether an OMOP concept has any relationships without loading the full relationship payload - a lightweight existence check for ETL validation.

## Overview

This lightweight endpoint quickly determines whether a concept has any relationships to other concepts. This is useful for UI components, validation logic, or filtering concepts that are isolated vs. connected in the terminology network.

## Path Parameters

**conceptId** `integer` *required*

The unique OMOP concept ID to check for relationships

## Query Parameters

**relationship\_types** `string`

Comma-separated list of relationship types to check (e.g., "Maps to", "Is a")

**vocabulary\_ids** `string`

Comma-separated list of vocabulary IDs to limit relationship check

**include\_reverse** `boolean` (default: true)

Include reverse relationships (concepts that relate to this concept)

**include\_invalid** `boolean` (default: true)

Include relationships to invalid/deprecated concepts

**vocab\_release** `string`

Specific vocabulary release version (e.g., "2024.1")

## Response

**success** `boolean` *required*

Indicates whether the request was successful

**data** `object` *required*

Response data containing relationship check results

**data**

**concept\_id** `integer`

The concept ID that was checked

**has\_relations** `boolean`

Whether this concept has any relationships matching the specified criteria

**relation\_summary** `object`

Summary information about relationships (when has\_relations is true)

**relation\_summary**

**total\_count** `integer`

Total number of relationships found

**outbound\_count** `integer`

Number of outbound relationships (from this concept)

**inbound\_count** `integer`

Number of inbound relationships (to this concept)

**relationship\_types** `array`

Array of relationship types found (up to 10 most common)

**connected\_vocabularies** `array`

Array of vocabularies that have related concepts (up to 10)

**has\_standard\_mappings** `boolean`

Whether concept has mappings to standard concepts

**checks\_performed** `object`

Details about what was checked

**checks\_performed**

**included\_relationship\_types** `array`

Relationship types included in the check

**included\_vocabularies** `array`

Vocabularies included in the check

**included\_reverse\_relations** `boolean`

Whether reverse relationships were checked

**included\_invalid\_relations** `boolean`

Whether invalid relationships were checked

**meta** `object` *required*

Response metadata and API information

**meta**

**request\_id** `string`

Unique request identifier for debugging

**timestamp** `string`

ISO 8601 timestamp of the response

**vocab\_release** `string`

Vocabulary release version used

```bash cURL theme={null}
curl -X GET "https://api.omophub.com/v1/concepts/201826/relations/any" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

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

concept_id = 201826  # Type 2 diabetes
url = f"https://api.omophub.com/v1/concepts/{concept_id}/relations/any"
params = {
    "relationship_types": "Maps to,Is a",
    "include_reverse": True
}

headers = {
    "Authorization": "Bearer YOUR_API_KEY"
}

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

if data['data']['has_relations']:
    print(f"✓ Concept {concept_id} has relationships")
    summary = data['data']['relation_summary']
    print(f"  - Total: {summary['total_count']}")
    print(f"  - Standard mappings: {'Yes' if summary['has_standard_mappings'] else 'No'}")
else:
    print(f"✗ Concept {concept_id} has no relationships")
```

```ts TypeScript theme={null}
import { OMOPHub } from '@omophub/omophub-node';

// Not yet exposed as a dedicated SDK method - use the typed low-level helper.
const client = new OMOPHub();

interface RelationCheck {
  has_relations: boolean;
  relation_summary: { total_count: number; relationship_types: string[] };
}

const conceptId = 201826; // Type 2 diabetes
const { data } = await client.get<RelationCheck>(
  `/concepts/${conceptId}/relations/any`
);

if (data?.has_relations) {
  console.log(
    `Concept ${conceptId} has ${data.relation_summary.total_count} relationships`
  );
  console.log('Relationship types:', data.relation_summary.relationship_types);
} else {
  console.log(`Concept ${conceptId} has no relationships`);
}
```

```bash cURL (filtered check) theme={null}
curl -X GET "https://api.omophub.com/v1/concepts/201826/relations/any?relationship_types=Maps%20to&vocabulary_ids=ICD10CM,ICD9CM" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```python Python (batch validation) theme={null}
import requests

def validate_concept_connectivity(concept_ids):
    """
    Check which concepts have standard mappings for data quality validation
    """
    connected_concepts = []
    isolated_concepts = []

    for concept_id in concept_ids:
        url = f"https://api.omophub.com/v1/concepts/{concept_id}/relations/any"
        params = {
            "relationship_types": "Maps to",
            "vocabulary_ids": "SNOMED,ICD10CM,ICD9CM"
        }

        response = requests.get(url, params=params, headers={
            "Authorization": "Bearer YOUR_API_KEY"
        })

        data = response.json()
        concept_data = data['data']

        if concept_data['has_relations'] and concept_data['relation_summary']['has_standard_mappings']:
            connected_concepts.append({
                'concept_id': concept_id,
                'total_mappings': concept_data['relation_summary']['total_count'],
                'vocabularies': concept_data['relation_summary']['connected_vocabularies']
            })
        else:
            isolated_concepts.append(concept_id)

    print(f"Connected concepts: {len(connected_concepts)}")
    print(f"Isolated concepts: {len(isolated_concepts)}")

    return connected_concepts, isolated_concepts

# Validate a set of cardiovascular concepts
cardiovascular_concepts = [201826, 4182210, 313217, 320128, 434557]
connected, isolated = validate_concept_connectivity(cardiovascular_concepts)

for concept in connected[:3]:  # Show top 3
    print(f"Concept {concept['concept_id']}: {concept['total_mappings']} mappings across {len(concept['vocabularies'])} vocabularies")
```

```json theme={null}
{
  "success": true,
  "data": {
    "concept_id": 201826,
    "has_relations": true,
    "relation_summary": {
      "total_count": 15,
      "outbound_count": 8,
      "inbound_count": 7,
      "relationship_types": ["Maps to", "Is a", "Has finding site", "May be a"],
      "connected_vocabularies": ["SNOMED", "ICD10CM", "ICD9CM"],
      "has_standard_mappings": true
    },
    "checks_performed": {
      "included_relationship_types": ["all"],
      "included_vocabularies": ["all"],
      "included_reverse_relations": true,
      "included_invalid_relations": false
    }
  },
  "meta": {
    "request_id": "req_check_relations_123",
    "timestamp": "2024-12-22T10:00:00Z",
    "vocab_release": "2025.2"
  }
}
```

## Usage Examples

### Simple Relationship Check

Check if a concept has any relationships:

```bash theme={null}
curl -X GET "https://api.omophub.com/v1/concepts/201826/relations/any" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Check for Standard Mappings

Check if concept has "Maps to" relationships:

```bash theme={null}
curl -G "https://api.omophub.com/v1/concepts/201826/relations/any" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "relationship_types=Maps to"
```

### Check Cross-Vocabulary Relations

Check relationships to specific vocabularies:

```bash theme={null}
curl -X GET "https://api.omophub.com/v1/concepts/201826/relations/any?vocabulary_ids=ICD10CM,ICD9CM" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Batch Checking in Applications

Use in loops or batch processing to filter connected concepts:

```ts TypeScript theme={null}
interface RelCheck {
  has_relations: boolean;
  relation_summary: { total_count: number; has_standard_mappings: boolean };
}

const conceptIds = [201826, 4182210, 313217];
const connectedConcepts: Array<{ concept_id: number; relation_count: number }> =
  [];

for (const id of conceptIds) {
  const { data } = await client.get<RelCheck>(`/concepts/${id}/relations/any`);

  if (data?.has_relations && data.relation_summary.has_standard_mappings) {
    connectedConcepts.push({
      concept_id: id,
      relation_count: data.relation_summary.total_count,
    });
  }
}
```

## Important Notes

* **Performance optimized** - Much faster than fetching full relationship data
* **Filtering support** - All the same filters as the full relations endpoint
* **UI integration** - Perfect for showing relationship icons or badges
* **Batch processing** - Ideal for filtering large concept lists
* **Standard mappings** - The `has_standard_mappings` flag is useful for data quality checks

## Related Endpoints

* [Get Concept Relationships](https://docs.omophub.com/api-reference/relationships/get-concept-relationships.md) - Get full relationship data
* [Batch Hierarchy Queries](https://docs.omophub.com/api-reference/concepts/batch-hierarchy-queries.md) - Check relationships for multiple concepts


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.