phenoml 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/construe/client/Client.d.ts +129 -0
  3. package/dist/cjs/api/resources/construe/client/Client.js +429 -0
  4. package/dist/cjs/api/resources/construe/client/requests/GetConstrueCodesCodesystemCodeIdRequest.d.ts +10 -0
  5. package/dist/cjs/api/resources/construe/client/requests/GetConstrueCodesCodesystemCodeIdRequest.js +3 -0
  6. package/dist/cjs/api/resources/construe/client/requests/GetConstrueCodesCodesystemRequest.d.ts +16 -0
  7. package/dist/cjs/api/resources/construe/client/requests/GetConstrueCodesCodesystemRequest.js +3 -0
  8. package/dist/cjs/api/resources/construe/client/requests/GetConstrueCodesCodesystemSearchSemanticRequest.d.ts +16 -0
  9. package/dist/cjs/api/resources/construe/client/requests/GetConstrueCodesCodesystemSearchSemanticRequest.js +3 -0
  10. package/dist/cjs/api/resources/construe/client/requests/GetConstrueCodesCodesystemSearchTextRequest.d.ts +16 -0
  11. package/dist/cjs/api/resources/construe/client/requests/GetConstrueCodesCodesystemSearchTextRequest.js +3 -0
  12. package/dist/cjs/api/resources/construe/client/requests/index.d.ts +4 -0
  13. package/dist/cjs/api/resources/construe/errors/NotFoundError.d.ts +5 -0
  14. package/dist/cjs/api/resources/construe/errors/NotFoundError.js +50 -0
  15. package/dist/cjs/api/resources/construe/errors/NotImplementedError.d.ts +5 -0
  16. package/dist/cjs/api/resources/construe/errors/NotImplementedError.js +50 -0
  17. package/dist/cjs/api/resources/construe/errors/ServiceUnavailableError.d.ts +5 -0
  18. package/dist/cjs/api/resources/construe/errors/ServiceUnavailableError.js +50 -0
  19. package/dist/cjs/api/resources/construe/errors/index.d.ts +3 -0
  20. package/dist/cjs/api/resources/construe/errors/index.js +3 -0
  21. package/dist/cjs/api/resources/construe/types/CodeResponse.d.ts +8 -0
  22. package/dist/cjs/api/resources/construe/types/CodeResponse.js +3 -0
  23. package/dist/cjs/api/resources/construe/types/CodeSystemDetails.d.ts +10 -0
  24. package/dist/cjs/api/resources/construe/types/CodeSystemDetails.js +3 -0
  25. package/dist/cjs/api/resources/construe/types/CodeSystemInfo.d.ts +6 -0
  26. package/dist/cjs/api/resources/construe/types/CodeSystemInfo.js +3 -0
  27. package/dist/cjs/api/resources/construe/types/GetCodeResponse.d.ts +10 -0
  28. package/dist/cjs/api/resources/construe/types/GetCodeResponse.js +3 -0
  29. package/dist/cjs/api/resources/construe/types/ListCodeSystemsResponse.d.ts +4 -0
  30. package/dist/cjs/api/resources/construe/types/ListCodeSystemsResponse.js +3 -0
  31. package/dist/cjs/api/resources/construe/types/ListCodesResponse.d.ts +9 -0
  32. package/dist/cjs/api/resources/construe/types/ListCodesResponse.js +3 -0
  33. package/dist/cjs/api/resources/construe/types/SemanticSearchResponse.d.ts +6 -0
  34. package/dist/cjs/api/resources/construe/types/SemanticSearchResponse.js +3 -0
  35. package/dist/cjs/api/resources/construe/types/SemanticSearchResult.d.ts +4 -0
  36. package/dist/cjs/api/resources/construe/types/SemanticSearchResult.js +3 -0
  37. package/dist/cjs/api/resources/construe/types/TextSearchResponse.d.ts +8 -0
  38. package/dist/cjs/api/resources/construe/types/TextSearchResponse.js +3 -0
  39. package/dist/cjs/api/resources/construe/types/TextSearchResult.d.ts +4 -0
  40. package/dist/cjs/api/resources/construe/types/TextSearchResult.js +3 -0
  41. package/dist/cjs/api/resources/construe/types/index.d.ts +10 -0
  42. package/dist/cjs/api/resources/construe/types/index.js +10 -0
  43. package/dist/cjs/version.d.ts +1 -1
  44. package/dist/cjs/version.js +1 -1
  45. package/dist/esm/Client.mjs +2 -2
  46. package/dist/esm/api/resources/construe/client/Client.d.mts +129 -0
  47. package/dist/esm/api/resources/construe/client/Client.mjs +429 -0
  48. package/dist/esm/api/resources/construe/client/requests/GetConstrueCodesCodesystemCodeIdRequest.d.mts +10 -0
  49. package/dist/esm/api/resources/construe/client/requests/GetConstrueCodesCodesystemCodeIdRequest.mjs +2 -0
  50. package/dist/esm/api/resources/construe/client/requests/GetConstrueCodesCodesystemRequest.d.mts +16 -0
  51. package/dist/esm/api/resources/construe/client/requests/GetConstrueCodesCodesystemRequest.mjs +2 -0
  52. package/dist/esm/api/resources/construe/client/requests/GetConstrueCodesCodesystemSearchSemanticRequest.d.mts +16 -0
  53. package/dist/esm/api/resources/construe/client/requests/GetConstrueCodesCodesystemSearchSemanticRequest.mjs +2 -0
  54. package/dist/esm/api/resources/construe/client/requests/GetConstrueCodesCodesystemSearchTextRequest.d.mts +16 -0
  55. package/dist/esm/api/resources/construe/client/requests/GetConstrueCodesCodesystemSearchTextRequest.mjs +2 -0
  56. package/dist/esm/api/resources/construe/client/requests/index.d.mts +4 -0
  57. package/dist/esm/api/resources/construe/errors/NotFoundError.d.mts +5 -0
  58. package/dist/esm/api/resources/construe/errors/NotFoundError.mjs +13 -0
  59. package/dist/esm/api/resources/construe/errors/NotImplementedError.d.mts +5 -0
  60. package/dist/esm/api/resources/construe/errors/NotImplementedError.mjs +13 -0
  61. package/dist/esm/api/resources/construe/errors/ServiceUnavailableError.d.mts +5 -0
  62. package/dist/esm/api/resources/construe/errors/ServiceUnavailableError.mjs +13 -0
  63. package/dist/esm/api/resources/construe/errors/index.d.mts +3 -0
  64. package/dist/esm/api/resources/construe/errors/index.mjs +3 -0
  65. package/dist/esm/api/resources/construe/types/CodeResponse.d.mts +8 -0
  66. package/dist/esm/api/resources/construe/types/CodeResponse.mjs +2 -0
  67. package/dist/esm/api/resources/construe/types/CodeSystemDetails.d.mts +10 -0
  68. package/dist/esm/api/resources/construe/types/CodeSystemDetails.mjs +2 -0
  69. package/dist/esm/api/resources/construe/types/CodeSystemInfo.d.mts +6 -0
  70. package/dist/esm/api/resources/construe/types/CodeSystemInfo.mjs +2 -0
  71. package/dist/esm/api/resources/construe/types/GetCodeResponse.d.mts +10 -0
  72. package/dist/esm/api/resources/construe/types/GetCodeResponse.mjs +2 -0
  73. package/dist/esm/api/resources/construe/types/ListCodeSystemsResponse.d.mts +4 -0
  74. package/dist/esm/api/resources/construe/types/ListCodeSystemsResponse.mjs +2 -0
  75. package/dist/esm/api/resources/construe/types/ListCodesResponse.d.mts +9 -0
  76. package/dist/esm/api/resources/construe/types/ListCodesResponse.mjs +2 -0
  77. package/dist/esm/api/resources/construe/types/SemanticSearchResponse.d.mts +6 -0
  78. package/dist/esm/api/resources/construe/types/SemanticSearchResponse.mjs +2 -0
  79. package/dist/esm/api/resources/construe/types/SemanticSearchResult.d.mts +4 -0
  80. package/dist/esm/api/resources/construe/types/SemanticSearchResult.mjs +2 -0
  81. package/dist/esm/api/resources/construe/types/TextSearchResponse.d.mts +8 -0
  82. package/dist/esm/api/resources/construe/types/TextSearchResponse.mjs +2 -0
  83. package/dist/esm/api/resources/construe/types/TextSearchResult.d.mts +4 -0
  84. package/dist/esm/api/resources/construe/types/TextSearchResult.mjs +2 -0
  85. package/dist/esm/api/resources/construe/types/index.d.mts +10 -0
  86. package/dist/esm/api/resources/construe/types/index.mjs +10 -0
  87. package/dist/esm/version.d.mts +1 -1
  88. package/dist/esm/version.mjs +1 -1
  89. package/package.json +1 -1
  90. package/reference.md +392 -0
