-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add Health Deidentification SDK client library for java #40725
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
Merged
samvaity
merged 30 commits into
Azure:main
from
danielszaniszlo:daszanis/feature/sdk-for-health-deid
Jul 22, 2024
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
e4e1919
Initialize with generated files
danielszaniszlo 9b6225b
Adding initial test cases and module setup
danielszaniszlo 54fd91d
adding test cases
danielszaniszlo d9c0dbc
add async tests
danielszaniszlo 8b3f38d
adding post processing for generated files
danielszaniszlo a885013
Adding readme and samples
danielszaniszlo b4a6efb
regenerated README
danielszaniszlo 34618a6
adding playback
danielszaniszlo 55a6c45
fixing test cases for playback mode
danielszaniszlo c8c9c22
adding module-info
danielszaniszlo 0ab3088
add assets.json with recordings location
scbedd 079d8c9
fixing comment + adding ci.yml
danielszaniszlo 644e173
Update ci.yml
samvaity ba60eea
Update ci.yml
samvaity d68eacf
Merge remote-tracking branch 'upstream/main' into daszanis/feature/sd…
danielszaniszlo 0ccf306
regenerated SDK and new test cases recorded and published
danielszaniszlo 9c2db0a
removed local setup
danielszaniszlo c4937fd
adding groupId
danielszaniszlo 31f0c83
fix versions
danielszaniszlo 5540386
fix linting issues
danielszaniszlo 10c714e
use base util test base + resourcenamer
samvaity f415c8d
regenerated SDK with commit hash
danielszaniszlo 5b9e2f2
new recordings removed sas uri
danielszaniszlo 4d5dad5
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
danielszaniszlo 5cd4628
fixed pipeline errors
danielszaniszlo 0958015
regenerate client from the latest
danielszaniszlo 1bfc67e
fix cspell errors
danielszaniszlo 4c4b4d9
fix comments
danielszaniszlo 468dd9d
Remove unused customization package
danielszaniszlo 8634a73
removed extra line
danielszaniszlo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Release History | ||
|
|
||
| ## 1.0.0-beta.1 (Unreleased) | ||
|
|
||
| - Azure Deidentification client library for Java. This package contains Microsoft Azure Deidentification client library. | ||
|
|
||
| ### Features Added | ||
|
|
||
| ### Breaking Changes | ||
|
|
||
| ### Bugs Fixed | ||
|
|
||
| ### Other Changes |
161 changes: 161 additions & 0 deletions
161
sdk/healthdataaiservices/azure-health-deidentification/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| # Azure Deidentification client library for Java | ||
|
|
||
| Azure Deidentification client library for Java. | ||
|
|
||
| This package contains Microsoft Azure Deidentification client library which is a managed service that enables users to tag, redact, or surrogate health data. | ||
|
|
||
| ## Documentation | ||
|
|
||
| Various documentation is available to help you get started | ||
|
|
||
| - [API reference documentation][docs] | ||
| - [Product documentation][product_documentation] | ||
|
|
||
| ## Getting started | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - [Java Development Kit (JDK)][jdk] with version 8 or above | ||
| - [Azure Subscription][azure_subscription] | ||
|
|
||
| ### Adding the package to your product | ||
|
|
||
| [//]: # ({x-version-update-start;com.azure:azure-health-deidentification;current}) | ||
| ```xml | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-health-deidentification</artifactId> | ||
| <version>1.0.0-beta.1</version> | ||
| </dependency> | ||
| ``` | ||
| [//]: # ({x-version-update-end}) | ||
|
|
||
| ### Authentication | ||
|
|
||
| [Azure Identity][azure_identity] package provides the default implementation for authenticating the client. | ||
|
|
||
| ## 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]` | ||
| - Surrogate: Will return output text with synthetic replacements. | ||
| - `My name is John Smith` | ||
| - `My name is Tom Jones` | ||
|
|
||
| ## Examples | ||
|
|
||
| The following sections provide several code snippets covering some of the most common Azure Deidentification client use cases, including: | ||
|
|
||
| - [Create a `DeidentificationClient`](#create-a-deidentificationclient) | ||
| - [Calling deidentification endpoint](#calling-deidentification-endpoint) | ||
| - [Creating deidentification Job](#creating-deidentification-job) | ||
| - [Process deidentification Job](#process-deidentification-job) | ||
| - [List deidentification Jobs](#list-deidentification-jobs) | ||
| - [List completed files](#list-completed-files) | ||
|
|
||
| ### Create a `DeidentificationClient` | ||
|
|
||
| Create a `DeidentificationClient` using the `DEID_SERVICE_ENDPOINT` environment variable. | ||
|
|
||
| ```java com.azure.health.deidentification.readme | ||
| DeidentificationClientBuilder deidentificationClientbuilder = new DeidentificationClientBuilder() | ||
| .endpoint(Configuration.getGlobalConfiguration().get("DEID_SERVICE_ENDPOINT", "endpoint")) | ||
| .httpClient(HttpClient.createDefault()) | ||
| .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); | ||
|
|
||
| DeidentificationClient deidentificationClient = deidentificationClientbuilder.buildClient(); | ||
| ``` | ||
|
|
||
| ### Calling `Deidentification` endpoint | ||
|
|
||
| Calling the realtime endpoint with an input. | ||
|
|
||
| ```java com.azure.health.deidentification.sync.helloworld | ||
| String inputText = "Hello, my name is John Smith."; | ||
|
|
||
| DeidentificationContent content = new DeidentificationContent(inputText); | ||
|
|
||
| DeidentificationResult result = deidentificationClient.deidentify(content); | ||
|
|
||
| System.out.println("Deidentified output: " + result.getOutputText()); | ||
| // Deidentified output: Hello, my name is Harley Billiard. | ||
| ``` | ||
| ### Creating Deidentification Job | ||
|
|
||
| Creating a Deidentification Job using `STORAGE_ACCOUNT_NAME` and `STORAGE_CONTAINER_NAME` environment variables. | ||
|
|
||
| ```java com.azure.health.deidentification.sync.createjob.create | ||
| String storageLocation = "https://" + Configuration.getGlobalConfiguration().get("STORAGE_ACCOUNT_NAME") + ".blob.core.windows.net/" + Configuration.getGlobalConfiguration().get("STORAGE_CONTAINER_NAME"); | ||
| String jobName = "MyJob-" + Instant.now().toEpochMilli(); | ||
| String outputFolder = "_output"; | ||
| String inputPrefix = "example_patient_1"; | ||
| SourceStorageLocation sourceStorageLocation = new SourceStorageLocation(storageLocation, inputPrefix); | ||
|
|
||
| DeidentificationJob job = new DeidentificationJob(sourceStorageLocation, new TargetStorageLocation(storageLocation, outputFolder)); | ||
| job.setOperation(OperationType.SURROGATE); | ||
| job.setDataType(DocumentDataType.PLAINTEXT); | ||
|
|
||
| ``` | ||
| ### Process Deidentification Job | ||
|
|
||
| Create and poll job until it is completed. | ||
|
|
||
| ```java com.azure.health.deidentification.sync.createjob.process | ||
| DeidentificationJob result = deidentificationClient.beginCreateJob(jobName, job) | ||
| .waitForCompletion() | ||
| .getValue(); | ||
| System.out.println(jobName + " - " + result.getStatus()); | ||
| // MyJob-1719953889301 - Succeeded | ||
| ``` | ||
|
|
||
| ### List Deidentification Jobs | ||
|
|
||
| List and process deidentification jobs | ||
|
|
||
| ```java com.azure.health.deidentification.sync.listjobs | ||
| PagedIterable<DeidentificationJob> jobs = deidentificationClient.listJobs(); | ||
| for (DeidentificationJob currentJob : jobs) { | ||
| System.out.println(currentJob.getName() + " - " + currentJob.getStatus()); | ||
| // MyJob-1719953889301 - Succeeded | ||
| } | ||
| ``` | ||
|
|
||
| ### List completed files | ||
|
|
||
| List the files which are completed by a job. | ||
|
|
||
| ```java com.azure.health.deidentification.sync.listcompletedfiles | ||
| PagedIterable<DocumentDetails> reports = deidentificationClient.listJobDocuments(jobName); | ||
|
|
||
| for (DocumentDetails currentFile : reports) { | ||
| System.out.println(currentFile.getId() + " - " + currentFile.getOutput().getPath()); | ||
| // c45dcd5e-e3ce-4ff2-80b6-a8bbeb47f878 - _output/MyJob-1719954393623/example_patient_1/visit_summary.txt | ||
| // e55a1aa2-8eba-4515-b070-1fd3d005008b - _output/MyJob-1719954393623/example_patient_1/doctor_dictation.txt | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ## Next steps | ||
|
|
||
| ## Contributing | ||
|
|
||
| For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). | ||
|
|
||
| 1. Fork it | ||
| 1. Create your feature branch (`git checkout -b my-new-feature`) | ||
| 1. Commit your changes (`git commit -am 'Add some feature'`) | ||
| 1. Push to the branch (`git push origin my-new-feature`) | ||
| 1. Create new Pull Request | ||
|
|
||
| <!-- LINKS --> | ||
| [product_documentation]: https://azure.microsoft.com/services/ | ||
| [docs]: https://azure.github.io/azure-sdk-for-java/ | ||
| [jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ | ||
| [azure_subscription]: https://azure.microsoft.com/free/ | ||
| [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity | ||
|
|
||
|  |
6 changes: 6 additions & 0 deletions
6
sdk/healthdataaiservices/azure-health-deidentification/assets.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "AssetsRepo": "Azure/azure-sdk-assets", | ||
| "AssetsRepoPrefixPath": "java", | ||
| "TagPrefix": "java/healthdataaiservices/azure-health-deidentification", | ||
| "Tag": "java/healthdataaiservices/azure-health-deidentification_aca7da2fcc" | ||
| } |
96 changes: 96 additions & 0 deletions
96
sdk/healthdataaiservices/azure-health-deidentification/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| <!-- | ||
| ~ Copyright (c) Microsoft Corporation. All rights reserved. | ||
| Licensed under the MIT License. | ||
| Code generated by Microsoft (R) TypeSpec Code Generator. | ||
| --> | ||
| <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"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-client-sdk-parent</artifactId> | ||
| <version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} --> | ||
| <relativePath>../../parents/azure-client-sdk-parent</relativePath> | ||
| </parent> | ||
|
|
||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-health-deidentification</artifactId> | ||
| <version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-health-deidentification;current} --> | ||
| <packaging>jar</packaging> | ||
|
|
||
| <name>Microsoft Azure SDK for Deidentification</name> | ||
| <description>This package contains Microsoft Azure Deidentification client library.</description> | ||
| <url>https://github.com/Azure/azure-sdk-for-java</url> | ||
|
|
||
| <licenses> | ||
| <license> | ||
| <name>The MIT License (MIT)</name> | ||
| <url>http://opensource.org/licenses/MIT</url> | ||
| <distribution>repo</distribution> | ||
| </license> | ||
| </licenses> | ||
|
|
||
| <scm> | ||
| <url>https://github.com/Azure/azure-sdk-for-java</url> | ||
| <connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection> | ||
| <developerConnection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</developerConnection> | ||
| <tag>HEAD</tag> | ||
| </scm> | ||
| <developers> | ||
| <developer> | ||
| <id>microsoft</id> | ||
| <name>Microsoft</name> | ||
| </developer> | ||
| </developers> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-json</artifactId> | ||
| <version>1.1.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} --> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-xml</artifactId> | ||
| <version>1.0.0</version> <!-- {x-version-update;com.azure:azure-xml;dependency} --> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-core</artifactId> | ||
| <version>1.50.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} --> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-core-http-netty</artifactId> | ||
| <version>1.15.2</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} --> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-api</artifactId> | ||
| <version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-engine</artifactId> | ||
| <version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-core-test</artifactId> | ||
| <version>1.26.1</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.azure</groupId> | ||
| <artifactId>azure-identity</artifactId> | ||
| <version>1.13.1</version> <!-- {x-version-update;com.azure:azure-identity;dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-simple</artifactId> | ||
| <version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} --> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
40 changes: 40 additions & 0 deletions
40
...ification/src/main/java/com/azure/health/deidentification/DeidServicesServiceVersion.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| // Code generated by Microsoft (R) TypeSpec Code Generator. | ||
|
|
||
| package com.azure.health.deidentification; | ||
|
|
||
| import com.azure.core.util.ServiceVersion; | ||
|
|
||
| /** | ||
| * Service version of DeidServicesClient. | ||
| */ | ||
| public enum DeidServicesServiceVersion implements ServiceVersion { | ||
| /** | ||
| * Enum value 2024-07-12-preview. | ||
| */ | ||
| V2024_07_12_PREVIEW("2024-07-12-preview"); | ||
|
|
||
| private final String version; | ||
|
|
||
| DeidServicesServiceVersion(String version) { | ||
| this.version = version; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritDoc} | ||
| */ | ||
| @Override | ||
| public String getVersion() { | ||
| return this.version; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the latest service version supported by this client library. | ||
| * | ||
| * @return The latest {@link DeidServicesServiceVersion}. | ||
| */ | ||
| public static DeidServicesServiceVersion getLatest() { | ||
| return V2024_07_12_PREVIEW; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.