Skip to main content
Search for concepts by text. The SDK normalises three possible server response shapes ({ concepts: [...] }, legacy { data: [...] }, bare Concept[]) into a stable SearchResult - data.concepts is always a Concept[]:

Parameters

ParameterTypeDefaultDescription
query (positional)stringrequiredSearch query string
vocabularyIdsstring[]-Filter by vocabulary IDs
domainIdsstring[]-Filter by domain IDs
conceptClassIdsstring[]-Filter by concept class IDs
standardConcept'S' | 'C' | 'N'-Filter by standard concept flag
includeSynonymsbooleanfalseSearch synonyms too
includeInvalidbooleanfalseInclude invalid concepts
minScorenumber-Minimum relevance score (0.0–1.0)
exactMatchbooleanfalseRequire exact match
pagenumber1Page number (1-based)
pageSizenumber20Results per page
sortBy'relevance' | 'name' | 'code' | 'date'-Sort field
sortOrder'asc' | 'desc'-Sort order

Filter Combinations

Autocomplete

Get suggestions as the user types. The response is { query, suggestions: [...] } - each entry nests the concept under suggestion:

Pagination

Manual Pagination

Auto-Pagination Iterator

basicIter is an async generator that walks every page and yields one concept at a time:
Async iterators throw OMOPHubIteratorError on page failure (generators can’t gracefully yield discriminated errors). Use the eager basicAll(...) variant if you prefer accumulating errors as values. See Error Handling.

Eager Collect

POST-based search with relationship filters:

Advanced Search Parameters

ParameterTypeDefaultDescription
query (positional)stringrequiredSearch query string
vocabularyIdsstring[]-Filter by vocabulary IDs
domainIdsstring[]-Filter by domain IDs
conceptClassIdsstring[]-Filter by concept class IDs
standardConceptsOnlybooleanfalseOnly standard concepts
includeInvalidbooleanfalseInclude invalid concepts
relationshipFiltersRelationshipFilter[]-Relationship-based filters
pagenumber1Page number
pageSizenumber20Results per page

Relationship Filters

Embedding-based natural-language search. The SDK normalises the response so data.results is always a populated array:
With filters:

Semantic Search Parameters

ParameterTypeDefaultDescription
query (positional)stringrequiredNatural language query
vocabularyIdsstring[]-Filter by vocabularies
domainIdsstring[]-Filter by domains
standardConcept'S' | 'C' | 'N'-Filter by standard flag
conceptClassIdstring-Filter by concept class
thresholdnumber0.5Minimum similarity (0–1)
pagenumber1Page number
pageSizenumber20Results per page (max 100)

Semantic Search Iterator

Run up to 50 keyword searches in a single API call:
The per-search entries (BulkBasicSearchInput) use snake_case keys (search_id, vocabulary_ids, domain_ids, page_size) — they’re a direct pass-through of the API payload, not a camelCase options object. The outer defaults object follows the same convention. This is the only place in the SDK where snake_case appears at the TypeScript surface.

Bulk Basic Parameters

ParameterTypeDescription
searches (positional)BulkBasicSearchInput[]1–50 search inputs
searches[].search_idstringUnique correlation ID echoed in results
searches[].querystringSearch query
searches[].vocabulary_idsstring[]Per-search vocabulary filter
searches[].domain_idsstring[]Per-search domain filter
searches[].page_sizenumberPer-search result limit (1–100)
defaultsBulkSearchDefaultsShared defaults - per-search values override
Up to 25 semantic searches per call:

Find Similar Concepts

Find concepts similar to a reference. Provide exactly one of conceptId, conceptName, or query. The discriminated union enforces this at the type level; a runtime check defends against JS callers:
similar() uses a two-arg signature similar(options, requestOptions?) - its query XOR variant would otherwise collide with PerCallOptions.query (the escape-hatch params record). Pass signal, headers, or idempotencyKey via the second argument.

Similar Concepts Parameters

ParameterTypeDefaultDescription
conceptIdnumber-Source concept ID (XOR with conceptName/query)
conceptNamestring-Source concept name
querystring-Natural-language query
algorithm'semantic' | 'lexical' | 'hybrid''hybrid'Matching algorithm
similarityThresholdnumber0.7Minimum similarity (0–1)
pageSizenumber20Max results (server caps at 1000)
vocabularyIdsstring[]-Filter by vocabulary
domainIdsstring[]-Filter by domain
standardConcept'S' | 'C' | 'N'-Standard concept filter
includeInvalidboolean-Include invalid/deprecated
includeScoresboolean-Include detailed scoring
includeExplanationsboolean-Include similarity explanations

Algorithm Comparison

AlgorithmBest ForSpeed
semanticMeaning-based similaritySlower
lexicalText/string similarityFaster
hybridBalanced approachMedium