Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 6.0.0 - 2026-02-10
* refactor: simplify upload code system API and remove user_id fields
* Major refactoring of the upload code system API to simplify the interface and improve consistency. The upload request structure has been consolidated and user ID references have been removed from multiple templates to support a more streamlined architecture.
* Key changes:
* Unified upload request structure with simplified parameter handling
* Removed user_id fields from chat, workflow, FHIR provider, and other templates
* Updated upload code system to return asynchronous processing status
* Consolidated upload request types into a single interface
* Improved documentation for asynchronous processing workflow
* 🌿 Generated with Fern

## 5.3.0 - 2026-02-09
* feat: add custom code system export endpoint
* Add new exportCustomCodeSystem method to the construe client that allows exporting custom (non-builtin) code systems as JSON files. This feature enables users to backup and transfer code systems between instances.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phenoml",
"version": "5.3.0",
"version": "6.0.0",
"private": false,
"repository": "github:PhenoML/phenoml-ts-sdk",
"type": "commonjs",
Expand Down
12 changes: 5 additions & 7 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1154,8 +1154,9 @@ await client.cohort.analyze({
<dd>

Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
Returns 202 immediately; embedding generation runs asynchronously. Poll
GET /construe/codes/systems/{codesystem}?version={version} to check when status
transitions from "processing" to "ready" or "failed".
</dd>
</dl>
</dd>
Expand All @@ -1171,12 +1172,9 @@ subsequently use the code system for construe/extract and lang2fhir/create (comi

```typescript
await client.construe.uploadCodeSystem({
format: "csv",
name: "CUSTOM_CODES",
version: "1.0",
file: "file",
code_col: "code",
desc_col: "description"
format: "csv"
});

```
Expand All @@ -1193,7 +1191,7 @@ await client.construe.uploadCodeSystem({
<dl>
<dd>

**request:** `phenoml.UploadRequest`
**request:** `phenoml.construe.UploadRequest`

</dd>
</dl>
Expand Down
4 changes: 2 additions & 2 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class phenomlClient {
{
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "phenoml",
"X-Fern-SDK-Version": "5.3.0",
"User-Agent": "phenoml/5.3.0",
"X-Fern-SDK-Version": "6.0.0",
"User-Agent": "phenoml/6.0.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
2 changes: 0 additions & 2 deletions src/api/resources/agent/types/ChatMessageTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export interface ChatMessageTemplate {
created?: string;
/** Message updated time */
updated?: string;
/** User ID */
user_id?: string;
/** Function name */
function_name?: string;
/** Function arguments */
Expand Down
2 changes: 0 additions & 2 deletions src/api/resources/agent/types/ChatSessionTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
export interface ChatSessionTemplate {
/** Chat session ID */
id?: string;
/** User ID */
user_id?: string;
/** Chat session ID */
session_id?: string;
/** Chat session status */
Expand Down
10 changes: 4 additions & 6 deletions src/api/resources/construe/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ export class Construe {

/**
* Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
* Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
* subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
* Returns 202 immediately; embedding generation runs asynchronously. Poll
* GET /construe/codes/systems/{codesystem}?version={version} to check when status
* transitions from "processing" to "ready" or "failed".
*
* @param {phenoml.construe.UploadRequest} request
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
Expand All @@ -37,12 +38,9 @@ export class Construe {
*
* @example
* await client.construe.uploadCodeSystem({
* format: "csv",
* name: "CUSTOM_CODES",
* version: "1.0",
* file: "file",
* code_col: "code",
* desc_col: "description"
* format: "csv"
* })
*/
public uploadCodeSystem(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
// This file was auto-generated by Fern from our API Definition.

import type * as phenoml from "../../../index.js";
import type * as phenoml from "../../../../index.js";

/**
* Upload codes in JSON format. Either 'file' or 'codes' must be provided.
* If both are provided, 'codes' takes precedence.
* @example
* {
* name: "CUSTOM_CODES",
* version: "1.0",
* format: "csv"
* }
*/
export interface UploadRequestJson {
export interface UploadRequest {
/**
* Name of the code system. Names are case-insensitive and stored uppercase.
* Builtin system names (e.g. ICD-10-CM, SNOMED_CT_US_LITE, LOINC, CPT, etc.) are
Expand All @@ -17,13 +21,22 @@ export interface UploadRequestJson {
version: string;
/** Optional revision number */
revision?: number;
/** Upload format */
format: UploadRequest.Format;
/**
* The file contents as a base64-encoded JSON array string.
* Prefer using 'codes' instead to pass the array directly without base64 encoding.
* The file contents as a base64-encoded string.
* For CSV format, this is the CSV file contents.
* For JSON format, this is a base64-encoded JSON array; prefer using 'codes' instead.
*/
file?: string;
/** Column name containing codes (required for CSV format) */
code_col?: string;
/** Column name containing descriptions (required for CSV format) */
desc_col?: string;
/** Optional column name containing long definitions (for CSV format) */
defn_col?: string;
/**
* The codes to upload as a JSON array.
* The codes to upload as a JSON array (JSON format only).
* This is the preferred way to upload JSON codes, as it avoids unnecessary base64 encoding.
* If both 'codes' and 'file' are provided, 'codes' takes precedence.
*/
Expand All @@ -34,10 +47,13 @@ export interface UploadRequestJson {
* When false (default), uploading a duplicate returns 409 Conflict.
*/
replace?: boolean;
/**
* If true, returns 202 Accepted immediately after validation and starts processing
* in the background. Poll GET /construe/codes/systems/{name}?version={version} to
* check when status transitions from "processing" to "ready" or "failed".
*/
async?: boolean;
}

export namespace UploadRequest {
/** Upload format */
export const Format = {
Csv: "csv",
Json: "json",
} as const;
export type Format = (typeof Format)[keyof typeof Format];
}
1 change: 1 addition & 0 deletions src/api/resources/construe/client/requests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export type { GetConstrueCodesCodesystemSearchSemanticRequest } from "./GetConst
export type { GetConstrueCodesCodesystemSearchTextRequest } from "./GetConstrueCodesCodesystemSearchTextRequest.js";
export type { GetConstrueCodesSystemsCodesystemExportRequest } from "./GetConstrueCodesSystemsCodesystemExportRequest.js";
export type { GetConstrueCodesSystemsCodesystemRequest } from "./GetConstrueCodesSystemsCodesystemRequest.js";
export type { UploadRequest } from "./UploadRequest.js";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type-only export makes Format enum values inaccessible

Medium Severity

The UploadRequest namespace defines runtime const Format values (Csv, Json), but requests/index.ts re-exports it using export type { UploadRequest }, which strips the runtime value. SDK consumers cannot access UploadRequest.Format.Csv or UploadRequest.Format.Json at runtime — these are effectively dead code. The comparable GetCodeSystemDetailResponse.Status const is properly exported via export * from the types index and works correctly.

Additional Locations (1)

Fix in Cursor Fix in Web

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

export interface ConstrueUploadCodeSystemResponse {
status?: string;
name?: string;
version?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export interface GetCodeSystemDetailResponse {
builtin: boolean;
/**
* Processing status of the code system.
* - "processing": embeddings are being generated (async upload in progress)
* - "processing": embeddings are being generated
* - "ready": code system is ready for use
* - "failed": async processing failed (re-upload with replace=true to retry)
* - "failed": processing failed (re-upload with replace=true to retry)
*/
status: GetCodeSystemDetailResponse.Status;
/** When the code system was created */
Expand All @@ -25,9 +25,9 @@ export interface GetCodeSystemDetailResponse {
export namespace GetCodeSystemDetailResponse {
/**
* Processing status of the code system.
* - "processing": embeddings are being generated (async upload in progress)
* - "processing": embeddings are being generated
* - "ready": code system is ready for use
* - "failed": async processing failed (re-upload with replace=true to retry)
* - "failed": processing failed (re-upload with replace=true to retry)
*/
export const Status = {
Processing: "processing",
Expand Down
15 changes: 0 additions & 15 deletions src/api/resources/construe/types/UploadRequest.ts

This file was deleted.

34 changes: 0 additions & 34 deletions src/api/resources/construe/types/UploadRequestCsv.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/api/resources/construe/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,3 @@ export * from "./SemanticSearchResponse.js";
export * from "./SemanticSearchResult.js";
export * from "./TextSearchResponse.js";
export * from "./TextSearchResult.js";
export * from "./UploadRequest.js";
export * from "./UploadRequestCsv.js";
export * from "./UploadRequestJson.js";
2 changes: 0 additions & 2 deletions src/api/resources/fhirProvider/types/FhirProviderTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import type * as phenoml from "../../../index.js";
export interface FhirProviderTemplate {
/** Unique identifier for the FHIR provider */
id?: string;
/** ID of the user who owns this FHIR provider */
user_id?: string;
/** Display name for the FHIR provider */
name?: string;
/** Optional description of the FHIR provider */
Expand Down
1 change: 0 additions & 1 deletion src/api/resources/summary/types/SummaryTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

export interface SummaryTemplate {
id?: string;
user_id?: string;
name?: string;
description?: string;
/** Template with {{resource.field}} placeholders */
Expand Down
2 changes: 0 additions & 2 deletions src/api/resources/tools/types/McpServerResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export namespace McpServerResponse {
export interface Data {
/** ID of the MCP server */
id?: string;
/** ID of the user who created the MCP server */
user_id?: string;
/** Name of the MCP server */
name?: string;
/** Description of the MCP server */
Expand Down
2 changes: 0 additions & 2 deletions src/api/resources/tools/types/McpServerToolResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export namespace McpServerToolResponse {
export interface Data {
/** ID of the MCP server tool */
id?: string;
/** ID of the user who created the MCP server tool */
user_id?: string;
/** Name of the MCP server tool */
name?: string;
/** Description of the MCP server tool */
Expand Down
2 changes: 0 additions & 2 deletions src/api/resources/workflows/types/WorkflowDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import type * as phenoml from "../../../index.js";
export interface WorkflowDefinition {
/** Unique identifier for the workflow */
id?: string;
/** ID of the user who created the workflow */
user_id?: string;
/** Human-readable name for the workflow */
name?: string;
/** Natural language instructions that define the workflow logic */
Expand Down
2 changes: 0 additions & 2 deletions src/api/resources/workflows/types/WorkflowResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import type * as phenoml from "../../../index.js";
export interface WorkflowResponse {
/** Unique identifier for the workflow */
id?: string;
/** ID of the user who created the workflow */
user_id?: string;
/** Human-readable name for the workflow */
name?: string;
/** Natural language instructions that define the workflow logic */
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SDK_VERSION = "5.3.0";
export const SDK_VERSION = "6.0.0";
2 changes: 0 additions & 2 deletions tests/wire/agent/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,6 @@ describe("Agent", () => {
content: "Hello, how are you?",
created: "2021-01-01T00:00:00Z",
updated: "2021-01-01T00:00:00Z",
user_id: "user_123",
function_name: "get_patient_info",
function_args: { patient_id: "123" },
function_result: { name: "John Doe" },
Expand Down Expand Up @@ -925,7 +924,6 @@ describe("Agent", () => {
content: "Hello, how are you?",
created: "2021-01-01T00:00:00Z",
updated: "2021-01-01T00:00:00Z",
user_id: "user_123",
function_name: "get_patient_info",
function_args: {
patient_id: "123",
Expand Down
Loading