@@ -174,6 +174,435 @@ export class Construe {
174
174
  }
175
175
  });
176
176
  }
177
+ /**
178
+ * Returns metadata about all available code systems including built-in and custom systems.
179
+ *
180
+ * @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
181
+ *
182
+ * @throws {@link phenoml.construe.UnauthorizedError}
183
+ * @throws {@link phenoml.construe.InternalServerError}
184
+ *
185
+ * @example
186
+ * await client.construe.listAvailableCodeSystems()
187
+ */
188
+ listAvailableCodeSystems(requestOptions) {
189
+ return core.HttpResponsePromise.fromPromise(this.__listAvailableCodeSystems(requestOptions));
190
+ }
191
+ __listAvailableCodeSystems(requestOptions) {
192
+ return __awaiter(this, void 0, void 0, function* () {
193
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
194
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
195
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
196
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "construe/codes/systems"),
197
+ method: "GET",
198
+ headers: _headers,
199
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
200
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
201
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
202
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
203
+ });
204
+ if (_response.ok) {
205
+ return {
206
+ data: _response.body,
207
+ rawResponse: _response.rawResponse,
208
+ };
209
+ }
210
+ if (_response.error.reason === "status-code") {
211
+ switch (_response.error.statusCode) {
212
+ case 401:
213
+ throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
214
+ case 500:
215
+ throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
216
+ default:
217
+ throw new errors.phenomlError({
218
+ statusCode: _response.error.statusCode,
219
+ body: _response.error.body,
220
+ rawResponse: _response.rawResponse,
221
+ });
222
+ }
223
+ }
224
+ switch (_response.error.reason) {
225
+ case "non-json":
226
+ throw new errors.phenomlError({
227
+ statusCode: _response.error.statusCode,
228
+ body: _response.error.rawBody,
229
+ rawResponse: _response.rawResponse,
230
+ });
231
+ case "timeout":
232
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling GET /construe/codes/systems.");
233
+ case "unknown":
234
+ throw new errors.phenomlError({
235
+ message: _response.error.errorMessage,
236
+ rawResponse: _response.rawResponse,
237
+ });
238
+ }
239
+ });
240
+ }
241
+ /**
242
+ * Returns a paginated list of all codes in the specified code system.
243
+ *
244
+ * @param {string} codesystem - Code system name (e.g., "ICD-10-CM", "SNOMED_CT_US_LITE")
245
+ * @param {phenoml.construe.GetConstrueCodesCodesystemRequest} request
246
+ * @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
247
+ *
248
+ * @throws {@link phenoml.construe.BadRequestError}
249
+ * @throws {@link phenoml.construe.UnauthorizedError}
250
+ * @throws {@link phenoml.construe.NotFoundError}
251
+ * @throws {@link phenoml.construe.InternalServerError}
252
+ *
253
+ * @example
254
+ * await client.construe.listCodesInACodeSystem("ICD-10-CM", {
255
+ * version: "2025",
256
+ * cursor: "cursor",
257
+ * limit: 1
258
+ * })
259
+ */
260
+ listCodesInACodeSystem(codesystem, request = {}, requestOptions) {
261
+ return core.HttpResponsePromise.fromPromise(this.__listCodesInACodeSystem(codesystem, request, requestOptions));
262
+ }
263
+ __listCodesInACodeSystem(codesystem_1) {
264
+ return __awaiter(this, arguments, void 0, function* (codesystem, request = {}, requestOptions) {
265
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
266
+ const { version, cursor, limit } = request;
267
+ const _queryParams = {};
268
+ if (version != null) {
269
+ _queryParams.version = version;
270
+ }
271
+ if (cursor != null) {
272
+ _queryParams.cursor = cursor;
273
+ }
274
+ if (limit != null) {
275
+ _queryParams.limit = limit.toString();
276
+ }
277
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
278
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
279
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `construe/codes/${core.url.encodePathParam(codesystem)}`),
280
+ method: "GET",
281
+ headers: _headers,
282
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
283
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
284
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
285
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
286
+ });
287
+ if (_response.ok) {
288
+ return { data: _response.body, rawResponse: _response.rawResponse };
289
+ }
290
+ if (_response.error.reason === "status-code") {
291
+ switch (_response.error.statusCode) {
292
+ case 400:
293
+ throw new phenoml.construe.BadRequestError(_response.error.body, _response.rawResponse);
294
+ case 401:
295
+ throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
296
+ case 404:
297
+ throw new phenoml.construe.NotFoundError(_response.error.body, _response.rawResponse);
298
+ case 500:
299
+ throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
300
+ default:
301
+ throw new errors.phenomlError({
302
+ statusCode: _response.error.statusCode,
303
+ body: _response.error.body,
304
+ rawResponse: _response.rawResponse,
305
+ });
306
+ }
307
+ }
308
+ switch (_response.error.reason) {
309
+ case "non-json":
310
+ throw new errors.phenomlError({
311
+ statusCode: _response.error.statusCode,
312
+ body: _response.error.rawBody,
313
+ rawResponse: _response.rawResponse,
314
+ });
315
+ case "timeout":
316
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling GET /construe/codes/{codesystem}.");
317
+ case "unknown":
318
+ throw new errors.phenomlError({
319
+ message: _response.error.errorMessage,
320
+ rawResponse: _response.rawResponse,
321
+ });
322
+ }
323
+ });
324
+ }
325
+ /**
326
+ * Returns details for a specific code within a code system.
327
+ *
328
+ * @param {string} codesystem - Code system name
329
+ * @param {string} codeId - The code identifier
330
+ * @param {phenoml.construe.GetConstrueCodesCodesystemCodeIdRequest} request
331
+ * @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
332
+ *
333
+ * @throws {@link phenoml.construe.BadRequestError}
334
+ * @throws {@link phenoml.construe.UnauthorizedError}
335
+ * @throws {@link phenoml.construe.NotFoundError}
336
+ * @throws {@link phenoml.construe.InternalServerError}
337
+ *
338
+ * @example
339
+ * await client.construe.getASpecificCode("ICD-10-CM", "E11.65", {
340
+ * version: "version"
341
+ * })
342
+ */
343
+ getASpecificCode(codesystem, codeId, request = {}, requestOptions) {
344
+ return core.HttpResponsePromise.fromPromise(this.__getASpecificCode(codesystem, codeId, request, requestOptions));
345
+ }
346
+ __getASpecificCode(codesystem_1, codeId_1) {
347
+ return __awaiter(this, arguments, void 0, function* (codesystem, codeId, request = {}, requestOptions) {
348
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
349
+ const { version } = request;
350
+ const _queryParams = {};
351
+ if (version != null) {
352
+ _queryParams.version = version;
353
+ }
354
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
355
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
356
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `construe/codes/${core.url.encodePathParam(codesystem)}/${core.url.encodePathParam(codeId)}`),
357
+ method: "GET",
358
+ headers: _headers,
359
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
360
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
361
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
362
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
363
+ });
364
+ if (_response.ok) {
365
+ return { data: _response.body, rawResponse: _response.rawResponse };
366
+ }
367
+ if (_response.error.reason === "status-code") {
368
+ switch (_response.error.statusCode) {
369
+ case 400:
370
+ throw new phenoml.construe.BadRequestError(_response.error.body, _response.rawResponse);
371
+ case 401:
372
+ throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
373
+ case 404:
374
+ throw new phenoml.construe.NotFoundError(_response.error.body, _response.rawResponse);
375
+ case 500:
376
+ throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
377
+ default:
378
+ throw new errors.phenomlError({
379
+ statusCode: _response.error.statusCode,
380
+ body: _response.error.body,
381
+ rawResponse: _response.rawResponse,
382
+ });
383
+ }
384
+ }
385
+ switch (_response.error.reason) {
386
+ case "non-json":
387
+ throw new errors.phenomlError({
388
+ statusCode: _response.error.statusCode,
389
+ body: _response.error.rawBody,
390
+ rawResponse: _response.rawResponse,
391
+ });
392
+ case "timeout":
393
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling GET /construe/codes/{codesystem}/{codeID}.");
394
+ case "unknown":
395
+ throw new errors.phenomlError({
396
+ message: _response.error.errorMessage,
397
+ rawResponse: _response.rawResponse,
398
+ });
399
+ }
400
+ });
401
+ }
402
+ /**
403
+ * Performs semantic similarity search using vector embeddings.
404
+ *
405
+ * **When to use**: Best for natural language queries where you want to find conceptually
406
+ * related codes, even when different terminology is used. The search understands meaning,
407
+ * not just keywords.
408
+ *
409
+ * **Examples**:
410
+ * - Query "trouble breathing at night" finds codes like "Sleep apnea", "Orthopnea",
411
+ * "Nocturnal dyspnea" — semantically related but no exact keyword matches
412
+ * - Query "heart problems" finds "Myocardial infarction", "Cardiac arrest", "Arrhythmia"
413
+ *
414
+ * **Trade-offs**: Slower than text search (requires embedding generation), but finds
415
+ * conceptually similar results that keyword search would miss.
416
+ *
417
+ * See also: `/search/text` for faster keyword-based lookup with typo tolerance.
418
+ *
419
+ * @param {string} codesystem - Code system name
420
+ * @param {phenoml.construe.GetConstrueCodesCodesystemSearchSemanticRequest} request
421
+ * @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
422
+ *
423
+ * @throws {@link phenoml.construe.BadRequestError}
424
+ * @throws {@link phenoml.construe.UnauthorizedError}
425
+ * @throws {@link phenoml.construe.NotFoundError}
426
+ * @throws {@link phenoml.construe.InternalServerError}
427
+ *
428
+ * @example
429
+ * await client.construe.semanticSearchEmbeddingBased("ICD-10-CM", {
430
+ * text: "patient has trouble breathing at night and wakes up gasping",
431
+ * version: "version",
432
+ * limit: 1
433
+ * })
434
+ */
435
+ semanticSearchEmbeddingBased(codesystem, request, requestOptions) {
436
+ return core.HttpResponsePromise.fromPromise(this.__semanticSearchEmbeddingBased(codesystem, request, requestOptions));
437
+ }
438
+ __semanticSearchEmbeddingBased(codesystem, request, requestOptions) {
439
+ return __awaiter(this, void 0, void 0, function* () {
440
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
441
+ const { text, version, limit } = request;
442
+ const _queryParams = {};
443
+ _queryParams.text = text;
444
+ if (version != null) {
445
+ _queryParams.version = version;
446
+ }
447
+ if (limit != null) {
448
+ _queryParams.limit = limit.toString();
449
+ }
450
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
451
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
452
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `construe/codes/${core.url.encodePathParam(codesystem)}/search/semantic`),
453
+ method: "GET",
454
+ headers: _headers,
455
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
456
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
457
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
458
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
459
+ });
460
+ if (_response.ok) {
461
+ return {
462
+ data: _response.body,
463
+ rawResponse: _response.rawResponse,
464
+ };
465
+ }
466
+ if (_response.error.reason === "status-code") {
467
+ switch (_response.error.statusCode) {
468
+ case 400:
469
+ throw new phenoml.construe.BadRequestError(_response.error.body, _response.rawResponse);
470
+ case 401:
471
+ throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
472
+ case 404:
473
+ throw new phenoml.construe.NotFoundError(_response.error.body, _response.rawResponse);
474
+ case 500:
475
+ throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
476
+ default:
477
+ throw new errors.phenomlError({
478
+ statusCode: _response.error.statusCode,
479
+ body: _response.error.body,
480
+ rawResponse: _response.rawResponse,
481
+ });
482
+ }
483
+ }
484
+ switch (_response.error.reason) {
485
+ case "non-json":
486
+ throw new errors.phenomlError({
487
+ statusCode: _response.error.statusCode,
488
+ body: _response.error.rawBody,
489
+ rawResponse: _response.rawResponse,
490
+ });
491
+ case "timeout":
492
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling GET /construe/codes/{codesystem}/search/semantic.");
493
+ case "unknown":
494
+ throw new errors.phenomlError({
495
+ message: _response.error.errorMessage,
496
+ rawResponse: _response.rawResponse,
497
+ });
498
+ }
499
+ });
500
+ }
501
+ /**
502
+ * Performs fast full-text search over code IDs and descriptions.
503
+ *
504
+ * **When to use**: Best for autocomplete UIs, code lookup, or when users know part of
505
+ * the code ID or specific keywords. Fast response times suitable for typeahead interfaces.
506
+ *
507
+ * **Features**:
508
+ * - Substring matching on code IDs (e.g., "11.65" finds "E11.65")
509
+ * - Typo tolerance on descriptions (not on code IDs)
510
+ * - Fast response times (~10-50ms)
511
+ *
512
+ * **Examples**:
513
+ * - Query "E11" finds all codes starting with E11 (diabetes codes)
514
+ * - Query "diabtes" (typo) still finds "diabetes" codes
515
+ *
516
+ * **Trade-offs**: Faster than semantic search, but only matches keywords/substrings.
517
+ * Won't find conceptually related codes with different terminology.
518
+ *
519
+ * See also: `/search/semantic` for finding conceptually similar codes.
520
+ *
521
+ * @param {string} codesystem - Code system name
522
+ * @param {phenoml.construe.GetConstrueCodesCodesystemSearchTextRequest} request
523
+ * @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
524
+ *
525
+ * @throws {@link phenoml.construe.BadRequestError}
526
+ * @throws {@link phenoml.construe.UnauthorizedError}
527
+ * @throws {@link phenoml.construe.NotFoundError}
528
+ * @throws {@link phenoml.construe.InternalServerError}
529
+ * @throws {@link phenoml.construe.NotImplementedError}
530
+ * @throws {@link phenoml.construe.ServiceUnavailableError}
531
+ *
532
+ * @example
533
+ * await client.construe.textSearchKeywordBased("ICD-10-CM", {
534
+ * q: "E11.65",
535
+ * version: "version",
536
+ * limit: 1
537
+ * })
538
+ */
539
+ textSearchKeywordBased(codesystem, request, requestOptions) {
540
+ return core.HttpResponsePromise.fromPromise(this.__textSearchKeywordBased(codesystem, request, requestOptions));
541
+ }
542
+ __textSearchKeywordBased(codesystem, request, requestOptions) {
543
+ return __awaiter(this, void 0, void 0, function* () {
544
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
545
+ const { q, version, limit } = request;
546
+ const _queryParams = {};
547
+ _queryParams.q = q;
548
+ if (version != null) {
549
+ _queryParams.version = version;
550
+ }
551
+ if (limit != null) {
552
+ _queryParams.limit = limit.toString();
553
+ }
554
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
555
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
556
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `construe/codes/${core.url.encodePathParam(codesystem)}/search/text`),
557
+ method: "GET",
558
+ headers: _headers,
559
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
560
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
561
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
562
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
563
+ });
564
+ if (_response.ok) {
565
+ return { data: _response.body, rawResponse: _response.rawResponse };
566
+ }
567
+ if (_response.error.reason === "status-code") {
568
+ switch (_response.error.statusCode) {
569
+ case 400:
570
+ throw new phenoml.construe.BadRequestError(_response.error.body, _response.rawResponse);
571
+ case 401:
572
+ throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
573
+ case 404:
574
+ throw new phenoml.construe.NotFoundError(_response.error.body, _response.rawResponse);
575
+ case 500:
576
+ throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
577
+ case 501:
578
+ throw new phenoml.construe.NotImplementedError(_response.error.body, _response.rawResponse);
579
+ case 503:
580
+ throw new phenoml.construe.ServiceUnavailableError(_response.error.body, _response.rawResponse);
581
+ default:
582
+ throw new errors.phenomlError({
583
+ statusCode: _response.error.statusCode,
584
+ body: _response.error.body,
585
+ rawResponse: _response.rawResponse,
586
+ });
587
+ }
588
+ }
589
+ switch (_response.error.reason) {
590
+ case "non-json":
591
+ throw new errors.phenomlError({
592
+ statusCode: _response.error.statusCode,
593
+ body: _response.error.rawBody,
594
+ rawResponse: _response.rawResponse,
595
+ });
596
+ case "timeout":
597
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling GET /construe/codes/{codesystem}/search/text.");
598
+ case "unknown":
599
+ throw new errors.phenomlError({
600
+ message: _response.error.errorMessage,
601
+ rawResponse: _response.rawResponse,
602
+ });
603
+ }
604
+ });
605
+ }
177
606
  _getAuthorizationHeader() {
178
607
  return __awaiter(this, void 0, void 0, function* () {
179
608
  return `Bearer ${yield core.Supplier.get(this._options.token)}`;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * version: "version"
5
+ * }
6
+ */
7
+ export interface GetConstrueCodesCodesystemCodeIdRequest {
8
+ /** Specific version of the code system */
9
+ version?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * version: "2025",
5
+ * cursor: "cursor",
6
+ * limit: 1
7
+ * }
8
+ */
9
+ export interface GetConstrueCodesCodesystemRequest {
10
+ /** Specific version of the code system. Required if multiple versions exist. */
11
+ version?: string;
12
+ /** Pagination cursor from previous response */
13
+ cursor?: string;
14
+ /** Maximum number of codes to return (default 20) */
15
+ limit?: number;
16
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * text: "patient has trouble breathing at night and wakes up gasping",
5
+ * version: "version",
6
+ * limit: 1
7
+ * }
8
+ */
9
+ export interface GetConstrueCodesCodesystemSearchSemanticRequest {
10
+ /** Natural language text to find semantically similar codes for */
11
+ text: string;
12
+ /** Specific version of the code system */
13
+ version?: string;
14
+ /** Maximum number of results (default 10, max 50) */
15
+ limit?: number;
16
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * q: "E11.65",
5
+ * version: "version",
6
+ * limit: 1
7
+ * }
8
+ */
9
+ export interface GetConstrueCodesCodesystemSearchTextRequest {
10
+ /** Search query (searches code IDs and descriptions) */
11
+ q: string;
12
+ /** Specific version of the code system */
13
+ version?: string;
14
+ /** Maximum number of results (default 20, max 100) */
15
+ limit?: number;
16
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,2 +1,6 @@
1
1
  export type { ExtractRequest } from "./ExtractRequest.mjs";
2
+ export type { GetConstrueCodesCodesystemCodeIdRequest } from "./GetConstrueCodesCodesystemCodeIdRequest.mjs";
3
+ export type { GetConstrueCodesCodesystemRequest } from "./GetConstrueCodesCodesystemRequest.mjs";
4
+ export type { GetConstrueCodesCodesystemSearchSemanticRequest } from "./GetConstrueCodesCodesystemSearchSemanticRequest.mjs";
5
+ export type { GetConstrueCodesCodesystemSearchTextRequest } from "./GetConstrueCodesCodesystemSearchTextRequest.mjs";
2
6
  export type { UploadRequest } from "./UploadRequest.mjs";
@@ -0,0 +1,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class NotFoundError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -0,0 +1,13 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export class NotFoundError extends errors.phenomlError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "NotFoundError",
7
+ statusCode: 404,
8
+ body: body,
9
+ rawResponse: rawResponse,
10
+ });
11
+ Object.setPrototypeOf(this, NotFoundError.prototype);
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class NotImplementedError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -0,0 +1,13 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export class NotImplementedError extends errors.phenomlError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "NotImplementedError",
7
+ statusCode: 501,
8
+ body: body,
9
+ rawResponse: rawResponse,
10
+ });
11
+ Object.setPrototypeOf(this, NotImplementedError.prototype);
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class ServiceUnavailableError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -0,0 +1,13 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export class ServiceUnavailableError extends errors.phenomlError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "ServiceUnavailableError",
7
+ statusCode: 503,
8
+ body: body,
9
+ rawResponse: rawResponse,
10
+ });
11
+ Object.setPrototypeOf(this, ServiceUnavailableError.prototype);
12
+ }
13
+ }
@@ -2,4 +2,7 @@ export * from "./BadRequestError.mjs";
2
2
  export * from "./ConflictError.mjs";
