Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,14 @@ private static VisualizationResource CreateAdaptiveCardResource(List<IResource>
{
type = "TextBlock",
text = "🔍 Clinical Entities Extracted",
weight = "Bolder",
size = "Large",
color = "Accent"
weight = "bolder",
},
new
{
type = "TextBlock",
text = $"Found {entities.Count} clinical {(entities.Count == 1 ? "entity" : "entities")} in the note",
wrap = true,
size = "Medium",
spacing = "Small"
spacing = "small"
}
};

Expand All @@ -227,7 +224,7 @@ private static VisualizationResource CreateAdaptiveCardResource(List<IResource>
{
type = "Container",
style = "emphasis",
spacing = "Medium",
spacing = "medium",
items = new object[]
{
new
Expand All @@ -245,8 +242,7 @@ private static VisualizationResource CreateAdaptiveCardResource(List<IResource>
{
type = "TextBlock",
text = GetEntityIcon(entityType),
size = "Large",
spacing = "None"
spacing = "none"
}
}
},
Expand All @@ -260,25 +256,21 @@ private static VisualizationResource CreateAdaptiveCardResource(List<IResource>
{
type = "TextBlock",
text = $"**{GetEntityTypeDisplayName(entityType)}**",
weight = "Bolder",
size = "Medium",
spacing = "None"
weight = "bolder",
spacing = "none"
},
new
{
type = "TextBlock",
text = entityName,
color = "Accent",
spacing = "None"
spacing = "none"
},
new
{
type = "TextBlock",
text = entityValue,
wrap = true,
size = "Small",
color = "Default",
spacing = "Small"
spacing = "small"
}
}
}
Expand Down Expand Up @@ -314,46 +306,49 @@ private static VisualizationResource CreateAdaptiveCardResource(List<IResource>
{
type = "TextBlock",
text = $"Processed at {DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC",
size = "Small",
horizontalAlignment = "Right",
spacing = "Medium"
spacing = "medium"
});

return new VisualizationResource
{
Id = Guid.NewGuid().ToString(),
Type = "AdaptiveCard",
Subtype = VisualizationSubtype.Note,
Subtype = VisualizationSubtype.Timeline,
CardTitle = "Clinical Entities Extracted",
AdaptiveCardPayload = new
PartnerLogo = "https://example.com/assets/sample-extension-logo.png",
AdaptiveCardPayload = new AdaptiveCardPayload
{
type = "AdaptiveCard",
version = "1.3",
body = bodyElements.ToArray()
Type = "AdaptiveCard",

Copilot AI Nov 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Type property assignment is redundant since AdaptiveCardPayload.Type already has a default value of "AdaptiveCard". This line can be removed.

Suggested change
Type = "AdaptiveCard",

Copilot uses AI. Check for mistakes.
Version = "1.3",

Copilot AI Nov 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Version property assignment is redundant since AdaptiveCardPayload.Version already has a default value of "1.3". This line can be removed.

Suggested change
Version = "1.3",

Copilot uses AI. Check for mistakes.
Body = bodyElements.ToArray(),

Copilot AI Nov 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The trailing comma after Body = bodyElements.ToArray() is unnecessary since it's the last property in the object initializer. While not incorrect, removing it would be more consistent with typical C# style.

Suggested change
Body = bodyElements.ToArray(),
Body = bodyElements.ToArray()

Copilot uses AI. Check for mistakes.
},
Actions = new List<VisualizationAction>
{
new()
{
Title = "Accept Analysis",
Action = VisualizationActionType.Accept,
ActionType = ActionButtonType.Primary
ActionType = ActionButtonType.Accept,
Code = "Accept",
},
new()
{
Title = "Copy to Note",
Action = VisualizationActionType.Copy,
ActionType = ActionButtonType.Secondary,
ActionType = ActionButtonType.Copy,
Code = "CLINICAL ENTITY ANALYSIS\n\nEntities detected:\n" +
string.Join("\n", entities.Select(e => $"- {GetEntityNameFromResource(e)} ({GetEntityTypeFromResource(e)})"))
},
new()
{
Title = "Reject Analysis",
Action = VisualizationActionType.Reject,
ActionType = ActionButtonType.Tertiary
ActionType = ActionButtonType.Reject,
Code = "Reject"
}
},
References = new List<VisualizationReference>(),
PayloadSources = new List<PayloadSource>
{
new()
Expand Down
17 changes: 11 additions & 6 deletions src/Dragon.Copilot.Models/ActionButtonType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,22 @@ namespace Dragon.Copilot.Models;
public enum ActionButtonType
{
/// <summary>
/// Primary action button style
/// Accept action button
/// </summary>
Primary,
Accept,

/// <summary>
/// Secondary action button style
/// Copy action button
/// </summary>
Secondary,
Copy,

/// <summary>
/// Tertiary action button style
/// Reject action button
/// </summary>
Tertiary
Reject,

/// <summary>
/// Update note action button
/// </summary>
UpdateNote
}
37 changes: 37 additions & 0 deletions src/Dragon.Copilot.Models/AdaptiveCardPayload.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Dragon.Copilot.Models;

/// <summary>
/// Adaptive card payload structure
/// </summary>
public class AdaptiveCardPayload
{
/// <summary>
/// Adaptive card schema URL
/// </summary>
[JsonPropertyName("$schema")]
public string Schema {get; } = "http://adaptivecards.io/schemas/adaptive-card.json";

Copilot AI Nov 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space between get and } in the property accessor. Should be { get; } for consistency with C# formatting conventions.

Suggested change
public string Schema {get; } = "http://adaptivecards.io/schemas/adaptive-card.json";
public string Schema { get; } = "http://adaptivecards.io/schemas/adaptive-card.json";

Copilot uses AI. Check for mistakes.

/// <summary>
/// Type of the card (always "AdaptiveCard")
/// </summary>
[JsonPropertyName("type")]
public string Type { get; set; } = "AdaptiveCard";

Copilot AI Nov 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Type property has inconsistent accessor pattern. It uses { get; set; } while the similar Schema property (line 18) uses { get; } (getter-only). Since the Type should always be "AdaptiveCard" according to the comment, consider making this getter-only like Schema: public string Type { get; } = "AdaptiveCard";

Suggested change
public string Type { get; set; } = "AdaptiveCard";
public string Type { get; } = "AdaptiveCard";

Copilot uses AI. Check for mistakes.

/// <summary>
/// Adaptive card version
/// </summary>
[JsonPropertyName("version")]
public string Version { get; init; } = "1.3";

/// <summary>
/// Body elements of the adaptive card
/// </summary>
[JsonPropertyName("body")]
public IList<object> Body { get; init; } = new List<object>();
}
2 changes: 1 addition & 1 deletion src/Dragon.Copilot.Models/VisualizationResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class VisualizationResource : IResource
/// Adaptive card payload (required)
/// </summary>
[JsonPropertyName("adaptive_card_payload")]
public required object AdaptiveCardPayload { get; set; }
public required AdaptiveCardPayload AdaptiveCardPayload { get; set; }

/// <summary>
/// Available actions for the card
Expand Down
Loading