From 0750542b25ee96d5243c8bb9cd3661a2a073ae23 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 12 May 2025 21:22:07 +0000 Subject: [PATCH] CodeGen from PR 34498 in Azure/azure-rest-api-specs Merge d1d2aa5b640dd868064d9d44acca625471c824c8 into 941fa4f0e3a86094c9e0fe61698c0646497d0753 --- .../CHANGELOG.md | 124 +- .../LICENSE | 21 + .../README.md | 731 +------- .../api-extractor.json | 4 +- .../assets.json | 6 - .../eslint.config.mjs | 14 + .../package.json | 149 +- .../health-insights-radiologyinsights.api.md | 344 +++- .../sample.env | 4 +- .../sample_age_mismatch_inference_async.ts | 243 --- ...plete_order_discrepancy_inference_async.ts | 239 --- .../sample_critical_result_inference_async.ts | 217 --- ...sample_critical_result_managed_identity.ts | 229 --- .../sample_finding_inference_async.ts | 247 --- ...follow_up_communication_inference_async.ts | 227 --- ...ollow_up_recommendation_inference_async.ts | 285 --- ..._laterality_discrepancy_inference_async.ts | 217 --- ...mited_order_discrepancy_inference_async.ts | 247 --- ...ple_radiology_procedure_inference_async.ts | 253 --- .../sample_sex_mismatch_inference_async.ts | 230 --- .../samples/v1/javascript/README.md | 70 - .../samples/v1/javascript/package.json | 33 - .../samples/v1/javascript/sample.env | 3 - .../sample_age_mismatch_inference_async.js | 258 --- ...plete_order_discrepancy_inference_async.js | 254 --- .../sample_critical_result_inference_async.js | 233 --- ...sample_critical_result_managed_identity.js | 245 --- .../sample_finding_inference_async.js | 246 --- ...follow_up_communication_inference_async.js | 236 --- ...ollow_up_recommendation_inference_async.js | 280 --- ..._laterality_discrepancy_inference_async.js | 216 --- ...mited_order_discrepancy_inference_async.js | 253 --- ...ple_radiology_procedure_inference_async.js | 257 --- .../sample_sex_mismatch_inference_async.js | 249 --- .../samples/v1/typescript/README.md | 83 - .../samples/v1/typescript/package.json | 42 - .../samples/v1/typescript/sample.env | 3 - .../sample_age_mismatch_inference_async.ts | 239 --- ...plete_order_discrepancy_inference_async.ts | 236 --- .../sample_critical_result_inference_async.ts | 215 --- ...sample_critical_result_managed_identity.ts | 227 --- .../src/sample_finding_inference_async.ts | 243 --- ...follow_up_communication_inference_async.ts | 220 --- ...ollow_up_recommendation_inference_async.ts | 265 --- ..._laterality_discrepancy_inference_async.ts | 207 --- ...mited_order_discrepancy_inference_async.ts | 243 --- ...ple_radiology_procedure_inference_async.ts | 250 --- .../sample_sex_mismatch_inference_async.ts | 227 --- .../samples/v1/typescript/tsconfig.json | 17 - .../src/azureHealthInsightsClient.ts | 37 +- .../src/clientDefinitions.ts | 13 +- .../src/index.ts | 6 +- .../src/isUnexpected.ts | 11 +- .../src/models.ts | 305 ++-- .../src/outputModels.ts | 312 ++-- .../src/parameters.ts | 39 +- .../src/pollingHelper.ts | 146 +- .../src/responses.ts | 36 +- .../src/serializeHelper.ts | 14 - .../SampleAgeMismatchInferenceAsync.spec.ts | 212 --- ...leteOrderDiscrepancyInferenceAsync.spec.ts | 213 --- ...SampleCriticalResultInferenceAsync.spec.ts | 190 -- .../SampleFindingInferenceAsync.spec.ts | 222 --- .../SampleFollowUpCommunicationAsync.spec.ts | 203 --- .../SampleFollowUpRecommendationAsync.spec.ts | 261 --- ...ateralityDiscrepancyInferenceAsync.spec.ts | 190 -- ...itedOrderDiscrepancyInferenceAsync.spec.ts | 223 --- ...leRadiologyProcedureInferenceAsync.spec.ts | 240 --- .../SampleSexMismatchInferenceAsync.spec.ts | 204 --- .../Test_RadiologyInsights_async.spec.ts | 164 -- .../test/public/sampleTest.spec.ts | 20 + .../test/public/utils/env-browser.mts | 2 - .../test/public/utils/env.ts | 4 - .../test/public/utils/recordedClient.ts | 45 +- .../test/snippets.spec.ts | 613 ------- .../tsconfig.json | 5 +- .../tsp-location.yaml | 9 +- .../vitest.browser.config.ts | 3 +- .../vitest.config.ts | 1 + .../vitest.esm.config.ts | 6 +- .../baseline/review/index.ts | 1351 +++++++++++++++ .../current/review/index.ts | 1524 +++++++++++++++++ .../.tmp-breaking-change-detect/tsconfig.json | 17 + 83 files changed, 3945 insertions(+), 12477 deletions(-) create mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/LICENSE delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/assets.json create mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/eslint.config.mjs delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_age_mismatch_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_complete_order_discrepancy_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_critical_result_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_critical_result_managed_identity.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_finding_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_follow_up_communication_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_follow_up_recommendation_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_laterality_discrepancy_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_limited_order_discrepancy_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_radiology_procedure_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_sex_mismatch_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/README.md delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/package.json delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample.env delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_age_mismatch_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_complete_order_discrepancy_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_managed_identity.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_finding_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_communication_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_recommendation_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_laterality_discrepancy_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_limited_order_discrepancy_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_radiology_procedure_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_sex_mismatch_inference_async.js delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/README.md delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/package.json delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/sample.env delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_age_mismatch_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_complete_order_discrepancy_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_managed_identity.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_finding_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_communication_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_recommendation_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_laterality_discrepancy_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_limited_order_discrepancy_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_radiology_procedure_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_sex_mismatch_inference_async.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/tsconfig.json delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/src/serializeHelper.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleAgeMismatchInferenceAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleCompleteOrderDiscrepancyInferenceAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleCriticalResultInferenceAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFindingInferenceAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFollowUpCommunicationAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFollowUpRecommendationAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleLateralityDiscrepancyInferenceAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleLimitedOrderDiscrepancyInferenceAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleRadiologyProcedureInferenceAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleSexMismatchInferenceAsync.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/Test_RadiologyInsights_async.spec.ts create mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/sampleTest.spec.ts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/env-browser.mts delete mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/env.ts create mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/baseline/review/index.ts create mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/current/review/index.ts create mode 100644 sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/tsconfig.json diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/CHANGELOG.md b/sdk/healthinsights/health-insights-radiologyinsights-rest/CHANGELOG.md index 3160db23e0ff..c7dc3d5d5fec 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/CHANGELOG.md +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/CHANGELOG.md @@ -1,71 +1,55 @@ # Release History - -## 1.0.0 (2024-08-15) - - - GA release - - ### Features Added -- Added sample code for all Inference types -- Added tests for all Inference types -- Rename param endpoint to endpointParam -- Rename const baseUrl to endpointUrl - - ### Breaking Changes - -- Client Changes - - POST call replaced with PUT (this change is taken care of automatically by the SDK) - - Adding TokenCredential remove KeyCredential - - Credential through DefaultAzureCredential and Managed Identities - -- Request changes: - - Renamed 'createdDateTime' into 'createdAt' - - Patients 'info' renamed into Patients 'details' - - Unique ID (String) required to be added in the request parameters as a unique job id - - Renamed 'RadiologyInsightsResultOutput' into 'RadiologyInsightsJobOutput' with the status being a 'JobStatusOutput' in stead of a string - - Retired 'RepeatabilityResultOutput' - -- Response changes: - - for RadiologyInsightsJobOutput - - Renamed 'createdDateTime' into 'createdAt' - - Renamed 'expirationDateTime' into 'expiresAt' - - Renamed 'lastUpdateDateTime' into 'updatedAt' - - - for ElementOutput - - added field 'kind' as a string - - - for ContactPointOutput - - 'system' field is now a 'ContactPointSystemOutput' and no longer a string - - 'use' field is now a 'ContactPointUseOutput' and no longer a string - - - for DomainResourceOutputParent - - 'status' field is now a 'ObservationStatusCodeTypeOutput' and no longer a string, limited to 4 options (registered | preliminary | final | amended) - - - for ConditionOutput - - 'status' field is now a 'ResearchStudyStatusCodeTypeOutput' and no longer a string - - - for FollowupRecommendationInferenceOutput - - Renamed 'effectiveDateTime' field into 'effectiveAt' - - - for RecommendationFindingOutput - - 'recommendationFindingStatus' field is now a RecommendationFindingStatusTypeOutput and no longer a string - - 'extension' field added - - - for ProcedureRecommendationOutputParent - - 'extension' field added - - - for FollowupCommunication - - Renamed 'dateTime' field into 'communicatedAt' - - 'recipient' field is now a 'MedicalProfessionalTypeOutput' and no longer a string[] - -## 1.0.0-beta.1 (2024-03-05) - -### Other Changes - -- Public Preview release -- Test example for Critical Result - -The package of @azure-rest/health-insights-radiologyinsights is using our next generation design principles. -- First release of package, see [README](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest/README.md) for details. -- To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). -- To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). -- To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). + +## 2.0.0 (2025-05-12) + +### Features Added + + - Added operation group SimplePollerLike + - Added Interface AssessmentValueRange + - Added Interface AssessmentValueRangeOutput + - Added Interface AzureHealthInsightsClientOptions + - Added Interface CreateJobExpandQueryParam + - Added Interface Element_2 + - Added Interface GetJobExpandQueryParam + - Added Interface GuidanceInference + - Added Interface GuidanceInferenceOutput + - Added Interface GuidanceOptions + - Added Interface GuidanceOptionsOutput + - Added Interface PresentGuidanceInformation + - Added Interface PresentGuidanceInformationOutput + - Added Interface QualityMeasureInference + - Added Interface QualityMeasureInferenceOutput + - Added Interface QualityMeasureOptions + - Added Interface QualityMeasureOptionsOutput + - Added Interface ScoringAndAssessmentInference + - Added Interface ScoringAndAssessmentInferenceOutput + - Added Type Alias GuidanceRankingType + - Added Type Alias QualityMeasureComplianceType + - Added Type Alias ScoringAndAssessmentCategoryType + - Interface RadiologyInsightsInferenceOptions has a new optional parameter guidanceOptions + - Interface RadiologyInsightsInferenceOptions has a new optional parameter qualityMeasureOptions + - Interface RadiologyInsightsInferenceOptionsOutput has a new optional parameter guidanceOptions + - Interface RadiologyInsightsInferenceOptionsOutput has a new optional parameter qualityMeasureOptions + - Added function overload "export function isUnexpected(response: GetJob200Response | GetJobDefaultResponse): response is GetJobDefaultResponse;" + - Added function overload "export function isUnexpected(response: CreateJob200Response | CreateJob201Response | CreateJobLogicalResponse | CreateJobDefaultResponse): response is CreateJobDefaultResponse;" + +### Breaking Changes + + - Operation GetJob.put has a new signature + - Interface HealthInsightsErrorResponseOutput no longer has parameter requestId + - Type of parameter expand of interface CreateJobQueryParamProperties is changed from string to CreateJobExpandQueryParam + - Type of parameter valueTime of interface Extension is changed from Date | string to string + - Type of parameter expand of interface GetJobQueryParamProperties is changed from string to GetJobExpandQueryParam + - Type of parameter valueTime of interface Observation is changed from Date | string to string + - Type of parameter valueTime of interface ObservationComponent is changed from Date | string to string + - Type of parameter birthDate of interface PatientDetails is changed from Date | string to string + - Removed Enum ClinicalDocumentTypeEnum + - Removed Enum ClinicalDocumentTypeOutputEnum + - Removed function buildMultiCollection + - Function getLongRunningPoller has a new signature + - Removed function overload "export function isUnexpected(response: GetJob200Response | GetJobDefaultResponse): response is GetJobDefaultResponse;" + - Removed function overload "export function isUnexpected(response: CreateJob200Response | CreateJob201Response | CreateJobLogicalResponse | CreateJobDefaultResponse): response is CreateJobDefaultResponse;" + - Removed Type Alias DocumentType + - Type alias "ClinicalDocumentType" has been changed + - Type alias "ClinicalDocumentTypeOutput" has been changed + diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/LICENSE b/sdk/healthinsights/health-insights-radiologyinsights-rest/LICENSE new file mode 100644 index 000000000000..63447fd8bbbf --- /dev/null +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/README.md b/sdk/healthinsights/health-insights-radiologyinsights-rest/README.md index 781cd2fe3f4c..c1849cef3ee5 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/README.md +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/README.md @@ -1,728 +1,44 @@ -# Azure Cognitive Services Health Insights Radiology Insights REST client library for JavaScript +# AzureHealthInsights REST client library for JavaScript -[Health Insights][health_insights] is an Azure Applied AI Service built with the Azure Cognitive Services Framework, that leverages multiple Cognitive Services, Healthcare API services and other Azure resources. - -[Radiology Insights][radiology_insights_docs] is a model that aims to provide quality checks as feedback on errors and inconsistencies (mismatches) and ensures critical findings are identified and communicated using the full context of the report. Follow-up recommendations and clinical findings with measurements (sizes) documented by the radiologist are also identified. +Azure AI Health Insights provides an API that serves insight models, specific for Health & Life Sciences, that perform analysis and provide inferences to be used by a human. **Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library** Key links: -[Source code] | [Package (NPM)] | [API reference documentation] | [Product Information] | [Samples] + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest) +- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/health-insights-radiologyinsights) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure-rest/health-insights-radiologyinsights?view=azure-node-preview) ## Getting started ### Currently supported environments - LTS versions of Node.js -- Latest versions of Safari, Chrome, Edge and Firefox. ### Prerequisites -- LTS versions of Node.js - You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package. -- An existing Cognitive Services Health Insights instance. ### Install the `@azure-rest/health-insights-radiologyinsights` package -Install the RadiologyInsights REST client library for JavaScript with `npm`: +Install the AzureHealthInsights REST client REST client library for JavaScript with `npm`: ```bash npm install @azure-rest/health-insights-radiologyinsights ``` -### Create and authenticate a `RadiologyInsightsClient` - -To use an [Azure Active Directory (AAD) token credential][token_credential], -provide an instance of the desired credential type obtained from the [Azure Identity library][azure_identity]. - -To authenticate with AAD, you must first `npm` install [`@azure/identity`][identity] - -After setup, you can choose which type of [credential][credential] from `@azure/identity` to use. -As an example, [DefaultAzureCredential][defaultazurecredential] -can be used to authenticate the client. See more info on defaultAzureCredentials [default_information]. -Managed Identities can also be used to authenticate through DefaultAzureCredential [managed_identity]. - -## Examples - -### Create a RadiologyInsights asynchronous client - -```ts snippet:ReadmeSampleCreateClient_Node -import { DefaultAzureCredential } from "@azure/identity"; -import RadiologyInsightsRestClient from "@azure-rest/health-insights-radiologyinsights"; - -const endpoint = "https://"; -const credential = new DefaultAzureCredential(); -const client = RadiologyInsightsRestClient(endpoint, credential); -``` - -### Build a request, send it to the client and print out the description of a Critical Result Inference - -```ts snippet:ReadmeSampleCriticalResultInference -import { DefaultAzureCredential } from "@azure/identity"; -import RadiologyInsightsRestClient, { - ClinicalDocumentTypeEnum, - isUnexpected, - getLongRunningPoller, - RadiologyProcedureInference, - Coding, - ImagingProcedure, -} from "@azure-rest/health-insights-radiologyinsights"; - -const endpoint = "https://"; -const credential = new DefaultAzureCredential(); -const client = RadiologyInsightsRestClient(endpoint, credential); - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "24727-0", - display: "CT HEAD W CONTRAST IV", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "CT HEAD W CONTRAST IV", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: ` Exam: Head CT with Contrast - - History: Headaches for 2 months - Technique: Axial, sagittal, and coronal images were reconstructed from helical CT through the head without IV contrast. - IV contrast: 100 mL IV Omnipaque 300. - - Findings: There is no mass effect. There is no abnormal enhancement of the brain or within injuries with IV contrast. - However, there is no evidence of enhancing lesion in either internal auditory canal. - Impression: Negative CT of the brain without IV contrast. - I recommend a new brain CT within nine months.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "CT HEAD W CONTRAST IV", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const radiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -// Create request body -const radiologyInsightsParameter = { body: radiologyInsightsJob }; - -// Initiate radiology insights job and retrieve results -const dateString = Date.now(); -const jobID = "jobId-" + dateString; -const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - -if (isUnexpected(initialResponse)) { - throw initialResponse.body.error; -} - -const poller = await getLongRunningPoller(client, initialResponse); -const radiologyInsightsResult = await poller.pollUntilDone(); - -if (isUnexpected(radiologyInsightsResult)) { - throw radiologyInsightsResult.body.error; -} - -const result = radiologyInsightsResult.body.result; - -if (result) { - for (const patientResult of result.patientResults) { - if (patientResult.inferences) { - for (const inference of patientResult.inferences) { - if (inference.kind === "radiologyProcedure") { - console.log("Radiology Procedure Inference found"); - const radiologyProcedureInference = inference as RadiologyProcedureInference; - for (const procedureCode of radiologyProcedureInference?.procedureCodes || []) { - console.log(" Procedure Codes: "); - displayCodes(procedureCode.coding); - } - - if (radiologyProcedureInference.imagingProcedures) { - console.log(" Imaging Procedure Codes: "); - for (const imagingProcedure of radiologyProcedureInference.imagingProcedures) { - displayImaging(imagingProcedure); - } - } - - if (radiologyProcedureInference.orderedProcedure) { - console.log(" Ordered Procedure Codes: "); - displayCodes(radiologyProcedureInference.orderedProcedure.code?.coding); - } - - if (radiologyProcedureInference.orderedProcedure.description) { - console.log( - ` Description: ${radiologyProcedureInference.orderedProcedure.description}`, - ); - } - } - } - } - } -} - -function displayCodes(codingList: Coding[] | undefined) { - for (const coding of codingList || []) { - console.log(` Coding: ${coding.code} , ${coding.display} (${coding.system})`); - } -} - -function displayImaging(images: ImagingProcedure): void { - console.log(" Modality Codes: "); - displayCodes(images.modality.coding); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy.coding); - if (images.laterality) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality.coding); - } - if (images.contrast) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code.coding); - } - if (images.view) { - console.log(" View Codes: "); - displayCodes(images.view.code.coding); - } -} -``` - -### Print out the Age Mismatch Inference evidences - -```ts snippet:ReadmeSampleAgeMismatch -import { - RadiologyInsightsJobOutput, - ExtensionOutput, -} from "@azure-rest/health-insights-radiologyinsights"; - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput, content: string): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "ageMismatch") { - console.log("Age Mismatch Inference found: "); - const evidence = findAgeEvidence(inference.extension, content); - console.log(" Evidence: " + evidence); - } - } - } - - function findAgeEvidence(extensions: ExtensionOutput[], content: string) { - let offset = -1; - let length = -1; - let piece = ""; - let evidence = ""; - // for loop needed for traversing from top to bottom of the array - for (const first of extensions) { - for (const ext of first.extension) { - if (ext.url === "offset") { - offset = ext.valueInteger; - } else if (ext.url === "length") { - length = ext.valueInteger; - } - if (offset > 0 && length > 0) { - piece = content.substring(offset, offset + length); - } - } - evidence += `${piece} `; - } - return evidence; - } -} -``` - -### Print out the Complete Order Discrepancy Inference ordertype and its missing Body Parts and missing Body Part Measurements - -```ts snippet:ReadmeSampleCompleteOrderDiscrepancy -import { - RadiologyInsightsJobOutput, - CompleteOrderDiscrepancyInference, - CodeableConcept, -} from "@azure-rest/health-insights-radiologyinsights"; - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "completeOrderDiscrepancy") { - const completeOrderDiscrepancyInference = inference as CompleteOrderDiscrepancyInference; - console.log("Complete Order Discrepancy Inference found: "); - console.log(" Ordertype: "); - displayCodes({ codeableConcept: completeOrderDiscrepancyInference.orderType }); - - for (const missingBodyPart of completeOrderDiscrepancyInference.missingBodyParts) { - console.log(" Missing Body Parts: "); - displayCodes({ codeableConcept: missingBodyPart }); - } - - for (const missingBodymeasure of completeOrderDiscrepancyInference.missingBodyPartMeasurements) { - console.log(" Missing Body Part Measurements: "); - displayCodes({ codeableConcept: missingBodymeasure }); - } - } - } - } - - function displayCodes({ codeableConcept }: { codeableConcept: CodeableConcept }): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } -} -``` - -### Print out the Finding Inference code, interpretation, Component codes and the section info +### Create and authenticate a `AzureHealthInsightsClient` -```ts snippet:ReadmeSampleFindingInference -import { - RadiologyInsightsJobOutput, - FindingInference, - CodeableConcept, - Extension, -} from "@azure-rest/health-insights-radiologyinsights"; +To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), +provide an instance of the desired credential type obtained from the +[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library. -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.result) { - for (const patientResult of radiologyInsightsResult.result.patientResults) { - if (patientResult.inferences) { - for (const inference of patientResult.inferences) { - console.log("Finding Inference found: "); - if (inference.kind === "finding") { - const findingInference = inference as FindingInference; +To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) - if (findingInference.finding.code) { - console.log(" Code: "); - displayCodes(findingInference.finding.code); - } - - for (const interpretation of findingInference.finding.interpretation) { - console.log(" Interpretation: "); - displayCodes(interpretation); - } - - for (const component of findingInference.finding.component) { - console.log(" Component code: "); - displayCodes(component.code); - if (component.valueCodeableConcept) { - console.log(" Value component codeable concept: "); - displayCodes(component.valueCodeableConcept); - } - } - - if (findingInference.extension) { - displaySectionInfo(findingInference); - } - } - } - } - } - } - - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - - function displaySectionInfo(inference: { extension?: Extension[] }) { - for (const extension of inference.extension || []) { - if (extension.url === "section") { - console.log(" Section:"); - for (const { url, valueString } of extension.extension || []) { - console.log(` ${url}: ${valueString}`); - } - } - } - } -} -``` - -### Print out the Follow Up Communication Inference date and recipient - -```ts snippet:ReadmeSampleFollowUpCommunication -import { - RadiologyInsightsJobOutput, - FollowupCommunicationInference, -} from "@azure-rest/health-insights-radiologyinsights"; - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "followupCommunication") { - const followupCommunicationInference = inference as FollowupCommunicationInference; - console.log("Followup Communication Inference found"); - if (followupCommunicationInference.communicatedAt) { - console.log( - `Communicated at: ${followupCommunicationInference.communicatedAt.join(" ")}`, - ); - } - if (followupCommunicationInference.recipient) { - console.log(`Recipient: ${followupCommunicationInference.recipient.join(" ")}`); - } - console.log(` Acknowledged: ${followupCommunicationInference.wasAcknowledged}`); - } - } - } -} -``` - -### Print out the Follow Up Recommendation Inference booleans, Generic Procedure code, description and Imaging Procedure codes - -```ts snippet:ReadmeSampleFollowUpRecommendation -import { - RadiologyInsightsJobOutput, - FollowupRecommendationInference, - GenericProcedureRecommendation, - ImagingProcedureRecommendation, - CodeableConcept, - ImagingProcedure, -} from "@azure-rest/health-insights-radiologyinsights"; - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "followupRecommendation") { - const followupRecommendationInference = inference as FollowupRecommendationInference; - - console.log("Follow Up Recommendation Inference found"); - console.log(` Is conditional: ${followupRecommendationInference.isConditional}`); - console.log(` Is guideline: ${followupRecommendationInference.isGuideline}`); - console.log(` Is hedging: ${followupRecommendationInference.isHedging}`); - console.log(` Is option: ${followupRecommendationInference.isOption}`); - - const procedure = followupRecommendationInference.recommendedProcedure; - if (procedure.kind === "genericProcedureRecommendation") { - const genericProcedureRecommendation = procedure as GenericProcedureRecommendation; - console.log(` Recommended Generic Procedure: ${genericProcedureRecommendation.code}`); - console.log(` Description: ${genericProcedureRecommendation.description}`); - } else if (procedure.kind === "imagingProcedureRecommendation") { - const imagingProcedureRecommendation = procedure as ImagingProcedureRecommendation; - - for (const procedureCode of imagingProcedureRecommendation?.procedureCodes || []) { - console.log(" Recommended Procedure Codes: "); - displayCodes(procedureCode); - } - - for (const imagingProcedure of imagingProcedureRecommendation?.imagingProcedures || []) { - console.log(" Recommended Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - } - } - } - } - } - - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - - function displayImaging(images: ImagingProcedure): void { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if (images.laterality) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if (images.contrast) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if (images.view) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } -} -``` - -### Print out the Laterality Discrepancy Inference code - -```ts snippet:ReadmeSampleLateralityDiscrepancy -import { - RadiologyInsightsJobOutput, - LateralityDiscrepancyInference, - CodeableConcept, -} from "@azure-rest/health-insights-radiologyinsights"; - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "lateralityDiscrepancy") { - const lateralityDiscrepancyInference = inference as LateralityDiscrepancyInference; - console.log("Laterality Discrepancy Inference found: "); - displayCodes(lateralityDiscrepancyInference.lateralityIndication); - } - } - } - - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } -} -``` - -### Print out the Limited Order Discrepancy Inference ordertype with present Body Parts and present Body Part Measurements - -```ts snippet:ReadmeSampleLimitedOrderDiscrepancy -import { - RadiologyInsightsJobOutput, - LimitedOrderDiscrepancyInference, - CodeableConcept, -} from "@azure-rest/health-insights-radiologyinsights"; - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "limitedOrderDiscrepancy") { - const limitedOrderDiscrepancyInference = inference as LimitedOrderDiscrepancyInference; - - console.log("Limited Order Discrepancy Inference found: "); - console.log(" Ordertype: "); - displayCodes(limitedOrderDiscrepancyInference.orderType); - - for (const presentBodyParts of limitedOrderDiscrepancyInference?.presentBodyParts || []) { - console.log(" Present Body Parts: "); - displayCodes(presentBodyParts); - } - - for (const presentBodymeasure of limitedOrderDiscrepancyInference?.presentBodyPartMeasurements || - []) { - console.log(" Present Body Part Measurements: "); - displayCodes(presentBodymeasure); - } - } - } - } - - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } -} -``` - -### Print out the Radiology Procedure Inference codes, Imaging Procedure codes and Order Procedure Codes and its description - -```ts snippet:ReadmeSampleRadiologyProcedure -import { - RadiologyInsightsJobOutput, - RadiologyProcedureInference, - CodeableConcept, - ImagingProcedure, -} from "@azure-rest/health-insights-radiologyinsights"; - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "radiologyProcedure") { - const radiologyProcedureInference = inference as RadiologyProcedureInference; - console.log("Radiology Procedure Inference found"); - - for (const procedureCode of radiologyProcedureInference?.procedureCodes || []) { - console.log(" Procedure Codes: "); - displayCodes(procedureCode); - } - - for (const imagingProcedure of radiologyProcedureInference?.imagingProcedures || []) { - console.log(" Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - } - - if (radiologyProcedureInference.orderedProcedure) { - console.log(" Ordered Procedure Codes: "); - displayCodes(radiologyProcedureInference.orderedProcedure.code); - } - - if (radiologyProcedureInference.orderedProcedure.description) { - console.log( - ` Description: ${radiologyProcedureInference.orderedProcedure.description}`, - ); - } - } - } - } - - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - - function displayImaging(images: ImagingProcedure): void { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if (images.laterality) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if (images.contrast) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if (images.view) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } -} -``` - -### Print out the Sex Mismatch Inference code - -```ts snippet:ReadmeSampleSexMismatch -import { - RadiologyInsightsJobOutput, - SexMismatchInference, - CodeableConcept, -} from "@azure-rest/health-insights-radiologyinsights"; - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "sexMismatch") { - const sexMismatchInference = inference as SexMismatchInference; - console.log("Sex Mismatch Inference found: "); - displayCodes(sexMismatchInference.sexIndication); - } - } - } - - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } -} -``` - -## Using a Managed Identity require changes in adding the clientID of your managed identity as a const, adding it to you DefaultAzureCredential and add the Authorization Header - -```ts snippet:ReadmeSampleManagedIdentity -import { DefaultAzureCredential } from "@azure/identity"; -import RadiologyInsightsRestClient from "@azure-rest/health-insights-radiologyinsights"; - -const managedIdentityClientId = ""; -const endpoint = "https://"; -const credential = new DefaultAzureCredential({ managedIdentityClientId }); -const client = RadiologyInsightsRestClient(endpoint, credential); - -const tokenResponse = await credential.getToken("https://cognitiveservices.azure.com/.default"); - -const jobID = "jobId-123456789"; -const radiologyInsightsJob = { - jobData: { - patients: [], - configuration: {}, - }, -}; - -// Create request body -const radiologyInsightsParameter = { body: radiologyInsightsJob }; -// Create request body -const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter, { - headers: { - Authorization: `Bearer ${tokenResponse?.token}`, - "Content-Type": "application/json", - }, - }); -``` +After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use. +As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) +can be used to authenticate the client. ## Troubleshooting @@ -737,20 +53,3 @@ setLogLevel("info"); ``` For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). - - - -[health_insights]: https://learn.microsoft.com/azure/azure-health-insights/overview -[radiology_insights_docs]: https://learn.microsoft.com/azure/azure-health-insights/radiology-insights/ -[Source code]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest -[Package (NPM)]: https://www.npmjs.com/package/@azure-rest/health-insights-radiologyinsights -[API reference documentation]: https://learn.microsoft.com/rest/api/cognitiveservices/healthinsights/operation-groups?view=rest-cognitiveservices-healthinsights-2024-04-01 -[Product Information]: https://learn.microsoft.com/azure/azure-health-insights/radiology-insights/overview -[Samples]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1 -[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity -[identity]: https://www.npmjs.com/package/@azure/identity -[token_credential]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token -[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential -[default_information]: https://learn.microsoft.com/javascript/api/%40azure/identity/defaultazurecredential?view=azure-node-latest -[managed_identity]: https://learn.microsoft.com/javascript/api/%40azure/identity/managedidentitycredential?view=azure-node-latest -[credential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/api-extractor.json b/sdk/healthinsights/health-insights-radiologyinsights-rest/api-extractor.json index 9680e08dedb1..410d1b0604be 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/api-extractor.json +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/api-extractor.json @@ -11,7 +11,7 @@ "dtsRollup": { "enabled": true, "untrimmedFilePath": "", - "publicTrimmedFilePath": "dist/health-insights-radiologyinsights-rest.d.ts" + "publicTrimmedFilePath": "dist/health-insights-radiologyinsights.d.ts" }, "messages": { "tsdocMessageReporting": { @@ -28,4 +28,4 @@ } } } -} +} \ No newline at end of file diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/assets.json b/sdk/healthinsights/health-insights-radiologyinsights-rest/assets.json deleted file mode 100644 index 6fcc4b5f41ef..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/healthinsights/health-insights-radiologyinsights-rest", - "Tag": "js/healthinsights/health-insights-radiologyinsights-rest_75e7a7a0ea" -} diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/eslint.config.mjs b/sdk/healthinsights/health-insights-radiologyinsights-rest/eslint.config.mjs new file mode 100644 index 000000000000..6d2f8a5914c3 --- /dev/null +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/eslint.config.mjs @@ -0,0 +1,14 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, +]); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/package.json b/sdk/healthinsights/health-insights-radiologyinsights-rest/package.json index 4a40a83194ad..3b28f8b38881 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/package.json +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/package.json @@ -1,9 +1,29 @@ { "name": "@azure-rest/health-insights-radiologyinsights", - "sdk-type": "client", - "author": "Microsoft Corporation", - "version": "1.0.0", - "description": "A generated SDK for Health Insights Radiology Insights Rest", + "version": "2.0.0", + "description": "A generated SDK for AzureHealthInsightsClient.", + "engines": { + "node": ">=18.0.0" + }, + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false, + "project": "./tsconfig.src.json" + }, + "type": "module", "keywords": [ "node", "azure", @@ -12,51 +32,35 @@ "browser", "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", - "repository": "github:Azure/azure-sdk-for-js", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, "files": [ "dist/", "README.md", - "LICENSE", - "review/", - "CHANGELOG.md" + "LICENSE" ], - "engines": { - "node": ">=18.0.0" + "sdk-type": "client", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, - "scripts": { - "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "echo skipped.", - "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" \"test/**/*.ts\"", - "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api", - "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" \"test/**/*.ts\"", - "generate:client": "echo skipped", - "lint": "eslint package.json api-extractor.json src test", - "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", - "pack": "npm pack 2>&1", - "test": "npm run test:node && npm run test:browser", - "test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser", - "test:node": "dev-tool run test:vitest", - "test:node:esm": "dev-tool run test:vitest --esm", - "update-snippets": "dev-tool run update-snippets" + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/azureHealthInsightsClient.ts", + "prefix": "userAgentInfo" + } + ] }, - "sideEffects": false, - "autoPublish": false, "dependencies": { "@azure-rest/core-client": "^2.3.1", "@azure/abort-controller": "^2.1.2", "@azure/core-auth": "^1.9.0", - "@azure/core-lro": "^2.7.2", - "@azure/core-rest-pipeline": "^1.19.0", - "@azure/logger": "^1.1.4", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/logger": "^1.2.0", "tslib": "^2.8.1" }, "devDependencies": { @@ -65,52 +69,44 @@ "@azure-tools/test-utils-vitest": "^1.0.0", "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@azure/identity": "^4.7.0", + "@azure/identity": "^4.9.1", "@types/node": "^18.0.0", "@vitest/browser": "^3.0.9", "@vitest/coverage-istanbul": "^3.0.9", - "autorest": "latest", "dotenv": "^16.0.0", "eslint": "^9.9.0", - "playwright": "^1.50.1", + "playwright": "^1.52.0", "typescript": "~5.8.2", "vitest": "^3.0.9" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest/README.md", - "//metadata": { - "constantPaths": [ - { - "path": "src/azureHealthInsightsClient.ts", - "prefix": "userAgentInfo" - } - ] + "scripts": { + "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", + "build:samples": "echo skipped", + "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", + "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", + "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "execute:samples": "echo skipped", + "extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api", + "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", + "generate:client": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "lint": "eslint package.json api-extractor.json src test", + "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", + "minify": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "pack": "npm pack 2>&1", + "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", + "test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser", + "test:node": "dev-tool run test:vitest", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser", + "unit-test:node": "dev-tool run test:vitest", + "update-snippets": "dev-tool run update-snippets", + "test:node:esm": "dev-tool run test:vitest --esm" }, "browser": "./dist/browser/index.js", - "//sampleConfiguration": { - "productName": "HealthInsightsRadiologyInsights", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://learn.microsoft.com/javascript/api" - }, - "type": "module", - "tshy": { - "project": "./tsconfig.src.json", - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], - "selfLink": false - }, + "react-native": "./dist/react-native/index.js", "exports": { "./package.json": "./package.json", ".": { @@ -132,5 +128,6 @@ } } }, - "react-native": "./dist/react-native/index.js" -} + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts" +} \ No newline at end of file diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/review/health-insights-radiologyinsights.api.md b/sdk/healthinsights/health-insights-radiologyinsights-rest/review/health-insights-radiologyinsights.api.md index ff78253645cd..5ff803bcdfc5 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/review/health-insights-radiologyinsights.api.md +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/review/health-insights-radiologyinsights.api.md @@ -4,15 +4,17 @@ ```ts +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { CancelOnProgress } from '@azure/core-lro'; import type { Client } from '@azure-rest/core-client'; import type { ClientOptions } from '@azure-rest/core-client'; import type { CreateHttpPollerOptions } from '@azure/core-lro'; import type { ErrorModel } from '@azure-rest/core-client'; import type { HttpResponse } from '@azure-rest/core-client'; +import type { KeyCredential } from '@azure/core-auth'; import type { OperationState } from '@azure/core-lro'; import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; import type { RequestParameters } from '@azure-rest/core-client'; -import type { SimplePollerLike } from '@azure/core-lro'; import type { StreamableMethod } from '@azure-rest/core-client'; import type { TokenCredential } from '@azure/core-auth'; @@ -41,40 +43,32 @@ export interface AnnotationOutput extends ElementOutput { } // @public -export type AzureHealthInsightsClient = Client & { - path: Routes; -}; +export interface AssessmentValueRange { + maximum: string; + minimum: string; +} // @public -export function buildMultiCollection(items: string[], parameterName: string): string; +export interface AssessmentValueRangeOutput { + maximum: string; + minimum: string; +} -// @public -export type ClinicalDocumentType = ClinicalDocumentTypeEnum; +// @public (undocumented) +export type AzureHealthInsightsClient = Client & { + path: Routes; +}; // @public -export enum ClinicalDocumentTypeEnum { - Consultation = "consultation", - DischargeSummary = "dischargeSummary", - HistoryAndPhysical = "historyAndPhysical", - Laboratory = "laboratory", - Procedure = "procedure", - Progress = "progress", - RadiologyReport = "radiologyReport" +export interface AzureHealthInsightsClientOptions extends ClientOptions { + apiVersion?: string; } // @public -export type ClinicalDocumentTypeOutput = ClinicalDocumentTypeOutputEnum; +export type ClinicalDocumentType = string; // @public -export enum ClinicalDocumentTypeOutputEnum { - Consultation = "consultation", - DischargeSummary = "dischargeSummary", - HistoryAndPhysical = "historyAndPhysical", - Laboratory = "laboratory", - Procedure = "procedure", - Progress = "progress", - RadiologyReport = "radiologyReport" -} +export type ClinicalDocumentTypeOutput = string; // @public export interface CodeableConcept extends Element_2 { @@ -215,22 +209,22 @@ export interface ContactPointOutput { } // @public -export type ContactPointSystem = string | "phone" | "fax" | "email" | "pager" | "url" | "sms" | "other"; +export type ContactPointSystem = string; // @public -export type ContactPointSystemOutput = string | "phone" | "fax" | "email" | "pager" | "url" | "sms" | "other"; +export type ContactPointSystemOutput = string; // @public -export type ContactPointUse = string | "home" | "work" | "temp" | "old" | "mobile"; +export type ContactPointUse = string; // @public -export type ContactPointUseOutput = string | "home" | "work" | "temp" | "old" | "mobile"; +export type ContactPointUseOutput = string; // @public -function createClient(endpointParam: string, credentials: TokenCredential, options?: ClientOptions): AzureHealthInsightsClient; +function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, { apiVersion, ...options }?: AzureHealthInsightsClientOptions): AzureHealthInsightsClient; export default createClient; -// @public +// @public (undocumented) export interface CreateJob200Headers { "operation-location": string; "x-ms-request-id"?: string; @@ -238,12 +232,15 @@ export interface CreateJob200Headers { // @public export interface CreateJob200Response extends HttpResponse { + // (undocumented) body: RadiologyInsightsJobOutput; + // (undocumented) headers: RawHttpHeaders & CreateJob200Headers; + // (undocumented) status: "200"; } -// @public +// @public (undocumented) export interface CreateJob201Headers { "operation-location": string; "x-ms-request-id"?: string; @@ -251,46 +248,62 @@ export interface CreateJob201Headers { // @public export interface CreateJob201Response extends HttpResponse { + // (undocumented) body: RadiologyInsightsJobOutput; + // (undocumented) headers: RawHttpHeaders & CreateJob201Headers; + // (undocumented) status: "201"; } -// @public +// @public (undocumented) export interface CreateJobBodyParam { body: RadiologyInsightsJob; } -// @public +// @public (undocumented) export interface CreateJobDefaultHeaders { "x-ms-error-code"?: string; "x-ms-request-id"?: string; } -// @public +// @public (undocumented) export interface CreateJobDefaultResponse extends HttpResponse { + // (undocumented) body: HealthInsightsErrorResponseOutput; + // (undocumented) headers: RawHttpHeaders & CreateJobDefaultHeaders; + // (undocumented) status: string; } +// @public +export interface CreateJobExpandQueryParam { + explode: true; + style: "form"; + value: string[]; +} + // @public export interface CreateJobLogicalResponse extends HttpResponse { + // (undocumented) body: RadiologyInsightsJobOutput; + // (undocumented) status: "200"; } -// @public +// @public (undocumented) export type CreateJobParameters = CreateJobQueryParam & CreateJobBodyParam & RequestParameters; -// @public +// @public (undocumented) export interface CreateJobQueryParam { + // (undocumented) queryParameters?: CreateJobQueryParamProperties; } -// @public +// @public (undocumented) export interface CreateJobQueryParamProperties { - expand?: string; + expand?: CreateJobExpandQueryParam; } // @public @@ -354,17 +367,17 @@ export interface DocumentContentOutput { } // @public -export type DocumentContentSourceType = string | "inline" | "reference"; +export type DocumentContentSourceType = string; // @public -export type DocumentContentSourceTypeOutput = string | "inline" | "reference"; +export type DocumentContentSourceTypeOutput = string; // @public -type DocumentType_2 = string | "note" | "fhirBundle" | "dicom" | "genomicSequencing"; +type DocumentType_2 = string; export { DocumentType_2 as DocumentType } // @public -export type DocumentTypeOutput = string | "note" | "fhirBundle" | "dicom" | "genomicSequencing"; +export type DocumentTypeOutput = string; // @public export type DomainResource = DomainResourceParent | Observation | Condition | ResearchStudy; @@ -377,6 +390,7 @@ export interface DomainResourceOutputParent extends ResourceOutput { contained?: Array; extension?: Array; modifierExtension?: Array; + // (undocumented) resourceType: string; text?: NarrativeOutput; } @@ -386,6 +400,7 @@ export interface DomainResourceParent extends Resource { contained?: Array; extension?: Array; modifierExtension?: Array; + // (undocumented) resourceType: string; text?: Narrative; } @@ -404,10 +419,10 @@ export interface ElementOutput { } // @public -export type EncounterClass = string | "inpatient" | "ambulatory" | "observation" | "emergency" | "virtual" | "healthHome"; +export type EncounterClass = string; // @public -export type EncounterClassOutput = string | "inpatient" | "ambulatory" | "observation" | "emergency" | "virtual" | "healthHome"; +export type EncounterClassOutput = string; // @public export interface Extension extends Element_2 { @@ -423,7 +438,7 @@ export interface Extension extends Element_2 { valueReference?: Reference; valueSampledData?: SampledData; valueString?: string; - valueTime?: Date | string; + valueTime?: string; } // @public @@ -535,13 +550,13 @@ export interface GenericProcedureRecommendationOutput extends ProcedureRecommend kind: "genericProcedureRecommendation"; } -// @public +// @public (undocumented) export interface GetJob { get(options?: GetJobParameters): StreamableMethod; - put(options: CreateJobParameters, requestOptions?: GetJobParameters): StreamableMethod; + put(options: CreateJobParameters): StreamableMethod; } -// @public +// @public (undocumented) export interface GetJob200Headers { "retry-after"?: number; "x-ms-request-id"?: string; @@ -549,46 +564,95 @@ export interface GetJob200Headers { // @public export interface GetJob200Response extends HttpResponse { + // (undocumented) body: RadiologyInsightsJobOutput; + // (undocumented) headers: RawHttpHeaders & GetJob200Headers; + // (undocumented) status: "200"; } -// @public +// @public (undocumented) export interface GetJobDefaultHeaders { "x-ms-error-code"?: string; "x-ms-request-id"?: string; } -// @public +// @public (undocumented) export interface GetJobDefaultResponse extends HttpResponse { + // (undocumented) body: HealthInsightsErrorResponseOutput; + // (undocumented) headers: RawHttpHeaders & GetJobDefaultHeaders; + // (undocumented) status: string; } // @public +export interface GetJobExpandQueryParam { + explode: true; + style: "form"; + value: string[]; +} + +// @public (undocumented) export type GetJobParameters = GetJobQueryParam & RequestParameters; -// @public +// @public (undocumented) export interface GetJobQueryParam { + // (undocumented) queryParameters?: GetJobQueryParamProperties; } -// @public +// @public (undocumented) export interface GetJobQueryParamProperties { - expand?: string; + expand?: GetJobExpandQueryParam; } // @public export function getLongRunningPoller(client: Client, initialResponse: CreateJob200Response | CreateJob201Response | CreateJobDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; +// @public +export interface GuidanceInference extends RadiologyInsightsInferenceParent { + finding: FindingInference; + identifier: CodeableConcept; + kind: "guidance"; + missingGuidanceInformation?: string[]; + presentGuidanceInformation?: Array; + ranking: GuidanceRankingType; + recommendationProposals?: Array; +} + +// @public +export interface GuidanceInferenceOutput extends RadiologyInsightsInferenceOutputParent { + finding: FindingInferenceOutput; + identifier: CodeableConceptOutput; + kind: "guidance"; + missingGuidanceInformation?: string[]; + presentGuidanceInformation?: Array; + ranking: GuidanceRankingTypeOutput; + recommendationProposals?: Array; +} + +// @public +export interface GuidanceOptions { + showGuidanceInHistory: boolean; +} + +// @public +export interface GuidanceOptionsOutput { + showGuidanceInHistory: boolean; +} + +// @public +export type GuidanceRankingType = string; + +// @public +export type GuidanceRankingTypeOutput = string; + // @public export interface HealthInsightsErrorResponseOutput { error: ErrorModel; - requestId: { - response: RequestIdResponseHeaderOutput; - }; } // @public @@ -643,17 +707,17 @@ export interface ImagingProcedureRecommendationOutput extends ProcedureRecommend procedureCodes?: Array; } -// @public +// @public (undocumented) export function isUnexpected(response: GetJob200Response | GetJobDefaultResponse): response is GetJobDefaultResponse; -// @public +// @public (undocumented) export function isUnexpected(response: CreateJob200Response | CreateJob201Response | CreateJobLogicalResponse | CreateJobDefaultResponse): response is CreateJobDefaultResponse; // @public -export type JobStatus = string | "notStarted" | "running" | "succeeded" | "failed" | "canceled"; +export type JobStatus = string; // @public -export type JobStatusOutput = string | "notStarted" | "running" | "succeeded" | "failed" | "canceled"; +export type JobStatusOutput = string; // @public export interface LateralityDiscrepancyInference extends RadiologyInsightsInferenceParent { @@ -670,10 +734,10 @@ export interface LateralityDiscrepancyInferenceOutput extends RadiologyInsightsI } // @public -export type LateralityDiscrepancyType = string | "orderLateralityMismatch" | "textLateralityContradiction" | "textLateralityMissing"; +export type LateralityDiscrepancyType = string; // @public -export type LateralityDiscrepancyTypeOutput = string | "orderLateralityMismatch" | "textLateralityContradiction" | "textLateralityMissing"; +export type LateralityDiscrepancyTypeOutput = string; // @public export interface LimitedOrderDiscrepancyInference extends RadiologyInsightsInferenceParent { @@ -692,10 +756,10 @@ export interface LimitedOrderDiscrepancyInferenceOutput extends RadiologyInsight } // @public -export type MedicalProfessionalType = string | "unknown" | "doctor" | "nurse" | "midwife" | "physicianAssistant"; +export type MedicalProfessionalType = string; // @public -export type MedicalProfessionalTypeOutput = string | "unknown" | "doctor" | "nurse" | "midwife" | "physicianAssistant"; +export type MedicalProfessionalTypeOutput = string; // @public export interface Meta { @@ -761,7 +825,7 @@ export interface Observation extends DomainResourceParent { valueRatio?: Ratio; valueSampledData?: SampledData; valueString?: string; - valueTime?: Date | string; + valueTime?: string; } // @public @@ -781,7 +845,7 @@ export interface ObservationComponent extends Element_2 { valueReference?: Reference; valueSampledData?: SampledData; valueString?: string; - valueTime?: Date | string; + valueTime?: string; } // @public @@ -860,10 +924,10 @@ export interface ObservationReferenceRangeOutput { } // @public -export type ObservationStatusCodeType = string | "registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"; +export type ObservationStatusCodeType = string; // @public -export type ObservationStatusCodeTypeOutput = string | "registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"; +export type ObservationStatusCodeTypeOutput = string; // @public export interface OrderedProcedure { @@ -881,7 +945,7 @@ export interface OrderedProcedureOutput { // @public export interface PatientDetails { - birthDate?: Date | string; + birthDate?: string; clinicalInfo?: Array; sex?: PatientSex; } @@ -950,10 +1014,10 @@ export interface PatientRecordOutput { } // @public -export type PatientSex = string | "female" | "male" | "unspecified"; +export type PatientSex = string; // @public -export type PatientSexOutput = string | "female" | "male" | "unspecified"; +export type PatientSexOutput = string; // @public export interface Period extends Element_2 { @@ -967,6 +1031,24 @@ export interface PeriodOutput extends ElementOutput { start?: string; } +// @public +export interface PresentGuidanceInformation { + extension?: Array; + maximumDiameterAsInText?: Quantity; + presentGuidanceItem: string; + presentGuidanceValues?: string[]; + sizes?: Array; +} + +// @public +export interface PresentGuidanceInformationOutput { + extension?: Array; + maximumDiameterAsInText?: QuantityOutput; + presentGuidanceItem: string; + presentGuidanceValues?: string[]; + sizes?: Array; +} + // @public export type ProcedureRecommendation = ProcedureRecommendationParent | GenericProcedureRecommendation | ImagingProcedureRecommendation; @@ -976,15 +1058,55 @@ export type ProcedureRecommendationOutput = ProcedureRecommendationOutputParent // @public export interface ProcedureRecommendationOutputParent { extension?: Array; + // (undocumented) kind: string; } // @public export interface ProcedureRecommendationParent { extension?: Array; + // (undocumented) kind: string; } +// @public +export type QualityMeasureComplianceType = string; + +// @public +export type QualityMeasureComplianceTypeOutput = string; + +// @public +export interface QualityMeasureInference extends RadiologyInsightsInferenceParent { + complianceType: QualityMeasureComplianceType; + kind: "qualityMeasure"; + qualityCriteria?: string[]; + qualityMeasureDenominator: string; +} + +// @public +export interface QualityMeasureInferenceOutput extends RadiologyInsightsInferenceOutputParent { + complianceType: QualityMeasureComplianceTypeOutput; + kind: "qualityMeasure"; + qualityCriteria?: string[]; + qualityMeasureDenominator: string; +} + +// @public +export interface QualityMeasureOptions { + measureTypes: QualityMeasureType[]; +} + +// @public +export interface QualityMeasureOptionsOutput { + measureTypes: QualityMeasureTypeOutput[]; +} + +// @public +export type QualityMeasureType = string; + +// @public +export type QualityMeasureTypeOutput = string; + // @public export interface Quantity extends Element_2 { code?: string; @@ -1028,32 +1150,38 @@ export interface RadiologyInsightsDataOutput { } // @public -export type RadiologyInsightsInference = RadiologyInsightsInferenceParent | AgeMismatchInference | SexMismatchInference | LateralityDiscrepancyInference | CompleteOrderDiscrepancyInference | LimitedOrderDiscrepancyInference | FindingInference | CriticalResultInference | RadiologyProcedureInference | FollowupRecommendationInference | FollowupCommunicationInference; +export type RadiologyInsightsInference = RadiologyInsightsInferenceParent | AgeMismatchInference | SexMismatchInference | LateralityDiscrepancyInference | CompleteOrderDiscrepancyInference | LimitedOrderDiscrepancyInference | FindingInference | CriticalResultInference | RadiologyProcedureInference | FollowupRecommendationInference | FollowupCommunicationInference | ScoringAndAssessmentInference | GuidanceInference | QualityMeasureInference; // @public export interface RadiologyInsightsInferenceOptions { findingOptions?: FindingOptions; followupRecommendationOptions?: FollowupRecommendationOptions; + guidanceOptions?: GuidanceOptions; + qualityMeasureOptions?: QualityMeasureOptions; } // @public export interface RadiologyInsightsInferenceOptionsOutput { findingOptions?: FindingOptionsOutput; followupRecommendationOptions?: FollowupRecommendationOptionsOutput; + guidanceOptions?: GuidanceOptionsOutput; + qualityMeasureOptions?: QualityMeasureOptionsOutput; } // @public -export type RadiologyInsightsInferenceOutput = RadiologyInsightsInferenceOutputParent | AgeMismatchInferenceOutput | SexMismatchInferenceOutput | LateralityDiscrepancyInferenceOutput | CompleteOrderDiscrepancyInferenceOutput | LimitedOrderDiscrepancyInferenceOutput | FindingInferenceOutput | CriticalResultInferenceOutput | RadiologyProcedureInferenceOutput | FollowupRecommendationInferenceOutput | FollowupCommunicationInferenceOutput; +export type RadiologyInsightsInferenceOutput = RadiologyInsightsInferenceOutputParent | AgeMismatchInferenceOutput | SexMismatchInferenceOutput | LateralityDiscrepancyInferenceOutput | CompleteOrderDiscrepancyInferenceOutput | LimitedOrderDiscrepancyInferenceOutput | FindingInferenceOutput | CriticalResultInferenceOutput | RadiologyProcedureInferenceOutput | FollowupRecommendationInferenceOutput | FollowupCommunicationInferenceOutput | ScoringAndAssessmentInferenceOutput | GuidanceInferenceOutput | QualityMeasureInferenceOutput; // @public export interface RadiologyInsightsInferenceOutputParent { extension?: Array; + // (undocumented) kind: string; } // @public export interface RadiologyInsightsInferenceParent { extension?: Array; + // (undocumented) kind: string; } @@ -1070,10 +1198,10 @@ export interface RadiologyInsightsInferenceResultOutput { } // @public -export type RadiologyInsightsInferenceType = string | "ageMismatch" | "lateralityDiscrepancy" | "sexMismatch" | "completeOrderDiscrepancy" | "limitedOrderDiscrepancy" | "finding" | "criticalResult" | "followupRecommendation" | "followupCommunication" | "radiologyProcedure"; +export type RadiologyInsightsInferenceType = string; // @public -export type RadiologyInsightsInferenceTypeOutput = string | "ageMismatch" | "lateralityDiscrepancy" | "sexMismatch" | "completeOrderDiscrepancy" | "limitedOrderDiscrepancy" | "finding" | "criticalResult" | "followupRecommendation" | "followupCommunication" | "radiologyProcedure"; +export type RadiologyInsightsInferenceTypeOutput = string; // @public export interface RadiologyInsightsJob { @@ -1180,10 +1308,10 @@ export interface RecommendationFindingOutput { } // @public -export type RecommendationFindingStatusType = string | "present" | "differential" | "ruleOut" | "conditional"; +export type RecommendationFindingStatusType = string; // @public -export type RecommendationFindingStatusTypeOutput = string | "present" | "differential" | "ruleOut" | "conditional"; +export type RecommendationFindingStatusTypeOutput = string; // @public export interface Reference extends Element_2 { @@ -1201,10 +1329,6 @@ export interface ReferenceOutput extends ElementOutput { type?: string; } -// @public -export interface RequestIdResponseHeaderOutput { -} - // @public export interface ResearchStudy extends DomainResourceParent { arm?: { @@ -1276,10 +1400,10 @@ export interface ResearchStudyOutput extends DomainResourceOutputParent { } // @public -export type ResearchStudyStatusCodeType = string | "active" | "administratively-completed" | "approved" | "closed-to-accrual" | "closed-to-accrual-and-intervention" | "completed" | "disapproved" | "in-review" | "temporarily-closed-to-accrual" | "temporarily-closed-to-accrual-and-intervention" | "withdrawn"; +export type ResearchStudyStatusCodeType = string; // @public -export type ResearchStudyStatusCodeTypeOutput = string | "active" | "administratively-completed" | "approved" | "closed-to-accrual" | "closed-to-accrual-and-intervention" | "completed" | "disapproved" | "in-review" | "temporarily-closed-to-accrual" | "temporarily-closed-to-accrual-and-intervention" | "withdrawn"; +export type ResearchStudyStatusCodeTypeOutput = string; // @public export interface Resource extends Record { @@ -1299,7 +1423,7 @@ export interface ResourceOutput extends Record { resourceType: string; } -// @public +// @public (undocumented) export interface Routes { (path: "/radiology-insights/jobs/{id}", id: string): GetJob; } @@ -1326,6 +1450,30 @@ export interface SampledDataOutput extends ElementOutput { upperLimit?: number; } +// @public +export type ScoringAndAssessmentCategoryType = string; + +// @public +export type ScoringAndAssessmentCategoryTypeOutput = string; + +// @public +export interface ScoringAndAssessmentInference extends RadiologyInsightsInferenceParent { + category: ScoringAndAssessmentCategoryType; + categoryDescription: string; + kind: "scoringAndAssessment"; + rangeValue?: AssessmentValueRange; + singleValue?: string; +} + +// @public +export interface ScoringAndAssessmentInferenceOutput extends RadiologyInsightsInferenceOutputParent { + category: ScoringAndAssessmentCategoryTypeOutput; + categoryDescription: string; + kind: "scoringAndAssessment"; + rangeValue?: AssessmentValueRangeOutput; + singleValue?: string; +} + // @public export interface SexMismatchInference extends RadiologyInsightsInferenceParent { kind: "sexMismatch"; @@ -1339,10 +1487,32 @@ export interface SexMismatchInferenceOutput extends RadiologyInsightsInferenceOu } // @public -export type SpecialtyType = string | "pathology" | "radiology"; +export interface SimplePollerLike, TResult> { + getOperationState(): TState; + getResult(): TResult | undefined; + isDone(): boolean; + // @deprecated + isStopped(): boolean; + onProgress(callback: (state: TState) => void): CancelOnProgress; + poll(options?: { + abortSignal?: AbortSignalLike; + }): Promise; + pollUntilDone(pollOptions?: { + abortSignal?: AbortSignalLike; + }): Promise; + serialize(): Promise; + // @deprecated + stopPolling(): void; + submitted(): Promise; + // @deprecated + toString(): string; +} + +// @public +export type SpecialtyType = string; // @public -export type SpecialtyTypeOutput = string | "pathology" | "radiology"; +export type SpecialtyTypeOutput = string; // @public export interface TimePeriod { diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/sample.env b/sdk/healthinsights/health-insights-radiologyinsights-rest/sample.env index 811d3b1ed982..508439fc7d62 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/sample.env +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/sample.env @@ -1,3 +1 @@ -# App registration secret for AAD authentication -HEALTH_INSIGHTS_KEY= -HEALTH_INSIGHTS_ENDPOINT= +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_age_mismatch_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_age_mismatch_inference_async.ts deleted file mode 100644 index 1977eefdd7dc..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_age_mismatch_inference_async.ts +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the age mismatch of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; - -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the age mismatch inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput, content: string): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "ageMismatch") { - console.log("Age Mismatch Inference found: "); - const evidence = findAgeEvidence(inference.extension, content); - console.log(" Evidence: " + evidence); - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function findAgeEvidence(extensions: any, innerContent: string): string { - let offset = -1; - let length = -1; - let piece = ""; - let evidence = ""; - // for loop needed for traversing from top to bottom of the array - for (const first of extensions) { - for (const ext of first.extension) { - if (ext.url === "offset") { - offset = ext.valueInteger; - } else if (ext.url === "length") { - length = ext.valueInteger; - } - if (offset > 0 && length > 0) { - piece = innerContent.substring(offset, offset + length); - } - } - evidence += `${piece} `; - } - return evidence; - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - const content = - radiologyInsightsParameter?.body?.jobData?.patients?.[0]?.patientDocuments?.[0]?.content - ?.value ?? ""; - await printResults(resultBody, content); -} - -main().catch((err) => { - console.error("The age mismatch encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_complete_order_discrepancy_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_complete_order_discrepancy_inference_async.ts deleted file mode 100644 index 85a8e0e69a65..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_complete_order_discrepancy_inference_async.ts +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the complete order discrepancy of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the complete order discrepancy inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "completeOrderDiscrepancy") { - console.log("Complete Order Discrepancy Inference found: "); - if ("orderType" in inference) { - console.log(" Ordertype: "); - displayCodes({ codeableConcept: inference.orderType }); - } - - inference.missingBodyParts?.forEach((bodyparts: any) => { - console.log(" Missing Body Parts: "); - displayCodes({ codeableConcept: bodyparts }); - }); - - inference.missingBodyPartMeasurements?.forEach((bodymeasure: any) => { - console.log(" Missing Body Part Measurements: "); - displayCodes({ codeableConcept: bodymeasure }); - }); - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes({ codeableConcept }: { codeableConcept: any }): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - await printResults(resultBody); -} - -main().catch((err) => { - console.error("The complete order encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_critical_result_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_critical_result_inference_async.ts deleted file mode 100644 index cb6e1ab4fe60..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_critical_result_inference_async.ts +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the critical results of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the critical result inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[] }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "criticalResult") { - if ("result" in inference) { - console.log("Critical Result Inference found: " + inference.result.description); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - await printResults(resultBody); -} - -main().catch((err) => { - console.error("The critical result encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_critical_result_managed_identity.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_critical_result_managed_identity.ts deleted file mode 100644 index b051175e2775..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_critical_result_managed_identity.ts +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the critical results of the Radiology Insights request. - */ -import { DefaultAzureCredential, logger } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; -const clientID = process.env["MANAGED_IDENTITY_CLIENT_ID"] || ""; - -/** - * Print the critical result inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[] }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "criticalResult") { - if ("result" in inference) { - console.log("Critical Result Inference found: " + inference.result.description); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - // Create Managed Identity Credential - const credential = new DefaultAzureCredential( - clientID ? { managedIdentityClientId: clientID } : undefined, - ); - const tokenResponse = await credential.getToken("https://cognitiveservices.azure.com/.default"); - await logger.info(null, `Got token for Cognitive Services ${tokenResponse?.token}`); - - const client = AzureHealthInsightsClient(endpoint, credential); - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter, { - headers: { - Authorization: `Bearer ${tokenResponse?.token}`, - "Content-Type": "application/json", - }, - }); - - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - await printResults(resultBody); -} - -main().catch((err) => { - console.error("The critical result encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_finding_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_finding_inference_async.ts deleted file mode 100644 index 4fbea9472ab7..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_finding_inference_async.ts +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the finding of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the finding inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[] }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "finding") { - console.log("Finding Inference found: "); - - const find = inference.finding; - if ("code" in find) { - const fcode = find.code; - console.log(" Code: "); - displayCodes(fcode); - } - - find.interpretation?.forEach((inter: any) => { - console.log(" Interpretation: "); - displayCodes(inter); - }); - - inference.finding.component?.forEach( - (comp: { code: any; valueCodeableConcept: any }) => { - console.log(" Component code: "); - displayCodes(comp.code); - if ("valueCodeableConcept" in comp) { - console.log(" Value component codeable concept: "); - displayCodes(comp.valueCodeableConcept); - } - }, - ); - - if ("extension" in inference) { - displaySectionInfo(inference); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } - - function displaySectionInfo(inference: { extension: any[] }): void { - inference.extension?.forEach((ext: any) => { - if ("url" in ext && ext.url === "section") { - console.log(" Section:"); - ext.extension?.forEach((subextension: { url: string; valueString: string }) => { - if ("url" in subextension && "valueString" in subextension) { - console.log(" " + subextension.url + ": " + subextension.valueString); - } - }); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "ANG366", - display: "XA VENACAVA FILTER INSERTION", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "male", - birthDate: new Date("1980-04-22T02:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "XA VENACAVA FILTER INSERTION", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `FINDINGS: - 1. Inferior vena cavagram using CO2 contrast shows the IVC is normal - in course and caliber without filling defects to indicate clot. It - measures 19.8 mm. in diameter infrarenally. - - 2. Successful placement of IVC filter in infrarenal location.`, - }; - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "XA VENACAVA FILTER INSERTION", - }; - - const patientData = { - id: "Roberto Lewis", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - await printResults(resultBody); -} - -main().catch((err) => { - console.error("The finding encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_follow_up_communication_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_follow_up_communication_inference_async.ts deleted file mode 100644 index de03f6a2c1f3..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_follow_up_communication_inference_async.ts +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the follow up communication of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the follow up communication inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - patientResult.inferences.forEach( - (inference: { - kind: string; - communicatedAt: any[]; - recipient: any[]; - wasAcknowledged: string; - }) => { - if (inference.kind === "followupCommunication") { - console.log("Followup Communication Inference found"); - if ("communicatedAt" in inference) { - console.log("Communicated at: " + inference.communicatedAt.join(" ")); - } - if ("recipient" in inference) { - console.log("Recipient: " + inference.recipient.join(" ")); - } - console.log(" Aknowledged: " + inference.wasAcknowledged); - } - }, - ); - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - await printResults(resultBody); -} - -main().catch((err) => { - console.error("The follow up communication encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_follow_up_recommendation_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_follow_up_recommendation_inference_async.ts deleted file mode 100644 index 99d316f267a0..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_follow_up_recommendation_inference_async.ts +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the follow up recommendation of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the follow up recommendation inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - patientResult.inferences.forEach( - (inference: { - kind: string; - isConditional: any; - isGuideline: any; - isHedging: any; - isOption: any; - recommendedProcedure: any; - }) => { - if (inference.kind === "followupRecommendation") { - console.log("Follow Up Recommendation Inference found"); - console.log(" Is conditional: ", inference.isConditional); - console.log(" Is guidline: ", inference.isGuideline); - console.log(" Is hedging: ", inference.isHedging); - console.log(" Is option: ", inference.isOption); - - const procedure = inference.recommendedProcedure; - if ("kind" in procedure && procedure.kind === "genericProcedureRecommendation") { - if ("code" in procedure) { - console.log(" Recommended Generic Procedure: ", procedure.code); - } - if ("description" in procedure) { - console.log(" Description: ", procedure.description); - } - } else if ( - "kind" in procedure && - procedure.kind === "imagingProcedureRecommendation" - ) { - procedure.procedureCodes?.forEach((procedureCode: any) => { - console.log(" Recommended Procedure Codes: "); - displayCodes(procedureCode); - }); - - if ("imagingProcedures" in procedure) { - procedure.imagingProcedures?.forEach((imagingProcedure: any) => { - console.log(" Recommended Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - }); - } - } - } - }, - ); - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } - - function displayImaging(images: { - modality: { coding: any[] }; - anatomy: { coding: any[] }; - laterality: { coding: any[] }; - contrast: { code: { coding: any[] } }; - view: { code: { coding: any[] } }; - }): void { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if ("laterality" in images) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if ("contrast" in images) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if ("view" in images) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - await printResults(resultBody); -} - -main().catch((err) => { - console.error("The follow up recommendation encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_laterality_discrepancy_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_laterality_discrepancy_inference_async.ts deleted file mode 100644 index cb0b702aa0f3..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_laterality_discrepancy_inference_async.ts +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the laterality discrepancy of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the laterality discrepancy recommendation inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - patientResult.inferences.forEach( - (inference: { kind: string; lateralityIndication: any }) => { - if (inference.kind === "lateralityDiscrepancy") { - console.log("Laterality Discrepancy Inference found: "); - displayCodes(inference.lateralityIndication); - } - }, - ); - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log( - " Coding: " + - coding.code + - ", " + - coding.display + - " (" + - coding.system + - "), type: " + - coding.type, - ); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "26688-1", - display: "US BREAST - LEFT LIMITED", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US BREAST - LEFT LIMITED", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `Exam: US LT BREAST TARGETED - Technique: Targeted imaging of the right breast is performed. - - Findings: - Targeted imaging of the left breast is performed from the 6:00 to the 9:00 position. - At the 6:00 position, 5 cm from the nipple, there is a 3 x 2 x 4 mm minimally hypoechoic mass with a peripheral calcification. - This may correspond to the mammographic finding. No other cystic or solid masses visualized.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US BREAST - LEFT LIMITED", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - await printResults(resultBody); -} - -main().catch((err) => { - console.error("The laterality discrepancy encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_limited_order_discrepancy_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_limited_order_discrepancy_inference_async.ts deleted file mode 100644 index 0a0b26fc8d99..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_limited_order_discrepancy_inference_async.ts +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the limited order discrepancy of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the limited order discrepancy inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[] }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "limitedOrderDiscrepancy") { - console.log("Limited Order Discrepancy Inference found: "); - if ("orderType" in inference) { - console.log(" Ordertype: "); - displayCodes(inference.orderType); - } - - inference.presentBodyParts?.forEach((bodyparts: any) => { - console.log(" Present Body Parts: "); - displayCodes(bodyparts); - }); - - inference.presentBodyPartMeasurements?.forEach((bodymeasure: any) => { - console.log(" Present Body Part Measurements: "); - displayCodes(bodymeasure); - }); - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "30704-1", - display: "US ABDOMEN LIMITED", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US ABDOMEN LIMITED", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `HISTORY: - 49-year-old male with a history of tuberous sclerosis presenting with epigastric pain and diffuse tenderness." - The patient was found to have pericholecystic haziness on CT; evaluation for acute cholecystitis." - - TECHNIQUE: Ultrasound evaluation of the abdomen was performed. - Comparison is made to the prior abdominal ultrasound (2004) and to the enhanced CT of the abdomen and pelvis (2014)." - - FINDINGS:" - The liver is elongated, measuring 19.3 cm craniocaudally, and is homogeneous in echotexture without evidence of focal mass lesion. - The liver contour is smooth on high resolution images." - There is no appreciable intra- or extrahepatic biliary ductal dilatation, with the visualized extrahepatic bile duct measuring up to 6 mm." - There are multiple shadowing gallstones, including within the gallbladder neck, which do not appear particularly mobile." - In addition, there is thickening of the gallbladder wall up to approximately 7 mm with probable mild mural edema." - There is no pericholecystic fluid. No sonographic Murphy's sign was elicited; however the patient reportedly received pain medications in the emergency department." - The pancreatic head, body and visualized portions of the tail are unremarkable." - The spleen is normal in size, measuring 9.9 cm in length." - The kidneys are normal in size." - The right kidney measures 11.5 x 5.2 x 4.3 cm and the left kidney measuring 11.8 x 5.3 x 5.1 cm." - There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis." - The largest echogenic mass on the right is located in the upper pole and measures 1.2 x 1.3 x 1.3 cm." - The largest echogenic mass on the left is located within the renal sinus and measures approximately 2.6 x 2.7 x 4.6 cm." - Additional indeterminate renal lesions are present bilaterally and are better characterized on CT." - There is no hydronephrosis.\\n\\nNo ascites is identified within the upper abdomen." - The visualized portions of the upper abdominal aorta and IVC are normal in caliber." - - IMPRESSION: " - 1. Numerous gallstones associated with gallbladder wall thickening and probable gallbladder mural edema, highly suspicious for acute cholecystitis in this patient presenting with epigastric pain and pericholecystic hazy density identified on CT." - Although no sonographic Murphy sign was elicited, evaluation is limited secondary to reported prior administration of pain medication." - Thus, clinical correlation is required. No evidence of biliary ductal dilation." - 2. There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis." - Additional indeterminate renal lesions are present bilaterally and are better characterized on CT and MR." - These findings were discussed with Dr. Doe at 5:05 p.m. on 1/1/15."`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US ABDOMEN LIMITED", - }; - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - await printResults(resultBody); -} - -main().catch((err) => { - console.error("The limited order encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_radiology_procedure_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_radiology_procedure_inference_async.ts deleted file mode 100644 index d8fd5199a5d5..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_radiology_procedure_inference_async.ts +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the radiology procedure of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the radiology procedure inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[] }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "radiologyProcedure") { - console.log("Radiology Procedure Inference found"); - inference.procedureCodes?.forEach((procedureCode: any) => { - console.log(" Procedure Codes: "); - displayCodes(procedureCode); - }); - - if ("imagingProcedures" in inference) { - inference.imagingProcedures?.forEach((imagingProcedure: any) => { - console.log(" Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - }); - } - - if ("orderedProcedure" in inference) { - console.log(" Ordered procedures: "); - if ("code" in inference.orderedProcedure) { - displayCodes(inference.orderedProcedure.code); - } - } - - if ("description" in inference.orderedProcedure) { - console.log(" Description: " + inference.orderedProcedure.description); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } - - function displayImaging(images: any): void { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if ("laterality" in images) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if ("contrast" in images) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if ("view" in images) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "24727-0", - display: "CT HEAD W CONTRAST IV", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "CT HEAD W CONTRAST IV", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: ` Exam: Head CT with Contrast - - History: Headaches for 2 months - Technique: Axial, sagittal, and coronal images were reconstructed from helical CT through the head without IV contrast. - IV contrast: 100 mL IV Omnipaque 300. - - Findings: There is no mass effect. There is no abnormal enhancement of the brain or within injuries with IV contrast. - However, there is no evidence of enhancing lesion in either internal auditory canal. - Impression: Negative CT of the brain without IV contrast. - I recommend a new brain CT within nine months.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "CT HEAD W CONTRAST IV", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The radiology procedure encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_sex_mismatch_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_sex_mismatch_inference_async.ts deleted file mode 100644 index 17f79e57f03d..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples-dev/sample_sex_mismatch_inference_async.ts +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the sex mismatch of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -import type { - CreateJobParameters, - RadiologyInsightsJobOutput, -} from "@azure-rest/health-insights-radiologyinsights"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - getLongRunningPoller, - isUnexpected, -} from "@azure-rest/health-insights-radiologyinsights"; - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the sex mismatch inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[] }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "sexMismatch") { - console.log("Sex Mismatch Inference found: "); - if ("sexIndication" in inference) { - displayCodes(inference.sexIndication); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: ` - CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - await printResults(resultBody); -} - -main().catch((err) => { - console.error("The sex mismatch encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/README.md b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/README.md deleted file mode 100644 index 188b7e018634..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# HealthInsightsRadiologyInsights client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for HealthInsightsRadiologyInsights in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| [sample_age_mismatch_inference_async.js][sample_age_mismatch_inference_async] | Displays the age mismatch of the Radiology Insights request. | -| [sample_complete_order_discrepancy_inference_async.js][sample_complete_order_discrepancy_inference_async] | Displays the complete order discrepancy of the Radiology Insights request. | -| [sample_critical_result_inference_async.js][sample_critical_result_inference_async] | Displays the critical results of the Radiology Insights request. | -| [sample_critical_result_managed_identity.js][sample_critical_result_managed_identity] | Displays the critical results of the Radiology Insights request. | -| [sample_finding_inference_async.js][sample_finding_inference_async] | Displays the finding of the Radiology Insights request. | -| [sample_follow_up_communication_inference_async.js][sample_follow_up_communication_inference_async] | Displays the follow up communication of the Radiology Insights request. | -| [sample_follow_up_recommendation_inference_async.js][sample_follow_up_recommendation_inference_async] | Displays the follow up recommendation of the Radiology Insights request. | -| [sample_laterality_discrepancy_inference_async.js][sample_laterality_discrepancy_inference_async] | Displays the laterality discrepancy of the Radiology Insights request. | -| [sample_limited_order_discrepancy_inference_async.js][sample_limited_order_discrepancy_inference_async] | Displays the limited order discrepancy of the Radiology Insights request. | -| [sample_radiology_procedure_inference_async.js][sample_radiology_procedure_inference_async] | Displays the radiology procedure of the Radiology Insights request. | -| [sample_sex_mismatch_inference_async.js][sample_sex_mismatch_inference_async] | Displays the sex mismatch of the Radiology Insights request. | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node sample_age_mismatch_inference_async.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env HEALTH_INSIGHTS_KEY="" HEALTH_INSIGHTS_ENDPOINT="" node sample_critical_result_inference_async.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[sample_age_mismatch_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_age_mismatch_inference_async.js -[sample_complete_order_discrepancy_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_complete_order_discrepancy_inference_async.js -[sample_critical_result_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_inference_async.js -[sample_critical_result_managed_identity]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_managed_identity.js -[sample_finding_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_finding_inference_async.js -[sample_follow_up_communication_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_communication_inference_async.js -[sample_follow_up_recommendation_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_recommendation_inference_async.js -[sample_laterality_discrepancy_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_laterality_discrepancy_inference_async.js -[sample_limited_order_discrepancy_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_limited_order_discrepancy_inference_async.js -[sample_radiology_procedure_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_radiology_procedure_inference_async.js -[sample_sex_mismatch_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_sex_mismatch_inference_async.js -[apiref]: https://learn.microsoft.com/javascript/api -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest/README.md diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/package.json b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/package.json deleted file mode 100644 index 490b47b1e581..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@azure-samples/health-insights-radiologyinsights-js", - "private": true, - "version": "1.0.0", - "description": "HealthInsightsRadiologyInsights client library samples for JavaScript", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/healthinsights/health-insights-radiologyinsights-rest" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest", - "dependencies": { - "@azure-rest/health-insights-radiologyinsights": "latest", - "dotenv": "latest", - "@azure/identity": "^4.0.1" - } -} diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample.env b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample.env deleted file mode 100644 index 811d3b1ed982..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample.env +++ /dev/null @@ -1,3 +0,0 @@ -# App registration secret for AAD authentication -HEALTH_INSIGHTS_KEY= -HEALTH_INSIGHTS_ENDPOINT= diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_age_mismatch_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_age_mismatch_inference_async.js deleted file mode 100644 index 9b44ab210a47..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_age_mismatch_inference_async.js +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the age mismatch of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); - -const dotenv = require("dotenv"); -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the age mismatch inference - */ - -function printResults(radiologyInsightsResult, content) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "ageMismatch") { - console.log("Age Mismatch Inference found: "); - const evidence = findAgeEvidence(inference.extension, content); - console.log(" Evidence: " + evidence); - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function findAgeEvidence(extensions, content) { - let offset = -1; - let length = -1; - let piece = ""; - let evidence = ""; - // for loop needed for traversing from top to bottom of the array - for (const first of extensions) { - for (const ext of first.extension) { - if (ext.url === "offset") { - offset = ext.valueInteger; - } else if (ext.url === "length") { - length = ext.valueInteger; - } - if (offset > 0 && length > 0) { - piece = content.substring(offset, offset + length); - } - } - evidence += `${piece} `; - } - return evidence; - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - - - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - - - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - - - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - - - - On duplex imaging, Doppler signal is symmetric. - - - - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - - - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - const content = - radiologyInsightsParameter?.body?.jobData?.patients?.[0]?.patientDocuments?.[0]?.content - ?.value ?? ""; - printResults(resultBody, content); -} - -main().catch((err) => { - console.error("The age mismatch encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_complete_order_discrepancy_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_complete_order_discrepancy_inference_async.js deleted file mode 100644 index 04da78c974c0..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_complete_order_discrepancy_inference_async.js +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the complete order discrepancy of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); - -const dotenv = require("dotenv"); -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the complete order discrepancy inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "completeOrderDiscrepancy") { - console.log("Complete Order Discrepancy Inference found: "); - if ("orderType" in inference) { - console.log(" Ordertype: "); - displayCodes({ codeableConcept: inference.orderType }); - } - inference.missingBodyParts?.forEach((bodyparts) => { - console.log(" Missing Body Parts: "); - displayCodes({ codeableConcept: bodyparts }); - }); - - inference.missingBodyPartMeasurements?.forEach((bodymeasure) => { - console.log(" Missing Body Part Measurements: "); - displayCodes({ codeableConcept: bodymeasure }); - }); - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes({ codeableConcept }) { - codeableConcept.coding?.forEach((coding) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - - - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - - - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - - - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - - - - On duplex imaging, Doppler signal is symmetric. - - - - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - - - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The complete order encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_inference_async.js deleted file mode 100644 index 3c27e0d17f78..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_inference_async.js +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the critical results of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the critical result inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "criticalResult") { - if ("result" in inference) { - console.log("Critical Result Inference found: " + inference.result.description); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - - - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - - - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - - - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - - - - On duplex imaging, Doppler signal is symmetric. - - - - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - - - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The critical result encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_managed_identity.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_managed_identity.js deleted file mode 100644 index e767a72c033d..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_critical_result_managed_identity.js +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the critical results of the Radiology Insights request. - */ -const { DefaultAzureCredential, logger } = require("@azure/identity"); -const dotenv = require("dotenv"); - -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; -const clientID = process.env["MANAGED_IDENTITY_CLIENT_ID"] || ""; - -/** - * Print the critical result inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "criticalResult") { - if ("result" in inference) { - console.log("Critical Result Inference found: " + inference.result.description); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - - - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - - - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - - - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - - - - On duplex imaging, Doppler signal is symmetric. - - - - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - - - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - //Create Managed Identity Credential - const credential = new DefaultAzureCredential( - clientID ? { managedIdentityClientId: clientID } : undefined, - ); - const tokenResponse = await credential.getToken("https://cognitiveservices.azure.com/.default"); - logger.info(null, `Got token for Cognitive Services ${tokenResponse?.token}`); - - const client = AzureHealthInsightsClient(endpoint, credential); - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter, { - headers: { - Authorization: `Bearer ${tokenResponse?.token}`, - "Content-Type": "application/json", - }, - }); - - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The critical result encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_finding_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_finding_inference_async.js deleted file mode 100644 index 85a81a3db71b..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_finding_inference_async.js +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the finding of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the finding inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "finding") { - console.log("Finding Inference found: "); - - let find = inference.finding; - if ("code" in find) { - let fcode = find.code; - console.log(" Code: "); - displayCodes(fcode); - } - - find.interpretation?.forEach((inter) => { - console.log(" Interpretation: "); - displayCodes(inter); - }); - - inference.finding.component?.forEach((comp) => { - console.log(" Component code: "); - displayCodes(comp.code); - if ("valueCodeableConcept" in comp) { - console.log(" Value component codeable concept: "); - displayCodes(comp.valueCodeableConcept); - } - }); - - if ("extension" in inference) { - displaySectionInfo(inference); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept) { - codeableConcept.coding?.forEach((coding) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } - - function displaySectionInfo(inference) { - inference.extension?.forEach((ext) => { - if ("url" in ext && ext.url === "section") { - console.log(" Section:"); - ext.extension?.forEach((subextension) => { - if ("url" in subextension && "valueString" in subextension) { - console.log(" " + subextension.url + ": " + subextension.valueString); - } - }); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "ANG366", - display: "XA VENACAVA FILTER INSERTION", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "male", - birthDate: new Date("1980-04-22T02:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "XA VENACAVA FILTER INSERTION", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `FINDINGS: - 1. Inferior vena cavagram using CO2 contrast shows the IVC is normal - in course and caliber without filling defects to indicate clot. It - measures 19.8 mm. in diameter infrarenally. - - - - - 2. Successful placement of IVC filter in infrarenal location.`, - }; - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "XA VENACAVA FILTER INSERTION", - }; - - const patientData = { - id: "Roberto Lewis", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The finding encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_communication_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_communication_inference_async.js deleted file mode 100644 index 8db63af94112..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_communication_inference_async.js +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the follow up communication of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the follow up communication inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "followupCommunication") { - console.log("Followup Communication Inference found"); - if ("communicatedAt" in inference) { - console.log("Communicated at: " + inference.communicatedAt.join(" ")); - } - if ("recipient" in inference) { - console.log("Recipient: " + inference.recipient.join(" ")); - } - console.log(" Aknowledged: " + inference.wasAcknowledged); - } - }); - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - - - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - - - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - - - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - - - - On duplex imaging, Doppler signal is symmetric. - - - - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - - - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The follow up communication encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_recommendation_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_recommendation_inference_async.js deleted file mode 100644 index 390418d53809..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_follow_up_recommendation_inference_async.js +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the follow up recommendation of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the follow up recommendation inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "followupRecommendation") { - console.log("Follow Up Recommendation Inference found"); - console.log(" Is conditional: ", inference.isConditional); - console.log(" Is guidline: ", inference.isGuideline); - console.log(" Is hedging: ", inference.isHedging); - console.log(" Is option: ", inference.isOption); - - var procedure = inference.recommendedProcedure; - if ("kind" in procedure && procedure.kind === "genericProcedureRecommendation") { - if ("code" in procedure) { - console.log(" Recommended Generic Procedure: ", procedure.code); - } - if ("description" in procedure) { - console.log(" Description: ", procedure.description); - } - } else if ("kind" in procedure && procedure.kind === "imagingProcedureRecommendation") { - procedure.procedureCodes?.forEach((procedureCode) => { - console.log(" Recommended Procedure Codes: "); - displayCodes(procedureCode); - }); - - if ("imagingProcedures" in procedure) { - procedure.imagingProcedures?.forEach((imagingProcedure) => { - console.log(" Recommended Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - }); - } - } - } - }); - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept) { - codeableConcept.coding?.forEach((coding) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } - - function displayImaging(images) { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if ("laterality" in images) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if ("contrast" in images) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if ("view" in images) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - - - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - - - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - - - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - On duplex imaging, Doppler signal is symmetric. - - - - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - - - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The follow up recommendation encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_laterality_discrepancy_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_laterality_discrepancy_inference_async.js deleted file mode 100644 index 91c2234829a6..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_laterality_discrepancy_inference_async.js +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the laterality discrepancy of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the laterality discrepancy recommendation inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "lateralityDiscrepancy") { - console.log("Laterality Discrepancy Inference found: "); - displayCodes(inference.lateralityIndication); - } - }); - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept) { - codeableConcept.coding?.forEach((coding) => { - if ("code" in coding) { - console.log( - " Coding: " + - coding.code + - ", " + - coding.display + - " (" + - coding.system + - "), type: " + - coding.type, - ); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "26688-1", - display: "US BREAST - LEFT LIMITED", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US BREAST - LEFT LIMITED", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `Exam: US LT BREAST TARGETED - Technique: Targeted imaging of the right breast is performed. - - - - - Findings: - Targeted imaging of the left breast is performed from the 6:00 to the 9:00 position. - At the 6:00 position, 5 cm from the nipple, there is a 3 x 2 x 4 mm minimally hypoechoic mass with a peripheral calcification. - This may correspond to the mammographic finding. No other cystic or solid masses visualized.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US BREAST - LEFT LIMITED", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The laterality discrepancy encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_limited_order_discrepancy_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_limited_order_discrepancy_inference_async.js deleted file mode 100644 index c51c44cd9cbc..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_limited_order_discrepancy_inference_async.js +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the limited order discrepancy of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the limited order discrepancy inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "limitedOrderDiscrepancy") { - console.log("Limited Order Discrepancy Inference found: "); - if ("orderType" in inference) { - console.log(" Ordertype: "); - displayCodes(inference.orderType); - } - inference.presentBodyParts?.forEach((bodyparts) => { - console.log(" Present Body Parts: "); - displayCodes(bodyparts); - }); - - inference.presentBodyPartMeasurements?.forEach((bodymeasure) => { - console.log(" Present Body Part Measurements: "); - displayCodes(bodymeasure); - }); - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept) { - codeableConcept.coding?.forEach((coding) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "30704-1", - display: "US ABDOMEN LIMITED", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US ABDOMEN LIMITED", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: `HISTORY: - 49-year-old male with a history of tuberous sclerosis presenting with epigastric pain and diffuse tenderness." - The patient was found to have pericholecystic haziness on CT; evaluation for acute cholecystitis." - - - - - TECHNIQUE: Ultrasound evaluation of the abdomen was performed. - Comparison is made to the prior abdominal ultrasound (2004) and to the enhanced CT of the abdomen and pelvis (2014)." - - - - - FINDINGS:" - The liver is elongated, measuring 19.3 cm craniocaudally, and is homogeneous in echotexture without evidence of focal mass lesion. - The liver contour is smooth on high resolution images." - There is no appreciable intra- or extrahepatic biliary ductal dilatation, with the visualized extrahepatic bile duct measuring up to 6 mm." - There are multiple shadowing gallstones, including within the gallbladder neck, which do not appear particularly mobile." - In addition, there is thickening of the gallbladder wall up to approximately 7 mm with probable mild mural edema." - There is no pericholecystic fluid. No sonographic Murphy's sign was elicited; however the patient reportedly received pain medications in the emergency department." - The pancreatic head, body and visualized portions of the tail are unremarkable." - The spleen is normal in size, measuring 9.9 cm in length." - The kidneys are normal in size." - The right kidney measures 11.5 x 5.2 x 4.3 cm and the left kidney measuring 11.8 x 5.3 x 5.1 cm." - There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis." - The largest echogenic mass on the right is located in the upper pole and measures 1.2 x 1.3 x 1.3 cm." - The largest echogenic mass on the left is located within the renal sinus and measures approximately 2.6 x 2.7 x 4.6 cm." - Additional indeterminate renal lesions are present bilaterally and are better characterized on CT." - There is no hydronephrosis.\\n\\nNo ascites is identified within the upper abdomen." - The visualized portions of the upper abdominal aorta and IVC are normal in caliber." - - - - - IMPRESSION: " - 1. Numerous gallstones associated with gallbladder wall thickening and probable gallbladder mural edema, highly suspicious for acute cholecystitis in this patient presenting with epigastric pain and pericholecystic hazy density identified on CT." - Although no sonographic Murphy sign was elicited, evaluation is limited secondary to reported prior administration of pain medication." - Thus, clinical correlation is required. No evidence of biliary ductal dilation." - 2. There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis." - Additional indeterminate renal lesions are present bilaterally and are better characterized on CT and MR." - These findings were discussed with Dr. Doe at 5:05 p.m. on 1/1/15."`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US ABDOMEN LIMITED", - }; - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The limited order encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_radiology_procedure_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_radiology_procedure_inference_async.js deleted file mode 100644 index 7d18eb3d895e..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_radiology_procedure_inference_async.js +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the radiology procedure of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the radiology procedure inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "radiologyProcedure") { - console.log("Radiology Procedure Inference found"); - inference.procedureCodes?.forEach((procedureCode) => { - console.log(" Procedure Codes: "); - displayCodes(procedureCode); - }); - - if ("imagingProcedures" in inference) { - inference.imagingProcedures?.forEach((imagingProcedure) => { - console.log(" Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - }); - } - - if ("orderedProcedure" in inference) { - console.log(" Ordered procedures: "); - if ("code" in inference.orderedProcedure) { - displayCodes(inference.orderedProcedure.code); - } - } - - if ("description" in inference.orderedProcedure) { - console.log(" Description: " + inference.orderedProcedure.description); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept) { - codeableConcept.coding?.forEach((coding) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } - - function displayImaging(images) { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if ("laterality" in images) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if ("contrast" in images) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if ("view" in images) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "24727-0", - display: "CT HEAD W CONTRAST IV", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "CT HEAD W CONTRAST IV", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: ` Exam: Head CT with Contrast - - - - - History: Headaches for 2 months - Technique: Axial, sagittal, and coronal images were reconstructed from helical CT through the head without IV contrast. - IV contrast: 100 mL IV Omnipaque 300. - - - - - Findings: There is no mass effect. There is no abnormal enhancement of the brain or within injuries with IV contrast. - However, there is no evidence of enhancing lesion in either internal auditory canal. - Impression: Negative CT of the brain without IV contrast. - I recommend a new brain CT within nine months.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "CT HEAD W CONTRAST IV", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The radiology procedure encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_sex_mismatch_inference_async.js b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_sex_mismatch_inference_async.js deleted file mode 100644 index 2d05d477b59b..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/javascript/sample_sex_mismatch_inference_async.js +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the sex mismatch of the Radiology Insights request. - */ -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -const AzureHealthInsightsClient = require("../src").default, - { ClinicalDocumentTypeEnum, getLongRunningPoller, isUnexpected } = require("../src"); - -dotenv.config(); - -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the sex mismatch inference - */ - -function printResults(radiologyInsightsResult) { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "sexMismatch") { - console.log("Sex Mismatch Inference found: "); - if ("sexIndication" in inference) { - displayCodes(inference.sexIndication); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept) { - codeableConcept.coding?.forEach((coding) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } -} - -// Create request body for radiology insights -function createRequestBody() { - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", - }; - - const code = { - coding: [codingData], - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - - const content = { - sourceType: "inline", - value: ` - CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - - - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - - - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - - - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - - - - On duplex imaging, Doppler signal is symmetric. - - - - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - - - - - A new US pelvis within the next 6 months is recommended. - - - - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", - }; - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; -} - -async function main() { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The sex mismatch encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/README.md b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/README.md deleted file mode 100644 index d06ecd0e8f15..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# HealthInsightsRadiologyInsights client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for HealthInsightsRadiologyInsights in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| [sample_age_mismatch_inference_async.ts][sample_age_mismatch_inference_async] | Displays the age mismatch of the Radiology Insights request. | -| [sample_complete_order_discrepancy_inference_async.ts][sample_complete_order_discrepancy_inference_async] | Displays the complete order discrepancy of the Radiology Insights request. | -| [sample_critical_result_inference_async.ts][sample_critical_result_inference_async] | Displays the critical results of the Radiology Insights request. | -| [sample_critical_result_managed_identity.ts][sample_critical_result_managed_identity] | Displays the critical results of the Radiology Insights request. | -| [sample_finding_inference_async.ts][sample_finding_inference_async] | Displays the finding of the Radiology Insights request. | -| [sample_follow_up_communication_inference_async.ts][sample_follow_up_communication_inference_async] | Displays the follow up communication of the Radiology Insights request. | -| [sample_follow_up_recommendation_inference_async.ts][sample_follow_up_recommendation_inference_async] | Displays the follow up recommendation of the Radiology Insights request. | -| [sample_laterality_discrepancy_inference_async.ts][sample_laterality_discrepancy_inference_async] | Displays the laterality discrepancy of the Radiology Insights request. | -| [sample_limited_order_discrepancy_inference_async.ts][sample_limited_order_discrepancy_inference_async] | Displays the limited order discrepancy of the Radiology Insights request. | -| [sample_radiology_procedure_inference_async.ts][sample_radiology_procedure_inference_async] | Displays the radiology procedure of the Radiology Insights request. | -| [sample_sex_mismatch_inference_async.ts][sample_sex_mismatch_inference_async] | Displays the sex mismatch of the Radiology Insights request. | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/sample_age_mismatch_inference_async.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env HEALTH_INSIGHTS_API_KEY="" HEALTH_INSIGHTS_ENDPOINT="" node dist/sample_critical_result_inference_async.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[sample_age_mismatch_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_age_mismatch_inference_async.ts -[sample_complete_order_discrepancy_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_complete_order_discrepancy_inference_async.ts -[sample_critical_result_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_inference_async.ts -[sample_critical_result_managed_identity]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_managed_identity.ts -[sample_finding_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_finding_inference_async.ts -[sample_follow_up_communication_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_communication_inference_async.ts -[sample_follow_up_recommendation_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_recommendation_inference_async.ts -[sample_laterality_discrepancy_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_laterality_discrepancy_inference_async.ts -[sample_limited_order_discrepancy_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_limited_order_discrepancy_inference_async.ts -[sample_radiology_procedure_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_radiology_procedure_inference_async.ts -[sample_sex_mismatch_inference_async]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_sex_mismatch_inference_async.ts -[apiref]: https://learn.microsoft.com/javascript/api -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/package.json b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/package.json deleted file mode 100644 index c73fa21baa8b..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@azure-samples/health-insights-radiologyinsights-ts", - "private": true, - "version": "1.0.0", - "description": "HealthInsightsRadiologyInsights client library samples for TypeScript", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/healthinsights/health-insights-radiologyinsights-rest" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-radiologyinsights-rest", - "dependencies": { - "@azure-rest/health-insights-radiologyinsights": "latest", - "dotenv": "latest", - "@azure/identity": "^4.0.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" - } -} diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/sample.env b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/sample.env deleted file mode 100644 index 811d3b1ed982..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/sample.env +++ /dev/null @@ -1,3 +0,0 @@ -# App registration secret for AAD authentication -HEALTH_INSIGHTS_KEY= -HEALTH_INSIGHTS_ENDPOINT= diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_age_mismatch_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_age_mismatch_inference_async.ts deleted file mode 100644 index e5a3ca608b60..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_age_mismatch_inference_async.ts +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the age mismatch of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; - -import "dotenv/config"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the age mismatch inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput, content: string): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "ageMismatch") { - console.log("Age Mismatch Inference found: "); - const evidence = findAgeEvidence(inference.extension, content); - console.log(" Evidence: " + evidence); - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function findAgeEvidence(extensions: any, content: string) { - let offset = -1; - let length = -1; - let piece = ""; - let evidence = ""; - // for loop needed for traversing from top to bottom of the array - for (const first of extensions) { - for (const ext of first.extension) { - if (ext.url === "offset") { - offset = ext.valueInteger; - } else if (ext.url === "length") { - length = ext.valueInteger; - } - if (offset > 0 && length > 0) { - piece = content.substring(offset, offset + length); - } - } - evidence += `${piece} `; - } - return evidence; - } - -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE" - }; - - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - const content = radiologyInsightsParameter?.body?.jobData?.patients?.[0]?.patientDocuments?.[0]?.content?.value ?? ''; - printResults(resultBody, content); -} - -main().catch((err) => { - console.error("The age mismatch encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_complete_order_discrepancy_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_complete_order_discrepancy_inference_async.ts deleted file mode 100644 index e606ac8e2876..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_complete_order_discrepancy_inference_async.ts +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the complete order discrepancy of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; - -import "dotenv/config"; -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the complete order discrepancy inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "completeOrderDiscrepancy") { - console.log("Complete Order Discrepancy Inference found: "); - if ("orderType" in inference) { - console.log(" Ordertype: "); - displayCodes({ codeableConcept: inference.orderType }); - }; - - inference.missingBodyParts?.forEach((bodyparts: any) => { - console.log(" Missing Body Parts: "); - displayCodes({ codeableConcept: bodyparts }); - }); - - inference.missingBodyPartMeasurements?.forEach((bodymeasure: any) => { - console.log(" Missing Body Part Measurements: "); - displayCodes({ codeableConcept: bodymeasure }); - }); - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes({ codeableConcept }: { codeableConcept: any; }): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log(" Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")"); - } - }); - } - -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE" - }; - - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The complete order encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_inference_async.ts deleted file mode 100644 index 7d031f432c29..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_inference_async.ts +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the critical results of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the critical result inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[]; }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "criticalResult") { - if ("result" in inference) { - console.log("Critical Result Inference found: " + inference.result.description); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE" - }; - - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The critical result encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_managed_identity.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_managed_identity.ts deleted file mode 100644 index 8f3f622dca02..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_critical_result_managed_identity.ts +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the critical results of the Radiology Insights request. - */ -import { DefaultAzureCredential, logger } from "@azure/identity"; -import "dotenv/config"; - -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; -const clientID = process.env["MANAGED_IDENTITY_CLIENT_ID"] || ""; - -/** - * Print the critical result inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[]; }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "criticalResult") { - if ("result" in inference) { - console.log("Critical Result Inference found: " + inference.result.description); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE" - }; - - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - //Create Managed Identity Credential - const credential = new DefaultAzureCredential( - clientID ? { managedIdentityClientId: clientID } : undefined, - ); - const tokenResponse = await credential.getToken('https://cognitiveservices.azure.com/.default'); - logger.info(null, `Got token for Cognitive Services ${tokenResponse?.token}`); - - const client = AzureHealthInsightsClient(endpoint, credential); - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter, { - headers: { - 'Authorization': `Bearer ${tokenResponse?.token}`, - 'Content-Type': 'application/json' - }, - }); - - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The critical result encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_finding_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_finding_inference_async.ts deleted file mode 100644 index faabdd287a78..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_finding_inference_async.ts +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the finding of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the finding inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[]; }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "finding") { - console.log("Finding Inference found: "); - - let find = inference.finding; - if ("code" in find) { - let fcode = find.code; - console.log(" Code: "); - displayCodes(fcode); - } - - find.interpretation?.forEach((inter: any) => { - console.log(" Interpretation: "); - displayCodes(inter); - }); - - inference.finding.component?.forEach((comp: { code: any; valueCodeableConcept: any }) => { - console.log(" Component code: "); - displayCodes(comp.code); - if ("valueCodeableConcept" in comp) { - console.log(" Value component codeable concept: "); - displayCodes(comp.valueCodeableConcept); - } - }); - - if ("extension" in inference) { - displaySectionInfo(inference); - }; - - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log(" Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")"); - } - }); - } - - function displaySectionInfo(inference: { extension: any[]; }) { - inference.extension?.forEach((ext: any) => { - if ("url" in ext && ext.url === "section") { - console.log(" Section:"); - ext.extension?.forEach((subextension: { url: string; valueString: string; }) => { - if ("url" in subextension && "valueString" in subextension) { - console.log(" " + subextension.url + ": " + subextension.valueString); - } - }); - } - }); - } - -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "ANG366", - display: "XA VENACAVA FILTER INSERTION" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "male", - birthDate: new Date("1980-04-22T02:00:00+00:00") - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "XA VENACAVA FILTER INSERTION" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: `FINDINGS: - 1. Inferior vena cavagram using CO2 contrast shows the IVC is normal - in course and caliber without filling defects to indicate clot. It - measures 19.8 mm. in diameter infrarenally. - - 2. Successful placement of IVC filter in infrarenal location.` - }; - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "XA VENACAVA FILTER INSERTION" - }; - - - const patientData = { - id: "Roberto Lewis", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The finding encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_communication_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_communication_inference_async.ts deleted file mode 100644 index d869b1f8bb67..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_communication_inference_async.ts +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the follow up communication of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the follow up communication inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - patientResult.inferences.forEach((inference: { kind: string; communicatedAt: any[]; recipient: any[]; wasAcknowledged: string; }) => { - if (inference.kind === "followupCommunication") { - console.log("Followup Communication Inference found"); - if ("communicatedAt" in inference) { - console.log("Communicated at: " + inference.communicatedAt.join(" ")); - } - if ("recipient" in inference) { - console.log("Recipient: " + inference.recipient.join(" ")); - } - console.log(" Aknowledged: " + inference.wasAcknowledged); - } - }); - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - -} - - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.` - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE" - }; - - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The follow up communication encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_recommendation_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_recommendation_inference_async.ts deleted file mode 100644 index aaad9dadc535..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_follow_up_recommendation_inference_async.ts +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the follow up recommendation of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the follow up recommendation inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - patientResult.inferences.forEach((inference: { kind: string; isConditional: any; isGuideline: any; isHedging: any; isOption: any; recommendedProcedure: any; }) => { - if (inference.kind === "followupRecommendation") { - console.log("Follow Up Recommendation Inference found"); - console.log(" Is conditional: ", inference.isConditional); - console.log(" Is guidline: ", inference.isGuideline); - console.log(" Is hedging: ", inference.isHedging); - console.log(" Is option: ", inference.isOption); - - var procedure = inference.recommendedProcedure; - if ("kind" in procedure && procedure.kind === "genericProcedureRecommendation") { - if ("code" in procedure) { - console.log(" Recommended Generic Procedure: ", procedure.code); - } - if ("description" in procedure) { - console.log(" Description: ", procedure.description); - } - } else if ("kind" in procedure && procedure.kind === "imagingProcedureRecommendation") { - procedure.procedureCodes?.forEach((procedureCode: any) => { - console.log(" Recommended Procedure Codes: "); - displayCodes(procedureCode); - }); - - if ("imagingProcedures" in procedure) { - procedure.imagingProcedures?.forEach((imagingProcedure: any) => { - console.log(" Recommended Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - }); - } - } - } - }); - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log(" Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")"); - } - }); - } - - function displayImaging(images: { modality: { coding: any[]; }; anatomy: { coding: any[]; }; laterality: { coding: any[]; }; contrast: { code: { coding: any[]; }; }; view: { code: { coding: any[]; }; }; }) { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if ("laterality" in images) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if ("contrast" in images) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if ("view" in images) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } - -} - - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.` - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE" - }; - - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The follow up recommendation encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_laterality_discrepancy_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_laterality_discrepancy_inference_async.ts deleted file mode 100644 index 1fe96691d7c6..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_laterality_discrepancy_inference_async.ts +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the laterality discrepancy of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the laterality discrepancy recommendation inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: any) => { - patientResult.inferences.forEach((inference: { kind: string; lateralityIndication: any }) => { - if (inference.kind === "lateralityDiscrepancy") { - console.log("Laterality Discrepancy Inference found: "); - displayCodes(inference.lateralityIndication); - } - }); - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log(" Coding: " + coding.code + ", " + coding.display + " (" + coding.system + "), type: " + coding.type); - } - }); - } - -} - - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "26688-1", - display: "US BREAST - LEFT LIMITED" - }; - - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US BREAST - LEFT LIMITED" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: `Exam: US LT BREAST TARGETED - Technique: Targeted imaging of the right breast is performed. - - Findings: - Targeted imaging of the left breast is performed from the 6:00 to the 9:00 position. - At the 6:00 position, 5 cm from the nipple, there is a 3 x 2 x 4 mm minimally hypoechoic mass with a peripheral calcification. - This may correspond to the mammographic finding. No other cystic or solid masses visualized.` - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US BREAST - LEFT LIMITED" - }; - - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The laterality discrepancy encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_limited_order_discrepancy_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_limited_order_discrepancy_inference_async.ts deleted file mode 100644 index f74e944130f8..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_limited_order_discrepancy_inference_async.ts +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the limited order discrepancy of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the limited order discrepancy inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[]; }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "limitedOrderDiscrepancy") { - console.log("Limited Order Discrepancy Inference found: "); - if ("orderType" in inference) { - console.log(" Ordertype: "); - displayCodes(inference.orderType); - }; - - inference.presentBodyParts?.forEach((bodyparts: any) => { - console.log(" Present Body Parts: "); - displayCodes(bodyparts); - }); - - inference.presentBodyPartMeasurements?.forEach((bodymeasure: any) => { - console.log(" Present Body Part Measurements: "); - displayCodes(bodymeasure); - }); - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log(" Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")"); - } - }); - } - -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "30704-1", - display: "US ABDOMEN LIMITED" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US ABDOMEN LIMITED" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: `HISTORY: - 49-year-old male with a history of tuberous sclerosis presenting with epigastric pain and diffuse tenderness." - The patient was found to have pericholecystic haziness on CT; evaluation for acute cholecystitis." - - TECHNIQUE: Ultrasound evaluation of the abdomen was performed. - Comparison is made to the prior abdominal ultrasound (2004) and to the enhanced CT of the abdomen and pelvis (2014)." - - FINDINGS:" - The liver is elongated, measuring 19.3 cm craniocaudally, and is homogeneous in echotexture without evidence of focal mass lesion. - The liver contour is smooth on high resolution images." - There is no appreciable intra- or extrahepatic biliary ductal dilatation, with the visualized extrahepatic bile duct measuring up to 6 mm." - There are multiple shadowing gallstones, including within the gallbladder neck, which do not appear particularly mobile." - In addition, there is thickening of the gallbladder wall up to approximately 7 mm with probable mild mural edema." - There is no pericholecystic fluid. No sonographic Murphy's sign was elicited; however the patient reportedly received pain medications in the emergency department." - The pancreatic head, body and visualized portions of the tail are unremarkable." - The spleen is normal in size, measuring 9.9 cm in length." - The kidneys are normal in size." - The right kidney measures 11.5 x 5.2 x 4.3 cm and the left kidney measuring 11.8 x 5.3 x 5.1 cm." - There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis." - The largest echogenic mass on the right is located in the upper pole and measures 1.2 x 1.3 x 1.3 cm." - The largest echogenic mass on the left is located within the renal sinus and measures approximately 2.6 x 2.7 x 4.6 cm." - Additional indeterminate renal lesions are present bilaterally and are better characterized on CT." - There is no hydronephrosis.\\n\\nNo ascites is identified within the upper abdomen." - The visualized portions of the upper abdominal aorta and IVC are normal in caliber." - - IMPRESSION: " - 1. Numerous gallstones associated with gallbladder wall thickening and probable gallbladder mural edema, highly suspicious for acute cholecystitis in this patient presenting with epigastric pain and pericholecystic hazy density identified on CT." - Although no sonographic Murphy sign was elicited, evaluation is limited secondary to reported prior administration of pain medication." - Thus, clinical correlation is required. No evidence of biliary ductal dilation." - 2. There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis." - Additional indeterminate renal lesions are present bilaterally and are better characterized on CT and MR." - These findings were discussed with Dr. Doe at 5:05 p.m. on 1/1/15."`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US ABDOMEN LIMITED" - }; - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The limited order encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_radiology_procedure_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_radiology_procedure_inference_async.ts deleted file mode 100644 index 7e15d60161a9..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_radiology_procedure_inference_async.ts +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the radiology procedure of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the radiology procedure inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[]; }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "radiologyProcedure") { - console.log("Radiology Procedure Inference found"); - inference.procedureCodes?.forEach((procedureCode: any) => { - console.log(" Procedure Codes: "); - displayCodes(procedureCode); - }); - - if ("imagingProcedures" in inference) { - inference.imagingProcedures?.forEach((imagingProcedure: any) => { - console.log(" Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - }); - } - - if ("orderedProcedure" in inference) { - console.log(" Ordered procedures: "); - if ("code" in inference.orderedProcedure) { - displayCodes(inference.orderedProcedure.code); - } - } - - if ("description" in inference.orderedProcedure) { - console.log(" Description: " + inference.orderedProcedure.description); - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log(" Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")"); - } - }); - } - - function displayImaging(images: any): void { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if ("laterality" in images) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if ("contrast" in images) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if ("view" in images) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } - -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "24727-0", - display: "CT HEAD W CONTRAST IV" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "CT HEAD W CONTRAST IV" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: ` Exam: Head CT with Contrast - - History: Headaches for 2 months - Technique: Axial, sagittal, and coronal images were reconstructed from helical CT through the head without IV contrast. - IV contrast: 100 mL IV Omnipaque 300. - - Findings: There is no mass effect. There is no abnormal enhancement of the brain or within injuries with IV contrast. - However, there is no evidence of enhancing lesion in either internal auditory canal. - Impression: Negative CT of the brain without IV contrast. - I recommend a new brain CT within nine months.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "CT HEAD W CONTRAST IV" - }; - - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The radiology procedure encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_sex_mismatch_inference_async.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_sex_mismatch_inference_async.ts deleted file mode 100644 index 230e8cc09ae4..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/src/sample_sex_mismatch_inference_async.ts +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * @summary Displays the sex mismatch of the Radiology Insights request. - */ -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -import AzureHealthInsightsClient, { - ClinicalDocumentTypeEnum, - CreateJobParameters, - RadiologyInsightsJobOutput, - getLongRunningPoller, - isUnexpected -} from "../src/index.js"; -// You will need to set this environment variables or edit the following values - -const endpoint = process.env["HEALTH_INSIGHTS_ENDPOINT"] || ""; - -/** - * Print the sex mismatch inference - */ - -function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.status === "succeeded") { - const results = radiologyInsightsResult.result; - if (results !== undefined) { - results.patientResults.forEach((patientResult: { inferences: any[]; }) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference) => { - if (inference.kind === "sexMismatch") { - console.log("Sex Mismatch Inference found: "); - if ("sexIndication" in inference) { - displayCodes(inference.sexIndication) - } - } - }); - } - }); - } - } else { - const error = radiologyInsightsResult.error; - if (error) { - console.log(error.code, ":", error.message); - } - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log(" Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")"); - } - }); - } - -} - -// Create request body for radiology insights -function createRequestBody(): CreateJobParameters { - - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE" - }; - - const code = { - coding: [codingData] - }; - - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - - const encounterData = { - id: "encounterid1", - period: { - "start": "2021-8-28T00:00:00", - "end": "2021-8-28T00:00:00" - }, - class: "inpatient" - }; - - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - - const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE" - }; - - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1" - }; - - const content = { - sourceType: "inline", - value: ` - CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, - }; - - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE" - }; - - - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData] - }; - - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure"]; - - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true - }; - - const findingOptions = { - provideFocusedSentenceEvidence: true - }; - - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions - }; - - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true - }; - - // create RI Data - const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - } - }; - - return { - body: RadiologyInsightsJob, - }; - -} - -export async function main(): Promise { - const credential = new DefaultAzureCredential(); - const client = AzureHealthInsightsClient(endpoint, credential); - - // Create request body - const radiologyInsightsParameter = createRequestBody(); - - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client.path("/radiology-insights/jobs/{id}", jobID).put(radiologyInsightsParameter); - if (isUnexpected(initialResponse)) { - throw initialResponse; - } - const poller = await getLongRunningPoller(client, initialResponse); - const RadiologyInsightsResult = await poller.pollUntilDone(); - if (isUnexpected(RadiologyInsightsResult)) { - throw RadiologyInsightsResult; - } - const resultBody = RadiologyInsightsResult.body; - printResults(resultBody); -} - -main().catch((err) => { - console.error("The sex mismatch encountered an error:", err); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/tsconfig.json b/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/tsconfig.json deleted file mode 100644 index 984eed535aa8..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/samples/v1/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/azureHealthInsightsClient.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/azureHealthInsightsClient.ts index 7ee1d76c4bd8..58681de73445 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/azureHealthInsightsClient.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/azureHealthInsightsClient.ts @@ -3,24 +3,29 @@ import type { ClientOptions } from "@azure-rest/core-client"; import { getClient } from "@azure-rest/core-client"; -import type { TokenCredential } from "@azure/core-auth"; -import type { AzureHealthInsightsClient } from "./clientDefinitions.js"; import { logger } from "./logger.js"; +import type { TokenCredential, KeyCredential } from "@azure/core-auth"; +import type { AzureHealthInsightsClient } from "./clientDefinitions.js"; + +/** The optional parameters for the client */ +export interface AzureHealthInsightsClientOptions extends ClientOptions { + /** The api version option of the client */ + apiVersion?: string; +} /** * Initialize a new instance of `AzureHealthInsightsClient` - * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.cognitiveservices.azure.com). + * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). * @param credentials - uniquely identify client credential * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - credentials: TokenCredential, - options: ClientOptions = {}, + credentials: TokenCredential | KeyCredential, + { apiVersion = "2024-10-01", ...options }: AzureHealthInsightsClientOptions = {}, ): AzureHealthInsightsClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}/health-insights`; - options.apiVersion = options.apiVersion ?? "2024-04-01"; - const userAgentInfo = `azsdk-js-health-insights-radiologyinsights-rest/1.0.0`; + const userAgentInfo = `azsdk-js-@azure-rest/health-insights-radiologyinsights/2.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` @@ -38,8 +43,24 @@ export default function createClient( apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "Ocp-Apim-Subscription-Key", }, }; - const client = getClient(endpointUrl, credentials, options) as AzureHealthInsightsClient; + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + client.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && apiVersion) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return client; } diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/clientDefinitions.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/clientDefinitions.ts index 44315dcfdcec..8139c8178834 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/clientDefinitions.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/clientDefinitions.ts @@ -1,35 +1,30 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { Client, StreamableMethod } from "@azure-rest/core-client"; -import type { CreateJobParameters, GetJobParameters } from "./parameters.js"; +import type { GetJobParameters, CreateJobParameters } from "./parameters.js"; import type { + GetJob200Response, + GetJobDefaultResponse, CreateJob200Response, CreateJob201Response, CreateJobDefaultResponse, - GetJob200Response, - GetJobDefaultResponse, } from "./responses.js"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; -/** Gets the Radiology Insights job. */ export interface GetJob { /** Gets the status and details of the Radiology Insights job. */ get(options?: GetJobParameters): StreamableMethod; /** Creates a Radiology Insights job with the given request body. */ put( options: CreateJobParameters, - requestOptions?: GetJobParameters, ): StreamableMethod; } -/** The routes for the resource */ export interface Routes { /** Resource for '/radiology-insights/jobs/\{id\}' has methods for the following verbs: get, put */ (path: "/radiology-insights/jobs/{id}", id: string): GetJob; } -/** Create a HealthInsightsclient which is a Client an defined by the resource */ export type AzureHealthInsightsClient = Client & { - /** The path specified by the routes for the resource */ path: Routes; }; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/index.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/index.ts index 79c13bbc8aea..65b13629dc42 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/index.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/index.ts @@ -4,14 +4,12 @@ import AzureHealthInsightsClient from "./azureHealthInsightsClient.js"; export * from "./azureHealthInsightsClient.js"; +export * from "./parameters.js"; +export * from "./responses.js"; export * from "./clientDefinitions.js"; export * from "./isUnexpected.js"; export * from "./models.js"; export * from "./outputModels.js"; -export * from "./parameters.js"; export * from "./pollingHelper.js"; -export * from "./responses.js"; -export * from "./serializeHelper.js"; -// eslint-disable-next-line @azure/azure-sdk/ts-modules-only-named export default AzureHealthInsightsClient; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/isUnexpected.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/isUnexpected.ts index a462994c8e8e..d4c00b42701b 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/isUnexpected.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/isUnexpected.ts @@ -2,12 +2,12 @@ // Licensed under the MIT License. import type { + GetJob200Response, + GetJobDefaultResponse, CreateJob200Response, CreateJob201Response, - CreateJobDefaultResponse, CreateJobLogicalResponse, - GetJob200Response, - GetJobDefaultResponse, + CreateJobDefaultResponse, } from "./responses.js"; const responseMap: Record = { @@ -15,12 +15,9 @@ const responseMap: Record = { "PUT /radiology-insights/jobs/{id}": ["200", "201"], }; -/** Unexpected responses for get job calls */ export function isUnexpected( response: GetJob200Response | GetJobDefaultResponse, ): response is GetJobDefaultResponse; - -/** Unexpected responses for create job calls */ export function isUnexpected( response: | CreateJob200Response @@ -28,8 +25,6 @@ export function isUnexpected( | CreateJobLogicalResponse | CreateJobDefaultResponse, ): response is CreateJobDefaultResponse; - -/** Unexpected responses for get & create job calls */ export function isUnexpected( response: | GetJob200Response diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/models.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/models.ts index cd6ab613ecc0..02586b2a7b02 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/models.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/models.ts @@ -23,10 +23,14 @@ export interface PatientRecord { /** Patient structured information, including demographics and known structured clinical information. */ export interface PatientDetails { - /** The patient's sex. */ + /** + * The patient's sex. + * + * Possible values: "female", "male", "unspecified" + */ sex?: PatientSex; /** The patient's date of birth. */ - birthDate?: Date | string; + birthDate?: string; /** Known clinical information for the patient, structured. */ clinicalInfo?: Array; } @@ -36,7 +40,7 @@ export interface PatientDetails { * Based on [FHIR Resource](https://www.hl7.org/fhir/r4/resource.html */ export interface Resource extends Record { - /** resourceType */ + /** The type of resource */ resourceType: string; /** Resource Id */ id?: string; @@ -95,7 +99,7 @@ export interface Element { /** * Base for all elements - * Based on [FHIR Element](https://www.hl7.org/fhir/datatypes.html#Element) + * Based on [FHIR Element](https://www.hl7.org/fhir/R4/element.html) */ export interface Extension extends Element { /** Source of the definition for the extension code - a logical name or a URL. */ @@ -117,7 +121,7 @@ export interface Extension extends Element { /** Value as SampledData. */ valueSampledData?: SampledData; /** Value as time (hh:mm:ss) */ - valueTime?: Date | string; + valueTime?: string; /** Value as dateTime. */ valueDateTime?: string; /** Value as Period. */ @@ -133,7 +137,7 @@ export interface Extension extends Element { export interface Quantity extends Element { /** Numerical value (with implicit precision) */ value?: number; - /** \< | \<= | \>= | \> - how to understand the value */ + /** < | <= | >= | > - how to understand the value */ comparator?: string; /** Unit representation */ unit?: string; @@ -290,7 +294,7 @@ export interface ObservationComponent extends Element { /** Value as SampledData. */ valueSampledData?: SampledData; /** Value as time (hh:mm:ss) */ - valueTime?: Date | string; + valueTime?: string; /** Value as dateTime. */ valueDateTime?: string; /** Value as Period. */ @@ -337,11 +341,19 @@ export interface ContactDetail extends Element { * See https://www.hl7.org/fhir/R4/datatypes.html#ContactPoint */ export interface ContactPoint { - /** phone | fax | email | pager | url | sms | other */ + /** + * phone | fax | email | pager | url | sms | other + * + * Possible values: "phone", "fax", "email", "pager", "url", "sms", "other" + */ system?: ContactPointSystem; /** The actual contact point details */ value?: string; - /** home | work | temp | old | mobile - purpose of this contact point */ + /** + * home | work | temp | old | mobile - purpose of this contact point + * + * Possible values: "home", "work", "temp", "old", "mobile" + */ use?: ContactPointUse; /** Specify preferred order of use (1 = highest) */ rank?: number; @@ -362,7 +374,6 @@ export interface DomainResourceParent extends Resource { extension?: Array; /** Extensions that cannot be ignored */ modifierExtension?: Array; - /** resourceType */ resourceType: string; } @@ -375,7 +386,11 @@ export interface Observation extends DomainResourceParent { resourceType: "Observation"; /** Business Identifier for observation */ identifier?: Array; - /** registered | preliminary | final | amended + */ + /** + * registered | preliminary | final | amended + + * + * Possible values: "registered", "preliminary", "final", "amended", "corrected", "cancelled", "entered-in-error", "unknown" + */ status: ObservationStatusCodeType; /** Classification of type of observation */ category?: Array; @@ -410,7 +425,7 @@ export interface Observation extends DomainResourceParent { /** Actual result */ valueSampledData?: SampledData; /** Actual result */ - valueTime?: Date | string; + valueTime?: string; /** Actual result */ valueDateTime?: string; /** Actual result */ @@ -512,7 +527,11 @@ export interface ResearchStudy extends DomainResourceParent { protocol?: Array; /** Part of larger study */ partOf?: Array; - /** active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn */ + /** + * active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn + * + * Possible values: "active", "administratively-completed", "approved", "closed-to-accrual", "closed-to-accrual-and-intervention", "completed", "disapproved", "in-review", "temporarily-closed-to-accrual", "temporarily-closed-to-accrual-and-intervention", "withdrawn" + */ status: ResearchStudyStatusCodeType; /** treatment | prevention | diagnostic | supportive-care | screening | health-services-research | basic-science | device-feasibility */ primaryPurposeType?: CodeableConcept; @@ -561,7 +580,11 @@ export interface PatientEncounter { * In case of admission, use timePeriod.start to indicate the admission time and timePeriod.end to indicate the discharge time. */ period?: TimePeriod; - /** The class of the encounter. */ + /** + * The class of the encounter. + * + * Possible values: "inpatient", "ambulatory", "observation", "emergency", "virtual", "healthHome" + */ class?: EncounterClass; } @@ -575,9 +598,17 @@ export interface TimePeriod { /** A clinical document related to a patient. Document here is in the wide sense - not just a text document (note). */ export interface PatientDocument { - /** The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). */ + /** + * The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). + * + * Possible values: "note", "fhirBundle", "dicom", "genomicSequencing" + */ type: DocumentType; - /** The type of the clinical document. */ + /** + * The type of the clinical document. + * + * Possible values: "consultation", "dischargeSummary", "historyAndPhysical", "radiologyReport", "procedure", "progress", "laboratory", "pathologyReport" + */ clinicalType?: ClinicalDocumentType; /** A given identifier for the document. Has to be unique across all documents for a single patient. */ id: string; @@ -587,7 +618,11 @@ export interface PatientDocument { createdAt?: Date | string; /** Document author(s) */ authors?: Array; - /** specialty type the document */ + /** + * specialty type the document + * + * Possible values: "pathology", "radiology" + */ specialtyType?: SpecialtyType; /** Administrative metadata for the document. */ administrativeMetadata?: DocumentAdministrativeMetadata; @@ -627,6 +662,8 @@ export interface DocumentContent { * The type of the content's source. * In case the source type is 'inline', the content is given as a string (for instance, text). * In case the source type is 'reference', the content is given as a URI. + * + * Possible values: "inline", "reference" */ sourceType: DocumentContentSourceType; /** The content of the document, given either inline (as a string) or as a reference (URI). */ @@ -653,6 +690,10 @@ export interface RadiologyInsightsInferenceOptions { followupRecommendationOptions?: FollowupRecommendationOptions; /** Finding options. */ findingOptions?: FindingOptions; + /** Guidance options. */ + guidanceOptions?: GuidanceOptions; + /** QualityMeasureOptions. */ + qualityMeasureOptions?: QualityMeasureOptions; } /** Follow-up recommendation options. */ @@ -671,6 +712,18 @@ export interface FindingOptions { provideFocusedSentenceEvidence?: boolean; } +/** Guidance options. */ +export interface GuidanceOptions { + /** If this is true, also show guidances from a clinical history section i.e. if the first token of the associated finding's clinical indicator is in this section. Default is false. */ + showGuidanceInHistory: boolean; +} + +/** Quality Measure Options. */ +export interface QualityMeasureOptions { + /** Id(s) of the MIPS measures that need to be evaluated in the document */ + measureTypes: QualityMeasureType[]; +} + /** The inference results for the Radiology Insights request. If field 'status' has value 'succeeded', then field 'result' will contain an instance of RadiologyInsightsInferenceResult. */ export interface RadiologyInsightsInferenceResult { /** Results for the patients given in the request. */ @@ -703,7 +756,6 @@ export interface RadiologyInsightsPatientResult { export interface RadiologyInsightsInferenceParent { /** Additional Content defined by implementations */ extension?: Array; - /** The kind of inference */ kind: string; } @@ -727,7 +779,11 @@ export interface LateralityDiscrepancyInference extends RadiologyInsightsInferen kind: "lateralityDiscrepancy"; /** Laterality indication : SNOMED CT code for laterality qualifier value. */ lateralityIndication?: CodeableConcept; - /** Mismatch type : orderLateralityMismatch, textLateralityContradiction, textLateralityMissing. */ + /** + * Mismatch type : orderLateralityMismatch, textLateralityContradiction, textLateralityMissing. + * + * Possible values: "orderLateralityMismatch", "textLateralityContradiction", "textLateralityMissing" + */ discrepancyType: LateralityDiscrepancyType; } @@ -841,7 +897,11 @@ export interface RecommendationFinding { finding?: Observation; /** Critical result linked to a recommendation. */ criticalFinding?: CriticalResult; - /** Recommendation finding status. */ + /** + * Recommendation finding status. + * + * Possible values: "present", "differential", "ruleOut", "conditional" + */ recommendationFindingStatus: RecommendationFindingStatusType; /** Additional Content defined by implementations */ extension?: Array; @@ -851,7 +911,6 @@ export interface RecommendationFinding { export interface ProcedureRecommendationParent { /** Additional Content defined by implementations */ extension?: Array; - /** The kind of procedure recommendation eg. generic or imaging*/ kind: string; } @@ -887,6 +946,84 @@ export interface FollowupCommunicationInference extends RadiologyInsightsInferen wasAcknowledged: boolean; } +/** Identifies and highlights Risk, Scoring, Assessment and Classifications and correspondent values dictated in a report, e.g. 'BIRADS 5' */ +export interface ScoringAndAssessmentInference extends RadiologyInsightsInferenceParent { + /** Inference type. */ + kind: "scoringAndAssessment"; + /** + * Category, e.g. BIRADS + * + * Possible values: "BIRADS", "C-RADS COLONIC FINDINGS", "CAD-RADS", "LI-RADS", "LUNG-RADS", "NI-RADS", "O-RADS", "PI-RADS", "TI-RADS", "C-RADS EXTRACOLONIC FINDINGS", "LIFETIME BREAST CANCER RISK", "ASCVD RISK", "MODIFIED GAIL MODEL RISK", "TYRER CUSICK MODEL RISK", "AGATSTON SCORE", "10 YEAR CHD RISK", "Z-SCORE", "T-SCORE", "CALCIUM VOLUME SCORE", "US LI-RADS VISUALIZATION SCORE", "US LI-RADS", "CEUS LI-RADS", "TREATMENT RESPONSE LI-RADS", "O-RADS MRI", "CALCIUM MASS SCORE", "RISK OF MALIGNANCY INDEX", "HNPCC MUTATION RISK", "ALBERTA STROKE PROGRAM EARLY CT SCORE", "KELLGREN-LAWRENCE GRADING SCALE", "TONNIS CLASSIFICATION", "CALCIUM SCORE (UNSPECIFIED)", "10 YEAR CHD RISK (OBSERVED AGE)", "10 YEAR CHD RISK (ARTERIAL AGE)", "FRAX SCORE" + */ + category: ScoringAndAssessmentCategoryType; + /** The expansion of the category (which is an abbreviation.) */ + categoryDescription: string; + /** The value. If the value is a range, use field valueRange. */ + singleValue?: string; + /** The range. */ + rangeValue?: AssessmentValueRange; +} + +/** A range of values. */ +export interface AssessmentValueRange { + /** The minimum value. */ + minimum: string; + /** The maximum value. */ + maximum: string; +} + +/** A guidance inference collects structured information about a specific finding in the report and can possibly propose appropriate follow-up recommendations, based upon established, evidence-based best practices i.e. ACR guidelines. */ +export interface GuidanceInference extends RadiologyInsightsInferenceParent { + /** Inference type. */ + kind: "guidance"; + /** The finding associated with the guidance. */ + finding: FindingInference; + /** The guidance identifier, as a concept */ + identifier: CodeableConcept; + /** presentGuidanceInformation lists each item of the structured information (e.g. laterality) and corresponding details (left, right, bilateral) that is present in the document. */ + presentGuidanceInformation?: Array; + /** + * See doc of GuidanceRankingType. + * + * Possible values: "high", "low" + */ + ranking: GuidanceRankingType; + /** The proposed follow-up recommendations, if any. If this is filled, missingGuidanceInformation cannot be filled (and vice versa). */ + recommendationProposals?: Array; + /** Contains all missing items that are needed to determine follow-up. */ + missingGuidanceInformation?: string[]; +} + +/** An item of the structured information (e.g. laterality or size) and one or more corresponding details (e.g. left or size-value) */ +export interface PresentGuidanceInformation { + /** The item of the structured information */ + presentGuidanceItem: string; + /** A list of size values, if the item is about size. */ + sizes?: Array; + /** The maximum diameter value, if the item is about the maximum diameter. */ + maximumDiameterAsInText?: Quantity; + /** The list of item values that are mentioned in the report. */ + presentGuidanceValues?: string[]; + /** Additional Content defined by implementations */ + extension?: Array; +} + +/** A QualityMeasure inference captures the MIPS ('measure based incentive payment system') quality measure criteria in the document that are used to measure the data completeness. */ +export interface QualityMeasureInference extends RadiologyInsightsInferenceParent { + /** Inference type. */ + kind: "qualityMeasure"; + /** The denominator, which identifies the QualityMeasure kind. */ + qualityMeasureDenominator: string; + /** + * The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + * + * Possible values: "notEligible", "performanceNotMet", "performanceMet", "denominatorException" + */ + complianceType: QualityMeasureComplianceType; + /** List of quality criteria identified in the document, if any. */ + qualityCriteria?: string[]; +} + /** Response for the Radiology Insights request. */ export interface RadiologyInsightsJob { /** The request data for the operation. */ @@ -922,122 +1059,50 @@ export type RadiologyInsightsInference = | CriticalResultInference | RadiologyProcedureInference | FollowupRecommendationInference - | FollowupCommunicationInference; + | FollowupCommunicationInference + | ScoringAndAssessmentInference + | GuidanceInference + | QualityMeasureInference; /** The procedure recommendation can be a generic procedure or an imaging procedure. */ export type ProcedureRecommendation = | ProcedureRecommendationParent | GenericProcedureRecommendation | ImagingProcedureRecommendation; /** Alias for PatientSex */ -export type PatientSex = string | "female" | "male" | "unspecified"; +export type PatientSex = string; /** Alias for ContactPointSystem */ -export type ContactPointSystem = - | string - | "phone" - | "fax" - | "email" - | "pager" - | "url" - | "sms" - | "other"; +export type ContactPointSystem = string; /** Alias for ContactPointUse */ -export type ContactPointUse = string | "home" | "work" | "temp" | "old" | "mobile"; +export type ContactPointUse = string; /** Alias for ObservationStatusCodeType */ -export type ObservationStatusCodeType = - | string - | "registered" - | "preliminary" - | "final" - | "amended" - | "corrected" - | "cancelled" - | "entered-in-error" - | "unknown"; +export type ObservationStatusCodeType = string; /** Alias for ResearchStudyStatusCodeType */ -export type ResearchStudyStatusCodeType = - | string - | "active" - | "administratively-completed" - | "approved" - | "closed-to-accrual" - | "closed-to-accrual-and-intervention" - | "completed" - | "disapproved" - | "in-review" - | "temporarily-closed-to-accrual" - | "temporarily-closed-to-accrual-and-intervention" - | "withdrawn"; +export type ResearchStudyStatusCodeType = string; /** Alias for EncounterClass */ -export type EncounterClass = - | string - | "inpatient" - | "ambulatory" - | "observation" - | "emergency" - | "virtual" - | "healthHome"; - +export type EncounterClass = string; /** Alias for DocumentType */ -export type DocumentType = string | "note" | "fhirBundle" | "dicom" | "genomicSequencing"; - +export type DocumentType = string; /** Alias for ClinicalDocumentType */ -export enum ClinicalDocumentTypeEnum { - /** Consultation documents */ - Consultation = "consultation", - /** Discharge summary documents */ - DischargeSummary = "dischargeSummary", - /** H&P documents */ - HistoryAndPhysical = "historyAndPhysical", - /** Radiology documents */ - RadiologyReport = "radiologyReport", - /** Procedure notes */ - Procedure = "procedure", - /** Progress notes */ - Progress = "progress", - /** Laboratory documents */ - Laboratory = "laboratory", - // Add more predefined types as needed -} -/** Allowed types of documents to be evaluated, specified in an Enum */ -export type ClinicalDocumentType = ClinicalDocumentTypeEnum; - +export type ClinicalDocumentType = string; /** Alias for SpecialtyType */ -export type SpecialtyType = string | "pathology" | "radiology"; +export type SpecialtyType = string; /** Alias for DocumentContentSourceType */ -export type DocumentContentSourceType = string | "inline" | "reference"; +export type DocumentContentSourceType = string; /** Alias for RadiologyInsightsInferenceType */ -export type RadiologyInsightsInferenceType = - | string - | "ageMismatch" - | "lateralityDiscrepancy" - | "sexMismatch" - | "completeOrderDiscrepancy" - | "limitedOrderDiscrepancy" - | "finding" - | "criticalResult" - | "followupRecommendation" - | "followupCommunication" - | "radiologyProcedure"; +export type RadiologyInsightsInferenceType = string; +/** Alias for QualityMeasureType */ +export type QualityMeasureType = string; /** Alias for LateralityDiscrepancyType */ -export type LateralityDiscrepancyType = - | string - | "orderLateralityMismatch" - | "textLateralityContradiction" - | "textLateralityMissing"; +export type LateralityDiscrepancyType = string; /** Alias for RecommendationFindingStatusType */ -export type RecommendationFindingStatusType = - | string - | "present" - | "differential" - | "ruleOut" - | "conditional"; +export type RecommendationFindingStatusType = string; /** Alias for MedicalProfessionalType */ -export type MedicalProfessionalType = - | string - | "unknown" - | "doctor" - | "nurse" - | "midwife" - | "physicianAssistant"; +export type MedicalProfessionalType = string; +/** Alias for ScoringAndAssessmentCategoryType */ +export type ScoringAndAssessmentCategoryType = string; +/** Alias for GuidanceRankingType */ +export type GuidanceRankingType = string; +/** Alias for QualityMeasureComplianceType */ +export type QualityMeasureComplianceType = string; /** Alias for JobStatus */ -export type JobStatus = string | "notStarted" | "running" | "succeeded" | "failed" | "canceled"; +export type JobStatus = string; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/outputModels.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/outputModels.ts index c0accbf8e997..feecd8a7fea8 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/outputModels.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/outputModels.ts @@ -11,7 +11,11 @@ export interface RadiologyInsightsJobOutput { readonly result?: RadiologyInsightsInferenceResultOutput; /** The unique ID of the job. */ readonly id: string; - /** The status of the job. */ + /** + * The status of the job. + * + * Possible values: "notStarted", "running", "succeeded", "failed", "canceled" + */ readonly status: JobStatusOutput; /** The date and time when the processing job was created. */ readonly createdAt?: string; @@ -45,7 +49,11 @@ export interface PatientRecordOutput { /** Patient structured information, including demographics and known structured clinical information. */ export interface PatientDetailsOutput { - /** The patient's sex. */ + /** + * The patient's sex. + * + * Possible values: "female", "male", "unspecified" + */ sex?: PatientSexOutput; /** The patient's date of birth. */ birthDate?: string; @@ -117,7 +125,7 @@ export interface ElementOutput { /** * Base for all elements - * Based on [FHIR Element](https://www.hl7.org/fhir/datatypes.html#Element) + * Based on [FHIR Element](https://www.hl7.org/fhir/R4/element.html) */ export interface ExtensionOutput extends ElementOutput { /** Source of the definition for the extension code - a logical name or a URL. */ @@ -155,7 +163,7 @@ export interface ExtensionOutput extends ElementOutput { export interface QuantityOutput extends ElementOutput { /** Numerical value (with implicit precision) */ value?: number; - /** \< | \<= | \>= | \> - how to understand the value */ + /** < | <= | >= | > - how to understand the value */ comparator?: string; /** Unit representation */ unit?: string; @@ -359,11 +367,19 @@ export interface ContactDetailOutput extends ElementOutput { * See https://www.hl7.org/fhir/R4/datatypes.html#ContactPoint */ export interface ContactPointOutput { - /** phone | fax | email | pager | url | sms | other */ + /** + * phone | fax | email | pager | url | sms | other + * + * Possible values: "phone", "fax", "email", "pager", "url", "sms", "other" + */ system?: ContactPointSystemOutput; /** The actual contact point details */ value?: string; - /** home | work | temp | old | mobile - purpose of this contact point */ + /** + * home | work | temp | old | mobile - purpose of this contact point + * + * Possible values: "home", "work", "temp", "old", "mobile" + */ use?: ContactPointUseOutput; /** Specify preferred order of use (1 = highest) */ rank?: number; @@ -384,7 +400,6 @@ export interface DomainResourceOutputParent extends ResourceOutput { extension?: Array; /** Extensions that cannot be ignored */ modifierExtension?: Array; - /** resourceType */ resourceType: string; } @@ -397,7 +412,11 @@ export interface ObservationOutput extends DomainResourceOutputParent { resourceType: "Observation"; /** Business Identifier for observation */ identifier?: Array; - /** registered | preliminary | final | amended + */ + /** + * registered | preliminary | final | amended + + * + * Possible values: "registered", "preliminary", "final", "amended", "corrected", "cancelled", "entered-in-error", "unknown" + */ status: ObservationStatusCodeTypeOutput; /** Classification of type of observation */ category?: Array; @@ -534,7 +553,11 @@ export interface ResearchStudyOutput extends DomainResourceOutputParent { protocol?: Array; /** Part of larger study */ partOf?: Array; - /** active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn */ + /** + * active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn + * + * Possible values: "active", "administratively-completed", "approved", "closed-to-accrual", "closed-to-accrual-and-intervention", "completed", "disapproved", "in-review", "temporarily-closed-to-accrual", "temporarily-closed-to-accrual-and-intervention", "withdrawn" + */ status: ResearchStudyStatusCodeTypeOutput; /** treatment | prevention | diagnostic | supportive-care | screening | health-services-research | basic-science | device-feasibility */ primaryPurposeType?: CodeableConceptOutput; @@ -583,7 +606,11 @@ export interface PatientEncounterOutput { * In case of admission, use timePeriod.start to indicate the admission time and timePeriod.end to indicate the discharge time. */ period?: TimePeriodOutput; - /** The class of the encounter. */ + /** + * The class of the encounter. + * + * Possible values: "inpatient", "ambulatory", "observation", "emergency", "virtual", "healthHome" + */ class?: EncounterClassOutput; } @@ -597,9 +624,17 @@ export interface TimePeriodOutput { /** A clinical document related to a patient. Document here is in the wide sense - not just a text document (note). */ export interface PatientDocumentOutput { - /** The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). */ + /** + * The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). + * + * Possible values: "note", "fhirBundle", "dicom", "genomicSequencing" + */ type: DocumentTypeOutput; - /** The type of the clinical document. */ + /** + * The type of the clinical document. + * + * Possible values: "consultation", "dischargeSummary", "historyAndPhysical", "radiologyReport", "procedure", "progress", "laboratory", "pathologyReport" + */ clinicalType?: ClinicalDocumentTypeOutput; /** A given identifier for the document. Has to be unique across all documents for a single patient. */ id: string; @@ -609,7 +644,11 @@ export interface PatientDocumentOutput { createdAt?: string; /** Document author(s) */ authors?: Array; - /** specialty type the document */ + /** + * specialty type the document + * + * Possible values: "pathology", "radiology" + */ specialtyType?: SpecialtyTypeOutput; /** Administrative metadata for the document. */ administrativeMetadata?: DocumentAdministrativeMetadataOutput; @@ -649,6 +688,8 @@ export interface DocumentContentOutput { * The type of the content's source. * In case the source type is 'inline', the content is given as a string (for instance, text). * In case the source type is 'reference', the content is given as a URI. + * + * Possible values: "inline", "reference" */ sourceType: DocumentContentSourceTypeOutput; /** The content of the document, given either inline (as a string) or as a reference (URI). */ @@ -675,6 +716,10 @@ export interface RadiologyInsightsInferenceOptionsOutput { followupRecommendationOptions?: FollowupRecommendationOptionsOutput; /** Finding options. */ findingOptions?: FindingOptionsOutput; + /** Guidance options. */ + guidanceOptions?: GuidanceOptionsOutput; + /** QualityMeasureOptions. */ + qualityMeasureOptions?: QualityMeasureOptionsOutput; } /** Follow-up recommendation options. */ @@ -693,6 +738,18 @@ export interface FindingOptionsOutput { provideFocusedSentenceEvidence?: boolean; } +/** Guidance options. */ +export interface GuidanceOptionsOutput { + /** If this is true, also show guidances from a clinical history section i.e. if the first token of the associated finding's clinical indicator is in this section. Default is false. */ + showGuidanceInHistory: boolean; +} + +/** Quality Measure Options. */ +export interface QualityMeasureOptionsOutput { + /** Id(s) of the MIPS measures that need to be evaluated in the document */ + measureTypes: QualityMeasureTypeOutput[]; +} + /** The inference results for the Radiology Insights request. If field 'status' has value 'succeeded', then field 'result' will contain an instance of RadiologyInsightsInferenceResult. */ export interface RadiologyInsightsInferenceResultOutput { /** Results for the patients given in the request. */ @@ -725,7 +782,6 @@ export interface RadiologyInsightsPatientResultOutput { export interface RadiologyInsightsInferenceOutputParent { /** Additional Content defined by implementations */ extension?: Array; - /** The kind of inference */ kind: string; } @@ -750,7 +806,11 @@ export interface LateralityDiscrepancyInferenceOutput kind: "lateralityDiscrepancy"; /** Laterality indication : SNOMED CT code for laterality qualifier value. */ lateralityIndication?: CodeableConceptOutput; - /** Mismatch type : orderLateralityMismatch, textLateralityContradiction, textLateralityMissing. */ + /** + * Mismatch type : orderLateralityMismatch, textLateralityContradiction, textLateralityMissing. + * + * Possible values: "orderLateralityMismatch", "textLateralityContradiction", "textLateralityMissing" + */ discrepancyType: LateralityDiscrepancyTypeOutput; } @@ -867,7 +927,11 @@ export interface RecommendationFindingOutput { finding?: ObservationOutput; /** Critical result linked to a recommendation. */ criticalFinding?: CriticalResultOutput; - /** Recommendation finding status. */ + /** + * Recommendation finding status. + * + * Possible values: "present", "differential", "ruleOut", "conditional" + */ recommendationFindingStatus: RecommendationFindingStatusTypeOutput; /** Additional Content defined by implementations */ extension?: Array; @@ -877,7 +941,6 @@ export interface RecommendationFindingOutput { export interface ProcedureRecommendationOutputParent { /** Additional Content defined by implementations */ extension?: Array; - /** The kind of procedure recommendation eg. generic or imaging*/ kind: string; } @@ -914,17 +977,91 @@ export interface FollowupCommunicationInferenceOutput wasAcknowledged: boolean; } +/** Identifies and highlights Risk, Scoring, Assessment and Classifications and correspondent values dictated in a report, e.g. 'BIRADS 5' */ +export interface ScoringAndAssessmentInferenceOutput + extends RadiologyInsightsInferenceOutputParent { + /** Inference type. */ + kind: "scoringAndAssessment"; + /** + * Category, e.g. BIRADS + * + * Possible values: "BIRADS", "C-RADS COLONIC FINDINGS", "CAD-RADS", "LI-RADS", "LUNG-RADS", "NI-RADS", "O-RADS", "PI-RADS", "TI-RADS", "C-RADS EXTRACOLONIC FINDINGS", "LIFETIME BREAST CANCER RISK", "ASCVD RISK", "MODIFIED GAIL MODEL RISK", "TYRER CUSICK MODEL RISK", "AGATSTON SCORE", "10 YEAR CHD RISK", "Z-SCORE", "T-SCORE", "CALCIUM VOLUME SCORE", "US LI-RADS VISUALIZATION SCORE", "US LI-RADS", "CEUS LI-RADS", "TREATMENT RESPONSE LI-RADS", "O-RADS MRI", "CALCIUM MASS SCORE", "RISK OF MALIGNANCY INDEX", "HNPCC MUTATION RISK", "ALBERTA STROKE PROGRAM EARLY CT SCORE", "KELLGREN-LAWRENCE GRADING SCALE", "TONNIS CLASSIFICATION", "CALCIUM SCORE (UNSPECIFIED)", "10 YEAR CHD RISK (OBSERVED AGE)", "10 YEAR CHD RISK (ARTERIAL AGE)", "FRAX SCORE" + */ + category: ScoringAndAssessmentCategoryTypeOutput; + /** The expansion of the category (which is an abbreviation.) */ + categoryDescription: string; + /** The value. If the value is a range, use field valueRange. */ + singleValue?: string; + /** The range. */ + rangeValue?: AssessmentValueRangeOutput; +} + +/** A range of values. */ +export interface AssessmentValueRangeOutput { + /** The minimum value. */ + minimum: string; + /** The maximum value. */ + maximum: string; +} + +/** A guidance inference collects structured information about a specific finding in the report and can possibly propose appropriate follow-up recommendations, based upon established, evidence-based best practices i.e. ACR guidelines. */ +export interface GuidanceInferenceOutput extends RadiologyInsightsInferenceOutputParent { + /** Inference type. */ + kind: "guidance"; + /** The finding associated with the guidance. */ + finding: FindingInferenceOutput; + /** The guidance identifier, as a concept */ + identifier: CodeableConceptOutput; + /** presentGuidanceInformation lists each item of the structured information (e.g. laterality) and corresponding details (left, right, bilateral) that is present in the document. */ + presentGuidanceInformation?: Array; + /** + * See doc of GuidanceRankingType. + * + * Possible values: "high", "low" + */ + ranking: GuidanceRankingTypeOutput; + /** The proposed follow-up recommendations, if any. If this is filled, missingGuidanceInformation cannot be filled (and vice versa). */ + recommendationProposals?: Array; + /** Contains all missing items that are needed to determine follow-up. */ + missingGuidanceInformation?: string[]; +} + +/** An item of the structured information (e.g. laterality or size) and one or more corresponding details (e.g. left or size-value) */ +export interface PresentGuidanceInformationOutput { + /** The item of the structured information */ + presentGuidanceItem: string; + /** A list of size values, if the item is about size. */ + sizes?: Array; + /** The maximum diameter value, if the item is about the maximum diameter. */ + maximumDiameterAsInText?: QuantityOutput; + /** The list of item values that are mentioned in the report. */ + presentGuidanceValues?: string[]; + /** Additional Content defined by implementations */ + extension?: Array; +} + +/** A QualityMeasure inference captures the MIPS ('measure based incentive payment system') quality measure criteria in the document that are used to measure the data completeness. */ +export interface QualityMeasureInferenceOutput extends RadiologyInsightsInferenceOutputParent { + /** Inference type. */ + kind: "qualityMeasure"; + /** The denominator, which identifies the QualityMeasure kind. */ + qualityMeasureDenominator: string; + /** + * The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + * + * Possible values: "notEligible", "performanceNotMet", "performanceMet", "denominatorException" + */ + complianceType: QualityMeasureComplianceTypeOutput; + /** List of quality criteria identified in the document, if any. */ + qualityCriteria?: string[]; +} + /** A response containing error details. */ export interface HealthInsightsErrorResponseOutput { /** The error object. */ error: ErrorModel; - /** An opaque, globally-unique, server-generated string identifier for the request. */ - requestId: { response: RequestIdResponseHeaderOutput }; } -/** Provides the 'x-ms-request-id' header to enable request correlation in responses. */ -export interface RequestIdResponseHeaderOutput {} - /** * A resource with narrative, extensions, and contained resources * Based on [FHIR DomainResource](https://www.hl7.org/fhir/domainresource.html) @@ -958,127 +1095,50 @@ export type RadiologyInsightsInferenceOutput = | CriticalResultInferenceOutput | RadiologyProcedureInferenceOutput | FollowupRecommendationInferenceOutput - | FollowupCommunicationInferenceOutput; + | FollowupCommunicationInferenceOutput + | ScoringAndAssessmentInferenceOutput + | GuidanceInferenceOutput + | QualityMeasureInferenceOutput; /** The procedure recommendation can be a generic procedure or an imaging procedure. */ export type ProcedureRecommendationOutput = | ProcedureRecommendationOutputParent | GenericProcedureRecommendationOutput | ImagingProcedureRecommendationOutput; /** Alias for PatientSexOutput */ -export type PatientSexOutput = string | "female" | "male" | "unspecified"; +export type PatientSexOutput = string; /** Alias for ContactPointSystemOutput */ -export type ContactPointSystemOutput = - | string - | "phone" - | "fax" - | "email" - | "pager" - | "url" - | "sms" - | "other"; +export type ContactPointSystemOutput = string; /** Alias for ContactPointUseOutput */ -export type ContactPointUseOutput = string | "home" | "work" | "temp" | "old" | "mobile"; +export type ContactPointUseOutput = string; /** Alias for ObservationStatusCodeTypeOutput */ -export type ObservationStatusCodeTypeOutput = - | string - | "registered" - | "preliminary" - | "final" - | "amended" - | "corrected" - | "cancelled" - | "entered-in-error" - | "unknown"; +export type ObservationStatusCodeTypeOutput = string; /** Alias for ResearchStudyStatusCodeTypeOutput */ -export type ResearchStudyStatusCodeTypeOutput = - | string - | "active" - | "administratively-completed" - | "approved" - | "closed-to-accrual" - | "closed-to-accrual-and-intervention" - | "completed" - | "disapproved" - | "in-review" - | "temporarily-closed-to-accrual" - | "temporarily-closed-to-accrual-and-intervention" - | "withdrawn"; +export type ResearchStudyStatusCodeTypeOutput = string; /** Alias for EncounterClassOutput */ -export type EncounterClassOutput = - | string - | "inpatient" - | "ambulatory" - | "observation" - | "emergency" - | "virtual" - | "healthHome"; +export type EncounterClassOutput = string; /** Alias for DocumentTypeOutput */ -export type DocumentTypeOutput = string | "note" | "fhirBundle" | "dicom" | "genomicSequencing"; - +export type DocumentTypeOutput = string; /** Alias for ClinicalDocumentTypeOutput */ -export enum ClinicalDocumentTypeOutputEnum { - /** Consultation documents */ - Consultation = "consultation", - /** Discharge summary documents */ - DischargeSummary = "dischargeSummary", - /** H&P documents */ - HistoryAndPhysical = "historyAndPhysical", - /** Radiology documents */ - RadiologyReport = "radiologyReport", - /** Procedure notes */ - Procedure = "procedure", - /** Progress notes */ - Progress = "progress", - /** Laboratory documents */ - Laboratory = "laboratory", - // Add more predefined types as needed - // Add more predefined types as needed -} -/** Output types of documents */ -export type ClinicalDocumentTypeOutput = ClinicalDocumentTypeOutputEnum; +export type ClinicalDocumentTypeOutput = string; /** Alias for SpecialtyTypeOutput */ -export type SpecialtyTypeOutput = string | "pathology" | "radiology"; +export type SpecialtyTypeOutput = string; /** Alias for DocumentContentSourceTypeOutput */ -export type DocumentContentSourceTypeOutput = string | "inline" | "reference"; +export type DocumentContentSourceTypeOutput = string; /** Alias for RadiologyInsightsInferenceTypeOutput */ -export type RadiologyInsightsInferenceTypeOutput = - | string - | "ageMismatch" - | "lateralityDiscrepancy" - | "sexMismatch" - | "completeOrderDiscrepancy" - | "limitedOrderDiscrepancy" - | "finding" - | "criticalResult" - | "followupRecommendation" - | "followupCommunication" - | "radiologyProcedure"; +export type RadiologyInsightsInferenceTypeOutput = string; +/** Alias for QualityMeasureTypeOutput */ +export type QualityMeasureTypeOutput = string; /** Alias for LateralityDiscrepancyTypeOutput */ -export type LateralityDiscrepancyTypeOutput = - | string - | "orderLateralityMismatch" - | "textLateralityContradiction" - | "textLateralityMissing"; +export type LateralityDiscrepancyTypeOutput = string; /** Alias for RecommendationFindingStatusTypeOutput */ -export type RecommendationFindingStatusTypeOutput = - | string - | "present" - | "differential" - | "ruleOut" - | "conditional"; +export type RecommendationFindingStatusTypeOutput = string; /** Alias for MedicalProfessionalTypeOutput */ -export type MedicalProfessionalTypeOutput = - | string - | "unknown" - | "doctor" - | "nurse" - | "midwife" - | "physicianAssistant"; +export type MedicalProfessionalTypeOutput = string; +/** Alias for ScoringAndAssessmentCategoryTypeOutput */ +export type ScoringAndAssessmentCategoryTypeOutput = string; +/** Alias for GuidanceRankingTypeOutput */ +export type GuidanceRankingTypeOutput = string; +/** Alias for QualityMeasureComplianceTypeOutput */ +export type QualityMeasureComplianceTypeOutput = string; /** Alias for JobStatusOutput */ -export type JobStatusOutput = - | string - | "notStarted" - | "running" - | "succeeded" - | "failed" - | "canceled"; +export type JobStatusOutput = string; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/parameters.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/parameters.ts index 1610e24a7ee9..2536dcfa8ed9 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/parameters.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/parameters.ts @@ -4,38 +4,49 @@ import type { RequestParameters } from "@azure-rest/core-client"; import type { RadiologyInsightsJob } from "./models.js"; -/** Get the job query parameter properties */ +/** This is the wrapper object for the parameter `expand` with explode set to true and style set to form. */ +export interface GetJobExpandQueryParam { + /** Value of the parameter */ + value: string[]; + /** Should we explode the value? */ + explode: true; + /** Style of the value */ + style: "form"; +} + export interface GetJobQueryParamProperties { - /** Expand the indicated resources into the response. This parameter needs to be formatted as multi collection, we provide buildMultiCollection from serializeHelper.ts to help, you will probably need to set skipUrlEncoding as true when sending the request */ - expand?: string; + /** Expand the indicated resources into the response. */ + expand?: GetJobExpandQueryParam; } -/** Get the job query parameters */ export interface GetJobQueryParam { - /** The query parameters. */ queryParameters?: GetJobQueryParamProperties; } -/** Get the job parameters, combining the query and request parameters */ export type GetJobParameters = GetJobQueryParam & RequestParameters; -/** The create job body parameters. */ export interface CreateJobBodyParam { - /** The body of the resource instance. */ + /** The resource instance. */ body: RadiologyInsightsJob; } -/** The create job query parameter properties. */ +/** This is the wrapper object for the parameter `expand` with explode set to true and style set to form. */ +export interface CreateJobExpandQueryParam { + /** Value of the parameter */ + value: string[]; + /** Should we explode the value? */ + explode: true; + /** Style of the value */ + style: "form"; +} + export interface CreateJobQueryParamProperties { - /** Expand the indicated resources into the response. This parameter needs to be formatted as multi collection, we provide buildMultiCollection from serializeHelper.ts to help, you will probably need to set skipUrlEncoding as true when sending the request */ - expand?: string; + /** Expand the indicated resources into the response. */ + expand?: CreateJobExpandQueryParam; } -/** The create job query parameter. */ export interface CreateJobQueryParam { - /** The query parameters. */ queryParameters?: CreateJobQueryParamProperties; } -/** Create the job parameters, combining the create query parameters, the create job body paramters and the request parameters */ export type CreateJobParameters = CreateJobQueryParam & CreateJobBodyParam & RequestParameters; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/pollingHelper.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/pollingHelper.ts index 55f12a7d3c63..5abda1a6550f 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/pollingHelper.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/pollingHelper.ts @@ -2,12 +2,13 @@ // Licensed under the MIT License. import type { Client, HttpResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; import type { + CancelOnProgress, CreateHttpPollerOptions, - LongRunningOperation, - LroResponse, + RunningOperation, + OperationResponse, OperationState, - SimplePollerLike, } from "@azure/core-lro"; import { createHttpPoller } from "@azure/core-lro"; import type { @@ -16,6 +17,73 @@ import type { CreateJobDefaultResponse, CreateJobLogicalResponse, } from "./responses.js"; + +/** + * A simple poller that can be used to poll a long running operation. + */ +export interface SimplePollerLike, TResult> { + /** + * Returns true if the poller has finished polling. + */ + isDone(): boolean; + /** + * Returns the state of the operation. + */ + getOperationState(): TState; + /** + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. + */ + getResult(): TResult | undefined; + /** + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + */ + poll(options?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Returns a promise that will resolve once the underlying operation is completed. + */ + pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. + */ + onProgress(callback: (state: TState) => void): CancelOnProgress; + + /** + * Returns a promise that could be used for serialized version of the poller's operation + * by invoking the operation's serialize method. + */ + serialize(): Promise; + + /** + * Wait the poller to be submitted. + */ + submitted(): Promise; + + /** + * Returns a string representation of the poller's operation. Similar to serialize but returns a string. + * @deprecated Use serialize() instead. + */ + toString(): string; + + /** + * Stops the poller from continuing to poll. Please note this will only stop the client-side polling + * @deprecated Use abortSignal to stop polling instead. + */ + stopPolling(): void; + + /** + * Returns true if the poller is stopped. + * @deprecated Use abortSignal status to track this instead. + */ + isStopped(): boolean; +} + /** * Helper function that builds a Poller object to help polling a long running operation. * @param client - Client to use for sending the request to get additional pages. @@ -35,21 +103,39 @@ export async function getLongRunningPoller( initialResponse: TResult, options: CreateHttpPollerOptions> = {}, ): Promise, TResult>> { - const poller: LongRunningOperation = { - requestMethod: initialResponse.request.method, - requestPath: initialResponse.request.url, + const abortController = new AbortController(); + const poller: RunningOperation = { sendInitialRequest: async () => { // In the case of Rest Clients we are building the LRO poller object from a response that's the reason // we are not triggering the initial request here, just extracting the information from the // response we were provided. return getLroResponse(initialResponse); }, - sendPollRequest: async (path) => { + sendPollRequest: async (path: string, pollOptions?: { abortSignal?: AbortSignalLike }) => { // This is the callback that is going to be called to poll the service // to get the latest status. We use the client provided and the polling path // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location // depending on the lro pattern that the service implements. If non is provided we default to the initial path. - const response = await client.pathUnchecked(path ?? initialResponse.request.url).get(); + function abortListener(): void { + abortController.abort(); + } + const inputAbortSignal = pollOptions?.abortSignal; + const abortSignal = abortController.signal; + if (inputAbortSignal?.aborted) { + abortController.abort(); + } else if (!abortSignal.aborted) { + inputAbortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client + .pathUnchecked(path ?? initialResponse.request.url) + .get({ abortSignal }); + } finally { + inputAbortSignal?.removeEventListener("abort", abortListener); + } const lroResponse = getLroResponse(response as TResult); lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url; return lroResponse; @@ -57,7 +143,45 @@ export async function getLongRunningPoller( }; options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true; - return createHttpPoller(poller, options); + const httpPoller = createHttpPoller(poller, options); + const simplePoller: SimplePollerLike, TResult> = { + isDone() { + return httpPoller.isDone; + }, + isStopped() { + return abortController.signal.aborted; + }, + getOperationState() { + if (!httpPoller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return httpPoller.operationState; + }, + getResult() { + return httpPoller.result; + }, + toString() { + if (!httpPoller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return JSON.stringify({ + state: httpPoller.operationState, + }); + }, + stopPolling() { + abortController.abort(); + }, + onProgress: httpPoller.onProgress, + poll: httpPoller.poll, + pollUntilDone: httpPoller.pollUntilDone, + serialize: httpPoller.serialize, + submitted: httpPoller.submitted, + }; + return simplePoller; } /** @@ -65,7 +189,9 @@ export async function getLongRunningPoller( * @param response - a rest client http response * @returns - An LRO response that the LRO implementation understands */ -function getLroResponse(response: TResult): LroResponse { +function getLroResponse( + response: TResult, +): OperationResponse { if (Number.isNaN(response.status)) { throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`); } diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/responses.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/responses.ts index 51e0b1cb5b11..10060257f035 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/responses.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/responses.ts @@ -1,14 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { HttpResponse } from "@azure-rest/core-client"; import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; import type { - HealthInsightsErrorResponseOutput, RadiologyInsightsJobOutput, + HealthInsightsErrorResponseOutput, } from "./outputModels.js"; -/** Get the headers of the succeeded request */ export interface GetJob200Headers { /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ "retry-after"?: number; @@ -16,32 +15,26 @@ export interface GetJob200Headers { "x-ms-request-id"?: string; } -/** The request has succeeded. Get job response */ +/** The request has succeeded. */ export interface GetJob200Response extends HttpResponse { - /** The status of the request */ status: "200"; - /** The body of the request */ body: RadiologyInsightsJobOutput; - /** The header of the request */ headers: RawHttpHeaders & GetJob200Headers; } -/** Get the default headers of the request */ + export interface GetJobDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; /** An opaque, globally-unique, server-generated string identifier for the request. */ "x-ms-request-id"?: string; } -/** Get the default Response */ + export interface GetJobDefaultResponse extends HttpResponse { - /** The status of the default response */ status: string; - /** The body of the default response */ body: HealthInsightsErrorResponseOutput; - /** The headers of the default response */ headers: RawHttpHeaders & GetJobDefaultHeaders; } -/** Creation of the Headers of the request */ + export interface CreateJob200Headers { /** An opaque, globally-unique, server-generated string identifier for the request. */ "x-ms-request-id"?: string; @@ -49,17 +42,13 @@ export interface CreateJob200Headers { "operation-location": string; } -/** The request has succeeded. Create job response */ +/** The request has succeeded. */ export interface CreateJob200Response extends HttpResponse { - /** The status of the request */ status: "200"; - /** The body of the request */ body: RadiologyInsightsJobOutput; - /** The headers of the request */ headers: RawHttpHeaders & CreateJob200Headers; } -/** Creation of the new resource headers after request has succeeded */ export interface CreateJob201Headers { /** An opaque, globally-unique, server-generated string identifier for the request. */ "x-ms-request-id"?: string; @@ -69,14 +58,11 @@ export interface CreateJob201Headers { /** The request has succeeded and a new resource has been created as a result. */ export interface CreateJob201Response extends HttpResponse { - /** The status of the new resource created */ status: "201"; - /** The body of the new resource created*/ body: RadiologyInsightsJobOutput; - /** The headers of the new resource created */ headers: RawHttpHeaders & CreateJob201Headers; } -/** The default header request creation */ + export interface CreateJobDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; @@ -84,20 +70,14 @@ export interface CreateJobDefaultHeaders { "x-ms-request-id"?: string; } -/** The default header response creation */ export interface CreateJobDefaultResponse extends HttpResponse { - /** The status of the default response */ status: string; - /** The body of the default response */ body: HealthInsightsErrorResponseOutput; - /** The headers of the default response */ headers: RawHttpHeaders & CreateJobDefaultHeaders; } /** The final response for long-running createJob operation */ export interface CreateJobLogicalResponse extends HttpResponse { - /** The status of the final response */ status: "200"; - /** The body of the final response */ body: RadiologyInsightsJobOutput; } diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/serializeHelper.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/src/serializeHelper.ts deleted file mode 100644 index afe6a0cd1b0e..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/src/serializeHelper.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** Returns all parameters per item*/ -export function buildMultiCollection(items: string[], parameterName: string): string { - return items - .map((item, index) => { - if (index === 0) { - return item; - } - return `${parameterName}=${item}`; - }) - .join("&"); -} diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleAgeMismatchInferenceAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleAgeMismatchInferenceAsync.spec.ts deleted file mode 100644 index 993ad9c994f1..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleAgeMismatchInferenceAsync.spec.ts +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: -20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - -COMPARISON: -Right upper quadrant sonographic performed 1 day prior. - -TECHNIQUE: -Transabdominal grayscale pelvic sonography with duplex color Doppler -and spectral waveform analysis of the ovaries. - -FINDINGS: -The uterus is unremarkable given the transabdominal technique with -endometrial echo complex within physiologic normal limits. The -ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the -left measuring 2.8 x 1.5 x 1.9 cm. -On duplex imaging, Doppler signal is symmetric. - -IMPRESSION: -1. Normal pelvic sonography. Findings of testicular torsion. -A new US pelvis within the next 6 months is recommended. - -These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the age mismatches of the Radiology Insights request. - * - */ - -function findAgeMismatch(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "ageMismatch") { - console.log("Age Mismatch Inference found: "); - const evidence = findAgeEvidence(inference.extension); - console.log(" Evidence: " + evidence); - } - }); - } - }); - } -} - -function findAgeEvidence(extensions: any): string { - let offset: number = -1; - let length: number = -1; - let piece: string = ""; - let evidence: string = ""; - // for loop needed for traversing from top to bottom of the array - for (const first of extensions) { - for (const ext of first.extension) { - if (ext.url === "offset") { - offset = ext.valueInteger; - } else if (ext.url === "length") { - length = ext.valueInteger; - } - if (offset > 0 && length > 0) { - piece = content.value.substring(offset, offset + length); - } - } - evidence += `${piece} `; - } - return evidence; -} - -describe("Age Mismatch Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("age mismatch inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138794618263") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findAgeMismatch(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleCompleteOrderDiscrepancyInferenceAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleCompleteOrderDiscrepancyInferenceAsync.spec.ts deleted file mode 100644 index 4c569d8a3e71..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleCompleteOrderDiscrepancyInferenceAsync.spec.ts +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "US BREAST - LEFT LIMITED", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: -20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - -COMPARISON: -Right upper quadrant sonographic performed 1 day prior. - -TECHNIQUE: -Transabdominal grayscale pelvic sonography with duplex color Doppler -and spectral waveform analysis of the ovaries. - -FINDINGS: -The uterus is unremarkable given the transabdominal technique with -endometrial echo complex within physiologic normal limits. The -ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the -left measuring 2.8 x 1.5 x 1.9 cm. - -On duplex imaging, Doppler signal is symmetric. - -IMPRESSION: -1. Normal pelvic sonography. Findings of testicular torsion. -A new US pelvis within the next 6 months is recommended. - -These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the complete order disrepancy inference of the Radiology Insights request. - * - */ - -function findCompleteOrderDiscrep(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "completeOrderDiscrepancy") { - console.log("Complete Order Discrepancy Inference found: "); - if ("orderType" in inference) { - console.log(" Ordertype: "); - displayCodes(inference.orderType); - } - - inference.missingBodyParts?.forEach((bodyparts: any) => { - console.log(" Missing Body Parts: "); - displayCodes(bodyparts); - }); - - inference.missingBodyPartMeasurements?.forEach((bodymeasure: any) => { - console.log(" Missing Body Part Measurements: "); - displayCodes(bodymeasure); - }); - } - }); - } - }); - } - - function displayCodes(codeableConcept: any[]): void { - (codeableConcept as { coding?: any[] }).coding?.forEach((coding) => { - if ("code" in coding && "display" in coding && "system" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } -} - -describe("Complete Order Discrepancy Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("complete order discrepancy inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138794703804") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findCompleteOrderDiscrep(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleCriticalResultInferenceAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleCriticalResultInferenceAsync.spec.ts deleted file mode 100644 index c4fe432f3081..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleCriticalResultInferenceAsync.spec.ts +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: -20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - -COMPARISON: -Right upper quadrant sonographic performed 1 day prior. - -TECHNIQUE: -Transabdominal grayscale pelvic sonography with duplex color Doppler -and spectral waveform analysis of the ovaries. - -FINDINGS: -The uterus is unremarkable given the transabdominal technique with -endometrial echo complex within physiologic normal limits. The -ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the -left measuring 2.8 x 1.5 x 1.9 cm. -On duplex imaging, Doppler signal is symmetric. - -IMPRESSION: -1. Normal pelvic sonography. Findings of testicular torsion. -A new US pelvis within the next 6 months is recommended. - -These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the critical results of the Radiology Insights request. - * - */ - -function findCriticalResultInferences(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "criticalResult") { - if ("result" in inference && "description" in inference.result) { - console.log("Critical Result Inference found: " + inference.result.description); - } - } - }); - } - }); - } -} - -describe("Critical Result Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("critical result inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138794753465") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findCriticalResultInferences(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFindingInferenceAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFindingInferenceAsync.spec.ts deleted file mode 100644 index b5aab505ae50..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFindingInferenceAsync.spec.ts +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "ANG366", - display: "XA VENACAVA FILTER INSERTION", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "male", - birthDate: new Date("1980-04-22T02:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "XA VENACAVA FILTER INSERTION", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: `FINDINGS: - 1. Inferior vena cavagram using CO2 contrast shows the IVC is normal - in course and caliber without filling defects to indicate clot. It - measures 19.8 mm. in diameter infrarenally. - - 2. Successful placement of IVC filter in infrarenal location.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "XA VENACAVA FILTER INSERTION", -}; - -const patientData = { - id: "Roberto Lewis", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the finding inference of the Radiology Insights request. - * - */ - -function findFinding(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "finding") { - console.log("Finding Inference found: "); - - const find = inference.finding; - if ("code" in find) { - const fcode = find.code; - console.log(" Code: "); - displayCodes(fcode); - } - - find.interpretation?.forEach((inter: { coding: any }) => { - console.log(" Interpretation: "); - displayCodes(inter); - }); - - inference.finding.component?.forEach( - (comp: { code: any; valueCodeableConcept: any }) => { - console.log(" Component code: "); - displayCodes(comp.code); - if ("valueCodeableConcept" in comp) { - console.log(" Value component codeable concept: "); - displayCodes(comp.valueCodeableConcept); - } - }, - ); - - if ("extension" in inference) { - displaySectionInfo(inference); - } - } - }); - } - }); - } - - function displayCodes(codeableConcept: { coding: any[] }): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } - - function displaySectionInfo(inference: { extension: any[] }): void { - inference.extension?.forEach((ext: any) => { - if ("url" in ext && ext.url === "section") { - console.log(" Section:"); - ext.extension?.forEach((subextension: { url: string; valueString: string }) => { - if ("url" in subextension && "valueString" in subextension) { - console.log(" " + subextension.url + ": " + subextension.valueString); - } - }); - } - }); - } -} - -describe("Finding Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("finding inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138794807336") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findFinding(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFollowUpCommunicationAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFollowUpCommunicationAsync.spec.ts deleted file mode 100644 index 7f01632e1b25..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFollowUpCommunicationAsync.spec.ts +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: -20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - -COMPARISON: -Right upper quadrant sonographic performed 1 day prior. - -TECHNIQUE: -Transabdominal grayscale pelvic sonography with duplex color Doppler -and spectral waveform analysis of the ovaries. - -FINDINGS: -The uterus is unremarkable given the transabdominal technique with -endometrial echo complex within physiologic normal limits. The -ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the -left measuring 2.8 x 1.5 x 1.9 cm. - -On duplex imaging, Doppler signal is symmetric. - -IMPRESSION: -1. Normal pelvic sonography. Findings of testicular torsion. -A new US pelvis within the next 6 months is recommended. - -These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the Follow Up Recommendation of the Radiology Insights request. - * - */ - -function findFollowUpCommunicationInferences(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach( - (inference: { - kind: string; - communicatedAt: any[]; - recipient: any[]; - wasAcknowledged: string; - }) => { - if (inference.kind === "followupCommunication") { - console.log("Followup Communication Inference found"); - if ("communicatedAt" in inference) { - console.log("Communicated At: " + inference.communicatedAt.join(" ")); - } - if ("recipient" in inference) { - console.log("Recipient: " + inference.recipient.join(" ")); - } - console.log("Aknowledged: " + inference.wasAcknowledged); - } - }, - ); - } - }); - } -} - -describe("Follow Up Communication Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("follow up communication inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138794923687") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findFollowUpCommunicationInferences(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFollowUpRecommendationAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFollowUpRecommendationAsync.spec.ts deleted file mode 100644 index fae60fa25217..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleFollowUpRecommendationAsync.spec.ts +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: `CLINICAL HISTORY: -20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - -COMPARISON: -Right upper quadrant sonographic performed 1 day prior. - -TECHNIQUE: -Transabdominal grayscale pelvic sonography with duplex color Doppler -and spectral waveform analysis of the ovaries. - -FINDINGS: -The uterus is unremarkable given the transabdominal technique with -endometrial echo complex within physiologic normal limits. The -ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the -left measuring 2.8 x 1.5 x 1.9 cm. -On duplex imaging, Doppler signal is symmetric. - -IMPRESSION: -1. Normal pelvic sonography. Findings of testicular torsion. -A new US pelvis within the next 6 months is recommended. - -These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the Follow Up Recommendation of the Radiology Insights request. - * - */ - -function findFollowUpRecommendation(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach( - (inference: { - kind: string; - isConditional: any; - isGuideline: any; - isHedging: any; - isOption: any; - recommendedProcedure: any; - }) => { - if (inference.kind === "followupRecommendation") { - console.log("Follow Up Recommendation Inference found"); - console.log(" Is conditional: ", inference.isConditional); - console.log(" Is guidline: ", inference.isGuideline); - console.log(" Is hedging: ", inference.isHedging); - console.log(" Is option: ", inference.isOption); - - const procedure = inference.recommendedProcedure; - if ("kind" in procedure && procedure.kind === "genericProcedureRecommendation") { - if ("code" in procedure) { - console.log(" Recommended Generic Procedure: ", procedure.code); - } - if ("description" in procedure) { - console.log(" Description: ", procedure.description); - } - } else if ( - "kind" in procedure && - procedure.kind === "imagingProcedureRecommendation" - ) { - procedure.procedureCodes?.forEach((procedureCode: any) => { - console.log(" Recommended Procedure Codes: "); - displayCodes(procedureCode); - }); - - if ("imagingProcedures" in procedure) { - procedure.imagingProcedures?.forEach((imagingProcedure: any) => { - console.log(" Recommended Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - }); - } - } - } - }, - ); - } - }); - } -} - -function displayCodes(codeableConcept: { coding: any[] }): void { - codeableConcept.coding?.forEach((coding) => { - if ("code" in coding && "display" in coding && "system" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); -} - -function displayImaging(images: { - modality: { coding: any[] }; - anatomy: { coding: any[] }; - laterality: { coding: any[] }; - contrast: { code: { coding: any[] } }; - view: { code: { coding: any[] } }; -}): void { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if ("laterality" in images) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if ("contrast" in images) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if ("view" in images) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } -} - -describe("Follow Up Recommendation Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("follow up recommendation inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138794993579") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findFollowUpRecommendation(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleLateralityDiscrepancyInferenceAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleLateralityDiscrepancyInferenceAsync.spec.ts deleted file mode 100644 index 4e950dbe8f2b..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleLateralityDiscrepancyInferenceAsync.spec.ts +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "26688-1", - display: "US BREAST - LEFT LIMITED", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "US BREAST - LEFT LIMITED", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: `Exam: US LT BREAST TARGETED -Technique: Targeted imaging of the right breast is performed. -Findings: -Targeted imaging of the left breast is performed from the 6:00 to the 9:00 position. -At the 6:00 position, 5 cm from the nipple, there is a 3 x 2 x 4 mm minimally hypoechoic mass with a peripheral calcification. -This may correspond to the mammographic finding. No other cystic or solid masses visualized.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US BREAST - LEFT LIMITED", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the laterality discrepancies of the Radiology Insights request. - * - */ - -function findLateralityDiscrepancy(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "lateralityDiscrepancy") { - console.log("Laterality Discrepancy Inference found: "); - displayCodes(inference.lateralityIndication); - } - }); - } - }); - } - - function displayCodes(codeableConcept: any[]): void { - (codeableConcept as { coding?: any[] }).coding?.forEach((coding) => { - if ("code" in coding && "display" in coding && "system" in coding) { - console.log( - " Coding: " + - coding.code + - ", " + - coding.display + - " (" + - coding.system + - "), type: " + - coding.type, - ); - } - }); - } -} - -describe("Laterality Discrepancy Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("laterality discrepancy inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138795064698") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findLateralityDiscrepancy(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleLimitedOrderDiscrepancyInferenceAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleLimitedOrderDiscrepancyInferenceAsync.spec.ts deleted file mode 100644 index 286f1cb657b1..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleLimitedOrderDiscrepancyInferenceAsync.spec.ts +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "30704-1", - display: "US ABDOMEN LIMITED", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "US ABDOMEN LIMITED", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: ` -HISTORY: 49-year-old male with a history of tuberous sclerosis presenting with epigastric pain and diffuse tenderness. -The patient was found to have pericholecystic haziness on CT; evaluation for acute cholecystitis. -TECHNIQUE: Ultrasound evaluation of the abdomen was performed. -Comparison is made to the prior abdominal ultrasound (2004) and to the enhanced CT of the abdomen and pelvis (2014). - -FINDINGS: -The liver is elongated, measuring 19.3 cm craniocaudally, and is homogeneous in echotexture without evidence of focal mass lesion. -The liver contour is smooth on high resolution images. -There is no appreciable intra- or extrahepatic biliary ductal dilatation, with the visualized extrahepatic bile duct measuring up to 6 mm. -There are multiple shadowing gallstones, including within the gallbladder neck, which do not appear particularly mobile. -In addition, there is thickening of the gallbladder wall up to approximately 7 mm with probable mild mural edema. -There is no pericholecystic fluid. No sonographic Murphy's sign was elicited; however the patient reportedly received pain medications in the emergency department. -The pancreatic head, body and visualized portions of the tail are unremarkable. -The spleen is normal in size, measuring 9.9 cm in length. -The kidneys are normal in size. -The right kidney measures 11.5 x 5.2 x 4.3 cm and the left kidney measuring 11.8 x 5.3 x 5.1 cm. -There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis. -The largest echogenic mass on the right is located in the upper pole and measures 1.2 x 1.3 x 1.3 cm. -The largest echogenic mass on the left is located within the renal sinus and measures approximately 2.6 x 2.7 x 4.6 cm. -Additional indeterminate renal lesions are present bilaterally and are better characterized on CT. -There is no hydronephrosis. - -No ascites is identified within the upper abdomen. -The visualized portions of the upper abdominal aorta and IVC are normal in caliber. - -IMPRESSION: -1. Numerous gallstones associated with gallbladder wall thickening and probable gallbladder mural edema, highly suspicious for acute cholecystitis in this patient presenting with epigastric pain and pericholecystic hazy density identified on CT. -Although no sonographic Murphy sign was elicited, evaluation is limited secondary to reported prior administration of pain medication. -Thus, clinical correlation is required. No evidence of biliary ductal dilation. -2. There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis. -Additional indeterminate renal lesions are present bilaterally and are better characterized on CT and MR. -These findings were discussed with Dr. Doe at 5:05 p.m. on 1/1/15. -`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US ABDOMEN LIMITED", -}; -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the limited order disrepancy inference of the Radiology Insights request. - * - */ - -function findLimitedOrderDiscrep(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "limitedOrderDiscrepancy") { - console.log("Limited Order Discrepancy Inference found: "); - if ("orderType" in inference) { - console.log(" Ordertype: "); - displayCodes(inference.orderType); - } - - inference.presentBodyParts?.forEach((bodyparts: any) => { - console.log(" Present Body Parts: "); - displayCodes(bodyparts); - }); - - inference.presentBodyPartMeasurements?.forEach((bodymeasure: any) => { - console.log(" Present Body Part Measurements: "); - displayCodes(bodymeasure); - }); - } - }); - } - }); - } - - function displayCodes(codeableConcept: any[]): void { - (codeableConcept as { coding?: any[] }).coding?.forEach((coding) => { - if ("code" in coding && "display" in coding && "system" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } -} - -describe("Limited Order Discrepancy Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("limited order discrepancy inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138795112952") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findLimitedOrderDiscrep(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleRadiologyProcedureInferenceAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleRadiologyProcedureInferenceAsync.spec.ts deleted file mode 100644 index a2ef0cc6837b..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleRadiologyProcedureInferenceAsync.spec.ts +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "24727-0", - display: "CT HEAD W CONTRAST IV", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "CT HEAD W CONTRAST IV", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: ` Exam: Head CT with Contrast - -History: Headaches for 2 months -Technique: Axial, sagittal, and coronal images were reconstructed from helical CT through the head without IV contrast. -IV contrast: 100 mL IV Omnipaque 300. - -Findings: There is no mass effect. There is no abnormal enhancement of the brain or within injuries with IV contrast. -However, there is no evidence of enhancing lesion in either internal auditory canal. -Impression: Negative CT of the brain without IV contrast. -I recommend a new brain CT within nine months.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "CT HEAD W CONTRAST IV", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the Radiology Procedure of the Radiology Insights request. - * - */ - -function findRadiologyProcedureInference(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach( - (inference: { - kind: string; - procedureCodes: any[]; - imagingProcedures: any[]; - orderedProcedure: { code: any[]; description: string }; - }) => { - if (inference.kind === "radiologyProcedure") { - console.log("Radiology Procedure Inference found"); - inference.procedureCodes?.forEach((procedureCode) => { - console.log(" Procedure Codes: "); - displayCodes(procedureCode); - }); - - if ("imagingProcedures" in inference) { - inference.imagingProcedures.forEach((imagingProcedure) => { - console.log(" Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - }); - } - - if ("orderedProcedure" in inference) { - console.log(" Ordered procedures: "); - if ("code" in inference.orderedProcedure) { - displayCodes(inference.orderedProcedure.code); - } - } - - if ("description" in inference.orderedProcedure) { - console.log(" Description: " + inference.orderedProcedure.description); - } - } - }, - ); - } - }); - } -} - -function displayCodes(codeableConcept: any): void { - (codeableConcept as { coding?: any[] }).coding?.forEach((coding) => { - if ("code" in coding && "display" in coding && "system" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); -} - -function displayImaging(images: { - modality: { coding: any[] }; - anatomy: { coding: any[] }; - laterality: { coding: any[] }; - contrast: { code: { coding: any[] } }; - view: { code: { coding: any[] } }; -}): void { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if ("laterality" in images) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if ("contrast" in images) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if ("view" in images) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } -} - -describe("Radiology Procedure Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("radiology procedure inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138795206163") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findRadiologyProcedureInference(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleSexMismatchInferenceAsync.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleSexMismatchInferenceAsync.spec.ts deleted file mode 100644 index 4f19aa54f03f..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/SampleSexMismatchInferenceAsync.spec.ts +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "USPELVIS", - display: "US PELVIS COMPLETE", -}; - -const code = { - coding: [codingData], -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code, - description: "US PELVIS COMPLETE", -}; - -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: ` - CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler - and spectral waveform analysis of the ovaries. - - FINDINGS: - The uterus is unremarkable given the transabdominal technique with - endometrial echo complex within physiologic normal limits. The - ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the - left measuring 2.8 x 1.5 x 1.9 cm. - - On duplex imaging, Doppler signal is symmetric. - - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - - A new US pelvis within the next 6 months is recommended. - - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; - -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -/** - * - * Display the sex mismatches of the Radiology Insights request. - * - */ - -function findSexMismatch(res: any): void { - if ("result" in res.body) { - res.body.result?.patientResults.forEach((patientResult: any) => { - if (patientResult.inferences) { - patientResult.inferences.forEach((inference: any) => { - if (inference.kind === "sexMismatch") { - console.log("Sex Mismatch Inference found: "); - if ("sexIndication" in inference) { - displayCodes(inference.sexIndication); - } - } - }); - } - }); - } - - function displayCodes(codeableConcept: any): void { - codeableConcept.coding?.forEach((coding: any) => { - if ("code" in coding) { - console.log( - " Coding: " + coding.code + ", " + coding.display + " (" + coding.system + ")", - ); - } - }); - } -} - -describe("Sex Mismatch Inference Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("sex mismatch inference test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138795260264") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - findSexMismatch(res); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/Test_RadiologyInsights_async.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/Test_RadiologyInsights_async.spec.ts deleted file mode 100644 index 5dcae2f9617d..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/Test_RadiologyInsights_async.spec.ts +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import type { AzureHealthInsightsClient } from "../../src/index.js"; -import { ClinicalDocumentTypeEnum, getLongRunningPoller } from "../../src/index.js"; -import { createRecorder, createTestClient } from "./utils/recordedClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const codingData = { - system: "http://www.nlm.nih.gov/research/umls", - code: "C0018802", - display: "MalignantNeoplasms", -}; - -const codingData2 = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "111111", - display: "CT ABD/PELVIS", -}; - -const code = { - coding: [codingData], -}; - -const code2 = { - coding: [codingData2], -}; - -const clinicInfoData = { - resourceType: "Observation", - status: "unknown", - code: code, - valueBoolean: true, -}; - -const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - clinicalInfo: [clinicInfoData], -}; - -const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", -}; - -const authorData = { - id: "authorid1", - fullName: "authorname1", -}; - -const orderedProceduresData = { - code: code2, - description: "CT ABD/PELVIS", -}; -const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", -}; - -const content = { - sourceType: "inline", - value: ` -The results were faxed to Julie Carter on July 6 2016 at 3 PM -The results were sent via Powerscribe to George Brown, PA.`, -}; - -const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T22:00:00.000Z"), - orderedProceduresAsCsv: "US PELVIS COMPLETE", -}; - -const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], -}; - -const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", -]; - -const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, -}; - -const findingOptions = { - provideFocusedSentenceEvidence: true, -}; -const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, -}; - -// Create RI Configuration -const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, -}; - -// create RI Data -const RadiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, -}; - -const param = { - body: RadiologyInsightsJob, -}; - -describe("Radiology Insights Test", () => { - let recorder: Recorder; - let client: AzureHealthInsightsClient; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = await createTestClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("radiology Insights test", async () => { - const result = await client - .path("/radiology-insights/jobs/{id}", "jobId-17138795314335") - .put(param); - const poller = await getLongRunningPoller(client, result); - const res = await poller.pollUntilDone(); - console.log(res); - assert.equal(res.status, "200"); - }); -}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/sampleTest.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..e4591bbad342 --- /dev/null +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/sampleTest.spec.ts @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { assert, beforeEach, afterEach, it, describe } from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + beforeEach(async () => { + // recorder = await createRecorder(this); + }); + + afterEach(async () => { + // await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/env-browser.mts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/env-browser.mts deleted file mode 100644 index fc36ab244fad..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/env-browser.mts +++ /dev/null @@ -1,2 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/env.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/env.ts deleted file mode 100644 index 54ee1e71af77..000000000000 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/env.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import "dotenv/config"; diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/recordedClient.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/recordedClient.ts index 2482e9bf99b3..14dcd9fa397c 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/recordedClient.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/public/utils/recordedClient.ts @@ -1,25 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { createTestCredential } from "@azure-tools/test-credential"; -import type { RecorderStartOptions, TestInfo } from "@azure-tools/test-recorder"; -import { assertEnvironmentVariable, Recorder } from "@azure-tools/test-recorder"; -import { DefaultAzureCredential, logger } from "@azure/identity"; -import type { AzureHealthInsightsClient } from "../../../src/index.js"; -import AHIClient from "../../../src/index.js"; -import "./env.js"; +import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; -const envSetupForPlayback: Record = { - HEALTH_INSIGHTS_ENDPOINT: "https://sanitized/", +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", }; const recorderEnvSetup: RecorderStartOptions = { - envSetupForPlayback, - removeCentralSanitizers: [ - "AZSDK3447", // .key is not a secret - "AZSDK4001", // URI need not be over sanitized since we have the fake endpoint set already - "AZSDK2030", // operation-location header is not a secret since the URI is fake, being done by the fake endpoint - ], + envSetupForPlayback: replaceableVariables, }; /** @@ -27,32 +16,8 @@ const recorderEnvSetup: RecorderStartOptions = { * Should be called first in the test suite to make sure environment variables are * read before they are being used. */ -export async function createRecorder(context: TestInfo): Promise { +export async function createRecorder(context: VitestTestContext): Promise { const recorder = new Recorder(context); await recorder.start(recorderEnvSetup); return recorder; } - -export async function createTestClient(recorder: Recorder): Promise { - const endpoint = assertEnvironmentVariable("HEALTH_INSIGHTS_ENDPOINT"); - const credential = createTestCredential(); - return AHIClient(endpoint, credential, recorder.configureClientOptions({})); -} - -export async function createManagedClient(recorder: Recorder): Promise { - const endpoint = assertEnvironmentVariable("HEALTH_INSIGHTS_ENDPOINT"); - const credential = new DefaultAzureCredential({ - managedIdentityClientId: process.env.MANAGED_IDENTITY_CLIENT_ID, - }); - const tokenResponse = await credential.getToken("https://cognitiveservices.azure.com/.default"); - logger.info(null, `Got token for Cognitive Services ${tokenResponse?.token}`); - return AHIClient( - endpoint, - credential, - recorder.configureClientOptions({ - bearerTokenAuthenticationPolicy: { - token: tokenResponse?.token, - }, - }), - ); -} diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/snippets.spec.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/snippets.spec.ts index dc0bb055b5af..5d6136453264 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/test/snippets.spec.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/test/snippets.spec.ts @@ -1,623 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import RadiologyInsightsRestClient, { - ClinicalDocumentTypeEnum, - CodeableConcept, - Coding, - CompleteOrderDiscrepancyInference, - Extension, - ExtensionOutput, - FindingInference, - FollowupCommunicationInference, - FollowupRecommendationInference, - GenericProcedureRecommendation, - getLongRunningPoller, - ImagingProcedure, - ImagingProcedureRecommendation, - isUnexpected, - LateralityDiscrepancyInference, - LimitedOrderDiscrepancyInference, - RadiologyInsightsJobOutput, - RadiologyProcedureInference, - SexMismatchInference, -} from "../src/index.js"; -import { DefaultAzureCredential } from "@azure/identity"; import { setLogLevel } from "@azure/logger"; import { describe, it } from "vitest"; describe("snippets", () => { - it("ReadmeSampleCreateClient_Node", async () => { - const endpoint = "https://"; - const credential = new DefaultAzureCredential(); - const client = RadiologyInsightsRestClient(endpoint, credential); - }); - - it("ReadmeSampleCriticalResultInference", async () => { - const endpoint = "https://"; - const credential = new DefaultAzureCredential(); - const client = RadiologyInsightsRestClient(endpoint, credential); - // @ts-preserve-whitespace - const codingData = { - system: "Http://hl7.org/fhir/ValueSet/cpt-all", - code: "24727-0", - display: "CT HEAD W CONTRAST IV", - }; - // @ts-preserve-whitespace - const code = { - coding: [codingData], - }; - // @ts-preserve-whitespace - const patientInfo = { - sex: "female", - birthDate: new Date("1959-11-11T19:00:00+00:00"), - }; - // @ts-preserve-whitespace - const encounterData = { - id: "encounterid1", - period: { - start: "2021-8-28T00:00:00", - end: "2021-8-28T00:00:00", - }, - class: "inpatient", - }; - // @ts-preserve-whitespace - const authorData = { - id: "authorid1", - fullName: "authorname1", - }; - // @ts-preserve-whitespace - const orderedProceduresData = { - code: code, - description: "CT HEAD W CONTRAST IV", - }; - // @ts-preserve-whitespace - const administrativeMetadata = { - orderedProcedures: [orderedProceduresData], - encounterId: "encounterid1", - }; - // @ts-preserve-whitespace - const content = { - sourceType: "inline", - value: ` Exam: Head CT with Contrast - - History: Headaches for 2 months - Technique: Axial, sagittal, and coronal images were reconstructed from helical CT through the head without IV contrast. - IV contrast: 100 mL IV Omnipaque 300. - - Findings: There is no mass effect. There is no abnormal enhancement of the brain or within injuries with IV contrast. - However, there is no evidence of enhancing lesion in either internal auditory canal. - Impression: Negative CT of the brain without IV contrast. - I recommend a new brain CT within nine months.`, - }; - // @ts-preserve-whitespace - const patientDocumentData = { - type: "note", - clinicalType: ClinicalDocumentTypeEnum.RadiologyReport, - id: "docid1", - language: "en", - authors: [authorData], - specialtyType: "radiology", - administrativeMetadata: administrativeMetadata, - content: content, - createdAt: new Date("2021-05-31T16:00:00.000Z"), - orderedProceduresAsCsv: "CT HEAD W CONTRAST IV", - }; - // @ts-preserve-whitespace - const patientData = { - id: "Samantha Jones", - details: patientInfo, - encounters: [encounterData], - patientDocuments: [patientDocumentData], - }; - // @ts-preserve-whitespace - const inferenceTypes = [ - "finding", - "ageMismatch", - "lateralityDiscrepancy", - "sexMismatch", - "completeOrderDiscrepancy", - "limitedOrderDiscrepancy", - "criticalResult", - "criticalRecommendation", - "followupRecommendation", - "followupCommunication", - "radiologyProcedure", - ]; - // @ts-preserve-whitespace - const followupRecommendationOptions = { - includeRecommendationsWithNoSpecifiedModality: true, - includeRecommendationsInReferences: true, - provideFocusedSentenceEvidence: true, - }; - // @ts-preserve-whitespace - const findingOptions = { - provideFocusedSentenceEvidence: true, - }; - // @ts-preserve-whitespace - const inferenceOptions = { - followupRecommendationOptions: followupRecommendationOptions, - findingOptions: findingOptions, - }; - // @ts-preserve-whitespace - // Create RI Configuration - const configuration = { - inferenceOptions: inferenceOptions, - inferenceTypes: inferenceTypes, - locale: "en-US", - verbose: false, - includeEvidence: true, - }; - // @ts-preserve-whitespace - // create RI Data - const radiologyInsightsJob = { - jobData: { - patients: [patientData], - configuration: configuration, - }, - }; - // @ts-preserve-whitespace - // Create request body - const radiologyInsightsParameter = { body: radiologyInsightsJob }; - // @ts-preserve-whitespace - // Initiate radiology insights job and retrieve results - const dateString = Date.now(); - const jobID = "jobId-" + dateString; - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter); - // @ts-preserve-whitespace - if (isUnexpected(initialResponse)) { - throw initialResponse.body.error; - } - // @ts-preserve-whitespace - const poller = await getLongRunningPoller(client, initialResponse); - const radiologyInsightsResult = await poller.pollUntilDone(); - // @ts-preserve-whitespace - if (isUnexpected(radiologyInsightsResult)) { - throw radiologyInsightsResult.body.error; - } - // @ts-preserve-whitespace - const result = radiologyInsightsResult.body.result; - // @ts-preserve-whitespace - if (result) { - for (const patientResult of result.patientResults) { - if (patientResult.inferences) { - for (const inference of patientResult.inferences) { - if (inference.kind === "radiologyProcedure") { - console.log("Radiology Procedure Inference found"); - const radiologyProcedureInference = inference as RadiologyProcedureInference; - for (const procedureCode of radiologyProcedureInference?.procedureCodes || []) { - console.log(" Procedure Codes: "); - displayCodes(procedureCode.coding); - } - // @ts-preserve-whitespace - if (radiologyProcedureInference.imagingProcedures) { - console.log(" Imaging Procedure Codes: "); - for (const imagingProcedure of radiologyProcedureInference.imagingProcedures) { - displayImaging(imagingProcedure); - } - } - // @ts-preserve-whitespace - if (radiologyProcedureInference.orderedProcedure) { - console.log(" Ordered Procedure Codes: "); - displayCodes(radiologyProcedureInference.orderedProcedure.code?.coding); - } - // @ts-preserve-whitespace - if (radiologyProcedureInference.orderedProcedure.description) { - console.log( - ` Description: ${radiologyProcedureInference.orderedProcedure.description}`, - ); - } - } - } - } - } - } - // @ts-preserve-whitespace - function displayCodes(codingList: Coding[] | undefined) { - for (const coding of codingList || []) { - console.log(` Coding: ${coding.code} , ${coding.display} (${coding.system})`); - } - } - // @ts-preserve-whitespace - function displayImaging(images: ImagingProcedure): void { - console.log(" Modality Codes: "); - displayCodes(images.modality.coding); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy.coding); - if (images.laterality) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality.coding); - } - if (images.contrast) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code.coding); - } - if (images.view) { - console.log(" View Codes: "); - displayCodes(images.view.code.coding); - } - } - }); - - it("ReadmeSampleAgeMismatch", async () => { - function printResults( - radiologyInsightsResult: RadiologyInsightsJobOutput, - content: string, - ): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "ageMismatch") { - console.log("Age Mismatch Inference found: "); - const evidence = findAgeEvidence(inference.extension, content); - console.log(" Evidence: " + evidence); - } - } - } - // @ts-preserve-whitespace - function findAgeEvidence(extensions: ExtensionOutput[], content: string) { - let offset = -1; - let length = -1; - let piece = ""; - let evidence = ""; - // for loop needed for traversing from top to bottom of the array - for (const first of extensions) { - for (const ext of first.extension) { - if (ext.url === "offset") { - offset = ext.valueInteger; - } else if (ext.url === "length") { - length = ext.valueInteger; - } - if (offset > 0 && length > 0) { - piece = content.substring(offset, offset + length); - } - } - evidence += `${piece} `; - } - return evidence; - } - } - }); - - it("ReadmeSampleCompleteOrderDiscrepancy", async () => { - function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "completeOrderDiscrepancy") { - const completeOrderDiscrepancyInference = - inference as CompleteOrderDiscrepancyInference; - console.log("Complete Order Discrepancy Inference found: "); - console.log(" Ordertype: "); - displayCodes({ codeableConcept: completeOrderDiscrepancyInference.orderType }); - // @ts-preserve-whitespace - for (const missingBodyPart of completeOrderDiscrepancyInference.missingBodyParts) { - console.log(" Missing Body Parts: "); - displayCodes({ codeableConcept: missingBodyPart }); - } - // @ts-preserve-whitespace - for (const missingBodymeasure of completeOrderDiscrepancyInference.missingBodyPartMeasurements) { - console.log(" Missing Body Part Measurements: "); - displayCodes({ codeableConcept: missingBodymeasure }); - } - } - } - } - // @ts-preserve-whitespace - function displayCodes({ codeableConcept }: { codeableConcept: CodeableConcept }): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - } - }); - - it("ReadmeSampleFindingInference", async () => { - function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - if (radiologyInsightsResult.result) { - for (const patientResult of radiologyInsightsResult.result.patientResults) { - if (patientResult.inferences) { - for (const inference of patientResult.inferences) { - console.log("Finding Inference found: "); - if (inference.kind === "finding") { - const findingInference = inference as FindingInference; - // @ts-preserve-whitespace - if (findingInference.finding.code) { - console.log(" Code: "); - displayCodes(findingInference.finding.code); - } - // @ts-preserve-whitespace - for (const interpretation of findingInference.finding.interpretation) { - console.log(" Interpretation: "); - displayCodes(interpretation); - } - // @ts-preserve-whitespace - for (const component of findingInference.finding.component) { - console.log(" Component code: "); - displayCodes(component.code); - if (component.valueCodeableConcept) { - console.log(" Value component codeable concept: "); - displayCodes(component.valueCodeableConcept); - } - } - // @ts-preserve-whitespace - if (findingInference.extension) { - displaySectionInfo(findingInference); - } - } - } - } - } - } - // @ts-preserve-whitespace - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - // @ts-preserve-whitespace - function displaySectionInfo(inference: { extension?: Extension[] }) { - for (const extension of inference.extension || []) { - if (extension.url === "section") { - console.log(" Section:"); - for (const { url, valueString } of extension.extension || []) { - console.log(` ${url}: ${valueString}`); - } - } - } - } - } - }); - - it("ReadmeSampleFollowUpCommunication", async () => { - function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "followupCommunication") { - const followupCommunicationInference = inference as FollowupCommunicationInference; - console.log("Followup Communication Inference found"); - if (followupCommunicationInference.communicatedAt) { - console.log( - `Communicated at: ${followupCommunicationInference.communicatedAt.join(" ")}`, - ); - } - if (followupCommunicationInference.recipient) { - console.log(`Recipient: ${followupCommunicationInference.recipient.join(" ")}`); - } - console.log(` Acknowledged: ${followupCommunicationInference.wasAcknowledged}`); - } - } - } - } - }); - - it("ReadmeSampleFollowUpRecommendation", async () => { - function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "followupRecommendation") { - const followupRecommendationInference = inference as FollowupRecommendationInference; - // @ts-preserve-whitespace - console.log("Follow Up Recommendation Inference found"); - console.log(` Is conditional: ${followupRecommendationInference.isConditional}`); - console.log(` Is guideline: ${followupRecommendationInference.isGuideline}`); - console.log(` Is hedging: ${followupRecommendationInference.isHedging}`); - console.log(` Is option: ${followupRecommendationInference.isOption}`); - // @ts-preserve-whitespace - const procedure = followupRecommendationInference.recommendedProcedure; - if (procedure.kind === "genericProcedureRecommendation") { - const genericProcedureRecommendation = procedure as GenericProcedureRecommendation; - console.log( - ` Recommended Generic Procedure: ${genericProcedureRecommendation.code}`, - ); - console.log(` Description: ${genericProcedureRecommendation.description}`); - } else if (procedure.kind === "imagingProcedureRecommendation") { - const imagingProcedureRecommendation = procedure as ImagingProcedureRecommendation; - // @ts-preserve-whitespace - for (const procedureCode of imagingProcedureRecommendation?.procedureCodes || []) { - console.log(" Recommended Procedure Codes: "); - displayCodes(procedureCode); - } - // @ts-preserve-whitespace - for (const imagingProcedure of imagingProcedureRecommendation?.imagingProcedures || - []) { - console.log(" Recommended Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - } - } - } - } - } - // @ts-preserve-whitespace - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - // @ts-preserve-whitespace - function displayImaging(images: ImagingProcedure): void { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if (images.laterality) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if (images.contrast) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if (images.view) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } - } - }); - - it("ReadmeSampleLateralityDiscrepancy", async () => { - function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "lateralityDiscrepancy") { - const lateralityDiscrepancyInference = inference as LateralityDiscrepancyInference; - console.log("Laterality Discrepancy Inference found: "); - displayCodes(lateralityDiscrepancyInference.lateralityIndication); - } - } - } - // @ts-preserve-whitespace - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - } - }); - - it("ReadmeSampleLimitedOrderDiscrepancy", async () => { - function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "limitedOrderDiscrepancy") { - const limitedOrderDiscrepancyInference = inference as LimitedOrderDiscrepancyInference; - // @ts-preserve-whitespace - console.log("Limited Order Discrepancy Inference found: "); - console.log(" Ordertype: "); - displayCodes(limitedOrderDiscrepancyInference.orderType); - // @ts-preserve-whitespace - for (const presentBodyParts of limitedOrderDiscrepancyInference?.presentBodyParts || - []) { - console.log(" Present Body Parts: "); - displayCodes(presentBodyParts); - } - // @ts-preserve-whitespace - for (const presentBodymeasure of limitedOrderDiscrepancyInference?.presentBodyPartMeasurements || - []) { - console.log(" Present Body Part Measurements: "); - displayCodes(presentBodymeasure); - } - } - } - } - // @ts-preserve-whitespace - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - } - }); - - it("ReadmeSampleRadiologyProcedure", async () => { - function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "radiologyProcedure") { - const radiologyProcedureInference = inference as RadiologyProcedureInference; - console.log("Radiology Procedure Inference found"); - // @ts-preserve-whitespace - for (const procedureCode of radiologyProcedureInference?.procedureCodes || []) { - console.log(" Procedure Codes: "); - displayCodes(procedureCode); - } - // @ts-preserve-whitespace - for (const imagingProcedure of radiologyProcedureInference?.imagingProcedures || []) { - console.log(" Imaging Procedure Codes: "); - displayImaging(imagingProcedure); - } - // @ts-preserve-whitespace - if (radiologyProcedureInference.orderedProcedure) { - console.log(" Ordered Procedure Codes: "); - displayCodes(radiologyProcedureInference.orderedProcedure.code); - } - // @ts-preserve-whitespace - if (radiologyProcedureInference.orderedProcedure.description) { - console.log( - ` Description: ${radiologyProcedureInference.orderedProcedure.description}`, - ); - } - } - } - } - // @ts-preserve-whitespace - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - // @ts-preserve-whitespace - function displayImaging(images: ImagingProcedure): void { - console.log(" Modality Codes: "); - displayCodes(images.modality); - console.log(" Anatomy Codes: "); - displayCodes(images.anatomy); - if (images.laterality) { - console.log(" Laterality Codes: "); - displayCodes(images.laterality); - } - if (images.contrast) { - console.log(" Contrast Codes: "); - displayCodes(images.contrast.code); - } - if (images.view) { - console.log(" View Codes: "); - displayCodes(images.view.code); - } - } - } - }); - - it("ReadmeSampleSexMismatch", async () => { - function printResults(radiologyInsightsResult: RadiologyInsightsJobOutput): void { - for (const patientResult of radiologyInsightsResult?.result?.patientResults || []) { - for (const inference of patientResult?.inferences || []) { - if (inference.kind === "sexMismatch") { - const sexMismatchInference = inference as SexMismatchInference; - console.log("Sex Mismatch Inference found: "); - displayCodes(sexMismatchInference.sexIndication); - } - } - } - // @ts-preserve-whitespace - function displayCodes(codeableConcept: CodeableConcept): void { - for (const coding of codeableConcept.coding || []) { - console.log(` Coding: ${coding.code}, ${coding.display} (${coding.system})`); - } - } - } - }); - - it("ReadmeSampleManagedIdentity", async () => { - const managedIdentityClientId = ""; - const endpoint = "https://"; - const credential = new DefaultAzureCredential({ managedIdentityClientId }); - const client = RadiologyInsightsRestClient(endpoint, credential); - // @ts-preserve-whitespace - const tokenResponse = await credential.getToken("https://cognitiveservices.azure.com/.default"); - // @ts-preserve-whitespace - const jobID = "jobId-123456789"; - const radiologyInsightsJob = { - jobData: { - patients: [], - configuration: {}, - }, - }; - // @ts-preserve-whitespace - // Create request body - const radiologyInsightsParameter = { body: radiologyInsightsJob }; - // Create request body - const initialResponse = await client - .path("/radiology-insights/jobs/{id}", jobID) - .put(radiologyInsightsParameter, { - headers: { - Authorization: `Bearer ${tokenResponse?.token}`, - "Content-Type": "application/json", - }, - }); - }); - it("SetLogLevel", async () => { setLogLevel("info"); }); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/tsconfig.json b/sdk/healthinsights/health-insights-radiologyinsights-rest/tsconfig.json index 19ceb382b521..59ea83c046bf 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/tsconfig.json +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/tsconfig.json @@ -3,11 +3,8 @@ { "path": "./tsconfig.src.json" }, - { - "path": "./tsconfig.samples.json" - }, { "path": "./tsconfig.test.json" } ] -} +} \ No newline at end of file diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/tsp-location.yaml b/sdk/healthinsights/health-insights-radiologyinsights-rest/tsp-location.yaml index c3c48ff9f9c9..d8c65885920b 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/tsp-location.yaml +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/tsp-location.yaml @@ -1,7 +1,6 @@ directory: specification/ai/HealthInsights/HealthInsights.RadiologyInsights -additionalDirectories: - - specification/ai/HealthInsights/HealthInsights.Common - - specification/ai/HealthInsights/HealthInsights.OpenAPI -commit: cd47418616e7308f2aa1797a6b2bd3750dc8f8a6 +commit: b21d3a9d67eaa53f6aa9a2781f4e7fd32df7ed87 repo: Azure/azure-rest-api-specs -cleanup: false +additionalDirectories: +- specification/ai/HealthInsights/HealthInsights.Common +- specification/ai/HealthInsights/HealthInsights.OpenAPI diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.browser.config.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.browser.config.ts index 10e70dbfa8ee..182729ab5ce9 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.browser.config.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.browser.config.ts @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. @@ -8,7 +9,7 @@ export default mergeConfig( viteConfig, defineConfig({ test: { - include: ["dist-test/browser/test/**/*.spec.js"], + include: ["dist-test/browser/test/**/*.spec.js",], testTimeout: 1200000, hookTimeout: 1200000, }, diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.config.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.config.ts index 86a71911ccc2..40e031385dd8 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.config.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.config.ts @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.esm.config.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.esm.config.ts index 5e9735e9b144..a70127279fc9 100644 --- a/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.esm.config.ts +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/vitest.esm.config.ts @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. @@ -5,4 +6,7 @@ import { mergeConfig } from "vitest/config"; import vitestConfig from "./vitest.config.ts"; import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; -export default mergeConfig(vitestConfig, vitestEsmConfig); +export default mergeConfig( + vitestConfig, + vitestEsmConfig +); diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/baseline/review/index.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/baseline/review/index.ts new file mode 100644 index 000000000000..e8d203de1d69 --- /dev/null +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/baseline/review/index.ts @@ -0,0 +1,1351 @@ + +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; +import { CreateHttpPollerOptions } from '@azure/core-lro'; +import { ErrorModel } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { SimplePollerLike } from '@azure/core-lro'; +import { StreamableMethod } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export interface AgeMismatchInference extends RadiologyInsightsInferenceParent { + kind: "ageMismatch"; +} + +// @public +export interface AgeMismatchInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "ageMismatch"; +} + +// @public +export interface Annotation extends Element { + authorString?: string; + text: string; + time?: string; +} + +// @public +export interface AnnotationOutput extends ElementOutput { + authorString?: string; + text: string; + time?: string; +} + +// @public +export type AzureHealthInsightsClient = Client & { + path: Routes; +}; + +// @public +export function buildMultiCollection(items: string[], parameterName: string): string; + +// @public +export type ClinicalDocumentType = ClinicalDocumentTypeEnum; + +// @public +export enum ClinicalDocumentTypeEnum { + Consultation = "consultation", + DischargeSummary = "dischargeSummary", + HistoryAndPhysical = "historyAndPhysical", + Laboratory = "laboratory", + Procedure = "procedure", + Progress = "progress", + RadiologyReport = "radiologyReport" +} + +// @public +export type ClinicalDocumentTypeOutput = ClinicalDocumentTypeOutputEnum; + +// @public +export enum ClinicalDocumentTypeOutputEnum { + Consultation = "consultation", + DischargeSummary = "dischargeSummary", + HistoryAndPhysical = "historyAndPhysical", + Laboratory = "laboratory", + Procedure = "procedure", + Progress = "progress", + RadiologyReport = "radiologyReport" +} + +// @public +export interface CodeableConcept extends Element { + coding?: Array; + text?: string; +} + +// @public +export interface CodeableConceptOutput extends ElementOutput { + coding?: Array; + text?: string; +} + +// @public +export interface Coding extends Element { + code?: string; + display?: string; + system?: string; + version?: string; +} + +// @public +export interface CodingOutput extends ElementOutput { + code?: string; + display?: string; + system?: string; + version?: string; +} + +// @public +export interface CompleteOrderDiscrepancyInference extends RadiologyInsightsInferenceParent { + kind: "completeOrderDiscrepancy"; + missingBodyPartMeasurements?: Array; + missingBodyParts?: Array; + orderType: CodeableConcept; +} + +// @public +export interface CompleteOrderDiscrepancyInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "completeOrderDiscrepancy"; + missingBodyPartMeasurements?: Array; + missingBodyParts?: Array; + orderType: CodeableConceptOutput; +} + +// @public +export interface Condition extends DomainResourceParent { + abatementAge?: Quantity; + abatementDateTime?: string; + abatementPeriod?: Period; + abatementRange?: Range; + abatementString?: string; + bodySite?: Array; + category?: Array; + clinicalStatus?: CodeableConcept; + code?: CodeableConcept; + encounter?: Reference; + identifier?: Array; + note?: Array; + onsetAge?: Quantity; + onsetDateTime?: string; + onsetPeriod?: Period; + onsetRange?: Range; + onsetString?: string; + recordedDate?: string; + resourceType: "Condition"; + severity?: CodeableConcept; + stage?: Array; + verificationStatus?: CodeableConcept; +} + +// @public +export interface ConditionOutput extends DomainResourceOutputParent { + abatementAge?: QuantityOutput; + abatementDateTime?: string; + abatementPeriod?: PeriodOutput; + abatementRange?: RangeOutput; + abatementString?: string; + bodySite?: Array; + category?: Array; + clinicalStatus?: CodeableConceptOutput; + code?: CodeableConceptOutput; + encounter?: ReferenceOutput; + identifier?: Array; + note?: Array; + onsetAge?: QuantityOutput; + onsetDateTime?: string; + onsetPeriod?: PeriodOutput; + onsetRange?: RangeOutput; + onsetString?: string; + recordedDate?: string; + resourceType: "Condition"; + severity?: CodeableConceptOutput; + stage?: Array; + verificationStatus?: CodeableConceptOutput; +} + +// @public +export interface ConditionStage { + summary?: CodeableConcept; + type?: CodeableConcept; +} + +// @public +export interface ConditionStageOutput { + summary?: CodeableConceptOutput; + type?: CodeableConceptOutput; +} + +// @public +export interface ContactDetail extends Element { + name?: string; + telecom?: Array; +} + +// @public +export interface ContactDetailOutput extends ElementOutput { + name?: string; + telecom?: Array; +} + +// @public +export interface ContactPoint { + period?: Period; + rank?: number; + system?: ContactPointSystem; + use?: ContactPointUse; + value?: string; +} + +// @public +export interface ContactPointOutput { + period?: PeriodOutput; + rank?: number; + system?: ContactPointSystemOutput; + use?: ContactPointUseOutput; + value?: string; +} + +// @public +export type ContactPointSystem = string | "phone" | "fax" | "email" | "pager" | "url" | "sms" | "other"; + +// @public +export type ContactPointSystemOutput = string | "phone" | "fax" | "email" | "pager" | "url" | "sms" | "other"; + +// @public +export type ContactPointUse = string | "home" | "work" | "temp" | "old" | "mobile"; + +// @public +export type ContactPointUseOutput = string | "home" | "work" | "temp" | "old" | "mobile"; + +// @public +function createClient(endpointParam: string, credentials: TokenCredential, options?: ClientOptions): AzureHealthInsightsClient; +export default createClient; + +// @public +export interface CreateJob200Headers { + "operation-location": string; + "x-ms-request-id"?: string; +} + +// @public +export interface CreateJob200Response extends HttpResponse { + body: RadiologyInsightsJobOutput; + headers: RawHttpHeaders & CreateJob200Headers; + status: "200"; +} + +// @public +export interface CreateJob201Headers { + "operation-location": string; + "x-ms-request-id"?: string; +} + +// @public +export interface CreateJob201Response extends HttpResponse { + body: RadiologyInsightsJobOutput; + headers: RawHttpHeaders & CreateJob201Headers; + status: "201"; +} + +// @public +export interface CreateJobBodyParam { + body: RadiologyInsightsJob; +} + +// @public +export interface CreateJobDefaultHeaders { + "x-ms-error-code"?: string; + "x-ms-request-id"?: string; +} + +// @public +export interface CreateJobDefaultResponse extends HttpResponse { + body: HealthInsightsErrorResponseOutput; + headers: RawHttpHeaders & CreateJobDefaultHeaders; + status: string; +} + +// @public +export interface CreateJobLogicalResponse extends HttpResponse { + body: RadiologyInsightsJobOutput; + status: "200"; +} + +// @public +export type CreateJobParameters = CreateJobQueryParam & CreateJobBodyParam & RequestParameters; + +// @public +export interface CreateJobQueryParam { + queryParameters?: CreateJobQueryParamProperties; +} + +// @public +export interface CreateJobQueryParamProperties { + expand?: string; +} + +// @public +export interface CriticalResult { + description: string; + finding?: Observation; +} + +// @public +export interface CriticalResultInference extends RadiologyInsightsInferenceParent { + kind: "criticalResult"; + result: CriticalResult; +} + +// @public +export interface CriticalResultInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "criticalResult"; + result: CriticalResultOutput; +} + +// @public +export interface CriticalResultOutput { + description: string; + finding?: ObservationOutput; +} + +// @public +export interface DocumentAdministrativeMetadata { + encounterId?: string; + orderedProcedures?: Array; +} + +// @public +export interface DocumentAdministrativeMetadataOutput { + encounterId?: string; + orderedProcedures?: Array; +} + +// @public +export interface DocumentAuthor { + fullName?: string; + id?: string; +} + +// @public +export interface DocumentAuthorOutput { + fullName?: string; + id?: string; +} + +// @public +export interface DocumentContent { + sourceType: DocumentContentSourceType; + value: string; +} + +// @public +export interface DocumentContentOutput { + sourceType: DocumentContentSourceTypeOutput; + value: string; +} + +// @public +export type DocumentContentSourceType = string | "inline" | "reference"; + +// @public +export type DocumentContentSourceTypeOutput = string | "inline" | "reference"; + +// @public +export type DocumentType = string | "note" | "fhirBundle" | "dicom" | "genomicSequencing"; + +// @public +export type DocumentTypeOutput = string | "note" | "fhirBundle" | "dicom" | "genomicSequencing"; + +// @public +export type DomainResource = DomainResourceParent | Observation | Condition | ResearchStudy; + +// @public +export type DomainResourceOutput = DomainResourceOutputParent | ObservationOutput | ConditionOutput | ResearchStudyOutput; + +// @public +export interface DomainResourceOutputParent extends ResourceOutput { + contained?: Array; + extension?: Array; + modifierExtension?: Array; + resourceType: string; + text?: NarrativeOutput; +} + +// @public +export interface DomainResourceParent extends Resource { + contained?: Array; + extension?: Array; + modifierExtension?: Array; + resourceType: string; + text?: Narrative; +} + +// @public +export interface Element { + extension?: Array; + id?: string; +} + +// @public +export interface ElementOutput { + extension?: Array; + id?: string; +} + +// @public +export type EncounterClass = string | "inpatient" | "ambulatory" | "observation" | "emergency" | "virtual" | "healthHome"; + +// @public +export type EncounterClassOutput = string | "inpatient" | "ambulatory" | "observation" | "emergency" | "virtual" | "healthHome"; + +// @public +export interface Extension extends Element { + url: string; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConcept; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: Period; + valueQuantity?: Quantity; + valueRange?: Range; + valueRatio?: Ratio; + valueReference?: Reference; + valueSampledData?: SampledData; + valueString?: string; + valueTime?: Date | string; +} + +// @public +export interface ExtensionOutput extends ElementOutput { + url: string; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConceptOutput; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: PeriodOutput; + valueQuantity?: QuantityOutput; + valueRange?: RangeOutput; + valueRatio?: RatioOutput; + valueReference?: ReferenceOutput; + valueSampledData?: SampledDataOutput; + valueString?: string; + valueTime?: string; +} + +// @public +export interface FindingInference extends RadiologyInsightsInferenceParent { + finding: Observation; + kind: "finding"; +} + +// @public +export interface FindingInferenceOutput extends RadiologyInsightsInferenceOutputParent { + finding: ObservationOutput; + kind: "finding"; +} + +// @public +export interface FindingOptions { + provideFocusedSentenceEvidence?: boolean; +} + +// @public +export interface FindingOptionsOutput { + provideFocusedSentenceEvidence?: boolean; +} + +// @public +export interface FollowupCommunicationInference extends RadiologyInsightsInferenceParent { + communicatedAt?: Date[] | string[]; + kind: "followupCommunication"; + recipient?: MedicalProfessionalType[]; + wasAcknowledged: boolean; +} + +// @public +export interface FollowupCommunicationInferenceOutput extends RadiologyInsightsInferenceOutputParent { + communicatedAt?: string[]; + kind: "followupCommunication"; + recipient?: MedicalProfessionalTypeOutput[]; + wasAcknowledged: boolean; +} + +// @public +export interface FollowupRecommendationInference extends RadiologyInsightsInferenceParent { + effectiveAt?: string; + effectivePeriod?: Period; + findings?: Array; + isConditional: boolean; + isGuideline: boolean; + isHedging: boolean; + isOption: boolean; + kind: "followupRecommendation"; + recommendedProcedure: ProcedureRecommendation; +} + +// @public +export interface FollowupRecommendationInferenceOutput extends RadiologyInsightsInferenceOutputParent { + effectiveAt?: string; + effectivePeriod?: PeriodOutput; + findings?: Array; + isConditional: boolean; + isGuideline: boolean; + isHedging: boolean; + isOption: boolean; + kind: "followupRecommendation"; + recommendedProcedure: ProcedureRecommendationOutput; +} + +// @public +export interface FollowupRecommendationOptions { + includeRecommendationsInReferences?: boolean; + includeRecommendationsWithNoSpecifiedModality?: boolean; + provideFocusedSentenceEvidence?: boolean; +} + +// @public +export interface FollowupRecommendationOptionsOutput { + includeRecommendationsInReferences?: boolean; + includeRecommendationsWithNoSpecifiedModality?: boolean; + provideFocusedSentenceEvidence?: boolean; +} + +// @public +export interface GenericProcedureRecommendation extends ProcedureRecommendationParent { + code: CodeableConcept; + description?: string; + kind: "genericProcedureRecommendation"; +} + +// @public +export interface GenericProcedureRecommendationOutput extends ProcedureRecommendationOutputParent { + code: CodeableConceptOutput; + description?: string; + kind: "genericProcedureRecommendation"; +} + +// @public +export interface GetJob { + get(options?: GetJobParameters): StreamableMethod; + put(options: CreateJobParameters, requestOptions?: GetJobParameters): StreamableMethod; +} + +// @public +export interface GetJob200Headers { + "retry-after"?: number; + "x-ms-request-id"?: string; +} + +// @public +export interface GetJob200Response extends HttpResponse { + body: RadiologyInsightsJobOutput; + headers: RawHttpHeaders & GetJob200Headers; + status: "200"; +} + +// @public +export interface GetJobDefaultHeaders { + "x-ms-error-code"?: string; + "x-ms-request-id"?: string; +} + +// @public +export interface GetJobDefaultResponse extends HttpResponse { + body: HealthInsightsErrorResponseOutput; + headers: RawHttpHeaders & GetJobDefaultHeaders; + status: string; +} + +// @public +export type GetJobParameters = GetJobQueryParam & RequestParameters; + +// @public +export interface GetJobQueryParam { + queryParameters?: GetJobQueryParamProperties; +} + +// @public +export interface GetJobQueryParamProperties { + expand?: string; +} + +// @public +export function getLongRunningPoller(client: Client, initialResponse: CreateJob200Response | CreateJob201Response | CreateJobDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; + +// @public +export interface HealthInsightsErrorResponseOutput { + error: ErrorModel; + requestId: { + response: RequestIdResponseHeaderOutput; + }; +} + +// @public +export interface Identifier extends Element { + assigner?: Reference; + period?: Period; + system?: string; + type?: CodeableConcept; + use?: string; + value?: string; +} + +// @public +export interface IdentifierOutput extends ElementOutput { + assigner?: ReferenceOutput; + period?: PeriodOutput; + system?: string; + type?: CodeableConceptOutput; + use?: string; + value?: string; +} + +// @public +export interface ImagingProcedure { + anatomy: CodeableConcept; + contrast?: RadiologyCodeWithTypes; + laterality?: CodeableConcept; + modality: CodeableConcept; + view?: RadiologyCodeWithTypes; +} + +// @public +export interface ImagingProcedureOutput { + anatomy: CodeableConceptOutput; + contrast?: RadiologyCodeWithTypesOutput; + laterality?: CodeableConceptOutput; + modality: CodeableConceptOutput; + view?: RadiologyCodeWithTypesOutput; +} + +// @public +export interface ImagingProcedureRecommendation extends ProcedureRecommendationParent { + imagingProcedures: Array; + kind: "imagingProcedureRecommendation"; + procedureCodes?: Array; +} + +// @public +export interface ImagingProcedureRecommendationOutput extends ProcedureRecommendationOutputParent { + imagingProcedures: Array; + kind: "imagingProcedureRecommendation"; + procedureCodes?: Array; +} + +// @public +export function isUnexpected(response: GetJob200Response | GetJobDefaultResponse): response is GetJobDefaultResponse; + +// @public +export function isUnexpected(response: CreateJob200Response | CreateJob201Response | CreateJobLogicalResponse | CreateJobDefaultResponse): response is CreateJobDefaultResponse; + +// @public +export type JobStatus = string | "notStarted" | "running" | "succeeded" | "failed" | "canceled"; + +// @public +export type JobStatusOutput = string | "notStarted" | "running" | "succeeded" | "failed" | "canceled"; + +// @public +export interface LateralityDiscrepancyInference extends RadiologyInsightsInferenceParent { + discrepancyType: LateralityDiscrepancyType; + kind: "lateralityDiscrepancy"; + lateralityIndication?: CodeableConcept; +} + +// @public +export interface LateralityDiscrepancyInferenceOutput extends RadiologyInsightsInferenceOutputParent { + discrepancyType: LateralityDiscrepancyTypeOutput; + kind: "lateralityDiscrepancy"; + lateralityIndication?: CodeableConceptOutput; +} + +// @public +export type LateralityDiscrepancyType = string | "orderLateralityMismatch" | "textLateralityContradiction" | "textLateralityMissing"; + +// @public +export type LateralityDiscrepancyTypeOutput = string | "orderLateralityMismatch" | "textLateralityContradiction" | "textLateralityMissing"; + +// @public +export interface LimitedOrderDiscrepancyInference extends RadiologyInsightsInferenceParent { + kind: "limitedOrderDiscrepancy"; + orderType: CodeableConcept; + presentBodyPartMeasurements?: Array; + presentBodyParts?: Array; +} + +// @public +export interface LimitedOrderDiscrepancyInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "limitedOrderDiscrepancy"; + orderType: CodeableConceptOutput; + presentBodyPartMeasurements?: Array; + presentBodyParts?: Array; +} + +// @public +export type MedicalProfessionalType = string | "unknown" | "doctor" | "nurse" | "midwife" | "physicianAssistant"; + +// @public +export type MedicalProfessionalTypeOutput = string | "unknown" | "doctor" | "nurse" | "midwife" | "physicianAssistant"; + +// @public +export interface Meta { + lastUpdated?: string; + profile?: string[]; + security?: Array; + source?: string; + tag?: Array; + versionId?: string; +} + +// @public +export interface MetaOutput { + lastUpdated?: string; + profile?: string[]; + security?: Array; + source?: string; + tag?: Array; + versionId?: string; +} + +// @public +export interface Narrative extends Element { + div: string; + status: string; +} + +// @public +export interface NarrativeOutput extends ElementOutput { + div: string; + status: string; +} + +// @public +export interface Observation extends DomainResourceParent { + bodySite?: CodeableConcept; + category?: Array; + code: CodeableConcept; + component?: Array; + dataAbsentReason?: CodeableConcept; + derivedFrom?: Array; + effectiveDateTime?: string; + effectiveInstant?: string; + effectivePeriod?: Period; + encounter?: Reference; + hasMember?: Array; + identifier?: Array; + interpretation?: Array; + issued?: string; + method?: CodeableConcept; + note?: Array; + referenceRange?: Array; + resourceType: "Observation"; + status: ObservationStatusCodeType; + subject?: Reference; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConcept; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: Period; + valueQuantity?: Quantity; + valueRange?: Range; + valueRatio?: Ratio; + valueSampledData?: SampledData; + valueString?: string; + valueTime?: Date | string; +} + +// @public +export interface ObservationComponent extends Element { + code: CodeableConcept; + dataAbsentReason?: CodeableConcept; + interpretation?: Array; + referenceRange?: Array; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConcept; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: Period; + valueQuantity?: Quantity; + valueRange?: Range; + valueRatio?: Ratio; + valueReference?: Reference; + valueSampledData?: SampledData; + valueString?: string; + valueTime?: Date | string; +} + +// @public +export interface ObservationComponentOutput extends ElementOutput { + code: CodeableConceptOutput; + dataAbsentReason?: CodeableConceptOutput; + interpretation?: Array; + referenceRange?: Array; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConceptOutput; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: PeriodOutput; + valueQuantity?: QuantityOutput; + valueRange?: RangeOutput; + valueRatio?: RatioOutput; + valueReference?: ReferenceOutput; + valueSampledData?: SampledDataOutput; + valueString?: string; + valueTime?: string; +} + +// @public +export interface ObservationOutput extends DomainResourceOutputParent { + bodySite?: CodeableConceptOutput; + category?: Array; + code: CodeableConceptOutput; + component?: Array; + dataAbsentReason?: CodeableConceptOutput; + derivedFrom?: Array; + effectiveDateTime?: string; + effectiveInstant?: string; + effectivePeriod?: PeriodOutput; + encounter?: ReferenceOutput; + hasMember?: Array; + identifier?: Array; + interpretation?: Array; + issued?: string; + method?: CodeableConceptOutput; + note?: Array; + referenceRange?: Array; + resourceType: "Observation"; + status: ObservationStatusCodeTypeOutput; + subject?: ReferenceOutput; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConceptOutput; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: PeriodOutput; + valueQuantity?: QuantityOutput; + valueRange?: RangeOutput; + valueRatio?: RatioOutput; + valueSampledData?: SampledDataOutput; + valueString?: string; + valueTime?: string; +} + +// @public +export interface ObservationReferenceRange { + age?: Range; + appliesTo?: Array; + high?: Quantity; + low?: Quantity; + text?: string; + type?: CodeableConcept; +} + +// @public +export interface ObservationReferenceRangeOutput { + age?: RangeOutput; + appliesTo?: Array; + high?: QuantityOutput; + low?: QuantityOutput; + text?: string; + type?: CodeableConceptOutput; +} + +// @public +export type ObservationStatusCodeType = string | "registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"; + +// @public +export type ObservationStatusCodeTypeOutput = string | "registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"; + +// @public +export interface OrderedProcedure { + code?: CodeableConcept; + description?: string; + extension?: Array; +} + +// @public +export interface OrderedProcedureOutput { + code?: CodeableConceptOutput; + description?: string; + extension?: Array; +} + +// @public +export interface PatientDetails { + birthDate?: Date | string; + clinicalInfo?: Array; + sex?: PatientSex; +} + +// @public +export interface PatientDetailsOutput { + birthDate?: string; + clinicalInfo?: Array; + sex?: PatientSexOutput; +} + +// @public +export interface PatientDocument { + administrativeMetadata?: DocumentAdministrativeMetadata; + authors?: Array; + clinicalType?: ClinicalDocumentType; + content: DocumentContent; + createdAt?: Date | string; + id: string; + language?: string; + specialtyType?: SpecialtyType; + type: DocumentType; +} + +// @public +export interface PatientDocumentOutput { + administrativeMetadata?: DocumentAdministrativeMetadataOutput; + authors?: Array; + clinicalType?: ClinicalDocumentTypeOutput; + content: DocumentContentOutput; + createdAt?: string; + id: string; + language?: string; + specialtyType?: SpecialtyTypeOutput; + type: DocumentTypeOutput; +} + +// @public +export interface PatientEncounter { + class?: EncounterClass; + id: string; + period?: TimePeriod; +} + +// @public +export interface PatientEncounterOutput { + class?: EncounterClassOutput; + id: string; + period?: TimePeriodOutput; +} + +// @public +export interface PatientRecord { + details?: PatientDetails; + encounters?: Array; + id: string; + patientDocuments?: Array; +} + +// @public +export interface PatientRecordOutput { + details?: PatientDetailsOutput; + encounters?: Array; + id: string; + patientDocuments?: Array; +} + +// @public +export type PatientSex = string | "female" | "male" | "unspecified"; + +// @public +export type PatientSexOutput = string | "female" | "male" | "unspecified"; + +// @public +export interface Period extends Element { + end?: string; + start?: string; +} + +// @public +export interface PeriodOutput extends ElementOutput { + end?: string; + start?: string; +} + +// @public +export type ProcedureRecommendation = ProcedureRecommendationParent | GenericProcedureRecommendation | ImagingProcedureRecommendation; + +// @public +export type ProcedureRecommendationOutput = ProcedureRecommendationOutputParent | GenericProcedureRecommendationOutput | ImagingProcedureRecommendationOutput; + +// @public +export interface ProcedureRecommendationOutputParent { + extension?: Array; + kind: string; +} + +// @public +export interface ProcedureRecommendationParent { + extension?: Array; + kind: string; +} + +// @public +export interface Quantity extends Element { + code?: string; + comparator?: string; + system?: string; + unit?: string; + value?: number; +} + +// @public +export interface QuantityOutput extends ElementOutput { + code?: string; + comparator?: string; + system?: string; + unit?: string; + value?: number; +} + +// @public +export interface RadiologyCodeWithTypes { + code: CodeableConcept; + types: Array; +} + +// @public +export interface RadiologyCodeWithTypesOutput { + code: CodeableConceptOutput; + types: Array; +} + +// @public +export interface RadiologyInsightsData { + configuration?: RadiologyInsightsModelConfiguration; + patients: Array; +} + +// @public +export interface RadiologyInsightsDataOutput { + configuration?: RadiologyInsightsModelConfigurationOutput; + patients: Array; +} + +// @public +export type RadiologyInsightsInference = RadiologyInsightsInferenceParent | AgeMismatchInference | SexMismatchInference | LateralityDiscrepancyInference | CompleteOrderDiscrepancyInference | LimitedOrderDiscrepancyInference | FindingInference | CriticalResultInference | RadiologyProcedureInference | FollowupRecommendationInference | FollowupCommunicationInference; + +// @public +export interface RadiologyInsightsInferenceOptions { + findingOptions?: FindingOptions; + followupRecommendationOptions?: FollowupRecommendationOptions; +} + +// @public +export interface RadiologyInsightsInferenceOptionsOutput { + findingOptions?: FindingOptionsOutput; + followupRecommendationOptions?: FollowupRecommendationOptionsOutput; +} + +// @public +export type RadiologyInsightsInferenceOutput = RadiologyInsightsInferenceOutputParent | AgeMismatchInferenceOutput | SexMismatchInferenceOutput | LateralityDiscrepancyInferenceOutput | CompleteOrderDiscrepancyInferenceOutput | LimitedOrderDiscrepancyInferenceOutput | FindingInferenceOutput | CriticalResultInferenceOutput | RadiologyProcedureInferenceOutput | FollowupRecommendationInferenceOutput | FollowupCommunicationInferenceOutput; + +// @public +export interface RadiologyInsightsInferenceOutputParent { + extension?: Array; + kind: string; +} + +// @public +export interface RadiologyInsightsInferenceParent { + extension?: Array; + kind: string; +} + +// @public +export interface RadiologyInsightsInferenceResult { + modelVersion: string; + patientResults: Array; +} + +// @public +export interface RadiologyInsightsInferenceResultOutput { + modelVersion: string; + patientResults: Array; +} + +// @public +export type RadiologyInsightsInferenceType = string | "ageMismatch" | "lateralityDiscrepancy" | "sexMismatch" | "completeOrderDiscrepancy" | "limitedOrderDiscrepancy" | "finding" | "criticalResult" | "followupRecommendation" | "followupCommunication" | "radiologyProcedure"; + +// @public +export type RadiologyInsightsInferenceTypeOutput = string | "ageMismatch" | "lateralityDiscrepancy" | "sexMismatch" | "completeOrderDiscrepancy" | "limitedOrderDiscrepancy" | "finding" | "criticalResult" | "followupRecommendation" | "followupCommunication" | "radiologyProcedure"; + +// @public +export interface RadiologyInsightsJob { + jobData?: RadiologyInsightsData; +} + +// @public +export interface RadiologyInsightsJobOutput { + readonly createdAt?: string; + readonly error?: ErrorModel; + readonly expiresAt?: string; + readonly id: string; + jobData?: RadiologyInsightsDataOutput; + readonly result?: RadiologyInsightsInferenceResultOutput; + readonly status: JobStatusOutput; + readonly updatedAt?: string; +} + +// @public +export interface RadiologyInsightsModelConfiguration { + includeEvidence?: boolean; + inferenceOptions?: RadiologyInsightsInferenceOptions; + inferenceTypes?: RadiologyInsightsInferenceType[]; + locale?: string; + verbose?: boolean; +} + +// @public +export interface RadiologyInsightsModelConfigurationOutput { + includeEvidence?: boolean; + inferenceOptions?: RadiologyInsightsInferenceOptionsOutput; + inferenceTypes?: RadiologyInsightsInferenceTypeOutput[]; + locale?: string; + verbose?: boolean; +} + +// @public +export interface RadiologyInsightsPatientResult { + inferences: Array; + patientId: string; +} + +// @public +export interface RadiologyInsightsPatientResultOutput { + inferences: Array; + patientId: string; +} + +// @public +export interface RadiologyProcedureInference extends RadiologyInsightsInferenceParent { + imagingProcedures: Array; + kind: "radiologyProcedure"; + orderedProcedure: OrderedProcedure; + procedureCodes?: Array; +} + +// @public +export interface RadiologyProcedureInferenceOutput extends RadiologyInsightsInferenceOutputParent { + imagingProcedures: Array; + kind: "radiologyProcedure"; + orderedProcedure: OrderedProcedureOutput; + procedureCodes?: Array; +} + +// @public +export interface Range extends Element { + high?: Quantity; + low?: Quantity; +} + +// @public +export interface RangeOutput extends ElementOutput { + high?: QuantityOutput; + low?: QuantityOutput; +} + +// @public +export interface Ratio extends Element { + denominator?: Quantity; + numerator?: Quantity; +} + +// @public +export interface RatioOutput extends ElementOutput { + denominator?: QuantityOutput; + numerator?: QuantityOutput; +} + +// @public +export interface RecommendationFinding { + criticalFinding?: CriticalResult; + extension?: Array; + finding?: Observation; + recommendationFindingStatus: RecommendationFindingStatusType; +} + +// @public +export interface RecommendationFindingOutput { + criticalFinding?: CriticalResultOutput; + extension?: Array; + finding?: ObservationOutput; + recommendationFindingStatus: RecommendationFindingStatusTypeOutput; +} + +// @public +export type RecommendationFindingStatusType = string | "present" | "differential" | "ruleOut" | "conditional"; + +// @public +export type RecommendationFindingStatusTypeOutput = string | "present" | "differential" | "ruleOut" | "conditional"; + +// @public +export interface Reference extends Element { + display?: string; + identifier?: Identifier; + reference?: string; + type?: string; +} + +// @public +export interface ReferenceOutput extends ElementOutput { + display?: string; + identifier?: IdentifierOutput; + reference?: string; + type?: string; +} + +// @public +export interface RequestIdResponseHeaderOutput { +} + +// @public +export interface ResearchStudy extends DomainResourceParent { + arm?: { + name: string; + type?: CodeableConcept; + description?: string; + }[]; + category?: Array; + condition?: Array; + contact?: Array; + description?: string; + enrollment?: Array; + focus?: Array; + identifier?: Array; + keyword?: Array; + location?: Array; + note?: Array; + objective?: { + name: string; + type?: CodeableConcept; + }[]; + partOf?: Array; + period?: Period; + phase?: CodeableConcept; + primaryPurposeType?: CodeableConcept; + principalInvestigator?: Reference; + protocol?: Array; + reasonStopped?: CodeableConcept; + resourceType: "ResearchStudy"; + site?: Array; + sponsor?: Reference; + status: ResearchStudyStatusCodeType; + title?: string; +} + +// @public +export interface ResearchStudyOutput extends DomainResourceOutputParent { + arm?: { + name: string; + type?: CodeableConceptOutput; + description?: string; + }[]; + category?: Array; + condition?: Array; + contact?: Array; + description?: string; + enrollment?: Array; + focus?: Array; + identifier?: Array; + keyword?: Array; + location?: Array; + note?: Array; + objective?: { + name: string; + type?: CodeableConceptOutput; + }[]; + partOf?: Array; + period?: PeriodOutput; + phase?: CodeableConceptOutput; + primaryPurposeType?: CodeableConceptOutput; + principalInvestigator?: ReferenceOutput; + protocol?: Array; + reasonStopped?: CodeableConceptOutput; + resourceType: "ResearchStudy"; + site?: Array; + sponsor?: ReferenceOutput; + status: ResearchStudyStatusCodeTypeOutput; + title?: string; +} + +// @public +export type ResearchStudyStatusCodeType = string | "active" | "administratively-completed" | "approved" | "closed-to-accrual" | "closed-to-accrual-and-intervention" | "completed" | "disapproved" | "in-review" | "temporarily-closed-to-accrual" | "temporarily-closed-to-accrual-and-intervention" | "withdrawn"; + +// @public +export type ResearchStudyStatusCodeTypeOutput = string | "active" | "administratively-completed" | "approved" | "closed-to-accrual" | "closed-to-accrual-and-intervention" | "completed" | "disapproved" | "in-review" | "temporarily-closed-to-accrual" | "temporarily-closed-to-accrual-and-intervention" | "withdrawn"; + +// @public +export interface Resource extends Record { + id?: string; + implicitRules?: string; + language?: string; + meta?: Meta; + resourceType: string; +} + +// @public +export interface ResourceOutput extends Record { + id?: string; + implicitRules?: string; + language?: string; + meta?: MetaOutput; + resourceType: string; +} + +// @public +export interface Routes { + (path: "/radiology-insights/jobs/{id}", id: string): GetJob; +} + +// @public +export interface SampledData extends Element { + data?: string; + dimensions: number; + factor?: number; + lowerLimit?: number; + origin: Quantity; + period: number; + upperLimit?: number; +} + +// @public +export interface SampledDataOutput extends ElementOutput { + data?: string; + dimensions: number; + factor?: number; + lowerLimit?: number; + origin: QuantityOutput; + period: number; + upperLimit?: number; +} + +// @public +export interface SexMismatchInference extends RadiologyInsightsInferenceParent { + kind: "sexMismatch"; + sexIndication: CodeableConcept; +} + +// @public +export interface SexMismatchInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "sexMismatch"; + sexIndication: CodeableConceptOutput; +} + +// @public +export type SpecialtyType = string | "pathology" | "radiology"; + +// @public +export type SpecialtyTypeOutput = string | "pathology" | "radiology"; + +// @public +export interface TimePeriod { + end?: Date | string; + start?: Date | string; +} + +// @public +export interface TimePeriodOutput { + end?: string; + start?: string; +} + +// (No @packageDocumentation comment for this package) diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/current/review/index.ts b/sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/current/review/index.ts new file mode 100644 index 000000000000..727ea5f640bd --- /dev/null +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/current/review/index.ts @@ -0,0 +1,1524 @@ + +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { CancelOnProgress } from '@azure/core-lro'; +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { CreateHttpPollerOptions } from '@azure/core-lro'; +import type { ErrorModel } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { KeyCredential } from '@azure/core-auth'; +import type { OperationState } from '@azure/core-lro'; +import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; +import type { TokenCredential } from '@azure/core-auth'; + +// @public +export interface AgeMismatchInference extends RadiologyInsightsInferenceParent { + kind: "ageMismatch"; +} + +// @public +export interface AgeMismatchInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "ageMismatch"; +} + +// @public +export interface Annotation extends Element_2 { + authorString?: string; + text: string; + time?: string; +} + +// @public +export interface AnnotationOutput extends ElementOutput { + authorString?: string; + text: string; + time?: string; +} + +// @public +export interface AssessmentValueRange { + maximum: string; + minimum: string; +} + +// @public +export interface AssessmentValueRangeOutput { + maximum: string; + minimum: string; +} + +// @public (undocumented) +export type AzureHealthInsightsClient = Client & { + path: Routes; +}; + +// @public +export interface AzureHealthInsightsClientOptions extends ClientOptions { + apiVersion?: string; +} + +// @public +export type ClinicalDocumentType = string; + +// @public +export type ClinicalDocumentTypeOutput = string; + +// @public +export interface CodeableConcept extends Element_2 { + coding?: Array; + text?: string; +} + +// @public +export interface CodeableConceptOutput extends ElementOutput { + coding?: Array; + text?: string; +} + +// @public +export interface Coding extends Element_2 { + code?: string; + display?: string; + system?: string; + version?: string; +} + +// @public +export interface CodingOutput extends ElementOutput { + code?: string; + display?: string; + system?: string; + version?: string; +} + +// @public +export interface CompleteOrderDiscrepancyInference extends RadiologyInsightsInferenceParent { + kind: "completeOrderDiscrepancy"; + missingBodyPartMeasurements?: Array; + missingBodyParts?: Array; + orderType: CodeableConcept; +} + +// @public +export interface CompleteOrderDiscrepancyInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "completeOrderDiscrepancy"; + missingBodyPartMeasurements?: Array; + missingBodyParts?: Array; + orderType: CodeableConceptOutput; +} + +// @public +export interface Condition extends DomainResourceParent { + abatementAge?: Quantity; + abatementDateTime?: string; + abatementPeriod?: Period; + abatementRange?: Range_2; + abatementString?: string; + bodySite?: Array; + category?: Array; + clinicalStatus?: CodeableConcept; + code?: CodeableConcept; + encounter?: Reference; + identifier?: Array; + note?: Array; + onsetAge?: Quantity; + onsetDateTime?: string; + onsetPeriod?: Period; + onsetRange?: Range_2; + onsetString?: string; + recordedDate?: string; + resourceType: "Condition"; + severity?: CodeableConcept; + stage?: Array; + verificationStatus?: CodeableConcept; +} + +// @public +export interface ConditionOutput extends DomainResourceOutputParent { + abatementAge?: QuantityOutput; + abatementDateTime?: string; + abatementPeriod?: PeriodOutput; + abatementRange?: RangeOutput; + abatementString?: string; + bodySite?: Array; + category?: Array; + clinicalStatus?: CodeableConceptOutput; + code?: CodeableConceptOutput; + encounter?: ReferenceOutput; + identifier?: Array; + note?: Array; + onsetAge?: QuantityOutput; + onsetDateTime?: string; + onsetPeriod?: PeriodOutput; + onsetRange?: RangeOutput; + onsetString?: string; + recordedDate?: string; + resourceType: "Condition"; + severity?: CodeableConceptOutput; + stage?: Array; + verificationStatus?: CodeableConceptOutput; +} + +// @public +export interface ConditionStage { + summary?: CodeableConcept; + type?: CodeableConcept; +} + +// @public +export interface ConditionStageOutput { + summary?: CodeableConceptOutput; + type?: CodeableConceptOutput; +} + +// @public +export interface ContactDetail extends Element_2 { + name?: string; + telecom?: Array; +} + +// @public +export interface ContactDetailOutput extends ElementOutput { + name?: string; + telecom?: Array; +} + +// @public +export interface ContactPoint { + period?: Period; + rank?: number; + system?: ContactPointSystem; + use?: ContactPointUse; + value?: string; +} + +// @public +export interface ContactPointOutput { + period?: PeriodOutput; + rank?: number; + system?: ContactPointSystemOutput; + use?: ContactPointUseOutput; + value?: string; +} + +// @public +export type ContactPointSystem = string; + +// @public +export type ContactPointSystemOutput = string; + +// @public +export type ContactPointUse = string; + +// @public +export type ContactPointUseOutput = string; + +// @public +function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, { apiVersion, ...options }?: AzureHealthInsightsClientOptions): AzureHealthInsightsClient; +export default createClient; + +// @public (undocumented) +export interface CreateJob200Headers { + "operation-location": string; + "x-ms-request-id"?: string; +} + +// @public +export interface CreateJob200Response extends HttpResponse { + // (undocumented) + body: RadiologyInsightsJobOutput; + // (undocumented) + headers: RawHttpHeaders & CreateJob200Headers; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface CreateJob201Headers { + "operation-location": string; + "x-ms-request-id"?: string; +} + +// @public +export interface CreateJob201Response extends HttpResponse { + // (undocumented) + body: RadiologyInsightsJobOutput; + // (undocumented) + headers: RawHttpHeaders & CreateJob201Headers; + // (undocumented) + status: "201"; +} + +// @public (undocumented) +export interface CreateJobBodyParam { + body: RadiologyInsightsJob; +} + +// @public (undocumented) +export interface CreateJobDefaultHeaders { + "x-ms-error-code"?: string; + "x-ms-request-id"?: string; +} + +// @public (undocumented) +export interface CreateJobDefaultResponse extends HttpResponse { + // (undocumented) + body: HealthInsightsErrorResponseOutput; + // (undocumented) + headers: RawHttpHeaders & CreateJobDefaultHeaders; + // (undocumented) + status: string; +} + +// @public +export interface CreateJobExpandQueryParam { + explode: true; + style: "form"; + value: string[]; +} + +// @public +export interface CreateJobLogicalResponse extends HttpResponse { + // (undocumented) + body: RadiologyInsightsJobOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export type CreateJobParameters = CreateJobQueryParam & CreateJobBodyParam & RequestParameters; + +// @public (undocumented) +export interface CreateJobQueryParam { + // (undocumented) + queryParameters?: CreateJobQueryParamProperties; +} + +// @public (undocumented) +export interface CreateJobQueryParamProperties { + expand?: CreateJobExpandQueryParam; +} + +// @public +export interface CriticalResult { + description: string; + finding?: Observation; +} + +// @public +export interface CriticalResultInference extends RadiologyInsightsInferenceParent { + kind: "criticalResult"; + result: CriticalResult; +} + +// @public +export interface CriticalResultInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "criticalResult"; + result: CriticalResultOutput; +} + +// @public +export interface CriticalResultOutput { + description: string; + finding?: ObservationOutput; +} + +// @public +export interface DocumentAdministrativeMetadata { + encounterId?: string; + orderedProcedures?: Array; +} + +// @public +export interface DocumentAdministrativeMetadataOutput { + encounterId?: string; + orderedProcedures?: Array; +} + +// @public +export interface DocumentAuthor { + fullName?: string; + id?: string; +} + +// @public +export interface DocumentAuthorOutput { + fullName?: string; + id?: string; +} + +// @public +export interface DocumentContent { + sourceType: DocumentContentSourceType; + value: string; +} + +// @public +export interface DocumentContentOutput { + sourceType: DocumentContentSourceTypeOutput; + value: string; +} + +// @public +export type DocumentContentSourceType = string; + +// @public +export type DocumentContentSourceTypeOutput = string; + +// @public +type DocumentType_2 = string; +export { DocumentType_2 as DocumentType } + +// @public +export type DocumentTypeOutput = string; + +// @public +export type DomainResource = DomainResourceParent | Observation | Condition | ResearchStudy; + +// @public +export type DomainResourceOutput = DomainResourceOutputParent | ObservationOutput | ConditionOutput | ResearchStudyOutput; + +// @public +export interface DomainResourceOutputParent extends ResourceOutput { + contained?: Array; + extension?: Array; + modifierExtension?: Array; + // (undocumented) + resourceType: string; + text?: NarrativeOutput; +} + +// @public +export interface DomainResourceParent extends Resource { + contained?: Array; + extension?: Array; + modifierExtension?: Array; + // (undocumented) + resourceType: string; + text?: Narrative; +} + +// @public +interface Element_2 { + extension?: Array; + id?: string; +} +export { Element_2 as Element } + +// @public +export interface ElementOutput { + extension?: Array; + id?: string; +} + +// @public +export type EncounterClass = string; + +// @public +export type EncounterClassOutput = string; + +// @public +export interface Extension extends Element_2 { + url: string; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConcept; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: Period; + valueQuantity?: Quantity; + valueRange?: Range_2; + valueRatio?: Ratio; + valueReference?: Reference; + valueSampledData?: SampledData; + valueString?: string; + valueTime?: string; +} + +// @public +export interface ExtensionOutput extends ElementOutput { + url: string; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConceptOutput; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: PeriodOutput; + valueQuantity?: QuantityOutput; + valueRange?: RangeOutput; + valueRatio?: RatioOutput; + valueReference?: ReferenceOutput; + valueSampledData?: SampledDataOutput; + valueString?: string; + valueTime?: string; +} + +// @public +export interface FindingInference extends RadiologyInsightsInferenceParent { + finding: Observation; + kind: "finding"; +} + +// @public +export interface FindingInferenceOutput extends RadiologyInsightsInferenceOutputParent { + finding: ObservationOutput; + kind: "finding"; +} + +// @public +export interface FindingOptions { + provideFocusedSentenceEvidence?: boolean; +} + +// @public +export interface FindingOptionsOutput { + provideFocusedSentenceEvidence?: boolean; +} + +// @public +export interface FollowupCommunicationInference extends RadiologyInsightsInferenceParent { + communicatedAt?: Date[] | string[]; + kind: "followupCommunication"; + recipient?: MedicalProfessionalType[]; + wasAcknowledged: boolean; +} + +// @public +export interface FollowupCommunicationInferenceOutput extends RadiologyInsightsInferenceOutputParent { + communicatedAt?: string[]; + kind: "followupCommunication"; + recipient?: MedicalProfessionalTypeOutput[]; + wasAcknowledged: boolean; +} + +// @public +export interface FollowupRecommendationInference extends RadiologyInsightsInferenceParent { + effectiveAt?: string; + effectivePeriod?: Period; + findings?: Array; + isConditional: boolean; + isGuideline: boolean; + isHedging: boolean; + isOption: boolean; + kind: "followupRecommendation"; + recommendedProcedure: ProcedureRecommendation; +} + +// @public +export interface FollowupRecommendationInferenceOutput extends RadiologyInsightsInferenceOutputParent { + effectiveAt?: string; + effectivePeriod?: PeriodOutput; + findings?: Array; + isConditional: boolean; + isGuideline: boolean; + isHedging: boolean; + isOption: boolean; + kind: "followupRecommendation"; + recommendedProcedure: ProcedureRecommendationOutput; +} + +// @public +export interface FollowupRecommendationOptions { + includeRecommendationsInReferences?: boolean; + includeRecommendationsWithNoSpecifiedModality?: boolean; + provideFocusedSentenceEvidence?: boolean; +} + +// @public +export interface FollowupRecommendationOptionsOutput { + includeRecommendationsInReferences?: boolean; + includeRecommendationsWithNoSpecifiedModality?: boolean; + provideFocusedSentenceEvidence?: boolean; +} + +// @public +export interface GenericProcedureRecommendation extends ProcedureRecommendationParent { + code: CodeableConcept; + description?: string; + kind: "genericProcedureRecommendation"; +} + +// @public +export interface GenericProcedureRecommendationOutput extends ProcedureRecommendationOutputParent { + code: CodeableConceptOutput; + description?: string; + kind: "genericProcedureRecommendation"; +} + +// @public (undocumented) +export interface GetJob { + get(options?: GetJobParameters): StreamableMethod; + put(options: CreateJobParameters): StreamableMethod; +} + +// @public (undocumented) +export interface GetJob200Headers { + "retry-after"?: number; + "x-ms-request-id"?: string; +} + +// @public +export interface GetJob200Response extends HttpResponse { + // (undocumented) + body: RadiologyInsightsJobOutput; + // (undocumented) + headers: RawHttpHeaders & GetJob200Headers; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface GetJobDefaultHeaders { + "x-ms-error-code"?: string; + "x-ms-request-id"?: string; +} + +// @public (undocumented) +export interface GetJobDefaultResponse extends HttpResponse { + // (undocumented) + body: HealthInsightsErrorResponseOutput; + // (undocumented) + headers: RawHttpHeaders & GetJobDefaultHeaders; + // (undocumented) + status: string; +} + +// @public +export interface GetJobExpandQueryParam { + explode: true; + style: "form"; + value: string[]; +} + +// @public (undocumented) +export type GetJobParameters = GetJobQueryParam & RequestParameters; + +// @public (undocumented) +export interface GetJobQueryParam { + // (undocumented) + queryParameters?: GetJobQueryParamProperties; +} + +// @public (undocumented) +export interface GetJobQueryParamProperties { + expand?: GetJobExpandQueryParam; +} + +// @public +export function getLongRunningPoller(client: Client, initialResponse: CreateJob200Response | CreateJob201Response | CreateJobDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; + +// @public +export interface GuidanceInference extends RadiologyInsightsInferenceParent { + finding: FindingInference; + identifier: CodeableConcept; + kind: "guidance"; + missingGuidanceInformation?: string[]; + presentGuidanceInformation?: Array; + ranking: GuidanceRankingType; + recommendationProposals?: Array; +} + +// @public +export interface GuidanceInferenceOutput extends RadiologyInsightsInferenceOutputParent { + finding: FindingInferenceOutput; + identifier: CodeableConceptOutput; + kind: "guidance"; + missingGuidanceInformation?: string[]; + presentGuidanceInformation?: Array; + ranking: GuidanceRankingTypeOutput; + recommendationProposals?: Array; +} + +// @public +export interface GuidanceOptions { + showGuidanceInHistory: boolean; +} + +// @public +export interface GuidanceOptionsOutput { + showGuidanceInHistory: boolean; +} + +// @public +export type GuidanceRankingType = string; + +// @public +export type GuidanceRankingTypeOutput = string; + +// @public +export interface HealthInsightsErrorResponseOutput { + error: ErrorModel; +} + +// @public +export interface Identifier extends Element_2 { + assigner?: Reference; + period?: Period; + system?: string; + type?: CodeableConcept; + use?: string; + value?: string; +} + +// @public +export interface IdentifierOutput extends ElementOutput { + assigner?: ReferenceOutput; + period?: PeriodOutput; + system?: string; + type?: CodeableConceptOutput; + use?: string; + value?: string; +} + +// @public +export interface ImagingProcedure { + anatomy: CodeableConcept; + contrast?: RadiologyCodeWithTypes; + laterality?: CodeableConcept; + modality: CodeableConcept; + view?: RadiologyCodeWithTypes; +} + +// @public +export interface ImagingProcedureOutput { + anatomy: CodeableConceptOutput; + contrast?: RadiologyCodeWithTypesOutput; + laterality?: CodeableConceptOutput; + modality: CodeableConceptOutput; + view?: RadiologyCodeWithTypesOutput; +} + +// @public +export interface ImagingProcedureRecommendation extends ProcedureRecommendationParent { + imagingProcedures: Array; + kind: "imagingProcedureRecommendation"; + procedureCodes?: Array; +} + +// @public +export interface ImagingProcedureRecommendationOutput extends ProcedureRecommendationOutputParent { + imagingProcedures: Array; + kind: "imagingProcedureRecommendation"; + procedureCodes?: Array; +} + +// @public (undocumented) +export function isUnexpected(response: GetJob200Response | GetJobDefaultResponse): response is GetJobDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: CreateJob200Response | CreateJob201Response | CreateJobLogicalResponse | CreateJobDefaultResponse): response is CreateJobDefaultResponse; + +// @public +export type JobStatus = string; + +// @public +export type JobStatusOutput = string; + +// @public +export interface LateralityDiscrepancyInference extends RadiologyInsightsInferenceParent { + discrepancyType: LateralityDiscrepancyType; + kind: "lateralityDiscrepancy"; + lateralityIndication?: CodeableConcept; +} + +// @public +export interface LateralityDiscrepancyInferenceOutput extends RadiologyInsightsInferenceOutputParent { + discrepancyType: LateralityDiscrepancyTypeOutput; + kind: "lateralityDiscrepancy"; + lateralityIndication?: CodeableConceptOutput; +} + +// @public +export type LateralityDiscrepancyType = string; + +// @public +export type LateralityDiscrepancyTypeOutput = string; + +// @public +export interface LimitedOrderDiscrepancyInference extends RadiologyInsightsInferenceParent { + kind: "limitedOrderDiscrepancy"; + orderType: CodeableConcept; + presentBodyPartMeasurements?: Array; + presentBodyParts?: Array; +} + +// @public +export interface LimitedOrderDiscrepancyInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "limitedOrderDiscrepancy"; + orderType: CodeableConceptOutput; + presentBodyPartMeasurements?: Array; + presentBodyParts?: Array; +} + +// @public +export type MedicalProfessionalType = string; + +// @public +export type MedicalProfessionalTypeOutput = string; + +// @public +export interface Meta { + lastUpdated?: string; + profile?: string[]; + security?: Array; + source?: string; + tag?: Array; + versionId?: string; +} + +// @public +export interface MetaOutput { + lastUpdated?: string; + profile?: string[]; + security?: Array; + source?: string; + tag?: Array; + versionId?: string; +} + +// @public +export interface Narrative extends Element_2 { + div: string; + status: string; +} + +// @public +export interface NarrativeOutput extends ElementOutput { + div: string; + status: string; +} + +// @public +export interface Observation extends DomainResourceParent { + bodySite?: CodeableConcept; + category?: Array; + code: CodeableConcept; + component?: Array; + dataAbsentReason?: CodeableConcept; + derivedFrom?: Array; + effectiveDateTime?: string; + effectiveInstant?: string; + effectivePeriod?: Period; + encounter?: Reference; + hasMember?: Array; + identifier?: Array; + interpretation?: Array; + issued?: string; + method?: CodeableConcept; + note?: Array; + referenceRange?: Array; + resourceType: "Observation"; + status: ObservationStatusCodeType; + subject?: Reference; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConcept; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: Period; + valueQuantity?: Quantity; + valueRange?: Range_2; + valueRatio?: Ratio; + valueSampledData?: SampledData; + valueString?: string; + valueTime?: string; +} + +// @public +export interface ObservationComponent extends Element_2 { + code: CodeableConcept; + dataAbsentReason?: CodeableConcept; + interpretation?: Array; + referenceRange?: Array; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConcept; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: Period; + valueQuantity?: Quantity; + valueRange?: Range_2; + valueRatio?: Ratio; + valueReference?: Reference; + valueSampledData?: SampledData; + valueString?: string; + valueTime?: string; +} + +// @public +export interface ObservationComponentOutput extends ElementOutput { + code: CodeableConceptOutput; + dataAbsentReason?: CodeableConceptOutput; + interpretation?: Array; + referenceRange?: Array; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConceptOutput; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: PeriodOutput; + valueQuantity?: QuantityOutput; + valueRange?: RangeOutput; + valueRatio?: RatioOutput; + valueReference?: ReferenceOutput; + valueSampledData?: SampledDataOutput; + valueString?: string; + valueTime?: string; +} + +// @public +export interface ObservationOutput extends DomainResourceOutputParent { + bodySite?: CodeableConceptOutput; + category?: Array; + code: CodeableConceptOutput; + component?: Array; + dataAbsentReason?: CodeableConceptOutput; + derivedFrom?: Array; + effectiveDateTime?: string; + effectiveInstant?: string; + effectivePeriod?: PeriodOutput; + encounter?: ReferenceOutput; + hasMember?: Array; + identifier?: Array; + interpretation?: Array; + issued?: string; + method?: CodeableConceptOutput; + note?: Array; + referenceRange?: Array; + resourceType: "Observation"; + status: ObservationStatusCodeTypeOutput; + subject?: ReferenceOutput; + valueBoolean?: boolean; + valueCodeableConcept?: CodeableConceptOutput; + valueDateTime?: string; + valueInteger?: number; + valuePeriod?: PeriodOutput; + valueQuantity?: QuantityOutput; + valueRange?: RangeOutput; + valueRatio?: RatioOutput; + valueSampledData?: SampledDataOutput; + valueString?: string; + valueTime?: string; +} + +// @public +export interface ObservationReferenceRange { + age?: Range_2; + appliesTo?: Array; + high?: Quantity; + low?: Quantity; + text?: string; + type?: CodeableConcept; +} + +// @public +export interface ObservationReferenceRangeOutput { + age?: RangeOutput; + appliesTo?: Array; + high?: QuantityOutput; + low?: QuantityOutput; + text?: string; + type?: CodeableConceptOutput; +} + +// @public +export type ObservationStatusCodeType = string; + +// @public +export type ObservationStatusCodeTypeOutput = string; + +// @public +export interface OrderedProcedure { + code?: CodeableConcept; + description?: string; + extension?: Array; +} + +// @public +export interface OrderedProcedureOutput { + code?: CodeableConceptOutput; + description?: string; + extension?: Array; +} + +// @public +export interface PatientDetails { + birthDate?: string; + clinicalInfo?: Array; + sex?: PatientSex; +} + +// @public +export interface PatientDetailsOutput { + birthDate?: string; + clinicalInfo?: Array; + sex?: PatientSexOutput; +} + +// @public +export interface PatientDocument { + administrativeMetadata?: DocumentAdministrativeMetadata; + authors?: Array; + clinicalType?: ClinicalDocumentType; + content: DocumentContent; + createdAt?: Date | string; + id: string; + language?: string; + specialtyType?: SpecialtyType; + type: DocumentType_2; +} + +// @public +export interface PatientDocumentOutput { + administrativeMetadata?: DocumentAdministrativeMetadataOutput; + authors?: Array; + clinicalType?: ClinicalDocumentTypeOutput; + content: DocumentContentOutput; + createdAt?: string; + id: string; + language?: string; + specialtyType?: SpecialtyTypeOutput; + type: DocumentTypeOutput; +} + +// @public +export interface PatientEncounter { + class?: EncounterClass; + id: string; + period?: TimePeriod; +} + +// @public +export interface PatientEncounterOutput { + class?: EncounterClassOutput; + id: string; + period?: TimePeriodOutput; +} + +// @public +export interface PatientRecord { + details?: PatientDetails; + encounters?: Array; + id: string; + patientDocuments?: Array; +} + +// @public +export interface PatientRecordOutput { + details?: PatientDetailsOutput; + encounters?: Array; + id: string; + patientDocuments?: Array; +} + +// @public +export type PatientSex = string; + +// @public +export type PatientSexOutput = string; + +// @public +export interface Period extends Element_2 { + end?: string; + start?: string; +} + +// @public +export interface PeriodOutput extends ElementOutput { + end?: string; + start?: string; +} + +// @public +export interface PresentGuidanceInformation { + extension?: Array; + maximumDiameterAsInText?: Quantity; + presentGuidanceItem: string; + presentGuidanceValues?: string[]; + sizes?: Array; +} + +// @public +export interface PresentGuidanceInformationOutput { + extension?: Array; + maximumDiameterAsInText?: QuantityOutput; + presentGuidanceItem: string; + presentGuidanceValues?: string[]; + sizes?: Array; +} + +// @public +export type ProcedureRecommendation = ProcedureRecommendationParent | GenericProcedureRecommendation | ImagingProcedureRecommendation; + +// @public +export type ProcedureRecommendationOutput = ProcedureRecommendationOutputParent | GenericProcedureRecommendationOutput | ImagingProcedureRecommendationOutput; + +// @public +export interface ProcedureRecommendationOutputParent { + extension?: Array; + // (undocumented) + kind: string; +} + +// @public +export interface ProcedureRecommendationParent { + extension?: Array; + // (undocumented) + kind: string; +} + +// @public +export type QualityMeasureComplianceType = string; + +// @public +export type QualityMeasureComplianceTypeOutput = string; + +// @public +export interface QualityMeasureInference extends RadiologyInsightsInferenceParent { + complianceType: QualityMeasureComplianceType; + kind: "qualityMeasure"; + qualityCriteria?: string[]; + qualityMeasureDenominator: string; +} + +// @public +export interface QualityMeasureInferenceOutput extends RadiologyInsightsInferenceOutputParent { + complianceType: QualityMeasureComplianceTypeOutput; + kind: "qualityMeasure"; + qualityCriteria?: string[]; + qualityMeasureDenominator: string; +} + +// @public +export interface QualityMeasureOptions { + measureTypes: QualityMeasureType[]; +} + +// @public +export interface QualityMeasureOptionsOutput { + measureTypes: QualityMeasureTypeOutput[]; +} + +// @public +export type QualityMeasureType = string; + +// @public +export type QualityMeasureTypeOutput = string; + +// @public +export interface Quantity extends Element_2 { + code?: string; + comparator?: string; + system?: string; + unit?: string; + value?: number; +} + +// @public +export interface QuantityOutput extends ElementOutput { + code?: string; + comparator?: string; + system?: string; + unit?: string; + value?: number; +} + +// @public +export interface RadiologyCodeWithTypes { + code: CodeableConcept; + types: Array; +} + +// @public +export interface RadiologyCodeWithTypesOutput { + code: CodeableConceptOutput; + types: Array; +} + +// @public +export interface RadiologyInsightsData { + configuration?: RadiologyInsightsModelConfiguration; + patients: Array; +} + +// @public +export interface RadiologyInsightsDataOutput { + configuration?: RadiologyInsightsModelConfigurationOutput; + patients: Array; +} + +// @public +export type RadiologyInsightsInference = RadiologyInsightsInferenceParent | AgeMismatchInference | SexMismatchInference | LateralityDiscrepancyInference | CompleteOrderDiscrepancyInference | LimitedOrderDiscrepancyInference | FindingInference | CriticalResultInference | RadiologyProcedureInference | FollowupRecommendationInference | FollowupCommunicationInference | ScoringAndAssessmentInference | GuidanceInference | QualityMeasureInference; + +// @public +export interface RadiologyInsightsInferenceOptions { + findingOptions?: FindingOptions; + followupRecommendationOptions?: FollowupRecommendationOptions; + guidanceOptions?: GuidanceOptions; + qualityMeasureOptions?: QualityMeasureOptions; +} + +// @public +export interface RadiologyInsightsInferenceOptionsOutput { + findingOptions?: FindingOptionsOutput; + followupRecommendationOptions?: FollowupRecommendationOptionsOutput; + guidanceOptions?: GuidanceOptionsOutput; + qualityMeasureOptions?: QualityMeasureOptionsOutput; +} + +// @public +export type RadiologyInsightsInferenceOutput = RadiologyInsightsInferenceOutputParent | AgeMismatchInferenceOutput | SexMismatchInferenceOutput | LateralityDiscrepancyInferenceOutput | CompleteOrderDiscrepancyInferenceOutput | LimitedOrderDiscrepancyInferenceOutput | FindingInferenceOutput | CriticalResultInferenceOutput | RadiologyProcedureInferenceOutput | FollowupRecommendationInferenceOutput | FollowupCommunicationInferenceOutput | ScoringAndAssessmentInferenceOutput | GuidanceInferenceOutput | QualityMeasureInferenceOutput; + +// @public +export interface RadiologyInsightsInferenceOutputParent { + extension?: Array; + // (undocumented) + kind: string; +} + +// @public +export interface RadiologyInsightsInferenceParent { + extension?: Array; + // (undocumented) + kind: string; +} + +// @public +export interface RadiologyInsightsInferenceResult { + modelVersion: string; + patientResults: Array; +} + +// @public +export interface RadiologyInsightsInferenceResultOutput { + modelVersion: string; + patientResults: Array; +} + +// @public +export type RadiologyInsightsInferenceType = string; + +// @public +export type RadiologyInsightsInferenceTypeOutput = string; + +// @public +export interface RadiologyInsightsJob { + jobData?: RadiologyInsightsData; +} + +// @public +export interface RadiologyInsightsJobOutput { + readonly createdAt?: string; + readonly error?: ErrorModel; + readonly expiresAt?: string; + readonly id: string; + jobData?: RadiologyInsightsDataOutput; + readonly result?: RadiologyInsightsInferenceResultOutput; + readonly status: JobStatusOutput; + readonly updatedAt?: string; +} + +// @public +export interface RadiologyInsightsModelConfiguration { + includeEvidence?: boolean; + inferenceOptions?: RadiologyInsightsInferenceOptions; + inferenceTypes?: RadiologyInsightsInferenceType[]; + locale?: string; + verbose?: boolean; +} + +// @public +export interface RadiologyInsightsModelConfigurationOutput { + includeEvidence?: boolean; + inferenceOptions?: RadiologyInsightsInferenceOptionsOutput; + inferenceTypes?: RadiologyInsightsInferenceTypeOutput[]; + locale?: string; + verbose?: boolean; +} + +// @public +export interface RadiologyInsightsPatientResult { + inferences: Array; + patientId: string; +} + +// @public +export interface RadiologyInsightsPatientResultOutput { + inferences: Array; + patientId: string; +} + +// @public +export interface RadiologyProcedureInference extends RadiologyInsightsInferenceParent { + imagingProcedures: Array; + kind: "radiologyProcedure"; + orderedProcedure: OrderedProcedure; + procedureCodes?: Array; +} + +// @public +export interface RadiologyProcedureInferenceOutput extends RadiologyInsightsInferenceOutputParent { + imagingProcedures: Array; + kind: "radiologyProcedure"; + orderedProcedure: OrderedProcedureOutput; + procedureCodes?: Array; +} + +// @public +interface Range_2 extends Element_2 { + high?: Quantity; + low?: Quantity; +} +export { Range_2 as Range } + +// @public +export interface RangeOutput extends ElementOutput { + high?: QuantityOutput; + low?: QuantityOutput; +} + +// @public +export interface Ratio extends Element_2 { + denominator?: Quantity; + numerator?: Quantity; +} + +// @public +export interface RatioOutput extends ElementOutput { + denominator?: QuantityOutput; + numerator?: QuantityOutput; +} + +// @public +export interface RecommendationFinding { + criticalFinding?: CriticalResult; + extension?: Array; + finding?: Observation; + recommendationFindingStatus: RecommendationFindingStatusType; +} + +// @public +export interface RecommendationFindingOutput { + criticalFinding?: CriticalResultOutput; + extension?: Array; + finding?: ObservationOutput; + recommendationFindingStatus: RecommendationFindingStatusTypeOutput; +} + +// @public +export type RecommendationFindingStatusType = string; + +// @public +export type RecommendationFindingStatusTypeOutput = string; + +// @public +export interface Reference extends Element_2 { + display?: string; + identifier?: Identifier; + reference?: string; + type?: string; +} + +// @public +export interface ReferenceOutput extends ElementOutput { + display?: string; + identifier?: IdentifierOutput; + reference?: string; + type?: string; +} + +// @public +export interface ResearchStudy extends DomainResourceParent { + arm?: { + name: string; + type?: CodeableConcept; + description?: string; + }[]; + category?: Array; + condition?: Array; + contact?: Array; + description?: string; + enrollment?: Array; + focus?: Array; + identifier?: Array; + keyword?: Array; + location?: Array; + note?: Array; + objective?: { + name: string; + type?: CodeableConcept; + }[]; + partOf?: Array; + period?: Period; + phase?: CodeableConcept; + primaryPurposeType?: CodeableConcept; + principalInvestigator?: Reference; + protocol?: Array; + reasonStopped?: CodeableConcept; + resourceType: "ResearchStudy"; + site?: Array; + sponsor?: Reference; + status: ResearchStudyStatusCodeType; + title?: string; +} + +// @public +export interface ResearchStudyOutput extends DomainResourceOutputParent { + arm?: { + name: string; + type?: CodeableConceptOutput; + description?: string; + }[]; + category?: Array; + condition?: Array; + contact?: Array; + description?: string; + enrollment?: Array; + focus?: Array; + identifier?: Array; + keyword?: Array; + location?: Array; + note?: Array; + objective?: { + name: string; + type?: CodeableConceptOutput; + }[]; + partOf?: Array; + period?: PeriodOutput; + phase?: CodeableConceptOutput; + primaryPurposeType?: CodeableConceptOutput; + principalInvestigator?: ReferenceOutput; + protocol?: Array; + reasonStopped?: CodeableConceptOutput; + resourceType: "ResearchStudy"; + site?: Array; + sponsor?: ReferenceOutput; + status: ResearchStudyStatusCodeTypeOutput; + title?: string; +} + +// @public +export type ResearchStudyStatusCodeType = string; + +// @public +export type ResearchStudyStatusCodeTypeOutput = string; + +// @public +export interface Resource extends Record { + id?: string; + implicitRules?: string; + language?: string; + meta?: Meta; + resourceType: string; +} + +// @public +export interface ResourceOutput extends Record { + id?: string; + implicitRules?: string; + language?: string; + meta?: MetaOutput; + resourceType: string; +} + +// @public (undocumented) +export interface Routes { + (path: "/radiology-insights/jobs/{id}", id: string): GetJob; +} + +// @public +export interface SampledData extends Element_2 { + data?: string; + dimensions: number; + factor?: number; + lowerLimit?: number; + origin: Quantity; + period: number; + upperLimit?: number; +} + +// @public +export interface SampledDataOutput extends ElementOutput { + data?: string; + dimensions: number; + factor?: number; + lowerLimit?: number; + origin: QuantityOutput; + period: number; + upperLimit?: number; +} + +// @public +export type ScoringAndAssessmentCategoryType = string; + +// @public +export type ScoringAndAssessmentCategoryTypeOutput = string; + +// @public +export interface ScoringAndAssessmentInference extends RadiologyInsightsInferenceParent { + category: ScoringAndAssessmentCategoryType; + categoryDescription: string; + kind: "scoringAndAssessment"; + rangeValue?: AssessmentValueRange; + singleValue?: string; +} + +// @public +export interface ScoringAndAssessmentInferenceOutput extends RadiologyInsightsInferenceOutputParent { + category: ScoringAndAssessmentCategoryTypeOutput; + categoryDescription: string; + kind: "scoringAndAssessment"; + rangeValue?: AssessmentValueRangeOutput; + singleValue?: string; +} + +// @public +export interface SexMismatchInference extends RadiologyInsightsInferenceParent { + kind: "sexMismatch"; + sexIndication: CodeableConcept; +} + +// @public +export interface SexMismatchInferenceOutput extends RadiologyInsightsInferenceOutputParent { + kind: "sexMismatch"; + sexIndication: CodeableConceptOutput; +} + +// @public +export interface SimplePollerLike, TResult> { + getOperationState(): TState; + getResult(): TResult | undefined; + isDone(): boolean; + // @deprecated + isStopped(): boolean; + onProgress(callback: (state: TState) => void): CancelOnProgress; + poll(options?: { + abortSignal?: AbortSignalLike; + }): Promise; + pollUntilDone(pollOptions?: { + abortSignal?: AbortSignalLike; + }): Promise; + serialize(): Promise; + // @deprecated + stopPolling(): void; + submitted(): Promise; + // @deprecated + toString(): string; +} + +// @public +export type SpecialtyType = string; + +// @public +export type SpecialtyTypeOutput = string; + +// @public +export interface TimePeriod { + end?: Date | string; + start?: Date | string; +} + +// @public +export interface TimePeriodOutput { + end?: string; + start?: string; +} + +// (No @packageDocumentation comment for this package) diff --git a/sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/tsconfig.json b/sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/tsconfig.json new file mode 100644 index 000000000000..26e6a4e090b4 --- /dev/null +++ b/sdk/healthinsights/health-insights-radiologyinsights-rest/~/.tmp-breaking-change-detect/tsconfig.json @@ -0,0 +1,17 @@ + +{ + "compilerOptions": { + "jsx": "preserve", + "target": "es5", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "lib": ["es2015", "es2017", "esnext"], + "experimentalDecorators": true, + "rootDir": "." + }, + "include": [ + "**/*.ts", + ], + "exclude": ["**/node_modules/**/*.*"] +}