Skip to content

Commit b714f86

Browse files
Add Health Deidentification SDK client library for java (#40725)
1 parent 4e150dd commit b714f86

File tree

61 files changed

+10873
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+10873
-0
lines changed

.vscode/cspell.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@
275275
"databind",
276276
"databricks",
277277
"DAZURE",
278+
"deidentification",
279+
"deidentificationclient",
280+
"deidentified",
281+
"deid",
282+
"deidservices",
283+
"deidentify",
278284
"ddos",
279285
"dcis",
280286
"deallocate",
@@ -301,6 +307,7 @@
301307
"Entra",
302308
"Esto",
303309
"etag",
310+
"euap",
304311
"eventhub",
305312
"eventhubs",
306313
"failondeprecatedstatus",
@@ -316,10 +323,12 @@
316323
"hanaonazure",
317324
"hdfs",
318325
"hdinsight",
326+
"healthdataaiservices",
319327
"hudha",
320328
"hvac",
321329
"hybridkubernetes",
322330
"hyunwoongko",
331+
"idnum",
323332
"insights",
324333
"intellij",
325334
"Intellij",

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ com.azure:azure-developer-devcenter;1.0.1;1.1.0-beta.1
126126
com.azure:azure-developer-loadtesting;1.0.14;1.1.0-beta.1
127127
com.azure:azure-digitaltwins-core;1.3.21;1.4.0-beta.1
128128
com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1
129+
com.azure:azure-health-deidentification;1.0.0;1.0.0-beta.1
129130
com.azure:azure-health-insights-clinicalmatching;1.0.0-beta.1;1.0.0-beta.2
130131
com.azure:azure-health-insights-cancerprofiling;1.0.0-beta.1;1.0.0-beta.2
131132
com.azure:azure-health-insights-radiologyinsights;1.0.0-beta.1;1.0.0-beta.2

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
<module>sdk/hdinsight</module>
102102
<module>sdk/healthbot</module>
103103
<module>sdk/healthcareapis</module>
104+
<module>sdk/healthdataaiservices</module>
104105
<module>sdk/healthinsights</module>
105106
<module>sdk/hybridcompute</module>
106107
<module>sdk/hybridconnectivity</module>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (Unreleased)
4+
5+
- Azure Deidentification client library for Java. This package contains Microsoft Azure Deidentification client library.
6+
7+
### Features Added
8+
9+
### Breaking Changes
10+
11+
### Bugs Fixed
12+
13+
### Other Changes
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# Azure Deidentification client library for Java
2+
3+
Azure Deidentification client library for Java.
4+
5+
This package contains Microsoft Azure Deidentification client library which is a managed service that enables users to tag, redact, or surrogate health data.
6+
7+
## Documentation
8+
9+
Various documentation is available to help you get started
10+
11+
- [API reference documentation][docs]
12+
- [Product documentation][product_documentation]
13+
14+
## Getting started
15+
16+
### Prerequisites
17+
18+
- [Java Development Kit (JDK)][jdk] with version 8 or above
19+
- [Azure Subscription][azure_subscription]
20+
21+
### Adding the package to your product
22+
23+
[//]: # ({x-version-update-start;com.azure:azure-health-deidentification;current})
24+
```xml
25+
<dependency>
26+
<groupId>com.azure</groupId>
27+
<artifactId>azure-health-deidentification</artifactId>
28+
<version>1.0.0-beta.1</version>
29+
</dependency>
30+
```
31+
[//]: # ({x-version-update-end})
32+
33+
### Authentication
34+
35+
[Azure Identity][azure_identity] package provides the default implementation for authenticating the client.
36+
37+
## Key concepts
38+
### Operation Modes:
39+
40+
- Tag: Will return a structure of offset and length with the PHI category of the related text spans.
41+
- Redact: Will return output text with placeholder stubbed text. ex. `[name]`
42+
- Surrogate: Will return output text with synthetic replacements.
43+
- `My name is John Smith`
44+
- `My name is Tom Jones`
45+
46+
## Examples
47+
48+
The following sections provide several code snippets covering some of the most common Azure Deidentification client use cases, including:
49+
50+
- [Create a `DeidentificationClient`](#create-a-deidentificationclient)
51+
- [Calling deidentification endpoint](#calling-deidentification-endpoint)
52+
- [Creating deidentification Job](#creating-deidentification-job)
53+
- [Process deidentification Job](#process-deidentification-job)
54+
- [List deidentification Jobs](#list-deidentification-jobs)
55+
- [List completed files](#list-completed-files)
56+
57+
### Create a `DeidentificationClient`
58+
59+
Create a `DeidentificationClient` using the `DEID_SERVICE_ENDPOINT` environment variable.
60+
61+
```java com.azure.health.deidentification.readme
62+
DeidentificationClientBuilder deidentificationClientbuilder = new DeidentificationClientBuilder()
63+
.endpoint(Configuration.getGlobalConfiguration().get("DEID_SERVICE_ENDPOINT", "endpoint"))
64+
.httpClient(HttpClient.createDefault())
65+
.httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
66+
67+
DeidentificationClient deidentificationClient = deidentificationClientbuilder.buildClient();
68+
```
69+
70+
### Calling `Deidentification` endpoint
71+
72+
Calling the realtime endpoint with an input.
73+
74+
```java com.azure.health.deidentification.sync.helloworld
75+
String inputText = "Hello, my name is John Smith.";
76+
77+
DeidentificationContent content = new DeidentificationContent(inputText);
78+
79+
DeidentificationResult result = deidentificationClient.deidentify(content);
80+
81+
System.out.println("Deidentified output: " + result.getOutputText());
82+
// Deidentified output: Hello, my name is Harley Billiard.
83+
```
84+
### Creating Deidentification Job
85+
86+
Creating a Deidentification Job using `STORAGE_ACCOUNT_NAME` and `STORAGE_CONTAINER_NAME` environment variables.
87+
88+
```java com.azure.health.deidentification.sync.createjob.create
89+
String storageLocation = "https://" + Configuration.getGlobalConfiguration().get("STORAGE_ACCOUNT_NAME") + ".blob.core.windows.net/" + Configuration.getGlobalConfiguration().get("STORAGE_CONTAINER_NAME");
90+
String jobName = "MyJob-" + Instant.now().toEpochMilli();
91+
String outputFolder = "_output";
92+
String inputPrefix = "example_patient_1";
93+
SourceStorageLocation sourceStorageLocation = new SourceStorageLocation(storageLocation, inputPrefix);
94+
95+
DeidentificationJob job = new DeidentificationJob(sourceStorageLocation, new TargetStorageLocation(storageLocation, outputFolder));
96+
job.setOperation(OperationType.SURROGATE);
97+
job.setDataType(DocumentDataType.PLAINTEXT);
98+
99+
```
100+
### Process Deidentification Job
101+
102+
Create and poll job until it is completed.
103+
104+
```java com.azure.health.deidentification.sync.createjob.process
105+
DeidentificationJob result = deidentificationClient.beginCreateJob(jobName, job)
106+
.waitForCompletion()
107+
.getValue();
108+
System.out.println(jobName + " - " + result.getStatus());
109+
// MyJob-1719953889301 - Succeeded
110+
```
111+
112+
### List Deidentification Jobs
113+
114+
List and process deidentification jobs
115+
116+
```java com.azure.health.deidentification.sync.listjobs
117+
PagedIterable<DeidentificationJob> jobs = deidentificationClient.listJobs();
118+
for (DeidentificationJob currentJob : jobs) {
119+
System.out.println(currentJob.getName() + " - " + currentJob.getStatus());
120+
// MyJob-1719953889301 - Succeeded
121+
}
122+
```
123+
124+
### List completed files
125+
126+
List the files which are completed by a job.
127+
128+
```java com.azure.health.deidentification.sync.listcompletedfiles
129+
PagedIterable<DocumentDetails> reports = deidentificationClient.listJobDocuments(jobName);
130+
131+
for (DocumentDetails currentFile : reports) {
132+
System.out.println(currentFile.getId() + " - " + currentFile.getOutput().getPath());
133+
// c45dcd5e-e3ce-4ff2-80b6-a8bbeb47f878 - _output/MyJob-1719954393623/example_patient_1/visit_summary.txt
134+
// e55a1aa2-8eba-4515-b070-1fd3d005008b - _output/MyJob-1719954393623/example_patient_1/doctor_dictation.txt
135+
}
136+
```
137+
138+
139+
140+
## Troubleshooting
141+
142+
## Next steps
143+
144+
## Contributing
145+
146+
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).
147+
148+
1. Fork it
149+
1. Create your feature branch (`git checkout -b my-new-feature`)
150+
1. Commit your changes (`git commit -am 'Add some feature'`)
151+
1. Push to the branch (`git push origin my-new-feature`)
152+
1. Create new Pull Request
153+
154+
<!-- LINKS -->
155+
[product_documentation]: https://azure.microsoft.com/services/
156+
[docs]: https://azure.github.io/azure-sdk-for-java/
157+
[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/
158+
[azure_subscription]: https://azure.microsoft.com/free/
159+
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
160+
161+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fhealthdataaiservices%2Fazure-health-deidentification%2FREADME.png)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"AssetsRepo": "Azure/azure-sdk-assets",
3+
"AssetsRepoPrefixPath": "java",
4+
"TagPrefix": "java/healthdataaiservices/azure-health-deidentification",
5+
"Tag": "java/healthdataaiservices/azure-health-deidentification_aca7da2fcc"
6+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<!--
2+
~ Copyright (c) Microsoft Corporation. All rights reserved.
3+
Licensed under the MIT License.
4+
Code generated by Microsoft (R) TypeSpec Code Generator.
5+
-->
6+
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7+
<modelVersion>4.0.0</modelVersion>
8+
<parent>
9+
<groupId>com.azure</groupId>
10+
<artifactId>azure-client-sdk-parent</artifactId>
11+
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
12+
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
13+
</parent>
14+
15+
<groupId>com.azure</groupId>
16+
<artifactId>azure-health-deidentification</artifactId>
17+
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-health-deidentification;current} -->
18+
<packaging>jar</packaging>
19+
20+
<name>Microsoft Azure SDK for Deidentification</name>
21+
<description>This package contains Microsoft Azure Deidentification client library.</description>
22+
<url>https://github.com/Azure/azure-sdk-for-java</url>
23+
24+
<licenses>
25+
<license>
26+
<name>The MIT License (MIT)</name>
27+
<url>http://opensource.org/licenses/MIT</url>
28+
<distribution>repo</distribution>
29+
</license>
30+
</licenses>
31+
32+
<scm>
33+
<url>https://github.com/Azure/azure-sdk-for-java</url>
34+
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection>
35+
<developerConnection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</developerConnection>
36+
<tag>HEAD</tag>
37+
</scm>
38+
<developers>
39+
<developer>
40+
<id>microsoft</id>
41+
<name>Microsoft</name>
42+
</developer>
43+
</developers>
44+
<dependencies>
45+
<dependency>
46+
<groupId>com.azure</groupId>
47+
<artifactId>azure-json</artifactId>
48+
<version>1.1.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} -->
49+
</dependency>
50+
<dependency>
51+
<groupId>com.azure</groupId>
52+
<artifactId>azure-xml</artifactId>
53+
<version>1.0.0</version> <!-- {x-version-update;com.azure:azure-xml;dependency} -->
54+
</dependency>
55+
<dependency>
56+
<groupId>com.azure</groupId>
57+
<artifactId>azure-core</artifactId>
58+
<version>1.50.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
59+
</dependency>
60+
<dependency>
61+
<groupId>com.azure</groupId>
62+
<artifactId>azure-core-http-netty</artifactId>
63+
<version>1.15.2</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
64+
</dependency>
65+
<dependency>
66+
<groupId>org.junit.jupiter</groupId>
67+
<artifactId>junit-jupiter-api</artifactId>
68+
<version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} -->
69+
<scope>test</scope>
70+
</dependency>
71+
<dependency>
72+
<groupId>org.junit.jupiter</groupId>
73+
<artifactId>junit-jupiter-engine</artifactId>
74+
<version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
75+
<scope>test</scope>
76+
</dependency>
77+
<dependency>
78+
<groupId>com.azure</groupId>
79+
<artifactId>azure-core-test</artifactId>
80+
<version>1.26.1</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
81+
<scope>test</scope>
82+
</dependency>
83+
<dependency>
84+
<groupId>com.azure</groupId>
85+
<artifactId>azure-identity</artifactId>
86+
<version>1.13.1</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
87+
<scope>test</scope>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.slf4j</groupId>
91+
<artifactId>slf4j-simple</artifactId>
92+
<version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
93+
<scope>test</scope>
94+
</dependency>
95+
</dependencies>
96+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) TypeSpec Code Generator.
4+
5+
package com.azure.health.deidentification;
6+
7+
import com.azure.core.util.ServiceVersion;
8+
9+
/**
10+
* Service version of DeidServicesClient.
11+
*/
12+
public enum DeidServicesServiceVersion implements ServiceVersion {
13+
/**
14+
* Enum value 2024-07-12-preview.
15+
*/
16+
V2024_07_12_PREVIEW("2024-07-12-preview");
17+
18+
private final String version;
19+
20+
DeidServicesServiceVersion(String version) {
21+
this.version = version;
22+
}
23+
24+
/**
25+
* {@inheritDoc}
26+
*/
27+
@Override
28+
public String getVersion() {
29+
return this.version;
30+
}
31+
32+
/**
33+
* Gets the latest service version supported by this client library.
34+
*
35+
* @return The latest {@link DeidServicesServiceVersion}.
36+
*/
37+
public static DeidServicesServiceVersion getLatest() {
38+
return V2024_07_12_PREVIEW;
39+
}
40+
}

0 commit comments

Comments
 (0)