/** * @fileoverview Free-text → ontology-term matcher for observation variables. * The default backend scores each variable record against the query using * substring + synonym matching; no network I/O of its own (variable lists * are fetched upstream by the caller). Designed to be swappable — embedding- * backed implementations can replace this one without changing the tool * surface. * * @module services/ontology-resolver/ontology-resolver */ import type { OntologyCandidate, ResolveOptions } from './types.js'; /** * Loose shape of a BrAPI observation-variable record. Every field is * optional because server implementations vary in what they populate. * Trait subobject fields follow BrAPI v2.1 naming (`traitName`, * `traitDescription`); both legacy `name` / `description` aliases are * accepted for older or non-conformant servers. */ export interface VariableLike { method?: { methodName?: string; }; observationVariableDbId?: string; observationVariableName?: string; observationVariablePUI?: string; ontologyDbId?: string; ontologyName?: string; scale?: { scaleName?: string; }; synonyms?: string[] | undefined; trait?: { traitClass?: string; /** Legacy alias for `traitDescription` — accepted for older servers. */ description?: string; /** Legacy alias for `traitName` — accepted for older servers. */ name?: string; synonyms?: string[]; traitDescription?: string; traitName?: string; }; } export declare class OntologyResolver { /** * Rank a pool of variables against a free-text query. Returns up to * `limit` candidates sorted by match quality (exact PUI > name match > * synonym match). When the query is empty, returns the pool unchanged * (up to the limit). */ match(query: string, variables: readonly VariableLike[], options?: ResolveOptions): OntologyCandidate[]; private scoreOne; } export declare function initOntologyResolver(): void; export declare function getOntologyResolver(): OntologyResolver; export declare function resetOntologyResolver(): void; //# sourceMappingURL=ontology-resolver.d.ts.map