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 adas_core.Domain.Enums;
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents configuration settings for an API, such as base URL, authentication credentials, and timeout values.
/// </summary>
public class ApiSettings
{
public const string Api = "ApiSettings";
@@ -208,6 +211,9 @@ public class ApiSettings
public string? NoCalculateStatusWithCodingSystem { get; set; }
}
/// <summary>
/// Represents archived data related to a nurse, providing storage or transfer of historical nursing records.
/// </summary>
public class ArchiveNurseData
{
public bool Active { get; set; } = false;
@@ -217,12 +223,18 @@ public class ArchiveNurseData
public int IntervalMinutes { get; set; } = 15;
}
/// <summary>
/// Represents the configuration settings used to control the archiving process for nurse-related data.
/// </summary>
public class ArchiveNurseDataConfig
{
public bool Active { get; set; } = false;
public int EndDateAfterMinutes { get; set; } = 60;
}
/// <summary>
/// Represents a mapping configuration for point of care data, defining relationships between source and target structures.
/// </summary>
public class PointOfCareMapping
{
public string? Key { get; set; }
@@ -230,6 +242,9 @@ public class PointOfCareMapping
public int? Refresh { get; set; } = 600; //10min
}
/// <summary>
/// Represents configuration settings that govern how observations are captured, processed, or reported.
/// </summary>
public class ConfigObservationSettings
{
public bool IgnoreUnknownObservation { get; set; }
@@ -239,6 +254,9 @@ public class ConfigObservationSettings
#region CCC mapping config
/// <summary>
/// Represents a collection or registry of intervention codes used to identify or categorize specific interventions.
/// </summary>
public class InterventionsCodes
{
private object? _finalValue;
@@ -366,6 +384,9 @@ public class InterventionsCodes
}
}
/// <summary>
/// Represents a collection or container of values related to interventions.
/// </summary>
public class InterventionsValues
{
private object? _finalValue;
@@ -476,6 +497,9 @@ public class InterventionsValues
public int ValueContributed { get; set; } = 0;
}
/// <summary>
/// Represents a collection or configuration for mapping interventions, providing the means to associate intervention data with corresponding target structures or actions.
/// </summary>
public class MappingInterventions
{
public string? Type { get; set; }
@@ -2,6 +2,9 @@ using adas_core.Domain.Models.MongoModels;
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents a set of configuration settings used to control authentication behavior.
/// </summary>
public class AuthSettings
{
public JwtConfig? JwtConfig { get; set; }
@@ -9,6 +12,12 @@ public class AuthSettings
public List<string> LoginMethods { get; set; } = [];
}
/// <summary>
/// Represents a JWT configuration class that extends <see cref="JwtExtConfig"/>, providing additional or specialized settings for JSON Web Token processing.
/// </summary>
/// <remarks>
/// This class derives from <see cref="JwtExtConfig"/> and inherits its configuration properties, allowing it to serve as a more specific or customized JWT configuration type.
/// </remarks>
public class JwtConfig : JwtExtConfig
{
public string? Issuer { get; set; }
@@ -20,6 +29,9 @@ public class JwtConfig : JwtExtConfig
public Dictionary<string, JwtExtConfig>? ExternalProviders { get; set; } = null;
}
/// <summary>
/// Represents a configuration class for JWT (JSON Web Token) extension settings.
/// </summary>
public class JwtExtConfig
{
public string? Key { get; set; }
@@ -27,20 +39,48 @@ public class JwtExtConfig
public bool ValidateAudience { get; set; } = true;
}
/// <summary>
/// Represents a configuration collection that defines a whitelist of users, stored as a list of string identifiers.
/// </summary>
/// <remarks>
/// Inherits from a generic list of strings, exposing standard collection semantics for the whitelisted user entries.
/// </remarks>
public class UsersWhiteListConfig : List<string>
{
/// <summary>
/// Determines whether the collection contains a username matching the specified user's username, using a case-insensitive comparison.
/// </summary>
/// <param name="user">The user whose username will be checked against the collection.</param>
/// <returns><c>true</c> if a matching username is found; otherwise, <c>false</c>.</returns>
public bool IsValid(User user)
{
return this.Any(username => username.ToLowerInvariant().Equals(user.UserName.ToLowerInvariant()));
}
{
return this.Any(username => username.ToLowerInvariant().Equals(user.UserName.ToLowerInvariant()));
}
}
/// <summary>
/// Represents a configuration collection of <see cref="ValidGroup"/> instances, exposing them as a strongly-typed list.
/// </summary>
/// <remarks>
/// This type inherits from <see cref="List{T}"/> where T is <see cref="ValidGroup"/>, providing standard list operations for managing the configured valid groups.
/// </remarks>
/// <summary>
/// Represents a validation group used to organize or aggregate related validation rules.
/// </summary>
/// <remarks>
/// This type serves as a container or marker for grouping validation logic within a broader validation framework.
/// </remarks>
public class ValidGroupsConfig : List<ValidGroup>
{
/// <summary>
/// Determines whether the specified user is considered valid by checking that it is not null.
/// </summary>
/// <param name="user">The user instance to validate.</param>
/// <returns><see langword="true"/> if <paramref name="user"/> is not null; otherwise, <see langword="false"/>.</returns>
public bool IsValid(User? user)
{
return user != null;
}
{
return user != null;
}
}
public class ValidGroup
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents the configuration settings for automatic recording functionality.
/// </summary>
public class AutoRecordingSettings
{
public AutoStart? AutoStart { get; set; }
@@ -7,6 +10,9 @@ public class AutoRecordingSettings
public MustSendAlert? MustSendAlert { get; set; }
}
/// <summary>
/// Represents functionality related to automatic startup of a process or service.
/// </summary>
public class AutoStart
{
public int BlueCode { get; set; }
@@ -14,6 +20,9 @@ public class AutoStart
public int RespirationAlert { get; set; }
}
/// <summary>
/// Represents an automatic stop mechanism that handles stopping operations or processes automatically.
/// </summary>
public class AutoStop
{
public int BlueCode { get; set; }
@@ -21,6 +30,9 @@ public class AutoStop
public int RespirationAlert { get; set; }
}
/// <summary>
/// Represents a condition or requirement that indicates an alert must be sent.
/// </summary>
public class MustSendAlert
{
public bool BlueCode { get; set; }
@@ -2,6 +2,9 @@ using adas_core.Domain.Enums;
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents configuration settings for a caching mechanism.
/// </summary>
public class CacheSettings
{
@@ -39,6 +42,10 @@ public class CacheSettings
// -------------------- InMemory Cache --------------------
/// <summary>
/// Represents an in-memory implementation for managing application settings.
/// Provides storage and retrieval of configuration values without persisting them to an external source.
/// </summary>
public class InMemorySettings
{
public TtlSettings Ttl { get; set; } = new();
@@ -48,6 +55,9 @@ public class InMemorySettings
// -------------------- TTL por entidad --------------------
/// <summary>
/// Represents configuration settings related to Time-To-Live (TTL) behavior.
/// </summary>
public class TtlSettings
{
public int? GlobalSeconds { get; set; }
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents a set of configuration settings used to establish and manage database connections.
/// </summary>
public class DatabaseSettings
{
public const string Database = "DatabaseSettings";
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents configuration or display settings for a list.
/// </summary>
public class ListSettings
{
public ListSettingItem AltableOptionList { get; set; } = new()
@@ -134,6 +137,9 @@ public class ListSettings
};
}
/// <summary>
/// Represents a single item within a list-based setting configuration.
/// </summary>
public class ListSettingItem
{
public string? ManualObservationName { get; set; }
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents the configuration settings related to permissions.
/// </summary>
public class PermissionSettings
{
public SourcePermissions Admin { get; set; } = new(
@@ -329,6 +332,12 @@ public class PanelPermissionTypes(
public bool UseDemoMode { get; set; } = useDemoMode;
}
/// <summary>
/// Represents a set of user permissions indicating whether the user is allowed to create, update, delete, read, or execute specific operations.
/// </summary>
/// <remarks>
/// This type captures granular action-level authorization flags, allowing the application to enforce and check individual user capabilities across supported operations.
/// </remarks>
public class UserActions(bool create, bool update, bool delete, bool read, bool execute)
{
public bool Create { get; set; } = create;
@@ -1,5 +1,11 @@
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents configuration settings for connecting to and interacting with a RabbitMQ message broker.
/// </summary>
/// <remarks>
/// This class is intended to hold RabbitMQ-related configuration values, such as connection details and broker options, that can be bound from application configuration sources.
/// </remarks>
public class RabbitMqSettings
{
public string ConnectionString { get; set; } = string.Empty;
@@ -1,5 +1,8 @@
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents configuration settings used to control recording behavior.
/// </summary>
public class RecordingSettings
{
public const string Recording = "RecordingSettings";
@@ -27,6 +27,9 @@ namespace adas_core.Domain.Models.AppSettings
public TtlSettings Ttl { get; set; } = new();
// Submodelos
/// <summary>
/// Represents a Redis server endpoint, typically used to encapsulate connection details such as host, port, and credentials required to connect to a Redis instance.
/// </summary>
public class RedisEndpoint
{
public string Host { get; set; } = null!;
@@ -36,48 +39,122 @@ namespace adas_core.Domain.Models.AppSettings
// CacheKeys: claves estandarizadas y unificadas para todas las entidades
// Estas claves son fundamentales para:
/// <summary>
/// Provides static cache key constants used throughout the application to ensure consistent key naming when storing and retrieving cached data.
/// </summary>
public static class CacheKeys
{
// ----------------- Patients -----------------
/// <summary>
/// Builds a formatted patient identifier by prefixing the provided patient ID with "patients:".
/// </summary>
/// <param name="patientId">The unique identifier of the patient to be included in the formatted string.</param>
/// <returns>A string in the format "patients:{patientId}" representing the patient resource key.</returns>
public static string Patient(string patientId)
=> $"patients:{patientId}";
=> $"patients:{patientId}";
// ----------------- ConfigDisplays -----------------
/// <summary>
/// Builds a configuration key for a config display by combining the <c>configDisplays</c> namespace with the specified identifier.
/// </summary>
/// <param name="id">The unique identifier of the config display to include in the key.</param>
/// <returns>A formatted key string in the form <c>configDisplays:{id}</c> suitable for lookup or caching.</returns>
public static string ConfigDisplay(string id)
=> $"configDisplays:{id}";
=> $"configDisplays:{id}";
/// <summary>
/// Returns the configuration key representing the "all displays" setting, typically used to request or identify the display configuration for all available displays.
/// </summary>
/// <returns>The string identifier "configDisplays:all" used to reference the all-displays configuration.</returns>
public static string ConfigDisplaysAll()
=> "configDisplays:all";
=> "configDisplays:all";
// ----------------- PumpObservations -----------------
/// <summary>
/// Formats the specified observation identifier as a pump observation reference string by prefixing it with "pumpObs:".
/// </summary>
/// <param name="obsId">The observation identifier to include in the formatted result.</param>
/// <returns>A formatted string in the form "pumpObs:{obsId}".</returns>
public static string PumpObservation(string obsId)
=> $"pumpObs:{obsId}";
=> $"pumpObs:{obsId}";
/// <summary>
/// Builds a daily pump observation identifier by composing a prefixed key with the pump identifier and the date in <c>yyyyMMdd</c> format.
/// </summary>
/// <param name="pumpId">The unique identifier of the pump used in the composed key.</param>
/// <param name="date">The observation date whose year, month, and day are formatted into the key.</param>
/// <returns>A string in the form <c>pumpObs:pump:{pumpId}:{yyyyMMdd}</c> representing the daily pump observation key.</returns>
public static string PumpDaily(string pumpId, DateTime date)
=> $"pumpObs:pump:{pumpId}:{date:yyyyMMdd}";
=> $"pumpObs:pump:{pumpId}:{date:yyyyMMdd}";
// ----------------- Appointments -----------------
/// <summary>
/// Builds an appointment resource identifier by combining the "appointments" prefix with the specified appointment ID.
/// </summary>
/// <param name="apptId">The unique identifier of the appointment.</param>
/// <returns>A formatted string in the form "appointments:{apptId}".</returns>
public static string Appointment(string apptId)
=> $"appointments:{apptId}";
=> $"appointments:{apptId}";
/// <summary>
/// Builds a cache key for retrieving a patient's appointments for a specific calendar day.
/// The key is composed of the patient identifier and the date formatted as <c>yyyyMMdd</c>.
/// </summary>
/// <param name="patientId">The unique identifier of the patient whose appointments are being addressed.</param>
/// <param name="date">The date for which the appointments are being requested.</param>
/// <returns>A formatted cache key string combining the patient identifier and the day in <c>yyyyMMdd</c> format.</returns>
public static string AppointmentsByPatientDay(string patientId, DateTime date)
=> $"appointments:patient:{patientId}:{date:yyyyMMdd}";
=> $"appointments:patient:{patientId}:{date:yyyyMMdd}";
/// <summary>
/// Builds a deterministic cache key used to look up a patient's appointments for the month of the supplied date.
/// The key is composed of the patient identifier and the date formatted as <c>yyyyMM</c>.
/// </summary>
/// <param name="patientId">The identifier of the patient whose appointments are being queried.</param>
/// <param name="date">The date whose year and month determine the appointment period encoded in the key.</param>
/// <returns>A formatted string in the form <c>appointments:patient:{patientId}:{yyyyMM}</c> suitable for use as a cache key.</returns>
public static string AppointmentsByPatientMonth(string patientId, DateTime date)
=> $"appointments:patient:{patientId}:{date:yyyyMM}";
=> $"appointments:patient:{patientId}:{date:yyyyMM}";
// ----------------- GroupedObservations -----------------
/// <summary>
/// Builds a formatted identifier string for grouped observations associated with a specific patient, typically used as a cache key or lookup token.
/// </summary>
/// <param name="patientId">The unique identifier of the patient whose observations are being referenced.</param>
/// <param name="groupedField">The optional field used to group the observations; may be null.</param>
/// <returns>A formatted string in the pattern "groupedObs:{groupedField}:patient:{patientId}".</returns>
public static string GroupedObservationsByPatient(string patientId, string? groupedField)
=> $"groupedObs:{groupedField}:patient:{patientId}";
=> $"groupedObs:{groupedField}:patient:{patientId}";
/// <summary>
/// Generates a formatted cache key for grouped observations scoped to a specific patient and day.
/// </summary>
/// <param name="patientId">The unique identifier of the patient.</param>
/// <param name="groupedField">The field name used to group the observations.</param>
/// <param name="date">The observation date, formatted as <c>yyyyMMdd</c> in the generated key.</param>
/// <returns>A cache key string in the format <c>groupedObs:{groupedField}:patient:{patientId}:{yyyyMMdd}</c>.</returns>
public static string GroupedObservationsByPatientDay(string patientId, string groupedField, DateTime date)
=> $"groupedObs:{groupedField}:patient:{patientId}:{date:yyyyMMdd}";
=> $"groupedObs:{groupedField}:patient:{patientId}:{date:yyyyMMdd}";
/// <summary>
/// Builds a cache key for grouped observations scoped to a specific patient and month, combining the grouping field, patient identifier, and the year-month portion of the provided date.
/// </summary>
/// <param name="patientId">The identifier of the patient whose observations are being grouped.</param>
/// <param name="groupedField">The observation field used as the grouping criterion.</param>
/// <param name="date">The date used to derive the month bucket (formatted as yyyyMM) for the cache key.</param>
/// <returns>A formatted cache key string in the form <c>groupedObs:{groupedField}:patient:{patientId}:{yyyyMM}</c>.</returns>
public static string GroupedObservationsByPatientMonth(string patientId, string groupedField, DateTime date)
=> $"groupedObs:{groupedField}:patient:{patientId}:{date:yyyyMM}";
=> $"groupedObs:{groupedField}:patient:{patientId}:{date:yyyyMM}";
/// <summary>
/// Generates a cache key for retrieving the most recent grouped observations for a specific patient.
/// </summary>
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
/// <param name="groupedField">The field used to group the observations.</param>
/// <param name="take">The maximum number of latest observations to include in the cache key.</param>
/// <returns>A formatted cache key string identifying the patient's latest grouped observations.</returns>
public static string GroupedObservationsLatest(string patientId, string groupedField, int take)
=> $"groupedObs:{groupedField}:patient:{patientId}:latest:{take}";
=> $"groupedObs:{groupedField}:patient:{patientId}:latest:{take}";
}
}
}