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