using adas_core.Domain.Utils;
namespace adas_core.Domain.Models.Observations;
///
/// Represents an observation that captures a double-precision floating-point measurement or value.
/// Inherits from the base type, providing a specialized observation variant for numeric data of type .
///
public class DoubleObservation : Observation
{
public double? Value { get; set; }
public double? LastValue { get; set; }
///
/// Creates a from a list of instances, using the first element's value as the primary Value and the second element's value as the LastValue when available.
///
/// The list of patient observations to convert. At least one element is required to produce a result.
/// A populated with the converted double values, or null if the list is empty.
public static DoubleObservation? From(List obs)
{
if (obs.Count > 0)
{
var val = new DoubleObservation
{
Value = obs[0].Value.ToDouble()
};
if (obs.Count > 1) val.LastValue = obs[1].Value.ToDouble();
return val;
}
return null;
}
}