Concept Tools
These graph-backed tools provide read-only access to OMOP concepts, hierarchy, relationships, neighborhoods, paths, and standard mappings. They are backed by GraphService and require the omop-graph backend.
For free-text grounding see Resolver Tools. For direct lexical search with retrieval signals see Search Tools.
concept_get
Returns a single OMOP concept by its integer concept_id.
{"concept_id": 4119419}
Response (success):
{
"concept_id": 4119419,
"concept_name": "Malignant neoplasm of bronchus and lung",
"concept_code": "363358000",
"vocabulary_id": "SNOMED",
"domain_id": "Condition",
"concept_class_id": "Clinical Finding",
"standard_concept": true,
"valid_start_date": "2002-01-31",
"valid_end_date": "2099-12-31",
"invalid_reason": null
}
standard_concept is a boolean (true/false).
Returns NOT_FOUND if the concept ID does not exist.
concept_by_code
Returns concepts matching a vocabulary ID and concept code pair.
{"vocabulary_id": "SNOMED", "concept_code": "363358000"}
Response: {"concepts": [...]} — array of concept dicts in the same shape as concept_get.
concept_ancestors
Returns stored non-self ancestors up to minimum separation max_depth (default 5, allowed 0..20).
{"concept_id": 4119419, "max_depth": 3}
Response:
{
"concept_id": 4119419,
"ancestors": [
{"concept_id": 441484, "concept_name": "Neoplasm", "vocabulary_id": "SNOMED", "domain_id": "Condition", "standard_concept": true, "depth": 1},
{"concept_id": 4008453, "concept_name": "Disease", "vocabulary_id": "SNOMED", "domain_id": "Condition", "standard_concept": true, "depth": 2}
]
}
Ancestry is read directly from the stored OMOP closure, with non-self zero-separation ancestors retained. max_depth accepts 0..20 and measures stored minimum separation; invalid values are rejected. The response preserves ancestors and reports ancestry_source, distance_metric, effective max_depth and include_self=false. A zero-distance link does not imply interchangeability. Parent/child primitives expose direct graph relationships. Descendant results use the stored concept_ancestor table.
concept_descendants
Returns descendants from the stored concept_ancestor table (default depth 3, range 1..10). depth is the stored minimum separation, not a count of graph relationship hops. Results are ordered by depth and then concept ID. Use limit (default 50, range 1..500) and offset (default 0, minimum 0) to page through the stored ancestry. concept_class_ids optionally filters by exact concept_class_id before paging; total counts only matching descendants. For drug concepts, filter by classes such as ["Clinical Drug"] because greater depth does not mean greater drug specificity. Unknown class IDs are rejected.
{"concept_id": 1503297, "max_depth": 3, "limit": 50, "offset": 0, "concept_class_ids": ["Clinical Drug"]}
Response:
{
"concept_id": 441484,
"descendants": [
{"concept_id": 441485, "depth": 1},
{"concept_id": 441486, "depth": 1}
],
"total": 12,
"returned": 2,
"truncated": true,
"limit": 50,
"offset": 0,
"max_depth": 2
}
total counts all descendants within max_depth; truncated is true when more rows remain after the returned page. Results are ordered by minimum depth, then concept_id.
concept_relationships
Returns all direct relationships (edges) for one concept, grouped by direction. Edges are not filtered by domain, so cross-domain attribute edges (a Procedure's Has method → Observation, Has dir proc site → Spec Anatomic Site) are included.
{"concept_id": 4119419}
Response:
{
"concept_id": 4119419,
"outbound": [
{
"relationship_id": "Is a",
"predicate_kind": "HIERARCHY",
"target_concept_id": 441484,
"target_concept_name": "Neoplasm",
"valid": true
}
],
"inbound": [
{
"relationship_id": "Subsumes",
"predicate_kind": "HIERARCHY",
"source_concept_id": 4248978,
"source_concept_name": "Adenocarcinoma of lung",
"valid": true
}
]
}
predicate_kind is one of HIERARCHY, IDENTITY, ATTRIBUTE, COMPOSITION, ASSOCIATION.
concept_equivalency_path
Returns the shortest path between two concepts traversing only identity (and optionally hierarchy) relationships. Use this to find cross-vocabulary equivalences — for example, confirming that an ICD-10 code maps to the same SNOMED concept as a OMOP standard concept.
{
"source_id": 45542442,
"target_id": 4119419,
"allow_hierarchical_traversal": false,
"max_depth": 8
}
All parameters except source_id and target_id are optional.
allow_hierarchical_traversal=false (default): only IDENTITY predicates, including Maps to, Concept same_as, cross-vocabulary equivalence and replacement links. Concept poss_eq is an ASSOCIATION predicate and is excluded.
allow_hierarchical_traversal=true: also allows HIERARCHY predicates (Is a / Subsumes). A path may then step up or down the ancestry chain; the connection may be at a broader level of abstraction.
Response (same shape as concept_path):
{
"source_id": 45542442,
"target_id": 4119419,
"found": true,
"paths": [
{
"length": 1,
"steps": [
{
"subject_id": 45542442,
"subject_name": "Malignant neoplasm of bronchus and lung",
"predicate": "Maps to",
"predicate_kind": "IDENTITY",
"object_id": 4119419,
"object_name": "Malignant neoplasm of bronchus and lung"
}
]
}
]
}
Returns {"found": false, "paths": []} when no path exists within max_depth.
concept_path
Finds the shortest path between two concepts across all relationship types (HIERARCHY, IDENTITY, ATTRIBUTE, COMPOSITION, ASSOCIATION).
{
"source_id": 4119419,
"target_id": 441484,
"max_depth": 8,
"within_domain": true
}
within_domain=true (default) restricts traversal to edges where both endpoints share the same domain_id. Set false to allow cross-domain traversal via attribute relationships.
Response:
{
"source_id": 4119419,
"target_id": 441484,
"found": true,
"paths": [
{
"length": 1,
"steps": [
{
"subject_id": 4119419,
"subject_name": "Malignant neoplasm of bronchus and lung",
"predicate": "Is a",
"predicate_kind": "HIERARCHY",
"object_id": 441484,
"object_name": "Neoplasm"
}
]
}
]
}
Returns {"found": false, "paths": []} when no path exists within max_depth. When source_id == target_id, returns {"found": true, "paths": [{"length": 0, "steps": []}]}.
For cross-vocabulary equivalence queries, prefer concept_equivalency_path which restricts traversal to identity edges only.
concept_neighbors
Returns a bounded multi-hop neighborhood around one concept.
{
"concept_id": 4119419,
"max_depth": 2,
"predicate_kinds": ["HIERARCHY", "ATTRIBUTE"],
"max_nodes": 100,
"include_edges": true
}
All parameters except concept_id are optional.
predicate_kindsrestricts traversal to specific relationship families.- Edges are followed across domains (unlike
concept_path'swithin_domain=truedefault), so procedure attributes are reachable. max_depthis clamped to1..4.max_nodesis clamped to10..500.
Response:
{
"concept_id": 4119419,
"neighbor_count": 2,
"edge_count": 2,
"neighbors": [
{
"concept_id": 441484,
"concept_name": "Neoplasm",
"vocabulary_id": "SNOMED",
"domain_id": "Condition",
"concept_class_id": "Clinical Finding",
"standard_concept": true
}
],
"edges": [
{
"subject_id": 4119419,
"predicate_id": "Is a",
"predicate_kind": "HIERARCHY",
"object_id": 441484
}
],
"terminated_early": false,
"terminated_reason": null
}
Use this when you want a local relationship subgraph without committing to a single path or hierarchy-only traversal.
concept_associations
Enumerates classified ASSOCIATION edges such as therapeutic links between a regimen and its component drugs, or relationships between a drug and an indication. Use it when you need to discover associated concepts from one seed, filtered by subkind and with standard flags; concept_relationships lists every edge kind unfiltered. SNOMED defining attributes (finding and procedure sites, method, device, substance) are ATTRIBUTE, not ASSOCIATION: use concept_neighbors with predicate_kinds: ["ATTRIBUTE"] for those.
{
"concept_id": 1118084,
"direction": "out",
"predicate_subkinds": ["Therapeutic"],
"active_only": true,
"limit": 50
}
direction is out, in, or both. limit is clamped to 1..200. The result includes the related concept and relationship classification for each edge.
concept_extended_inheritance
Enumerates raw HIERARCHY-classified relationship edges, including single-hop taxonomic and categorical/classification links. This differs from concept_ancestors and concept_descendants, which use the OMOP transitive ancestor closure for strict ancestry.
{
"concept_id": 4119419,
"direction": "out",
"predicate_subkinds": ["Taxonomic - up"],
"active_only": true,
"limit": 50
}
Use the ancestor/descendant tools for the usual “what is this a kind of?” question. Use this tool when the edge-level classification graph itself matters, including cross-vocabulary or non-standard relationships. direction is out, in, or both; limit is clamped to 1..200.
concept_map_to_standard
Resolves a vocabulary/code pair through all IDENTITY-type relationship edges. These include Maps to value and Maps to unit, so standard value or unit targets can appear alongside the Maps to target. For Maps to targets alone, use concept_navigate_to_standard with the source concept ID.
{"vocabulary_id": "ICD10CM", "concept_code": "C34.1"}
Response:
{
"source": {"concept_id": 45542442, "vocabulary_id": "ICD10CM", "standard_concept": false, ...},
"standard_concepts": [
{"concept_id": 4119419, "vocabulary_id": "SNOMED", "standard_concept": true, ...}
]
}
standard_concepts is an empty list if no standard mapping exists. When the source concept is already standard, it is returned as-is in standard_concepts.