3
3
  export * from "./FailedDependencyError.mjs";
4
4
  export * from "./InternalServerError.mjs";
5
+ export * from "./NotFoundError.mjs";
6
+ export * from "./NotImplementedError.mjs";
7
+ export * from "./ServiceUnavailableError.mjs";
5
8
  export * from "./UnauthorizedError.mjs";
@@ -2,4 +2,7 @@ export * from "./BadRequestError.mjs";
2
2
  export * from "./ConflictError.mjs";
3
3
  export * from "./FailedDependencyError.mjs";
4
4
  export * from "./InternalServerError.mjs";
5
+ export * from "./NotFoundError.mjs";
6
+ export * from "./NotImplementedError.mjs";
7
+ export * from "./ServiceUnavailableError.mjs";
5
8
  export * from "./UnauthorizedError.mjs";
@@ -0,0 +1,8 @@
1
+ export interface CodeResponse {
2
+ /** The code identifier */
3
+ code: string;
4
+ /** Short description of the code */
5
+ description: string;
6
+ /** Extended definition of the code (if available) */
7
+ definition?: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,10 @@
1
+ export interface CodeSystemDetails {
2
+ /** Code system name */
3
+ name: string;
4
+ /** Code system version */
5
+ version: string;
6
+ /** Total number of codes in the system */
7
+ code_count: number;
8
+ /** Whether this is a built-in system (vs custom uploaded) */
9
+ builtin: boolean;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface CodeSystemInfo {
2
+ /** Code system name */
3
+ name: string;
4
+ /** Code system version */
5
+ version: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};