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
@@ -3,6 +3,9 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents an admission, typically encapsulating data and behavior related to the process of admitting an entity, such as a student or patient, into an institution or system.
/// </summary>
public class Admission
{
public ObjectId Id { get; set; }
@@ -29,23 +32,27 @@ public class Admission
#endregion
/// <summary>
/// Returns a human-readable string representation of the Admission, conditionally including NHC, Person, Admission Date, location, Origin, Diagnosis, and any associated Allergies only when they are present.
/// </summary>
/// <returns>A formatted string in the form "Admission [...]" summarizing the Admission's key properties.</returns>
public override string ToString()
{
List<string> items = [];
if (!string.IsNullOrEmpty(Nhc)) items.Add($"NHC: {Nhc}");
if (Person != null) items.Add($", Person: {Person}");
items.Add($"Admission Date: {AdmissionDate}");
if (PointOfCareId != null) items.Add($"Location: {PointOfCareId}");
if (PatientLocation != null) items.Add($"Location: {PatientLocation}");
if (Origin != null) items.Add($", Origin: {Origin.Name}");
if (Diagnosis != null) items.Add($", Diagnosis; {Diagnosis.Name}");
if (Allergies != null)
{
items.Add("Allergies:");
Allergies.ForEach(a => items.Add($", Allergy; {a.Name}"));
List<string> items = [];
if (!string.IsNullOrEmpty(Nhc)) items.Add($"NHC: {Nhc}");
if (Person != null) items.Add($", Person: {Person}");
items.Add($"Admission Date: {AdmissionDate}");
if (PointOfCareId != null) items.Add($"Location: {PointOfCareId}");
if (PatientLocation != null) items.Add($"Location: {PatientLocation}");
if (Origin != null) items.Add($", Origin: {Origin.Name}");
if (Diagnosis != null) items.Add($", Diagnosis; {Diagnosis.Name}");
if (Allergies != null)
{
items.Add("Allergies:");
Allergies.ForEach(a => items.Add($", Allergy; {a.Name}"));
}
return "Admission [" + string.Join(", ", items) + "]";
}
return "Admission [" + string.Join(", ", items) + "]";
}
}
@@ -2,6 +2,9 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents the configuration settings for an alarm.
/// </summary>
public class AlarmConfig
{
public string? Name { get; set; }
@@ -15,6 +18,9 @@ public class AlarmConfig
public AudioConfig? AudioConfig { get; set; }
}
/// <summary>
/// Represents the configuration settings for audio processing or playback.
/// </summary>
public class AudioConfig
{
public AlarmEnum.AudioAlarmType Type { get; set; } = AlarmEnum.AudioAlarmType.Off;
@@ -2,6 +2,9 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents an alarm item entity.
/// </summary>
public class AlarmItem
{
public bool Enabled { get; set; }
@@ -21,19 +24,23 @@ public class AlarmItem
public AlarmEnum.Severity Severity { get; set; } = AlarmEnum.Severity.None;
public AlarmEnum.BeaconColor BeaconColor { get; set; } = AlarmEnum.BeaconColor.None;
/// <summary>
/// Returns a formatted string representation of the <see cref="AlarmItem"/>, including the Enabled, StartBefore, EndAfter, Severity, and BeaconColor values, and optionally appending the Color value when it is not null or empty.
/// </summary>
/// <returns>A string in the format "AlarmItem[item1, item2, ...]" containing the key properties of the alarm item.</returns>
public override string ToString()
{
List<string> items =
[
$"Enabled: {Enabled}",
$"StartBefore: {StartBefore}",
$"EndAfter: {EndAfter}",
$"Severity: {Severity}",
$"BeaconColorEnum: {BeaconColor}"
];
if (!string.IsNullOrEmpty(Color)) items.Add($"Color: {Color}");
return "AlarmItem[" + string.Join(", ", items) + "]";
}
{
List<string> items =
[
$"Enabled: {Enabled}",
$"StartBefore: {StartBefore}",
$"EndAfter: {EndAfter}",
$"Severity: {Severity}",
$"BeaconColorEnum: {BeaconColor}"
];
if (!string.IsNullOrEmpty(Color)) items.Add($"Color: {Color}");
return "AlarmItem[" + string.Join(", ", items) + "]";
}
}
@@ -2,6 +2,9 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents an authorization mechanism that determines whether a principal is granted access to a protected resource or operation.
/// </summary>
public class Authorization
{
public ObjectId Id { get; set; }
@@ -4,6 +4,10 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a patient box (clinical display unit) that aggregates patient data,
/// observations, medications, and display configuration for a specific point of care.
/// </summary>
public class Box
{
public Person? AttendingDoctor;
@@ -2,6 +2,9 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a camera, typically used to capture or render visual content in a scene or application.
/// </summary>
public class Camera
{
public ObjectId Id { get; set; }
@@ -21,6 +24,9 @@ public class Camera
public bool InUse { get; private set; }
}
/// <summary>
/// Represents a sequence of bytes that can be read from or written to.
/// </summary>
public class Stream
{
public string? Rtsp { get; set; }
@@ -5,6 +5,12 @@ using Newtonsoft.Json;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents an observation or record related to configuration state.
/// </summary>
/// <remarks>
/// This type is intended to capture configuration-related observation data within the application.
/// </remarks>
public class ConfigObservation
{
public Dictionary<string, ConfigObservation>? Grouped;
@@ -74,11 +80,20 @@ public class ConfigObservation
public List<ColorRange>? ColorRanges { get; set; }
public DemoConfig? DemoConfig { get; set; }
/// <summary>
/// Returns a JSON string representation of the current object with indented formatting,
/// overriding the default <see cref="object.ToString"/> behavior to provide a
/// human-readable serialization.
/// </summary>
/// <returns>A string containing the JSON-serialized representation of the object with indented formatting.</returns>
public override string ToString()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Represents a range of colors, typically used to define a spectrum or gradient between a start and end color.
/// </summary>
public class ColorRange
{
public ObservationEnum.ValueType? ValueType;
@@ -103,6 +118,9 @@ public class ConfigObservation
}
}
/// <summary>
/// Represents a configuration class that holds settings for demonstration purposes.
/// </summary>
public class DemoConfig
{
public int? MaxValue { get; set; }
@@ -2,6 +2,12 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a configuration container for pump-related settings.
/// </summary>
/// <remarks>
/// Used to manage and access configuration parameters specific to pump operations.
/// </remarks>
public class ConfigPumps
{
public string Id { get; set; } = string.Empty;
@@ -11,6 +17,9 @@ public class ConfigPumps
}
/// <summary>
/// Represents a configuration item related to a pump, encapsulating its settings or state data.
/// </summary>
public class ConfigPumpItem
{
public PumpEnum.AlarmType? AlarmType { get; set; }
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a configuration container for unit definitions, providing centralized access to unit-related settings and metadata.
/// </summary>
public class ConfigUnits
{
public string Id { get; set; } = string.Empty;
@@ -7,6 +10,9 @@ public class ConfigUnits
public List<ConfigUnitItem>? Items { get; set; }
}
/// <summary>
/// Represents a single configuration unit item, serving as a data model for storing and managing individual configuration entries.
/// </summary>
public class ConfigUnitItem
{
public string? Code { get; set; }
@@ -3,6 +3,9 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a device entity within the application.
/// </summary>
public class Device
{
public ObjectId Id { get; set; }
@@ -22,10 +25,16 @@ public class Device
public DeviceSettings? Settings { get; set; }
}
/// <summary>
/// Represents the configuration settings for a device.
/// </summary>
public class DeviceSettings
{
public DeviceAction? Action { get; set; }
}
/// <summary>
/// Represents an action that can be performed on or by a device.
/// </summary>
public class DeviceAction
{
public DeviceActionType Type { get; set; }
@@ -3,6 +3,9 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a discharge, typically referring to the release or emission of a substance, energy, or a patient leaving a medical facility.
/// </summary>
public class Discharge
{
public ObjectId Id { get; set; }
@@ -3,6 +3,9 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a display used to present or output information to the user.
/// </summary>
public class Display
{
public ObjectId Id { get; set; }
@@ -5,12 +5,24 @@ namespace adas_core.Domain.Models.MongoModels;
#region HomeConfig
/// <summary>
/// Represents a configuration class for defining the properties and settings of a card.
/// </summary>
/// <remarks>
/// This class is intended to be used as a data container or settings holder for card-related configurations.
/// </remarks>
public class CardConfig
{
public ObjectId Id { get; set; }
public List<RowCardConfig>? Rows { get; set; }
}
/// <summary>
/// Represents configuration settings for a row card component.
/// </summary>
/// <remarks>
/// This type is intended to be used as a data container to define the visual or behavioral properties of a row card.
/// </remarks>
public class RowCardConfig
{
// Dynamic cells de nurse y Dynamic Obs de monitoring
@@ -32,6 +44,9 @@ public class RowCardConfig
public string? PaddingRight { get; set; }
}
/// <summary>
/// Represents a single cell, typically used as an individual unit within a larger structured data model such as a grid, table, or matrix.
/// </summary>
public class Cell
{
public ChartSettings? ChartSettings { get; set; }
@@ -78,6 +93,9 @@ public class Cell
public DisplayConfigEnums.DirectionEnum? Direction { get; set; }
}
/// <summary>
/// Represents the configuration settings used to control the appearance and behavior of a chart.
/// </summary>
public class ChartSettings
{
public LegendLayoutConfig? LegendLayoutConfig { get; set; }
@@ -85,18 +103,30 @@ public class ChartSettings
public decimal? ChartGrowPriority { get; set; }
}
/// <summary>
/// Represents configuration settings for a dialog, providing a centralized structure to manage dialog-related options and parameters.
/// </summary>
public class DialogConfig
{
public bool? IsDraggable { get; set; }
public MedicalConfig? MedicalConfig { get; set; }
}
/// <summary>
/// Represents a configuration class for medical-related settings and parameters.
/// </summary>
/// <remarks>
/// Serves as a container for medical configuration data, providing a centralized structure to manage and access medical settings within the application.
/// </remarks>
public class MedicalConfig
{
public bool HasFinalizeTime { get; set; }
public bool HasStartTime { get; set; }
}
/// <summary>
/// Represents a list of icon values, providing a collection structure for managing and accessing icon-related data.
/// </summary>
public class IconValueList
{
public double? MinValue { get; set; }
@@ -106,6 +136,9 @@ public class IconValueList
public List<string>? IconList { get; set; }
}
/// <summary>
/// Represents the configuration settings for the home page or home component.
/// </summary>
public class HomeConfig
{
public string? MinColumnSize { get; set; }
@@ -5,6 +5,9 @@ namespace adas_core.Domain.Models.MongoModels;
#region DetailsConfig
/// <summary>
/// Represents the configuration settings for card details.
/// </summary>
public class CardDetailsConfig
{
public ObjectId Id { get; set; }
@@ -13,6 +16,9 @@ public class CardDetailsConfig
public List<SectionBoxLayout>? SmartSections { get; set; }
}
/// <summary>
/// Represents configuration settings for row details, typically used to control the display and behavior of expandable detail rows.
/// </summary>
public class RowDetailsConfig
{
// Dynamic cells de nurse y Dynamic Obs de monitoring
@@ -24,6 +30,9 @@ public class RowDetailsConfig
public DialogConfig? DialogConfig { get; set; }
}
/// <summary>
/// Represents a container for detailed information about an individual cell.
/// </summary>
public class CellDetails
{
public List<ObservationTextRule>? TextRules { get; set; }
@@ -5,6 +5,12 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a configuration class for display settings and options.
/// </summary>
/// <remarks>
/// This class encapsulates the configuration data used to manage display-related properties and behavior.
/// </remarks>
public class DisplayConfig
{
public ObjectId Id { get; set; }
@@ -47,91 +53,135 @@ public class DisplayConfig
#endregion
/// <summary>
/// Merges the current display configuration with the provided default configuration,
/// using the current instance's values where they are not null or empty, and falling back
/// to the default configuration values otherwise. Simple nullable properties are merged
/// via null-coalescing assignment, while collection properties are replaced when they
/// are null or empty.
/// </summary>
/// <param name="defaultConfig">The default configuration to use as a fallback when the current configuration properties are null or empty.</param>
/// <returns>The current <see cref="DisplayConfig"/> instance with merged configuration values.</returns>
public virtual DisplayConfig MergeConfig(DisplayConfig defaultConfig)
{
// CardConfig ??= defaultConfig.CardConfig;
CardConfigId ??= defaultConfig.CardConfigId;
HomeConfig ??= defaultConfig.HomeConfig;
HeaderConfig ??= defaultConfig.HeaderConfig;
DetailConfigId ??= defaultConfig.DetailConfigId;
Hospital ??= defaultConfig.Hospital;
ColorConfig ??= defaultConfig.ColorConfig;
MediaFolder ??= defaultConfig.MediaFolder;
GroupedFieldList ??= defaultConfig.GroupedFieldList;
if (SensorList?.Count == 0) SensorList = defaultConfig.SensorList;
if (AlarmFieldList?.Count == 0) AlarmFieldList = defaultConfig.AlarmFieldList;
if (FieldList.Count == 0) FieldList = defaultConfig.FieldList;
if (GroupedFieldList?.Count == 0) GroupedFieldList = defaultConfig.GroupedFieldList;
if (RequestGroupedFieldList?.Count == 0) RequestGroupedFieldList = defaultConfig.RequestGroupedFieldList;
if (ChartConfig?.Count == 0) ChartConfig = defaultConfig.ChartConfig;
return this;
}
{
// CardConfig ??= defaultConfig.CardConfig;
CardConfigId ??= defaultConfig.CardConfigId;
HomeConfig ??= defaultConfig.HomeConfig;
HeaderConfig ??= defaultConfig.HeaderConfig;
DetailConfigId ??= defaultConfig.DetailConfigId;
Hospital ??= defaultConfig.Hospital;
ColorConfig ??= defaultConfig.ColorConfig;
MediaFolder ??= defaultConfig.MediaFolder;
GroupedFieldList ??= defaultConfig.GroupedFieldList;
if (SensorList?.Count == 0) SensorList = defaultConfig.SensorList;
if (AlarmFieldList?.Count == 0) AlarmFieldList = defaultConfig.AlarmFieldList;
if (FieldList.Count == 0) FieldList = defaultConfig.FieldList;
if (GroupedFieldList?.Count == 0) GroupedFieldList = defaultConfig.GroupedFieldList;
if (RequestGroupedFieldList?.Count == 0) RequestGroupedFieldList = defaultConfig.RequestGroupedFieldList;
if (ChartConfig?.Count == 0) ChartConfig = defaultConfig.ChartConfig;
return this;
}
}
/// <summary>
/// Represents a standard display configuration, extending the base <see cref="DisplayConfig"/> class to provide default display settings.
/// </summary>
public class StandarDisplay : DisplayConfig
{
public SectionConfig? SectionConfig { get; set; }
/// <summary>
/// Merges the provided default display configuration into the current instance when it is a <see cref="StandarDisplay"/>, applying the default home configuration if none is set and overriding color and rotation settings; otherwise returns the current instance unchanged.
/// </summary>
/// <param name="defaultConfig">The default display configuration to merge from. Only values from a <see cref="StandarDisplay"/> instance are applied.</param>
/// <returns>The merged <see cref="DisplayConfig"/>, or the current instance if the provided configuration is not a <see cref="StandarDisplay"/>.</returns>
public override DisplayConfig MergeConfig(DisplayConfig defaultConfig)
{
if (defaultConfig is not StandarDisplay defaultStandarConfig)
return this; // Si no es de tipo DisplayNurse, no combinar.
HomeConfig ??= defaultStandarConfig.HomeConfig;
ColorConfig = defaultStandarConfig.ColorConfig;
IsRotationEnabled = defaultStandarConfig.IsRotationEnabled;
return base.MergeConfig(defaultConfig);
}
{
if (defaultConfig is not StandarDisplay defaultStandarConfig)
return this; // Si no es de tipo DisplayNurse, no combinar.
HomeConfig ??= defaultStandarConfig.HomeConfig;
ColorConfig = defaultStandarConfig.ColorConfig;
IsRotationEnabled = defaultStandarConfig.IsRotationEnabled;
return base.MergeConfig(defaultConfig);
}
}
/// <summary>
/// Represents a display configuration specific to nurses, inheriting common display behavior from the <see cref="DisplayConfig"/> base class.
/// </summary>
public class DisplayNurse : DisplayConfig
{
/// <summary>
/// Merges the current display configuration with the provided default configuration, populating HomeBanner, ColorConfig, and FormConfig with the default values when they are not already set. If the defaultConfig is not a DisplayNurse instance, the current configuration is returned unchanged before delegating to the base merge behavior.
/// </summary>
/// <param name="defaultConfig">The default DisplayConfig to merge values from. Only DisplayNurse instances contribute fallback values for nurse-specific settings.</param>
/// <returns>A DisplayConfig containing the merged configuration.</returns>
public override DisplayConfig MergeConfig(DisplayConfig defaultConfig)
{
if (defaultConfig is not DisplayNurse defaultNurseConfig) return this;
HomeBanner ??= defaultNurseConfig.HomeBanner;
ColorConfig ??= defaultNurseConfig.ColorConfig;
FormConfig ??= defaultNurseConfig.FormConfig;
return base.MergeConfig(defaultConfig);
}
{
if (defaultConfig is not DisplayNurse defaultNurseConfig) return this;
HomeBanner ??= defaultNurseConfig.HomeBanner;
ColorConfig ??= defaultNurseConfig.ColorConfig;
FormConfig ??= defaultNurseConfig.FormConfig;
return base.MergeConfig(defaultConfig);
}
}
/// <summary>
/// Represents a display configuration tailored for a pump, providing settings that determine how pump-related information is rendered.
/// </summary>
/// <remarks>
/// Inherits from <see cref="DisplayConfig"/>, extending its general display configuration behavior with pump-specific context.
/// </remarks>
public class PumpDisplay : DisplayConfig
{
/// <summary>
/// Merges the specified display configuration into the current instance, applying default values from the provided <see cref="PumpDisplay"/> configuration when the current values are null or empty. Returns the current instance unchanged if the supplied configuration is not a <see cref="PumpDisplay"/>.
/// </summary>
/// <param name="config">The display configuration to merge from. Only <see cref="PumpDisplay"/> instances are processed; any other type results in the current instance being returned as-is.</param>
/// <returns>The merged <see cref="DisplayConfig"/> result produced by chaining the base merge operation.</returns>
public override DisplayConfig MergeConfig(DisplayConfig config)
{
if (config is not PumpDisplay defaultConfig) return this;
CardConfigId ??= defaultConfig.CardConfigId;
HomeConfig ??= defaultConfig.HomeConfig;
ColorConfig = defaultConfig.ColorConfig;
GraphLayout ??= defaultConfig.GraphLayout;
Pumps ??= defaultConfig.Pumps;
if (FieldList.Count == 0) FieldList = defaultConfig.FieldList;
if (GroupedFieldList?.Count == 0) GroupedFieldList = defaultConfig.GroupedFieldList;
if (RequestGroupedFieldList?.Count == 0) RequestGroupedFieldList = defaultConfig.RequestGroupedFieldList;
if (ChartConfig?.Count == 0) ChartConfig = defaultConfig.ChartConfig;
return base.MergeConfig(config);
}
{
if (config is not PumpDisplay defaultConfig) return this;
CardConfigId ??= defaultConfig.CardConfigId;
HomeConfig ??= defaultConfig.HomeConfig;
ColorConfig = defaultConfig.ColorConfig;
GraphLayout ??= defaultConfig.GraphLayout;
Pumps ??= defaultConfig.Pumps;
if (FieldList.Count == 0) FieldList = defaultConfig.FieldList;
if (GroupedFieldList?.Count == 0) GroupedFieldList = defaultConfig.GroupedFieldList;
if (RequestGroupedFieldList?.Count == 0) RequestGroupedFieldList = defaultConfig.RequestGroupedFieldList;
if (ChartConfig?.Count == 0) ChartConfig = defaultConfig.ChartConfig;
return base.MergeConfig(config);
}
}
/// <summary>
/// Represents a smart display configuration that extends the base <see cref="DisplayConfig"/> behavior.
/// </summary>
public class SmartDisplay : DisplayConfig
{
/// <summary>
/// Merges the provided default configuration into this <see cref="SmartDisplay"/> instance, applying default values for any properties that are currently <see langword="null"/>. If the supplied configuration is not a <see cref="SmartDisplay"/>, the current instance is returned unchanged and the merge is delegated to the base implementation.
/// </summary>
/// <param name="defaultConfigToCast">The default <see cref="DisplayConfig"/> to merge; it is cast to <see cref="SmartDisplay"/> to access smart display-specific properties.</param>
/// <returns>The merged <see cref="DisplayConfig"/> produced by the base merge operation.</returns>
public override DisplayConfig MergeConfig(DisplayConfig defaultConfigToCast)
{
if (defaultConfigToCast is not SmartDisplay defaultConfig) return this;
ColorConfig = defaultConfig.ColorConfig;
HasCameras ??= defaultConfig.HasCameras;
HasSound ??= defaultConfig.HasSound;
IsRotationEnabled ??= defaultConfig.IsRotationEnabled;
CanChangeCameraMode ??= defaultConfig.CanChangeCameraMode;
CamerasAreActive ??= defaultConfig.CamerasAreActive;
CameraStreamType ??= defaultConfig.CameraStreamType;
GraphLayout ??= defaultConfig.GraphLayout;
Pumps ??= defaultConfig.Pumps;
ObservationForIndicator ??= defaultConfig.ObservationForIndicator;
CardRotatingLayout ??= defaultConfig.CardRotatingLayout;
return base.MergeConfig(defaultConfig);
}
{
if (defaultConfigToCast is not SmartDisplay defaultConfig) return this;
ColorConfig = defaultConfig.ColorConfig;
HasCameras ??= defaultConfig.HasCameras;
HasSound ??= defaultConfig.HasSound;
IsRotationEnabled ??= defaultConfig.IsRotationEnabled;
CanChangeCameraMode ??= defaultConfig.CanChangeCameraMode;
CamerasAreActive ??= defaultConfig.CamerasAreActive;
CameraStreamType ??= defaultConfig.CameraStreamType;
GraphLayout ??= defaultConfig.GraphLayout;
Pumps ??= defaultConfig.Pumps;
ObservationForIndicator ??= defaultConfig.ObservationForIndicator;
CardRotatingLayout ??= defaultConfig.CardRotatingLayout;
return base.MergeConfig(defaultConfig);
}
// TO TEST
public List<string> GetDifferentProperties(SmartDisplay? other)
@@ -154,38 +204,47 @@ public class SmartDisplay : DisplayConfig
}
// Método para comparar valores de diferentes tipos de propiedades
/// <summary>
/// Determines whether two values are considered equal, handling null cases, performing element-wise comparison for enumerables, and falling back to <see cref="object.Equals(object, object)"/> for same-type values or string comparison for different types.
/// </summary>
/// <param name="value1">The first value to compare.</param>
/// <param name="value2">The second value to compare.</param>
/// <returns><c>true</c> if both values are null, deeply equal as enumerables, equal via <see cref="object.Equals(object, object)"/> when their types match, or have matching string representations; otherwise, <c>false</c>.</returns>
private static bool AreEqual(object? value1, object? value2)
{
if (value1 == null && value2 == null) return true;
if (value1 == null || value2 == null) return false;
if (value1 is IEnumerable enumerable1 && value2 is IEnumerable enumerable2)
{
var enumerator1 = enumerable1.GetEnumerator();
var enumerator2 = enumerable2.GetEnumerator();
try
if (value1 == null && value2 == null) return true;
if (value1 == null || value2 == null) return false;
if (value1 is IEnumerable enumerable1 && value2 is IEnumerable enumerable2)
{
while (enumerator1.MoveNext() && enumerator2.MoveNext())
if (!AreEqual(enumerator1.Current, enumerator2.Current))
return false;
return !enumerator1.MoveNext() && !enumerator2.MoveNext();
}
finally
{
if (enumerator1 is IDisposable disposable1) disposable1.Dispose();
if (enumerator2 is IDisposable disposable2) disposable2.Dispose();
var enumerator1 = enumerable1.GetEnumerator();
var enumerator2 = enumerable2.GetEnumerator();
try
{
while (enumerator1.MoveNext() && enumerator2.MoveNext())
if (!AreEqual(enumerator1.Current, enumerator2.Current))
return false;
return !enumerator1.MoveNext() && !enumerator2.MoveNext();
}
finally
{
if (enumerator1 is IDisposable disposable1) disposable1.Dispose();
if (enumerator2 is IDisposable disposable2) disposable2.Dispose();
}
}
// Si ambos valores son del mismo tipo, usa Equals para comparar
if (value1.GetType() == value2.GetType()) return value1.Equals(value2);
// Si los tipos son diferentes, convierte a string y compara
return value1.ToString() == value2.ToString();
}
// Si ambos valores son del mismo tipo, usa Equals para comparar
if (value1.GetType() == value2.GetType()) return value1.Equals(value2);
// Si los tipos son diferentes, convierte a string y compara
return value1.ToString() == value2.ToString();
}
}
/// <summary>
/// Represents a configuration class for defining header-related settings.
/// </summary>
public class HeaderConfig
{
public HeaderItem? PartnerLogo { get; set; }
@@ -212,6 +271,9 @@ public class HeaderConfig
public HeaderItem? SectionTitle { get; set; }
/// <summary>
/// Represents a single item contained within a header.
/// </summary>
public class HeaderItem
{
public string? LogoUrl { get; set; }
@@ -219,12 +281,18 @@ public class HeaderConfig
}
}
/// <summary>
/// Represents a display section that provides a minimal rendering configuration.
/// </summary>
public class MinimalDisplaySection
{
public string? Name { get; set; }
public ObjectId Id { get; set; }
public bool IsSelected { get; set; }
}
/// <summary>
/// Represents the configuration settings for a section.
/// </summary>
public class SectionConfig
{
public int? Columns { get; set; }
@@ -234,6 +302,9 @@ public class SectionConfig
public UiFontData? DesignProperties { get; set; }
public List<Step>? Steps { get; set; }
}
/// <summary>
/// Represents a banner item, typically used to encapsulate data related to a banner display element such as a notification, advertisement, or promotional content.
/// </summary>
public class BannerItem
{
public DisplayConfigEnums.BannerType? Type { get; set; }
@@ -241,6 +312,12 @@ public class BannerItem
public BannerItemConfig? Config { get; set; }
}
/// <summary>
/// Represents the configuration settings for a banner item, defining its properties and behavior.
/// </summary>
/// <remarks>
/// This class is used to store and manage configuration data related to individual banner items within the application.
/// </remarks>
public class BannerItemConfig
{
public BannerItemTableConfig? BannerItemTableConfig { get; set; }
@@ -248,6 +325,9 @@ public class BannerItemConfig
public MedicalStaffConfig? MedicalStaffConfig { get; set; }
}
/// <summary>
/// Represents the configuration settings for a banner item table.
/// </summary>
public class BannerItemTableConfig
{
public List<HeaderBannerItemTableConfig>? Config { get; set; }
@@ -255,12 +335,18 @@ public class BannerItemTableConfig
public string? TextColor { get; set; }
}
/// <summary>
/// Represents the configuration settings for medical staff.
/// </summary>
public class MedicalStaffConfig
{
public bool? HasTeams { get; set; }
public int? StaffAmount { get; set; }
}
/// <summary>
/// Represents an overview of form items, providing a consolidated view or summary of form-related data.
/// </summary>
public class FormItemOverview
{
public bool Nhc { get; set; }
@@ -288,6 +374,9 @@ public class FormItemOverview
public bool? UciDays { get; set; }
}
/// <summary>
/// Represents the configuration settings for a table that displays header banner items.
/// </summary>
public class HeaderBannerItemTableConfig
{
public DisplayConfigEnums.CellType? Type { get; set; }
@@ -300,6 +389,9 @@ public class HeaderBannerItemTableConfig
public string? Title { get; set; }
}
/// <summary>
/// Represents a sensor, which is a device or component used to detect and measure physical phenomena such as temperature, pressure, or motion.
/// </summary>
public class Sensor
{
public string? Name { get; set; }
@@ -308,6 +400,9 @@ public class Sensor
public bool IsGeneral { get; set; }
}
/// <summary>
/// Represents a configuration that defines color-related settings or values.
/// </summary>
public class ColorConfig
{
public LevelColors? Level { get; set; }
@@ -357,6 +452,9 @@ public class ColorConfig
// }
//}
/// <summary>
/// Represents configuration settings that define the visual appearance of an application or user interface element.
/// </summary>
public class AppearanceSettings
{
public string? TextColor { get; set; }
@@ -395,6 +493,9 @@ public class ColorConfig
//}
}
/// <summary>
/// Represents the set of colors used to display numbers within a status box.
/// </summary>
public class StatusBoxNumberColors
{
public AppearanceSettings? Reserved { get; set; }
@@ -433,6 +534,9 @@ public class ColorConfig
//}
}
/// <summary>
/// Represents a collection of colors used for therapy-related visuals or themes.
/// </summary>
public class TherapyColors
{
public AppearanceSettings? Default { get; set; }
@@ -464,6 +568,9 @@ public class ColorConfig
//}
}
/// <summary>
/// Represents a test class for color-related operations or values.
/// </summary>
public class TestColors
{
public AppearanceSettings? Default { get; set; }
@@ -496,6 +603,9 @@ public class ColorConfig
//}
}
/// <summary>
/// Represents a set of colors used to define or customize the appearance of a procedure.
/// </summary>
public class ProcedureColors
{
public AppearanceSettings? Default { get; set; }
@@ -528,6 +638,9 @@ public class ColorConfig
//}
}
/// <summary>
/// Represents a collection or definition of colors associated with different levels.
/// </summary>
public class LevelColors
{
public string? Level1 { get; set; }
@@ -563,6 +676,9 @@ public class ColorConfig
//}
}
/// <summary>
/// Provides a collection of predefined color values used for styling or rendering text.
/// </summary>
public class TextColors
{
public string? Normal { get; set; }
@@ -598,6 +714,9 @@ public class ColorConfig
//}
}
/// <summary>
/// Represents a collection or definition of colors used for rendering arrows.
/// </summary>
public class ArrowColors
{
public string? Normal { get; set; }
@@ -630,6 +749,9 @@ public class ColorConfig
//}
}
/// <summary>
/// Represents a collection or definition of colors used for indicators.
/// </summary>
public class IndicatorColors
{
public string? Empty { get; set; }
@@ -668,6 +790,9 @@ public class ColorConfig
//}
}
/// <summary>
/// Represents a collection or definition of colors used for rendering graphs.
/// </summary>
public class GraphColors
{
public string? Normal { get; set; }
@@ -698,6 +823,12 @@ public class ColorConfig
}
}
/// <summary>
/// Represents configuration settings for a form.
/// </summary>
/// <remarks>
/// This class encapsulates the configuration data required to define or manage form-related properties.
/// </remarks>
public class FormConfig
{
public FormItemOverview? Admission { get; set; }
@@ -709,6 +840,9 @@ public class FormConfig
// ======================
// Axis Components
// ======================
/// <summary>
/// Represents a label associated with an axis, typically used in charting or graphing scenarios to describe or identify the axis.
/// </summary>
public class AxisLabel
{
public bool? Show { get; set; }
@@ -718,6 +852,12 @@ public class AxisLabel
public bool? Silent { get; set; }
}
/// <summary>
/// Represents the style configuration used to render an axis line.
/// </summary>
/// <summary>
/// Represents a line associated with an axis, typically used in charting or graphing scenarios to render or define axis-related visual elements.
/// </summary>
public class AxisLineStyle
{
public string? Color { get; set; }
@@ -729,6 +869,9 @@ public class AxisLine
public AxisLineStyle? LineStyle { get; set; }
}
/// <summary>
/// Represents a single tick mark on an axis, typically used in charting or graphing scenarios.
/// </summary>
public class AxisTick
{
public bool? Show { get; set; }
@@ -737,6 +880,9 @@ public class AxisTick
public int? Interval { get; set; }
}
/// <summary>
/// Represents the configuration settings for a chart, defining its visual and behavioral properties.
/// </summary>
public class ChartConfig
{
public ObjectId Id { get; set; }
@@ -750,6 +896,10 @@ public class ChartConfig
// ======================
// Series Implementations
// ======================
/// <summary>
/// Serves as the base class for configuration types that define settings for a series.
/// Provides a common foundation for derived series configuration implementations.
/// </summary>
public class SeriesConfigBase
{
public string? Key { get; set; }
@@ -791,6 +941,9 @@ public class SeriesConfigBase
//}
}
/// <summary>
/// Represents a visual mapping that handles the rendering or display logic for map-related data.
/// </summary>
public class VisualMap
{
public bool Show { get; set; } //Mostrar en la leyenda
@@ -799,6 +952,9 @@ public class VisualMap
public List<Piece>? Pieces { get; set; } //Rangos de colores y configuraciones de tipos
}
/// <summary>
/// Represents a single piece, serving as a general-purpose entity within its containing system.
/// </summary>
public class Piece
{
public double? Opacity { get; set; } //Valor de la opacidad
@@ -871,6 +1027,9 @@ public class Piece
// return HashCode.Combine(AboveBaselineColor, BelowBaselineColor);
// }
// }
// /// <summary>
// /// Represents a candle entity within the system.
// /// </summary>
// public class CandlestickSeriesConfig : SeriesConfigBase
// {
// public List<Candle>? CandleKeyList { get; set; }
@@ -902,6 +1061,12 @@ public enum CandleValueType
// ======================
// Chart Configurations
// ======================
/// <summary>
/// Serves as the base class for chart configuration objects, providing common configuration properties and behavior shared by all chart types.
/// </summary>
/// <remarks>
/// This class is intended to be inherited by specialized chart configuration types to ensure consistent configuration handling across the charting system.
/// </remarks>
public class ChartBaseConfig
{
public string? Title { get; set; }
@@ -919,6 +1084,9 @@ public class ChartBaseConfig
public float BaselineOffset { get; set; }
}
/// <summary>
/// Represents the configuration settings for an axis.
/// </summary>
public class AxisConfig
{
public DisplayConfigEnums.AxisType Type { get; set; }
@@ -938,6 +1106,12 @@ public class AxisConfig
public GroupedObservationEnum.Regularity Regularity { get; set; }
}
/// <summary>
/// Represents a layout configuration for arranging elements of a graph, such as positioning nodes and routing edges.
/// </summary>
/// <remarks>
/// This class serves as a base type for specific graph layout strategies and is intended to be used to control the visual or logical arrangement of graph components.
/// </remarks>
public class GraphLayout
{
public string? Layout { get; set; }
@@ -947,6 +1121,9 @@ public class GraphLayout
public List<string>? ObservationName { get; set; }
}
/// <summary>
/// Represents a layout configuration for arranging section boxes.
/// </summary>
public class SectionBoxLayout
{
public DisplayConfigEnums.RowType Type { get; set; }
@@ -971,12 +1148,18 @@ public class SectionBoxLayout
public List<RowBoxLayout>? Rows { get; set; }
}
/// <summary>
/// Represents a configuration class that defines conditions.
/// </summary>
public class ConditionsConfig
{
public string? Condition { get; set; }
public string? FieldCondition { get; set; }
}
/// <summary>
/// Represents a layout manager that arranges child elements in a row-based box configuration.
/// </summary>
public class RowBoxLayout
{
public double? GrowPriority { get; set; }
@@ -991,6 +1174,9 @@ public class RowBoxLayout
public DisplayConfigEnums.DirectionEnum Direction { get; set; }
}
/// <summary>
/// Represents a box layout configuration for displaying observation rows.
/// </summary>
public class ObservationRowBoxLayout
{
public List<ObservationTextRule>? TextRules { get; set; }
@@ -1027,6 +1213,9 @@ public class ObservationRowBoxLayout
public DisplayConfigEnums.DirectionEnum? Direction { get; set; }
}
/// <summary>
/// Represents a layout that arranges cards with a rotating behavior, likely managing the visual positioning and orientation of card elements within a container.
/// </summary>
public class CardRotatingLayout
{
// In MS
@@ -1040,6 +1229,9 @@ public class CardRotatingLayout
public CardConfig Data { get; set; } = new();
}
/// <summary>
/// Represents a rule used to validate or process observation text.
/// </summary>
public class ObservationTextRule
{
public ObservationEnum.ValueType ValueType { get; set; }
@@ -1056,17 +1248,26 @@ public class ObservationTextRule
public decimal? MaxNum { get; set; }
}
/// <summary>
/// Represents a configuration object that defines layout settings for a legend.
/// </summary>
public class LegendLayoutConfig
{
public List<LegendLayoutRow>? Rows { get; set; }
}
/// <summary>
/// Represents a single row within a legend layout, typically used to organize and arrange legend items in a structured, row-based configuration.
/// </summary>
public class LegendLayoutRow
{
public decimal? GrowPriority { get; set; }
public List<LegendLayoutColumn>? Columns { get; set; }
}
/// <summary>
/// Represents a column within a legend layout, defining a vertical arrangement of legend entries or items.
/// </summary>
public class LegendLayoutColumn
{
public string? Key { get; set; }
@@ -1074,6 +1275,9 @@ public class LegendLayoutColumn
public LegendLabel? Label { get; set; }
}
/// <summary>
/// Represents a label associated with a legend, typically used to describe or identify an entry in a chart, graph, or similar visual component.
/// </summary>
public class LegendLabel
{
public string? Name { get; set; }
@@ -7,6 +7,12 @@ using Newtonsoft.Json.Linq;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a custom JSON converter for serializing and deserializing historical configuration changes.
/// </summary>
/// <remarks>
/// This converter extends <see cref="JsonConverter"/> to provide tailored JSON conversion behavior for historical config change data.
/// </remarks>
public class HistoricalConfigChanges : JsonConverter
{
public DateTime Time;
@@ -21,50 +27,77 @@ public class HistoricalConfigChanges : JsonConverter
public string NewConfig { get; set; } = string.Empty;
/// <summary>
/// Serializes the specified object to JSON, skipping output when the value is <c>null</c>.
/// The object is first projected into a <see cref="JObject"/> and annotated with a string enum converter for the <c>ConfigType</c> property before being written to the <paramref name="writer"/>.
/// </summary>
/// <param name="writer">The <see cref="JsonWriter"/> that receives the serialized JSON output.</param>
/// <param name="value">The object to serialize. If <c>null</c>, the method does nothing.</param>
/// <param name="serializer">The <see cref="JsonSerializer"/> used during serialization.</param>
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
if (value != null)
{
var jo = JObject.FromObject(value);
AddStringEnumConverterAttribute(value, nameof(ConfigType));
jo.WriteTo(writer);
}
}
private static void AddStringEnumConverterAttribute(object value, string propertyName)
{
var prop = value.GetType().GetProperty(propertyName);
var attr = new JsonConverterAttribute(typeof(StringEnumConverter));
if (prop != null)
{
var attrs = prop.GetCustomAttributes(false);
// Check if the attribute is not already applied
if (Array.Find(attrs, a => a is JsonConverterAttribute) == null)
if (value != null)
{
// Create a new array that includes the existing attributes and the new one
var newAttrs = new object[attrs.Length + 1];
Array.Copy(attrs, newAttrs, attrs.Length);
newAttrs[attrs.Length] = attr;
// Use reflection to set the new attributes array
var field = typeof(PropertyInfo).GetField("m_customAttributes",
BindingFlags.Instance | BindingFlags.NonPublic);
field?.SetValue(prop, newAttrs);
var jo = JObject.FromObject(value);
AddStringEnumConverterAttribute(value, nameof(ConfigType));
jo.WriteTo(writer);
}
}
}
/// <summary>
/// Adds a <see cref="JsonConverterAttribute"/> using <see cref="StringEnumConverter"/> to the specified property via reflection, but only if the property does not already have a <see cref="JsonConverterAttribute"/> applied. The new attribute is appended to the existing custom attributes array using a non-public field on <see cref="PropertyInfo"/>.
/// </summary>
/// <param name="value">The object instance whose type defines the target property.</param>
/// <param name="propertyName">The name of the property to which the converter attribute should be added.</param>
private static void AddStringEnumConverterAttribute(object value, string propertyName)
{
var prop = value.GetType().GetProperty(propertyName);
var attr = new JsonConverterAttribute(typeof(StringEnumConverter));
if (prop != null)
{
var attrs = prop.GetCustomAttributes(false);
// Check if the attribute is not already applied
if (Array.Find(attrs, a => a is JsonConverterAttribute) == null)
{
// Create a new array that includes the existing attributes and the new one
var newAttrs = new object[attrs.Length + 1];
Array.Copy(attrs, newAttrs, attrs.Length);
newAttrs[attrs.Length] = attr;
// Use reflection to set the new attributes array
var field = typeof(PropertyInfo).GetField("m_customAttributes",
BindingFlags.Instance | BindingFlags.NonPublic);
field?.SetValue(prop, newAttrs);
}
}
}
/// <summary>
/// Reads the JSON representation of the object and converts it to the target type as part of a custom <see cref="JsonConverter"/>. This implementation is not yet provided.
/// </summary>
/// <param name="reader">The <see cref="JsonReader"/> used to read the JSON content.</param>
/// <param name="objectType">The type of the object to deserialize to.</param>
/// <param name="existingValue">The existing value of the object being read, or <c>null</c> if no value exists.</param>
/// <param name="serializer">The <see cref="JsonSerializer"/> used to deserialize nested objects.</param>
/// <returns>The deserialized object value.</returns>
/// <exception cref="NotImplementedException">Always thrown because the method has not been implemented.</exception>
public override object ReadJson(JsonReader reader, Type objectType, object? existingValue,
JsonSerializer serializer)
{
throw new NotImplementedException();
}
JsonSerializer serializer)
{
throw new NotImplementedException();
}
/// <summary>
/// Determines whether the converter can convert the specified type. The override has not been implemented and always throws a <see cref="NotImplementedException"/> when invoked.
/// </summary>
/// <param name="objectType">The type to evaluate for convertibility.</param>
/// <returns><see langword="true"/> when the converter supports <paramref name="objectType"/>; otherwise, <see langword="false"/>.</returns>
/// <exception cref="NotImplementedException">Thrown in all cases because the method body is not implemented.</exception>
public override bool CanConvert(Type objectType)
{
throw new NotImplementedException();
}
{
throw new NotImplementedException();
}
}
@@ -1,5 +1,11 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a historical identifier that associates a specific point in time with a set of patient identifiers.
/// </summary>
/// <remarks>
/// The type holds a timestamp together with a dictionary of patient IDs, providing a snapshot of the identification data at the given time.
/// </remarks>
public class HistoricalId(DateTime time, Dictionary<string, string> patientIds)
{
// Propiedades
@@ -9,21 +15,33 @@ public class HistoricalId(DateTime time, Dictionary<string, string> patientIds)
patientIds ?? throw new ArgumentNullException(nameof(patientIds));
/// <summary>
/// Determines whether the appointment is empty by checking if the <see cref="Time"/> has not been set (is the default <see cref="DateTime"/>) and no patient identifiers have been associated.
/// </summary>
/// <returns><see langword="true"/> if both the time is uninitialized and the patient list is empty; otherwise, <see langword="false"/>.</returns>
public bool IsEmpty()
{
return Time == default(DateTime) && PatientIds.Count == 0;
}
{
return Time == default(DateTime) && PatientIds.Count == 0;
}
/// <summary>
/// Determines whether the current entity is fully populated by verifying that a time has been explicitly assigned and at least one patient is associated.
/// </summary>
/// <returns><c>true</c> if both the <c>Time</c> property is set to a non-default <see cref="DateTime"/> value and the <c>PatientIds</c> collection contains at least one entry; otherwise, <c>false</c>.</returns>
public bool IsFull()
{
return Time != default(DateTime) && PatientIds.Count > 0;
}
{
return Time != default(DateTime) && PatientIds.Count > 0;
}
/// <summary>
/// Returns a string representation of the HistoricalId, including the time and a comma-separated list of patient identifiers.
/// </summary>
/// <returns>A formatted string in the form "HistoricalId[Time: {Time}, PatientIds: {idsString}]" where idsString is the patient identifiers joined by commas.</returns>
public override string ToString()
{
var idsString = string.Join(", ", PatientIds);
return $"HistoricalId[Time: {Time}, PatientIds: {idsString}]";
}
{
var idsString = string.Join(", ", PatientIds);
return $"HistoricalId[Time: {Time}, PatientIds: {idsString}]";
}
}
@@ -2,6 +2,9 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a light beacon, typically used to emit or signal light as a visual indicator or warning marker.
/// </summary>
public class LightBeacon
{
public ObjectId Id { get; set; }
@@ -11,6 +14,9 @@ public class LightBeacon
public Options Options { get; set; } = new();
}
/// <summary>
/// Represents a container for configuration or option settings used by the application.
/// </summary>
public class Options
{
public string? Url { get; set; }
+19 -9
View File
@@ -2,6 +2,9 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a notice, typically used to convey information, alerts, or messages within the application.
/// </summary>
public class Notice
{
public ObjectId Id { get; set; }
@@ -13,18 +16,25 @@ public class Notice
public bool IsFooterEnabled { get; set; } = true;
/// <summary>
/// Returns a string representation of the notice, including the date (only when set), display ID, type, and description.
/// </summary>
/// <returns>A formatted string prefixed with "Notice [" and containing the comma-separated notice details, omitting the date entry when <c>NoticeDate</c> equals <see cref="System.DateTime.MinValue"/>.</returns>
public override string ToString()
{
List<string> items = [];
if (NoticeDate != DateTime.MinValue) items.Add($"Date: {NoticeDate}");
items.Add($"DisplayId : {DisplayId}");
items.Add($"Type: {NoticeType}");
items.Add($"Description: {Description}");
return "Notice [" + string.Join(",", items) + "]";
}
{
List<string> items = [];
if (NoticeDate != DateTime.MinValue) items.Add($"Date: {NoticeDate}");
items.Add($"DisplayId : {DisplayId}");
items.Add($"Type: {NoticeType}");
items.Add($"Description: {Description}");
return "Notice [" + string.Join(",", items) + "]";
}
}
/// <summary>
/// Represents a data structure that contains information about a staff member.
/// </summary>
public class StaffInfo
{
public required string Role { get; set; }
+44 -22
View File
@@ -4,6 +4,9 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a patient entity, typically used to encapsulate patient-related data and behavior within a healthcare or medical information system.
/// </summary>
public class Patient
{
public ObjectId Id { get; set; }
@@ -84,33 +87,49 @@ public class Patient
public List<HistoricalLocation>? HistoricalLocations { get; set; }
/// <summary>
/// Returns a human-readable string representation of the person, including the identifier and any
/// available contextual details such as point of care, bed, patient numbers, admission and discharge
/// timestamps, assigned patient, attending doctor, and relevant date metadata. Optional fields are
/// appended to the output only when their values are present (non-null, non-empty, or with a value
/// for nullable types).
/// </summary>
/// <returns>A formatted string prefixed with "person[" and containing the included fields joined by commas.</returns>
public override string ToString()
{
List<string> items = [$"id: {Id}"];
if (!string.IsNullOrEmpty(UnitString)) items.Add($"pointOfCare: {UnitString}");
if (!string.IsNullOrEmpty(Bed)) items.Add($"bed: {Bed}");
if (!string.IsNullOrEmpty(PatientNumber)) items.Add($"patientNumber: {PatientNumber}");
if (!string.IsNullOrEmpty(PatientId)) items.Add($"patientId: {PatientId}");
if (AdmTime.HasValue) items.Add($"admTime: {AdmTime}");
if (DisTime.HasValue) items.Add($"disTime: {DisTime}");
if (Person != null) items.Add($"patient: {Person}");
if (AttendingDoctor != null) items.Add($"attendingDoctor: {AttendingDoctor}");
if (LastObservationDate.HasValue) items.Add($"lastObservationDate: {LastObservationDate}");
if (CreationDate.HasValue) items.Add($"creationDate: {CreationDate}");
if (UpdateDate.HasValue) items.Add($"updateDate: {UpdateDate}");
if (ArchiveDate.HasValue) items.Add($"archiveDate: {UpdateDate}");
return "person[" + string.Join(", ", items) + "]";
}
{
List<string> items = [$"id: {Id}"];
if (!string.IsNullOrEmpty(UnitString)) items.Add($"pointOfCare: {UnitString}");
if (!string.IsNullOrEmpty(Bed)) items.Add($"bed: {Bed}");
if (!string.IsNullOrEmpty(PatientNumber)) items.Add($"patientNumber: {PatientNumber}");
if (!string.IsNullOrEmpty(PatientId)) items.Add($"patientId: {PatientId}");
if (AdmTime.HasValue) items.Add($"admTime: {AdmTime}");
if (DisTime.HasValue) items.Add($"disTime: {DisTime}");
if (Person != null) items.Add($"patient: {Person}");
if (AttendingDoctor != null) items.Add($"attendingDoctor: {AttendingDoctor}");
if (LastObservationDate.HasValue) items.Add($"lastObservationDate: {LastObservationDate}");
if (CreationDate.HasValue) items.Add($"creationDate: {CreationDate}");
if (UpdateDate.HasValue) items.Add($"updateDate: {UpdateDate}");
if (ArchiveDate.HasValue) items.Add($"archiveDate: {UpdateDate}");
return "person[" + string.Join(", ", items) + "]";
}
/// <summary>
/// Determines whether the current <see cref="UnitString"/> represents an inactive Virtual Point of Care by checking that it is not null and is not defined as a value of the <see cref="VirtualPointOfCare"/> enumeration.
/// </summary>
/// <returns><c>true</c> if <c>UnitString</c> is not null and does not match any defined <see cref="VirtualPointOfCare"/> value; otherwise, <c>false</c>.</returns>
public bool IsInActivePoC()
{
return UnitString != null && !Enum.IsDefined(typeof(VirtualPointOfCare), UnitString);
}
{
return UnitString != null && !Enum.IsDefined(typeof(VirtualPointOfCare), UnitString);
}
/// <summary>
/// Creates a copy of the current <see cref="Patient"/> instance by performing a shallow copy.
/// </summary>
/// <returns>A new <see cref="Patient"/> object that is a shallow copy of the current instance.</returns>
public Patient DeepCopy()
{
return (Patient)MemberwiseClone();
}
{
return (Patient)MemberwiseClone();
}
#region UnMap
@@ -160,6 +179,9 @@ public class Patient
#endregion
}
/// <summary>
/// Represents data related to a patient's income information.
/// </summary>
public class PatientIncomeData
{
public DateTime? AdmTime { get; set; }
@@ -4,6 +4,12 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a care plan for a patient, encapsulating the details and coordination of medical treatment and health management.
/// </summary>
/// <remarks>
/// This class serves as a structured model for organizing and tracking the various aspects of a patient's care strategy.
/// </remarks>
public class PatientCarePlan
{
public ObjectId Id { get; set; }
@@ -1,5 +1,11 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a mapping structure, likely used to define relationships or transformations within a Proof of Concept (PoC) implementation.
/// </summary>
/// <remarks>
/// This class serves as a container or descriptor for mapping logic, commonly used to translate data between different representations or models.
/// </remarks>
public class PoCMapping
{
public string Id { get; set; } = string.Empty;
@@ -8,6 +14,9 @@ public class PoCMapping
public List<PoCMappingItem> PointOfCares { get; set; } = [];
}
/// <summary>
/// Represents a single item used in a proof of concept (PoC) mapping, encapsulating the data or configuration required to define a mapping entry.
/// </summary>
public class PoCMappingItem
{
public string OriginalPoC { get; set; } = string.Empty;
@@ -3,6 +3,12 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents the configuration settings for a Proof of Concept (PoC) implementation.
/// </summary>
/// <remarks>
/// This class serves as a container for configuration values used during proof-of-concept development and testing phases.
/// </remarks>
public class PoCSettings
{
public ObjectId Id { get; set; }
@@ -11,14 +17,18 @@ public class PoCSettings
public RelayEnum.Status? ManualRelayStatus { get; set; }
/// <summary>
/// Returns a string representation of the object, always including the Id, and conditionally appending the PatientLocation and Relay Manual Status when those values are not null.
/// </summary>
/// <returns>A string containing the Id and, when available, the PatientLocation and Manual Relay Status information.</returns>
public override string ToString()
{
var result = "Id: " + Id;
if (PatientLocation != null) result += PatientLocation.ToString();
if (ManualRelayStatus != null) result += "Relay Manual Status: " + ManualRelayStatus;
return result;
}
{
var result = "Id: " + Id;
if (PatientLocation != null) result += PatientLocation.ToString();
if (ManualRelayStatus != null) result += "Relay Manual Status: " + ManualRelayStatus;
return result;
}
}
@@ -3,6 +3,12 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a point-of-care location or entity within a healthcare delivery context.
/// </summary>
/// <remarks>
/// This class serves as a data model for capturing information related to a specific point where care is administered to patients.
/// </remarks>
public class PointOfCare
{
public ObjectId Id { get; set; }
@@ -30,6 +36,9 @@ public class PointOfCare
#endregion
}
/// <summary>
/// Represents the configuration settings for a point-of-care system, encapsulating the parameters and options required to manage its behavior.
/// </summary>
public class PointOfCareConfiguration
{
public List<ObjectId>? BeaconIdList { get; set; } = [];
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a pump element within the system, serving as a component for pumping-related functionality.
/// </summary>
public class PumpElement
{
public string? Id { get; set; }
+23 -8
View File
@@ -4,6 +4,12 @@ using Newtonsoft.Json;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a relay class that provides functionality for forwarding or passing through data, commands, or notifications between components.
/// </summary>
/// <remarks>
/// This class serves as an intermediary mechanism, commonly used to decouple producers and consumers of information.
/// </remarks>
public class Relay
{
public ObjectId Id { get; set; }
@@ -41,15 +47,24 @@ public class Relay
public RelayEnum.Status? ManualRelayStatus { get; set; }
/// <summary>
/// Determines whether the current <see cref="Relay"/> instance is equal to another <see cref="Relay"/> by comparing all of their properties (Driver, Ip, Port, RelayNumber, RelayName, Total, Username, and Password).
/// </summary>
/// <param name="other">The other <see cref="Relay"/> instance to compare against the current one.</param>
/// <returns><c>true</c> if all properties of both relays match; otherwise, <c>false</c>.</returns>
public bool Equals(Relay other)
{
return Driver == other.Driver && Ip == other.Ip && Port == other.Port && RelayNumber == other.RelayNumber &&
RelayName == other.RelayName && Total == other.Total && Username == other.Username &&
Password == other.Password;
}
{
return Driver == other.Driver && Ip == other.Ip && Port == other.Port && RelayNumber == other.RelayNumber &&
RelayName == other.RelayName && Total == other.Total && Username == other.Username &&
Password == other.Password;
}
/// <summary>
/// Returns a JSON string representation of the current object, serializing all its public properties via JsonConvert.
/// </summary>
/// <returns>A JSON-formatted string that represents the current object.</returns>
public override string ToString()
{
return JsonConvert.SerializeObject(this);
}
{
return JsonConvert.SerializeObject(this);
}
}
+23 -7
View File
@@ -3,6 +3,9 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a section, typically used to group or encapsulate a distinct portion of related content or functionality within a larger structure.
/// </summary>
public class Section
{
// ReSharper disable once InconsistentNaming
@@ -30,17 +33,30 @@ public class Section
public StatusEnum.Type? Status { get; set; } = null;
/// <summary>
/// Determines whether the current <see cref="Section"/> is equal to another <see cref="Section"/> by comparing their identifiers.
/// Returns <c>false</c> when the supplied instance is <c>null</c>, so no exception is raised for null inputs.
/// </summary>
/// <param name="other">The <see cref="Section"/> instance to compare with the current one.</param>
/// <returns><c>true</c> if both sections share the same <see cref="Section.Id"/>; otherwise, <c>false</c>.</returns>
public bool Equals(Section? other)
{
return other != null &&
Id == other.Id;
}
{
return other != null &&
Id == other.Id;
}
/// <summary>
/// Returns a string representation of the Section, including its identifier.
/// </summary>
/// <returns>A string formatted as "[Section id: {Id}]" containing the section's identifier.</returns>
public override string ToString()
{
return "[Section id: " + Id + "]";
}
{
return "[Section id: " + Id + "]";
}
/// <summary>
/// Represents an individual item within a section, encapsulating the data and behavior associated with that entry.
/// </summary>
public class SectionItem
{
public string? Group { get; set; }
@@ -2,6 +2,9 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents the configuration settings for a service.
/// </summary>
public class ServiceConfig
{
public ObjectId Id { get; set; }
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Provides functionality for managing service configuration settings.
/// </summary>
public class ServiceConfigService
{
public string Screen { get; set; } = string.Empty;
@@ -8,6 +11,9 @@ public class ServiceConfigService
public List<ServiceConfigServiceSection> Sections { get; set; } = [];
}
/// <summary>
/// Represents a configuration section that defines settings for a service configuration service.
/// </summary>
public class ServiceConfigServiceSection
{
public string BoxId { get; set; } = string.Empty;
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents the configuration settings for the theme of a service.
/// </summary>
public class ServiceConfigTheme
{
public string DefaultTheme { get; set; } = string.Empty;
@@ -8,6 +11,9 @@ public class ServiceConfigTheme
public List<ServiceConfigThemeTimetable> Timetables { get; set; } = [];
}
/// <summary>
/// Represents the configuration settings for a service's theme timetable.
/// </summary>
public class ServiceConfigThemeTimetable
{
public string Theme { get; set; } = string.Empty;
@@ -2,6 +2,9 @@
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents an individual step, typically within a sequence or workflow.
/// </summary>
public class Step
{
public int? RotationTime { get; set; }
@@ -18,6 +21,12 @@ public class Step
public DisplayConfigEnums.StepType? Type { get; set; } = DisplayConfigEnums.StepType.Standar;
}
/// <summary>
/// Represents data for a UI font, storing font-related information used for rendering user interface elements.
/// </summary>
/// <remarks>
/// This class serves as a data container for font properties required by the UI rendering system.
/// </remarks>
public class UiFontData
{
public double? WidthStepBed { get; set; }
@@ -4,6 +4,9 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a unit, typically used as a return type for operations that have no meaningful result value.
/// </summary>
public class Unit
{
public ObjectId Id { get; set; }
@@ -75,6 +78,9 @@ public class Unit
#endregion
}
/// <summary>
/// Represents the configuration settings for a unit.
/// </summary>
public class UnitConfiguration
{
public bool AutoAdt { get; set; }
@@ -3,6 +3,9 @@ using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a user within the system, encapsulating user-related data and behavior.
/// </summary>
public class User
{
public ObjectId Id { get; set; }