chore: necessary updates given the changes in the alert controller
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
public class AlertExplanation
|
||||
{
|
||||
public List<ScoreContributor> ScoreContributors { get; set; } = new();
|
||||
public TrendContext? Trend { get; set; }
|
||||
public MedicationContext? MedicationContext { get; set; }
|
||||
public string NarrativeSummary { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class ScoreContributor
|
||||
{
|
||||
public string Parameter { get; set; } = string.Empty;
|
||||
public int Points { get; set; }
|
||||
public string? RawValue { get; set; }
|
||||
public string? NormalRange { get; set; }
|
||||
}
|
||||
|
||||
public class TrendContext
|
||||
{
|
||||
public string Parameter { get; set; } = string.Empty;
|
||||
public double PercentChange { get; set; }
|
||||
public TimeSpan Duration { get; set; }
|
||||
public string Direction { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class MedicationContext
|
||||
{
|
||||
public string DrugName { get; set; } = string.Empty;
|
||||
public string Dose { get; set; } = string.Empty;
|
||||
public string Route { get; set; } = string.Empty;
|
||||
public DateTimeOffset AdministeredAt { get; set; }
|
||||
public string? RelevanceNote { get; set; }
|
||||
}
|
||||
@@ -1,3 +1,19 @@
|
||||
public record AlertResponse(
|
||||
Guid Id, string AlertType, string Severity, string Status,
|
||||
string Details, DateTimeOffset TriggeredAt);
|
||||
Guid Id,
|
||||
Guid EncounterId,
|
||||
Guid PatientId,
|
||||
string AlertType,
|
||||
string Severity,
|
||||
string Details,
|
||||
string Status,
|
||||
DateTimeOffset TriggeredAt,
|
||||
DateTimeOffset? AcknowledgedAt = null,
|
||||
string? AcknowledgedBy = null,
|
||||
DateTimeOffset? ResolvedAt = null,
|
||||
AlertExplanation? Explanation = null)
|
||||
{
|
||||
public string DisplaySummary =>
|
||||
string.IsNullOrWhiteSpace(Explanation?.NarrativeSummary)
|
||||
? Details
|
||||
: Explanation!.NarrativeSummary;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
public class VigilCareApiClient
|
||||
{
|
||||
private static readonly JsonSerializerOptions ApiJsonOptions = new(JsonSerializerDefaults.Web);
|
||||
|
||||
private readonly HttpClient _http;
|
||||
|
||||
public VigilCareApiClient(HttpClient http)
|
||||
@@ -147,7 +150,7 @@ public class VigilCareApiClient
|
||||
var response = await _http.GetAsync($"/api/v1/encounters/{encounterId}/alerts");
|
||||
if (!response.IsSuccessStatusCode) return new();
|
||||
var envelope = await response.Content
|
||||
.ReadFromJsonAsync<ApiResponse<PagedResponse<AlertResponse>>>();
|
||||
.ReadFromJsonAsync<ApiResponse<PagedResponse<AlertResponse>>>(ApiJsonOptions);
|
||||
return envelope?.Data?.Items?.ToList() ?? new();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user