rama creada apartir de master en j

This commit is contained in:
jrojas
2026-06-26 10:29:23 +02:00
parent 319fd3dfb0
commit c1517fda87
2810 changed files with 1927392 additions and 25392 deletions
@@ -1,16 +1,25 @@
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents an observation that conveys a boolean value, extending the base <see cref="Observation"/> type.
/// </summary>
public class BoolObservation : Observation
{
public bool Value { get; set; }
/// <summary>
/// Creates a <see cref="BoolObservation"/> from the first item in the provided list of patient observations.
/// Returns <see langword="null"/> when the list is empty.
/// </summary>
/// <param name="obs">The list of patient observations from which the first entry is converted.</param>
/// <returns>A <see cref="BoolObservation"/> containing the boolean value of the first observation, or <see langword="null"/> if the list contains no observations.</returns>
internal static BoolObservation? From(List<PatientObservation> obs)
{
if (obs.Count > 0)
return new BoolObservation
{
Value = (bool)obs[0].Value
};
return null;
}
{
if (obs.Count > 0)
return new BoolObservation
{
Value = (bool)obs[0].Value
};
return null;
}
}
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents an observation that is associated with a chart, providing chart-specific contextual data derived from the base <see cref="Observation"/> type.
/// </summary>
public class ChartObservation : Observation
{
public List<double> Values { get; set; } = [];
@@ -10,8 +13,15 @@ public class ChartObservation : Observation
public double? MinWarn { get; set; }
public double? MaxWarn { get; set; }
/// <summary>
/// Creates a new <see cref="ChartObservation"/> instance from the provided list of patient observations.
/// Throws an exception when the source list is null; otherwise returns a new empty <see cref="ChartObservation"/>.
/// </summary>
/// <param name="obs">The list of patient observations to convert.</param>
/// <returns>A new <see cref="ChartObservation"/> instance.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="obs"/> is null.</exception>
internal static ChartObservation From(List<PatientObservation> obs)
{
return obs == null ? throw new ArgumentNullException(nameof(obs)) : new ChartObservation();
}
{
return obs == null ? throw new ArgumentNullException(nameof(obs)) : new ChartObservation();
}
}
@@ -2,23 +2,32 @@
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents an observation that captures a double-precision floating-point measurement or value.
/// Inherits from the base <see cref="Observation"/> type, providing a specialized observation variant for numeric data of type <see cref="double"/>.
/// </summary>
public class DoubleObservation : Observation
{
public double? Value { get; set; }
public double? LastValue { get; set; }
/// <summary>
/// Creates a <see cref="DoubleObservation"/> from a list of <see cref="PatientObservation"/> instances, using the first element's value as the primary <c>Value</c> and the second element's value as the <c>LastValue</c> when available.
/// </summary>
/// <param name="obs">The list of patient observations to convert. At least one element is required to produce a result.</param>
/// <returns>A <see cref="DoubleObservation"/> populated with the converted double values, or <c>null</c> if the list is empty.</returns>
public static DoubleObservation? From(List<PatientObservation> obs)
{
if (obs.Count > 0)
{
var val = new DoubleObservation
if (obs.Count > 0)
{
Value = obs[0].Value.ToDouble()
};
if (obs.Count > 1) val.LastValue = obs[1].Value.ToDouble();
return val;
var val = new DoubleObservation
{
Value = obs[0].Value.ToDouble()
};
if (obs.Count > 1) val.LastValue = obs[1].Value.ToDouble();
return val;
}
return null;
}
return null;
}
}
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents a complete observation as a specialized form of the <see cref="Observation"/> base class.
/// </summary>
public class FullObservation : Observation
{
public DateTime LastObservationDate;
@@ -17,19 +20,24 @@ public class FullObservation : Observation
public double? MinWarn { get; set; }
public double? MaxWarn { get; set; }
/// <summary>
/// Creates a <see cref="FullObservation"/> from a list of <see cref="PatientObservation"/> records, using the first entry's data and, when available, the second entry's value and time as the last observation. Returns <c>null</c> when the provided list is empty.
/// </summary>
/// <param name="obs">The list of patient observations to convert; only the first two entries are used when present.</param>
/// <returns>A <see cref="FullObservation"/> built from the first observation, or <c>null</c> if <paramref name="obs"/> contains no items.</returns>
public static FullObservation? From(List<PatientObservation> 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;
}
{
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;
}
}
@@ -3,6 +3,12 @@ using adas_core.Domain.Utils;
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents a medication-related observation, extending the base <see cref="Observation"/> type.
/// </summary>
/// <remarks>
/// Serves as a specialized observation for capturing and modeling medication-specific data within the inheritance hierarchy.
/// </remarks>
public class Medication : Observation
{
public Medication()
@@ -46,6 +52,9 @@ public class Medication : Observation
public Drug? Drug { get; set; }
}
/// <summary>
/// Represents a value or data entry associated with a drug, such as dosage, concentration, or other pharmaceutical-related information.
/// </summary>
public class DrugValue
{
public DrugValue()
@@ -69,17 +78,27 @@ public class DrugValue
public string? CodingSystem { get; set; }
public char? Result { get; set; } = 'R';
/// <summary>
/// Copies the values from the specified <see cref="DrugValue"/> instance into the current instance, replacing the existing Id, Text, Units, Time, CodingSystem, and Result properties.
/// </summary>
/// <param name="common">The <see cref="DrugValue"/> instance whose property values will be copied to the current instance.</param>
public void Copy(DrugValue common)
{
Id = common.Id;
Text = common.Text;
Units = common.Units;
Time = common.Time;
CodingSystem = common.CodingSystem;
Result = common.Result;
}
{
Id = common.Id;
Text = common.Text;
Units = common.Units;
Time = common.Time;
CodingSystem = common.CodingSystem;
Result = common.Result;
}
}
/// <summary>
/// Represents an abstract base class for drug values that are expressed as double-precision floating-point numbers, providing a common foundation for numerical drug-related data.
/// </summary>
/// <remarks>
/// As an abstract class, it must be inherited by a derived class that supplies the concrete implementation for the double-based drug value behavior.
/// </remarks>
public abstract class DrugDoubleValue : DrugValue
{
protected DrugDoubleValue(PumpElement pumpElement) : base(pumpElement)
@@ -91,29 +110,69 @@ public abstract class DrugDoubleValue : DrugValue
public double? Value { get; set; }
}
/// <summary>
/// Serves as an abstract base class for drug values represented as strings, extending <see cref="DrugValue"/>.
/// </summary>
/// <remarks>
/// Inherits from <see cref="DrugValue"/> and is intended to be derived by concrete classes that encapsulate string-typed drug data associated with a <see cref="PumpElement"/>.
/// </remarks>
public abstract class DrugStringValue(PumpElement pumpElement) : DrugValue(pumpElement)
{
public string? Value { get; set; } = pumpElement.Value?.ToString();
}
/// <summary>
/// Represents a double-precision drug value that describes the flow of a fluid for the specified <see cref="PumpElement"/>.
/// </summary>
public class FlowFluid(PumpElement pumpElement) : DrugDoubleValue(pumpElement);
/// <summary>
/// Represents the total volume of fluid delivered as a drug-related double value associated with a specific pump element.
/// </summary>
/// <remarks>
/// Inherits from <see cref="DrugDoubleValue"/>, sharing the pump element context with its base type.
/// </remarks>
public class VolumeFluidDeliveryTotal(PumpElement pumpElement) : DrugDoubleValue(pumpElement);
/// <summary>
/// Represents the delivery pressure of a pump as a drug-related double precision value.
/// </summary>
/// <remarks>
/// Inherits from <see cref="DrugDoubleValue"/> and is constructed with a <see cref="PumpElement"/> instance that is forwarded to the base constructor.
/// </remarks>
public class PumpDeliveryPressure(PumpElement pumpElement) : DrugDoubleValue(pumpElement);
/// <summary>
/// Represents the remaining volume of fluid to be infused (TBI) associated with a pump element, implemented as a drug-related double value.
/// </summary>
public class VolumeFluidTbiRemain(PumpElement pumpElement) : DrugDoubleValue(pumpElement);
/// <summary>
/// Represents the remaining time for volume fluid delivery, derived from a drug double value associated with a pump element.
/// </summary>
/// <remarks>
/// Inherits from <see cref="DrugDoubleValue"/> and is constructed with a <see cref="PumpElement"/> to capture time-related fluid volume metrics.
/// </remarks>
public class VolumeFluidTimePdRemain(PumpElement pumpElement) : DrugDoubleValue(pumpElement);
/// <summary>
/// Represents the active sources of a pump element as a drug string value.
/// Inherits from <see cref="DrugStringValue"/>, encapsulating source information for pump operations.
/// </summary>
public class PumpActiveSources(PumpElement pumpElement) : DrugStringValue(pumpElement)
{
public string? ValueId { get; set; } = pumpElement.ValueId;
public string? ValueCodingSystem { get; set; } = pumpElement.ValueCodingSystem;
}
/// <summary>
/// Represents a drug value associated with a pump element, inheriting from the DrugStringValue base class.
/// </summary>
public class Drug(PumpElement pumpElement) : DrugStringValue(pumpElement);
/// <summary>
/// Represents a pump mode as a drug-related string value, inheriting string-based value semantics from <see cref="DrugStringValue"/>.
/// </summary>
public class PumpMode : DrugStringValue
{
public PumpMode(PumpElement pumpElement) : base(pumpElement)
@@ -122,6 +181,9 @@ public class PumpMode : DrugStringValue
}
}
/// <summary>
/// Represents the operational status of a pump as a drug-related string value.
/// </summary>
public class PumpStatus : DrugStringValue
{
public PumpStatus(PumpElement pumpElement) : base(pumpElement)
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents a single observation or recorded data point.
/// </summary>
public class Observation
{
}
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents a paginated collection of observation results, typically used to return a subset of observations along with associated pagination metadata.
/// </summary>
public class ObservationPaginatedResult
{
public int Count { get; set; } = 0;
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents a request for retrieving observations data, typically used to encapsulate query parameters or filtering criteria when interacting with an observations service or repository.
/// </summary>
public class ObservationsRequest
{
public string? PatientNumber { get; set; }
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents a prediction result or data model for medication observation.
/// </summary>
public class PredictMedicationObservation
{
public string MedicineText { get; set; } = string.Empty;
@@ -1,16 +1,28 @@
namespace adas_core.Domain.Models.Observations;
/// <summary>
/// Represents an observation that is associated with string data, extending the base Observation type.
/// </summary>
/// <remarks>
/// This class specializes the Observation concept for textual or string-based content, inheriting the core observation behavior from its parent class.
/// </remarks>
public class StringObservation : Observation
{
public string Value { get; set; } = string.Empty;
/// <summary>
/// Creates a <see cref="StringObservation"/> from the first <see cref="PatientObservation"/> in the provided list.
/// Returns <c>null</c> when the list is empty.
/// </summary>
/// <param name="obs">The list of <see cref="PatientObservation"/> instances to convert.</param>
/// <returns>A <see cref="StringObservation"/> populated with the string value of the first observation, or <c>null</c> if the list contains no elements.</returns>
public static StringObservation? From(List<PatientObservation> obs)
{
if (obs.Count > 0)
return new StringObservation
{
Value = (string)obs[0].Value
};
return null;
}
{
if (obs.Count > 0)
return new StringObservation
{
Value = (string)obs[0].Value
};
return null;
}
}