namespace adas_core.Domain.Models.Observations;
///
/// Represents a complete observation as a specialized form of the base class.
///
public class FullObservation : Observation
{
public DateTime LastObservationDate;
public DateTime ObservationDate;
public string? Text { get; set; }
public required object Value { get; set; }
public object? LastValue { get; set; }
public double? Min { get; set; }
public double? Max { get; set; }
public double? MinAlert { get; set; }
public double? MaxAlert { get; set; }
public double? MinWarn { get; set; }
public double? MaxWarn { get; set; }
///
/// Creates a from a list of records, using the first entry's data and, when available, the second entry's value and time as the last observation. Returns null when the provided list is empty.
///
/// The list of patient observations to convert; only the first two entries are used when present.
/// A built from the first observation, or null if contains no items.
public static FullObservation? From(List obs)
{
if (obs.Count > 0)
return new FullObservation
{
Text = obs[0].Name,
Value = obs[0].Value,
Min = obs[0].Min,
Max = obs[0].Max,
ObservationDate = obs[0].Time,
LastValue = obs.Count > 1 ? obs[1].Value : null,
LastObservationDate = obs.Count > 1 ? obs[1].Time : DateTime.MinValue
};
return null;
}
}