Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop

This commit is contained in:
jrojas
2026-06-26 09:52:35 +02:00
commit 319fd3dfb0
746 changed files with 106610 additions and 0 deletions
@@ -0,0 +1,50 @@
using adas_core.Application.Services.Caching;
using adas_core.Application.Services.Interfaces;
using adas_core.Domain.Models.AppSettings;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace adas_core.Infrastructure.Utils
{
public static class CacheHostBuilderExtension
{
public static IHostBuilder UseCache(this IHostBuilder hostBuilder)
{
return hostBuilder.ConfigureServices((context, services) =>
{
services.Configure<CacheSettings>(context.Configuration.GetSection("CacheSettings"));
services.AddSingleton(sp => sp.GetRequiredService<IOptions<CacheSettings>>().Value);
services.AddSingleton<InMemoryLockProvider>();
services.AddSingleton<NoCacheService>();
// RedisLockProvider obtiene IDatabase de forma lazy a través de una clausura,
// ya que la conexión se establece de forma asíncrona dentro de RedisService.
services.AddSingleton<RedisService>(sp => {
RedisService? svcRef = null;
var lockProvider = new RedisLockProvider(() => svcRef?.Database);
var lockMgr = new LockManagerService(
sp.GetRequiredService<ILogger<LockManagerService>>(),
lockProvider);
svcRef = new RedisService(
sp.GetRequiredService<IOptions<CacheSettings>>(),
sp.GetRequiredService<ILogger<RedisService>>(),
lockMgr);
return svcRef;
});
// Inyectamos LockManager con InMemoryLockProvider
services.AddSingleton<CacheService>(sp => {
var lockMgr = new LockManagerService(
sp.GetRequiredService<ILogger<LockManagerService>>(),
sp.GetRequiredService<InMemoryLockProvider>());
return new CacheService(lockMgr);
});
services.AddSingleton<ICacheService, CacheDispatcher>();
});
}
}
}
@@ -0,0 +1,43 @@
using adas_core.Domain.Models.MongoModels;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace adas_core.Infrastructure.Utils;
public class CustomPointOfCareConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType == typeof(PointOfCare);
}
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
if (value == null)
{
writer.WriteNull();
return;
}
var jo = JObject.FromObject(value);
// Aquí modificas específicamente las propiedades que necesitas
// Por ejemplo, aplicar StringEnumConverter solo a ciertas propiedades enumeradas
// Esto es un ejemplo, ajusta según tus necesidades
foreach (var prop in value.GetType().GetProperties())
if (prop.PropertyType.IsEnum)
{
var enumValue = prop.GetValue(value);
if (enumValue != null) jo[prop.Name] = JToken.FromObject(enumValue.ToString() ?? string.Empty);
}
jo.WriteTo(writer);
}
public override object ReadJson(JsonReader reader, Type objectType, object? existingValue,
JsonSerializer serializer)
{
// Implementa la lógica de deserialización si es necesario
throw new NotImplementedException();
}
}
@@ -0,0 +1,104 @@
using System.Reflection;
using adas_core.Domain.Models.AppSettings;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Driver;
using MongoMigrations.Core;
using MongoClient = MongoDB.Driver.MongoClient;
namespace adas_core.Infrastructure.Utils;
public static class MongoDbHostBuilderExtension
{
public static IHostBuilder UseMongo(this IHostBuilder hostBuilder)
{
ConfigureMongoDbConventions();
ConfigureRegisterMapClass();
return hostBuilder;
}
public static IHost RunMongoMigrations(this IHost host)
{
using var scope = host.Services.CreateScope();
var database = scope.ServiceProvider.GetRequiredService<IMongoDatabase>();
var locator = new MigrationLocator();
locator.LookForMigrationsInAssembly(
typeof(adas_core.Infrastructure.Migrations.MongoMigrations.U_0_1_0_UpdateDataPatien).Assembly
);
var runner = new MigrationRunner(
database,
collectionName: "migrations",
migrationLocator: locator
);
runner.UpdateToLatest();
return host;
}
private static IMongoDatabase ConfigureMongoDbConnection(IOptions<DatabaseSettings> dbSettings)
{
var connectionString = dbSettings.Value.ConnectionString;
var databaseName = dbSettings.Value.DatabaseName;
if (string.IsNullOrEmpty(connectionString) || string.IsNullOrEmpty(databaseName))
throw new Exception("DataBase connection string and name is requiered");
_mongoClient = new MongoClient(connectionString);
var mongoDb = _mongoClient.GetDatabase(databaseName);
if (mongoDb == null) throw new Exception("DataBase doesn't exist");
return mongoDb;
}
public static void ConfigureRegisterMapClass()
{
var assembly = Assembly.GetExecutingAssembly();
// Busca todos los tipos que implementan la interfaz
var contributors = assembly.GetTypes()
.Where(t => typeof(IEntityMapContributor).IsAssignableFrom(t) &&
t is { IsInterface: false, IsAbstract: false });
// Crea una instancia de cada contribuidor y ejecuta su método
foreach (var contributorType in contributors)
{
var contributorInstance = (IEntityMapContributor)Activator.CreateInstance(contributorType)!;
contributorInstance.RegisterMaps();
}
}
public static void ConfigureMongoDbConventions()
{
var pack = new ConventionPack
{
new IgnoreExtraElementsConvention(true),
new CamelCaseElementNameConvention()
};
ConventionRegistry.Register(
"Ignore Extra Elements Convention",
pack,
_ => true);
ConventionRegistry.Register(
"Camel Case Convention",
pack,
_ => true);
}
#region MongoDB
private static MongoClient? _mongoClient;
#endregion
}
@@ -0,0 +1,133 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models;
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.SystemAlerts;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class AlarmMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(AlarmConfig)))
BsonClassMap.RegisterClassMap<AlarmConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Enabled).SetDefaultValue(false);
cm.MapMember(c => c.EndAfter).SetIgnoreIfNull(true);
cm.MapMember(c => c.Recording).SetIgnoreIfNull(true);
cm.MapMember(c => c.Beacon).SetIgnoreIfNull(true);
cm.MapMember(c => c.OpenDoor).SetIgnoreIfNull(true);
cm.MapMember(c => c.Priority).SetIgnoreIfNull(true);
cm.MapMember(c => c.Color).SetIgnoreIfNull(true);
cm.MapMember(c => c.AudioConfig).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(AudioConfig)))
BsonClassMap.RegisterClassMap<AudioConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type)
.SetDefaultValue(AlarmEnum.AudioAlarmType.Off)
.SetSerializer(new EnumSerializer<AlarmEnum.AudioAlarmType>(BsonType.String));
cm.MapMember(c => c.Path).SetIgnoreIfNull(true);
cm.MapMember(c => c.EndAfter).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(AlarmItem)))
BsonClassMap.RegisterClassMap<AlarmItem>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Enabled).SetDefaultValue(false);
cm.MapMember(c => c.StartBefore).SetIgnoreIfNull(true);
cm.MapMember(c => c.EndAfter).SetIgnoreIfNull(true);
cm.MapMember(c => c.Color).SetIgnoreIfNull(true);
cm.MapMember(c => c.Severity)
.SetDefaultValue(AlarmEnum.Severity.None)
.SetSerializer(new EnumSerializer<AlarmEnum.Severity>(BsonType.String));
cm.MapMember(c => c.BeaconColor)
.SetDefaultValue(AlarmEnum.BeaconColor.None)
.SetSerializer(new EnumSerializer<AlarmEnum.BeaconColor>(BsonType.String));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientObservationAlarm)))
{
BsonClassMap.RegisterClassMap<PatientObservationAlarm>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.InactivationState).SetIgnoreIfNull(true);
cm.MapMember(c => c.EventPhase)
.SetDefaultValue(AlarmEnum.EventPhase.Continue)
.SetSerializer(new EnumSerializer<AlarmEnum.EventPhase>(BsonType.String));
cm.MapMember(c => c.Event).SetIgnoreIfNull(true);
cm.MapMember(c => c.EventId).SetIgnoreIfNull(true);
cm.MapMember(c => c.State)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<AlarmEnum.ObservationAlarmState>(
new EnumSerializer<AlarmEnum.ObservationAlarmState>(BsonType.String)));
cm.MapMember(c => c.Priority)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<AlarmEnum.ObservationAlarmPriority>(
new EnumSerializer<AlarmEnum.ObservationAlarmPriority>(BsonType.String)));
cm.MapMember(c => c.PriorityLevel)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<int>(new Int32Serializer()));
cm.UnmapMember(c => c.AlarmConfig);
cm.MapMember(c => c.Type)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<AlarmEnum.ObservationAlarmType>(
new EnumSerializer<AlarmEnum.ObservationAlarmType>(BsonType.String)));
cm.MapMember(c => c.AlertColor).SetIgnoreIfNull(true)
.SetSerializer(new StringSerializer(BsonType.String));
cm.UnmapMember(c => c.MessageTime);
cm.MapMember(c => c.Persist).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.Expired);
cm.MapMember(c => c.Expires).SetIgnoreIfNull(true);
cm.MapMember(c => c.Sources).SetIgnoreIfNull(true);
});
BsonClassMap.RegisterClassMap<InactivationState>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Audio)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<AlarmEnum.AudioVideoState>(
new EnumSerializer<AlarmEnum.AudioVideoState>(BsonType.String)));
cm.MapMember(c => c.Visual)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<AlarmEnum.AudioVideoState>(
new EnumSerializer<AlarmEnum.AudioVideoState>(BsonType.String)));
cm.MapMember(c => c.Acknowledge).SetIgnoreIfNull(true);
});
BsonClassMap.RegisterClassMap<Source>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Code).SetIgnoreIfNull(true);
cm.MapMember(c => c.OriginalName).SetIgnoreIfNull(true);
cm.MapMember(c => c.CodeSystem).SetIgnoreIfNull(true);
cm.MapMember(c => c.Units).SetIgnoreIfNull(true);
cm.MapMember(c => c.Value).SetIgnoreIfNull(true);
cm.MapMember(c => c.Result).SetIgnoreIfNull(true);
});
}
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientRecordingAlert)))
BsonClassMap.RegisterClassMap<PatientRecordingAlert>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.IsRecording);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Performance)))
BsonClassMap.RegisterClassMap<Performance>(cm => { cm.AutoMap(); });
}
}
@@ -0,0 +1,72 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class AppointmentMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientAppointment)))
BsonClassMap.RegisterClassMap<PatientAppointment>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.PatientId).SetSerializer(new ObjectIdSerializer(BsonType.String));
cm.MapMember(c => c.Patient).SetIgnoreIfNull(true);
cm.MapMember(c => c.Timings).SetDefaultValue(new List<Timing>());
cm.MapMember(c => c.CreateTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.UpdateTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.PlacerOrder).SetIgnoreIfNull(true);
cm.MapMember(c => c.FillerOrder).SetIgnoreIfNull(true);
cm.MapMember(c => c.EventReason).SetIgnoreIfNull(true);
cm.MapMember(c => c.AppointmentReason).SetIgnoreIfNull(true);
cm.MapMember(c => c.AppointmentType).SetIgnoreIfNull(true);
cm.MapMember(c => c.AppointmentOperationType)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<OperationType>(new EnumSerializer<OperationType>(BsonType.String)));
cm.MapMember(c => c.AppointmentStatus)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<OperationType>(new EnumSerializer<OperationType>(BsonType.String)));
cm.MapMember(c => c.Duration).SetIgnoreIfNull(true);
cm.MapMember(c => c.VisitNumber).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientClass).SetIgnoreIfNull(true);
cm.MapMember(c => c.EpisodeActivation).SetDefaultValue(true);
cm.MapMember(c => c.PlacerContact).SetIgnoreIfNull(true);
cm.MapMember(c => c.FillerContact).SetIgnoreIfNull(true);
cm.MapMember(c => c.ResourceGroups).SetDefaultValue(new List<PatientAppointmentResourceGroup>());
cm.MapMember(c => c.Allergies).SetDefaultValue(new List<Allergies>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientAppointmentResourceGroup)))
BsonClassMap.RegisterClassMap<PatientAppointmentResourceGroup>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Services).SetIgnoreIfNull(true);
cm.MapMember(c => c.Resources).SetIgnoreIfNull(true);
cm.MapMember(c => c.Locations).SetIgnoreIfNull(true);
cm.MapMember(c => c.Personnel).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.ServicesActions);
cm.UnmapMember(c => c.ResourcesActions);
cm.UnmapMember(c => c.LocationsActions);
cm.UnmapMember(c => c.PersonnelActions);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Allergies)))
BsonClassMap.RegisterClassMap<Allergies>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.AllergenType).SetIgnoreIfNull(true);
cm.MapMember(c => c.Allergen).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,37 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class AuthMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(User)))
BsonClassMap.RegisterClassMap<User>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Password)
.SetIgnoreIfNull(true)
.SetShouldSerializeMethod(obj => !string.IsNullOrEmpty(((User)obj).Password));
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.LockExpirationDate)
.SetIgnoreIfNull(true);
cm.MapMember(c => c.Authorization).SetElementName("Authorization")
.SetShouldSerializeMethod(_ => false);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Authorization)))
BsonClassMap.RegisterClassMap<Authorization>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.UnitId).SetIgnoreIfNull(true);
cm.UnmapProperty(c => c.User);
cm.UnmapProperty(c => c.Display);
cm.UnmapProperty(c => c.Unit);
});
}
}
@@ -0,0 +1,62 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class BannerConfigMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(BannerItem)))
BsonClassMap.RegisterClassMap<BannerItem>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<DisplayConfigEnums.BannerType>(
new EnumSerializer<DisplayConfigEnums.BannerType>(BsonType.String)));
cm.MapMember(c => c.GrowPriority).SetDefaultValue(1);
cm.MapMember(c => c.Config).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(BannerItemConfig)))
BsonClassMap.RegisterClassMap<BannerItemConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.BannerItemDialogTableConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.BannerItemTableConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.MedicalStaffConfig).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(BannerItemTableConfig)))
BsonClassMap.RegisterClassMap<BannerItemTableConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Config).SetIgnoreIfNull(true);
cm.MapMember(c => c.BgColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.TextColor).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(HeaderBannerItemTableConfig)))
BsonClassMap.RegisterClassMap<HeaderBannerItemTableConfig>(cm =>
{
cm.MapMember(c => c.Type)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<DisplayConfigEnums.CellType>(
new EnumSerializer<DisplayConfigEnums.CellType>(BsonType.String)));
cm.MapMember(c => c.SubType).SetIgnoreIfNull(true);
cm.MapMember(c => c.Field).SetIgnoreIfNull(true);
cm.MapMember(c => c.GrowPriority).SetIgnoreIfNull(true);
cm.MapMember(c => c.Icon).SetIgnoreIfNull(true);
cm.MapMember(c => c.BgColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.TextColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,42 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using adas_core.module.LightBeacons.Devices;
using MongoDB.Bson.Serialization;
using LightBeacon = adas_core.Domain.Models.MongoModels.LightBeacon;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class BeaconMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(LightBeacon)))
BsonClassMap.RegisterClassMap<LightBeacon>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.Type).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Name).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Options).SetDefaultValue(new Options());
cm.MapMember(c => c.InUse).SetIgnoreIfNull(true).SetIsRequired(false);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Options)))
BsonClassMap.RegisterClassMap<Options>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Url).SetIgnoreIfNull(true);
cm.MapMember(c => c.Port).SetIgnoreIfNull(true);
cm.MapMember(c => c.Password).SetIgnoreIfNull(true);
cm.MapMember(c => c.Emulate).SetDefaultValue(false);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(LightBeaconAbstract)))
BsonClassMap.RegisterClassMap<LightBeaconAbstract>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Host);
cm.MapMember(c => c.Password);
});
}
}
@@ -0,0 +1,48 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.BsonConverters;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using Stream = adas_core.Domain.Models.MongoModels.Stream;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class BoxConfigMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Box)))
BsonClassMap.RegisterClassMap<Box>(cm =>
{
cm.AutoMap();
cm.UnmapMember(c => c.PointOfCare); //Esto hace que ignora la propiedad en la serialización del Bson
cm.MapMember(c => c.Bed).SetElementName("name");
cm.UnmapMember(c => c.IsActive);
cm.UnmapMember(c => c.IsVisible);
cm.MapMember(c => c.Configuration)
.SetSerializer(new DictionaryBsonConverter())
.SetIgnoreIfNull(true);
cm.UnmapMember(c => c.Location);
cm.UnmapMember(c => c.HasPatient);
cm.UnmapMember(c => c.Patientid);
cm.UnmapMember(c => c.Patient);
cm.UnmapMember(c => c.AttendingDoctor);
cm.UnmapMember(c => c.Type);
cm.UnmapMember(c => c.Observations);
cm.UnmapMember(c => c.Medication);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Sensor)))
BsonClassMap.RegisterClassMap<Sensor>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
cm.MapMember(c => c.OnlyNumbers).SetDefaultValue(true);
cm.MapMember(c => c.IsGeneral).SetDefaultValue(true);
});
}
}
@@ -0,0 +1,39 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
using Stream = System.IO.Stream;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class CameraContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Camera)))
{
BsonClassMap.RegisterClassMap<Camera>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.Streams).SetIgnoreIfNull(true);
cm.MapMember(c => c.Name).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Ptz).SetDefaultValue(false);
cm.MapMember(c => c.Driver).SetIgnoreIfNull(true);
cm.MapMember(c => c.Ip).SetIgnoreIfNull(true);
cm.MapMember(c => c.Username).SetIgnoreIfNull(true);
cm.MapMember(c => c.Password).SetIgnoreIfNull(true);
cm.MapMember(c => c.InUse).SetIgnoreIfNull(true).SetIsRequired(false);
});
BsonClassMap.RegisterClassMap<Domain.Models.MongoModels.Stream>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Rtsp).SetIgnoreIfNull(true);
cm.MapMember(c => c.Jpeg).SetIgnoreIfNull(true);
cm.MapMember(c => c.WebRtc).SetIgnoreIfNull(true);
cm.MapMember(c => c.Hls).SetIgnoreIfNull(true);
cm.MapMember(c => c.Mp4).SetIgnoreIfNull(true);
});
}
}
}
@@ -0,0 +1,93 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class CardMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(SectionBoxLayout)))
BsonClassMap.RegisterClassMap<SectionBoxLayout>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type).SetDefaultValue(DisplayConfigEnums.RowType.Simple)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.RowType>(BsonType.String));
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Subtitle).SetIgnoreIfNull(true);
cm.MapMember(c => c.Icon).SetIgnoreIfNull(true);
cm.MapMember(c => c.GridColumn).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingTop).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingBottom).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingLeft).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingRight).SetIgnoreIfNull(true);
cm.MapMember(c => c.BorderColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.BorderWidth).SetIgnoreIfNull(true);
cm.MapMember(c => c.BorderStyle).SetIgnoreIfNull(true);
cm.MapMember(c => c.BorderRadius).SetIgnoreIfNull(true);
cm.MapMember(c => c.HProportion).SetIgnoreIfNull(true);
cm.MapMember(c => c.BgColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.SectionUrl).SetIgnoreIfNull(true);
cm.MapMember(c => c.MinHeight).SetIgnoreIfNull(true);
cm.MapMember(c => c.Subtitle).SetIgnoreIfNull(true);
cm.MapMember(c => c.Conditions).SetIgnoreIfNull(true);
cm.MapMember(c => c.Direction).SetDefaultValue(DisplayConfigEnums.DirectionEnum.Row)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.DirectionEnum>(BsonType.String));
cm.MapMember(c => c.Rows).SetDefaultValue(new List<RowBoxLayout>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(CardDetailsConfig)))
BsonClassMap.RegisterClassMap<CardDetailsConfig>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.Header).SetIgnoreIfNull(true);
cm.MapMember(c => c.SmartSections).SetDefaultValue(new List<SectionBoxLayout>());
cm.MapMember(c => c.NurseRows).SetDefaultValue(new List<RowDetailsConfig>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(CardRotatingLayout)))
BsonClassMap.RegisterClassMap<CardRotatingLayout>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.MillisecondsBeforeRotating).SetDefaultValue(3000);
cm.MapMember(c => c.Order).SetIgnoreIfNull(true);
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
cm.MapMember(c => c.Data)
.SetIgnoreIfNull(true)
.SetIsRequired(false);
cm.MapMember(c => c.Type).SetDefaultValue(DisplayConfigEnums.RotatingLayoutType.HomeSection)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.RotatingLayoutType>(BsonType.String));
cm.MapMember(c => c.Mode).SetDefaultValue(DisplayConfigEnums.RotatingLayoutMode.Default)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.RotatingLayoutMode>(BsonType.String));
});
//standard card rotating layout
if (!BsonClassMap.IsClassMapRegistered(typeof(Step)))
BsonClassMap.RegisterClassMap<Step>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<DisplayConfigEnums.StepType>(
new EnumSerializer<DisplayConfigEnums.StepType>(BsonType.String)));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(HomeConfig)))
BsonClassMap.RegisterClassMap<HomeConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.MinColumnSize).SetDefaultValue("250");
cm.MapMember(c => c.ColumnsPerBreakpoint).SetDefaultValue(1);
cm.MapMember(c => c.BreakpointSize).SetDefaultValue("2000");
cm.MapMember(c => c.CardAspectRatioHeight).SetDefaultValue("700");
cm.MapMember(c => c.CardAspectRatioWidth).SetDefaultValue("500");
});
}
}
@@ -0,0 +1,129 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class CellMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Cell)))
BsonClassMap.RegisterClassMap<Cell>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type)
.SetDefaultValue(DisplayConfigEnums.CellType.Default)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.CellType>(BsonType.String));
cm.MapMember(c => c.ChartSettings).SetIgnoreIfNull(true);
cm.MapMember(c => c.GrowPriority).SetDefaultValue(1.0);
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.IconValueList)
.SetIgnoreIfNull(true);
cm.MapMember(c => c.Border).SetIgnoreIfNull(true);
cm.MapMember(c => c.BorderRadius).SetIgnoreIfNull(true);
cm.MapMember(c => c.Direction)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<DisplayConfigEnums.DirectionEnum>(
new EnumSerializer<DisplayConfigEnums.DirectionEnum>(BsonType.String)));
cm.MapMember(c => c.SubType).SetIgnoreIfNull(true);
cm.MapMember(c => c.Size).SetIgnoreIfNull(true);
cm.MapMember(c => c.HideName).SetIgnoreIfNull(true);
cm.MapMember(c => c.IsVisible).SetDefaultValue(true);
cm.MapMember(c => c.IsColumn).SetIgnoreIfNull(true);
cm.MapMember(c => c.BgColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
cm.MapMember(c => c.ValuePathKey).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingTop).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingBottom).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingLeft).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingRight).SetIgnoreIfNull(true);
cm.MapMember(c => c.Color).SetIgnoreIfNull(true);
cm.MapMember(c => c.BackgroundColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShowIcon).SetIgnoreIfNull(true);
cm.MapMember(c => c.FlexBasis).SetIgnoreIfNull(true);
cm.MapMember(c => c.Grow).SetIgnoreIfNull(true);
cm.MapMember(c => c.Shrink).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShowTitle).SetIgnoreIfNull(true);
cm.MapMember(c => c.IndicatorHorizontal).SetIgnoreIfNull(true);
cm.MapMember(c => c.DialogConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShowIndicator).SetIgnoreIfNull(true);
cm.MapMember(c => c.OnlyNumber).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShowArrow).SetIgnoreIfNull(true);
cm.MapMember(c => c.GraphConf).SetIgnoreIfNull(true);
cm.MapMember(c => c.Names).SetIgnoreIfNull(true);
cm.MapMember(c => c.ObservationName).SetIgnoreIfNull(true);
cm.MapMember(c => c.ObservationTitle).SetIgnoreIfNull(true);
cm.MapMember(c => c.GraphConf).SetIgnoreIfNull(true);
cm.MapMember(c => c.ValuePathNested).SetIgnoreIfNull(true);
cm.MapMember(c => c.SubObs).SetIgnoreIfNull(true);
cm.MapMember(c => c.TextRules).SetIgnoreIfNull(true);
cm.MapMember(c => c.IsStatic).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(CellDetails)))
BsonClassMap.RegisterClassMap<CellDetails>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.TextRules).SetIgnoreIfNull(true);
cm.MapMember(c => c.Type)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.CellType>(BsonType.String))
.SetDefaultValue(DisplayConfigEnums.CellType.Default);
cm.MapMember(c => c.ChartSettings).SetIgnoreIfNull(true);
cm.MapMember(c => c.SubType).SetDefaultValue(string.Empty);
cm.MapMember(c => c.GrowPriority).SetDefaultValue(1.0);
cm.MapMember(c => c.Cells).SetDefaultValue(new List<CellDetails>());
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
cm.MapMember(c => c.IsVisible).SetDefaultValue(true);
cm.MapMember(c => c.ValuePathNested).SetIgnoreIfNull(true);
cm.MapMember(c => c.ValuePathKey).SetIgnoreIfNull(true);
cm.MapMember(c => c.IconValueList).SetIgnoreIfNull(true);
cm.MapMember(c => c.ObservationName).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingTop).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingBottom).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingLeft).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingRight).SetIgnoreIfNull(true);
cm.MapMember(c => c.Color).SetIgnoreIfNull(true);
cm.MapMember(c => c.BackgroundColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShowIcon).SetIgnoreIfNull(true);
cm.MapMember(c => c.FlexBasis).SetIgnoreIfNull(true);
cm.MapMember(c => c.FlexDirection).SetIgnoreIfNull(true);
cm.MapMember(c => c.Grow).SetIgnoreIfNull(true);
cm.MapMember(c => c.Shrink).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShowTitle).SetIgnoreIfNull(true);
cm.MapMember(c => c.DialogConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.IsStatic).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(IconValueList)))
BsonClassMap.RegisterClassMap<IconValueList>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.MinValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.MaxValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.Width).SetIgnoreIfNull(true);
cm.MapMember(c => c.Height).SetIgnoreIfNull(true);
cm.MapMember(c => c.IconList).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(DialogConfig)))
BsonClassMap.RegisterClassMap<DialogConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.IsDraggable).SetDefaultValue(false);
cm.MapMember(c => c.MedicalConfig).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(MedicalConfig)))
BsonClassMap.RegisterClassMap<MedicalConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.HasFinalizeTime).SetDefaultValue(true);
cm.MapMember(c => c.HasStartTime).SetDefaultValue(true);
});
}
}
@@ -0,0 +1,334 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class ColorConfigMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig)))
BsonClassMap.RegisterClassMap<ColorConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Level).SetDefaultValue(new ColorConfig.LevelColors
{
Level1 = "#FFFFFF",
Level2 = "#FAFF41",
Level3 = "#F5A623",
Level4 = "#C2510F",
Level5 = "#FF5D6A"
}).SetIgnoreIfNull(true);
cm.MapMember(c => c.Text).SetDefaultValue(new ColorConfig.TextColors
{
Normal = "#FFFFFF",
Warning = "#FFAD26",
Alert = "#FF5D6A",
Improve = "#60D61D",
Expired = "#333333"
}).SetIgnoreIfNull(true);
cm.MapMember(c => c.Arrow).SetDefaultValue(new ColorConfig.ArrowColors
{
Normal = "#FFFFFF",
Warning = "#F5A623",
Alert = "#FF5D6A",
Improve = "#60D61D"
}).SetIgnoreIfNull(true);
cm.MapMember(c => c.Indicator).SetDefaultValue(new ColorConfig.IndicatorColors
{
Empty = "#CCCCCC",
Warning = "#FFAD26",
Normal = "#60D61D",
Alert = "#FF5D6A",
Background = "#000000",
EmptyBackground = "#CCCCCC"
}).SetIgnoreIfNull(true);
cm.MapMember(c => c.Graph).SetDefaultValue(new ColorConfig.GraphColors
{
Alert = "#FF5D6A",
Warning = "#FFAD26",
Normal = "#60D61D"
}).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxNumber).SetDefaultValue(new ColorConfig.StatusBoxNumberColors
{
Reserved =
new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" },
InUse = new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" },
Available = new ColorConfig.AppearanceSettings
{ BackgroundColor = "#FFF84C", TextColor = "#000000" },
Locked = new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" },
Transferable = new ColorConfig.AppearanceSettings
{ BackgroundColor = "#FFF84C", TextColor = "#000000" },
Exitus = new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" },
Altable = new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" }
}).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxStatusColor).SetDefaultValue(new ColorConfig.StatusBoxNumberColors
{
Reserved =
new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" },
InUse = new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" },
Available = new ColorConfig.AppearanceSettings
{ BackgroundColor = "#FFF84C", TextColor = "#000000" },
Locked = new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" },
Transferable = new ColorConfig.AppearanceSettings
{ BackgroundColor = "#FFF84C", TextColor = "#000000" },
Exitus = new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" },
Altable = new ColorConfig.AppearanceSettings { BackgroundColor = "#FFF84C", TextColor = "#000000" }
}).SetIgnoreIfNull(true);
cm.MapMember(c => c.Therapy).SetDefaultValue(new ColorConfig.TherapyColors
{
Default = new ColorConfig.AppearanceSettings(),
Finished = new ColorConfig.AppearanceSettings(),
Initialized = new ColorConfig.AppearanceSettings(),
InProgress = new ColorConfig.AppearanceSettings()
}).SetIgnoreIfNull(true);
cm.MapMember(c => c.Test).SetDefaultValue(new ColorConfig.TestColors
{
Default = new ColorConfig.AppearanceSettings
{
BackgroundColor = "#00A4E1",
TextColor = "#FFF"
},
Finished = new ColorConfig.AppearanceSettings
{
BackgroundColor = "#00C49B",
TextColor = "#FFF",
Icon = "assets/icon/light-theme/ic-tick.svg",
IconDefault = "icTick"
},
Initialized = new ColorConfig.AppearanceSettings
{
BackgroundColor = "#ED4965",
TextColor = "#FFF"
},
Expired = new ColorConfig.AppearanceSettings
{
BackgroundColor = "#ED4965",
TextColor = "#FFF",
Icon = "assets/icon/light-theme/ic-clock.svg",
IconDefault = "icClock"
}
}).SetIgnoreIfNull(true);
cm.MapMember(c => c.Procedure).SetDefaultValue(new ColorConfig.ProcedureColors
{
Default = new ColorConfig.AppearanceSettings
{
BackgroundColor = "#00A4E1",
TextColor = "#FFF"
},
Finished = new ColorConfig.AppearanceSettings
{
BackgroundColor = "#00C49B",
TextColor = "#FFF",
Icon = "assets/icon/light-theme/ic-tick.svg",
IconDefault = "icTick"
},
Initialized = new ColorConfig.AppearanceSettings
{
BackgroundColor = "#ED4965",
TextColor = "#FFF"
},
Expired = new ColorConfig.AppearanceSettings
{
BackgroundColor = "#ED4965",
TextColor = "#FFF",
Icon = "assets/icon/light-theme/ic-clock.svg",
IconDefault = "icClock"
}
}).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.StatusBoxNumberColors)))
BsonClassMap.RegisterClassMap<ColorConfig.StatusBoxNumberColors>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Reserved).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#FFF84C",
TextColor = "#000000"
});
cm.MapMember(c => c.InUse).SetDefaultValue(new ColorConfig.AppearanceSettings());
cm.MapMember(c => c.Available).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#57B812",
TextColor = "#000000"
});
cm.MapMember(c => c.Locked).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#ED4965",
TextColor = "#000000"
});
cm.MapMember(c => c.Transferable).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#57B812",
TextColor = "#000000"
});
cm.MapMember(c => c.Exitus).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#24BFF9",
TextColor = "#000000"
});
cm.MapMember(c => c.Altable).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#24BFF9",
TextColor = "#000000"
});
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.TherapyColors)))
BsonClassMap.RegisterClassMap<ColorConfig.TherapyColors>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Default).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#00A4E1",
TextColor = "#FFF",
IconInvertColor = 1
});
cm.MapMember(c => c.Initialized).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#FFF",
TextColor = "#000"
});
cm.MapMember(c => c.Finished).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#FFF",
TextColor = "#000",
Icon = "assets/icon/light-theme/ic-tick.svg",
IconDefault = "icTick"
});
cm.MapMember(c => c.InProgress).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#FFF",
TextColor = "#000"
});
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.AppearanceSettings)))
BsonClassMap.RegisterClassMap<ColorConfig.AppearanceSettings>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.TextColor).SetDefaultValue("#000000");
cm.MapMember(c => c.BackgroundColor).SetDefaultValue("#FFFFFF");
cm.MapMember(c => c.Icon).SetIgnoreIfNull(true);
cm.MapMember(c => c.IconDefault).SetIgnoreIfNull(true);
cm.MapMember(c => c.IconColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.IconCategory).SetIgnoreIfNull(true);
cm.MapMember(c => c.IconInvertColor).SetDefaultValue(0.0);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.TestColors)))
BsonClassMap.RegisterClassMap<ColorConfig.TestColors>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Default).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#00A4E1",
TextColor = "#FFF"
});
cm.MapMember(c => c.Initialized).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#ED4965",
TextColor = "#FFF"
});
cm.MapMember(c => c.Finished).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#00C49B",
TextColor = "#FFF",
Icon = "assets/icon/light-theme/ic-tick.svg",
IconDefault = "icTick"
});
cm.MapMember(c => c.Expired).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#ED4965",
TextColor = "#FFF",
Icon = "assets/icon/light-theme/ic-clock.svg",
IconDefault = "icClock"
});
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.ProcedureColors)))
BsonClassMap.RegisterClassMap<ColorConfig.ProcedureColors>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Default).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#00A4E1",
TextColor = "#FFF"
});
cm.MapMember(c => c.Initialized).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#ED4965",
TextColor = "#FFF"
});
cm.MapMember(c => c.Finished).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#00C49B",
TextColor = "#FFF",
Icon = "assets/icon/light-theme/ic-tick.svg",
IconDefault = "icTick"
});
cm.MapMember(c => c.Expired).SetDefaultValue(new ColorConfig.AppearanceSettings
{
BackgroundColor = "#ED4965",
TextColor = "#FFF",
Icon = "assets/icon/light-theme/ic-clock.svg",
IconDefault = "icClock"
});
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.LevelColors)))
BsonClassMap.RegisterClassMap<ColorConfig.LevelColors>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Level1).SetDefaultValue("#FFFFFF");
cm.MapMember(c => c.Level2).SetDefaultValue("#FAFF41");
cm.MapMember(c => c.Level3).SetDefaultValue("#F5A623");
cm.MapMember(c => c.Level4).SetDefaultValue("#C2510F");
cm.MapMember(c => c.Level5).SetDefaultValue("#FF5D6A");
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.TextColors)))
BsonClassMap.RegisterClassMap<ColorConfig.TextColors>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Normal).SetDefaultValue("#FFFFFF");
cm.MapMember(c => c.Warning).SetDefaultValue("#FFAD26");
cm.MapMember(c => c.Alert).SetDefaultValue("#FF5D6A");
cm.MapMember(c => c.Improve).SetDefaultValue("#60D61D");
cm.MapMember(c => c.Expired).SetDefaultValue("#333333");
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.ArrowColors)))
BsonClassMap.RegisterClassMap<ColorConfig.ArrowColors>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Normal).SetDefaultValue("#FFFFFF");
cm.MapMember(c => c.Warning).SetDefaultValue("#F5A623");
cm.MapMember(c => c.Alert).SetDefaultValue("#FF5D6A");
cm.MapMember(c => c.Improve).SetDefaultValue("#60D61D");
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.IndicatorColors)))
BsonClassMap.RegisterClassMap<ColorConfig.IndicatorColors>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Empty).SetDefaultValue("#CCCCCC");
cm.MapMember(c => c.Warning).SetDefaultValue("#FFAD26");
cm.MapMember(c => c.Normal).SetDefaultValue("#60D61D");
cm.MapMember(c => c.Alert).SetDefaultValue("#FF5D6A");
cm.MapMember(c => c.Background).SetDefaultValue("#000000");
cm.MapMember(c => c.EmptyBackground).SetDefaultValue("#CCCCCC");
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig.GraphColors)))
BsonClassMap.RegisterClassMap<ColorConfig.GraphColors>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Normal).SetDefaultValue("#60D61D");
cm.MapMember(c => c.Warning).SetDefaultValue("#FFAD26");
cm.MapMember(c => c.Alert).SetDefaultValue("#FF5D6A");
});
}
}
@@ -0,0 +1,40 @@
using adas_core.Domain.Models;
using adas_core.Domain.Models.Recording;
using adas_core.Domain.Models.SignalR;
using adas_core.Domain.Models.SystemAlerts;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class ComunicationFlowMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Message)))
BsonClassMap.RegisterClassMap<Message>(cm =>
{
cm.AutoMap();
cm.UnmapMember(c => c.Operation);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Queue)))
BsonClassMap.RegisterClassMap<Queue>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(ApiRequest)))
BsonClassMap.RegisterClassMap<ApiRequest>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(AdmPanelRequest)))
BsonClassMap.RegisterClassMap<AdmPanelRequest>(cm =>
{
cm.AutoMap();
cm.GetMemberMap(c => c.ObsertationData).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ApiClients)))
BsonClassMap.RegisterClassMap<ApiClients>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(VideoDto)))
BsonClassMap.RegisterClassMap<VideoDto>(cm => { cm.AutoMap(); });
}
}
@@ -0,0 +1,81 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Utils;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class DeviceMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(DeviceActionType)))
{
BsonClassMap.RegisterClassMap<DeviceActionType>(cm => cm.AutoMap() );
}
if (!BsonClassMap.IsClassMapRegistered(typeof(DeviceAction)))
{
BsonClassMap.RegisterClassMap<DeviceAction>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type)
.SetDefaultValue(DeviceActionType.Unknown)
.SetSerializer(new EnumSerializer<DeviceActionType>(BsonType.String));
cm.MapMember(c => c.ConfigObservationId).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmName).SetIgnoreIfNull(true);
cm.MapMember(c => c.ValueOnSingleClick)
.SetDefaultValue(new object())
.SetSerializer(new ComplexObjectValueTypeSerializer());
cm.MapMember(c => c.ValueOnDoubleClick)
.SetDefaultValue(new object())
.SetSerializer(new ComplexObjectValueTypeSerializer());
cm.MapMember(c => c.ValueOnHoldClick)
.SetDefaultValue(new object())
.SetSerializer(new ComplexObjectValueTypeSerializer());
}
);
}
if (!BsonClassMap.IsClassMapRegistered(typeof(DeviceSettings)))
{
BsonClassMap.RegisterClassMap<DeviceSettings>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Action).SetDefaultValue(new DeviceAction());
}
);
}
if (!BsonClassMap.IsClassMapRegistered(typeof(Device)))
{
BsonClassMap.RegisterClassMap<Device>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.DeviceType)
.SetDefaultValue(DeviceType.Unknown)
.SetSerializer(new EnumSerializer<DeviceType>(BsonType.String));
cm.MapMember(c => c.Uuid).SetIgnoreIfNull(true);
cm.MapMember(c => c.MacAddr).SetIgnoreIfNull(true);
cm.MapMember(c => c.CreatedAt).SetDefaultValue(DateTime.UtcNow);
cm.MapMember(c => c.UpdatedAt).SetDefaultValue(DateTime.UtcNow);
cm.MapMember(c => c.Key).SetIgnoreIfNull(true);
cm.MapMember(c => c.Color).SetIgnoreIfNull(true);
cm.MapMember(c => c.Battery).SetIgnoreIfNull(true);
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.SerialNumber).SetIgnoreIfNull(true);
cm.MapMember(c => c.PointOfCareIds).SetDefaultValue(new List<ObjectId>());
cm.MapMember(c => c.Connected).SetDefaultValue(false).SetIgnoreIfNull(true);
cm.MapMember(c => c.Ready).SetDefaultValue(false).SetIgnoreIfNull(true);
cm.MapMember(c => c.DeviceType)
.SetSerializer(new EnumSerializer<DeviceType>(BsonType.String));
cm.MapMember(c => c.Settings).SetDefaultValue(new DeviceSettings());
}
);
}
}
}
@@ -0,0 +1,46 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class DisplayHomeConfigContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(CardConfig)))
BsonClassMap.RegisterClassMap<CardConfig>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.Rows).SetDefaultValue(new List<RowCardConfig>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(RowCardConfig)))
BsonClassMap.RegisterClassMap<RowCardConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Cells).SetDefaultValue(new List<Cell>());
cm.MapMember(c => c.GrowPriority).SetDefaultValue(1);
cm.MapMember(c => c.Border).SetIgnoreIfNull(true);
cm.MapMember(c => c.BorderRadius).SetIgnoreIfNull(true);
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
cm.MapMember(c => c.Size).SetIgnoreIfNull(true);
cm.MapMember(c => c.MarginTop).SetIgnoreIfNull(true);
cm.MapMember(c => c.MarginBottom).SetIgnoreIfNull(true);
cm.MapMember(c => c.MarginLeft).SetIgnoreIfNull(true);
cm.MapMember(c => c.MarginRight).SetIgnoreIfNull(true);
cm.MapMember(c => c.BgColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingTop).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingBottom).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingLeft).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingRight).SetIgnoreIfNull(true);
cm.MapMember(c => c.Type)
.SetDefaultValue(DisplayConfigEnums.CellType.Default)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.CellType>(BsonType.String));
});
}
}
@@ -0,0 +1,134 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.GroupedObservations;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class DisplayMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Display)))
BsonClassMap.RegisterClassMap<Display>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.UnmapProperty(c => c.Unit);
cm.UnmapProperty(c => c.PointOfCares);
cm.UnmapProperty(c => c.DisplayConfig);
cm.MapMember(c => c.Type)
.SetDefaultValue(DisplayConfigEnums.DisplayType.Unknown)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.DisplayType>(BsonType.String));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(DisplayNurse)))
BsonClassMap.RegisterClassMap<DisplayNurse>(cm =>
{
cm.AutoMap();
});
if (!BsonClassMap.IsClassMapRegistered(typeof(StandarDisplay)))
BsonClassMap.RegisterClassMap<StandarDisplay>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.SectionConfig).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(SmartDisplay)))
BsonClassMap.RegisterClassMap<SmartDisplay>(cm =>
{
cm.AutoMap();
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PumpDisplay)))
BsonClassMap.RegisterClassMap<PumpDisplay>(cm =>
{
cm.AutoMap();
});
if (!BsonClassMap.IsClassMapRegistered(typeof(DisplayConfig)))
{
BsonClassMap.RegisterClassMap<DisplayConfig>(cm =>
{
cm.AutoMap();
cm.AddKnownType(typeof(DisplayNurse));
cm.AddKnownType(typeof(StandarDisplay));
cm.AddKnownType(typeof(SmartDisplay));
cm.AddKnownType(typeof(PumpDisplay));
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.Type)
.SetDefaultValue(DisplayConfigEnums.DisplayType.Unknown)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.DisplayType>(BsonType.String));
cm.MapMember(c => c.MediaFolder).SetIgnoreIfNull(true);
cm.MapMember(c => c.CardConfigId).SetIgnoreIfNull(true);
cm.MapMember(c => c.CardConfig)
.SetIgnoreIfNull(true)
.SetIsRequired(false);
cm.MapMember(c => c.DetailConfigId).SetIgnoreIfNull(true);
cm.MapMember(c => c.DetailConfig)
.SetIgnoreIfNull(true)
.SetIsRequired(false);
cm.MapMember(c => c.HomeBanner).SetIgnoreIfNull(true);
cm.MapMember(c => c.FormConfig)
.SetDefaultValue(new FormConfig
{
Admission = new FormItemOverview { Nhc = true },
Demographic = new FormItemOverview { Nhc = true },
Discharge = new FormItemOverview { Nhc = true },
IncomeInfo = new FormItemOverview { Nhc = true }
});
cm.MapMember(c => c.HasCameras).SetIgnoreIfNull(true);
cm.MapMember(c => c.HasSound).SetIgnoreIfNull(true);
cm.MapMember(c => c.IsRotationEnabled).SetIgnoreIfNull(true);
cm.MapMember(c => c.CanChangeCameraMode).SetIgnoreIfNull(true);
cm.MapMember(c => c.CamerasAreActive).SetIgnoreIfNull(true);
cm.MapMember(c => c.CameraStreamType).SetIgnoreIfNull(true);
cm.MapMember(c => c.SensorList).SetIgnoreIfNull(true);
cm.MapMember(c => c.ObservationForIndicator).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmFieldList).SetIgnoreIfNull(true);
cm.MapMember(c => c.RequestGroupedFieldList).SetIgnoreIfNull(true);
cm.MapMember(c => c.Pumps).SetIgnoreIfNull(true);
cm.MapMember(c => c.ChartConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.GraphLayout).SetIgnoreIfNull(true);
cm.MapMember(c => c.CardRotatingLayout).SetIgnoreIfNull(true);
cm.MapMember(c => c.ChartConfigIdList).SetIgnoreIfNull(true);
cm.MapMember(c => c.HomeConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.HeaderConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.DisplaySectionIdList).SetDefaultValue(new List<ObjectId>());
cm.MapMember(c => c.Hospital).SetIgnoreIfNull(true);
cm.MapMember(c => c.ColorConfig).SetDefaultValue(new ColorConfig());
cm.MapMember(c => c.FieldList).SetDefaultValue(new List<Field>());
cm.MapMember(c => c.GroupedFieldList).SetDefaultValue(new List<GroupedField>());
cm.UnmapProperty(c => c.DisplaySectionList);
// cm.UnmapProperty(c => c.CardConfig);
});
BsonClassMap.RegisterClassMap<GroupedField>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Names).SetIgnoreIfNull(true);
cm.MapMember(c => c.Group).SetIgnoreIfNull(true);
cm.MapMember(c => c.StartTimeShift).SetIgnoreIfNull(true);
cm.MapMember(c => c.Max);
cm.MapMember(c => c.Regularity)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<GroupedObservationEnum.Regularity>(
new EnumSerializer<GroupedObservationEnum.Regularity>(BsonType.String)));
cm.MapMember(c => c.Since)
.SetDefaultValue(GroupedObservationEnum.Since.Last)
.SetSerializer(new EnumSerializer<GroupedObservationEnum.Since>(BsonType.String));
cm.MapMember(c => c.Result)
.SetIgnoreIfNull(true);
//.SetSerializer(new EnumSerializer<GroupedObservationEnum.Result>(BsonType.Array));
cm.MapMember(c => c.LabelList).SetIgnoreIfNull(true);
});
}
}
}
@@ -0,0 +1,49 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class FormMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(FormConfig)))
BsonClassMap.RegisterClassMap<FormConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Admission).SetDefaultValue(new FormItemOverview());
cm.MapMember(c => c.Demographic).SetIgnoreIfNull(true);
cm.MapMember(c => c.Discharge).SetIgnoreIfNull(true);
cm.MapMember(c => c.IncomeInfo).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(FormItemOverview)))
BsonClassMap.RegisterClassMap<FormItemOverview>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Nhc).SetDefaultValue(true);
cm.MapMember(c => c.Bed).SetIgnoreIfNull(true);
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.LastName).SetIgnoreIfNull(true);
cm.MapMember(c => c.SecondName).SetIgnoreIfNull(true);
cm.MapMember(c => c.Genre).SetIgnoreIfNull(true);
cm.MapMember(c => c.Birthday).SetIgnoreIfNull(true);
cm.MapMember(c => c.Origin).SetIgnoreIfNull(true);
cm.MapMember(c => c.OriginAux).SetIgnoreIfNull(true);
cm.MapMember(c => c.Diagnostic).SetIgnoreIfNull(true);
cm.MapMember(c => c.DiagnosticAux).SetIgnoreIfNull(true);
cm.MapMember(c => c.Allergy).SetIgnoreIfNull(true);
cm.MapMember(c => c.Language).SetIgnoreIfNull(true);
cm.MapMember(c => c.Insulation).SetIgnoreIfNull(true);
cm.MapMember(c => c.Service).SetIgnoreIfNull(true);
cm.MapMember(c => c.Destination).SetIgnoreIfNull(true);
cm.MapMember(c => c.DestinationAux).SetIgnoreIfNull(true);
cm.MapMember(c => c.AdmDischarge).SetIgnoreIfNull(true);
cm.MapMember(c => c.NurseDischarge).SetIgnoreIfNull(true);
cm.MapMember(c => c.MedicalDischarge).SetIgnoreIfNull(true);
cm.MapMember(c => c.IncomingDate).SetIgnoreIfNull(true);
cm.MapMember(c => c.UciDays).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,265 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class GraphMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(GraphLayout)))
BsonClassMap.RegisterClassMap<GraphLayout>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Layout).SetIgnoreIfNull(true);
cm.MapMember(c => c.ObservationTitle).SetIgnoreIfNull(true);
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.GraphConf).SetIgnoreIfNull(true);
cm.MapMember(c => c.ObservationName).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ChartSettings)))
BsonClassMap.RegisterClassMap<ChartSettings>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.LegendLayoutConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.LegendGrowPriority).SetIgnoreIfNull(true);
cm.MapMember(c => c.ChartGrowPriority).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ChartConfig)))
{
BsonClassMap.RegisterClassMap<ChartConfig>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.BaseConfig).SetDefaultValue(new ChartBaseConfig());
cm.MapMember(c => c.AxesConfig).SetDefaultValue(new List<AxisConfig>());
cm.MapMember(c => c.SeriesConfig).SetDefaultValue(new List<SeriesConfigBase>());
});
BsonClassMap.RegisterClassMap<ChartBaseConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Title).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Top).SetDefaultValue("7%");
cm.MapMember(c => c.Right).SetDefaultValue("7%");
cm.MapMember(c => c.Bottom).SetDefaultValue("7%");
cm.MapMember(c => c.Left).SetDefaultValue("7%");
cm.MapMember(c => c.Group).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Name).SetDefaultValue(string.Empty);
cm.MapMember(c => c.BorderWidth).SetDefaultValue(1);
cm.MapMember(c => c.BorderColor).SetDefaultValue(string.Empty);
cm.MapMember(c => c.ShowLegend).SetDefaultValue(false);
cm.MapMember(c => c.ShowGrid).SetDefaultValue(false);
cm.MapMember(c => c.NumValues).SetIgnoreIfNull(true);
cm.MapMember(c => c.BaselineOffset).SetIgnoreIfNull(true);
});
BsonClassMap.RegisterClassMap<AxisConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(a => a.Type)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.AxisType>(BsonType.String))
.SetDefaultValue(DisplayConfigEnums.AxisType.Value);
cm.MapMember(a => a.KeyName).SetIgnoreIfNull(true);
cm.MapMember(a => a.Position)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.AxisPosition>(BsonType.String))
.SetDefaultValue(DisplayConfigEnums.AxisPosition.Left);
cm.MapMember(a => a.Min).SetIgnoreIfNull(true);
cm.MapMember(a => a.Max).SetIgnoreIfNull(true);
cm.MapMember(a => a.AxisLine).SetIgnoreIfNull(true);
cm.MapMember(a => a.AxisTick).SetIgnoreIfNull(true);
cm.MapMember(a => a.AxisLabel).SetIgnoreIfNull(true);
cm.MapMember(a => a.Silent).SetDefaultValue(true);
cm.MapMember(a => a.LabelFormat)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.LabelFormat>(BsonType.String))
.SetDefaultValue(DisplayConfigEnums.LabelFormat.Hour);
cm.MapMember(a => a.Offset).SetDefaultValue(0.0);
cm.MapMember(a => a.CustomLabels).SetDefaultValue(new List<string>());
cm.MapMember(a => a.SortLabels).SetDefaultValue(false);
cm.MapMember(a => a.Show).SetDefaultValue(true);
cm.MapMember(a => a.Regularity)
.SetSerializer(new EnumSerializer<GroupedObservationEnum.Regularity>(BsonType.String))
.SetDefaultValue(GroupedObservationEnum.Regularity.Hour);
});
BsonClassMap.RegisterClassMap<AxisTick>(cm =>
{
cm.AutoMap();
cm.MapMember(a => a.Show).SetIgnoreIfNull(true);
cm.MapMember(a => a.Interval).SetIgnoreIfNull(true);
cm.MapMember(a => a.Length).SetIgnoreIfNull(true);
});
BsonClassMap.RegisterClassMap<AxisLabel>(cm =>
{
cm.AutoMap();
cm.MapMember(a => a.Show).SetIgnoreIfNull(true);
cm.MapMember(a => a.Color).SetIgnoreIfNull(true);
cm.MapMember(a => a.Margin).SetIgnoreIfNull(true);
cm.MapMember(a => a.FontSize).SetIgnoreIfNull(true);
cm.MapMember(a => a.Silent).SetIgnoreIfNull(true);
});
BsonClassMap.RegisterClassMap<AxisLineStyle>(cm =>
{
cm.AutoMap();
cm.MapMember(a => a.Color).SetIgnoreIfNull(true);
});
BsonClassMap.RegisterClassMap<AxisLine>(cm =>
{
cm.AutoMap();
cm.MapMember(a => a.Show).SetIgnoreIfNull(true);
cm.MapMember(a => a.LineStyle).SetIgnoreIfNull(true);
});
BsonClassMap.RegisterClassMap<SeriesConfigBase>(cm =>
{
cm.AutoMap();
// cm.SetIsRootClass(true);
// cm.AddKnownType(typeof(CandlestickSeriesConfig));
cm.MapMember(s => s.Key).SetElementName("key");
cm.MapMember(s => s.Color).SetElementName("color");
cm.MapMember(s => s.Type)
.SetDefaultValue(DisplayConfigEnums.SeriesType.Line)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.SeriesType>(BsonType.String));
cm.MapMember(s => s.SourceType)
.SetDefaultValue(DisplayConfigEnums.SourceType.Obs)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.SourceType>(BsonType.String));
cm.MapMember(s => s.AxesNames)
.SetDefaultValue(new List<string>());
cm.MapMember(s => s.ShowSymbol).SetDefaultValue(false);
cm.MapMember(s => s.ShowColorOnLegend).SetDefaultValue(false);
cm.MapMember(s => s.ShowOnLegend).SetDefaultValue(true);
cm.MapMember(s => s.Values)
.SetDefaultValue(GroupedObservationEnum.Result.Last)
.SetSerializer(new EnumSerializer<GroupedObservationEnum.Result>(BsonType.String));
cm.MapMember(s => s.MarkerIcon)
.SetDefaultValue(DisplayConfigEnums.MarkerIcon.None)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.MarkerIcon>(BsonType.String));
cm.MapMember(s => s.VisualMap).SetIgnoreIfNull(true);
cm.MapMember(l => l.LineWidth).SetDefaultValue(2);
cm.MapMember(l => l.LineStyle).SetDefaultValue("solid");
cm.MapMember(v => v.Marker)
.SetDefaultValue(DisplayConfigEnums.MarkerIcon.Kangaroo)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.MarkerIcon>(BsonType.String));
cm.MapMember(a => a.AboveBaselineColor).SetIgnoreIfDefault(true);
cm.MapMember(a => a.BelowBaselineColor).SetIgnoreIfDefault(true);
cm.MapMember(a => a.CandleKeyList).SetIgnoreIfDefault(true);
cm.MapMember(p => p.LineType).SetIgnoreIfNull(true);
});
// BsonClassMap.RegisterClassMap<LineSeriesConfig>(cm =>
// {
// cm.AutoMap();
// cm.MapMember(l => l.LineWidth).SetDefaultValue(2);
// cm.MapMember(l => l.LineStyle).SetDefaultValue("solid");
// });
// BsonClassMap.RegisterClassMap<VerticalMarkerSeriesConfig>(cm =>
// {
// cm.AutoMap();
// cm.MapMember(v => v.Marker)
// .SetDefaultValue(DisplayConfigEnums.MarkerIcon.Kangaroo)
// .SetSerializer(new EnumSerializer<DisplayConfigEnums.MarkerIcon>(BsonType.String));
// });
// BsonClassMap.RegisterClassMap<AreaSeriesConfig>(cm =>
// {
// cm.AutoMap();
// cm.MapMember(a => a.AboveBaselineColor).SetIgnoreIfDefault(true);
// cm.MapMember(a => a.BelowBaselineColor).SetIgnoreIfDefault(true);
// });
// BsonClassMap.RegisterClassMap<CandlestickSeriesConfig>(cm =>
// {
// cm.AutoMap();
// cm.MapMember(a => a.CandleKeyList).SetIgnoreIfDefault(true);
// });
// if (!BsonClassMap.IsClassMapRegistered(typeof(LineSeriesConfig)))
// {
// BsonClassMap.RegisterClassMap<LineSeriesConfig>(cm =>
// {
// cm.AutoMap();
// cm.MapMember(p => p.LineStyle).SetDefaultValue("solid");
// cm.MapMember(p => p.LineWidth).SetDefaultValue(2);
// cm.MapMember(p => p.LineType).SetIgnoreIfNull(true);
// });
// }
BsonClassMap.RegisterClassMap<Candle>(cm =>
{
cm.AutoMap();
cm.MapMember(a => a.Key).SetIgnoreIfDefault(true);
cm.MapMember(a => a.CandleValueType)
.SetSerializer(
new NullableSerializer<CandleValueType>(new EnumSerializer<CandleValueType>(BsonType.String)));
});
BsonClassMap.RegisterClassMap<VisualMap>(cm =>
{
cm.AutoMap();
cm.MapMember(v => v.Show).SetDefaultValue(false);
cm.MapMember(v => v.Dimension).SetDefaultValue(0);
cm.MapMember(v => v.SerieKey).SetIgnoreIfNull(true);
cm.MapMember(v => v.Pieces).SetDefaultValue(new List<Piece>());
});
}
if (!BsonClassMap.IsClassMapRegistered(typeof(LegendLayoutConfig)))
BsonClassMap.RegisterClassMap<LegendLayoutConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Rows).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(LegendLayoutRow)))
BsonClassMap.RegisterClassMap<LegendLayoutRow>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.GrowPriority).SetIgnoreIfNull(true);
cm.MapMember(c => c.Columns).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(LegendLayoutColumn)))
BsonClassMap.RegisterClassMap<LegendLayoutColumn>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Key).SetIgnoreIfNull(true);
cm.MapMember(c => c.GrowPriority).SetIgnoreIfNull(true);
cm.MapMember(c => c.Label).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(LegendLabel)))
BsonClassMap.RegisterClassMap<LegendLabel>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.ColorLabel).SetIgnoreIfNull(true);
cm.MapMember(c => c.ColorIcon).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShowSymbol).SetIgnoreIfNull(true);
cm.MapMember(c => c.IconType).SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<DisplayConfigEnums.ELegendIconType>(
new EnumSerializer<DisplayConfigEnums.ELegendIconType>(BsonType.String)));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Piece)))
BsonClassMap.RegisterClassMap<Piece>(cm =>
{
cm.AutoMap();
cm.MapMember(p => p.Opacity).SetIgnoreIfNull(true);
cm.MapMember(p => p.LineType)
.SetDefaultValue(DisplayConfigEnums.LineType.Solid)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.LineType>(BsonType.String));
cm.MapMember(p => p.Color).SetIgnoreIfNull(true);
cm.MapMember(p => p.Symbol).SetIgnoreIfNull(true);
cm.MapMember(p => p.SymbolSize).SetIgnoreIfNull(true);
cm.MapMember(p => p.Eq).SetIgnoreIfNull(true);
cm.MapMember(p => p.Neq).SetIgnoreIfNull(true);
cm.MapMember(p => p.Gt).SetIgnoreIfNull(true);
cm.MapMember(p => p.Lt).SetIgnoreIfNull(true);
cm.MapMember(p => p.Gte).SetIgnoreIfNull(true);
cm.MapMember(p => p.Lte).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,39 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class HeaderMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(HeaderConfig)))
BsonClassMap.RegisterClassMap<HeaderConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.PartnerLogo).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.CompanyLogo).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.CenterLogo).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.MeddisLogo).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.UnitName).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.Cameras).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.Sensors).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.Fullscreen).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.Sounds).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.Sidebar).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
cm.MapMember(c => c.CurrentDateTime).SetDefaultValue(new HeaderConfig.HeaderItem())
.SetIgnoreIfNull(true);
cm.MapMember(c => c.SectionTitle).SetDefaultValue(new HeaderConfig.HeaderItem()).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(HeaderConfig.HeaderItem)))
BsonClassMap.RegisterClassMap<HeaderConfig.HeaderItem>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.LogoUrl).SetDefaultValue(() => null)
.SetIgnoreIfNull(true);
cm.MapMember(c => c.IsVisible).SetDefaultValue(true);
});
}
}
@@ -0,0 +1,9 @@
namespace adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
/// <summary>
/// Interfaz para clases que contribuyen al registro de mapas de BSON.
/// </summary>
public interface IEntityMapContributor
{
void RegisterMaps();
}
@@ -0,0 +1,158 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.Masters;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class MasterListMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Element)))
BsonClassMap.RegisterClassMap<Element>(cm =>
{
cm.AutoMap();
cm.GetMemberMap(c => c.Title).SetDefaultValue(string.Empty);
cm.GetMemberMap(c => c.IsRequired).SetDefaultValue(false);
cm.GetMemberMap(c => c.IsList).SetDefaultValue(false);
cm.GetMemberMap(c => c.ListName).SetDefaultValue(string.Empty);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(OptionListDetails)))
BsonClassMap.RegisterClassMap<OptionListDetails>(cm =>
{
cm.AutoMap();
cm.GetMemberMap(c => c.OptionType).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Name).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.IconDefault).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.IconCategory).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.IconColor).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Color).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.BgColor).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Description).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(MasterList)))
BsonClassMap.RegisterClassMap<MasterList>(cm =>
{
cm.AutoMap();
cm.UnmapMember(c => c.ManualObservationName);
cm.UnmapMember(c => c.AutoObservationName);
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.GetMemberMap(c => c.DefaultLocale).SetIgnoreIfNull(true).SetSerializer(
new NullableSerializer<LocaleEnum>(new EnumSerializer<LocaleEnum>(BsonType.String))
);
cm.GetMemberMap(c => c.Name).SetDefaultValue(string.Empty);
cm.GetMemberMap(c => c.Description).SetDefaultValue(string.Empty);
cm.GetMemberMap(c => c.OptionListDetails).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.CanAddElement).SetDefaultValue(false);
cm.MapMember(c => c.ListType)
.SetSerializer(new EnumSerializer<MasterListType>(BsonType.String));
cm.MapMember(c => c.Options).SetDefaultValue(new List<OptionList>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(LocaleItem)))
BsonClassMap.RegisterClassMap<LocaleItem>(cm =>
{
cm.AutoMap();
cm.GetMemberMap(c => c.Name).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Locale)))
BsonClassMap.RegisterClassMap<Locale>(cm =>
{
cm.AutoMap();
cm.GetMemberMap(c => c.Es).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Pt).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Eng).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Ca).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Zh).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(OptionList)))
BsonClassMap.RegisterClassMap<OptionList>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id").SetSerializer(new NullableSerializer<ObjectId>(new ObjectIdSerializer(BsonType.ObjectId)));;
cm.GetMemberMap(c => c.OptionType).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Name).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.LocaleItems).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.IconDefault).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.IconCategory).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.IconColor).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Color).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.BgColor).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Description).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.InitDate).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.EndDate).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.IsDefault).SetIgnoreIfNull(true);
cm.SetDiscriminator(nameof(OptionList));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(AltableOptionList)))
BsonClassMap.RegisterClassMap<AltableOptionList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(VisitOptionList)))
BsonClassMap.RegisterClassMap<VisitOptionList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(AccessControlList)))
BsonClassMap.RegisterClassMap<AccessControlList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(MobilityOptionList)))
BsonClassMap.RegisterClassMap<MobilityOptionList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(TherapeuticCeilingList)))
BsonClassMap.RegisterClassMap<TherapeuticCeilingList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(PassiveSittingList)))
BsonClassMap.RegisterClassMap<PassiveSittingList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(GenericList)))
BsonClassMap.RegisterClassMap<GenericList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(ProcedureList)))
BsonClassMap.RegisterClassMap<ProcedureList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(TestList)))
BsonClassMap.RegisterClassMap<TestList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(DiagnosisList)))
BsonClassMap.RegisterClassMap<DiagnosisList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(OriginList)))
BsonClassMap.RegisterClassMap<OriginList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(DestinationList)))
BsonClassMap.RegisterClassMap<DestinationList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(InternalDestinationList)))
BsonClassMap.RegisterClassMap<InternalDestinationList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(TreatmentList)))
BsonClassMap.RegisterClassMap<TreatmentList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientStatusList)))
BsonClassMap.RegisterClassMap<PatientStatusList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(ServiceList)))
BsonClassMap.RegisterClassMap<ServiceList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(AllergyList)))
BsonClassMap.RegisterClassMap<AllergyList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(DoctorTypeList)))
BsonClassMap.RegisterClassMap<DoctorTypeList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(DoctorList)))
BsonClassMap.RegisterClassMap<DoctorList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(InsulationList)))
BsonClassMap.RegisterClassMap<InsulationList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(DischargeStatusList)))
BsonClassMap.RegisterClassMap<DischargeStatusList>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(LanguageBarrierList)))
BsonClassMap.RegisterClassMap<LanguageBarrierList>(cm => { cm.AutoMap(); });
}
}
@@ -0,0 +1,28 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class NoticeControlMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Notice)))
BsonClassMap.RegisterClassMap<Notice>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
});
if (!BsonClassMap.IsClassMapRegistered(typeof(StaffInfo)))
BsonClassMap.RegisterClassMap<StaffInfo>(cm => { cm.AutoMap(); });
if (!BsonClassMap.IsClassMapRegistered(typeof(MedicalStaffConfig)))
BsonClassMap.RegisterClassMap<MedicalStaffConfig>(cm =>
{
cm.MapMember(c => c.HasTeams).SetIgnoreIfNull(true);
cm.MapMember(c => c.StaffAmount).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,27 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class ObsUnitMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(ConfigUnits)))
BsonClassMap.RegisterClassMap<ConfigUnits>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id").SetDefaultValue(string.Empty);
cm.MapMember(c => c.Items).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ConfigUnitItem)))
BsonClassMap.RegisterClassMap<ConfigUnitItem>(cm =>
{
cm.AutoMap();
cm.GetMemberMap(c => c.Code).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Value).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,289 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models;
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Observations;
using adas_core.Domain.Utils;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using static adas_core.Domain.Models.GroupedObservation;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class ObservationMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(BasePatientObservation)))
BsonClassMap.RegisterClassMap<BasePatientObservation>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.PatientId).SetElementName("patientid");
cm.MapMember(c => c.UserId).SetIgnoreIfNull(true);
cm.MapMember(c => c.ClinicalEpisode).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.Patient);
cm.MapMember(c => c.SystemId).SetIgnoreIfNull(true);
cm.MapMember(c => c.Code).SetIgnoreIfNull(true);
cm.MapMember(c => c.CodingSystem).SetIgnoreIfNull(true);
cm.MapMember(c => c.ParentData).SetIgnoreIfNull(true);
cm.MapMember(c => c.Time);
cm.MapMember(c => c.EndTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Units).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.CheckObservations);
cm.UnmapMember(c => c.CreateObservation);
cm.MapMember(c => c.PatientId).SetElementName("patientid");
cm.MapMember(c => c.EndTime).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(BasePatientObservationValue)))
BsonClassMap.RegisterClassMap<BasePatientObservationValue>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Value)
.SetDefaultValue(new object())
.SetSerializer(new ComplexObjectValueTypeSerializer());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientObservation)))
BsonClassMap.RegisterClassMap<PatientObservation>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Max).SetIgnoreIfNull(true);
cm.MapMember(c => c.Min).SetIgnoreIfNull(true);
cm.MapMember(c => c.MaxWarn).SetIgnoreIfNull(true);
cm.MapMember(c => c.MinWarn).SetIgnoreIfNull(true);
cm.MapMember(c => c.WarnColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlertColor).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.ShowOnExpired);
cm.MapMember(c => c.InsertMode)
.SetDefaultValue(ObservationEnum.InsertMode.Auto)
.SetSerializer(new EnumSerializer<ObservationEnum.InsertMode>(BsonType.String));
cm.UnmapMember(c => c.Persist);
cm.MapMember(c => c.ColorOnExpired).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.MessageTime);
cm.MapMember(c => c.Result).SetIgnoreIfNull(true);
cm.MapMember(c => c.Status)
.SetDefaultValue(StatusEnum.Type.Ok)
.SetSerializer(new EnumSerializer<StatusEnum.Type>(BsonType.String));
cm.UnmapMember(c => c.Level);
cm.UnmapMember(c => c.Expires);
cm.MapMember(c => c.Expired).SetDefaultValue(false);
cm.UnmapMember(c => c.UiConfiguration);
cm.UnmapMember(c => c.Alarm);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ParentDataClass)))
BsonClassMap.RegisterClassMap<ParentDataClass>(cm =>
{
cm.AutoMap();
cm.GetMemberMap(c => c.Code).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.CodingSystem).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Name).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ObservationData)))
BsonClassMap.RegisterClassMap<ObservationData>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.CodingSystem).SetIgnoreIfNull(true);
cm.MapMember(c => c.Code).SetIgnoreIfNull(true);
cm.MapMember(c => c.Text).SetIgnoreIfNull(true);
cm.MapMember(c => c.Time).SetIgnoreIfNull(true);
cm.MapMember(c => c.Value).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ObservationsRequest)))
BsonClassMap.RegisterClassMap<ObservationsRequest>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.PatientNumber).SetIgnoreIfNull(true);
cm.MapMember(c => c.ObservationNames).SetIgnoreIfNull(true);
cm.MapMember(c => c.StartTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.EndTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.PageNumber).SetDefaultValue(1);
cm.MapMember(c => c.PageSize).SetDefaultValue(10);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(DemoConfig)))
BsonClassMap.RegisterClassMap<DemoConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.ValueOption)
.SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ConfigObservation)))
BsonClassMap.RegisterClassMap<ConfigObservation>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.DemoConfig).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ConfigObservation)))
BsonClassMap.RegisterClassMap<ConfigObservation>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Code).SetIgnoreIfNull(true);
cm.MapMember(c => c.CodingSystem).SetIgnoreIfNull(true);
cm.MapMember(c => c.OriginalName).SetIgnoreIfNull(true);
cm.MapMember(c => c.ParentCode).SetIgnoreIfNull(true);
cm.MapMember(c => c.ParentCodingSystem).SetIgnoreIfNull(true);
cm.MapMember(c => c.ParentName).SetIgnoreIfNull(true);
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Units).SetIgnoreIfNull(true);
cm.MapMember(c => c.ArrowType)
.SetSerializer(new EnumSerializer<ObservationEnum.ArrowType>(BsonType.String))
.SetDefaultValue(ObservationEnum.ArrowType.Default);
cm.MapMember(c => c.ShowArrow).SetDefaultValue(true);
cm.MapMember(c => c.ShowValue).SetDefaultValue(true);
cm.MapMember(c => c.ForceUnits).SetDefaultValue(false);
cm.MapMember(c => c.MinAlert).SetIgnoreIfNull(true);
cm.MapMember(c => c.MaxAlert).SetIgnoreIfNull(true);
cm.MapMember(c => c.MaxWarn).SetIgnoreIfNull(true);
cm.MapMember(c => c.MinWarn).SetIgnoreIfNull(true);
cm.MapMember(c => c.WarnColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlertColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlertValues).SetIgnoreIfNull(true);
cm.MapMember(c => c.WarningValues).SetIgnoreIfNull(true);
cm.MapMember(c => c.ForceWarn).SetDefaultValue(false);
cm.MapMember(c => c.ForceAlert).SetDefaultValue(false);
cm.MapMember(c => c.Alert).SetIgnoreIfNull(true);
cm.MapMember(c => c.Expires).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShowOnExpired).SetIgnoreIfDefault(true);
cm.MapMember(c => c.Persist).SetIgnoreIfNull(true);
cm.MapMember(c => c.ColorOnExpired).SetIgnoreIfNull(true);
cm.MapMember(c => c.RetentionPolicy)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<RetentionPolicy>(new EnumSerializer<RetentionPolicy>(BsonType.String)));
cm.MapMember(c => c.RetentionPolicyValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.LevelCondition).SetIgnoreIfNull(true);
cm.MapMember(c => c.Grouped).SetIgnoreIfNull(true);
cm.MapMember(c => c.UiConfiguration).SetIgnoreIfNull(true);
cm.MapMember(c => c.Alarm).SetIgnoreIfNull(true);
cm.MapMember(c => c.Description).SetIgnoreIfNull(true);
cm.MapMember(c => c.RequiredValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.Preconditions).SetIgnoreIfNull(true);
cm.MapMember(c => c.CheckObservations).SetDefaultValue(false);
cm.MapMember(c => c.CreateObservation).SetIgnoreIfNull(true);
cm.MapMember(c => c.InsertMode)
.SetDefaultValue(ObservationEnum.InsertMode.Auto)
.SetSerializer(new EnumSerializer<ObservationEnum.InsertMode>(BsonType.String));
cm.MapMember(c => c.TimeFromMessageTime).SetIgnoreIfDefault(true);
cm.MapMember(c => c.ColorRanges).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ConfigObservation.ColorRange)))
BsonClassMap.RegisterClassMap<ConfigObservation.ColorRange>(cm =>
{
cm.AutoMap();
cm.MapMember(s => s.ValueType)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<ObservationEnum.ValueType>(
new EnumSerializer<ObservationEnum.ValueType>(BsonType.String)));
cm.MapMember(s => s.Min).SetIgnoreIfNull(true);
cm.MapMember(s => s.Max).SetIgnoreIfNull(true);
cm.MapMember(s => s.MatchText).SetIgnoreIfNull(true);
cm.MapMember(s => s.MatchBoolean).SetIgnoreIfNull(true);
cm.MapMember(s => s.MinDate).SetIgnoreIfNull(true);
cm.MapMember(s => s.MaxDate).SetIgnoreIfNull(true);
cm.MapMember(s => s.Color).SetIgnoreIfNull(true);
cm.MapMember(s => s.Label).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(GroupedObservation)))
BsonClassMap.RegisterClassMap<GroupedObservation>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.PatientId);
cm.MapMember(c => c.Name).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Group).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Observations).SetDefaultValue(new List<GroupedObservationObs>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(GroupedObservationObs)))
BsonClassMap.RegisterClassMap<GroupedObservationObs>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Name).SetDefaultValue(string.Empty);
cm.MapMember(c => c.First).SetIgnoreIfNull(true);
cm.MapMember(c => c.Last).SetIgnoreIfNull(true);
cm.MapMember(c => c.Min).SetIgnoreIfNull(true);
cm.MapMember(c => c.Max).SetIgnoreIfNull(true);
cm.MapMember(c => c.MinAlert).SetIgnoreIfNull(true);
cm.MapMember(c => c.MaxAlert).SetIgnoreIfNull(true);
cm.MapMember(c => c.Average).SetIgnoreIfNull(true);
cm.MapMember(c => c.Sum).SetIgnoreIfNull(true);
cm.MapMember(c => c.Count).SetIgnoreIfNull(true);
cm.MapMember(c => c.HalfHour).SetIgnoreIfNull(true);
cm.MapMember(c => c.LastFilled).SetIgnoreIfNull(true);
cm.MapMember(c => c.Time);
cm.MapMember(c => c.Shift).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShiftDate);
cm.MapMember(c => c.IsFilled);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(GroupedObservationObsValue)))
BsonClassMap.RegisterClassMap<GroupedObservationObsValue>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type)
.SetDefaultValue(StatusEnum.Type.Ok)
.SetSerializer(new EnumSerializer<StatusEnum.Type>(BsonType.String));
cm.MapMember(c => c.Value);
cm.MapMember(c => c.Time).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PredictMedicationObservation)))
BsonClassMap.RegisterClassMap<PredictMedicationObservation>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.MedicineText).SetDefaultValue(string.Empty);
cm.MapMember(c => c.DegreeSimilarity);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ObservationTextRule)))
BsonClassMap.RegisterClassMap<ObservationTextRule>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.ValueType)
.SetDefaultValue(ObservationEnum.ValueType.String)
.SetSerializer(new EnumSerializer<ObservationEnum.ValueType>(BsonType.String));
cm.MapMember(c => c.Value).SetIgnoreIfNull(true);
cm.MapMember(c => c.MatchText).SetIgnoreIfNull(true);
cm.MapMember(c => c.MatchBoolean).SetIgnoreIfNull(true);
cm.MapMember(c => c.MatchNumber).SetIgnoreIfNull(true);
cm.MapMember(c => c.MatchDate).SetIgnoreIfNull(true);
cm.MapMember(c => c.Label).SetIgnoreIfNull(true);
cm.MapMember(c => c.MinDate).SetIgnoreIfNull(true);
cm.MapMember(c => c.MaxDate).SetIgnoreIfNull(true);
cm.MapMember(c => c.MinNum).SetIgnoreIfNull(true);
cm.MapMember(c => c.MaxNum).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ConditionsConfig)))
BsonClassMap.RegisterClassMap<ConditionsConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Condition).SetIgnoreIfNull(true);
cm.MapMember(c => c.FieldCondition).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,245 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Options;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class PatientMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(HistoricalLocation)))
{
BsonClassMap.RegisterClassMap<HistoricalLocation>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.AdmTime);
cm.MapMember(c => c.PatientLocation);
});
}
if (!BsonClassMap.IsClassMapRegistered(typeof(Patient)))
BsonClassMap.RegisterClassMap<Patient>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.GetMemberMap(c => c.PatientNumber).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.PatientId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.AdmTime).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.DischargeStatus).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Altable).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Origin).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.OriginAux).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Diagnosis).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.DiagnosisAux).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Visits).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.AccessControl).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Insulation).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.PatientStatus).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Mobility).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.TherapeuticCeiling).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Procedures).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Tests).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Treatment).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Doctors).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Allergies).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.LanguageBarrier).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.PassiveSitting).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.DisTime).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Person).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.AttendingDoctor).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.LastObservationDate).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.CreationDate).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.UpdateDate).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.ArchiveDate).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.PointOfCareId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.UnitId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.HistoricalLocations).SetIgnoreIfNull(true);
// No mapear estos campos
cm.UnmapMember(c => c.Bed);
cm.UnmapMember(c => c.UnitString);
cm.UnmapMember(c => c.Room);
cm.UnmapMember(c => c.PointOfCare);
cm.UnmapMember(c => c.Location);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Person)))
{
BsonClassMap.RegisterClassMap<Person>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.LastName).SetIgnoreIfNull(true);
cm.MapMember(c => c.FirstName).SetIgnoreIfNull(true);
cm.MapMember(c => c.SecondName).SetIgnoreIfNull(true);
cm.MapMember(c => c.BirthDate).SetIgnoreIfNull(true);
cm.MapMember(c => c.Language).SetIgnoreIfNull(true);
cm.MapMember(c => c.Gender)
.SetDefaultValue(PatientEnum.Gender.Unknown)
.SetSerializer(new EnumSerializer<PatientEnum.Gender>(BsonType.String));
cm.MapMember(c => c.Ids).SetIgnoreIfNull(true);
cm.MapMember(c => c.HistoricalIds)
.SetIgnoreIfNull(true);
});
BsonClassMap.RegisterClassMap<HistoricalId>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Time).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientIds)
.SetSerializer(
new DictionaryInterfaceImplementerSerializer<Dictionary<string, string>, string, string>(
DictionaryRepresentation.Document))
.SetIgnoreIfNull(true);
});
}
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientLocation)))
BsonClassMap.RegisterClassMap<PatientLocation>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.UnitName).SetIgnoreIfNull(true);
cm.MapMember(c => c.Bed).SetIgnoreIfNull(true);
cm.MapMember(c => c.Room).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientLocationAction)))
BsonClassMap.RegisterClassMap<PatientLocationAction>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Location).SetIgnoreIfNull(true);
cm.MapMember(c => c.Action)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<ActionsEnum.ResourceAction>(
new EnumSerializer<ActionsEnum.ResourceAction>(BsonType.String)));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientIncomeData)))
BsonClassMap.RegisterClassMap<PatientIncomeData>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Diagnosis).SetIgnoreIfNull(true);
cm.MapMember(c => c.DiagnosisAux).SetIgnoreIfNull(true);
cm.MapMember(c => c.Origin).SetIgnoreIfNull(true);
cm.MapMember(c => c.OriginAux).SetIgnoreIfNull(true);
cm.MapMember(c => c.AdmTime).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientIcca)))
BsonClassMap.RegisterClassMap<PatientIcca>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Location).SetDefaultValue(new PatientLocation(string.Empty, string.Empty));
cm.MapMember(c => c.PatientNumber).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientId).SetIgnoreIfNull(true);
cm.MapMember(c => c.AdmitTime).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientAllergiesValue)))
BsonClassMap.RegisterClassMap<PatientAllergiesValue>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Notes).SetIgnoreIfNull(true);
cm.MapMember(c => c.Type).SetIgnoreIfNull(true);
cm.MapMember(c => c.Value).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientIntravenousLinesValue)))
BsonClassMap.RegisterClassMap<PatientIntravenousLinesValue>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type).SetIgnoreIfNull(true);
cm.MapMember(c => c.Duration).SetIgnoreIfNull(true);
cm.MapMember(c => c.Action).SetIgnoreIfNull(true);
cm.MapMember(c => c.Location).SetIgnoreIfNull(true);
cm.MapMember(c => c.InsertTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.RemoveTime).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientDiagnosis)))
BsonClassMap.RegisterClassMap<PatientDiagnosis>(cm =>
{
cm.AutoMap();
cm.SetIgnoreExtraElements(true);
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.PatientId);
cm.MapMember(c => c.Time);
cm.MapMember(c => c.UpdateDate).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.MessageTime);
cm.MapMember(c => c.CodingSystem).SetIgnoreIfNull(true);
cm.MapMember(c => c.Description).SetIgnoreIfNull(true);
cm.MapMember(c => c.Label).SetIgnoreIfNull(true);
cm.MapMember(c => c.Code).SetIgnoreIfNull(true);
cm.MapMember(c => c.State).SetIgnoreIfNull(true);
cm.MapMember(c => c.Category).SetIgnoreIfNull(true);
cm.MapMember(c => c.StartTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.EndTime).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.DiagnosisCode);
cm.UnmapMember(c => c.DiagnosisSystem);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientDrainagesValue)))
BsonClassMap.RegisterClassMap<PatientDrainagesValue>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type).SetIgnoreIfNull(true);
cm.MapMember(c => c.Location).SetIgnoreIfNull(true);
cm.MapMember(c => c.Volume).SetIgnoreIfNull(true);
cm.MapMember(c => c.Height).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientCarePlan)))
BsonClassMap.RegisterClassMap<PatientCarePlan>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.PatientId);
cm.MapMember(c => c.PointOfCareId).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientNumber).SetIgnoreIfNull(true);
cm.MapMember(c => c.UserId).SetIgnoreIfNull(true);
cm.MapMember(c => c.CarePlan).SetIgnoreIfNull(true);
cm.MapMember(c => c.Description).SetIgnoreIfNull(true);
cm.MapMember(c => c.Time).SetIgnoreIfNull(true);
cm.MapMember(c => c.Action)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<ActionsEnum.CrudAction>(
new EnumSerializer<ActionsEnum.CrudAction>(BsonType.String)));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Admission)))
BsonClassMap.RegisterClassMap<Admission>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.UnmapMember(c => c.PatientLocation);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Discharge)))
BsonClassMap.RegisterClassMap<Discharge>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.UnmapMember(c => c.Patient);
cm.UnmapMember(c => c.PatientLocation);
cm.MapMember(c => c.MedicalDischarge).SetIgnoreIfNull(true);
cm.MapMember(c => c.AdminDischarge).SetIgnoreIfNull(true);
cm.MapMember(c => c.NurseDischarge).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,96 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using LightBeacon = adas_core.Domain.Models.MongoModels.LightBeacon;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class PoCMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(PointOfCare)))
BsonClassMap.RegisterClassMap<PointOfCare>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.Room).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Bed).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Hall).SetIgnoreIfNull(true);
cm.MapMember(c => c.UnitId);
cm.MapMember(c => c.Configuration).SetIgnoreIfNull(true);
cm.MapMember(c => c.Status)
.SetSerializer(new EnumSerializer<StatusEnum.PointOfCare>(BsonType.String));
cm.MapMember(c => c.AdmissionId).SetIgnoreIfNull(true);
cm.MapMember(c => c.IsActive).SetIgnoreIfNull(true);
cm.MapMember(c => c.IsVisible).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.UnitName);
cm.UnmapMember(c => c.Unit);
cm.UnmapMember(c => c.Location);
cm.UnmapMember(c => c.Observations);
cm.UnmapMember(c => c.HasPatient);
cm.UnmapMember(c => c.Patientid);
cm.UnmapMember(c => c.Patient);
cm.UnmapMember(c => c.Admission);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PointOfCareConfiguration)))
BsonClassMap.RegisterClassMap<PointOfCareConfiguration>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.BeaconIdList)
.SetDefaultValue(new List<ObjectId>());
cm.MapMember(c => c.CameraIdList)
.SetDefaultValue(new List<ObjectId>());
cm.MapMember(c => c.RelayIdList).SetIgnoreIfNull(true);
cm.MapMember(c => c.Type).SetIgnoreIfNull(true);
cm.MapMember(c => c.Id).SetIgnoreIfNull(true);
cm.MapMember(c => c.BeaconList)
.SetIgnoreIfNull(true)
.SetIsRequired(false);
cm.MapMember(c => c.CameraList)
.SetIgnoreIfNull(true)
.SetIsRequired(false);
cm.MapMember(c => c.RelayList)
.SetIgnoreIfNull(true)
.SetIsRequired(false);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PoCMapping)))
BsonClassMap.RegisterClassMap<PoCMapping>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.PointOfCares).SetDefaultValue(new List<PoCMappingItem>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PoCMappingItem)))
BsonClassMap.RegisterClassMap<PoCMappingItem>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.NewPoC).SetElementName("new");
cm.MapMember(c => c.OriginalPoC).SetElementName("original");
cm.MapMember(c => c.Beds).SetDefaultValue(new List<List<string>>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PoCSettings)))
BsonClassMap.RegisterClassMap<PoCSettings>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.PatientLocation).SetIgnoreIfNull(true);
cm.MapMember(c => c.ManualRelayStatus)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<RelayEnum.Status>(
new EnumSerializer<RelayEnum.Status>(BsonType.String)));
});
}
}
@@ -0,0 +1,380 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Pumps;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps
{
public class PumpMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
// ============================================================
// CommonPumpTypes: PumpValue
// ============================================================
if (!BsonClassMap.IsClassMapRegistered(typeof(CommonPumpTypes.PumpValue)))
{
BsonClassMap.RegisterClassMap<CommonPumpTypes.PumpValue>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Value).SetIgnoreIfNull(true);
cm.MapMember(c => c.Units).SetIgnoreIfNull(true);
});
}
// ============================================================
// CommonPumpTypes: SyringeDetails
// ============================================================
if (!BsonClassMap.IsClassMapRegistered(typeof(CommonPumpTypes.SyringeDetails)))
{
BsonClassMap.RegisterClassMap<CommonPumpTypes.SyringeDetails>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Type).SetIgnoreIfNull(true);
cm.MapMember(c => c.Manufacturer).SetIgnoreIfNull(true);
cm.MapMember(c => c.Volume).SetIgnoreIfNull(true);
});
}
// ============================================================
// PatientPumpObservation (nuevo modelo simplificado)
// ============================================================
if (!BsonClassMap.IsClassMapRegistered(typeof(PumpObservation)))
{
BsonClassMap.RegisterClassMap<PumpObservation>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
// Identificadores
cm.MapMember(c => c.DeviceId).SetIgnoreIfNull(true);
cm.MapMember(c => c.RackId).SetIgnoreIfNull(true);
cm.MapMember(c => c.DeviceTypeMdc).SetIgnoreIfNull(true);
cm.MapMember(c => c.InfusionId).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientId).SetIgnoreIfNull(true).SetElementName("patientid");
//campos para Alaris
cm.MapMember(c => c.Pressure).SetIgnoreIfNull(true);
cm.MapMember(c => c.DiluentVolume).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientHeight).SetIgnoreIfNull(true);
cm.MapMember(c => c.BasalRate).SetIgnoreIfNull(true);
cm.MapMember(c => c.TotalAux).SetIgnoreIfNull(true);
cm.MapMember(c => c.GatewayNumber).SetIgnoreIfNull(true);
cm.MapMember(c => c.Number).SetIgnoreIfNull(true);
cm.MapMember(c => c.Total).SetIgnoreIfNull(true);
cm.MapMember(c => c.IsAux).SetIgnoreIfNull(true);
cm.MapMember(c => c.Code).SetIgnoreIfNull(true);
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.UiConfiguration);
cm.MapMember(c => c.AlarmMode)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.AlarmMode>(
new EnumSerializer<PumpEnum.AlarmMode>(BsonType.String)));
// Tiempo
cm.MapMember(c => c.Time).SetIgnoreIfNull(true);
cm.MapMember(c => c.MessageType)
.SetIgnoreIfNull(true)
.SetSerializer(new EnumSerializer<PumpEnum.PumpMessageType>(BsonType.String));
// Estado de infusión
cm.MapMember(c => c.IsInfusing).SetIgnoreIfNull(true);
cm.MapMember(c => c.InfusingStatus)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.InfusingStatus>(
new EnumSerializer<PumpEnum.InfusingStatus>(BsonType.String)));
cm.MapMember(c => c.Status)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.Status>(
new EnumSerializer<PumpEnum.Status>(BsonType.String)));
cm.MapMember(c => c.PumpMode)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.Mode>(
new EnumSerializer<PumpEnum.Mode>(BsonType.String)));
cm.MapMember(c => c.ActiveSourceInfo).SetIgnoreIfNull(true);
cm.MapMember(c => c.InfusionModeDetail).SetIgnoreIfNull(true);
cm.MapMember(c => c.NotDeliveringReason).SetIgnoreIfNull(true);
cm.MapMember(c => c.Source).SetIgnoreIfNull(true);
// Métricas
cm.MapMember(c => c.FlowFluid).SetIgnoreIfNull(true);
cm.MapMember(c => c.Rate).SetIgnoreIfNull(true);
cm.MapMember(c => c.VolumeInfused).SetIgnoreIfNull(true);
cm.MapMember(c => c.FluidDelivTotal).SetIgnoreIfNull(true);
cm.MapMember(c => c.FluidDelivTotalSet).SetIgnoreIfNull(true);
cm.MapMember(c => c.VolumeRemaining).SetIgnoreIfNull(true);
cm.MapMember(c => c.Vtbi).SetIgnoreIfNull(true);
cm.MapMember(c => c.TimeRemaining).SetIgnoreIfNull(true);
cm.MapMember(c => c.TimeProgrammed).SetIgnoreIfNull(true);
// Medicación
cm.MapMember(c => c.DrugName).SetIgnoreIfNull(true);
cm.MapMember(c => c.DrugId).SetIgnoreIfNull(true);
cm.MapMember(c => c.Concentration).SetIgnoreIfNull(true);
cm.MapMember(c => c.DoseRate).SetIgnoreIfNull(true);
cm.MapMember(c => c.DrugAmount).SetIgnoreIfNull(true);
cm.MapMember(c => c.DrugDoseDelivered).SetIgnoreIfNull(true);
// Paciente
cm.MapMember(c => c.PatientWeight).SetIgnoreIfNull(true);
cm.MapMember(c => c.Syringe).SetIgnoreIfNull(true);
// Ubicación
cm.MapMember(c => c.DeviceIp).SetIgnoreIfNull(true);
cm.MapMember(c => c.PillarAssembly).SetIgnoreIfNull(true);
cm.MapMember(c => c.PillarRackSlot).SetIgnoreIfNull(true);
// ALARMAS
cm.MapMember(c => c.AlarmType)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.AlarmType>(
new EnumSerializer<PumpEnum.AlarmType>(BsonType.String)));
cm.MapMember(c => c.AlarmDescription).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmState).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmInactivationState).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmPriority).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmTypeMdc).SetIgnoreIfNull(true);
cm.MapMember(c => c.EventPhase)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.EventPhase>(
new EnumSerializer<PumpEnum.EventPhase>(BsonType.String)));
cm.MapMember(c => c.AlertSourceMdc).SetIgnoreIfNull(true);
// EVENTOS (PCD-10)
cm.MapMember(c => c.Event)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.Event>(
new EnumSerializer<PumpEnum.Event>(BsonType.String)));
});
}
// ============================================================
// PumpState
// ============================================================
if (!BsonClassMap.IsClassMapRegistered(typeof(PumpState)))
{
BsonClassMap.RegisterClassMap<PumpState>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.DeviceId).SetIgnoreIfNull(true);
cm.MapMember(c => c.RackId).SetIgnoreIfNull(true);
cm.MapMember(c => c.DeviceTypeMdc).SetIgnoreIfNull(true);
cm.MapMember(c => c.DeviceIp).SetIgnoreIfNull(true);
cm.MapMember(c => c.PillarAssembly).SetIgnoreIfNull(true);
cm.MapMember(c => c.PillarRackSlot).SetIgnoreIfNull(true);
cm.MapMember(c => c.InfusionId).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientId).SetIgnoreIfNull(true);
cm.MapMember(c => c.LastUpdated).SetIgnoreIfNull(true);
// Estado
cm.MapMember(c => c.IsInfusing).SetIgnoreIfNull(true);
cm.MapMember(c => c.InfusingStatus)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.InfusingStatus>(
new EnumSerializer<PumpEnum.InfusingStatus>(BsonType.String)));
cm.MapMember(c => c.Status)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.Status>(
new EnumSerializer<PumpEnum.Status>(BsonType.String)));
cm.MapMember(c => c.PumpMode)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.Mode>(
new EnumSerializer<PumpEnum.Mode>(BsonType.String)));
cm.MapMember(c => c.InfusionModeDetail).SetIgnoreIfNull(true);
cm.MapMember(c => c.ActiveSourceInfo).SetIgnoreIfNull(true);
cm.MapMember(c => c.NotDeliveringReason).SetIgnoreIfNull(true);
cm.MapMember(c => c.Source).SetIgnoreIfNull(true);
// Métricas
cm.MapMember(c => c.FlowFluid).SetIgnoreIfNull(true);
cm.MapMember(c => c.Rate).SetIgnoreIfNull(true);
cm.MapMember(c => c.VolumeInfused).SetIgnoreIfNull(true);
cm.MapMember(c => c.FluidDelivTotal).SetIgnoreIfNull(true);
cm.MapMember(c => c.FluidDelivTotalSet).SetIgnoreIfNull(true);
cm.MapMember(c => c.VolumeRemaining).SetIgnoreIfNull(true);
cm.MapMember(c => c.Vtbi).SetIgnoreIfNull(true);
cm.MapMember(c => c.TimeRemaining).SetIgnoreIfNull(true);
cm.MapMember(c => c.TimeProgrammed).SetIgnoreIfNull(true);
// Medicación
cm.MapMember(c => c.DrugName).SetIgnoreIfNull(true);
cm.MapMember(c => c.DrugId).SetIgnoreIfNull(true);
cm.MapMember(c => c.Concentration).SetIgnoreIfNull(true);
cm.MapMember(c => c.DoseRate).SetIgnoreIfNull(true);
cm.MapMember(c => c.DrugAmount).SetIgnoreIfNull(true);
cm.MapMember(c => c.DrugDoseDelivered).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientWeight).SetIgnoreIfNull(true);
cm.MapMember(c => c.Syringe).SetIgnoreIfNull(true);
// Última alarma resumen
cm.MapMember(c => c.AlarmType)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.AlarmType>(
new EnumSerializer<PumpEnum.AlarmType>(BsonType.String)));
cm.MapMember(c => c.AlarmDescription).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmState).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmInactivationState).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmPriority).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmCodeMdc).SetIgnoreIfNull(true);
cm.MapMember(c => c.Event)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.Event>(
new EnumSerializer<PumpEnum.Event>(BsonType.String)));
cm.MapMember(c => c.EventPhase)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.EventPhase>(
new EnumSerializer<PumpEnum.EventPhase>(BsonType.String)));
// Relay / Comm
cm.MapMember(c => c.CommStatus).SetIgnoreIfNull(true);
cm.MapMember(c => c.RelayState).SetIgnoreIfNull(true);
cm.MapMember(c => c.RelayGuid).SetIgnoreIfNull(true);
});
}
// ============================================================
// PumpAlarmEvent
// ============================================================
if (!BsonClassMap.IsClassMapRegistered(typeof(PumpAlarmEvent)))
{
BsonClassMap.RegisterClassMap<PumpAlarmEvent>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.DeviceId).SetIgnoreIfNull(true);
cm.MapMember(c => c.RackId).SetIgnoreIfNull(true);
cm.MapMember(c => c.DeviceTypeMdc).SetIgnoreIfNull(true);
cm.MapMember(c => c.InfusionId).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientId).SetIgnoreIfNull(true);
cm.MapMember(c => c.Time).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmType)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.AlarmType>(
new EnumSerializer<PumpEnum.AlarmType>(BsonType.String)));
cm.MapMember(c => c.AlarmDescription).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmState).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmInactivationState).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmPriority).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmTypeMdc).SetIgnoreIfNull(true);
cm.MapMember(c => c.EventPhase)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.EventPhase>(
new EnumSerializer<PumpEnum.EventPhase>(BsonType.String)));
cm.MapMember(c => c.AlertSourceMdc).SetIgnoreIfNull(true);
cm.MapMember(c => c.DeviceIp).SetIgnoreIfNull(true);
cm.MapMember(c => c.PillarAssembly).SetIgnoreIfNull(true);
cm.MapMember(c => c.PillarRackSlot).SetIgnoreIfNull(true);
});
}
// ============================================================
// PumpAlarmState
// ============================================================
if (!BsonClassMap.IsClassMapRegistered(typeof(PumpAlarmState)))
{
BsonClassMap.RegisterClassMap<PumpAlarmState>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.DeviceId).SetIgnoreIfNull(true);
cm.MapMember(c => c.PatientId).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmType)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.AlarmType>(
new EnumSerializer<PumpEnum.AlarmType>(BsonType.String)));
cm.MapMember(c => c.AlarmCodeMdc).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmDescription).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmPriority).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlarmState).SetIgnoreIfNull(true);
cm.MapMember(c => c.LastPhase)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.EventPhase>(
new EnumSerializer<PumpEnum.EventPhase>(BsonType.String)));
cm.MapMember(c => c.FirstSeen).SetIgnoreIfNull(true);
cm.MapMember(c => c.LastUpdated).SetIgnoreIfNull(true);
cm.MapMember(c => c.AlertSourceMdc).SetIgnoreIfNull(true);
cm.MapMember(c => c.InfusionId).SetIgnoreIfNull(true);
});
}
// ============================================================
// ConfigPumps
// ============================================================
if (!BsonClassMap.IsClassMapRegistered(typeof(ConfigPumps)))
{
BsonClassMap.RegisterClassMap<ConfigPumps>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.Items).SetIgnoreIfNull(true);
});
}
// ============================================================
// ConfigPumpItem
// ============================================================
if (!BsonClassMap.IsClassMapRegistered(typeof(ConfigPumpItem)))
{
BsonClassMap.RegisterClassMap<ConfigPumpItem>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.AlarmType)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.AlarmType>(
new EnumSerializer<PumpEnum.AlarmType>(BsonType.String)));
cm.MapMember(c => c.UiConfiguration).SetIgnoreIfNull(true);
cm.MapMember(c => c.Type)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<PumpEnum.PumpMessageType>(
new EnumSerializer<PumpEnum.PumpMessageType>(BsonType.String)));
cm.MapMember(c => c.RetentionPolicy).SetIgnoreIfNull(true);
cm.MapMember(c => c.RetentionPolicyValue).SetIgnoreIfNull(true);
});
}
}
}
}
@@ -0,0 +1,48 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class RelayContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Relay)))
BsonClassMap.RegisterClassMap<Relay>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.Type)
.SetDefaultValue(RelayEnum.Type.Door)
.SetSerializer(new EnumSerializer<RelayEnum.Type>(BsonType.String));
cm.MapMember(c => c.Driver).SetIgnoreIfNull(true);
cm.MapMember(c => c.Ip).SetIgnoreIfNull(true);
cm.MapMember(c => c.Port).SetDefaultValue(0);
cm.MapMember(c => c.RelayNumber).SetDefaultValue(1);
cm.MapMember(c => c.RelayName).SetIgnoreIfNull(true);
cm.MapMember(c => c.Total).SetDefaultValue(1);
cm.MapMember(c => c.RefreshTime).SetDefaultValue(60);
cm.MapMember(c => c.Open).SetDefaultValue(false);
cm.MapMember(c => c.Status)
.SetDefaultValue(RelayEnum.Status.NotInitialized)
.SetSerializer(new EnumSerializer<RelayEnum.Status>(BsonType.String));
cm.MapMember(c => c.Username).SetIgnoreIfNull(true);
cm.MapMember(c => c.Password).SetIgnoreIfNull(true);
cm.MapMember(c => c.Mode)
.SetDefaultValue(RelayEnum.Mode.OpenedOnClosedOff)
.SetSerializer(new EnumSerializer<RelayEnum.Mode>(BsonType.String));
cm.MapMember(c => c.RebootDelay).SetIgnoreIfNull(true);
cm.MapMember(c => c.Cache).SetDefaultValue(true);
cm.MapMember(c => c.InUse).SetIgnoreIfNull(true).SetIsRequired(false);
cm.MapMember(c => c.ManualRelayStatus)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<RelayEnum.Status>(
new EnumSerializer<RelayEnum.Status>(BsonType.String)));
});
}
}
@@ -0,0 +1,91 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class RowMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(RowBoxLayout)))
BsonClassMap.RegisterClassMap<RowBoxLayout>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.GrowPriority).SetDefaultValue(1D);
cm.MapMember(c => c.Type)
.SetDefaultValue(DisplayConfigEnums.CellType.Default)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.CellType>(BsonType.String));
cm.MapMember(c => c.SubType)
.SetDefaultValue(DisplayConfigEnums.WebDisplayCellSubtype.Default)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.WebDisplayCellSubtype>(BsonType.String));
cm.MapMember(c => c.BgColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingTop).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingBottom).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingLeft).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingRight).SetIgnoreIfNull(true);
cm.MapMember(c => c.Observations)
.SetDefaultValue(new List<ObservationRowBoxLayout>());
cm.MapMember(c => c.Direction)
.SetDefaultValue(DisplayConfigEnums.DirectionEnum.Row)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.DirectionEnum>(BsonType.String));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(RowDetailsConfig)))
BsonClassMap.RegisterClassMap<RowDetailsConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Cells).SetDefaultValue(new List<CellDetails>());
cm.MapMember(c => c.Rows).SetDefaultValue(new List<RowDetailsConfig>());
cm.MapMember(c => c.GrowPriority).SetDefaultValue(1.0);
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
cm.MapMember(c => c.DialogConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.Type).SetDefaultValue(DisplayConfigEnums.RowType.Demographic)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.RowType>(BsonType.String));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ObservationRowBoxLayout)))
BsonClassMap.RegisterClassMap<ObservationRowBoxLayout>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.TextRules).SetIgnoreIfNull(true);
cm.MapMember(c => c.ChartSettings).SetIgnoreIfNull(true);
cm.MapMember(c => c.ShowTitle).SetIgnoreIfNull(true);
cm.MapMember(c => c.GrowPriority).SetDefaultValue(1D);
cm.MapMember(c => c.Type)
.SetDefaultValue(DisplayConfigEnums.CellType.Default)
.SetSerializer(new EnumSerializer<DisplayConfigEnums.CellType>(BsonType.String));
cm.MapMember(c => c.SubType).SetIgnoreIfNull(true);
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Icon).SetIgnoreIfNull(true);
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
cm.MapMember(c => c.GridColumn).SetDefaultValue(1);
cm.MapMember(c => c.IsColumn).SetIgnoreIfNull(true);
cm.MapMember(c => c.IsStatic).SetIgnoreIfNull(true);
cm.MapMember(c => c.GraphConf).SetIgnoreIfNull(true);
cm.MapMember(c => c.Names).SetIgnoreIfNull(true);
cm.MapMember(c => c.ObservationName).SetIgnoreIfNull(true);
cm.MapMember(c => c.ObservationTitle).SetIgnoreIfNull(true);
cm.MapMember(c => c.Observations).SetIgnoreIfNull(true);
cm.MapMember(c => c.BgColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingTop).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingBottom).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingLeft).SetIgnoreIfNull(true);
cm.MapMember(c => c.PaddingRight).SetIgnoreIfNull(true);
cm.MapMember(c => c.Border).SetIgnoreIfNull(true);
cm.MapMember(c => c.BorderRadius).SetIgnoreIfNull(true);
cm.MapMember(c => c.ValuePathKey).SetIgnoreIfNull(true);
cm.MapMember(c => c.ValuePathNested).SetIgnoreIfNull(true);
cm.MapMember(c => c.Size).SetDefaultValue(15.0);
cm.MapMember(c => c.Format).SetIgnoreIfNull(true);
cm.MapMember(c => c.Length).SetIgnoreIfNull(true);
cm.MapMember(c => c.Direction)
.SetIgnoreIfNull(true)
.SetSerializer(new NullableSerializer<DisplayConfigEnums.DirectionEnum>(
new EnumSerializer<DisplayConfigEnums.DirectionEnum>(BsonType.String)));
});
}
}
@@ -0,0 +1,69 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.BsonConverters;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class SectionMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Section)))
BsonClassMap.RegisterClassMap<Section>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c._id);
cm.MapMember(c => c.Id)
.SetIsRequired(true)
.SetDefaultValue(string.Empty);
cm.MapMember(c => c.SectionTitle).SetIgnoreIfNull(true);
cm.MapMember(c => c.PointOfCare).SetIgnoreIfNull(true);
cm.MapMember(c => c.LastUpdate).SetIgnoreIfNull(true);
cm.MapMember(c => c.Configuration)
.SetSerializer(new DictionaryBsonConverter());
cm.MapMember(c => c.SectionConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.DesignProperties).SetIgnoreIfNull(true);
cm.MapMember(c => c.PointOfCareList)
.SetDefaultValue(new Dictionary<string, List<PointOfCare>>());
cm.MapMember(c => c.Items).SetDefaultValue(new List<Section.SectionItem>());
cm.MapMember(c => c.Status)
.SetIgnoreIfNull(true)
.SetSerializer(
new NullableSerializer<StatusEnum.Type>(new EnumSerializer<StatusEnum.Type>(BsonType.String)));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Section.SectionItem)))
BsonClassMap.RegisterClassMap<Section.SectionItem>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Group).SetIgnoreIfNull(true);
cm.MapMember(c => c.Boxes).SetDefaultValue(new List<Box>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(SectionConfig)))
BsonClassMap.RegisterClassMap<SectionConfig>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Columns).SetIgnoreIfNull(true);
cm.MapMember(c => c.Rows).SetIgnoreIfNull(true);
cm.MapMember(c => c.RefreshValues).SetIgnoreIfNull(true);
cm.MapMember(c => c.RefreshConfig).SetIgnoreIfNull(true);
cm.MapMember(c => c.Steps).SetIgnoreIfNull(true);
cm.MapMember(c => c.DesignProperties).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(MinimalDisplaySection)))
BsonClassMap.RegisterClassMap<MinimalDisplaySection>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetDefaultValue(ObjectId.GenerateNewId());
cm.MapMember(c => c.Name).SetDefaultValue(string.Empty);
cm.MapMember(c => c.IsSelected).SetDefaultValue(false);
});
}
}
@@ -0,0 +1,60 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class ServiceConfigMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(ServiceConfig)))
BsonClassMap.RegisterClassMap<ServiceConfig>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.StrId).SetElementName("id")
.SetDefaultValue(string.Empty);
cm.MapMember(c => c.Service).SetDefaultValue(new List<ServiceConfigService>());
cm.MapMember(c => c.Theme).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxObservations).SetIgnoreIfNull(true);
cm.MapMember(c => c.Score).SetDefaultValue(string.Empty);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ServiceConfigService)))
BsonClassMap.RegisterClassMap<ServiceConfigService>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Screen).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Sections).SetDefaultValue(new List<ServiceConfigServiceSection>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ServiceConfigServiceSection)))
BsonClassMap.RegisterClassMap<ServiceConfigServiceSection>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.BoxId).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Box).SetDefaultValue(string.Empty);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ServiceConfigTheme)))
BsonClassMap.RegisterClassMap<ServiceConfigTheme>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.DefaultTheme).SetElementName("default")
.SetDefaultValue(string.Empty);
cm.MapMember(c => c.Timetables).SetDefaultValue(new List<ServiceConfigThemeTimetable>());
});
if (!BsonClassMap.IsClassMapRegistered(typeof(ServiceConfigThemeTimetable)))
BsonClassMap.RegisterClassMap<ServiceConfigThemeTimetable>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Theme).SetDefaultValue(string.Empty);
cm.MapMember(c => c.StartDay).SetDefaultValue(string.Empty);
cm.MapMember(c => c.EndDay).SetDefaultValue(string.Empty);
cm.MapMember(c => c.StartHour).SetDefaultValue(string.Empty);
cm.MapMember(c => c.EndHour).SetDefaultValue(string.Empty);
});
}
}
@@ -0,0 +1,45 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class StandardMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(HistoricalConfigChanges)))
BsonClassMap.RegisterClassMap<HistoricalConfigChanges>(cm =>
{
cm.AutoMap();
//cm.MapMember(c => c.Id)
// .SetSerializer(new ObjectIdSerializer(BsonType.String));
//cm.GetMemberMap(c => c.ConfigType)
// .SetSerializer(new NullableSerializer<ConfigTypes>(new EnumSerializer<ConfigTypes>(BsonType.String)));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(UiFontData)))
BsonClassMap.RegisterClassMap<UiFontData>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.WidthStepBed).SetIgnoreIfNull(true);
cm.MapMember(c => c.HeightStepBed).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeMediumValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeHeaderValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeLittleValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeMicroValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeNanoValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeLittleTextValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeName).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeLittleName).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeUnit).SetIgnoreIfNull(true);
cm.MapMember(c => c.BorderColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.BackGroundColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxMarginTop).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxMarginBot).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxMarginLeft).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxMarginRight).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,116 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models;
using adas_core.Domain.Models.Observations;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class TreatmentMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientTreatment)))
BsonClassMap.RegisterClassMap<PatientTreatment>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.PatientId)
.SetSerializer(new ObjectIdSerializer(BsonType.String))
.SetIgnoreIfNull(true);
cm.MapMember(c => c.OrderControl)
.SetSerializer(new EnumSerializer<OrderControlType>(BsonType.String));
cm.MapMember(c => c.PlacerOrder).SetIgnoreIfNull(true);
cm.MapMember(c => c.FillerOrder).SetIgnoreIfNull(true);
cm.MapMember(c => c.OrderStatus).SetDefaultValue(string.Empty);
cm.MapMember(c => c.OrderTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.StartTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.EndTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.RequestedGiveCodes).SetDefaultValue(new List<Code>());
cm.MapMember(c => c.RequestedGiveTreatment).SetDefaultValue(string.Empty);
cm.MapMember(c => c.RequestedGiveCodesStatus).SetDefaultValue(new List<CodeStatus>());
cm.MapMember(c => c.RequestedGiveAmountMinimum).SetIgnoreIfNull(true);
cm.MapMember(c => c.RequestedGiveAmountMaximum).SetIgnoreIfNull(true);
cm.MapMember(c => c.RequestedGiveUnits).SetIgnoreIfNull(true);
cm.MapMember(c => c.RequestedDosageForm).SetIgnoreIfNull(true);
cm.MapMember(c => c.Notes).SetDefaultValue(new List<Note>());
cm.MapMember(c => c.Routes).SetDefaultValue(new List<TreatmentRoute>());
cm.MapMember(c => c.SingleDose).SetDefaultValue(false);
cm.MapMember(c => c.BoloPom).SetDefaultValue(false);
cm.MapMember(c => c.MessageTime);
cm.MapMember(c => c.SystemId).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Entity)))
BsonClassMap.RegisterClassMap<Entity>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.EntityIdentifier).SetIgnoreIfNull(true);
cm.MapMember(c => c.NamespaceId).SetIgnoreIfNull(true);
cm.MapMember(c => c.UniversalId).SetIgnoreIfNull(true);
cm.MapMember(c => c.UniversalIdType).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Code)))
BsonClassMap.RegisterClassMap<Code>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Identifier).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Text).SetDefaultValue(string.Empty);
cm.MapMember(c => c.CodingSystem).SetDefaultValue(string.Empty);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(CodeStatus)))
BsonClassMap.RegisterClassMap<CodeStatus>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Code).SetIgnoreIfNull(true);
cm.MapMember(c => c.Status).SetIgnoreIfNull(true);
cm.MapMember(c => c.AdministrationTime).SetIgnoreIfNull(true);
cm.MapMember(c => c.EndAdministrationTime).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Note)))
BsonClassMap.RegisterClassMap<Note>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.CommentType).SetDefaultValue(string.Empty);
cm.MapMember(c => c.Comment).SetDefaultValue(string.Empty);
cm.MapMember(c => c.EnteredTime).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(TreatmentRoute)))
BsonClassMap.RegisterClassMap<TreatmentRoute>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Route).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(Medicine)))
BsonClassMap.RegisterClassMap<Medicine>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id");
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
cm.MapMember(c => c.Codes).SetIgnoreIfNull(true);
cm.MapMember(c => c.Notes).SetIgnoreIfNull(true);
cm.MapMember(c => c.Type).SetIgnoreIfNull(true);
cm.MapMember(c => c.Group).SetIgnoreIfNull(true);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(CodeAction)))
BsonClassMap.RegisterClassMap<CodeAction>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.Code).SetIsRequired(true);
cm.MapMember(c => c.Action)
.SetSerializer(new EnumSerializer<ActionsEnum.ResourceAction>(BsonType.String));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(PredictMedicationObservation)))
BsonClassMap.RegisterClassMap<PredictMedicationObservation>(cm => { cm.AutoMap(); });
}
}
@@ -0,0 +1,94 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class UnitMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(Unit)))
BsonClassMap.RegisterClassMap<Unit>(cm =>
{
cm.AutoMap();
cm.MapIdMember(c => c.Id).SetElementName("_id").SetIsRequired(true);
cm.GetMemberMap(c => c.Title).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.Name).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.LastUpdate).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.PointOfCareIds).SetIgnoreIfNull(true);
cm.UnmapMember(c => c.PocCount);
cm.MapMember(c => c.Status)
.SetDefaultValue(StatusEnum.Type.Ok)
.SetSerializer(
new NullableSerializer<StatusEnum.Type>(new EnumSerializer<StatusEnum.Type>(BsonType.String)));
cm.MapMember(c => c.Configuration).SetDefaultValue(new UnitConfiguration());
cm.GetMemberMap(c => c.AltableOptionListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.AllergyListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.DestinationListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.InternalDestinationListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.DiagnosisListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.DoctorListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.DoctorTypeListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.InsulationListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.MobilityOptionListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.OriginListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.PatientStatusListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.ProcedureListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.TestListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.ServiceListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.TherapeuticCeilingListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.TreatmentListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.VisitOptionListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.AccessControlListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.LanguageBarrierListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.DischargeStatusListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.PassiveSittingListId).SetIgnoreIfNull(true);
cm.GetMemberMap(c => c.GenericListId).SetIgnoreIfNull(true);
// No mapear estos campos
cm.UnmapProperty(c => c.AllergyList);
cm.UnmapProperty(c => c.DestinationList);
cm.UnmapProperty(c => c.DiagnosisList);
cm.UnmapProperty(c => c.DoctorList);
cm.UnmapProperty(c => c.DoctorTypeList);
cm.UnmapProperty(c => c.InsulationList);
cm.UnmapProperty(c => c.MobilityOptionList);
cm.UnmapProperty(c => c.OriginList);
cm.UnmapProperty(c => c.PatientStatusList);
cm.UnmapProperty(c => c.ProcedureList);
cm.UnmapProperty(c => c.TestList);
cm.UnmapProperty(c => c.AltableOptionList);
cm.UnmapProperty(c => c.DischargeStatusList);
cm.UnmapProperty(c => c.ServiceList);
cm.UnmapProperty(c => c.TherapeuticCeilingList);
cm.UnmapProperty(c => c.TreatmentList);
cm.UnmapProperty(c => c.VisitOptionList);
cm.UnmapProperty(c => c.PassiveSittingList);
cm.UnmapProperty(c => c.GenericList);
cm.UnmapProperty(c => c.LanguageBarrierList);
cm.UnmapProperty(c => c.PointOfCares);
cm.UnmapProperty(c => c.InternalDestinationList);
});
if (!BsonClassMap.IsClassMapRegistered(typeof(UnitConfiguration)))
BsonClassMap.RegisterClassMap<UnitConfiguration>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.AutoAdt).SetDefaultValue(false);
cm.MapMember(c => c.ManualDischarge).SetDefaultValue(true);
cm.MapMember(c => c.ManualAdmit).SetDefaultValue(true);
cm.MapMember(c => c.ManualMove).SetDefaultValue(true);
cm.MapMember(c => c.ManualEdit).SetDefaultValue(true);
cm.MapMember(c => c.PlanDisplayConfiguration).SetIgnoreIfNull(true);
cm.MapMember(c => c.SmartDisplayConfiguration).SetIgnoreIfNull(true);
cm.MapMember(c => c.StandarDisplayConfiguration).SetIgnoreIfNull(true);
});
}
}
@@ -0,0 +1,90 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Driver;
namespace adas_core.Infrastructure.Utils;
public class MongoUtils
{
public static async Task EnsureIndexes<TDocument>(IMongoCollection<TDocument> collection,
List<CreateIndexModel<TDocument>> expectedIndexes)
{
var existingIndexes = await (await collection.Indexes.ListAsync()).ToListAsync();
var documentSerializer = BsonSerializer.SerializerRegistry.GetSerializer<TDocument>();
var serializerRegistry = BsonSerializer.SerializerRegistry;
var renderArgs = new RenderArgs<TDocument>(documentSerializer, serializerRegistry);
foreach (var expectedIndexModel in expectedIndexes)
{
var expectedIndexKeys = expectedIndexModel.Keys
.Render(renderArgs).ToString();
var existingIndexWithSameKeys = existingIndexes.FirstOrDefault(index =>
{
var keys = index.Elements.FirstOrDefault(e => e.Name == "key").Value?.ToString();
return keys == expectedIndexKeys;
});
if (existingIndexWithSameKeys != null)
{
// Existe un índice con las mismas claves, verificar las opciones
if (!IndexOptionsMatch(expectedIndexModel, existingIndexWithSameKeys, renderArgs))
{
// Las opciones no coinciden, eliminar el índice existente y crear el nuevo
var indexName = existingIndexWithSameKeys.Elements.FirstOrDefault(e => e.Name == "name").Value
?.AsString;
if (!string.IsNullOrEmpty(indexName) && indexName != "_id_")
try
{
await collection.Indexes.DropOneAsync(indexName);
await collection.Indexes.CreateOneAsync(expectedIndexModel);
Console.WriteLine($"Info: Índice con claves '{expectedIndexKeys}' actualizado.");
}
catch (MongoCommandException ex) when (ex.Code == 85)
{
Console.WriteLine(
$"Warning: No se pudo actualizar el índice con claves '{expectedIndexKeys}'. Error: {ex.Message}");
}
else
try
{
await collection.Indexes.CreateOneAsync(expectedIndexModel);
}
catch (MongoCommandException ex) when (ex.Code == 85)
{
Console.WriteLine(
$"Warning: El índice con claves '{expectedIndexKeys}' ya existe con diferentes opciones y no se pudo actualizar automáticamente.");
}
}
// Si las opciones coinciden, no se hace nada
}
else
{
// No existe un índice con estas claves, crear el nuevo
try
{
await collection.Indexes.CreateOneAsync(expectedIndexModel);
}
catch (MongoCommandException ex) when (ex.Code == 85)
{
Console.WriteLine($"Warning: El índice con claves '{expectedIndexKeys}' ya existe.");
}
}
}
}
private static bool IndexOptionsMatch<TDocument>(CreateIndexModel<TDocument> expectedIndexModel,
BsonDocument existingIndex, RenderArgs<TDocument> renderArgs)
{
var expectedIndexOptions = expectedIndexModel.Options;
var unique = existingIndex.Elements.FirstOrDefault(e => e.Name == "unique").Value?.AsBoolean ?? false;
var background = existingIndex.Elements.FirstOrDefault(e => e.Name == "background").Value?.AsBoolean ?? false;
var partialFilter = existingIndex.Elements.FirstOrDefault(e => e.Name == "partialFilterExpression").Value
?.ToString();
var expectedPartialFilter = expectedIndexOptions.PartialFilterExpression
?.Render(renderArgs).ToString();
return unique == expectedIndexOptions.Unique &&
background == expectedIndexOptions.Background &&
partialFilter == expectedPartialFilter;
}
}
@@ -0,0 +1,100 @@
using System.Reflection;
using adas_core.Domain.Models;
using MongoDB.Bson.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
namespace adas_core.Infrastructure.Utils;
public class PatientObservationAlarmConverter : JsonConverter<PatientObservationAlarm>, IBsonSerializer
{
public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
{
throw new NotImplementedException();
}
public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value)
{
throw new NotImplementedException();
}
public Type ValueType => typeof(PatientObservationAlarm);
public override PatientObservationAlarm? ReadJson(JsonReader reader, Type objectType,
PatientObservationAlarm? existingValue,
bool hasExistingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
return null;
// Implement your custom deserialization logic here
var jsonObject = JObject.Load(reader);
// Deserialize properties from jsonObject to PatientObservationAlarm object
// Example: Deserialize 'Value' property
var value = jsonObject.GetValue("value")?.ToObject<object>();
return new PatientObservationAlarm
{
Value = value ?? new object()
// Other property assignments...
};
}
public new void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
if (value != null)
{
var jo = JObject.FromObject(value);
// Add [JsonConverter(typeof(StringEnumConverter))] attribute to specified properties
AddStringEnumConverterAttribute(value, "eventPhase");
AddStringEnumConverterAttribute(value, "state");
AddStringEnumConverterAttribute(value, "priority");
AddStringEnumConverterAttribute(value, "type");
jo.Property("messageTime")?.Remove();
jo.Property("expired")?.Remove();
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)
{
// 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);
}
}
}
public override void WriteJson(JsonWriter writer, PatientObservationAlarm? value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
/*How to use it:
BsonSerializer.RegisterSerializer(new PatientObservationAlarmConverter());
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Converters = { new PatientObservationAlarmConverter() }
};
*/
@@ -0,0 +1,68 @@
using System.Reflection;
using adas_core.Domain.Models;
using MongoDB.Bson.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
namespace adas_core.Infrastructure.Utils;
public class PatientObservationConverter(Type? valueType) : JsonConverter<PatientObservation>, IBsonSerializer
{
public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
{
throw new NotImplementedException();
}
public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value)
{
throw new NotImplementedException();
}
public Type? ValueType { get; } = valueType;
public override void WriteJson(JsonWriter writer, PatientObservation? value, JsonSerializer serializer)
{
if (value != null)
{
var jo = JObject.FromObject(value);
// Add [JsonConverter(typeof(StringEnumConverter))] attribute to specified properties
AddStringEnumConverterAttribute(value, "Status");
jo.Property("MessageTime")?.Remove();
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)
{
// 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);
}
}
}
public override PatientObservation ReadJson(JsonReader reader, Type objectType, PatientObservation? existingValue,
bool hasExistingValue, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
@@ -0,0 +1,87 @@
using System.Reflection;
using adas_core.Domain.Models;
using adas_core.Domain.Models.Pumps;
using MongoDB.Bson.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using JsonConverterAttribute = Newtonsoft.Json.JsonConverterAttribute;
namespace adas_core.Infrastructure.Utils;
public class PatientPumpObservationConverter : JsonConverter<PumpObservation>, IBsonSerializer
{
public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
{
throw new NotImplementedException();
}
public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value)
{
throw new NotImplementedException();
}
public Type ValueType => typeof(PatientObservationAlarm);
public override PumpObservation ReadJson(JsonReader reader, Type objectType,
PumpObservation? existingValue,
bool hasExistingValue, JsonSerializer serializer)
{
throw new NotImplementedException();
}
public new void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
if (value != null)
{
var jo = JObject.FromObject(value);
// Add [JsonConverter(typeof(StringEnumConverter))] attribute to specified properties
AddStringEnumConverterAttribute(value, "Event");
AddStringEnumConverterAttribute(value, "Status");
AddStringEnumConverterAttribute(value, "PumpMode");
AddStringEnumConverterAttribute(value, "InfusingStatus");
AddStringEnumConverterAttribute(value, "AlarmMode");
jo.WriteTo(writer);
}
}
public override void WriteJson(JsonWriter writer, PumpObservation? value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
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);
}
}
}
}
/*How to use it:
BsonSerializer.RegisterSerializer(new PatientObservationAlarmConverter());
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Converters = { new PatientObservationAlarmConverter() }
};
*/
@@ -0,0 +1,63 @@
using System.Reflection;
using adas_core.Domain.Models;
using MongoDB.Bson.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
namespace adas_core.Infrastructure.Utils;
public class PersonConverter(Type valueType) : JsonConverter<Person>, IBsonSerializer
{
public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
{
throw new NotImplementedException();
}
public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value)
{
throw new NotImplementedException();
}
public Type ValueType { get; } = valueType;
public override void WriteJson(JsonWriter writer, Person? value, JsonSerializer serializer)
{
if (value == null) return;
var jo = JObject.FromObject(value);
// Add [JsonConverter(typeof(StringEnumConverter))] attribute to specified properties
AddStringEnumConverterAttribute(value, "Gender");
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) return;
var attrs = prop.GetCustomAttributes(false);
// Check if the attribute is not already applied
if (Array.Find(attrs, a => a is JsonConverterAttribute) != null) return;
// 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);
}
public override Person ReadJson(JsonReader reader, Type objectType, Person? existingValue, bool hasExistingValue,
JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
@@ -0,0 +1,145 @@
using adas_core.Application.Services.Interfaces;
using EasyNetQ;
using EasyNetQ.SystemMessages;
using Newtonsoft.Json;
using Serilog;
using System.Text;
using ILogger = Serilog.ILogger;
namespace adas_core.Infrastructure.Utils;
public class RabbitConsumerErrorHandler(IPublisherService publisherService)
{
private const int MaxRetries = 2;
private static readonly ILogger Logger = Log.ForContext<RabbitConsumerErrorHandler>();
public async Task HandleAsync<T>(
Message<T> message,
MessageReceivedInfo receivedInfo,
Func<Task> next)
{
try
{
await next();
}
catch (Exception exception)
{
Logger.Error(exception, "Consumer error {Message}", exception.Message);
var properties = message.Properties;
var body = Encoding.UTF8.GetString(
message.Body is byte[] bytes
? bytes
: Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(message.Body)));
HandleRetries(receivedInfo, properties, body, exception);
}
}
private void HandleRetries(
MessageReceivedInfo receivedInfo,
MessageProperties properties,
string body,
Exception exception)
{
try
{
var headers = properties.Headers != null
? new Dictionary<string, object>(properties.Headers)
: [];
var retries = GetRetries(properties);
// MAX RETRIES → ERROR QUEUE
if (retries > MaxRetries)
{
if (!receivedInfo.Queue.StartsWith("Error"))
{
headers["retries"] = BitConverter.GetBytes(MaxRetries + 1);
var errorMsg = CreateErrorMessage(
receivedInfo,
properties,
body,
exception,
headers
);
_ = publisherService.SendMessageError(
errorMsg,
$"Error{receivedInfo.Queue}");
}
return;
}
// RETRY NORMAL
headers["retries"] = BitConverter.GetBytes(retries + 1);
var newProps = new MessageProperties
{
DeliveryMode = 2,
Headers = headers,
ContentType = properties.ContentType,
CorrelationId = properties.CorrelationId,
MessageId = properties.MessageId
};
var message = new Message<string>(body, newProps);
var result = publisherService
.SendMessage(message, receivedInfo.Queue)
.GetAwaiter()
.GetResult();
if (!result)
throw new Exception("Requeue failed");
}
catch (Exception e)
{
Logger.Error(e, "Exception processing rabbit message");
}
}
private int GetRetries(MessageProperties properties)
{
if (properties.Headers != null &&
properties.Headers.TryGetValue("retries", out var retriesObj) &&
retriesObj is byte[] bytes)
{
return BitConverter.ToInt32(bytes, 0);
}
return 0;
}
private static Message<Error> CreateErrorMessage(
MessageReceivedInfo receivedInfo,
MessageProperties originalProperties,
string body,
Exception exception,
Dictionary<string, object> headers)
{
var props = new MessageProperties
{
Headers = headers,
DeliveryMode = originalProperties.DeliveryMode,
ContentType = originalProperties.ContentType,
CorrelationId = originalProperties.CorrelationId,
MessageId = originalProperties.MessageId
};
var error = new Error(
body,
exception.Message,
receivedInfo.Exchange,
receivedInfo.RoutingKey,
receivedInfo.Queue,
DateTime.UtcNow,
props
);
return new Message<Error>(error, props);
}
}
@@ -0,0 +1,29 @@
using System.Text;
using EasyNetQ.Consumer;
using Newtonsoft.Json;
namespace adas_core.Infrastructure.Utils;
public class RabbitIErrorMessageSerializer : IErrorMessageSerializer
{
public byte[]? Deserialize(string messageBody)
{
var unescapedJsonString = JsonConvert.DeserializeObject<string>(messageBody);
return unescapedJsonString != null ? Encoding.UTF8.GetBytes(unescapedJsonString) : null;
}
public string? Serialize(byte[] messageBody)
{
var stringifiedMsgBody = Encoding.UTF8.GetString(messageBody);
try
{
return JsonConvert.DeserializeObject<string>(stringifiedMsgBody);
}
catch (Exception)
{
return stringifiedMsgBody;
}
}
}
@@ -0,0 +1,40 @@
using adas_core.Domain.Exceptions;
namespace adas_core.Infrastructure.Utils;
public static class TypesUtils
{
public static Type GetDriver(string deviceType, string device)
{
return deviceType switch
{
"Relay" => GetType("adas-core.module.Relays", device, deviceType),
"LightBeacon" => GetType("adas-core.module.LightBeacons", device, deviceType),
_ => throw new AdasException($"Device type {deviceType} not found")
};
}
private static Type GetType(string typeName, string device, string deviceType)
{
var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
var assembly = loadedAssemblies.FirstOrDefault(a =>
{
var name = a.GetName().Name;
return name != null && name.Contains(typeName);
});
if (assembly == null)
// El ensamblado no está cargado. Lanzar excepción o manejar el fallo.
throw new AdasException($"Assembly '{typeName}' not loaded.");
var fullClassName = $"{typeName.Replace('-', '_')}.Devices.{device}{deviceType}";
var type = assembly.GetType(fullClassName,
true,
true);
if (type != null) return type;
throw new AdasException($"{typeName} driver not found");
}
}