Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Health Data AI Services Stable GA SDK #32098

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
89c561c
Regenerated SDK
Nov 4, 2024
859c8d9
Change DeidServicesClient to DeidentificationClient via autorest
Nov 4, 2024
77c3059
Deidentification instead of DeidServices
Nov 5, 2024
9fc660d
Rm dataType
Nov 6, 2024
dd304f4
jobName
Nov 6, 2024
f974a28
Add continuationToken in tests
Nov 7, 2024
2fa203e
Merge branch 'main' of https://github.com/alexathomases/azure-sdk-for…
Nov 10, 2024
0c8658d
Update configuration files
Nov 11, 2024
9b51092
Merge branch 'healthdataaiservices/stable' of https://github.com/alex…
Dec 7, 2024
e02cfff
Regenerated with merged typespec
Dec 7, 2024
7c6ba1e
API updates
Dec 7, 2024
01f6412
rushx format
Dec 8, 2024
f3bb516
rushx lint --fix
Dec 8, 2024
7b72880
Updated API
Dec 8, 2024
46c35db
Update package name
Dec 8, 2024
6c047f0
Update rush.json
Dec 8, 2024
f8e6386
Update pnpm-lock.yaml
Dec 8, 2024
6baa8e5
Added 3rd document to test pagination
Dec 8, 2024
3efe54a
Update to @azure-rest/azure-health-deidentification
Dec 8, 2024
211a475
Updating review/core-rest-pipeline.api.md
Dec 8, 2024
9dbc19f
Fix broken link
Dec 8, 2024
3e67889
Ran tsp-client update
Dec 8, 2024
9383616
Rushx build
Dec 8, 2024
e2facd0
Tests working in all modes
Dec 9, 2024
dd3e81c
Pushed test assets
Dec 9, 2024
51a6620
Removed locale
Dec 9, 2024
3bdb343
rushx format
Dec 9, 2024
cb68e7e
Samples
Dec 9, 2024
73e2544
rushx format again
Dec 9, 2024
2da17f8
Merge branch 'main' into healthdataaiservices/stable-ga
alexathomases Dec 10, 2024
25921ad
Synced with latest pnpm-lock.yaml
Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 42 additions & 42 deletions common/config/rush/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
59 changes: 17 additions & 42 deletions sdk/healthdataaiservices/azure-health-deidentification/README.md
Original file line number Diff line number Diff line change
@@ -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**

<!-- **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)
- [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

Expand All @@ -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`
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
@@ -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",
},
},
]);
];
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Loading
Loading