Skip to content

Commit a7fad7c

Browse files
koen-mertensrameezmicrosoft
andauthored
Update client and models based on new typespec version (2024-10-01) (#48359)
* generate SDK with new inferences * Create Sample01_GuidanceSample.cs * added inference * updated for latest commit id * Update cspell.json * updated assets * updated api * dot net build commit * updated formatting * updated assets * Update Azure.Health.Insights.RadiologyInsights.csproj * updated changelog * Update CHANGELOG.md * resolvbed review comments * updated snippet * Update CHANGELOG.md * Update README.md * fix reviewer comments and regenerate based on latest commit id for tsp * Update CHANGELOG.md --------- Co-authored-by: rameezmicrosoft <[email protected]>
1 parent 2e63a91 commit a7fad7c

File tree

51 files changed

+5425
-17
lines changed

Some content is hidden

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

51 files changed

+5425
-17
lines changed

.vscode/cspell.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,6 +1728,23 @@
17281728
"prebuilts"
17291729
]
17301730
},
1731+
{
1732+
"filename": "**/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/**",
1733+
"words": [
1734+
"Ceus",
1735+
"Tonnis",
1736+
"Hnpcc",
1737+
"Ascvd",
1738+
"Mednax",
1739+
"Cusick",
1740+
"Acrad",
1741+
"Kellgren",
1742+
"Frax",
1743+
"Birads",
1744+
"Agatston",
1745+
"Tyrer"
1746+
]
1747+
},
17311748
{
17321749
"filename": "**/sdk/iotoperations/Azure.ResourceManager.IotOperations/api/*.cs",
17331750
"words": [

sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Release History
22

3+
## 1.1.0 (2025-06-13)
4+
5+
### Features Added
6+
7+
- Class `QualityMeasureInference` added
8+
- Class `ScoringAndAssessmentInference` added
9+
- Class `GuidanceInference` added
10+
311
## 1.0.0 (2024-08-16)
412
- GA release
513

sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This table shows the relationship between SDK versions and supported API version
2525
|SDK version|Supported API version of service |
2626
|-------------|---------------|
2727
|1.0.0 | 2024-04-01|
28+
|1.1.0 | 2024-10-01|
2829

2930
### Authenticate the client
3031

sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.net8.0.cs

Lines changed: 231 additions & 1 deletion
Large diffs are not rendered by default.

sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.netstandard2.0.cs

Lines changed: 231 additions & 1 deletion
Large diffs are not rendered by default.

sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "net",
44
"TagPrefix": "net/healthinsights/Azure.Health.Insights.RadiologyInsights",
5-
"Tag": "net/healthinsights/Azure.Health.Insights.RadiologyInsights_7b9442bc23"
5+
"Tag": "net/healthinsights/Azure.Health.Insights.RadiologyInsights_ad57304204"
66
}
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
# How to extract the description of a Clinical Guidance inference using a synchronous call
2+
3+
In this sample it is shown how you can construct a request, add a configuration, create a client, send a synchronous request and use the result returned to extract clinical guidance information from radiology reports, display findings codes, present guidance information, and recommendation proposals.
4+
5+
## Creating a PatientRecord with Details, Encounter, and Document Content
6+
To create a comprehensive patient record, instantiate a `PatientRecord` object with the patient’s details, encounter information, and document content. This record includes the patient’s birth date, sex, encounter class, period, and associated clinical documents, such as radiology reports. The `PatientRecord` object is then populated with these details to ensure all relevant patient information is accurately captured and organized.
7+
```C# Snippet:Guidance_Sync_Tests_Samples_CreatePatientRecord
8+
string id = "patient_id2";
9+
PatientDetails patientInfo = new()
10+
{
11+
BirthDate = new System.DateTime(1959, 11, 11),
12+
Sex = PatientSex.Female,
13+
};
14+
PatientEncounter encounter = new("encounterid1")
15+
{
16+
Class = EncounterClass.InPatient,
17+
Period = new TimePeriod
18+
{
19+
Start = new System.DateTime(2021, 08, 28),
20+
End = new System.DateTime(2021, 08, 28)
21+
}
22+
};
23+
List<PatientEncounter> encounterList = new() { encounter };
24+
ClinicalDocumentContent documentContent = new(DocumentContentSourceType.Inline, DOC_CONTENT);
25+
PatientDocument patientDocument = new(ClinicalDocumentContentType.Note, "doc2", documentContent)
26+
{
27+
ClinicalType = ClinicalDocumentType.RadiologyReport,
28+
CreatedAt = new System.DateTime(2021, 08, 28),
29+
AdministrativeMetadata = CreateDocumentAdministrativeMetadata()
30+
};
31+
PatientRecord patientRecord = new(id);
32+
patientRecord.Details = patientInfo;
33+
patientRecord.Encounters.Add(encounter);
34+
patientRecord.PatientDocuments.Add(patientDocument);
35+
```
36+
37+
## Specifying Document Content for Patient Record
38+
To define the document content for a patient record, create a constant string `DOC_CONTENT` that includes detailed clinical history, comparison, technique, findings, and impression sections. This content provides comprehensive information about the patient’s medical history, the techniques used in the examination, and the findings from the radiology report. This structured document content is essential for accurate and thorough patient records.
39+
```C# Snippet:Guidance_Sync_Tests_Samples_Doc_Content
40+
private const string DOC_CONTENT = "History:" +
41+
"\r\n Left renal tumor with thin septations." +
42+
"\r\n Findings:" +
43+
"\r\n There is a right kidney tumor with nodular calcification.";
44+
```
45+
46+
## Creating Ordered Procedures for Patient Record
47+
To add ordered procedures to a patient record, instantiate a `DocumentAdministrativeMetadata` object and create a `FhirR4Coding` object with the relevant procedure details. This includes the display name, code, and system. Then, create a `FhirR4CodeableConcept` object and add the coding to it. Finally, create an `OrderedProcedure` object with a description and code, and add it to the `OrderedProcedures` list of the `DocumentAdministrativeMetadata` object. This process ensures that the ordered procedures are accurately documented and associated with the patient record.
48+
```C# Snippet:Guidance_Sync_Tests_Samples_CreateDocumentAdministrativeMetadata
49+
DocumentAdministrativeMetadata documentAdministrativeMetadata = new DocumentAdministrativeMetadata();
50+
51+
FhirR4Coding coding = new()
52+
{
53+
Display = "US PELVIS COMPLETE",
54+
Code = "USPELVIS",
55+
System = "Http://hl7.org/fhir/ValueSet/cpt-all"
56+
};
57+
58+
FhirR4CodeableConcept codeableConcept = new();
59+
codeableConcept.Coding.Add(coding);
60+
61+
OrderedProcedure orderedProcedure = new()
62+
{
63+
Description = "US PELVIS COMPLETE",
64+
Code = codeableConcept
65+
};
66+
67+
documentAdministrativeMetadata.OrderedProcedures.Add(orderedProcedure);
68+
```
69+
70+
## Creating and Configuring ModelConfiguration for Radiology Insights
71+
To set up a `RadiologyInsightsModelConfiguration`, instantiate the configuration object and specify the locale, whether to include evidence, and the inference options. Additionally, define the expected response inference types by adding them to the `InferenceTypes` list. This configuration ensures that the radiology insights model is tailored to the specific requirements and expected outcomes of the analysis.
72+
```C# Snippet:Guidance_Sync_Tests_Samples_CreateModelConfiguration
73+
RadiologyInsightsModelConfiguration radiologyInsightsModelConfiguration = new()
74+
{
75+
Locale = "en-US",
76+
IncludeEvidence = true,
77+
InferenceOptions = radiologyInsightsInferenceOptions
78+
};
79+
radiologyInsightsModelConfiguration.InferenceTypes.Add(RadiologyInsightsInferenceType.Guidance);
80+
```
81+
82+
## Adding Inference Options to ModelConfiguration for Radiology Insights
83+
To configure the inference options for the radiology insights model, create instances of `RadiologyInsightsInferenceOptions`, `FollowupRecommendationOptions`, and `FindingOptions`. Set the desired properties for follow-up recommendations and findings, such as including recommendations with no specified modality, including recommendations in references, and providing focused sentence evidence. Assign these options to the `RadiologyInsightsInferenceOptions` object, ensuring that the model configuration is tailored to provide detailed and relevant insights.
84+
```C# Snippet:Guidance_Sync_Tests_Samples_CreateRadiologyInsightsInferenceOptions
85+
RadiologyInsightsInferenceOptions radiologyInsightsInferenceOptions = new();
86+
FollowupRecommendationOptions followupRecommendationOptions = new();
87+
FindingOptions findingOptions = new();
88+
followupRecommendationOptions.IncludeRecommendationsWithNoSpecifiedModality = true;
89+
followupRecommendationOptions.IncludeRecommendationsInReferences = true;
90+
followupRecommendationOptions.ProvideFocusedSentenceEvidence = true;
91+
findingOptions.ProvideFocusedSentenceEvidence = true;
92+
radiologyInsightsInferenceOptions.FollowupRecommendationOptions = followupRecommendationOptions;
93+
radiologyInsightsInferenceOptions.FindingOptions = findingOptions;
94+
```
95+
96+
## Adding PatientRecord and ModelConfiguration to RadiologyInsightsData
97+
To integrate the patient record and model configuration into `RadiologyInsightsData`, create a list of `PatientRecord` objects and initialize it with the patient record. Then, instantiate `RadiologyInsightsData` with this list. Finally, set the Configuration property of `RadiologyInsightsData` to the model configuration created using the `CreateConfiguration` method. This ensures that the data object is fully prepared with both patient information and the necessary configuration for radiology insights analysis.
98+
```C# Snippet:Guidance_Sync_Tests_Samples_AddRecordAndConfiguration
99+
List<PatientRecord> patientRecords = new() { patientRecord };
100+
RadiologyInsightsData radiologyInsightsData = new(patientRecords);
101+
radiologyInsightsData.Configuration = CreateConfiguration();
102+
```
103+
104+
## Initializing RadiologyInsights Client with Default Azure Credentials
105+
Create a `RadiologyInsightsClient` by initializing TokenCredential using the default Azure credentials.
106+
```C# Snippet:Guidance_Sync_Tests_Samples_TokenCredential
107+
Uri endpointUri = new Uri(endpoint);
108+
TokenCredential cred = new DefaultAzureCredential();
109+
RadiologyInsightsClient client = new RadiologyInsightsClient(endpointUri, cred);
110+
```
111+
112+
## Sending Synchronous Requests with RadiologyInsights Client
113+
Send a synchronous request using the `RadiologyInsightsClient` along with the job id and radiologyInsightsjob.
114+
```C# Snippet:Guidance_Sync_Tests_Samples_synccall
115+
RadiologyInsightsJob radiologyInsightsjob = GetRadiologyInsightsJob();
116+
var jobId = "job" + DateTimeOffset.Now.ToUnixTimeMilliseconds();
117+
Operation<RadiologyInsightsInferenceResult> operation = client.InferRadiologyInsights(WaitUntil.Completed, jobId, radiologyInsightsjob);
118+
```
119+
120+
## Displaying Guidance Inferences from Radiology Insights
121+
Below code retrieves clinical guidance inferences from radiology report analysis results and displays key information for each guidance inference found. It extracts and displays finding codes, identifiers, present guidance information, rankings, recommendation proposals, and any missing guidance information - providing a comprehensive view of the clinical guidance derived from the radiology report.
122+
```C# Snippet:Guidance_Sync_Tests_Samples_GuidanceInference
123+
RadiologyInsightsInferenceResult responseData = operation.Value;
124+
IReadOnlyList<RadiologyInsightsInference> inferences = responseData.PatientResults[0].Inferences;
125+
126+
foreach (RadiologyInsightsInference inference in inferences)
127+
{
128+
if (inference is GuidanceInference guidanceInference)
129+
{
130+
Console.WriteLine("Guidance Inference found: ");
131+
132+
FindingInference findingInference = guidanceInference.Finding;
133+
FhirR4Observation finding = findingInference.Finding;
134+
if (finding.Code != null)
135+
{
136+
Console.WriteLine(" Finding Code: ");
137+
DisplayCodes(finding.Code, 2);
138+
}
139+
140+
Console.WriteLine(" Identifier: ");
141+
DisplayCodes(guidanceInference.Identifier, 2);
142+
143+
foreach (var presentInfo in guidanceInference.PresentGuidanceInformation)
144+
{
145+
Console.WriteLine(" Present Guidance Information: ");
146+
DisplayPresentGuidanceInformation(presentInfo);
147+
}
148+
149+
Console.WriteLine($" Ranking: {guidanceInference.Ranking}");
150+
IReadOnlyList<FollowupRecommendationInference> recommendationProposals = guidanceInference.RecommendationProposals;
151+
foreach (FollowupRecommendationInference recommendationProposal in recommendationProposals)
152+
{
153+
Console.WriteLine($" Recommendation Proposal: {recommendationProposal.RecommendedProcedure.Kind}");
154+
}
155+
156+
foreach (var missingInfo in guidanceInference.MissingGuidanceInformation)
157+
{
158+
Console.WriteLine($" Missing Guidance Information: {missingInfo}");
159+
}
160+
}
161+
}
162+
```
163+
164+
## Display FHIR R4 Coding Information
165+
Below code iterates through a list of FHIR R4 codings and displays their key components.
166+
```C# Snippet:Guidance_Sync_Sync_Tests_Samples_DisplayCodes
167+
IList<FhirR4Coding> codingList = codeableConcept.Coding;
168+
if (codingList != null)
169+
{
170+
foreach (FhirR4Coding fhirR4Coding in codingList)
171+
{
172+
Console.WriteLine(initialBlank + "Coding: " + fhirR4Coding.Code + ", " + fhirR4Coding.Display + " (" + fhirR4Coding.System + ")");
173+
}
174+
}
175+
```
176+
177+
## Display Present Guidance Information and Measurements
178+
Below code displays comprehensive guidance information including present values, size measurements, and dimensional data from radiology findings.
179+
```C# Snippet:Guidance_Sync_Tests_Samples_DisplayPresentGuidanceInformation
180+
if (guidanceInfo.PresentGuidanceValues != null)
181+
{
182+
foreach (var value in guidanceInfo.PresentGuidanceValues)
183+
{
184+
Console.WriteLine($" Present Guidance Value: {value}");
185+
}
186+
}
187+
188+
if (guidanceInfo.Sizes != null)
189+
{
190+
foreach (var size in guidanceInfo.Sizes)
191+
{
192+
if (size.ValueQuantity != null)
193+
{
194+
Console.WriteLine(" Size ValueQuantity: ");
195+
DisplayQuantityOutput(size.ValueQuantity);
196+
}
197+
if (size.ValueRange != null)
198+
{
199+
if (size.ValueRange.Low != null)
200+
{
201+
Console.WriteLine($" Size ValueRange: min {size.ValueRange.Low}");
202+
}
203+
if (size.ValueRange.High != null)
204+
{
205+
Console.WriteLine($" Size ValueRange: max {size.ValueRange.High}");
206+
}
207+
}
208+
}
209+
}
210+
211+
if (guidanceInfo.MaximumDiameterAsInText != null)
212+
{
213+
Console.WriteLine(" Maximum Diameter As In Text: ");
214+
DisplayQuantityOutput(guidanceInfo.MaximumDiameterAsInText);
215+
}
216+
217+
if (guidanceInfo.Extension != null)
218+
{
219+
Console.WriteLine(" Extension: ");
220+
DisplaySectionInfo(guidanceInfo);
221+
}
222+
```
223+
224+
## Display Quantity Values and Units
225+
Below code outputs the numeric value and unit of measurement from a quantity object. It checks for both components separately since either could be null.
226+
```C# Snippet:Guidance_Sync_Tests_Samples_DisplayQuantityOutput
227+
if (quantity.Value != null)
228+
{
229+
Console.WriteLine($" Value: {quantity.Value}");
230+
}
231+
if (quantity.Unit != null)
232+
{
233+
Console.WriteLine($" Unit: {quantity.Unit}");
234+
}
235+
```
236+
237+
## Display Section Information from Extensions
238+
Below code processes extension data within guidance information, specifically looking for sections and their associated details.
239+
```C# Snippet:Guidance_Sync_Tests_Samples_DisplaySectionInfo
240+
if (guidanceInfo.Extension != null)
241+
{
242+
foreach (var ext in guidanceInfo.Extension)
243+
{
244+
if (ext.Url == "section")
245+
{
246+
Console.WriteLine(" Section:");
247+
if (ext.Extension != null)
248+
{
249+
foreach (var subextension in ext.Extension)
250+
{
251+
if (subextension.Url != null && subextension.ValueString != null)
252+
{
253+
Console.WriteLine($" {subextension.Url}: {subextension.ValueString}");
254+
}
255+
}
256+
}
257+
}
258+
}
259+
}
260+
```

0 commit comments

Comments
 (0)