feature: NEWS2 Composite Scoring Engine
This commit is contained in:
@@ -0,0 +1 @@
|
||||
public record News2CachedParam(decimal Value, int Score, DateTimeOffset RecordedAt);
|
||||
@@ -0,0 +1,6 @@
|
||||
public record News2ObservationEvent(
|
||||
Guid ObservationId,
|
||||
Guid EncounterId,
|
||||
Guid PatientId,
|
||||
string ObservationCode,
|
||||
decimal Value);
|
||||
@@ -0,0 +1,13 @@
|
||||
public record News2Result(
|
||||
News2Outcome Outcome,
|
||||
int? TotalScore = null,
|
||||
string? RiskLevel = null,
|
||||
bool AlertCreated = false,
|
||||
int PresentParameters = 0,
|
||||
bool HasSingleParamThree = false)
|
||||
{
|
||||
public static readonly News2Result NotNews2Code = new(News2Outcome.NotNews2Code);
|
||||
|
||||
public static News2Result IncompleteParameters(int presentCount) =>
|
||||
new(News2Outcome.IncompleteParameters, PresentParameters: presentCount);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
public record News2ScoreCursor(DateTimeOffset CalculatedAt, Guid Id)
|
||||
{
|
||||
public string Encode()
|
||||
{
|
||||
var json = JsonSerializer.Serialize(this);
|
||||
return Convert.ToBase64String(Encoding.UTF8.GetBytes(json));
|
||||
}
|
||||
|
||||
public static News2ScoreCursor? Decode(string? encoded)
|
||||
{
|
||||
if (string.IsNullOrEmpty(encoded)) return null;
|
||||
try
|
||||
{
|
||||
var json = Encoding.UTF8.GetString(Convert.FromBase64String(encoded));
|
||||
return JsonSerializer.Deserialize<News2ScoreCursor>(json);
|
||||
}
|
||||
catch { return null; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user