phenoml 17.8.0 → 17.10.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 (35) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/construe/resources/codes/client/Client.d.ts +32 -0
  3. package/dist/cjs/api/resources/construe/resources/codes/client/Client.js +80 -0
  4. package/dist/cjs/api/resources/construe/resources/codes/client/requests/PhenoCrRequest.d.ts +16 -0
  5. package/dist/cjs/api/resources/construe/resources/codes/client/requests/PhenoCrRequest.js +3 -0
  6. package/dist/cjs/api/resources/construe/resources/codes/client/requests/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/construe/types/PhenocrExtractRequestSystem.d.ts +6 -0
  8. package/dist/cjs/api/resources/construe/types/PhenocrExtractRequestSystem.js +3 -0
  9. package/dist/cjs/api/resources/construe/types/index.d.ts +1 -0
  10. package/dist/cjs/api/resources/construe/types/index.js +1 -0
  11. package/dist/cjs/core/runtime/index.d.ts +1 -1
  12. package/dist/cjs/core/runtime/index.js +2 -1
  13. package/dist/cjs/core/runtime/runtime.d.ts +19 -0
  14. package/dist/cjs/core/runtime/runtime.js +47 -2
  15. package/dist/cjs/version.d.ts +1 -1
  16. package/dist/cjs/version.js +1 -1
  17. package/dist/esm/BaseClient.mjs +2 -2
  18. package/dist/esm/api/resources/construe/resources/codes/client/Client.d.mts +32 -0
  19. package/dist/esm/api/resources/construe/resources/codes/client/Client.mjs +80 -0
  20. package/dist/esm/api/resources/construe/resources/codes/client/requests/PhenoCrRequest.d.mts +16 -0
  21. package/dist/esm/api/resources/construe/resources/codes/client/requests/PhenoCrRequest.mjs +2 -0
  22. package/dist/esm/api/resources/construe/resources/codes/client/requests/index.d.mts +1 -0
  23. package/dist/esm/api/resources/construe/types/PhenocrExtractRequestSystem.d.mts +6 -0
  24. package/dist/esm/api/resources/construe/types/PhenocrExtractRequestSystem.mjs +2 -0
  25. package/dist/esm/api/resources/construe/types/index.d.mts +1 -0
  26. package/dist/esm/api/resources/construe/types/index.mjs +1 -0
  27. package/dist/esm/core/runtime/index.d.mts +1 -1
  28. package/dist/esm/core/runtime/index.mjs +1 -1
  29. package/dist/esm/core/runtime/runtime.d.mts +19 -0
  30. package/dist/esm/core/runtime/runtime.mjs +46 -2
  31. package/dist/esm/version.d.mts +1 -1
  32. package/dist/esm/version.mjs +1 -1
  33. package/openapi/openapi.json +106 -1
  34. package/package.json +1 -1
  35. package/reference.md +77 -0
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "phenoml",
46
- "X-Fern-SDK-Version": "17.8.0",
47
- "User-Agent": "phenoml/17.8.0",
46
+ "X-Fern-SDK-Version": "17.10.0",
47
+ "User-Agent": "phenoml/17.10.0",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -109,6 +109,38 @@ export declare class CodesClient {
109
109
  */
110
110
  extract(request: phenoml.construe.ExtractRequest, requestOptions?: CodesClient.RequestOptions): core.HttpResponsePromise<phenoml.construe.ExtractCodesResult>;
111
111
  private __extract;
112
+ /**
113
+ * **Alpha:** phenocr is an alpha feature. The API contract — request
114
+ * parameters and response shape — may change as its internals evolve, and
115
+ * results may vary between releases. Do not depend on it for production
116
+ * workloads yet.
117
+ *
118
+ * Extracts medical codes from natural language clinical text using phenocr.
119
+ *
120
+ * Supported code systems: HPO, ICD-10-CM, and SNOMED_CT_US. The code
121
+ * system name and version are both required.
122
+ *
123
+ * @param {phenoml.construe.PhenoCrRequest} request
124
+ * @param {CodesClient.RequestOptions} requestOptions - Request-specific configuration.
125
+ *
126
+ * @throws {@link phenoml.construe.BadRequestError}
127
+ * @throws {@link phenoml.construe.UnauthorizedError}
128
+ * @throws {@link phenoml.construe.NotFoundError}
129
+ * @throws {@link phenoml.construe.InternalServerError}
130
+ * @throws {@link phenoml.construe.ServiceUnavailableError}
131
+ * @throws {@link phenoml.construe.GatewayTimeoutError}
132
+ *
133
+ * @example
134
+ * await client.construe.codes.phenocr({
135
+ * text: "5-year-old male with seizures, severe intellectual disability, microcephaly, and hypotonia.",
136
+ * system: {
137
+ * name: "HPO",
138
+ * version: "umls-2026AA"
139
+ * }
140
+ * })
141
+ */
142
+ phenocr(request: phenoml.construe.PhenoCrRequest, requestOptions?: CodesClient.RequestOptions): core.HttpResponsePromise<phenoml.construe.ExtractCodesResult>;
143
+ private __phenocr;
112
144
  /**
113
145
  * Returns a paginated list of all codes in the specified code system from the terminology server.
114
146
  *
@@ -203,6 +203,86 @@ class CodesClient {
203
203
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/construe/extract");
204
204
  });
205
205
  }
206
+ /**
207
+ * **Alpha:** phenocr is an alpha feature. The API contract — request
208
+ * parameters and response shape — may change as its internals evolve, and
209
+ * results may vary between releases. Do not depend on it for production
210
+ * workloads yet.
211
+ *
212
+ * Extracts medical codes from natural language clinical text using phenocr.
213
+ *
214
+ * Supported code systems: HPO, ICD-10-CM, and SNOMED_CT_US. The code
215
+ * system name and version are both required.
216
+ *
217
+ * @param {phenoml.construe.PhenoCrRequest} request
218
+ * @param {CodesClient.RequestOptions} requestOptions - Request-specific configuration.
219
+ *
220
+ * @throws {@link phenoml.construe.BadRequestError}
221
+ * @throws {@link phenoml.construe.UnauthorizedError}
222
+ * @throws {@link phenoml.construe.NotFoundError}
223
+ * @throws {@link phenoml.construe.InternalServerError}
224
+ * @throws {@link phenoml.construe.ServiceUnavailableError}
225
+ * @throws {@link phenoml.construe.GatewayTimeoutError}
226
+ *
227
+ * @example
228
+ * await client.construe.codes.phenocr({
229
+ * text: "5-year-old male with seizures, severe intellectual disability, microcephaly, and hypotonia.",
230
+ * system: {
231
+ * name: "HPO",
232
+ * version: "umls-2026AA"
233
+ * }
234
+ * })
235
+ */
236
+ phenocr(request, requestOptions) {
237
+ return core.HttpResponsePromise.fromPromise(this.__phenocr(request, requestOptions));
238
+ }
239
+ __phenocr(request, requestOptions) {
240
+ return __awaiter(this, void 0, void 0, function* () {
241
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
242
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
243
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
244
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
245
+ 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/phenocr"),
246
+ method: "POST",
247
+ headers: _headers,
248
+ contentType: "application/json",
249
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
250
+ requestType: "json",
251
+ body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
252
+ 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,
253
+ 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,
254
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
255
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
256
+ logging: this._options.logging,
257
+ });
258
+ if (_response.ok) {
259
+ return { data: _response.body, rawResponse: _response.rawResponse };
260
+ }
261
+ if (_response.error.reason === "status-code") {
262
+ switch (_response.error.statusCode) {
263
+ case 400:
264
+ throw new phenoml.construe.BadRequestError(_response.error.body, _response.rawResponse);
265
+ case 401:
266
+ throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
267
+ case 404:
268
+ throw new phenoml.construe.NotFoundError(_response.error.body, _response.rawResponse);
269
+ case 500:
270
+ throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
271
+ case 503:
272
+ throw new phenoml.construe.ServiceUnavailableError(_response.error.body, _response.rawResponse);
273
+ case 504:
274
+ throw new phenoml.construe.GatewayTimeoutError(_response.error.body, _response.rawResponse);
275
+ default:
276
+ throw new errors.phenomlError({
277
+ statusCode: _response.error.statusCode,
278
+ body: _response.error.body,
279
+ rawResponse: _response.rawResponse,
280
+ });
281
+ }
282
+ }
283
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/construe/phenocr");
284
+ });
285
+ }
206
286
  /**
207
287
  * Returns a paginated list of all codes in the specified code system from the terminology server.
208
288
  *
@@ -0,0 +1,16 @@
1
+ import type * as phenoml from "../../../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * text: "5-year-old male with seizures, severe intellectual disability, microcephaly, and hypotonia.",
6
+ * system: {
7
+ * name: "HPO",
8
+ * version: "umls-2026AA"
9
+ * }
10
+ * }
11
+ */
12
+ export interface PhenoCrRequest {
13
+ /** Natural language text to extract codes from */
14
+ text: string;
15
+ system: phenoml.construe.PhenocrExtractRequestSystem;
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,5 +1,6 @@
1
1
  export type { CodesListRequest } from "./CodesListRequest.js";
2
2
  export type { ExtractRequest } from "./ExtractRequest.js";
3
3
  export type { LookupRequest } from "./LookupRequest.js";
4
+ export type { PhenoCrRequest } from "./PhenoCrRequest.js";
4
5
  export type { SearchSemanticRequest } from "./SearchSemanticRequest.js";
5
6
  export type { SearchTextRequest } from "./SearchTextRequest.js";
@@ -0,0 +1,6 @@
1
+ export interface PhenocrExtractRequestSystem {
2
+ /** Code system name. Supported by phenocr: HPO, ICD-10-CM, SNOMED_CT_US. */
3
+ name: string;
4
+ /** Code system version to run against. */
5
+ version: string;
6
+ }
@@ -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 });
@@ -14,6 +14,7 @@ export * from "./GetCodeResponse.js";
14
14
  export * from "./GetCodeSystemDetailResponse.js";
