Skip to content
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

[TA] PageableOperation implementation #18351

Merged
merged 3 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 34 additions & 33 deletions sdk/textanalytics/Azure.AI.TextAnalytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,68 +412,69 @@ catch (RequestFailedException exception)
Text Analytics for health is a containerized service that extracts and labels relevant medical information from unstructured texts such as doctor's notes, discharge summaries, clinical documents, and electronic health records. For more information see [How to: Use Text Analytics for health][healthcare].

```C# Snippet:TextAnalyticsSampleHealthcareBatchAsync
string document = @"RECORD #333582770390100 | MH | 85986313 | | 054351 | 2/14/2001 12:00:00 AM | CORONARY ARTERY DISEASE | Signed | DIS | \
Admission Date: 5/22/2001 Report Status: Signed Discharge Date: 4/24/2001 ADMISSION DIAGNOSIS: CORONARY ARTERY DISEASE. \
HISTORY OF PRESENT ILLNESS: The patient is a 54-year-old gentleman with a history of progressive angina over the past several months. \
string document1 = @"RECORD #333582770390100 | MH | 85986313 | | 054351 | 2/14/2001 12:00:00 AM | CORONARY ARTERY DISEASE | Signed | DIS |
Admission Date: 5/22/2001 Report Status: Signed Discharge Date: 4/24/2001 ADMISSION DIAGNOSIS: CORONARY ARTERY DISEASE.
HISTORY OF PRESENT ILLNESS: The patient is a 54-year-old gentleman with a history of progressive angina over the past several months.
The patient had a cardiac catheterization in July of this year revealing total occlusion of the RCA and 50% left main disease ,\
with a strong family history of coronary artery disease with a brother dying at the age of 52 from a myocardial infarction and \
another brother who is status post coronary artery bypass grafting. The patient had a stress echocardiogram done on July , 2001 , \
which showed no wall motion abnormalities , but this was a difficult study due to body habitus. The patient went for six minutes with \
minimal ST depressions in the anterior lateral leads , thought due to fatigue and wrist pain , his anginal equivalent. Due to the patient's \
increased symptoms and family history and history left main disease with total occasional of his RCA was referred for revascularization with open heart surgery.";

string document2 = "Prescribed 100mg ibuprofen, taken twice daily.";

List<string> batchInput = new List<string>()
{
document,
document,
document1,
document2,
};

AnalyzeHealthcareEntitiesOptions options = new AnalyzeHealthcareEntitiesOptions()
{
Top = 1,
Skip = 0,
IncludeStatistics = true
};

AnalyzeHealthcareEntitiesOperation healthOperation = await client.StartAnalyzeHealthcareEntitiesAsync(batchInput, "en", options);

await healthOperation.WaitForCompletionAsync();

AnalyzeHealthcareEntitiesResultCollection results = healthOperation.Value;

Console.WriteLine($"Results of Azure Text Analytics \"Healthcare Async\" Model, version: \"{results.ModelVersion}\"");
Console.WriteLine("");

foreach (AnalyzeHealthcareEntitiesResult result in results)
await foreach (AnalyzeHealthcareEntitiesResultCollection documentsInPage in healthOperation.Value)
{
Console.WriteLine($" Recognized the following {result.Entities.Count} healthcare entities:");
Console.WriteLine($"Results of Azure Text Analytics \"Healthcare Async\" Model, version: \"{documentsInPage.ModelVersion}\"");
Console.WriteLine("");

foreach (HealthcareEntity entity in result.Entities)
foreach (AnalyzeHealthcareEntitiesResult result in documentsInPage)
{
Console.WriteLine($" Entity: {entity.Text}");
Console.WriteLine($" Category: {entity.Category}");
Console.WriteLine($" Offset: {entity.Offset}");
Console.WriteLine($" Length: {entity.Length}");
Console.WriteLine($" Links:");
Console.WriteLine($" Recognized the following {result.Entities.Count} healthcare entities:");

foreach (EntityDataSource entityDataSource in entity.DataSources)
foreach (HealthcareEntity entity in result.Entities)
{
Console.WriteLine($" Entity ID in Data Source: {entityDataSource.EntityId}");
Console.WriteLine($" DataSource: {entityDataSource.Name}");
Console.WriteLine($" Entity: {entity.Text}");
Console.WriteLine($" Category: {entity.Category}");
Console.WriteLine($" Offset: {entity.Offset}");
Console.WriteLine($" Length: {entity.Length}");
Console.WriteLine($" Links:");

foreach (EntityDataSource entityDataSource in entity.DataSources)
{
Console.WriteLine($" Entity ID in Data Source: {entityDataSource.EntityId}");
Console.WriteLine($" DataSource: {entityDataSource.Name}");
}
}
}

Console.WriteLine($" Document statistics:");
Console.WriteLine($" Character count (in Unicode graphemes): {result.Statistics.CharacterCount}");
Console.WriteLine($" Transaction count: {result.Statistics.TransactionCount}");
Console.WriteLine($" Document statistics:");
Console.WriteLine($" Character count (in Unicode graphemes): {result.Statistics.CharacterCount}");
Console.WriteLine($" Transaction count: {result.Statistics.TransactionCount}");
Console.WriteLine("");
}
Console.WriteLine($"Request statistics:");
Console.WriteLine($" Document Count: {documentsInPage.Statistics.DocumentCount}");
Console.WriteLine($" Valid Document Count: {documentsInPage.Statistics.ValidDocumentCount}");
Console.WriteLine($" Transaction Count: {documentsInPage.Statistics.TransactionCount}");
Console.WriteLine($" Invalid Document Count: {documentsInPage.Statistics.InvalidDocumentCount}");
Console.WriteLine("");
}
Console.WriteLine($"Request statistics:");
Console.WriteLine($" Document Count: {results.Statistics.DocumentCount}");
Console.WriteLine($" Valid Document Count: {results.Statistics.ValidDocumentCount}");
Console.WriteLine($" Transaction Count: {results.Statistics.TransactionCount}");
Console.WriteLine($" Invalid Document Count: {results.Statistics.InvalidDocumentCount}");
Console.WriteLine("");
}
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Azure.AI.TextAnalytics
{
public partial class AnalyzeHealthcareEntitiesOperation : Azure.Operation<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection>
public partial class AnalyzeHealthcareEntitiesOperation : Azure.AI.TextAnalytics.PageableOperation<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection>
{
public AnalyzeHealthcareEntitiesOperation(string operationId, Azure.AI.TextAnalytics.TextAnalyticsClient client) { }
public System.DateTimeOffset CreatedOn { get { throw null; } }
Expand All @@ -10,20 +10,20 @@ public AnalyzeHealthcareEntitiesOperation(string operationId, Azure.AI.TextAnaly
public override string Id { get { throw null; } }
public System.DateTimeOffset LastModified { get { throw null; } }
public Azure.AI.TextAnalytics.TextAnalyticsOperationStatus Status { get { throw null; } }
public override Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection Value { get { throw null; } }
public override Azure.AsyncPageable<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection> Value { get { throw null; } }
public virtual void Cancel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { }
public virtual System.Threading.Tasks.Task CancelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override Azure.Response GetRawResponse() { throw null; }
public override Azure.Pageable<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection> GetValues() { throw null; }
public override Azure.AsyncPageable<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection> GetValuesAsync() { throw null; }
public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.ValueTask<Azure.Response> UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.ValueTask<Azure.Response<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection>> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.ValueTask<Azure.Response<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection>> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.ValueTask<Azure.Response<Azure.AsyncPageable<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection>>> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.ValueTask<Azure.Response<Azure.AsyncPageable<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResultCollection>>> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class AnalyzeHealthcareEntitiesOptions : Azure.AI.TextAnalytics.TextAnalyticsRequestOptions
{
public AnalyzeHealthcareEntitiesOptions() { }
public int? Skip { get { throw null; } set { } }
public int? Top { get { throw null; } set { } }
}
public partial class AnalyzeHealthcareEntitiesResult : Azure.AI.TextAnalytics.TextAnalyticsResult
{
Expand Down Expand Up @@ -337,6 +337,13 @@ public readonly partial struct OpinionSentiment
public Azure.AI.TextAnalytics.TextSentiment Sentiment { get { throw null; } }
public string Text { get { throw null; } }
}
public abstract partial class PageableOperation<T> : Azure.Operation<Azure.AsyncPageable<T>> where T : notnull
{
protected PageableOperation() { }
public override Azure.AsyncPageable<T> Value { get { throw null; } }
public abstract Azure.Pageable<T> GetValues();
public abstract Azure.AsyncPageable<T> GetValuesAsync();
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct PiiEntity
{
Expand Down Expand Up @@ -515,7 +522,6 @@ public TextAnalyticsClient(System.Uri endpoint, Azure.Core.TokenCredential crede
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.TextAnalytics.ExtractKeyPhrasesResultCollection>> ExtractKeyPhrasesBatchAsync(System.Collections.Generic.IEnumerable<string> documents, string language = null, Azure.AI.TextAnalytics.TextAnalyticsRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public virtual Azure.AsyncPageable<Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesResult> GetHealthcareEntities(Azure.AI.TextAnalytics.AnalyzeHealthcareEntitiesOperation operation, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.AI.TextAnalytics.CategorizedEntityCollection> RecognizeEntities(string document, string language = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.TextAnalytics.CategorizedEntityCollection>> RecognizeEntitiesAsync(string document, string language = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.AI.TextAnalytics.RecognizeEntitiesResultCollection> RecognizeEntitiesBatch(System.Collections.Generic.IEnumerable<Azure.AI.TextAnalytics.TextDocumentInput> documents, Azure.AI.TextAnalytics.TextAnalyticsRequestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down
Loading