-
Notifications
You must be signed in to change notification settings - Fork 5.1k
health insights sdk for net #34812
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
chunyu3
merged 19 commits into
Azure:main
from
asaflevi-ms:asaflevi/feature/healthinsights-sdk-for-net
Mar 23, 2023
Merged
health insights sdk for net #34812
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5743024
health insights sdk for net
asaflevi-ms 222f91a
rename Country to CountryOrRegion
asaflevi-ms d16ffcc
add cadl-location
asaflevi-ms ca37496
add test.yml
asaflevi-ms 1d743f4
update country to countryOrRegion
asaflevi-ms 0890d97
remove healthinsights from Test-SampleMetadata
asaflevi-ms 431f6d4
update product name to azure-health-insights
asaflevi-ms 262a4c9
update cadl-location with additional directories
asaflevi-ms 5b6adde
Merge branch 'main' into asaflevi/feature/healthinsights-sdk-for-net-…
asaflevi-ms dce135a
convert to typespec
asaflevi-ms 77dfc4a
Merge branch 'main' into asaflevi/feature/healthinsights-sdk-for-net
asaflevi-ms 7187872
update tsp-location
asaflevi-ms 191cbee
update commit-id in tsp-location
asaflevi-ms aae8d9a
update commit-id in tsp-location
asaflevi-ms 656d994
update tsp-location
asaflevi-ms aab6469
update commit-id in tsp-location
asaflevi-ms d97b3d7
samples scenarios sync/async
asaflevi-ms 9ca0320
update tsp-location.yaml
asaflevi-ms 45161af
update snippets
asaflevi-ms 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
37 changes: 37 additions & 0 deletions
37
...hinsights/Azure.Health.Insights.CancerProfiling/Azure.Health.Insights.CancerProfiling.sln
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,37 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio Version 17 | ||
| VisualStudioVersion = 17.3.32929.385 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Health.Insights.CancerProfiling", "src\Azure.Health.Insights.CancerProfiling.csproj", "{2D88565D-163A-4BB6-B95C-1CA4A21D5537}" | ||
| EndProject | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Health.Insights.CancerProfiling.Tests", "tests\Azure.Health.Insights.CancerProfiling.Tests.csproj", "{00E239E3-F439-47C2-85D1-1CEEC623FFE0}" | ||
| EndProject | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{2FA6BF22-3400-4581-B5E7-2F9A7E4D6D2C}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {2D88565D-163A-4BB6-B95C-1CA4A21D5537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {2D88565D-163A-4BB6-B95C-1CA4A21D5537}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {2D88565D-163A-4BB6-B95C-1CA4A21D5537}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {2D88565D-163A-4BB6-B95C-1CA4A21D5537}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {00E239E3-F439-47C2-85D1-1CEEC623FFE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {00E239E3-F439-47C2-85D1-1CEEC623FFE0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {00E239E3-F439-47C2-85D1-1CEEC623FFE0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {00E239E3-F439-47C2-85D1-1CEEC623FFE0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {2FA6BF22-3400-4581-B5E7-2F9A7E4D6D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {2FA6BF22-3400-4581-B5E7-2F9A7E4D6D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {2FA6BF22-3400-4581-B5E7-2F9A7E4D6D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {2FA6BF22-3400-4581-B5E7-2F9A7E4D6D2C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} | ||
| EndGlobalSection | ||
| EndGlobal |
12 changes: 12 additions & 0 deletions
12
sdk/healthinsights/Azure.Health.Insights.CancerProfiling/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,12 @@ | ||
| # Release History | ||
|
|
||
| ## 1.0.0-beta.1 (Unreleased) | ||
|
|
||
| ### Features Added | ||
| - Initial preview of the Azure.Health.Insights.CancerProfiling client library. | ||
|
|
||
| ### Breaking Changes | ||
|
|
||
| ### Bugs Fixed | ||
|
|
||
| ### Other Changes |
6 changes: 6 additions & 0 deletions
6
sdk/healthinsights/Azure.Health.Insights.CancerProfiling/Directory.Build.props
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 @@ | ||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- | ||
| Add any shared properties you want for the projects under this package directory that need to be set before the auto imported Directory.Build.props | ||
| --> | ||
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" /> | ||
| </Project> |
175 changes: 175 additions & 0 deletions
175
sdk/healthinsights/Azure.Health.Insights.CancerProfiling/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,175 @@ | ||
| # Azure Cognitive Services Health Insights Cancer Profiling client library for .NET | ||
|
|
||
| <!-- [Health Insights](https://review.learn.microsoft.com/en-us/azure/cognitive-services/health-decision-support/overview?branch=main) 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](https://review.learn.microsoft.com/en-us/azure/cognitive-services/health-decision-support/oncophenotype/overview?branch=main) 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. --> | ||
|
|
||
| [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] 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 | ||
|
|
||
| - You need an [Azure subscription][azure_sub] to use this package. | ||
| - An existing Cognitive Services Health Insights instance. | ||
|
|
||
| ### Install the package | ||
|
|
||
| Install the Azure Health Insights client Cancer Profiling library for .NET with [NuGet][nuget]: | ||
|
|
||
| ```dotnetcli | ||
| dotnet add package Azure.Health.Insights.CancerProfiling --prerelease | ||
| ``` | ||
|
|
||
| This table shows the relationship between SDK versions and supported API versions of the service: | ||
|
|
||
| |SDK version|Supported API version of service | | ||
| |-------------|---------------| | ||
| |1.0.0b1 | 2023-03-01-preview| | ||
|
|
||
| ### Authenticate the client | ||
|
|
||
| You can find the endpoint for your Health Insights service resource using the | ||
| [Azure Portal](https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesHealthInsights) | ||
| or [Azure CLI](https://learn.microsoft.com/cli/azure/): | ||
|
|
||
| ```bash | ||
| # Get the endpoint for the Health Insights service resource | ||
| az cognitiveservices account show --name "resource-name" --resource-group "resource-group-name" --query "properties.endpoint" | ||
| ``` | ||
|
|
||
| #### Get the API Key | ||
|
|
||
| You can get the **API Key** from the Health Insights service resource in the Azure Portal. | ||
| Alternatively, you can use **Azure CLI** snippet below to get the API key of your resource. | ||
|
|
||
| ```PowerShell | ||
| az cognitiveservices account keys list --resource-group <your-resource-group-name> --name <your-resource-name> | ||
| ``` | ||
|
|
||
| #### Create CancerProfilingClient with AzureKeyCredential | ||
|
|
||
| Once you have the value for the API key, create an `AzureKeyCredential`. With the endpoint and key credential, you can create the [`CancerProfilingClient`][cancer_profiling_client_class]: | ||
|
|
||
| ```C# | ||
| string endpoint = "<endpoint>"; | ||
| string apiKey = "<apiKey>"; | ||
| var credential = new AzureKeyCredential(apiKey); | ||
| var client = new CancerProfilingClient(new Uri(endpoint), credential); | ||
| ``` | ||
|
|
||
| ### Long-Running Operations | ||
|
|
||
| For large documents which take a long time to execute, these operations are implemented as [**long-running operations**][dotnet_lro]. Long-running operations consist of an initial request sent to the service to start an operation, followed by polling the service at intervals to determine whether the operation has completed or failed, and if it has succeeded, to get the result. | ||
|
|
||
| For long running operations in the Azure SDK, the client exposes a `Start<operation-name>` method that returns an `Operation<T>` or a `PageableOperation<T>`. You can use the extension method `WaitForCompletionAsync()` to wait for the operation to complete and obtain its result. A sample code snippet is provided to illustrate using long-running operations [below](#run-multiple-actions-asynchronously). | ||
|
|
||
| ## 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 Cancer Profiling](#cancer-profiling) | ||
|
|
||
| ### Cancer Profiling | ||
|
|
||
| ```C# Snippet:HealthInsightsCancerProfilingClientInferCancerProfileAsync | ||
| OncoPhenotypeResult oncoPhenotypeResult = default; | ||
| try | ||
| { | ||
| Operation<OncoPhenotypeResult> operation = await client.InferCancerProfileAsync(WaitUntil.Completed, oncoPhenotypeData); | ||
| Response resp = operation.GetRawResponse(); | ||
| oncoPhenotypeResult = OncoPhenotypeResult.FromResponse(resp); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine(ex.ToString()); | ||
| return; | ||
| } | ||
| ``` | ||
| ```C# Snippet:HealthInsightsCancerProfilingInferCancerProfileAsyncViewResults | ||
| // View operation results | ||
| if (oncoPhenotypeResult.Status == JobStatus.Succeeded) | ||
| { | ||
| OncoPhenotypeResults oncoResults = oncoPhenotypeResult.Results; | ||
| foreach (OncoPhenotypePatientResult patientResult in oncoResults.Patients) | ||
| { | ||
| Console.WriteLine($"\n==== Inferences of Patient {patientResult.Id} ===="); | ||
| foreach (OncoPhenotypeInference oncoInference in patientResult.Inferences) | ||
| { | ||
| Console.WriteLine($"\n=== Clinical Type: {oncoInference.Type.ToString()} Value: {oncoInference.Value} ConfidenceScore: {oncoInference.ConfidenceScore} ==="); | ||
| foreach (InferenceEvidence evidence in oncoInference.Evidence) | ||
| { | ||
| if (evidence.PatientDataEvidence != null) | ||
| { | ||
| var dataEvidence = evidence.PatientDataEvidence; | ||
| Console.WriteLine($"Evidence {dataEvidence.Id} {dataEvidence.Offset} {dataEvidence.Length} {dataEvidence.Text}"); | ||
| } | ||
| if (evidence.PatientInfoEvidence != null) | ||
| { | ||
| var infoEvidence = evidence.PatientInfoEvidence; | ||
| Console.WriteLine($"Evidence {infoEvidence.System} {infoEvidence.Code} {infoEvidence.Name} {infoEvidence.Value}"); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| else | ||
| { | ||
| IReadOnlyList<ResponseError> oncoErrors = oncoPhenotypeResult.Errors; | ||
| foreach (ResponseError error in oncoErrors) | ||
| { | ||
| Console.WriteLine($"{error.Code} : {error.Message}"); | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Setting up console logging | ||
|
|
||
| The simplest way to see the logs is to enable the console logging. | ||
| To create an Azure SDK log listener that outputs messages to console use the AzureEventSourceListener.CreateConsoleLogger method. | ||
|
|
||
| ```C# | ||
| // Setup a listener to monitor logged events. | ||
| using AzureEventSourceListener listener = AzureEventSourceListener.CreateConsoleLogger(); | ||
| ``` | ||
|
|
||
| To learn more about other logging mechanisms see [Diagnostics Samples][logging]. | ||
|
|
||
| ## Next steps | ||
|
|
||
| <!-- These code samples show common scenario operations with the Azure health Insights Cancer Profiling library. More samples can be found under the [samples](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/healthinsights/Azure.Health.Insights.CancerProfiling/tests/Samples/) directory. | ||
|
|
||
| - Infer Cancer Profile: [Sample_InferCancerProfile.cs](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/healthinsights/Azure.Health.Insights.CancerProfiling/tests/Samples/Sample_InferCancerProfile.cs) --> | ||
|
|
||
|
|
||
| ### Additional documentation | ||
|
|
||
| <!-- For more extensive documentation on Azure Health Insights Cancer Profiling, see the [Cancer Profiling documentation](https://review.learn.microsoft.com/en-us/azure/cognitive-services/health-decision-support/oncophenotype/overview?branch=main) 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 [opencode@microsoft.com][coc_contact] with any additional questions or comments. | ||
|
|
||
| <!-- LINKS --> | ||
| [cancer_profiling_client_class]: | ||
| <!-- https://github.com/Azure/azure-sdk-for-net/tree/main/ | ||
| sdk/healthinsights/Azure.Health.Insights.CancerProfiling/src/Generated/CancerProfilingClient.cs --> | ||
|
|
||
| [DefaultAzureCredential]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity/README.md | ||
| [cognitive_resource_cli]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli | ||
| [logging]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/core/Azure.Core/samples/Diagnostics.md | ||
| [azure_cli]: https://docs.microsoft.com/cli/azure | ||
| [azure_sub]: https://azure.microsoft.com/free/dotnet/ | ||
| [nuget]: https://www.nuget.org/ | ||
| [azure_portal]: https://portal.azure.com | ||
| [cla]: https://cla.microsoft.com | ||
| [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ | ||
| [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ | ||
| [coc_contact]: mailto:opencode@microsoft.com | ||
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.