Skip to content

Commit

Permalink
CodeGen from PR 31387 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 02bb3966d5d68dd08e4bd2fff041348052c31500 into 4a34315010d7416991838424bcbbfe0d4f8cea8a
  • Loading branch information
SDKAuto committed Nov 1, 2024
1 parent 4a2df5a commit 2ab3945
Show file tree
Hide file tree
Showing 54 changed files with 418 additions and 1,804 deletions.
84 changes: 77 additions & 7 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Release History

## 1.0.0-beta.1 (2024-08-15)

- Azure Deidentification client library for JS. This package contains Microsoft Azure Deidentification client library.

## 1.0.0-beta.1 (2024-11-01)

### Features Added

- Azure Deidentification client library for JS. This package contains Microsoft Azure Deidentification client library.
- Added Interface DeidServicesClientOptions
- Added Type Alias DeidServicesClient

60 changes: 9 additions & 51 deletions sdk/healthdataaiservices/azure-health-deidentification/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Azure Deidentification REST client library for JavaScript
# Azure DeidServices 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**

<!-- **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** -->
<!-- TODO Fix links once they are live use placeholden until then -->
Key links:

- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/health-deidentification)
- [API reference documentation](https://docs.microsoft.com/javascript/api/@azure-rest/health-deidentification?view=azure-node-preview)

## Getting started

Expand All @@ -20,69 +21,26 @@ Key links:

### Install the `@azure-rest/health-deidentification` package

Install the Azure Deidentification REST client REST client library for JavaScript with `npm`:
Install the Azure DeidServices REST client REST client library for JavaScript with `npm`:

```bash
npm install @azure-rest/health-deidentification
```

### Create and authenticate a `DeidentificationClient`
### Create and authenticate a `DeidServicesClient`

To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
provide an instance of the desired credential type obtained from the
[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.

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`

Pull `ServiceUrl` from your created Deidentification Service.

![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!
```

## Key concept

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]`
- Surrogate: Will return output text with synthetic replacements.
- `My name is John Smith`
- `My name is Tom Jones`
AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./dist/esm/index.d.ts",
"docModel": { "enabled": true },
"apiReport": { "enabled": true, "reportFolder": "./review" },
"docModel": {
"enabled": true
},
"apiReport": {
"enabled": true,
"reportFolder": "./review"
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./types/health-deidentification.d.ts"
},
"messages": {
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
},
"extractorMessageReporting": {
"ae-missing-release-tag": { "logLevel": "none" },
"ae-unresolved-link": { "logLevel": "none" }
"ae-missing-release-tag": {
"logLevel": "none"
},
"ae-unresolved-link": {
"logLevel": "none"
}
}
}
}
}

This file was deleted.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ export default [
"@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"
}
}
];
Loading

0 comments on commit 2ab3945

Please sign in to comment.