curl -X GET "https://api.omophub.com/v1/search/facets?query=diabetes&vocabulary_ids=SNOMED,ICD10CM&bucket_limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
import { OMOPHub } from '@omophub/omophub-node';
// Not yet exposed as a dedicated SDK method - use the typed low-level helper.
const client = new OMOPHub();
const { data } = await client.get<unknown>('/search/facets', {
query: {
query: 'diabetes',
vocabulary_ids: 'SNOMED,ICD10CM',
bucket_limit: 20,
},
});
import requests
response = requests.get(
"https://api.omophub.com/v1/search/facets",
params={
"query": "diabetes",
"vocabulary_ids": "SNOMED,ICD10CM",
"bucket_limit": 20
},
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
data = response.json()
{
"success": true,
"data": {
"query": "diabetes",
"total_items": 312,
"facets": {
"vocabularies": [
{
"vocabulary_id": "SNOMED",
"vocabulary_name": "SNOMED CT",
"count": 245
},
{
"vocabulary_id": "ICD10CM",
"vocabulary_name": "ICD-10-CM",
"count": 67
}
],
"domains": [
{ "domain_id": "Condition", "domain_name": "Condition", "count": 198 },
{
"domain_id": "Observation",
"domain_name": "Observation",
"count": 87
},
{ "domain_id": "Drug", "domain_name": "Drug", "count": 27 }
],
"concept_classes": [
{
"concept_class_id": "Clinical Finding",
"concept_class_name": "Clinical Finding",
"count": 156
},
{
"concept_class_id": "Disorder",
"concept_class_name": "Disorder",
"count": 87
},
{
"concept_class_id": "Procedure",
"concept_class_name": "Procedure",
"count": 42
}
],
"years": [
{ "year": 2025, "count": 245 },
{ "year": 2024, "count": 67 }
]
},
"facet_metadata": {
"vocabularies": {
"total_buckets": 2,
"returned_buckets": 2,
"returned_count": 312,
"other_count": 0
},
"domains": {
"total_buckets": 3,
"returned_buckets": 3,
"returned_count": 312,
"other_count": 0
},
"concept_classes": {
"total_buckets": 4,
"returned_buckets": 3,
"returned_count": 285,
"other_count": 27
},
"years": {
"total_buckets": 2,
"returned_buckets": 2,
"returned_count": 312,
"other_count": 0
}
},
"facet_status": {
"partial": false,
"failed_facets": []
}
},
"meta": {
"request_id": "req_abc123",
"vocab_release": "2025.1"
}
}
Search Facets
Retrieve search facets for filtering medical terminology search results by vocabulary, domain, concept class, and valid-start year.
curl -X GET "https://api.omophub.com/v1/search/facets?query=diabetes&vocabulary_ids=SNOMED,ICD10CM&bucket_limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
import { OMOPHub } from '@omophub/omophub-node';
// Not yet exposed as a dedicated SDK method - use the typed low-level helper.
const client = new OMOPHub();
const { data } = await client.get<unknown>('/search/facets', {
query: {
query: 'diabetes',
vocabulary_ids: 'SNOMED,ICD10CM',
bucket_limit: 20,
},
});
import requests
response = requests.get(
"https://api.omophub.com/v1/search/facets",
params={
"query": "diabetes",
"vocabulary_ids": "SNOMED,ICD10CM",
"bucket_limit": 20
},
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
data = response.json()
{
"success": true,
"data": {
"query": "diabetes",
"total_items": 312,
"facets": {
"vocabularies": [
{
"vocabulary_id": "SNOMED",
"vocabulary_name": "SNOMED CT",
"count": 245
},
{
"vocabulary_id": "ICD10CM",
"vocabulary_name": "ICD-10-CM",
"count": 67
}
],
"domains": [
{ "domain_id": "Condition", "domain_name": "Condition", "count": 198 },
{
"domain_id": "Observation",
"domain_name": "Observation",
"count": 87
},
{ "domain_id": "Drug", "domain_name": "Drug", "count": 27 }
],
"concept_classes": [
{
"concept_class_id": "Clinical Finding",
"concept_class_name": "Clinical Finding",
"count": 156
},
{
"concept_class_id": "Disorder",
"concept_class_name": "Disorder",
"count": 87
},
{
"concept_class_id": "Procedure",
"concept_class_name": "Procedure",
"count": 42
}
],
"years": [
{ "year": 2025, "count": 245 },
{ "year": 2024, "count": 67 }
]
},
"facet_metadata": {
"vocabularies": {
"total_buckets": 2,
"returned_buckets": 2,
"returned_count": 312,
"other_count": 0
},
"domains": {
"total_buckets": 3,
"returned_buckets": 3,
"returned_count": 312,
"other_count": 0
},
"concept_classes": {
"total_buckets": 4,
"returned_buckets": 3,
"returned_count": 285,
"other_count": 27
},
"years": {
"total_buckets": 2,
"returned_buckets": 2,
"returned_count": 312,
"other_count": 0
}
},
"facet_status": {
"partial": false,
"failed_facets": []
}
},
"meta": {
"request_id": "req_abc123",
"vocab_release": "2025.1"
}
}
Overview
This endpoint provides faceted search capabilities for medical terminology, returning aggregated counts that can be used to filter and refine search results. Facets help users understand the distribution of concepts across different dimensions.Query Parameters
string
Search query to generate facets for. When provided, facets reflect the
distribution of matching concepts.
string
Filter facets to specific vocabularies (comma-separated)
Examples:
Examples:
SNOMED, ICD10CM,LOINC, RxNormstring
Filter facets to specific domains (comma-separated).
Examples:
Examples:
Condition, Drug,Measurementinteger
default:"20"
Maximum number of buckets returned for each facet category. Minimum:
1;
maximum: 100. Counts omitted by this limit are reported in the corresponding
facet metadata other_count.string
Specific vocabulary release version (defaults to latest)
Examples:
Examples:
2025.1, 2024.2Response
boolean
Indicates if the request was successful
object
Contains the faceted search results
Show data
Show data
string
The search query provided (empty string if none)
integer
Number of concepts represented by each successful facet category. For a
text query this uses the same candidate set and 10,050-result maximum as
/v1/search/concepts (50 exact-name, 5,000 name/code, and 5,000 synonym
candidates before duplicate removal).object
Object containing facet categories and their values
Show facets
Show facets
array
array
array
object
Reconciliation information keyed by facet category. Each category has
total_buckets, returned_buckets, returned_count, and other_count.
For every successful category,
returned_count + other_count = total_items.object
curl -X GET "https://api.omophub.com/v1/search/facets?query=diabetes&vocabulary_ids=SNOMED,ICD10CM&bucket_limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
import { OMOPHub } from '@omophub/omophub-node';
// Not yet exposed as a dedicated SDK method - use the typed low-level helper.
const client = new OMOPHub();
const { data } = await client.get<unknown>('/search/facets', {
query: {
query: 'diabetes',
vocabulary_ids: 'SNOMED,ICD10CM',
bucket_limit: 20,
},
});
import requests
response = requests.get(
"https://api.omophub.com/v1/search/facets",
params={
"query": "diabetes",
"vocabulary_ids": "SNOMED,ICD10CM",
"bucket_limit": 20
},
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
data = response.json()
{
"success": true,
"data": {
"query": "diabetes",
"total_items": 312,
"facets": {
"vocabularies": [
{
"vocabulary_id": "SNOMED",
"vocabulary_name": "SNOMED CT",
"count": 245
},
{
"vocabulary_id": "ICD10CM",
"vocabulary_name": "ICD-10-CM",
"count": 67
}
],
"domains": [
{ "domain_id": "Condition", "domain_name": "Condition", "count": 198 },
{
"domain_id": "Observation",
"domain_name": "Observation",
"count": 87
},
{ "domain_id": "Drug", "domain_name": "Drug", "count": 27 }
],
"concept_classes": [
{
"concept_class_id": "Clinical Finding",
"concept_class_name": "Clinical Finding",
"count": 156
},
{
"concept_class_id": "Disorder",
"concept_class_name": "Disorder",
"count": 87
},
{
"concept_class_id": "Procedure",
"concept_class_name": "Procedure",
"count": 42
}
],
"years": [
{ "year": 2025, "count": 245 },
{ "year": 2024, "count": 67 }
]
},
"facet_metadata": {
"vocabularies": {
"total_buckets": 2,
"returned_buckets": 2,
"returned_count": 312,
"other_count": 0
},
"domains": {
"total_buckets": 3,
"returned_buckets": 3,
"returned_count": 312,
"other_count": 0
},
"concept_classes": {
"total_buckets": 4,
"returned_buckets": 3,
"returned_count": 285,
"other_count": 27
},
"years": {
"total_buckets": 2,
"returned_buckets": 2,
"returned_count": 312,
"other_count": 0
}
},
"facet_status": {
"partial": false,
"failed_facets": []
}
},
"meta": {
"request_id": "req_abc123",
"vocab_release": "2025.1"
}
}
Usage Examples
Get Facets for a Search Query
GET /v1/search/facets?query=hypertension
Filter Facets by Vocabulary
GET /v1/search/facets?query=medication&vocabulary_ids=RxNorm,NDC
General Facets Without Query
Get overall distribution of concepts:GET /v1/search/facets
Facet Types
Vocabularies
Shows distribution across medical vocabularies (SNOMED, ICD10CM, LOINC, RxNorm, etc.). Use to filter searches to specific terminology systems.Domains
Shows distribution across clinical domains (Condition, Drug, Procedure, Measurement, etc.). Use to focus on specific types of medical concepts.Concept Classes
Shows distribution across concept classifications (Clinical Finding, Disorder, Ingredient, etc.). Provides more granular filtering than domains.Years
Shows the distribution by the year in each concept’svalid_start_date.
Reconciliation and failures
Facet buckets are built from one candidate set, so all four categories describe the sametotal_items. A successful response is therefore complete and reports
facet_status.partial: false. If candidate retrieval fails, the endpoint returns
an error instead of combining categories from different candidate sets.
When bucket_limit omits lower-frequency buckets, they are counted in
other_count; they are not silently discarded. Null or empty source values are
returned as an explicit Unknown/null bucket and are always retained within
the limit.
Related Endpoints
- Basic Search - Apply facet filters to search
- Advanced Search - Complex search with multiple filters
Was this page helpful?