-
Notifications
You must be signed in to change notification settings - Fork 7
Kerbearasaurus/use-phenoml-ts-sdk #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| username: email, | ||
| password, | ||
| baseUrl: 'https://experiment.app.pheno.ml', | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent baseUrl configuration across PhenoML client instances
Medium Severity
The new phenoml-workflow.ts bot explicitly sets baseUrl: 'https://experiment.app.pheno.ml' when creating the PhenoMLClient, but the converted bots (lang2fhir-create.ts, lang2fhir-document.ts, phenoml-cohort.ts) omit this configuration and rely on the SDK's default. The original code in all these bots explicitly used PHENOML_API_URL = "https://experiment.app.pheno.ml". If the SDK's default baseUrl differs from this experiment endpoint, the converted bots will connect to the wrong API environment, causing failures or unexpected behavior.
Additional Locations (2)
| throw new Error(`Authentication failed: ${authResponse.status} ${authResponse.statusText}`); | ||
| } | ||
| // Initialize PhenoML client with automatic auth handling | ||
| const phenomlClient = new PhenoMLClient({ username: email, password }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent baseUrl configuration in PhenoML client initialization
Medium Severity
The refactored bots (lang2fhir-create.ts, lang2fhir-document.ts, phenoml-cohort.ts) initialize PhenoMLClient without a baseUrl, while the new bots (phenoml-workflow.ts, phenoml-ips-summary.ts) explicitly set baseUrl: 'https://experiment.app.pheno.ml'. The old code being replaced explicitly used this URL via PHENOML_API_URL. If the SDK's default differs from this experiment URL, the refactored bots will fail or hit an incorrect endpoint while the new bots work correctly.
Additional Locations (2)
| const content = Buffer.from(arrayBuffer).toString('base64'); | ||
|
|
||
| const contentType = inputDocRef.content?.[0].attachment?.contentType || 'application/pdf'; | ||
| const fileType = FILE_TYPE_MAP[contentType] || 'application/pdf'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsupported file types silently misrepresented as PDF
Medium Severity
When a document has a content type not in FILE_TYPE_MAP (e.g., 'image/gif', 'image/tiff', 'application/msword'), the code silently falls back to 'application/pdf'. This sends the actual file bytes to the SDK while claiming it's a PDF, which will cause incorrect processing or confusing parsing errors. The old code would pass the actual content type, letting the API validate and reject unsupported types with a clear error. Missing validation for unsupported file types before calling the SDK.
| const content = Buffer.from(arrayBuffer).toString('base64'); | ||
|
|
||
| const contentType = inputDocRef.content?.[0].attachment?.contentType || 'application/pdf'; | ||
| const fileType = FILE_TYPE_MAP[contentType] || 'application/pdf'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsupported file types silently misrepresented as PDF
Medium Severity
When a document has a content type not in FILE_TYPE_MAP (e.g., 'image/gif', 'image/tiff', 'application/msword'), the code silently falls back to 'application/pdf'. This sends the actual file bytes to the SDK while claiming it's a PDF, which will cause incorrect processing or confusing parsing errors. The old code would pass the actual content type, letting the API validate and reject unsupported types with a clear error. Missing validation for unsupported file types before calling the SDK.
|
Brillante! @kerbearasaurus como siempre...! "A Medplum Bot that generates International Patient Summary (IPS) using PhenoML" Felicitaciones, porque siempre están pensado en construir "cosas" "herramientas" que las Personas y los Profesionales necesitan y usarán! :) |
use phenoml ts SDK for all bots
Note
Integrates PhenoML TS SDK and adds new automation bots
lang2fhir-createandlang2fhir-documentfor generating FHIR resources from text/documentsphenoml-cohortto analyze natural language into FHIR queries and createGroupcohortsphenoml-ips-summaryto produce IPS narrative from a patient bundle or fetched resourcesphenoml-workflowto execute PhenoML workflows by ID with input dataPHENOML_EMAIL,PHENOML_PASSWORD.build-bots.mjsbundles SDK (esbuild) and outputs todist/deploy-bots.tsregisters all new bots and their compiled artifacts (Lambda runtime)phenoml(and@huggingface/transformers) dependencies and retains existing scripts withbuild:botspipeline.Written by Cursor Bugbot for commit 2517f4d. This will update automatically on new commits. Configure here.