@azure-rest/health-deidentification 1.0.0-alpha.20250702.3 → 1.0.0-alpha.20250715.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +34 -9
  2. package/package.json +5 -11
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # Azure Health Data Services de-identification service REST client library for JavaScript
2
2
 
3
- This package contains a client library for the de-identification service in Azure Health Data Services which
3
+ This package contains a client library for the de-identification service in Azure Health Data Services which
4
4
  enables users to tag, redact, or surrogate health data containing Protected Health Information (PHI).
5
5
 
6
6
  Use the client library for the de-identification service to:
7
+
7
8
  - Discover PHI in unstructured text
8
9
  - Replace PHI in unstructured text with placeholder values
9
10
  - Replace PHI in unstructured text with realistic surrogate values
@@ -12,6 +13,7 @@ Use the client library for the de-identification service to:
12
13
  **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.**
13
14
 
14
15
  Use the client library for the de-identification service to:
16
+
15
17
  - Discover PHI in unstructured text
16
18
  - Replace PHI in unstructured text with placeholder values
17
19
  - Replace PHI in unstructured text with realistic surrogate values
@@ -64,32 +66,45 @@ Here's an example of setting an environment variable in Bash using Azure CLI:
64
66
 
65
67
  ```bash
66
68
  # Get the service URL for the resource
67
- export DEID_SERVICE_ENDPOINT=$(az deidservice show --name "<resource-name>" --resource-group "<resource-group-name>" --query "properties.serviceUrl")
69
+ export HEALTHDATAAISERVICES_DEID_SERVICE_ENDPOINT=$(az deidservice show --name "<resource-name>" --resource-group "<resource-group-name>" --query "properties.serviceUrl")
68
70
  ```
69
71
 
70
72
  Create a client with the endpoint and credential:
73
+
71
74
  ```ts snippet:CreateClient
72
75
  import { DefaultAzureCredential } from "@azure/identity";
73
76
  import DeidentificationClient from "@azure-rest/health-deidentification";
74
77
 
75
78
  const credential = new DefaultAzureCredential();
76
- const serviceEndpoint = process.env.DEID_SERVICE_ENDPOINT || "https://example.api.deid.azure.com";
79
+ const serviceEndpoint =
80
+ process.env.HEALTHDATAAISERVICES_DEID_SERVICE_ENDPOINT || "https://example.api.deid.azure.com";
77
81
  const client = DeidentificationClient(serviceEndpoint, credential);
78
82
  ```
79
83
 
80
84
  ## Key concepts
81
85
 
82
86
  ### De-identification operations:
87
+
83
88
  Given an input text, the de-identification service can perform three main operations:
89
+
84
90
  - `Tag` returns the category and location within the text of detected PHI entities.
85
91
  - `Redact` returns output text where detected PHI entities are replaced with placeholder text. For example `John` replaced with `[name]`.
86
92
  - `Surrogate` returns output text where detected PHI entities are replaced with realistic replacement values. For example, `My name is John Smith` could become `My name is Tom Jones`.
87
93
 
94
+ ### String Encoding
95
+
96
+ When using the `Tag` operation, the service will return the locations of PHI entities in the input text. These locations will be represented as offsets and lengths, each of which is a [StringIndex][string_index] containing
97
+ three properties corresponding to three different text encodings. **JavaScript applications should use the `utf16` property.**
98
+
99
+ For more on text encoding, see [Character encoding in .NET][character_encoding].
100
+
88
101
  ### Available endpoints
89
- There are two ways to interact with the de-identification service. You can send text directly, or you can create jobs
102
+
103
+ There are two ways to interact with the de-identification service. You can send text directly, or you can create jobs
90
104
  to de-identify documents in Azure Storage.
91
105
 
92
106
  You can de-identify text directly using the `DeidentificationClient`:
107
+
93
108
  ```ts snippet:DeidentifyText
94
109
  import { DefaultAzureCredential } from "@azure/identity";
95
110
  import DeidentificationClient, {
@@ -98,7 +113,8 @@ import DeidentificationClient, {
98
113
  } from "@azure-rest/health-deidentification";
99
114
 
100
115
  const credential = new DefaultAzureCredential();
101
- const serviceEndpoint = process.env.DEID_SERVICE_ENDPOINT || "https://example.api.deid.azure.com";
116
+ const serviceEndpoint =
117
+ process.env.HEALTHDATAAISERVICES_DEID_SERVICE_ENDPOINT || "https://example.api.deid.azure.com";
102
118
  const client = DeidentificationClient(serviceEndpoint, credential);
103
119
 
104
120
  const content: DeidentificationContent = {
@@ -117,6 +133,7 @@ console.log(response.body.outputText); // Hello, Tom!
117
133
  To de-identify documents in Azure Storage, you'll need a storage account with a container to which the de-identification service has been granted an appropriate role. See [Tutorial: Configure Azure Storage to de-identify documents][deid_configure_storage] for prerequisites and configuration options. You can upload the files in the [test data folder][test_data] as blobs, like: `https://<storageaccount>.blob.core.windows.net/<container>/example_patient_1/doctor_dictation.txt`.
118
134
 
119
135
  You can create jobs to de-identify documents in the source Azure Storage account and container with an optional input prefix. If there's no input prefix, all blobs in the container will be de-identified. Azure Storage blobs can use `/` in the blob name to emulate a folder or directory layout. For more on blob naming, see [Naming and Referencing Containers, Blobs, and Metadata][blob_names]. The files you've uploaded can be de-identified by providing `example_patient_1` as the input prefix:
