Skip to content

Commit

Permalink
health insights sdk for java (#33948)
Browse files Browse the repository at this point in the history
* health insights sdk for java

* rename country to countryOrRegion

* update product name to azure-health-insights

* update cspell with missing words

* update root pom.xml and version_client.txt

* update dependency versions

* update dependency versions (#2)

* skip jacoco

* fix spell checks

* Asaflevi/feature/healthinsights sdk for java (#3)

* update dependency versions

* skip jacoco

* fix spell checks

* skip jacoco

* linting

* remove redundant plugins

* remove test.yaml files

* remove redundant package.json file

* fix sampes and readmes

* spell

* fix linting

* fix sample repository reference

* remove duplicate dependency (mockito)

* alignment (readme)

* fix readme title

* setPlaybackSyncPollerPollInterval

* update serviceversion class (emitter 0.5.1)

* remove impressions png
  • Loading branch information
asaflevi-ms authored Mar 30, 2023
1 parent 0fa61e1 commit 660c4c4
Show file tree
Hide file tree
Showing 106 changed files with 48,323 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,13 @@
"databricks",
"DAZURE",
"ddos",
"dcis",
"deallocate",
"decryptor",
"Deserialization",
"destfile",
"Dgenerate",
"dicom",
"doclint",
"doclinting",
"doctitle",
Expand All @@ -260,6 +262,7 @@
"eventhub",
"eventhubs",
"failondeprecatedstatus",
"FHIR",
"filereports",
"gapra",
"gltf",
Expand All @@ -273,6 +276,7 @@
"hdinsight",
"hvac",
"hybridkubernetes",
"insights",
"intellij",
"Intellij",
"iotcentral",
Expand Down Expand Up @@ -303,6 +307,7 @@
"Lucene",
"mgmt",
"mibps",
"Mirena",
"Mockito",
"msal",
"msix",
Expand All @@ -314,6 +319,7 @@
"okhttp",
"OLTP",
"onboarded",
"Onco",
"onenote",
"premf",
"pwsh",
Expand All @@ -338,6 +344,7 @@
"servicebus",
"sftdl",
"skus",
"snomed",
"sonatype",
"Sonatype",
"spotbugs",
Expand All @@ -349,6 +356,7 @@
"timeframe",
"tofile",
"toFile",
"umls",
"undelete",
"unmanaged",
"unmutated",
Expand Down
2 changes: 2 additions & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ com.azure:azure-data-tables-perf;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-digitaltwins-core;1.3.7;1.4.0-beta.1
com.azure:azure-developer-devcenter;1.0.0-beta.2;1.0.0-beta.3
com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-health-insights-clinicalmatching;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-health-insights-cancerprofiling;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-identity;1.8.1;1.9.0-beta.2
com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-iot-deviceupdate;1.0.5;1.1.0-beta.1
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<module>sdk/hdinsight</module>
<module>sdk/healthbot</module>
<module>sdk/healthcareapis</module>
<module>sdk/healthinsights</module>
<module>sdk/hybridcompute</module>
<module>sdk/hybridcontainerservice</module>
<module>sdk/hybridkubernetes</module>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release History

## 1.0.0-beta.1 (Unreleased)

- Initial preview of the Azure Health Insights CancerProfiling client library.
219 changes: 219 additions & 0 deletions sdk/healthinsights/azure-health-insights-cancerprofiling/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
# Azure Cognitive Services Health Insights Cancer Profiling client library for Java

[Health Insights](https://review.learn.microsoft.com/azure/azure-health-insights/?branch=release-azure-health-insights) is an Azure Applied AI Service built with the Azure Cognitive Services Framework, that leverages multiple Cognitive Services, Healthcare API services and other Azure resources.

The [Cancer Profiling model][cancer_profiling_docs] receives clinical records of oncology patients and outputs cancer staging, such as clinical stage TNM categories and pathologic stage TNM categories as well as tumor site, histology.


## Getting started

### Prerequisites

- A [Java Development Kit (JDK)][jdk_link] with version 8 or above
- [Azure Subscription][azure_subscription]
- An existing Cognitive Services Health Insights instance.

For more information about creating the resource or how to get the location and sku information see [here][cognitive_resource_cli].

### Include the Package

[//]: # ({x-version-update-start;com.azure:azure-health-insights-cancerprofiling;current})

```xml
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-health-insights-cancerprofiling</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
```

[//]: # ({x-version-update-end})

### Authenticate the client

In order to interact with the Health Insights Cancer Profiling service, you'll need to create an instance of the [`CancerProfilingClient`][cancer_profiling_client_class] class. You will need an **endpoint** and an **API key** to instantiate a client object.

#### Get API Key

You can obtain the endpoint and API key from the resource information in the [Azure Portal][azure_portal].

Alternatively, you can use the [Azure CLI][azure_cli] snippet below to get the API key from the Health Insights resource.

```bash
az cognitiveservices account keys list --resource-group <your-resource-group-name> --name <your-resource-name>
```

#### Create a CancerProfilingClient with an API Key Credential

Once you have the value for the API key, you can pass it as a string into an instance of **AzureKeyCredential**. Use the key as the credential parameter to authenticate the client:

```Java com.azure.health.insights.cancerprofiling.buildasyncclient
String endpoint = Configuration.getGlobalConfiguration().get("AZURE_HEALTH_INSIGHTS_ENDPOINT");
String apiKey = Configuration.getGlobalConfiguration().get("AZURE_HEALTH_INSIGHTS_API_KEY");

CancerProfilingAsyncClient asyncClient = new CancerProfilingClientBuilder()
.endpoint(endpoint)
.serviceVersion(CancerProfilingServiceVersion.getLatest())
.credential(new AzureKeyCredential(apiKey))
.buildAsyncClient();
```

## Key concepts

The Cancer Profiling model allows you to infer cancer attributes such as tumor site, histology, clinical stage TNM categories and pathologic stage TNM categories from unstructured clinical documents.

## Examples

Infer key cancer attributes such as tumor site, histology, clinical stage TNM categories and pathologic stage TNM categories from a patient's unstructured clinical documents.
<!--
- [SampleInferCancerProfile.java](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/healthinsights/azure-health-insights-cancerprofiling/src/samples/java/com/azure/health/insights/cancerprofiling/SampleInferCancerProfile.java).
-->

```Java com.azure.health.insights.cancerprofiling.infercancerprofile
// Construct Patient
PatientRecord patient1 = new PatientRecord("patient_id");
PatientInfo patientInfo = new PatientInfo();
patientInfo.setBirthDate(LocalDate.parse("1965-12-26"));
patientInfo.setSex(PatientInfoSex.FEMALE);
patient1.setInfo(patientInfo);
LinkedList<PatientDocument> patientDocuments = new LinkedList<>();
patient1.setData(patientDocuments);

// Add imaging document
final String docContent1 = String.join(System.getProperty("line.separator"),
"15.8.2021",
"Jane Doe 091175-8967",
"42 year old female, married with 3 children, works as a nurse. ",
"Healthy, no medications taken on a regular basis.",
"PMHx is significant for migraines with aura, uses Mirena for contraception.",
"Smoking history of 10 pack years (has stopped and relapsed several times).",
"She is in c/o 2 weeks of productive cough and shortness of breath.",
"She has a fever of 37.8 and general weakness. ",
"Denies night sweats and rash. She denies symptoms of rhinosinusitis, asthma, and heartburn. ",
"On PE:",
"GENERAL: mild pallor, no cyanosis. Regular breathing rate. ",
"LUNGS: decreased breath sounds on the base of the right lung. Vesicular breathing.",
" No crackles, rales, and wheezes. Resonant percussion. ",
"PLAN: ",
"Will be referred for a chest x-ray. ",
"======================================",
"CXR showed mild nonspecific opacities in right lung base. ",
"PLAN:",
"Findings are suggestive of a working diagnosis of pneumonia. The patient is referred to a follow-up CXR in 2 weeks.");

PatientDocument patientDocument1 = new PatientDocument(
DocumentType.NOTE,
"doc1",
new DocumentContent(DocumentContentSourceType.INLINE, docContent1));

patientDocument1.setClinicalType(ClinicalDocumentType.IMAGING);
patientDocument1.setLanguage("en");
patientDocument1.setCreatedDateTime(OffsetDateTime.parse("2021-08-15T10:15:30+01:00"));
patient1.getData().add(patientDocument1);

// Add Pathology documents
String docContent2 = String.join(System.getProperty("line.separator"),
"Oncology Clinic ",
"20.10.2021",
"Jane Doe 091175-8967",
"42-year-old healthy female who works as a nurse in the ER of this hospital. ",
"First menstruation at 11 years old. First delivery- 27 years old. She has 3 children.",
"Didn’t breastfeed. ",
"Contraception- Mirena.",
"Smoking- 10 pack years. ",
"Mother- Belarusian. Father- Georgian. ",
"About 3 months prior to admission, she stated she had SOB and was febrile. ",
"She did a CXR as an outpatient which showed a finding in the base of the right lung- possibly an infiltrate.",
"She was treated with antibiotics with partial response. ",
"6 weeks later a repeat CXR was performed- a few solid dense findings in the right lung. ",
"Therefore, she was referred for a PET-CT which demonstrated increased uptake in the right breast, lymph nodes on the right a few areas in the lungs and liver. ",
"On biopsy from the lesion in the right breast- triple negative adenocarcinoma. Genetic testing has not been done thus far. ",
"Genetic counseling- the patient denies a family history of breast, ovary, uterus, and prostate cancer. Her mother has chronic lymphocytic leukemia (CLL). ",
"She is planned to undergo genetic tests because the aggressive course of the disease, and her young age. ",
"Impression:",
"Stage 4 triple negative breast adenocarcinoma. ",
"Could benefit from biological therapy. ",
"Different treatment options were explained- the patient wants to get a second opinion.");

PatientDocument patientDocument2 = new PatientDocument(DocumentType.NOTE,
"doc2",
new DocumentContent(DocumentContentSourceType.INLINE, docContent2));
patientDocument2.setClinicalType(ClinicalDocumentType.PATHOLOGY);
patientDocument2.setLanguage("en");
patientDocument2.setCreatedDateTime(OffsetDateTime.parse("2021-10-20T22:00:00.00Z"));
patient1.getData().add(patientDocument2);

String docContent3 = String.join(System.getProperty("line.separator"),
"PATHOLOGY REPORT",
" Clinical Information",
"Ultrasound-guided biopsy; A. 18 mm mass; most likely diagnosis based on imaging: IDC",
" Diagnosis",
" A. BREAST, LEFT AT 2:00 4 CM FN; ULTRASOUND-GUIDED NEEDLE CORE BIOPSIES:",
" - Invasive carcinoma of no special type (invasive ductal carcinoma), grade 1",
" Nottingham histologic grade: 1/3 (tubules 2; nuclear grade 2; mitotic rate 1; total score; 5/9)",
" Fragments involved by invasive carcinoma: 2",
" Largest measurement of invasive carcinoma on a single fragment: 7 mm",
" Ductal carcinoma in situ (DCIS): Present",
" Architectural pattern: Cribriform",
" Nuclear grade: 2-",
" -intermediate",
" Necrosis: Not identified",
" Fragments involved by DCIS: 1",
" Largest measurement of DCIS on a single fragment: Span 2 mm",
" Microcalcifications: Present in benign breast tissue and invasive carcinoma",
" Blocks with invasive carcinoma: A1",
" Special studies: Pending");

PatientDocument patientDocument3 = new PatientDocument(DocumentType.NOTE,
"doc3",
new DocumentContent(DocumentContentSourceType.INLINE, docContent3));
patientDocument3.setClinicalType(ClinicalDocumentType.PATHOLOGY);
patientDocument3.setLanguage("en");
patientDocument3.setCreatedDateTime(OffsetDateTime.parse("2022-01-01T10:15:30+01:00"));

patient1.getData().add(patientDocument3);

// Set configuration to include evidence for the cancer staging inferences
OncoPhenotypeModelConfiguration configuration = new OncoPhenotypeModelConfiguration();
configuration.setIncludeEvidence(true);

// Construct the request with the patient and configration
OncoPhenotypeData oncoPhenotypeData = new OncoPhenotypeData(Arrays.asList(patient1));
oncoPhenotypeData.setConfiguration(configuration);

PollerFlux<OncoPhenotypeResult, OncoPhenotypeResult> asyncPoller = asyncClient.beginInferCancerProfile(oncoPhenotypeData);
```

## Troubleshooting

## Next steps
<!--
This code sample show common scenario operation with the Azure Health Insights Cancer Profiling library. More samples can be found under the [samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/healthinsights/azure-health-insights-cancerprofiling/src/samples/java/com/azure/health/insights/) directory.
-->

## Additional documentation
For more extensive documentation on Azure Health Insights Cancer Profiling, see the [Cancer Profiling documentation][cancer_profiling_docs] on docs.microsoft.com.
## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [[email protected]][coc_contact] with any additional questions or comments.

<!-- LINKS -->
[cla]: https://cla.microsoft.com
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
[coc_contact]: mailto:[email protected]
[azure_subscription]: https://azure.microsoft.com/free/
[cognitive_resource_cli]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli
[jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable

[azure_cli]: https://docs.microsoft.com/cli/azure
[azure_portal]: https://portal.azure.com
[cancer_profiling_docs]: https://review.learn.microsoft.com/azure/cognitive-services/health-decision-support/oncophenotype/overview?branch=main
<!--
[cancer_profiling_client_class]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/healthinsights/azure-health-insights-cancerprofiling/src/main/java/com/azure/health/cancerprofiling/CancerProfilingClient.java
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%healthinsights%2Fazure-health-insights-cancerprofiling%2FREADME.png)
-->
Loading

0 comments on commit 660c4c4

Please sign in to comment.