15
15
  export * from "./ListCodeSystemsResponse.js";
16
16
  export * from "./ListCodesResponse.js";
17
+ export * from "./PhenocrExtractRequestSystem.js";
17
18
  export * from "./SemanticSearchResponse.js";
18
19
  export * from "./SemanticSearchResult.js";
19
20
  export * from "./TextSearchResponse.js";
@@ -30,6 +30,7 @@ __exportStar(require("./GetCodeResponse.js"), exports);
30
30
  __exportStar(require("./GetCodeSystemDetailResponse.js"), exports);
31
31
  __exportStar(require("./ListCodeSystemsResponse.js"), exports);
32
32
  __exportStar(require("./ListCodesResponse.js"), exports);
33
+ __exportStar(require("./PhenocrExtractRequestSystem.js"), exports);
33
34
  __exportStar(require("./SemanticSearchResponse.js"), exports);
34
35
  __exportStar(require("./SemanticSearchResult.js"), exports);
35
36
  __exportStar(require("./TextSearchResponse.js"), exports);
@@ -1 +1 @@
1
- export { RUNTIME } from "./runtime.js";
1
+ export { getUserAgent, RUNTIME } from "./runtime.js";
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RUNTIME = void 0;
3
+ exports.RUNTIME = exports.getUserAgent = void 0;
4
4
  var runtime_js_1 = require("./runtime.js");
