diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 9b9f9c511158..86d5e2590a1a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -815,6 +815,9 @@ dependencies: '@rush-temp/attestation': specifier: file:./projects/attestation.tgz version: file:projects/attestation.tgz + '@rush-temp/azure-health-deidentification': + specifier: file:./projects/azure-health-deidentification.tgz + version: file:projects/azure-health-deidentification.tgz '@rush-temp/batch': specifier: file:./projects/batch.tgz version: file:projects/batch.tgz @@ -953,9 +956,6 @@ dependencies: '@rush-temp/functions-authentication-events': specifier: file:./projects/functions-authentication-events.tgz version: file:projects/functions-authentication-events.tgz - '@rush-temp/health-deidentification': - specifier: file:./projects/health-deidentification.tgz - version: file:projects/health-deidentification.tgz '@rush-temp/health-insights-cancerprofiling': specifier: file:./projects/health-insights-cancerprofiling.tgz version: file:projects/health-insights-cancerprofiling.tgz @@ -18713,6 +18713,43 @@ packages: - webdriverio dev: false + file:projects/azure-health-deidentification.tgz: + resolution: {integrity: sha512-QOXZI7kM7ZZf7hI2dN1s3V/tn9Ii5cGzOjpbAVUkpVB8mGXVBu+CNaVb/0OTBjSm7YCc6hNrgKtvtN11XpdsNw==, tarball: file:projects/azure-health-deidentification.tgz} + name: '@rush-temp/azure-health-deidentification' + version: 0.0.0 + dependencies: + '@types/node': 18.19.67 + '@vitest/browser': 2.1.8(@types/node@18.19.67)(playwright@1.49.0)(typescript@5.6.3)(vitest@2.1.8) + '@vitest/coverage-istanbul': 2.1.8(vitest@2.1.8) + dotenv: 16.4.7 + eslint: 9.16.0 + loupe: 3.1.2 + playwright: 1.49.0 + tslib: 2.8.1 + typescript: 5.6.3 + vitest: 2.1.8(@types/node@18.19.67)(@vitest/browser@2.1.8) + transitivePeerDependencies: + - '@edge-runtime/vm' + - '@vitest/ui' + - bufferutil + - happy-dom + - jiti + - jsdom + - less + - lightningcss + - msw + - safaridriver + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - utf-8-validate + - vite + - webdriverio + dev: false + file:projects/batch.tgz: resolution: {integrity: sha512-XuL+PYlzGB/YmNDbnPrIq9AjDzOIhnjUFAr7XTwTGR8huP18WZWmL/m0YW4MlwP69ewEyjD8dWCAb0KmJl92pQ==, tarball: file:projects/batch.tgz} name: '@rush-temp/batch' @@ -19721,7 +19758,7 @@ packages: dev: false file:projects/core-sse.tgz: - resolution: {integrity: sha512-rxq/J1ftJ2e0MkPDv49RFsVQcu/68yCe6/h0R6+SdIkKBnhbYY12SkHzwOEOLFtemwLv+mh2SAqE6KHTYwJ8Lg==, tarball: file:projects/core-sse.tgz} + resolution: {integrity: sha512-mJ6yU1aJSHYVmT31VIT4SQSNzaMvqNi0IAWz+DHH2XZj+GTcVazXvt3x02xgQMraoXRuBuaEBiW5RfwqK99Jiw==, tarball: file:projects/core-sse.tgz} name: '@rush-temp/core-sse' version: 0.0.0 dependencies: @@ -20500,43 +20537,6 @@ packages: - webdriverio dev: false - file:projects/health-deidentification.tgz: - resolution: {integrity: sha512-6LdN/I3/IT+r5A4w8Ac5rRXYnfUzCGhSyEhSq0zB1vEsyX0oOz5viCnGYYqmiyOOfGvgqaMBOk4KwrCCeMcTOA==, tarball: file:projects/health-deidentification.tgz} - name: '@rush-temp/health-deidentification' - version: 0.0.0 - dependencies: - '@types/node': 18.19.67 - '@vitest/browser': 2.1.8(@types/node@18.19.67)(playwright@1.49.0)(typescript@5.6.3)(vitest@2.1.8) - '@vitest/coverage-istanbul': 2.1.8(vitest@2.1.8) - dotenv: 16.4.7 - eslint: 9.16.0 - loupe: 3.1.2 - playwright: 1.49.0 - tslib: 2.8.1 - typescript: 5.6.3 - vitest: 2.1.8(@types/node@18.19.67)(@vitest/browser@2.1.8) - transitivePeerDependencies: - - '@edge-runtime/vm' - - '@vitest/ui' - - bufferutil - - happy-dom - - jiti - - jsdom - - less - - lightningcss - - msw - - safaridriver - - sass - - sass-embedded - - stylus - - sugarss - - supports-color - - terser - - utf-8-validate - - vite - - webdriverio - dev: false - file:projects/health-insights-cancerprofiling.tgz: resolution: {integrity: sha512-VbNwjG9FeYaNHVZ5ccHivYA5aMTBQaj9e/3S1qhujNHdW79W4w9R989l0SMtitK7WXcC7OfQunMVVA/v5BKPeA==, tarball: file:projects/health-insights-cancerprofiling.tgz} name: '@rush-temp/health-insights-cancerprofiling' @@ -22607,7 +22607,7 @@ packages: dev: false file:projects/search-documents.tgz: - resolution: {integrity: sha512-3S94WjpWXw7riA1c+tkPKkCHWJJ9jqEbdpx4k2Z8cYJXfS2N8eH3bd4Mhk7qY7DdoOOG4qeOT6ofNyXT3WRXlg==, tarball: file:projects/search-documents.tgz} + resolution: {integrity: sha512-/zkv3RZpvF5SXN3aKwaX8QidH+/p6MUfd4j7BYtJRrTp+HCbscmtm+DrGZwqRHhUAUBdsbLQ3E/CXDMlfuOpig==, tarball: file:projects/search-documents.tgz} name: '@rush-temp/search-documents' version: 0.0.0 dependencies: diff --git a/rush.json b/rush.json index 6dea8ac0965a..76687fb689a0 100644 --- a/rush.json +++ b/rush.json @@ -2219,7 +2219,7 @@ "versionPolicyName": "management" }, { - "packageName": "@azure-rest/health-deidentification", + "packageName": "@azure-rest/azure-health-deidentification", "projectFolder": "sdk/healthdataaiservices/azure-health-deidentification", "versionPolicyName": "client" }, diff --git a/sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md b/sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md index f5986a61661e..999fca2146eb 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md +++ b/sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 1.0.0 (2024-12-13) + +### Features Added + +- Introduced `DeidentificationCustomizationOptions` and `DeidentificationJobCustomizationOptions` models + - Created `SurrogateLocale` field in these models + - Moved `RedactionFormat` field into these models +- Introduced `Overwrite` flag in `TargetStorageLocation` model + +### Breaking Changes + +- Changed `outputPrefix` behavior from including `jobName` to prefix replacement method +- Changed `Path` field to `Location` in `SourceStorageLocation` and `TargetStorageLocation` +- Deprecated `DocumentDataType` +- Deprecated `Path` and `Location` from `TaggerResult` model + ## 1.0.0-beta.1 (2024-08-15) - Azure Deidentification client library for JS. This package contains Microsoft Azure Deidentification client library. diff --git a/sdk/healthdataaiservices/azure-health-deidentification/README.md b/sdk/healthdataaiservices/azure-health-deidentification/README.md index ce0923b0f8ae..214f54493fdc 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/README.md +++ b/sdk/healthdataaiservices/azure-health-deidentification/README.md @@ -1,12 +1,14 @@ # Azure Deidentification REST client library for JavaScript -`@azure-rest/health-deidentification` is a managed service that enables users to tag, redact, or surrogate health data. +Health Deidentification Service + +**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: -- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/health-deidentification) +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/azure-health-deidentification) +- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/azure-health-deidentification) +- [API reference documentation](https://docs.microsoft.com/javascript/api/@azure-rest/health-deidentification?view=azure-node-preview) ## Getting started @@ -18,12 +20,12 @@ Key links: - You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package. -### Install the `@azure-rest/health-deidentification` package +### Install the `@azure-rest/azure-health-deidentification` package Install the Azure Deidentification REST client REST client library for JavaScript with `npm`: ```bash -npm install @azure-rest/health-deidentification +npm install @azure-rest/azure-health-deidentification ``` ### Create and authenticate a `DeidentificationClient` @@ -32,57 +34,30 @@ To use an [Azure Active Directory (AAD) token credential](https://github.com/Azu 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. -To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) +To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity). 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. Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: -`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` +`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. -Pull `ServiceUrl` from your created Deidentification Service. +Set the value of the environment variable `DEID_SERVICE_ENDPOINT` to the `ServiceUrl` of the Deidentification Service you created. ![Service Url Location](documentation/images/ServiceUrl_Location.png) -Basic code snippet to create your Deidentification Client and Deidentify a string. - -```javascript -import createClient, { - DeidentificationContent, - isUnexpected, -} from "@azure-rest/health-deidentification"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); - -const credential = new DefaultAzureCredential(); -const serviceEndpoint = - process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com"; -const client = createClient(serviceEndpoint, credential); - -const content: DeidentificationContent = { - inputText: "Hello John!" -}; - -const response = await client.path("/deid").post({ body: content }); - -if (isUnexpected(response)) { - throw response.body.error; -} - -console.log(response.body.outputText); // Hello, Tom! -``` +The samples folder contains simple code examples to Deidentify text. -## Key concept +## Key concepts Operation Modes: -- Tag: Will return a structure of offset and length with the PHI category of the related text spans. -- Redact: Will return output text with placeholder stubbed text. ex. `[name]` +- Tag: Will return the offset, length, and PHI category of deidentified text. +- Redact: Will return output text with placeholder stubbed text. See [redaction format tutorial](https://learn.microsoft.com/azure/healthcare-apis/deidentification/redaction-format) for more information. - Surrogate: Will return output text with synthetic replacements. - - `My name is John Smith` - - `My name is Tom Jones` + - Input: `My name is John Smith` + - Output: `My name is Tom Jones` ## Troubleshooting diff --git a/sdk/healthdataaiservices/azure-health-deidentification/assets.json b/sdk/healthdataaiservices/azure-health-deidentification/assets.json index 31fc3d9e152c..d59563d5765a 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/assets.json +++ b/sdk/healthdataaiservices/azure-health-deidentification/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/healthdataaiservices/azure-health-deidentification", - "Tag": "js/healthdataaiservices/azure-health-deidentification_69c12d020a" + "Tag": "js/healthdataaiservices/azure-health-deidentification_302840dfd0" } diff --git a/sdk/healthdataaiservices/azure-health-deidentification/eslint.config.mjs b/sdk/healthdataaiservices/azure-health-deidentification/eslint.config.mjs index 48206a891e00..03244d34a19f 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/eslint.config.mjs +++ b/sdk/healthdataaiservices/azure-health-deidentification/eslint.config.mjs @@ -1,18 +1,17 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default azsdkEslint.config([ +export default [ + ...azsdkEslint.configs.recommended, { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", "@azure/azure-sdk/ts-apiextractor-json-types": "warn", "@azure/azure-sdk/ts-package-json-types": "warn", "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "tsdoc/syntax": "warn", "@azure/azure-sdk/ts-package-json-module": "off", "@azure/azure-sdk/ts-package-json-files-required": "off", "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", - "@azure/azure-sdk/ts-package-json-name": "warn", - "@azure/azure-sdk/ts-package-json-homepage": "warn", + "tsdoc/syntax": "warn", }, }, -]); +]; diff --git a/sdk/healthdataaiservices/azure-health-deidentification/package.json b/sdk/healthdataaiservices/azure-health-deidentification/package.json index 9e7f861696ef..320e89f9bdfa 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/package.json +++ b/sdk/healthdataaiservices/azure-health-deidentification/package.json @@ -1,6 +1,6 @@ { - "name": "@azure-rest/health-deidentification", - "version": "1.0.0-beta.1", + "name": "@azure-rest/azure-health-deidentification", + "version": "1.0.0", "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/azure-health-deidentification", "description": "Health Deidentification Service", "engines": { diff --git a/sdk/healthdataaiservices/azure-health-deidentification/review/health-deidentification.api.md b/sdk/healthdataaiservices/azure-health-deidentification/review/azure-health-deidentification.api.md similarity index 68% rename from sdk/healthdataaiservices/azure-health-deidentification/review/health-deidentification.api.md rename to sdk/healthdataaiservices/azure-health-deidentification/review/azure-health-deidentification.api.md index 2a20f945c003..1f9e4c393db8 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/review/health-deidentification.api.md +++ b/sdk/healthdataaiservices/azure-health-deidentification/review/azure-health-deidentification.api.md @@ -1,26 +1,24 @@ -## API Report File for "@azure-rest/health-deidentification" +## API Report File for "@azure-rest/azure-health-deidentification" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```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 { ErrorResponse } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { OperationState } from '@azure/core-lro'; -import type { Paged } from '@azure/core-paging'; -import type { PagedAsyncIterableIterator } from '@azure/core-paging'; -import type { PathUncheckedResponse } from '@azure-rest/core-client'; -import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import type { RawHttpHeadersInput } 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'; +import { AbortSignalLike } from '@azure/abort-controller'; +import { CancelOnProgress } from '@azure/core-lro'; +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 { ErrorResponse } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationState as OperationState_2 } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; // @public (undocumented) export interface CancelJob { @@ -76,70 +74,173 @@ function createClient(endpointParam: string, credentials: TokenCredential, { api export default createClient; // @public (undocumented) -export interface CreateJob200Headers { +export type DeidentificationClient = Client & { + path: Routes; +}; + +// @public +export interface DeidentificationClientOptions extends ClientOptions { + apiVersion?: string; +} + +// @public +export interface DeidentificationContent { + customizations?: DeidentificationCustomizationOptions; + inputText: string; + operation?: DeidentificationOperationType; +} + +// @public +export interface DeidentificationCustomizationOptions { + redactionFormat?: string; + surrogateLocale?: string; +} + +// @public +export interface DeidentificationDocumentDetailsOutput { + error?: ErrorModel; + readonly id: string; + input: DeidentificationDocumentLocationOutput; + output?: DeidentificationDocumentLocationOutput; + status: OperationStateOutput; +} + +// @public +export interface DeidentificationDocumentLocationOutput { + readonly etag: string; + location: string; +} + +// @public +export interface DeidentificationJob { + customizations?: DeidentificationJobCustomizationOptions; + operation?: DeidentificationOperationType; + sourceLocation: SourceStorageLocation; + targetLocation: TargetStorageLocation; +} + +// @public +export interface DeidentificationJobCustomizationOptions { + redactionFormat?: string; + surrogateLocale?: string; +} + +// @public +export interface DeidentificationJobCustomizationOptionsOutput { + redactionFormat?: string; + surrogateLocale?: string; +} + +// @public +export interface DeidentificationJobOutput { + readonly createdAt: string; + customizations?: DeidentificationJobCustomizationOptionsOutput; + readonly error?: ErrorModel; + readonly lastUpdatedAt: string; + readonly name: string; + operation?: DeidentificationOperationTypeOutput; + sourceLocation: SourceStorageLocationOutput; + readonly startedAt?: string; + readonly status: OperationStateOutput; + readonly summary?: DeidentificationJobSummaryOutput; + targetLocation: TargetStorageLocationOutput; +} + +// @public +export interface DeidentificationJobSummary { + bytesProcessed: number; + canceled: number; + failed: number; + successful: number; + total: number; +} + +// @public +export interface DeidentificationJobSummaryOutput { + bytesProcessed: number; + canceled: number; + failed: number; + successful: number; + total: number; +} + +// @public +export type DeidentificationOperationType = string; + +// @public +export type DeidentificationOperationTypeOutput = string; + +// @public +export interface DeidentificationResultOutput { + outputText?: string; + taggerResult?: PhiTaggerResultOutput; +} + +// @public (undocumented) +export interface DeidentifyDocuments200Headers { "operation-location": string; "x-ms-client-request-id"?: string; } // @public -export interface CreateJob200Response extends HttpResponse { +export interface DeidentifyDocuments200Response extends HttpResponse { // (undocumented) body: DeidentificationJobOutput; // (undocumented) - headers: RawHttpHeaders & CreateJob200Headers; + headers: RawHttpHeaders & DeidentifyDocuments200Headers; // (undocumented) status: "200"; } // @public (undocumented) -export interface CreateJob201Headers { +export interface DeidentifyDocuments201Headers { "operation-location": string; "x-ms-client-request-id"?: string; } // @public -export interface CreateJob201Response extends HttpResponse { +export interface DeidentifyDocuments201Response extends HttpResponse { // (undocumented) body: DeidentificationJobOutput; // (undocumented) - headers: RawHttpHeaders & CreateJob201Headers; + headers: RawHttpHeaders & DeidentifyDocuments201Headers; // (undocumented) status: "201"; } // @public (undocumented) -export interface CreateJobBodyParam { +export interface DeidentifyDocumentsBodyParam { body: DeidentificationJob; } // @public (undocumented) -export interface CreateJobDefaultHeaders { +export interface DeidentifyDocumentsDefaultHeaders { "x-ms-error-code"?: string; } // @public (undocumented) -export interface CreateJobDefaultResponse extends HttpResponse { +export interface DeidentifyDocumentsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponse; // (undocumented) - headers: RawHttpHeaders & CreateJobDefaultHeaders; + headers: RawHttpHeaders & DeidentifyDocumentsDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export interface CreateJobHeaderParam { +export interface DeidentifyDocumentsHeaderParam { // (undocumented) - headers?: RawHttpHeadersInput & CreateJobHeaders; + headers?: RawHttpHeadersInput & DeidentifyDocumentsHeaders; } // @public (undocumented) -export interface CreateJobHeaders { +export interface DeidentifyDocumentsHeaders { "x-ms-client-request-id"?: string; } // @public -export interface CreateJobLogicalResponse extends HttpResponse { +export interface DeidentifyDocumentsLogicalResponse extends HttpResponse { // (undocumented) body: DeidentificationJobOutput; // (undocumented) @@ -147,92 +248,61 @@ export interface CreateJobLogicalResponse extends HttpResponse { } // @public (undocumented) -export type CreateJobParameters = CreateJobHeaderParam & CreateJobBodyParam & RequestParameters; +export type DeidentifyDocumentsParameters = DeidentifyDocumentsHeaderParam & DeidentifyDocumentsBodyParam & RequestParameters; // @public (undocumented) -export type DeidentificationClient = Client & { - path: Routes; -}; - -// @public -export interface DeidentificationClientOptions extends ClientOptions { - apiVersion?: string; -} - -// @public -export interface DeidentificationContent { - dataType?: DocumentDataType; - inputText: string; - operation?: OperationType; - redactionFormat?: string; -} - -// @public -export interface DeidentificationJob { - dataType?: DocumentDataType; - operation?: OperationType; - redactionFormat?: string; - sourceLocation: SourceStorageLocation; - targetLocation: TargetStorageLocation; -} - -// @public -export interface DeidentificationJobOutput { - readonly createdAt: string; - dataType?: DocumentDataTypeOutput; - readonly error?: ErrorModel; - readonly lastUpdatedAt: string; - readonly name: string; - operation?: OperationTypeOutput; - redactionFormat?: string; - sourceLocation: SourceStorageLocationOutput; - readonly startedAt?: string; - readonly status: JobStatusOutput; - readonly summary?: JobSummaryOutput; - targetLocation: TargetStorageLocationOutput; -} - -// @public -export interface DeidentificationResultOutput { - outputText?: string; - taggerResult?: PhiTaggerResultOutput; +export interface DeidentifyText { + post(options: DeidentifyTextParameters): StreamableMethod; } // @public (undocumented) -export interface Deidentify { - post(options: DeidentifyParameters): StreamableMethod; +export interface DeidentifyText200Headers { + "x-ms-client-request-id"?: string; } // @public -export interface Deidentify200Response extends HttpResponse { +export interface DeidentifyText200Response extends HttpResponse { // (undocumented) body: DeidentificationResultOutput; // (undocumented) + headers: RawHttpHeaders & DeidentifyText200Headers; + // (undocumented) status: "200"; } // @public (undocumented) -export interface DeidentifyBodyParam { +export interface DeidentifyTextBodyParam { body: DeidentificationContent; } // @public (undocumented) -export interface DeidentifyDefaultHeaders { +export interface DeidentifyTextDefaultHeaders { "x-ms-error-code"?: string; } // @public (undocumented) -export interface DeidentifyDefaultResponse extends HttpResponse { +export interface DeidentifyTextDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponse; // (undocumented) - headers: RawHttpHeaders & DeidentifyDefaultHeaders; + headers: RawHttpHeaders & DeidentifyTextDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type DeidentifyParameters = DeidentifyBodyParam & RequestParameters; +export interface DeidentifyTextHeaderParam { + // (undocumented) + headers?: RawHttpHeadersInput & DeidentifyTextHeaders; +} + +// @public (undocumented) +export interface DeidentifyTextHeaders { + "x-ms-client-request-id"?: string; +} + +// @public (undocumented) +export type DeidentifyTextParameters = DeidentifyTextHeaderParam & DeidentifyTextBodyParam & RequestParameters; // @public (undocumented) export interface DeleteJob204Headers { @@ -276,27 +346,6 @@ export interface DeleteJobHeaders { // @public (undocumented) export type DeleteJobParameters = DeleteJobHeaderParam & RequestParameters; -// @public -export type DocumentDataType = string; - -// @public -export type DocumentDataTypeOutput = string; - -// @public -export interface DocumentDetailsOutput { - error?: ErrorModel; - readonly id: string; - input: DocumentLocationOutput; - output?: DocumentLocationOutput; - status: OperationStateOutput; -} - -// @public -export interface DocumentLocationOutput { - readonly etag: string; - path: string; -} - // @public export type GetArrayType = T extends Array ? TData : never; @@ -304,7 +353,7 @@ export type GetArrayType = T extends Array ? TData : never; export interface GetJob { delete(options?: DeleteJobParameters): StreamableMethod; get(options?: GetJobParameters): StreamableMethod; - put(options: CreateJobParameters): StreamableMethod; + put(options: DeidentifyDocumentsParameters): StreamableMethod; } // @public (undocumented) @@ -352,10 +401,10 @@ export interface GetJobHeaders { export type GetJobParameters = GetJobHeaderParam & RequestParameters; // @public -export function getLongRunningPoller(client: Client, initialResponse: CreateJob200Response | CreateJob201Response | CreateJobDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; +export function getLongRunningPoller(client: Client, initialResponse: DeidentifyDocuments200Response | DeidentifyDocuments201Response | DeidentifyDocumentsDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; // @public -export type GetPage = (pageLink: string, maxPageSize?: number) => Promise<{ +export type GetPage = (pageLink: string) => Promise<{ page: TPage; nextPageLink?: string; }>; @@ -364,7 +413,7 @@ export type GetPage = (pageLink: string, maxPageSize?: number) => Promise export function isUnexpected(response: GetJob200Response | GetJobDefaultResponse): response is GetJobDefaultResponse; // @public (undocumented) -export function isUnexpected(response: CreateJob200Response | CreateJob201Response | CreateJobLogicalResponse | CreateJobDefaultResponse): response is CreateJobDefaultResponse; +export function isUnexpected(response: DeidentifyDocuments200Response | DeidentifyDocuments201Response | DeidentifyDocumentsLogicalResponse | DeidentifyDocumentsDefaultResponse): response is DeidentifyDocumentsDefaultResponse; // @public (undocumented) export function isUnexpected(response: DeleteJob204Response | DeleteJobDefaultResponse): response is DeleteJobDefaultResponse; @@ -379,31 +428,7 @@ export function isUnexpected(response: ListJobDocuments200Response | ListJobDocu export function isUnexpected(response: CancelJob200Response | CancelJobDefaultResponse): response is CancelJobDefaultResponse; // @public (undocumented) -export function isUnexpected(response: Deidentify200Response | DeidentifyDefaultResponse): response is DeidentifyDefaultResponse; - -// @public -export type JobStatus = string; - -// @public -export type JobStatusOutput = string; - -// @public -export interface JobSummary { - bytesProcessed: number; - canceled: number; - failed: number; - successful: number; - total: number; -} - -// @public -export interface JobSummaryOutput { - bytesProcessed: number; - canceled: number; - failed: number; - successful: number; - total: number; -} +export function isUnexpected(response: DeidentifyText200Response | DeidentifyTextDefaultResponse): response is DeidentifyTextDefaultResponse; // @public (undocumented) export interface ListJobDocuments { @@ -418,7 +443,7 @@ export interface ListJobDocuments200Headers { // @public export interface ListJobDocuments200Response extends HttpResponse { // (undocumented) - body: PagedDocumentDetailsOutput; + body: PagedDeidentificationDocumentDetailsOutput; // (undocumented) headers: RawHttpHeaders & ListJobDocuments200Headers; // (undocumented) @@ -527,20 +552,35 @@ export interface ListJobsQueryParamProperties { maxpagesize?: number; } +// @public +export type OperationState = string; + // @public export type OperationStateOutput = string; // @public -export type OperationType = string; +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator; + next(): Promise>; +} // @public -export type OperationTypeOutput = string; +export interface PagedDeidentificationDocumentDetailsOutput { + nextLink?: string; + value: Array; +} // @public -export type PagedDeidentificationJobOutput = Paged; +export interface PagedDeidentificationJobOutput { + nextLink?: string; + value: Array; +} // @public -export type PagedDocumentDetailsOutput = Paged; +export interface PageSettings { + continuationToken?: string; +} // @public export function paginate(client: Client, initialResponse: TResponse, options?: PagingOptions): PagedAsyncIterableIterator>; @@ -572,8 +612,6 @@ export interface PhiEntityOutput { // @public export interface PhiTaggerResultOutput { entities: Array; - etag?: string; - path?: string; } // @public (undocumented) @@ -582,11 +620,11 @@ export interface Routes { (path: "/jobs"): ListJobs; (path: "/jobs/{name}/documents", name: string): ListJobDocuments; (path: "/jobs/{name}:cancel", name: string): CancelJob; - (path: "/deid"): Deidentify; + (path: "/deid"): DeidentifyText; } // @public -export interface SimplePollerLike, TResult> { +export interface SimplePollerLike, TResult> { getOperationState(): TState; getResult(): TResult | undefined; isDone(): boolean; @@ -631,12 +669,14 @@ export interface StringIndexOutput { // @public export interface TargetStorageLocation { location: string; + overwrite?: boolean; prefix: string; } // @public export interface TargetStorageLocationOutput { location: string; + overwrite?: boolean; prefix: string; } diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/createJob.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/createJob.ts index 44b6b71301ad..8c847110f3a4 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/createJob.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/createJob.ts @@ -2,13 +2,13 @@ // Licensed under the MIT License. /** - * @summary This sample demonstrates how to create a job which will deidentify all files within a blob storage container filtering via a prefix. + * @summary This sample demonstrates how to create a job which will deidentify all files within a specific folder of a blob storage container. */ import createClient, { DeidentificationJob, isUnexpected, -} from "@azure-rest/health-deidentification"; +} from "@azure-rest/azure-health-deidentification"; import { DefaultAzureCredential } from "@azure/identity"; import * as dotenv from "dotenv"; dotenv.config(); @@ -25,7 +25,6 @@ export async function main(): Promise { const jobName = "exampleJob"; const job: DeidentificationJob = { - dataType: "Plaintext", operation: "Surrogate", sourceLocation: { location, prefix: inputPrefix }, targetLocation: { location, prefix: OUTPUT_FOLDER }, diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/helloWorld.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/helloWorld.ts index c96423ff88e9..a5dc86d297f1 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/helloWorld.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/helloWorld.ts @@ -8,7 +8,7 @@ import createClient, { DeidentificationContent, isUnexpected, -} from "@azure-rest/health-deidentification"; +} from "@azure-rest/azure-health-deidentification"; import { DefaultAzureCredential } from "@azure/identity"; import * as dotenv from "dotenv"; dotenv.config(); @@ -20,7 +20,7 @@ export async function main(): Promise { const client = createClient(serviceEndpoint, credential); const content: DeidentificationContent = { - inputText: "Hello John!", + inputText: "Hello, John!", }; const response = await client.path("/deid").post({ body: content }); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/listCompletedFiles.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/listCompletedFiles.ts index 01e35025cffe..ae248ed8c2ec 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/listCompletedFiles.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/listCompletedFiles.ts @@ -9,7 +9,7 @@ import createClient, { DeidentificationJob, isUnexpected, paginate, -} from "@azure-rest/health-deidentification"; +} from "@azure-rest/azure-health-deidentification"; import { DefaultAzureCredential } from "@azure/identity"; import * as dotenv from "dotenv"; dotenv.config(); @@ -26,10 +26,12 @@ export async function main(): Promise { const jobName = "exampleJob"; const job: DeidentificationJob = { - dataType: "Plaintext", - operation: "Surrogate", + operation: "Redact", sourceLocation: { location, prefix: inputPrefix }, - targetLocation: { location, prefix: OUTPUT_FOLDER }, + targetLocation: { location, prefix: OUTPUT_FOLDER, overwrite: true }, + customizations: { + redactionFormat: "<{TYPE}>", + }, }; await client.path("/jobs/{name}", jobName).put({ body: job }); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/listJobs.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/listJobs.ts index 99301ef9eac5..2dc25f3cfab3 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/listJobs.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples-dev/listJobs.ts @@ -2,10 +2,10 @@ // Licensed under the MIT License. /** - * @summary This sample demonstrates how to list jobs and iterate over them in a for loop. + * @summary This sample demonstrates how to list Deidentification jobs and iterate over them. */ -import createClient, { isUnexpected, paginate } from "@azure-rest/health-deidentification"; +import createClient, { isUnexpected, paginate } from "@azure-rest/azure-health-deidentification"; import { DefaultAzureCredential } from "@azure/identity"; import * as dotenv from "dotenv"; dotenv.config(); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/createJob.js b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/createJob.js index cfc1a10ae227..c9dc98228a9b 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/createJob.js +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/createJob.js @@ -5,8 +5,8 @@ * @summary This sample demonstrates how to create a job which will deidentify all files within a blob storage container filtering via a prefix. */ -const createClient = require("@azure-rest/health-deidentification").default, - { isUnexpected } = require("@azure-rest/health-deidentification"); +const createClient = require("@azure-rest/azure-health-deidentification").default, + { isUnexpected } = require("@azure-rest/azure-health-deidentification"); const { DefaultAzureCredential } = require("@azure/identity"); require("dotenv").config(); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/helloWorld.js b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/helloWorld.js index cd01a19b6e1c..401d87ef12d4 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/helloWorld.js +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/helloWorld.js @@ -5,8 +5,8 @@ * @summary This sample demonstrates how to create a `DeidentificationClient` and then deidentify a `string` */ -const createClient = require("@azure-rest/health-deidentification").default, - { isUnexpected } = require("@azure-rest/health-deidentification"); +const createClient = require("@azure-rest/azure-health-deidentification").default, + { isUnexpected } = require("@azure-rest/azure-health-deidentification"); const { DefaultAzureCredential } = require("@azure/identity"); require("dotenv").config(); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/listCompletedFiles.js b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/listCompletedFiles.js index d44825fc5533..0e90bfaec685 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/listCompletedFiles.js +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/listCompletedFiles.js @@ -5,8 +5,8 @@ * @summary This sample demonstrates how to list files that were completed by a job. */ -const createClient = require("@azure-rest/health-deidentification").default, - { isUnexpected, paginate } = require("@azure-rest/health-deidentification"); +const createClient = require("@azure-rest/azure-health-deidentification").default, + { isUnexpected, paginate } = require("@azure-rest/azure-health-deidentification"); const { DefaultAzureCredential } = require("@azure/identity"); require("dotenv").config(); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/listJobs.js b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/listJobs.js index aa5d0903082f..a1d3430eb154 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/listJobs.js +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/listJobs.js @@ -5,8 +5,8 @@ * @summary This sample demonstrates how to list jobs and iterate over them in a for loop. */ -const createClient = require("@azure-rest/health-deidentification").default, - { isUnexpected, paginate } = require("@azure-rest/health-deidentification"); +const createClient = require("@azure-rest/azure-health-deidentification").default, + { isUnexpected, paginate } = require("@azure-rest/azure-health-deidentification"); const { DefaultAzureCredential } = require("@azure/identity"); require("dotenv").config(); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/package.json b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/package.json index 2e6d1369680e..538b6eade270 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/package.json +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/javascript/package.json @@ -26,7 +26,7 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/azure-health-deidentification", "dependencies": { - "@azure-rest/health-deidentification": "next", + "@azure-rest/azure-health-deidentification": "next", "dotenv": "latest", "@azure/identity": "~4.3.0-beta.1" } diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/package.json b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/package.json index cf24dbdfb56c..2f80ab10bd31 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/package.json +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/package.json @@ -30,7 +30,7 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/azure-health-deidentification", "dependencies": { - "@azure-rest/health-deidentification": "next", + "@azure-rest/azure-health-deidentification": "next", "dotenv": "latest", "@azure/identity": "~4.3.0-beta.1" }, diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/createJob.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/createJob.ts index 44b6b71301ad..a5063b25abf6 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/createJob.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/createJob.ts @@ -2,13 +2,13 @@ // Licensed under the MIT License. /** - * @summary This sample demonstrates how to create a job which will deidentify all files within a blob storage container filtering via a prefix. + * @summary This sample demonstrates how to create a job which will deidentify all files within a specific folder of a blob storage container. */ import createClient, { DeidentificationJob, isUnexpected, -} from "@azure-rest/health-deidentification"; +} from "@azure-rest/azure-health-deidentification"; import { DefaultAzureCredential } from "@azure/identity"; import * as dotenv from "dotenv"; dotenv.config(); @@ -25,10 +25,12 @@ export async function main(): Promise { const jobName = "exampleJob"; const job: DeidentificationJob = { - dataType: "Plaintext", operation: "Surrogate", sourceLocation: { location, prefix: inputPrefix }, - targetLocation: { location, prefix: OUTPUT_FOLDER }, + targetLocation: { location, prefix: OUTPUT_FOLDER, overwrite: true }, + customizations: { + surrogateLocale: "en-US", + } }; const response = await client.path("/jobs/{name}", jobName).put({ body: job }); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/helloWorld.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/helloWorld.ts index c96423ff88e9..a5dc86d297f1 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/helloWorld.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/helloWorld.ts @@ -8,7 +8,7 @@ import createClient, { DeidentificationContent, isUnexpected, -} from "@azure-rest/health-deidentification"; +} from "@azure-rest/azure-health-deidentification"; import { DefaultAzureCredential } from "@azure/identity"; import * as dotenv from "dotenv"; dotenv.config(); @@ -20,7 +20,7 @@ export async function main(): Promise { const client = createClient(serviceEndpoint, credential); const content: DeidentificationContent = { - inputText: "Hello John!", + inputText: "Hello, John!", }; const response = await client.path("/deid").post({ body: content }); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/listCompletedFiles.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/listCompletedFiles.ts index 01e35025cffe..87856a6f0812 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/listCompletedFiles.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/listCompletedFiles.ts @@ -9,7 +9,7 @@ import createClient, { DeidentificationJob, isUnexpected, paginate, -} from "@azure-rest/health-deidentification"; +} from "@azure-rest/azure-health-deidentification"; import { DefaultAzureCredential } from "@azure/identity"; import * as dotenv from "dotenv"; dotenv.config(); @@ -26,10 +26,12 @@ export async function main(): Promise { const jobName = "exampleJob"; const job: DeidentificationJob = { - dataType: "Plaintext", - operation: "Surrogate", + operation: "Redact", sourceLocation: { location, prefix: inputPrefix }, - targetLocation: { location, prefix: OUTPUT_FOLDER }, + targetLocation: { location, prefix: OUTPUT_FOLDER, overwrite: true }, + customizations: { + redactionFormat: "<{TYPE}>", + } }; await client.path("/jobs/{name}", jobName).put({ body: job }); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/listJobs.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/listJobs.ts index 99301ef9eac5..2dc25f3cfab3 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/listJobs.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1-beta/typescript/src/listJobs.ts @@ -2,10 +2,10 @@ // Licensed under the MIT License. /** - * @summary This sample demonstrates how to list jobs and iterate over them in a for loop. + * @summary This sample demonstrates how to list Deidentification jobs and iterate over them. */ -import createClient, { isUnexpected, paginate } from "@azure-rest/health-deidentification"; +import createClient, { isUnexpected, paginate } from "@azure-rest/azure-health-deidentification"; import { DefaultAzureCredential } from "@azure/identity"; import * as dotenv from "dotenv"; dotenv.config(); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/README.md b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/README.md new file mode 100644 index 000000000000..1f25c4b72172 --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/README.md @@ -0,0 +1,59 @@ +# Health Deidentification Service client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for Health Deidentification Service in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| [createJob.js][createjob] | This sample demonstrates how to create a job which will deidentify all files within a specific folder of a blob storage container. | +| [helloWorld.js][helloworld] | This sample demonstrates how to create a `DeidentificationClient` and then deidentify a `string` | +| [listCompletedFiles.js][listcompletedfiles] | This sample demonstrates how to list files that were completed by a job. | +| [listJobs.js][listjobs] | This sample demonstrates how to list Deidentification jobs and iterate over them. | + +## 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] and the following Azure resources to run these sample programs: + +- [De-identification Service][createinstance_de-identificationservice] + +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 createJob.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 DEID_SERVICE_ENDPOINT="" STORAGE_ACCOUNT_NAME="" STORAGE_CONTAINER_NAME="" node createJob.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[createjob]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/createJob.js +[helloworld]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/helloWorld.js +[listcompletedfiles]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/listCompletedFiles.js +[listjobs]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/listJobs.js +[apiref]: https://docs.microsoft.com/javascript/api/ +[freesub]: https://azure.microsoft.com/free/ +[createinstance_de-identificationservice]: https://docs.microsoft.com/javascript/api/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/azure-health-deidentification/README.md diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/createJob.js b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/createJob.js new file mode 100644 index 000000000000..a035f5a0841b --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/createJob.js @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary This sample demonstrates how to create a job which will deidentify all files within a specific folder of a blob storage container. + */ + +const createClient = require("@azure-rest/azure-health-deidentification").default, + { isUnexpected } = require("@azure-rest/azure-health-deidentification"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +async function main() { + const credential = new DefaultAzureCredential(); + const serviceEndpoint = + process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com"; + const storageLocation = `https://${process.env["STORAGE_ACCOUNT_NAME"]}.blob.core.windows.net/${process.env["STORAGE_CONTAINER_NAME"]}`; + const location = storageLocation || "defaultSasUri"; + const OUTPUT_FOLDER = "_output"; + const inputPrefix = "example_patient_1"; + const client = createClient(serviceEndpoint, credential); + const jobName = "exampleJob"; + + const job = { + operation: "Surrogate", + sourceLocation: { location, prefix: inputPrefix }, + targetLocation: { location, prefix: OUTPUT_FOLDER }, + }; + const response = await client.path("/jobs/{name}", jobName).put({ body: job }); + + if (isUnexpected(response)) { + throw response.body.error; + } + + console.log(response.body); +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); + +module.exports = { main }; diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/helloWorld.js b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/helloWorld.js new file mode 100644 index 000000000000..6948684b03cc --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/helloWorld.js @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary This sample demonstrates how to create a `DeidentificationClient` and then deidentify a `string` + */ + +const createClient = require("@azure-rest/azure-health-deidentification").default, + { isUnexpected } = require("@azure-rest/azure-health-deidentification"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +async function main() { + const credential = new DefaultAzureCredential(); + const serviceEndpoint = + process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com"; + const client = createClient(serviceEndpoint, credential); + + const content = { + inputText: "Hello, John!", + }; + + const response = await client.path("/deid").post({ body: content }); + + if (isUnexpected(response)) { + throw response.body.error; + } + + console.log(response.body.outputText); // Hello, Tom! +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); + +module.exports = { main }; diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/listCompletedFiles.js b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/listCompletedFiles.js new file mode 100644 index 000000000000..586e2549d83b --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/listCompletedFiles.js @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary This sample demonstrates how to list files that were completed by a job. + */ + +const createClient = require("@azure-rest/azure-health-deidentification").default, + { isUnexpected, paginate } = require("@azure-rest/azure-health-deidentification"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +async function main() { + const credential = new DefaultAzureCredential(); + const serviceEndpoint = + process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com"; + const storageLocation = `https://${process.env["STORAGE_ACCOUNT_NAME"]}.blob.core.windows.net/${process.env["STORAGE_CONTAINER_NAME"]}`; + const location = storageLocation || "defaultSasUri"; + const OUTPUT_FOLDER = "_output"; + const inputPrefix = "example_patient_1"; + const client = createClient(serviceEndpoint, credential); + const jobName = "exampleJob"; + + const job = { + operation: "Redact", + sourceLocation: { location, prefix: inputPrefix }, + targetLocation: { location, prefix: OUTPUT_FOLDER, overwrite: true }, + customizations: { + redactionFormat: "<{TYPE}>", + }, + }; + + await client.path("/jobs/{name}", jobName).put({ body: job }); + + const response = await client.path("/jobs/{name}/documents", jobName).get(); + + if (isUnexpected(response)) { + throw response.body.error; + } + + const items = []; + const iter = paginate(client, response); + + for await (const item of iter) { + items.push(item); + } + + console.log(items); // items will contain all the completed files +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); + +module.exports = { main }; diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/listJobs.js b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/listJobs.js new file mode 100644 index 000000000000..b51fb0502c41 --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/listJobs.js @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary This sample demonstrates how to list Deidentification jobs and iterate over them. + */ + +const createClient = require("@azure-rest/azure-health-deidentification").default, + { isUnexpected, paginate } = require("@azure-rest/azure-health-deidentification"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +async function main() { + const credential = new DefaultAzureCredential(); + const serviceEndpoint = + process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com"; + const client = createClient(serviceEndpoint, credential); + + const response = await client.path("/jobs").get(); + + if (isUnexpected(response)) { + throw response.body.error; + } + + const items = []; + const iter = paginate(client, response); + for await (const item of iter) { + items.push(item); + } + + console.log(items); // items will contain all the jobs +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); + +module.exports = { main }; diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/package.json b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/package.json new file mode 100644 index 000000000000..1b8118a38d3e --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/package.json @@ -0,0 +1,33 @@ +{ + "name": "@azure-samples/azure-health-deidentification-js", + "private": true, + "version": "1.0.0", + "description": "Health Deidentification Service 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/healthdataaiservices/azure-health-deidentification" + }, + "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/healthdataaiservices/azure-health-deidentification", + "dependencies": { + "@azure-rest/azure-health-deidentification": "latest", + "dotenv": "latest", + "@azure/identity": "^4.4.0" + } +} diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/sample.env b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/sample.env new file mode 100644 index 000000000000..2ff41595523b --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/javascript/sample.env @@ -0,0 +1,5 @@ +# Your De-identification Service URL can be found in the overview section of the Azure Portal. +DEID_SERVICE_ENDPOINT= +# Storage account and container name +STORAGE_ACCOUNT_NAME= +STORAGE_CONTAINER_NAME= diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/README.md b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/README.md new file mode 100644 index 000000000000..c84e322977b1 --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/README.md @@ -0,0 +1,72 @@ +# Health Deidentification Service client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for Health Deidentification Service in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| [createJob.ts][createjob] | This sample demonstrates how to create a job which will deidentify all files within a specific folder of a blob storage container. | +| [helloWorld.ts][helloworld] | This sample demonstrates how to create a `DeidentificationClient` and then deidentify a `string` | +| [listCompletedFiles.ts][listcompletedfiles] | This sample demonstrates how to list files that were completed by a job. | +| [listJobs.ts][listjobs] | This sample demonstrates how to list Deidentification jobs and iterate over them. | + +## 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] and the following Azure resources to run these sample programs: + +- [De-identification Service][createinstance_de-identificationservice] + +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/createJob.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 DEID_SERVICE_ENDPOINT="" STORAGE_ACCOUNT_NAME="" STORAGE_CONTAINER_NAME="" node dist/createJob.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[createjob]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/createJob.ts +[helloworld]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/helloWorld.ts +[listcompletedfiles]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/listCompletedFiles.ts +[listjobs]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/listJobs.ts +[apiref]: https://docs.microsoft.com/javascript/api/ +[freesub]: https://azure.microsoft.com/free/ +[createinstance_de-identificationservice]: https://docs.microsoft.com/javascript/api/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/azure-health-deidentification/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/package.json b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/package.json new file mode 100644 index 000000000000..2d752691dbca --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/package.json @@ -0,0 +1,42 @@ +{ + "name": "@azure-samples/azure-health-deidentification-ts", + "private": true, + "version": "1.0.0", + "description": "Health Deidentification Service 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/healthdataaiservices/azure-health-deidentification" + }, + "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/healthdataaiservices/azure-health-deidentification", + "dependencies": { + "@azure-rest/azure-health-deidentification": "latest", + "dotenv": "latest", + "@azure/identity": "^4.4.0" + }, + "devDependencies": { + "@types/node": "^18.0.0", + "typescript": "~5.6.2", + "rimraf": "latest" + } +} diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/sample.env b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/sample.env new file mode 100644 index 000000000000..2ff41595523b --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/sample.env @@ -0,0 +1,5 @@ +# Your De-identification Service URL can be found in the overview section of the Azure Portal. +DEID_SERVICE_ENDPOINT= +# Storage account and container name +STORAGE_ACCOUNT_NAME= +STORAGE_CONTAINER_NAME= diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/createJob.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/createJob.ts new file mode 100644 index 000000000000..8c847110f3a4 --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/createJob.ts @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary This sample demonstrates how to create a job which will deidentify all files within a specific folder of a blob storage container. + */ + +import createClient, { + DeidentificationJob, + isUnexpected, +} from "@azure-rest/azure-health-deidentification"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main(): Promise { + const credential = new DefaultAzureCredential(); + const serviceEndpoint = + process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com"; + const storageLocation = `https://${process.env["STORAGE_ACCOUNT_NAME"]}.blob.core.windows.net/${process.env["STORAGE_CONTAINER_NAME"]}`; + const location = storageLocation || "defaultSasUri"; + const OUTPUT_FOLDER = "_output"; + const inputPrefix = "example_patient_1"; + const client = createClient(serviceEndpoint, credential); + const jobName = "exampleJob"; + + const job: DeidentificationJob = { + operation: "Surrogate", + sourceLocation: { location, prefix: inputPrefix }, + targetLocation: { location, prefix: OUTPUT_FOLDER }, + }; + const response = await client.path("/jobs/{name}", jobName).put({ body: job }); + + if (isUnexpected(response)) { + throw response.body.error; + } + + console.log(response.body); +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/helloWorld.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/helloWorld.ts new file mode 100644 index 000000000000..a5dc86d297f1 --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/helloWorld.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary This sample demonstrates how to create a `DeidentificationClient` and then deidentify a `string` + */ + +import createClient, { + DeidentificationContent, + isUnexpected, +} from "@azure-rest/azure-health-deidentification"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main(): Promise { + const credential = new DefaultAzureCredential(); + const serviceEndpoint = + process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com"; + const client = createClient(serviceEndpoint, credential); + + const content: DeidentificationContent = { + inputText: "Hello, John!", + }; + + const response = await client.path("/deid").post({ body: content }); + + if (isUnexpected(response)) { + throw response.body.error; + } + + console.log(response.body.outputText); // Hello, Tom! +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/listCompletedFiles.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/listCompletedFiles.ts new file mode 100644 index 000000000000..87856a6f0812 --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/listCompletedFiles.ts @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary This sample demonstrates how to list files that were completed by a job. + */ + +import createClient, { + DeidentificationJob, + isUnexpected, + paginate, +} from "@azure-rest/azure-health-deidentification"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main(): Promise { + const credential = new DefaultAzureCredential(); + const serviceEndpoint = + process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com"; + const storageLocation = `https://${process.env["STORAGE_ACCOUNT_NAME"]}.blob.core.windows.net/${process.env["STORAGE_CONTAINER_NAME"]}`; + const location = storageLocation || "defaultSasUri"; + const OUTPUT_FOLDER = "_output"; + const inputPrefix = "example_patient_1"; + const client = createClient(serviceEndpoint, credential); + const jobName = "exampleJob"; + + const job: DeidentificationJob = { + operation: "Redact", + sourceLocation: { location, prefix: inputPrefix }, + targetLocation: { location, prefix: OUTPUT_FOLDER, overwrite: true }, + customizations: { + redactionFormat: "<{TYPE}>", + } + }; + + await client.path("/jobs/{name}", jobName).put({ body: job }); + + const response = await client.path("/jobs/{name}/documents", jobName).get(); + + if (isUnexpected(response)) { + throw response.body.error; + } + + const items = []; + const iter = paginate(client, response); + + for await (const item of iter) { + items.push(item); + } + + console.log(items); // items will contain all the completed files +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/listJobs.ts b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/listJobs.ts new file mode 100644 index 000000000000..2dc25f3cfab3 --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/src/listJobs.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary This sample demonstrates how to list Deidentification jobs and iterate over them. + */ + +import createClient, { isUnexpected, paginate } from "@azure-rest/azure-health-deidentification"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main(): Promise { + const credential = new DefaultAzureCredential(); + const serviceEndpoint = + process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com"; + const client = createClient(serviceEndpoint, credential); + + const response = await client.path("/jobs").get(); + + if (isUnexpected(response)) { + throw response.body.error; + } + + const items = []; + const iter = paginate(client, response); + for await (const item of iter) { + items.push(item); + } + + console.log(items); // items will contain all the jobs +} + +main().catch((err) => { + console.error("The sample encountered an error:", err); +}); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/tsconfig.json b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/tsconfig.json new file mode 100644 index 000000000000..984eed535aa8 --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/samples/v1/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "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/healthdataaiservices/azure-health-deidentification/src/clientDefinitions.ts b/sdk/healthdataaiservices/azure-health-deidentification/src/clientDefinitions.ts index c153bb2c1725..7618dd5eb42b 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/src/clientDefinitions.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/src/clientDefinitions.ts @@ -1,21 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { +import { GetJobParameters, - CreateJobParameters, + DeidentifyDocumentsParameters, DeleteJobParameters, ListJobsParameters, ListJobDocumentsParameters, CancelJobParameters, - DeidentifyParameters, + DeidentifyTextParameters, } from "./parameters.js"; -import type { +import { GetJob200Response, GetJobDefaultResponse, - CreateJob200Response, - CreateJob201Response, - CreateJobDefaultResponse, + DeidentifyDocuments200Response, + DeidentifyDocuments201Response, + DeidentifyDocumentsDefaultResponse, DeleteJob204Response, DeleteJobDefaultResponse, ListJobs200Response, @@ -24,18 +24,22 @@ import type { ListJobDocumentsDefaultResponse, CancelJob200Response, CancelJobDefaultResponse, - Deidentify200Response, - DeidentifyDefaultResponse, + DeidentifyText200Response, + DeidentifyTextDefaultResponse, } from "./responses.js"; -import type { Client, StreamableMethod } from "@azure-rest/core-client"; +import { Client, StreamableMethod } from "@azure-rest/core-client"; export interface GetJob { /** Resource read operation template. */ get(options?: GetJobParameters): StreamableMethod; /** Long-running resource create or replace operation template. */ put( - options: CreateJobParameters, - ): StreamableMethod; + options: DeidentifyDocumentsParameters, + ): StreamableMethod< + | DeidentifyDocuments200Response + | DeidentifyDocuments201Response + | DeidentifyDocumentsDefaultResponse + >; /** Removes the record of the job from the service. Does not delete any documents. */ delete( options?: DeleteJobParameters, @@ -69,11 +73,11 @@ export interface CancelJob { ): StreamableMethod; } -export interface Deidentify { +export interface DeidentifyText { /** A remote procedure call (RPC) operation. */ post( - options: DeidentifyParameters, - ): StreamableMethod; + options: DeidentifyTextParameters, + ): StreamableMethod; } export interface Routes { @@ -86,7 +90,7 @@ export interface Routes { /** Resource for '/jobs/\{name\}:cancel' has methods for the following verbs: post */ (path: "/jobs/{name}:cancel", name: string): CancelJob; /** Resource for '/deid' has methods for the following verbs: post */ - (path: "/deid"): Deidentify; + (path: "/deid"): DeidentifyText; } export type DeidentificationClient = Client & { diff --git a/sdk/healthdataaiservices/azure-health-deidentification/src/deidentificationClient.ts b/sdk/healthdataaiservices/azure-health-deidentification/src/deidentificationClient.ts index b07991a8ff93..ad76752ab575 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/src/deidentificationClient.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/src/deidentificationClient.ts @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { ClientOptions } from "@azure-rest/core-client"; -import { getClient } from "@azure-rest/core-client"; +import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; -import type { TokenCredential } from "@azure/core-auth"; -import type { DeidentificationClient } from "./clientDefinitions.js"; +import { TokenCredential } from "@azure/core-auth"; +import { DeidentificationClient } from "./clientDefinitions.js"; /** The optional parameters for the client */ export interface DeidentificationClientOptions extends ClientOptions { @@ -22,9 +21,9 @@ export interface DeidentificationClientOptions extends ClientOptions { export default function createClient( endpointParam: string, credentials: TokenCredential, - { apiVersion = "2024-07-12-preview", ...options }: DeidentificationClientOptions = {}, + { apiVersion = "2024-11-15", ...options }: DeidentificationClientOptions = {}, ): DeidentificationClient { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://${endpointParam}`; + const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`; const userAgentInfo = `azsdk-js-health-deidentification-rest/1.0.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix @@ -60,5 +59,6 @@ export default function createClient( return next(req); }, }); + return client; } diff --git a/sdk/healthdataaiservices/azure-health-deidentification/src/isUnexpected.ts b/sdk/healthdataaiservices/azure-health-deidentification/src/isUnexpected.ts index b99766aa2f8b..2f22cafd8f4f 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/src/isUnexpected.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/src/isUnexpected.ts @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { +import { GetJob200Response, GetJobDefaultResponse, - CreateJob200Response, - CreateJob201Response, - CreateJobLogicalResponse, - CreateJobDefaultResponse, + DeidentifyDocuments200Response, + DeidentifyDocuments201Response, + DeidentifyDocumentsLogicalResponse, + DeidentifyDocumentsDefaultResponse, DeleteJob204Response, DeleteJobDefaultResponse, ListJobs200Response, @@ -16,8 +16,8 @@ import type { ListJobDocumentsDefaultResponse, CancelJob200Response, CancelJobDefaultResponse, - Deidentify200Response, - DeidentifyDefaultResponse, + DeidentifyText200Response, + DeidentifyTextDefaultResponse, } from "./responses.js"; const responseMap: Record = { @@ -35,11 +35,11 @@ export function isUnexpected( ): response is GetJobDefaultResponse; export function isUnexpected( response: - | CreateJob200Response - | CreateJob201Response - | CreateJobLogicalResponse - | CreateJobDefaultResponse, -): response is CreateJobDefaultResponse; + | DeidentifyDocuments200Response + | DeidentifyDocuments201Response + | DeidentifyDocumentsLogicalResponse + | DeidentifyDocumentsDefaultResponse, +): response is DeidentifyDocumentsDefaultResponse; export function isUnexpected( response: DeleteJob204Response | DeleteJobDefaultResponse, ): response is DeleteJobDefaultResponse; @@ -53,16 +53,16 @@ export function isUnexpected( response: CancelJob200Response | CancelJobDefaultResponse, ): response is CancelJobDefaultResponse; export function isUnexpected( - response: Deidentify200Response | DeidentifyDefaultResponse, -): response is DeidentifyDefaultResponse; + response: DeidentifyText200Response | DeidentifyTextDefaultResponse, +): response is DeidentifyTextDefaultResponse; export function isUnexpected( response: | GetJob200Response | GetJobDefaultResponse - | CreateJob200Response - | CreateJob201Response - | CreateJobLogicalResponse - | CreateJobDefaultResponse + | DeidentifyDocuments200Response + | DeidentifyDocuments201Response + | DeidentifyDocumentsLogicalResponse + | DeidentifyDocumentsDefaultResponse | DeleteJob204Response | DeleteJobDefaultResponse | ListJobs200Response @@ -71,16 +71,16 @@ export function isUnexpected( | ListJobDocumentsDefaultResponse | CancelJob200Response | CancelJobDefaultResponse - | Deidentify200Response - | DeidentifyDefaultResponse, + | DeidentifyText200Response + | DeidentifyTextDefaultResponse, ): response is | GetJobDefaultResponse - | CreateJobDefaultResponse + | DeidentifyDocumentsDefaultResponse | DeleteJobDefaultResponse | ListJobsDefaultResponse | ListJobDocumentsDefaultResponse | CancelJobDefaultResponse - | DeidentifyDefaultResponse { + | DeidentifyTextDefaultResponse { const lroOriginal = response.headers["x-ms-original-url"]; const url = new URL(lroOriginal ?? response.request.url); const method = response.request.method; diff --git a/sdk/healthdataaiservices/azure-health-deidentification/src/models.ts b/sdk/healthdataaiservices/azure-health-deidentification/src/models.ts index 14f321c93294..616dded323f6 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/src/models.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/src/models.ts @@ -3,24 +3,18 @@ /** A job containing a batch of documents to de-identify. */ export interface DeidentificationJob { - /** Storage location to perform the operation on. */ - sourceLocation: SourceStorageLocation; - /** Target location to store output of operation. */ - targetLocation: TargetStorageLocation; /** * Operation to perform on the input documents. * * Possible values: "Redact", "Surrogate", "Tag" */ - operation?: OperationType; - /** - * Data type of the input documents. - * - * Possible values: "Plaintext" - */ - dataType?: DocumentDataType; - /** Format of the redacted output. Only valid when Operation is Redact. */ - redactionFormat?: string; + operation?: DeidentificationOperationType; + /** Storage location to perform the operation on. */ + sourceLocation: SourceStorageLocation; + /** Target location to store output of operation. */ + targetLocation: TargetStorageLocation; + /** Customization parameters to override default service behaviors. */ + customizations?: DeidentificationJobCustomizationOptions; } /** Storage location. */ @@ -37,12 +31,34 @@ export interface SourceStorageLocation { export interface TargetStorageLocation { /** URL to storage location. */ location: string; - /** Prefix to filter path by. */ + /** + * Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure. + * + * Example: + * File full path: documents/user/note.txt + * Input Prefix: "documents/user/" + * Output Prefix: "output_docs/" + * + * Output file: "output_docs/note.txt" + */ prefix: string; + /** When set to true during a job, the service will overwrite the output location if it already exists. */ + overwrite?: boolean; +} + +/** Customizations options to override default service behaviors for job usage. */ +export interface DeidentificationJobCustomizationOptions { + /** + * Format of the redacted output. Only valid when Operation is Redact. + * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details. + */ + redactionFormat?: string; + /** Locale in which the output surrogates are written. */ + surrogateLocale?: string; } /** Summary metrics of a job. */ -export interface JobSummary { +export interface DeidentificationJobSummary { /** Number of documents that have completed. */ successful: number; /** Number of documents that have failed. */ @@ -60,24 +76,27 @@ export interface DeidentificationContent { /** Input text to de-identify. */ inputText: string; /** - * Operation to perform on the input. + * Operation to perform on the input documents. * * Possible values: "Redact", "Surrogate", "Tag" */ - operation?: OperationType; + operation?: DeidentificationOperationType; + /** Customization parameters to override default service behaviors. */ + customizations?: DeidentificationCustomizationOptions; +} + +/** Customizations options to override default service behaviors for synchronous usage. */ +export interface DeidentificationCustomizationOptions { /** - * Data type of the input. - * - * Possible values: "Plaintext" + * Format of the redacted output. Only valid when Operation is Redact. + * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details. */ - dataType?: DocumentDataType; - /** Format of the redacted output. Only valid when OperationType is "Redact". */ redactionFormat?: string; + /** Locale in which the output surrogates are written. */ + surrogateLocale?: string; } -/** Alias for OperationType */ -export type OperationType = string; -/** Alias for DocumentDataType */ -export type DocumentDataType = string; -/** Alias for JobStatus */ -export type JobStatus = string; +/** Alias for DeidentificationOperationType */ +export type DeidentificationOperationType = string; +/** Alias for OperationState */ +export type OperationState = string; diff --git a/sdk/healthdataaiservices/azure-health-deidentification/src/outputModels.ts b/sdk/healthdataaiservices/azure-health-deidentification/src/outputModels.ts index a336f45fe532..d092a1df4d4f 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/src/outputModels.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/src/outputModels.ts @@ -1,37 +1,30 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { Paged } from "@azure/core-paging"; -import type { ErrorModel } from "@azure-rest/core-client"; +import { ErrorModel } from "@azure-rest/core-client"; /** A job containing a batch of documents to de-identify. */ export interface DeidentificationJobOutput { /** The name of a job. */ readonly name: string; - /** Storage location to perform the operation on. */ - sourceLocation: SourceStorageLocationOutput; - /** Target location to store output of operation. */ - targetLocation: TargetStorageLocationOutput; /** * Operation to perform on the input documents. * * Possible values: "Redact", "Surrogate", "Tag" */ - operation?: OperationTypeOutput; - /** - * Data type of the input documents. - * - * Possible values: "Plaintext" - */ - dataType?: DocumentDataTypeOutput; - /** Format of the redacted output. Only valid when Operation is Redact. */ - redactionFormat?: string; + operation?: DeidentificationOperationTypeOutput; + /** Storage location to perform the operation on. */ + sourceLocation: SourceStorageLocationOutput; + /** Target location to store output of operation. */ + targetLocation: TargetStorageLocationOutput; + /** Customization parameters to override default service behaviors. */ + customizations?: DeidentificationJobCustomizationOptionsOutput; /** * Current status of a job. * - * Possible values: "NotStarted", "Running", "Succeeded", "PartialFailed", "Failed", "Canceled" + * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" */ - readonly status: JobStatusOutput; + readonly status: OperationStateOutput; /** Error when job fails in it's entirety. */ readonly error?: ErrorModel; /** @@ -47,7 +40,7 @@ export interface DeidentificationJobOutput { /** Date and time when the job was started. */ readonly startedAt?: string; /** Summary of a job. Exists only when the job is completed. */ - readonly summary?: JobSummaryOutput; + readonly summary?: DeidentificationJobSummaryOutput; } /** Storage location. */ @@ -64,12 +57,34 @@ export interface SourceStorageLocationOutput { export interface TargetStorageLocationOutput { /** URL to storage location. */ location: string; - /** Prefix to filter path by. */ + /** + * Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure. + * + * Example: + * File full path: documents/user/note.txt + * Input Prefix: "documents/user/" + * Output Prefix: "output_docs/" + * + * Output file: "output_docs/note.txt" + */ prefix: string; + /** When set to true during a job, the service will overwrite the output location if it already exists. */ + overwrite?: boolean; +} + +/** Customizations options to override default service behaviors for job usage. */ +export interface DeidentificationJobCustomizationOptionsOutput { + /** + * Format of the redacted output. Only valid when Operation is Redact. + * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details. + */ + redactionFormat?: string; + /** Locale in which the output surrogates are written. */ + surrogateLocale?: string; } /** Summary metrics of a job. */ -export interface JobSummaryOutput { +export interface DeidentificationJobSummaryOutput { /** Number of documents that have completed. */ successful: number; /** Number of documents that have failed. */ @@ -82,14 +97,30 @@ export interface JobSummaryOutput { bytesProcessed: number; } +/** Paged collection of DeidentificationJob items */ +export interface PagedDeidentificationJobOutput { + /** The DeidentificationJob items on this page */ + value: Array; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Paged collection of DeidentificationDocumentDetails items */ +export interface PagedDeidentificationDocumentDetailsOutput { + /** The DeidentificationDocumentDetails items on this page */ + value: Array; + /** The link to the next page of items */ + nextLink?: string; +} + /** Details of a single document in a job. */ -export interface DocumentDetailsOutput { +export interface DeidentificationDocumentDetailsOutput { /** Id of the document details. */ readonly id: string; /** Location for the input. */ - input: DocumentLocationOutput; + input: DeidentificationDocumentLocationOutput; /** Location for the output. */ - output?: DocumentLocationOutput; + output?: DeidentificationDocumentLocationOutput; /** * Status of the document. * @@ -101,9 +132,9 @@ export interface DocumentDetailsOutput { } /** Location of a document. */ -export interface DocumentLocationOutput { - /** Path of document in storage. */ - path: string; +export interface DeidentificationDocumentLocationOutput { + /** Location of document in storage. */ + location: string; /** The entity tag for this resource. */ readonly etag: string; } @@ -120,10 +151,6 @@ export interface DeidentificationResultOutput { export interface PhiTaggerResultOutput { /** List of entities detected in the input. */ entities: Array; - /** Path to the document in storage. */ - path?: string; - /** The entity tag for this resource. */ - etag?: string; } /** PHI Entity tag in the input. */ @@ -162,16 +189,8 @@ export interface StringIndexOutput { codePoint: number; } -/** Alias for OperationTypeOutput */ -export type OperationTypeOutput = string; -/** Alias for DocumentDataTypeOutput */ -export type DocumentDataTypeOutput = string; -/** Alias for JobStatusOutput */ -export type JobStatusOutput = string; -/** Paged collection of DeidentificationJob items */ -export type PagedDeidentificationJobOutput = Paged; -/** Paged collection of DocumentDetails items */ -export type PagedDocumentDetailsOutput = Paged; +/** Alias for DeidentificationOperationTypeOutput */ +export type DeidentificationOperationTypeOutput = string; /** Alias for OperationStateOutput */ export type OperationStateOutput = string; /** Alias for PhiCategoryOutput */ diff --git a/sdk/healthdataaiservices/azure-health-deidentification/src/paginateHelper.ts b/sdk/healthdataaiservices/azure-health-deidentification/src/paginateHelper.ts index 5d541b4e406d..a5ee77d86caf 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/src/paginateHelper.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/src/paginateHelper.ts @@ -1,10 +1,146 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { PagedAsyncIterableIterator, PagedResult } from "@azure/core-paging"; -import { getPagedAsyncIterator } from "@azure/core-paging"; -import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; -import { createRestError } from "@azure-rest/core-client"; +import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, + TLink = string, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + (((settings?: PageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken as unknown as TLink | undefined, + }); + }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + const firstVal = await pages.next(); + // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is + if (!Array.isArray(firstVal.value)) { + // can extract elements from this page + const { toElements } = pagedResult; + if (toElements) { + yield* toElements(firstVal.value) as TElement[]; + for await (const page of pages) { + yield* toElements(page) as TElement[]; + } + } else { + yield firstVal.value; + // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case + yield* pages as unknown as AsyncIterableIterator; + } + } else { + yield* firstVal.value; + for await (const page of pages) { + // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, + // it must be the case that `TPage = TElement[]` + yield* page as unknown as TElement[]; + } + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: TLink; + } = {}, +): AsyncIterableIterator { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + yield response.page; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + yield response.page; + } +} + +/** + * An interface that tracks the settings for paged iteration + */ +export interface PageSettings { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +} + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator; +} + +/** + * An interface that describes how to communicate with the service. + */ +interface PagedResult { + /** + * Link to the first page of results. + */ + firstPageLink: TLink; + /** + * A method that returns a page of results. + */ + getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => unknown[]; +} /** * Helper type to extract the type of an array @@ -14,10 +150,7 @@ export type GetArrayType = T extends Array ? TData : never; /** * The type of a custom function that defines how to get a page and a link to the next one if any. */ -export type GetPage = ( - pageLink: string, - maxPageSize?: number, -) => Promise<{ +export type GetPage = (pageLink: string) => Promise<{ page: TPage; nextPageLink?: string; }>; diff --git a/sdk/healthdataaiservices/azure-health-deidentification/src/parameters.ts b/sdk/healthdataaiservices/azure-health-deidentification/src/parameters.ts index 22d840140ea7..06a061c1fa87 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/src/parameters.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/src/parameters.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; -import type { RequestParameters } from "@azure-rest/core-client"; -import type { DeidentificationJob, DeidentificationContent } from "./models.js"; +import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; +import { RequestParameters } from "@azure-rest/core-client"; +import { DeidentificationJob, DeidentificationContent } from "./models.js"; export interface GetJobHeaders { /** An opaque, globally-unique, client-generated string identifier for the request. */ @@ -16,21 +16,23 @@ export interface GetJobHeaderParam { export type GetJobParameters = GetJobHeaderParam & RequestParameters; -export interface CreateJobHeaders { +export interface DeidentifyDocumentsHeaders { /** An opaque, globally-unique, client-generated string identifier for the request. */ "x-ms-client-request-id"?: string; } -export interface CreateJobBodyParam { +export interface DeidentifyDocumentsBodyParam { /** The resource instance. */ body: DeidentificationJob; } -export interface CreateJobHeaderParam { - headers?: RawHttpHeadersInput & CreateJobHeaders; +export interface DeidentifyDocumentsHeaderParam { + headers?: RawHttpHeadersInput & DeidentifyDocumentsHeaders; } -export type CreateJobParameters = CreateJobHeaderParam & CreateJobBodyParam & RequestParameters; +export type DeidentifyDocumentsParameters = DeidentifyDocumentsHeaderParam & + DeidentifyDocumentsBodyParam & + RequestParameters; export interface ListJobsHeaders { /** An opaque, globally-unique, client-generated string identifier for the request. */ @@ -100,9 +102,20 @@ export interface DeleteJobHeaderParam { export type DeleteJobParameters = DeleteJobHeaderParam & RequestParameters; -export interface DeidentifyBodyParam { +export interface DeidentifyTextHeaders { + /** An opaque, globally-unique, client-generated string identifier for the request. */ + "x-ms-client-request-id"?: string; +} + +export interface DeidentifyTextBodyParam { /** Request body for de-identification operation. */ body: DeidentificationContent; } -export type DeidentifyParameters = DeidentifyBodyParam & RequestParameters; +export interface DeidentifyTextHeaderParam { + headers?: RawHttpHeadersInput & DeidentifyTextHeaders; +} + +export type DeidentifyTextParameters = DeidentifyTextHeaderParam & + DeidentifyTextBodyParam & + RequestParameters; diff --git a/sdk/healthdataaiservices/azure-health-deidentification/src/pollingHelper.ts b/sdk/healthdataaiservices/azure-health-deidentification/src/pollingHelper.ts index 5abda1a6550f..9d048d5e945b 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/src/pollingHelper.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/src/pollingHelper.ts @@ -1,21 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { Client, HttpResponse } from "@azure-rest/core-client"; -import type { AbortSignalLike } from "@azure/abort-controller"; -import type { +import { Client, HttpResponse } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { CancelOnProgress, CreateHttpPollerOptions, RunningOperation, OperationResponse, OperationState, + createHttpPoller, } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import type { - CreateJob200Response, - CreateJob201Response, - CreateJobDefaultResponse, - CreateJobLogicalResponse, +import { + DeidentifyDocuments200Response, + DeidentifyDocuments201Response, + DeidentifyDocumentsDefaultResponse, + DeidentifyDocumentsLogicalResponse, } from "./responses.js"; /** @@ -92,10 +92,13 @@ export interface SimplePollerLike, TResul * @returns - A poller object to poll for operation state updates and eventually get the final response. */ export async function getLongRunningPoller< - TResult extends CreateJobLogicalResponse | CreateJobDefaultResponse, + TResult extends DeidentifyDocumentsLogicalResponse | DeidentifyDocumentsDefaultResponse, >( client: Client, - initialResponse: CreateJob200Response | CreateJob201Response | CreateJobDefaultResponse, + initialResponse: + | DeidentifyDocuments200Response + | DeidentifyDocuments201Response + | DeidentifyDocumentsDefaultResponse, options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller( diff --git a/sdk/healthdataaiservices/azure-health-deidentification/src/responses.ts b/sdk/healthdataaiservices/azure-health-deidentification/src/responses.ts index 0db6d44e9749..54af3ed0d23b 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/src/responses.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/src/responses.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import type { HttpResponse, ErrorResponse } from "@azure-rest/core-client"; -import type { +import { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import { HttpResponse, ErrorResponse } from "@azure-rest/core-client"; +import { DeidentificationJobOutput, PagedDeidentificationJobOutput, - PagedDocumentDetailsOutput, + PagedDeidentificationDocumentDetailsOutput, DeidentificationResultOutput, } from "./outputModels.js"; @@ -33,7 +33,7 @@ export interface GetJobDefaultResponse extends HttpResponse { headers: RawHttpHeaders & GetJobDefaultHeaders; } -export interface CreateJob200Headers { +export interface DeidentifyDocuments200Headers { /** An opaque, globally-unique, client-generated string identifier for the request. */ "x-ms-client-request-id"?: string; /** The location for monitoring the operation state. */ @@ -41,13 +41,13 @@ export interface CreateJob200Headers { } /** The request has succeeded. */ -export interface CreateJob200Response extends HttpResponse { +export interface DeidentifyDocuments200Response extends HttpResponse { status: "200"; body: DeidentificationJobOutput; - headers: RawHttpHeaders & CreateJob200Headers; + headers: RawHttpHeaders & DeidentifyDocuments200Headers; } -export interface CreateJob201Headers { +export interface DeidentifyDocuments201Headers { /** An opaque, globally-unique, client-generated string identifier for the request. */ "x-ms-client-request-id"?: string; /** The location for monitoring the operation state. */ @@ -55,25 +55,25 @@ export interface CreateJob201Headers { } /** The request has succeeded and a new resource has been created as a result. */ -export interface CreateJob201Response extends HttpResponse { +export interface DeidentifyDocuments201Response extends HttpResponse { status: "201"; body: DeidentificationJobOutput; - headers: RawHttpHeaders & CreateJob201Headers; + headers: RawHttpHeaders & DeidentifyDocuments201Headers; } -export interface CreateJobDefaultHeaders { +export interface DeidentifyDocumentsDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface CreateJobDefaultResponse extends HttpResponse { +export interface DeidentifyDocumentsDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & CreateJobDefaultHeaders; + headers: RawHttpHeaders & DeidentifyDocumentsDefaultHeaders; } -/** The final response for long-running createJob operation */ -export interface CreateJobLogicalResponse extends HttpResponse { +/** The final response for long-running deidentifyDocuments operation */ +export interface DeidentifyDocumentsLogicalResponse extends HttpResponse { status: "200"; body: DeidentificationJobOutput; } @@ -109,7 +109,7 @@ export interface ListJobDocuments200Headers { /** The request has succeeded. */ export interface ListJobDocuments200Response extends HttpResponse { status: "200"; - body: PagedDocumentDetailsOutput; + body: PagedDeidentificationDocumentDetailsOutput; headers: RawHttpHeaders & ListJobDocuments200Headers; } @@ -169,19 +169,25 @@ export interface DeleteJobDefaultResponse extends HttpResponse { headers: RawHttpHeaders & DeleteJobDefaultHeaders; } +export interface DeidentifyText200Headers { + /** An opaque, globally-unique, client-generated string identifier for the request. */ + "x-ms-client-request-id"?: string; +} + /** The request has succeeded. */ -export interface Deidentify200Response extends HttpResponse { +export interface DeidentifyText200Response extends HttpResponse { status: "200"; body: DeidentificationResultOutput; + headers: RawHttpHeaders & DeidentifyText200Headers; } -export interface DeidentifyDefaultHeaders { +export interface DeidentifyTextDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface DeidentifyDefaultResponse extends HttpResponse { +export interface DeidentifyTextDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & DeidentifyDefaultHeaders; + headers: RawHttpHeaders & DeidentifyTextDefaultHeaders; } diff --git a/sdk/healthdataaiservices/azure-health-deidentification/test/public/data/example_patient_1/row-2-data.txt b/sdk/healthdataaiservices/azure-health-deidentification/test/public/data/example_patient_1/row-2-data.txt new file mode 100644 index 000000000000..6fc315d75c92 --- /dev/null +++ b/sdk/healthdataaiservices/azure-health-deidentification/test/public/data/example_patient_1/row-2-data.txt @@ -0,0 +1,54 @@ +"CHIEF COMPLAINT + +Follow-up of chronic problems. + +HISTORY OF PRESENT ILLNESS + +Brian White is a 58-year-old male with a past medical history significant for congestive heart failure and hypertension, who presents today for follow-up of his chronic problems. + +The patient states he has been feeling out of sorts lately. He is not sure if it is due to the change in the seasons or due to performing lots of projects and some construction on his home. He reports fatigue and lightheadedness. This has been going on for about 5 weeks. While exerting energy, he has experienced some shortness of breath and chest cramps. The patient also notes a slight cough, but he is not sure if it is just the change in seasons. + +He feels bloated every once in a while. His diet has been a little bit of a struggle. They had construction on their kitchen begin over Labor Day weekend, and have been eating less healthy food as a result. + +Regarding his heart failure, he has been pretty good with his salt intake. He has been pretty good about his diet since the last year and is staying on top of that as much as possible. The patient has continued to utilize Lasix daily. + +For his hypertension, this has been well controlled with lisinopril 20 mg a day. He has continued to monitor his blood pressure regularly. + +The patient did the review of systems sheet when he checked in. He denies weight gain, swelling in the lower extremities, fevers, chills, dizziness, nausea, vomiting, and diarrhea. + +REVIEW OF SYSTEMS + + Constitutional: Endorses fatigue. Denies fevers, chills, or weight loss. + Cardiovascular: Endorses chest pain or dyspnea on exertion. + Respiratory: Endorses cough and shortness of breath. + Gastrointestinal: Endorses bloating. + +PHYSICAL EXAMINATION + + Neck: JVD 8 cm. + Respiratory: Rales bilateral bases. + Cardiovascular: 3/6 systolic ejection murmur. + Musculoskeletal: 1+ pitting edema bilateral lower extremities. + +RESULTS + +X-ray of the chest demonstrates a mild amount of fluid in the lungs. + +Echocardiogram demonstrates decreased ejection fraction of 45% and mild mitral regurgitation. + +ASSESSMENT AND PLAN + +Brian White is a 58-year-old male with a past medical history significant for congestive heart failure and hypertension, who presents today for follow up of his chronic problems. + +Congestive heart failure. + Medical Reasoning: The patient reports increased fatigue, dizziness, and chest discomfort on exertion. He also exhibits some jugular venous distention, lung base crackles, and lower extremity edema on exam today. He has been compliant with his current medications but admits to dietary indiscretion lately. His recent echocardiogram demonstrated a reduced ejection fraction of 45%, as well as mitral regurgitation. + Additional Testing: We will order a repeat echocardiogram. + Medical Treatment: Increase Lasix to 80 mg daily. + Patient Education and Counseling: I advised the patient to monitor and record his daily weight and report those to me via the patient portal. He will contact me should he continue to experience any dyspnea. + +Hypertension. + Medical Reasoning: This is well controlled based on home monitoring. + Medical Treatment: Continue lisinopril 20 mg daily. + Patient Education and Counseling: I advised him to monitor and record his blood pressures at home and report these to me via the patient portal. + +Patient Agreements: The patient understands and agrees with the recommended medical treatment plan." \ No newline at end of file diff --git a/sdk/healthdataaiservices/azure-health-deidentification/test/public/jobOperationsTest.spec.ts b/sdk/healthdataaiservices/azure-health-deidentification/test/public/jobOperationsTest.spec.ts index fe2fc07180f2..0416d1b74e7c 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/test/public/jobOperationsTest.spec.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/test/public/jobOperationsTest.spec.ts @@ -11,7 +11,10 @@ import { assert, beforeEach, afterEach, it, describe } from "vitest"; import type { DeidentificationClient } from "../../src/clientDefinitions.js"; import { createTestCredential } from "@azure-tools/test-credential"; import type { DeidentificationJob } from "../../src/models.js"; -import type { DeidentificationJobOutput, DocumentDetailsOutput } from "../../src/outputModels.js"; +import type { + DeidentificationJobOutput, + DeidentificationDocumentDetailsOutput, +} from "../../src/outputModels.js"; import type { Recorder } from "@azure-tools/test-recorder"; import { isPlaybackMode, isRecordMode } from "@azure-tools/test-recorder"; import type { ErrorResponse } from "@azure-rest/core-client"; @@ -24,18 +27,21 @@ const testPollingOptions = { }; const TEST_TIMEOUT_MS: number = 200000; +const NUMBER_OF_DOCUMENTS = 3; -const fakeServiceEndpoint = "example.com"; +const fakeServiceEndpoint = "https://example.api.deid.azure.com"; +const fakeContinuationTokenSegment = "continuationToken=1234567890"; const replaceableVariables: Record = { DEID_SERVICE_ENDPOINT: fakeServiceEndpoint, STORAGE_ACCOUNT_LOCATION: "https://fake_storage_account_sas_uri.blob.core.windows.net/container-sdk-dev-fakeid", + CONTINUATION_TOKEN: fakeContinuationTokenSegment, }; const generateJobName = (testName?: string): string => { let jobName = "js-sdk-job-" + Date.now(); if (isPlaybackMode() || isRecordMode()) { - jobName = `js-sdk-job-recorded-${testName}`; + jobName = `js-job-recorded-${testName}`; } return jobName; }; @@ -55,9 +61,21 @@ describe("Batch", () => { bodyKeySanitizers: [ { value: replaceableVariables.STORAGE_ACCOUNT_LOCATION, - jsonPath: "$..location", + jsonPath: "$..sourceLocation.location", regex: "^(?!.*FAKE_STORAGE_ACCOUNT).*", }, + { + value: replaceableVariables.STORAGE_ACCOUNT_LOCATION, + jsonPath: "$..targetLocation.location", + regex: "^(?!.*FAKE_STORAGE_ACCOUNT).*", + }, + ], + generalSanitizers: [ + { + regex: true, + value: replaceableVariables.CONTINUATION_TOKEN, + target: "continuationToken=[A-Za-z0-9%._~-]+", + }, ], }, removeCentralSanitizers: ["AZSDK4001", "AZSDK2030", "AZSDK3430", "AZSDK3493"], @@ -85,19 +103,23 @@ describe("Batch", () => { : getStorageAccountLocation(); const job: DeidentificationJob = { - dataType: "Plaintext", operation: "Surrogate", sourceLocation: { location: storageAccountLocation, prefix: inputPrefix, extensions: ["*"], }, - targetLocation: { location: storageAccountLocation, prefix: OUTPUT_FOLDER }, + targetLocation: { + location: storageAccountLocation, + prefix: OUTPUT_FOLDER, + overwrite: true, + }, }; const jobOutput = await client.path("/jobs/{name}", jobName).put({ body: job }); if (isUnexpected(jobOutput)) { + console.log(jobOutput["body"]); throw new Error("Unexpected job result"); } @@ -108,7 +130,10 @@ describe("Batch", () => { assert.isUndefined(jobOutput.body.startedAt, "Job should not have startedAt"); assert.equal("NotStarted", jobOutput.body.status, "Job status should be NotStarted"); assert.isUndefined(jobOutput.body.error, "Job should not have error"); - assert.isUndefined(jobOutput.body.redactionFormat, "Job should not have redactionFormat"); + assert.isUndefined( + jobOutput.body.customizations?.redactionFormat, + "Job should not have redactionFormat", + ); assert.isUndefined(jobOutput.body.summary, "Job should not have summary"); assert.equal( inputPrefix, @@ -142,14 +167,17 @@ describe("Batch", () => { : getStorageAccountLocation(); const job: DeidentificationJob = { - dataType: "Plaintext", operation: "Surrogate", sourceLocation: { location: storageAccountLocation, prefix: inputPrefix, extensions: ["*"], }, - targetLocation: { location: storageAccountLocation, prefix: OUTPUT_FOLDER }, + targetLocation: { + location: storageAccountLocation, + prefix: OUTPUT_FOLDER, + overwrite: true, + }, }; const initialResponse = await client.path("/jobs/{name}", jobName).put({ body: job }); @@ -158,7 +186,7 @@ describe("Batch", () => { assert.equal(poller.getOperationState().status, "running"); // Test list jobs with pagination - const jobs = await client.path("/jobs").get(); + const jobs = await client.path("/jobs").get({ queryParameters: { maxpagesize: 2 } }); const items = []; const iter = paginate(client, jobs); for await (const item of iter) { @@ -172,7 +200,10 @@ describe("Batch", () => { assert.isNotNull(foundJob!.startedAt, "Job should have startedAt"); assert.equal("NotStarted", foundJob!.status, "Job status should be NotStarted"); assert.isUndefined(foundJob!.error, "Job should not have error"); - assert.isUndefined(foundJob!.redactionFormat, "Job should not have redactionFormat"); + assert.isUndefined( + foundJob!.customizations?.redactionFormat, + "Job should not have redactionFormat", + ); assert.isUndefined(foundJob!.summary, "Job should not have summary"); assert.equal( inputPrefix, @@ -206,14 +237,17 @@ describe("Batch", () => { : getStorageAccountLocation(); const job: DeidentificationJob = { - dataType: "Plaintext", operation: "Surrogate", sourceLocation: { location: storageAccountLocation, prefix: inputPrefix, extensions: ["*"], }, - targetLocation: { location: storageAccountLocation, prefix: OUTPUT_FOLDER }, + targetLocation: { + location: storageAccountLocation, + prefix: OUTPUT_FOLDER, + overwrite: true, + }, }; const initialResponse = await client.path("/jobs/{name}", jobName).put({ body: job }); @@ -229,14 +263,22 @@ describe("Batch", () => { assert.equal(finalJobOutput.body.status, "Succeeded", "Job status should be Succeeded"); assert.notEqual(finalJobOutput.body.startedAt, null, "Job should have startedAt"); assert.notEqual(finalJobOutput.body.summary, null, "Job should have summary"); - assert.equal(finalJobOutput.body.summary!.total, 2, "Job should have processed 2 documents"); + assert.equal( + finalJobOutput.body.summary!.total, + NUMBER_OF_DOCUMENTS, + `Job should have processed ${NUMBER_OF_DOCUMENTS} documents`, + ); assert.equal( finalJobOutput.body.summary!.successful, - 2, - "Job should have succeeded 2 documents", + NUMBER_OF_DOCUMENTS, + `Job should have succeeded ${NUMBER_OF_DOCUMENTS} documents`, ); - const reports = await client.path("/jobs/{name}/documents", jobName).get(); + const reports = await client.path("/jobs/{name}/documents", jobName).get({ + queryParameters: { + maxpagesize: 2, + }, + }); if (isUnexpected(reports)) { throw new Error("Unexpected error occurred"); @@ -250,21 +292,26 @@ describe("Batch", () => { } assert.isTrue( - (items as unknown[] as DocumentDetailsOutput[]).length === 2, - "Should have 2 documents", + (items as unknown[] as DeidentificationDocumentDetailsOutput[]).length === + NUMBER_OF_DOCUMENTS, + `Should have ${NUMBER_OF_DOCUMENTS} documents`, ); assert.isTrue( - (items as unknown[] as DocumentDetailsOutput[]).every((obj) => obj.status === "Succeeded"), + (items as unknown[] as DeidentificationDocumentDetailsOutput[]).every( + (obj) => obj.status === "Succeeded", + ), "All documents should have succeeded", ); assert.isTrue( - (items as unknown[] as DocumentDetailsOutput[]).every((obj) => - obj.output!.path.startsWith(OUTPUT_FOLDER), + (items as unknown[] as DeidentificationDocumentDetailsOutput[]).every((obj) => + obj.output!.location.includes(OUTPUT_FOLDER), ), - "Output path should start with the output folder", + "Output path location should contain the output folder", ); assert.isTrue( - (items as unknown[] as DocumentDetailsOutput[]).every((obj) => obj.id.length === 36), + (items as unknown[] as DeidentificationDocumentDetailsOutput[]).every( + (obj) => obj.id.length === 36, + ), "Document id should be a GUID", ); }, @@ -281,14 +328,17 @@ describe("Batch", () => { : getStorageAccountLocation(); const job: DeidentificationJob = { - dataType: "Plaintext", operation: "Surrogate", sourceLocation: { location: storageAccountLocation, prefix: inputPrefix, extensions: ["*"], }, - targetLocation: { location: storageAccountLocation, prefix: OUTPUT_FOLDER }, + targetLocation: { + location: storageAccountLocation, + prefix: OUTPUT_FOLDER, + overwrite: true, + }, }; const initialResponse = await client.path("/jobs/{name}", jobName).put({ body: job }); @@ -319,7 +369,6 @@ describe("Batch", () => { const storageAccountLocation = "FAKE_STORAGE_ACCOUNT"; const job: DeidentificationJob = { - dataType: "Plaintext", operation: "Surrogate", sourceLocation: { location: storageAccountLocation, diff --git a/sdk/healthdataaiservices/azure-health-deidentification/test/public/realtimeOperationsTest.spec.ts b/sdk/healthdataaiservices/azure-health-deidentification/test/public/realtimeOperationsTest.spec.ts index 793a2bc36b90..4f07d7ce4838 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/test/public/realtimeOperationsTest.spec.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/test/public/realtimeOperationsTest.spec.ts @@ -10,10 +10,11 @@ import type { DeidentificationContent } from "../../src/models.js"; import type { DeidentificationResultOutput } from "../../src/outputModels.js"; import type { Recorder } from "@azure-tools/test-recorder"; -const fakeServiceEndpoint = "example.com"; +const fakeServiceEndpoint = "https://example.api.deid.azure.com"; const replaceableVariables: Record = { DEID_SERVICE_ENDPOINT: fakeServiceEndpoint, }; +const inputText = "Hello, my name is John Smith."; describe("Realtime", () => { let recorder: Recorder; @@ -39,9 +40,11 @@ describe("Realtime", () => { it("surrogate returns expected", async function () { const content: DeidentificationContent = { - dataType: "Plaintext", - inputText: "Hello, my name is John Smith.", + inputText: inputText, operation: "Surrogate", + customizations: { + surrogateLocale: "en-US", + }, }; const response = await client.path("/deid").post({ body: content }); assert.equal(response.status, "200"); @@ -65,10 +68,33 @@ describe("Realtime", () => { ); }, 10000); + it("redact returns expected", async function () { + const content: DeidentificationContent = { + inputText: inputText, + operation: "Redact", + customizations: { + redactionFormat: "*{len}", + }, + }; + const response = await client.path("/deid").post({ body: content }); + assert.equal(response.status, "200"); + const output = response.body as DeidentificationResultOutput; + assert.isUndefined(output.taggerResult, "On Redact Operation, expect TaggerResult to be null."); + assert.isNotNull(output.outputText, "On Redact Operation, expect OutputText to be not null."); + assert.isTrue( + (output.outputText as string).length === inputText.length, + "Expected redactionFormat *{len} to preserve length.", + ); + assert.notEqual( + content.inputText, + output.outputText, + "Expected output text to be different from input text.", + ); + }, 10000); + it("tag returns expected", async function () { const content: DeidentificationContent = { - dataType: "Plaintext", - inputText: "Hello, my name is John Smith.", + inputText: inputText, operation: "Tag", }; const response = await client.path("/deid").post({ body: content }); @@ -77,8 +103,6 @@ describe("Realtime", () => { assert.isNotNull(output.taggerResult, "On Tag Operation, expect TaggerResult to be not null."); assert.isObject(output.taggerResult, "On Tag Operation, expect TaggerResult to be not null."); assert.isUndefined(output.outputText, "On Tag Operation, expect OutputText to be null."); - assert.isTrue(output.taggerResult!.etag === undefined, "Expected Etag to be null."); - assert.isTrue(output.taggerResult!.path === undefined, "Expected Path to be null."); assert.isTrue( output.taggerResult!.entities.length > 0, diff --git a/sdk/healthdataaiservices/azure-health-deidentification/test/public/utils/recordedClient.ts b/sdk/healthdataaiservices/azure-health-deidentification/test/public/utils/recordedClient.ts index cdfad48924c2..5fe5428597be 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/test/public/utils/recordedClient.ts +++ b/sdk/healthdataaiservices/azure-health-deidentification/test/public/utils/recordedClient.ts @@ -33,7 +33,7 @@ export async function createRecordedDeidentificationClient( credentials: TokenCredential, ): Promise { const endpoint = isPlaybackMode() - ? "example.com" + ? "https://example.api.deid.azure.com" : assertEnvironmentVariable("DEID_SERVICE_ENDPOINT"); const client = await createClient(endpoint, credentials, recorder.configureClientOptions({})); diff --git a/sdk/healthdataaiservices/azure-health-deidentification/tests.yml b/sdk/healthdataaiservices/azure-health-deidentification/tests.yml index f27af5d776b4..9eaf3cf080ea 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/tests.yml +++ b/sdk/healthdataaiservices/azure-health-deidentification/tests.yml @@ -4,5 +4,5 @@ trigger: none extends: template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml parameters: - PackageName: "@azure-rest/health-deidentification" + PackageName: "@azure-rest/azure-health-deidentification" ServiceDirectory: healthdataaiservices diff --git a/sdk/healthdataaiservices/azure-health-deidentification/tsconfig.json b/sdk/healthdataaiservices/azure-health-deidentification/tsconfig.json index b495c1a46b90..993e43f59f8a 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/tsconfig.json +++ b/sdk/healthdataaiservices/azure-health-deidentification/tsconfig.json @@ -1,19 +1,10 @@ { - "extends": "../../../tsconfig.json", + "extends": "../../../tsconfig", "compilerOptions": { "module": "NodeNext", "moduleResolution": "NodeNext", "rootDir": ".", - "paths": { - "@azure/health-deidentification": ["./src/index"] - } + "skipLibCheck": true }, - "include": [ - "./src/**/*.ts", - "./src/**/*.mts", - "./src/**/*.cts", - "test/**/*.ts", - "./test/**/*.ts", - "./samples-dev/**/*.ts" - ] + "include": ["src/**/*.ts", "src/**/*.mts", "src/**/*.cts", "test/**/*.ts", "test/**/*.ts"] } diff --git a/sdk/healthdataaiservices/azure-health-deidentification/tsp-location.yaml b/sdk/healthdataaiservices/azure-health-deidentification/tsp-location.yaml index bc53597e9692..5feffc1106d3 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/tsp-location.yaml +++ b/sdk/healthdataaiservices/azure-health-deidentification/tsp-location.yaml @@ -1,5 +1,5 @@ +directory: specification/healthdataaiservices/HealthDataAIServices.DeidServices repo: Azure/azure-rest-api-specs +commit: 45baf6e76beba3c271f839c8e3c2d2fffa209ab8 additionalDirectories: [] -commit: dc4f9f316f20e45231df187971a4dad2e5dd8964 -directory: specification/healthdataaiservices/HealthDataAIServices.DeidServices