136
+
120
137
  ```
121
138
  <container>/
122
139
  ├── example_patient_1/
@@ -126,6 +143,7 @@ You can create jobs to de-identify documents in the source Azure Storage account
126
143
  ```
127
144
 
128
145
  Your target Azure Storage account and container where documents will be written can be the same as the source, or a different account or container. In the examples below, the source and target account and container are the same. You can specify an output prefix to indicate where the job's output documents should be written (defaulting to `_output`). Each document processed by the job will have the same relative blob name with the input prefix replaced by the output prefix:
146
+
129
147
  ```
130
148
  <container>/
131
149
  ├── example_patient_1/
@@ -139,13 +157,15 @@ Your target Azure Storage account and container where documents will be written
139
157
  ```
140
158
 
141
159
  Set the following environment variables, updating the storage account and container with real values:
160
+
142
161
  ```bash
143
- export AZURE_STORAGE_ACCOUNT_LOCATION="https://<storageaccount>.blob.core.windows.net/<container>"
162
+ export HEALTHDATAAISERVICES_STORAGE_ACCOUNT_LOCATION="https://<storageaccount>.blob.core.windows.net/<container>"
144
163
  export INPUT_PREFIX="example_patient_1"
145
164
  export OUTPUT_PREFIX="_output"
146
165
  ```
147
166
 
148
167
  You can create and view job status using the client:
168
+
149
169
  ```ts snippet:DeidentifyDocuments
150
170
  import { DefaultAzureCredential } from "@azure/identity";
151
171
  import DeidentificationClient, {
@@ -157,8 +177,10 @@ import DeidentificationClient, {
157
177
 
158
178
  const credential = new DefaultAzureCredential();
159
179
  const serviceEndpoint =
160
- process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.deid.azure.com";
161
- const storageLocation = `https://${process.env["STORAGE_ACCOUNT_NAME"]}.blob.core.windows.net/${process.env["STORAGE_CONTAINER_NAME"]}`;
180
+ process.env["HEALTHDATAAISERVICES_DEID_SERVICE_ENDPOINT"] || "https://example.api.deid.azure.com";
181
+ const storageLocation =
182
+ process.env["HEALTHDATAAISERVICES_STORAGE_ACCOUNT_LOCATION"] ||
183
+ "https://example.blob.core.windows.net/example-container";
162
184
  const inputPrefix = "example_patient_1";
163
185
  const outputPrefix = process.env["OUTPUT_PREFIX"] || "_output";
164
186
 
@@ -206,12 +228,15 @@ setLogLevel("info");
206
228
  For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
207
229
 
208
230
  <!-- LINKS -->
231
+
209
232
  [azure_sub]: https://azure.microsoft.com/free/
210
233
  [deid_quickstart]: https://learn.microsoft.com/azure/healthcare-apis/deidentification/quickstart
234
+ [string_index]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthdataaiservices/health-deidentification-rest/src/outputModels.ts#L175
235
+ [character_encoding]: https://learn.microsoft.com/dotnet/standard/base-types/character-encoding-introduction
211
236
  [deid_redact]: https://learn.microsoft.com/azure/healthcare-apis/deidentification/redaction-format
212
237
  [deid_rbac]: https://learn.microsoft.com/azure/healthcare-apis/deidentification/manage-access-rbac
213
238
  [deid_managed_identity]: https://learn.microsoft.com/azure/healthcare-apis/deidentification/managed-identities
214
239
  [deid_configure_storage]: https://learn.microsoft.com/azure/healthcare-apis/deidentification/configure-storage
215
240
  [azure_cli]: https://learn.microsoft.com/cli/azure/healthcareapis/deidservice?view=azure-cli-latest
216
241
  [azure_portal]: https://ms.portal.azure.com
217
- [github_issue_label]: https://github.com/Azure/azure-sdk-for-js/labels/Health%20Deidentification
242
+ [github_issue_label]: https://github.com/Azure/azure-sdk-for-js/labels/Health%20Deidentification
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-rest/health-deidentification",
3
- "version": "1.0.0-alpha.20250702.3",
3
+ "version": "1.0.0-alpha.20250715.2",
4
4
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/health-deidentification-rest",
5
5
  "description": "Azure Health Data Services de-identification service",
6
6
  "engines": {
@@ -94,7 +94,7 @@
94
94
  },
95
95
  "scripts": {
96
96
  "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
97
- "build:samples": "echo Obsolete.",
97
+ "build:samples": "dev-tool samples publish",
98
98
  "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test",
99
99
  "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples-dev/**/*.ts\"",
100
100
  "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
@@ -102,19 +102,13 @@
102
102
  "extract-api": "dev-tool run build-package && dev-tool run extract-api",
103
103
  "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples-dev/**/*.ts\"",
104
104
  "generate:client": "autorest --typescript ./swagger/README.md",
105
- "integration-test": "npm run integration-test:node && npm run integration-test:browser",
106
- "integration-test:browser": "dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
107
- "integration-test:node": "dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest",
108
105
  "lint": "eslint package.json api-extractor.json src test",
109
106
  "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
110
107
  "pack": "npm pack 2>&1",
111
- "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser",
112
- "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
113
- "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node",
108
+ "test": "npm run test:node && npm run test:browser",
109
+ "test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
110
+ "test:node": "dev-tool run test:vitest",
114
111
  "test:node:esm": "dev-tool run test:vitest --esm",
115
- "unit-test": "npm run unit-test:node && npm run unit-test:browser",
116
- "unit-test:browser": "npm run integration-test:browser",
117
- "unit-test:node": "npm run integration-test:node",
118
112
  "update-snippets": "dev-tool run update-snippets"
119
113
  },
120
114
  "exports": {