5
+ Object.defineProperty(exports, "getUserAgent", { enumerable: true, get: function () { return runtime_js_1.getUserAgent; } });
5
6
  Object.defineProperty(exports, "RUNTIME", { enumerable: true, get: function () { return runtime_js_1.RUNTIME; } });
@@ -6,4 +6,23 @@ export interface Runtime {
6
6
  type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
7
7
  version?: string;
8
8
  parsedVersion?: number;
9
+ /**
10
+ * The operating system the SDK is running on, when it can be determined
11
+ * (e.g. "linux", "darwin", "win32" on server runtimes). Undefined in
12
+ * environments where the OS is not observable (e.g. browsers).
13
+ */
14
+ os?: string;
15
+ /**
16
+ * The CPU architecture the SDK is running on, when it can be determined
17
+ * (e.g. "x64", "arm64" on server runtimes). Undefined in environments where
18
+ * the architecture is not observable (e.g. browsers).
19
+ */
20
+ arch?: string;
9
21
  }
22
+ /**
23
+ * Builds a structured User-Agent string of the form
24
+ * `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
25
+ * where the platform group and runtime segment are omitted gracefully when the
26
+ * underlying values cannot be determined (e.g. in a browser).
27
+ */
28
+ export declare function getUserAgent(sdkName: string, sdkVersion: string): string;
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RUNTIME = void 0;
4
+ exports.getUserAgent = getUserAgent;
4
5
  /**
5
6
  * A constant that indicates which environment and version the SDK is running in.
6
7
  */
7
8
  exports.RUNTIME = evaluateRuntime();
8
9
  function evaluateRuntime() {
9
- var _a, _b, _c, _d, _e;
10
+ var _a, _b, _c, _d, _e, _f, _g;
10
11
  /**
11
12
  * A constant that indicates whether the environment the code is running is a Web Browser.
12
13
  */
@@ -59,6 +60,8 @@ function evaluateRuntime() {
59
60
  return {
60
61
  type: "deno",
61
62
  version: Deno.version.deno,
63
+ os: (_e = Deno.build) === null || _e === void 0 ? void 0 : _e.os,
64
+ arch: (_f = Deno.build) === null || _f === void 0 ? void 0 : _f.arch,
62
65
  };
63
66
  }
64
67
  /**
@@ -69,6 +72,8 @@ function evaluateRuntime() {
69
72
  return {
70
73
  type: "bun",
71
74
  version: Bun.version,
75
+ os: typeof process !== "undefined" ? process.platform : undefined,
76
+ arch: typeof process !== "undefined" ? process.arch : undefined,
72
77
  };
73
78
  }
74
79
  /**
@@ -90,15 +95,55 @@ function evaluateRuntime() {
90
95
  * Edge Runtime warns about Node.js APIs even when they are guarded).
91
96
  */
92
97
  const _process = typeof process !== "undefined" ? process : undefined;
93
- const isNode = typeof _process !== "undefined" && typeof ((_e = _process.versions) === null || _e === void 0 ? void 0 : _e.node) === "string";
98
+ const isNode = typeof _process !== "undefined" && typeof ((_g = _process.versions) === null || _g === void 0 ? void 0 : _g.node) === "string";
94
99
  if (isNode) {
95
100
  return {
96
101
  type: "node",
97
102
  version: _process.versions.node,
98
103
  parsedVersion: Number(_process.versions.node.split(".")[0]),
104
+ os: _process.platform,
105
+ arch: _process.arch,
99
106
  };
100
107
  }
101
108
  return {
102
109
  type: "unknown",
103
110
  };
104
111
  }
112
+ /**
113
+ * Display names for the language runtimes whose version is meaningful to encode
114
+ * in a User-Agent. Environments where a version string is not useful (e.g.
115
+ * browsers, where `version` is the full navigator UA) are intentionally mapped
116
+ * to `undefined` so they are omitted from the User-Agent.
117
+ */
118
+ const RUNTIME_DISPLAY_NAMES = {
119
+ node: "Node",
120
+ deno: "Deno",
121
+ bun: "Bun",
122
+ browser: undefined,
123
+ "web-worker": undefined,
124
+ "react-native": undefined,
125
+ workerd: undefined,
126
+ "edge-runtime": undefined,
127
+ unknown: undefined,
128
+ };
129
+ /**
130
+ * Builds a structured User-Agent string of the form
131
+ * `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
132
+ * where the platform group and runtime segment are omitted gracefully when the
133
+ * underlying values cannot be determined (e.g. in a browser).
134
+ */
135
+ function getUserAgent(sdkName, sdkVersion) {
136
+ let userAgent = `${sdkName}/${sdkVersion}`;
137
+ const platform = [exports.RUNTIME.os, exports.RUNTIME.arch].filter((part) => part != null && part.length > 0);
138
+ if (platform.length > 0) {
139
+ userAgent += ` (${platform.join("; ")})`;
140
+ }
141
+ const runtimeName = RUNTIME_DISPLAY_NAMES[exports.RUNTIME.type];
142
+ if (runtimeName != null) {
143
+ userAgent += ` ${runtimeName}`;
144
+ if (exports.RUNTIME.version != null && exports.RUNTIME.version.length > 0) {
145
+ userAgent += `/${exports.RUNTIME.version}`;
146
+ }
147
+ }
148
+ return userAgent;
149
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "17.8.0";
1
+ export declare const SDK_VERSION = "17.10.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "17.8.0";
4
+ exports.SDK_VERSION = "17.10.0";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "phenoml",
9
- "X-Fern-SDK-Version": "17.8.0",
10
- "User-Agent": "phenoml/17.8.0",
9
+ "X-Fern-SDK-Version": "17.10.0",
10
+ "User-Agent": "phenoml/17.10.0",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -109,6 +109,38 @@ export declare class CodesClient {
109
109
  */
110
110
  extract(request: phenoml.construe.ExtractRequest, requestOptions?: CodesClient.RequestOptions): core.HttpResponsePromise<phenoml.construe.ExtractCodesResult>;
111
111
  private __extract;
112
+ /**
113
+ * **Alpha:** phenocr is an alpha feature. The API contract — request
114
+ * parameters and response shape — may change as its internals evolve, and
115
+ * results may vary between releases. Do not depend on it for production
116
+ * workloads yet.
117
+ *
118
+ * Extracts medical codes from natural language clinical text using phenocr.
119
+ *
120
+ * Supported code systems: HPO, ICD-10-CM, and SNOMED_CT_US. The code
121
+ * system name and version are both required.
122
+ *
123
+ * @param {phenoml.construe.PhenoCrRequest} request
124
+ * @param {CodesClient.RequestOptions} requestOptions - Request-specific configuration.
125
+ *
126
+ * @throws {@link phenoml.construe.BadRequestError}
127
+ * @throws {@link phenoml.construe.UnauthorizedError}
128
+ * @throws {@link phenoml.construe.NotFoundError}
129
+ * @throws {@link phenoml.construe.InternalServerError}
130
+ * @throws {@link phenoml.construe.ServiceUnavailableError}
131
+ * @throws {@link phenoml.construe.GatewayTimeoutError}
132
+ *
133
+ * @example
134
+ * await client.construe.codes.phenocr({
135
+ * text: "5-year-old male with seizures, severe intellectual disability, microcephaly, and hypotonia.",
136
+ * system: {
137
+ * name: "HPO",
138
+ * version: "umls-2026AA"
139
+ * }
140
+ * })
141
+ */
142
+ phenocr(request: phenoml.construe.PhenoCrRequest, requestOptions?: CodesClient.RequestOptions): core.HttpResponsePromise<phenoml.construe.ExtractCodesResult>;
143
+ private __phenocr;
112
144
  /**
113
145
  * Returns a paginated list of all codes in the specified code system from the terminology server.
114
146
  *
@@ -167,6 +167,86 @@ export class CodesClient {
167
167
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/construe/extract");
168
168
  });
169
169
  }
170
+ /**
171
+ * **Alpha:** phenocr is an alpha feature. The API contract — request
172
+ * parameters and response shape — may change as its internals evolve, and
173
+ * results may vary between releases. Do not depend on it for production
174
+ * workloads yet.
175
+ *
176
+ * Extracts medical codes from natural language clinical text using phenocr.
177
+ *
178
+ * Supported code systems: HPO, ICD-10-CM, and SNOMED_CT_US. The code
179
+ * system name and version are both required.
180
+ *
181
+ * @param {phenoml.construe.PhenoCrRequest} request
182
+ * @param {CodesClient.RequestOptions} requestOptions - Request-specific configuration.
183
+ *
184
+ * @throws {@link phenoml.construe.BadRequestError}
185
+ * @throws {@link phenoml.construe.UnauthorizedError}
186
+ * @throws {@link phenoml.construe.NotFoundError}
187
+ * @throws {@link phenoml.construe.InternalServerError}
188
+ * @throws {@link phenoml.construe.ServiceUnavailableError}
189
+ * @throws {@link phenoml.construe.GatewayTimeoutError}
190
+ *
191
+ * @example
192
+ * await client.construe.codes.phenocr({
193
+ * text: "5-year-old male with seizures, severe intellectual disability, microcephaly, and hypotonia.",
194
+ * system: {
195
+ * name: "HPO",
196
+ * version: "umls-2026AA"
197
+ * }
198
+ * })
199
+ */
200
+ phenocr(request, requestOptions) {
201
+ return core.HttpResponsePromise.fromPromise(this.__phenocr(request, requestOptions));
202
+ }
203
+ __phenocr(request, requestOptions) {
204
+ return __awaiter(this, void 0, void 0, function* () {
205
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
206
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
207
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
208
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
209
+ 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/phenocr"),
210
+ method: "POST",
211
+ headers: _headers,
212
+ contentType: "application/json",
213
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
214
+ requestType: "json",
215
+ body: mergeAdditionalBodyParameters(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
216
+ 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,
217
+ 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,
218
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
219
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
220
+ logging: this._options.logging,
221
+ });
222
+ if (_response.ok) {
223
+ return { data: _response.body, rawResponse: _response.rawResponse };
224
+ }
225
+ if (_response.error.reason === "status-code") {
226
+ switch (_response.error.statusCode) {
227
+ case 400:
228
+ throw new phenoml.construe.BadRequestError(_response.error.body, _response.rawResponse);
229
+ case 401:
230
+ throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
231
+ case 404:
232
+ throw new phenoml.construe.NotFoundError(_response.error.body, _response.rawResponse);
233
+ case 500:
234
+ throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
235
+ case 503:
236
+ throw new phenoml.construe.ServiceUnavailableError(_response.error.body, _response.rawResponse);
237
+ case 504:
238
+ throw new phenoml.construe.GatewayTimeoutError(_response.error.body, _response.rawResponse);
239
+ default:
240
+ throw new errors.phenomlError({
241
+ statusCode: _response.error.statusCode,
242
+ body: _response.error.body,
243
+ rawResponse: _response.rawResponse,
244
+ });
245
+ }
246
+ }
247
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/construe/phenocr");
248
+ });
249
+ }
170
250
  /**
171
251
  * Returns a paginated list of all codes in the specified code system from the terminology server.
172
252
  *
@@ -0,0 +1,16 @@
1
+ import type * as phenoml from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * text: "5-year-old male with seizures, severe intellectual disability, microcephaly, and hypotonia.",
6
+ * system: {
7
+ * name: "HPO",
8
+ * version: "umls-2026AA"
9
+ * }
10
+ * }
11
+ */
12
+ export interface PhenoCrRequest {
13
+ /** Natural language text to extract codes from */
14
+ text: string;
15
+ system: phenoml.construe.PhenocrExtractRequestSystem;
16
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,5 +1,6 @@
1
1
  export type { CodesListRequest } from "./CodesListRequest.mjs";
2
2
  export type { ExtractRequest } from "./ExtractRequest.mjs";
3
3
  export type { LookupRequest } from "./LookupRequest.mjs";
4
+ export type { PhenoCrRequest } from "./PhenoCrRequest.mjs";
4
5
  export type { SearchSemanticRequest } from "./SearchSemanticRequest.mjs";
5
6
  export type { SearchTextRequest } from "./SearchTextRequest.mjs";
@@ -0,0 +1,6 @@
1
+ export interface PhenocrExtractRequestSystem {
2
+ /** Code system name. Supported by phenocr: HPO, ICD-10-CM, SNOMED_CT_US. */
3
+ name: string;
4
+ /** Code system version to run against. */
5
+ version: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -14,6 +14,7 @@ export * from "./GetCodeResponse.mjs";
14
14
  export * from "./GetCodeSystemDetailResponse.mjs";
15
15
  export * from "./ListCodeSystemsResponse.mjs";
16
16
  export * from "./ListCodesResponse.mjs";
17
+ export * from "./PhenocrExtractRequestSystem.mjs";
17
18
  export * from "./SemanticSearchResponse.mjs";
18
19
  export * from "./SemanticSearchResult.mjs";
19
20
  export * from "./TextSearchResponse.mjs";
@@ -14,6 +14,7 @@ export * from "./GetCodeResponse.mjs";
14
14
  export * from "./GetCodeSystemDetailResponse.mjs";
15
15
  export * from "./ListCodeSystemsResponse.mjs";
16
16
  export * from "./ListCodesResponse.mjs";
17
+ export * from "./PhenocrExtractRequestSystem.mjs";
17
18
  export * from "./SemanticSearchResponse.mjs";
18
19
  export * from "./SemanticSearchResult.mjs";
19
20
  export * from "./TextSearchResponse.mjs";
@@ -1 +1 @@
1
- export { RUNTIME } from "./runtime.mjs";
1
+ export { getUserAgent, RUNTIME } from "./runtime.mjs";
@@ -1 +1 @@
1
- export { RUNTIME } from "./runtime.mjs";
1
+ export { getUserAgent, RUNTIME } from "./runtime.mjs";
@@ -6,4 +6,23 @@ export interface Runtime {
6
6
  type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
7
7
  version?: string;
8
8
  parsedVersion?: number;
9
+ /**
10
+ * The operating system the SDK is running on, when it can be determined
11
+ * (e.g. "linux", "darwin", "win32" on server runtimes). Undefined in
12
+ * environments where the OS is not observable (e.g. browsers).
13
+ */
14
+ os?: string;
15
+ /**
16
+ * The CPU architecture the SDK is running on, when it can be determined
17
+ * (e.g. "x64", "arm64" on server runtimes). Undefined in environments where
18
+ * the architecture is not observable (e.g. browsers).
19
+ */
20
+ arch?: string;
9
21
  }
22
+ /**
23
+ * Builds a structured User-Agent string of the form
24
+ * `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
25
+ * where the platform group and runtime segment are omitted gracefully when the
26
+ * underlying values cannot be determined (e.g. in a browser).
27
+ */
28
+ export declare function getUserAgent(sdkName: string, sdkVersion: string): string;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const RUNTIME = evaluateRuntime();
5
5
  function evaluateRuntime() {
6
- var _a, _b, _c, _d, _e;
6
+ var _a, _b, _c, _d, _e, _f, _g;
7
7
  /**
8
8
  * A constant that indicates whether the environment the code is running is a Web Browser.
9
9
  */
@@ -56,6 +56,8 @@ function evaluateRuntime() {
56
56
  return {
57
57
  type: "deno",
58
58
  version: Deno.version.deno,
59
+ os: (_e = Deno.build) === null || _e === void 0 ? void 0 : _e.os,
60
+ arch: (_f = Deno.build) === null || _f === void 0 ? void 0 : _f.arch,
59
61
  };
60
62
  }
61
63
  /**
@@ -66,6 +68,8 @@ function evaluateRuntime() {
66
68
  return {
67
69
  type: "bun",
68
70
  version: Bun.version,
71
+ os: typeof process !== "undefined" ? process.platform : undefined,
72
+ arch: typeof process !== "undefined" ? process.arch : undefined,
69
73
  };
70
74
  }
71
75
  /**
@@ -87,15 +91,55 @@ function evaluateRuntime() {
87
91
  * Edge Runtime warns about Node.js APIs even when they are guarded).
88
92
  */
89
93
  const _process = typeof process !== "undefined" ? process : undefined;
90
- const isNode = typeof _process !== "undefined" && typeof ((_e = _process.versions) === null || _e === void 0 ? void 0 : _e.node) === "string";
94
+ const isNode = typeof _process !== "undefined" && typeof ((_g = _process.versions) === null || _g === void 0 ? void 0 : _g.node) === "string";
91
95
  if (isNode) {
92
96
  return {
93
97
  type: "node",
94
98
  version: _process.versions.node,
95
99
  parsedVersion: Number(_process.versions.node.split(".")[0]),
100
+ os: _process.platform,
101
+ arch: _process.arch,
96
102
  };
97
103
  }
98
104
  return {
99
105
  type: "unknown",
100
106
  };
101
107
  }
108
+ /**
109
+ * Display names for the language runtimes whose version is meaningful to encode
110
+ * in a User-Agent. Environments where a version string is not useful (e.g.
111
+ * browsers, where `version` is the full navigator UA) are intentionally mapped
112
+ * to `undefined` so they are omitted from the User-Agent.
113
+ */
114
+ const RUNTIME_DISPLAY_NAMES = {
115
+ node: "Node",
116
+ deno: "Deno",
117
+ bun: "Bun",
118
+ browser: undefined,
119
+ "web-worker": undefined,
120
+ "react-native": undefined,
121
+ workerd: undefined,
122
+ "edge-runtime": undefined,
123
+ unknown: undefined,
124
+ };
125
+ /**
126
+ * Builds a structured User-Agent string of the form
127
+ * `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
128
+ * where the platform group and runtime segment are omitted gracefully when the
129
+ * underlying values cannot be determined (e.g. in a browser).
130
+ */
131
+ export function getUserAgent(sdkName, sdkVersion) {
132
+ let userAgent = `${sdkName}/${sdkVersion}`;
133
+ const platform = [RUNTIME.os, RUNTIME.arch].filter((part) => part != null && part.length > 0);
134
+ if (platform.length > 0) {
135
+ userAgent += ` (${platform.join("; ")})`;
136
+ }
137
+ const runtimeName = RUNTIME_DISPLAY_NAMES[RUNTIME.type];
138
+ if (runtimeName != null) {
139
+ userAgent += ` ${runtimeName}`;
140
+ if (RUNTIME.version != null && RUNTIME.version.length > 0) {
141
+ userAgent += `/${RUNTIME.version}`;
142
+ }
143
+ }
144
+ return userAgent;
145
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "17.8.0";
1
+ export declare const SDK_VERSION = "17.10.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "17.8.0";
1
+ export const SDK_VERSION = "17.10.0";
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
4
  "title": "Phenoml API",
5
- "version": "0f5e6fc5cd6ac889d00d6733e3b710e4fb90e90e"
5
+ "version": "4303ef3d3e7bb2159a5d8301937194e8bb681125"
6
6
  },
7
7
  "x-services": [
8
8
  {
@@ -2033,6 +2033,75 @@
2033
2033
  "x-service": "construe"
2034
2034
  }
2035
2035
  },
2036
+ "/construe/phenocr": {
2037
+ "post": {
2038
+ "tags": [
2039
+ "Construe / Codes"
2040
+ ],
2041
+ "operationId": "construe_phenocr",
2042
+ "summary": "[Alpha] Extract medical codes with phenocr",
2043
+ "description": "**Alpha:** phenocr is an alpha feature. The API contract \u2014 request\nparameters and response shape \u2014 may change as its internals evolve, and\nresults may vary between releases. Do not depend on it for production\nworkloads yet.\n\nExtracts medical codes from natural language clinical text using phenocr.\n\nSupported code systems: HPO, ICD-10-CM, and SNOMED_CT_US. The code\nsystem name and version are both required.\n",
2044
+ "requestBody": {
2045
+ "required": true,
2046
+ "content": {
2047
+ "application/json": {
2048
+ "schema": {
2049
+ "$ref": "#/components/schemas/construe_PhenoCRRequest"
2050
+ },
2051
+ "examples": {
2052
+ "hpo_phenotype_extraction": {
2053
+ "summary": "HPO Phenotype Extraction",
2054
+ "description": "Extract HPO phenotype terms from a clinical note.",
2055
+ "value": {
2056
+ "text": "5-year-old male with seizures, severe intellectual disability, microcephaly, and hypotonia.",
2057
+ "system": {
2058
+ "name": "HPO",
2059
+ "version": "umls-2026AA"
2060
+ }
2061
+ }
2062
+ }
2063
+ }
2064
+ }
2065
+ }
2066
+ },
2067
+ "responses": {
2068
+ "200": {
2069
+ "description": "Successfully extracted codes",
2070
+ "content": {
2071
+ "application/json": {
2072
+ "schema": {
2073
+ "$ref": "#/components/schemas/construe_ExtractCodesResult"
2074
+ }
2075
+ }
2076
+ }
2077
+ },
2078
+ "400": {
2079
+ "description": "Invalid request"
2080
+ },
2081
+ "401": {
2082
+ "description": "Unauthorized"
2083
+ },
2084
+ "404": {
2085
+ "description": "Code system not found"
2086
+ },
2087
+ "500": {
2088
+ "description": "Server error"
2089
+ },
2090
+ "503": {
2091
+ "description": "Service temporarily unavailable"
2092
+ },
2093
+ "504": {
2094
+ "description": "Request timed out"
2095
+ }
2096
+ },
2097
+ "security": [
2098
+ {
2099
+ "bearerAuth": []
2100
+ }
2101
+ ],
2102
+ "x-service": "construe"
2103
+ }
2104
+ },
2036
2105
  "/construe/codes/systems": {
2037
2106
  "get": {
2038
2107
  "tags": [
@@ -8468,6 +8537,42 @@
8468
8537
  }
8469
8538
  }
8470
8539
  },
8540
+ "construe_PhenoCRRequest": {
8541
+ "type": "object",
8542
+ "required": [
8543
+ "text",
8544
+ "system"
8545
+ ],
8546
+ "properties": {
8547
+ "text": {
8548
+ "type": "string",
8549
+ "description": "Natural language text to extract codes from",
8550
+ "example": "5-year-old male with seizures, severe intellectual disability, microcephaly, and hypotonia."
8551
+ },
8552
+ "system": {
8553
+ "$ref": "#/components/schemas/construe_PhenocrExtractRequestSystem"
8554
+ }
8555
+ }
8556
+ },
8557
+ "construe_PhenocrExtractRequestSystem": {
8558
+ "type": "object",
8559
+ "required": [
8560
+ "name",
8561
+ "version"
8562
+ ],
8563
+ "properties": {
8564
+ "name": {
8565
+ "type": "string",
8566
+ "description": "Code system name. Supported by phenocr: HPO, ICD-10-CM, SNOMED_CT_US.\n",
8567
+ "example": "HPO"
8568
+ },
8569
+ "version": {
8570
+ "type": "string",
8571
+ "description": "Code system version to run against.",
8572
+ "example": "umls-2026AA"
8573
+ }
8574
+ }
8575
+ },
8471
8576
  "construe_ExtractRequestSystem": {
8472
8577
  "type": "object",
8473
8578
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phenoml",
3
- "version": "17.8.0",
3
+ "version": "17.10.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -1683,6 +1683,83 @@ await client.construe.codes.extract({
1683
1683
  </dl>
1684
1684
 
1685
1685
 
1686
+ </dd>
1687
+ </dl>
1688
+ </details>
1689
+
1690
+ <details><summary><code>client.construe.codes.<a href="/src/api/resources/construe/resources/codes/client/Client.ts">phenocr</a>({ ...params }) -> phenoml.ExtractCodesResult</code></summary>
1691
+ <dl>
1692
+ <dd>
1693
+
1694
+ #### 📝 Description
1695
+
1696
+ <dl>
1697
+ <dd>
1698
+
1699
+ <dl>
1700
+ <dd>
1701
+
1702
+ **Alpha:** phenocr is an alpha feature. The API contract — request
1703
+ parameters and response shape — may change as its internals evolve, and
1704
+ results may vary between releases. Do not depend on it for production
1705
+ workloads yet.
1706
+
1707
+ Extracts medical codes from natural language clinical text using phenocr.
1708
+
1709
+ Supported code systems: HPO, ICD-10-CM, and SNOMED_CT_US. The code
1710
+ system name and version are both required.
1711
+ </dd>
1712
+ </dl>
1713
+ </dd>
1714
+ </dl>
1715
+
1716
+ #### 🔌 Usage
1717
+
1718
+ <dl>
1719
+ <dd>
1720
+
1721
+ <dl>
1722
+ <dd>
1723
+
1724
+ ```typescript
1725
+ await client.construe.codes.phenocr({
1726
+ text: "5-year-old male with seizures, severe intellectual disability, microcephaly, and hypotonia.",
1727
+ system: {
1728
+ name: "HPO",
1729
+ version: "umls-2026AA"
1730
+ }
1731
+ });
1732
+
1733
+ ```
1734
+ </dd>
1735
+ </dl>
1736
+ </dd>
1737
+ </dl>
1738
+
1739
+ #### ⚙️ Parameters
1740
+
1741
+ <dl>
1742
+ <dd>
1743
+
1744
+ <dl>
1745
+ <dd>
1746
+
1747
+ **request:** `phenoml.construe.PhenoCrRequest`
1748
+
1749
+ </dd>
1750
+ </dl>
1751
+
1752
+ <dl>
1753
+ <dd>
1754
+
1755
+ **requestOptions:** `CodesClient.RequestOptions`
1756
+
1757
+ </dd>
1758
+ </dl>
1759
+ </dd>
1760
+ </dl>
1761
+
1762
+
1686
1763
  </dd>
1687
1764
  </dl>
1688
1765
  </details>