From 586f02a2ca6e3721de3a35cb1b0406312f7a2048 Mon Sep 17 00:00:00 2001 From: julian Date: Sun, 28 Jun 2026 02:50:05 -0700 Subject: [PATCH] === Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) === --- .../BD/CalculatedObservations.cs | 15 ++++ .../CHUO/CalculatedObservations.cs | 14 +++ .../H12O/UCIN/CalculatedObservations.cs | 43 +++++++++ .../HGM/CalculatedObservations.cs | 14 +++ .../HPAZ/CalculatedObservations.cs | 36 ++++++++ .../HRYC/CalculatedObservations.cs | 35 ++++++++ .../HUVH/UCIA/CalculatedObservations.cs | 29 ++++++ .../HUVH/UCIN/CalculatedObservations.cs | 27 ++++++ .../NursePlan/CalculatedObservations.cs | 12 +++ .../Exceptions/APIRequestException.cs | 1 + .../Exceptions/BadRequestException.cs | 3 + .../Exceptions/ConflictException.cs | 3 + .../Exceptions/CustomArgumentException.cs | 3 + .../Exceptions/ForbbidenException.cs | 3 + .../Exceptions/InvalidFormatException.cs | 4 + .../Exceptions/NotFoundException.cs | 4 + .../Exceptions/TokenException.cs | 1 + .../Exceptions/UnauthorizedException.cs | 3 + .../UnprocessableEntityException.cs | 3 + .../Providers/AdasProvider.cs | 5 ++ .../Providers/BaseProvider.cs | 1 + .../Interfaces/IAdmissionRepository.cs | 18 ++++ .../Interfaces/IAlarmRepository.cs | 2 + .../IAppointmentArchiveRepository.cs | 3 + .../Interfaces/IAppointmentRepository.cs | 11 +++ .../IArchivePatientCarePlanRepository.cs | 6 ++ .../Interfaces/IAuthorityRepository.cs | 8 ++ .../Interfaces/ICameraRepository.cs | 7 ++ .../IConfigObservationRepository.cs | 14 +++ .../Interfaces/IConfigPumpsRepository.cs | 4 + .../Interfaces/IConfigUnitsRepository.cs | 1 + .../Interfaces/IDeviceRepository.cs | 5 ++ .../Interfaces/IDiagnosisArchiveRepository.cs | 3 + .../Interfaces/IDiagnosisRepository.cs | 7 ++ .../Interfaces/IDischargeRepository.cs | 18 ++++ .../IDisplayCardConfigRepository.cs | 5 ++ .../IDisplayChartConfigRepository.cs | 5 ++ .../Interfaces/IDisplayConfigRepository.cs | 25 ++++++ .../IDisplayDetailConfigRepository.cs | 5 ++ .../Interfaces/IDisplayRepository.cs | 17 ++++ .../IHistoricalConfigChangesRepository.cs | 8 ++ .../Interfaces/ILightBeaconRepository.cs | 6 ++ .../Interfaces/IMasterListRepository.cs | 23 +++++ .../Interfaces/IMedicineRepository.cs | 10 +++ .../Interfaces/IMongoRepository.cs | 4 + .../Interfaces/INoticeRepository.cs | 7 ++ .../IObservationArchiveRepository.cs | 5 ++ .../Interfaces/IObservationRepository.cs | 34 +++++++ .../Interfaces/IPatientArchiveRepository.cs | 3 + .../Interfaces/IPatientCarePlanRepository.cs | 4 + .../Interfaces/IPatientRepository.cs | 35 ++++++++ .../Interfaces/IPoCMappingRepository.cs | 2 + .../Interfaces/IPoCSettingsRepository.cs | 5 ++ .../Interfaces/IPointOfCareRepository.cs | 27 ++++++ .../Interfaces/IPumpAlarmEventRepository.cs | 5 ++ .../Interfaces/IPumpAlarmStateRepository.cs | 6 ++ .../Interfaces/IPumpArchiveRepository.cs | 4 + .../Interfaces/IPumpObservationRepository.cs | 11 +++ .../Interfaces/IPumpStateRepository.cs | 3 + .../IRecordingAlertArchiveRepository.cs | 3 + .../Interfaces/IRecordingAlertRepository.cs | 9 ++ .../Interfaces/IRelayRepository.cs | 7 ++ .../Interfaces/ISectionRepository.cs | 8 ++ .../Interfaces/IServiceConfigRepository.cs | 2 + .../Interfaces/ITreatmentArchiveRepository.cs | 4 + .../Interfaces/ITreatmentRepository.cs | 12 +++ .../Interfaces/IUnitRepository.cs | 12 +++ .../Interfaces/IUserRepository.cs | 8 ++ .../Services/AdminPanelService.cs | 25 ++++++ .../Services/AdmissionService.cs | 28 ++++++ .../Services/AlarmService.cs | 31 +++++++ .../Services/AlertValuesService.cs | 2 + .../Services/AppointmentService.cs | 13 +++ .../Services/ArchivePatientCarePlanService.cs | 7 ++ .../ArchivePatientObservationsService.cs | 1 + .../Services/ArchivedPatientService.cs | 2 + .../ArchivedPatientTreatmentService.cs | 1 + adas-core.Application/Services/AuthService.cs | 8 ++ .../Services/Caching/CacheDispatcher.cs | 17 ++++ .../Services/Caching/CacheService.cs | 18 ++++ .../Services/Caching/InMemoryLockProvider.cs | 10 +++ .../Services/Caching/LockManagerService.cs | 18 ++++ .../Services/Caching/NoCacheService.cs | 12 +++ .../Services/Caching/RedisLockProvider.cs | 3 + .../Services/Caching/RedisService.cs | 18 ++++ .../Services/CalculatedObservationsService.cs | 12 +++ .../Services/CameraService.cs | 8 ++ .../Services/ConfigObservationService.cs | 31 +++++++ .../Services/ConfigPumpsService.cs | 14 +++ .../Services/ConfigUnitsService.cs | 6 ++ .../Services/DefaultCalculatedObservations.cs | 15 ++++ .../Services/DeviceService.cs | 11 +++ .../Services/DiagnosisService.cs | 17 ++++ .../Services/DischargeService.cs | 26 ++++++ .../Services/DisplayConfigService.cs | 39 ++++++++ .../Services/DisplayService.cs | 40 +++++++++ adas-core.Application/Services/FileService.cs | 5 ++ .../Services/GroupedObservationService.cs | 18 ++++ .../HistoricalConfigChangesService.cs | 12 +++ .../Services/Interfaces/IAPIRequestService.cs | 2 + .../Services/Interfaces/IAdminPanelService.cs | 18 ++++ .../Services/Interfaces/IAdmissionService.cs | 19 ++++ .../Services/Interfaces/IAlarmService.cs | 8 ++ .../Interfaces/IAlertValuesService.cs | 1 + .../Interfaces/IAppointmentService.cs | 10 +++ .../IArchivePatientCarePlanService.cs | 6 ++ .../IArchivedPatientObservationService.cs | 1 + .../Interfaces/IArchivedPatientService.cs | 1 + .../IArchivedPatientTreatmentService.cs | 1 + .../Services/Interfaces/IAuthService.cs | 6 ++ .../Services/Interfaces/ICacheService.cs | 12 +++ .../Interfaces/ICalculatedObservations.cs | 12 +++ .../ICalculatedObservationsService.cs | 11 +++ .../Services/Interfaces/ICameraService.cs | 7 ++ .../Interfaces/IClientMessageService.cs | 5 ++ .../Interfaces/IConfigObservationService.cs | 21 +++++ .../Interfaces/IConfigPumpsService.cs | 8 ++ .../Interfaces/IConfigUnitsService.cs | 2 + .../Services/Interfaces/IDeviceService.cs | 4 + .../Services/Interfaces/IDiagnosisService.cs | 8 ++ .../Services/Interfaces/IDischargeService.cs | 15 ++++ .../Interfaces/IDisplayConfigService.cs | 30 +++++++ .../Services/Interfaces/IDisplayService.cs | 28 ++++++ .../Services/Interfaces/IFileService.cs | 4 + .../Interfaces/IGroupedObservationService.cs | 5 ++ .../IHistoricalConfigChangesService.cs | 9 ++ .../Interfaces/ILightBeaconService.cs | 14 +++ .../Services/Interfaces/ILocalAuditService.cs | 2 + .../Services/Interfaces/ILockProvider.cs | 3 + .../Services/Interfaces/IMasterListService.cs | 28 ++++++ .../Interfaces/IMasterListServiceFactory.cs | 10 +++ .../Services/Interfaces/IMedicineService.cs | 15 ++++ .../Services/Interfaces/INoticeService.cs | 10 +++ .../Interfaces/IObservationDemoService.cs | 3 + .../Interfaces/IObservationService.cs | 37 ++++++++ .../Interfaces/IPatientCarePlanService.cs | 8 ++ .../Services/Interfaces/IPatientService.cs | 50 +++++++++++ .../Services/Interfaces/IPermissionService.cs | 7 ++ .../Services/Interfaces/IPoCMappingService.cs | 1 + .../Interfaces/IPointOfCareService.cs | 30 +++++++ .../Services/Interfaces/IPublisherService.cs | 4 + .../Services/Interfaces/IPumpService.cs | 15 ++++ .../Interfaces/IRecordingAlertService.cs | 5 ++ .../Services/Interfaces/IRecordingService.cs | 5 ++ .../Services/Interfaces/IRelayService.cs | 11 +++ .../Services/Interfaces/ISendAlertService.cs | 3 + .../Interfaces/IServiceConfigService.cs | 1 + .../Interfaces/ISubscriberGroupedService.cs | 8 ++ .../Interfaces/ISubscribersService.cs | 5 ++ .../Services/Interfaces/ITreatmentService.cs | 14 +++ .../Services/Interfaces/IUnitService.cs | 21 +++++ .../Services/LocalAuditService.cs | 2 + .../Services/MasterListService.cs | 38 ++++++++ .../Services/MasterListServiceFactory .cs | 11 +++ .../Services/MedicineService.cs | 16 ++++ .../Services/NoticeService.cs | 12 +++ .../Services/ObservationDemoService.cs | 6 ++ .../Services/ObservationService.cs | 61 +++++++++++++ .../Services/PatientCarePlanService.cs | 8 ++ .../Services/PatientService.cs | 90 +++++++++++++++++++ .../Services/PermissionService.cs | 12 +++ .../Services/PoCMappingService.cs | 5 ++ .../Services/PointOfCareService.cs | 33 +++++++ adas-core.Application/Services/PumpService.cs | 33 +++++++ .../Services/RecordingAlertService.cs | 26 ++++++ .../Services/RecordingService.cs | 12 +++ .../Services/SchedulerService.cs | 25 ++++++ .../Services/ServiceConfigService.cs | 1 + .../Services/SubscribersService.cs | 6 ++ .../Services/TreatmentService.cs | 22 +++++ adas-core.Application/Services/UnitService.cs | 29 ++++++ .../Subscriptions/SubscriberGroupedService.cs | 14 +++ .../Subscriptions/WsSubscriberGrouped.cs | 12 +++ .../Subscriptions/WsSuscriber.cs | 1 + .../Attributes/AuthorizeRolesAttribute.cs | 3 + .../Attributes/AuthorizeUserByService.cs | 1 + .../PermissionAuthorizeAttribute.cs | 1 + adas-core.Authentication/AuthorityService.cs | 9 ++ .../Interfaces/IAuthorityService.cs | 9 ++ .../Interfaces/ILoginService.cs | 7 ++ .../Interfaces/ITokenService.cs | 3 + .../Interfaces/IUserService.cs | 24 +++++ adas-core.Authentication/Models/LoginInfo.cs | 1 + adas-core.Authentication/Models/Token.cs | 2 + .../Models/UciResponse.cs | 4 + .../AuthRegistration.cs | 2 + adas-core.Authentication/UserService.cs | 34 +++++++ adas-core.Domain/Enums/ActionsEnum.cs | 1 + adas-core.Domain/Enums/AlarmEnum.cs | 1 + adas-core.Domain/Enums/CacheEnum.cs | 1 + adas-core.Domain/Enums/DisplayConfigEnums.cs | 1 + adas-core.Domain/Enums/FileEnum.cs | 1 + .../Enums/GroupedObservationEnum.cs | 2 + adas-core.Domain/Enums/HttpEnum.cs | 1 + adas-core.Domain/Enums/MedicineEnum.cs | 1 + adas-core.Domain/Enums/ObservationEnum.cs | 1 + adas-core.Domain/Enums/PatientEnum.cs | 1 + adas-core.Domain/Enums/PermissionEnum.cs | 1 + adas-core.Domain/Enums/PumpEnum.cs | 1 + adas-core.Domain/Enums/RelayEnum.cs | 1 + adas-core.Domain/Enums/StatusEnum.cs | 1 + adas-core.Domain/Enums/SubscriptionType.cs | 1 + adas-core.Domain/Enums/UserEnum.cs | 1 + adas-core.Domain/Exceptions/AdasException.cs | 1 + .../Exceptions/BusinessException.cs | 1 + .../Exceptions/LoginServicesException.cs | 1 + .../Exceptions/UserNotFoundException.cs | 1 + adas-core.Domain/IDefaultRepository.cs | 16 ++++ adas-core.Domain/Models/ADMPanelRequest.cs | 2 + adas-core.Domain/Models/APIRequest.cs | 2 + .../Models/AppSettings/ApiSettings.cs | 8 ++ .../Models/AppSettings/AuthSettings.cs | 10 +++ .../AppSettings/AutoRecordingSettings.cs | 4 + .../Models/AppSettings/CacheSettings.cs | 3 + .../Models/AppSettings/DatabaseSettings.cs | 1 + .../Models/AppSettings/ListSettings.cs | 2 + .../Models/AppSettings/PermissionSettings.cs | 2 + .../Models/AppSettings/RabbitMQSettings.cs | 1 + .../Models/AppSettings/RecordingSettings.cs | 1 + .../Models/AppSettings/RedisSettings.cs | 15 ++++ .../Models/BasePatientObservation.cs | 9 ++ .../Models/BasePatientObservationValue.cs | 1 + .../BsonConverters/DictionaryBsonConverter.cs | 4 + .../BsonConverters/DictionaryConverter.cs | 4 + adas-core.Domain/Models/ChartValue.cs | 1 + adas-core.Domain/Models/ChatMessage.cs | 1 + adas-core.Domain/Models/Code.cs | 1 + adas-core.Domain/Models/CodeAction.cs | 3 + adas-core.Domain/Models/CodeStatus.cs | 1 + adas-core.Domain/Models/DTO/AppointmentDto.cs | 1 + adas-core.Domain/Models/DTO/AssetDto.cs | 1 + .../Models/DTO/ConfigObservationDto.cs | 1 + .../Models/DTO/CreateUserWithAuthDto.cs | 1 + adas-core.Domain/Models/DTO/DeviceDto.cs | 2 + adas-core.Domain/Models/DTO/DiagnosisDto.cs | 1 + .../Models/DTO/Display/ColorConfigDto.cs | 11 +++ .../DTO/Display/CreateDisplayConfigDto.cs | 2 + .../Models/DTO/Display/DisplayConfigDto.cs | 1 + .../DTO/Display/DisplayConfigLocationDto.cs | 1 + .../DTO/Display/DisplayConfigSummary.cs | 1 + .../Models/DTO/Display/DisplayMinimalDto.cs | 1 + .../Models/DTO/Display/DisplayNurseDto.cs | 1 + .../DTO/Display/DisplayWithPermissionsDto.cs | 1 + .../DTO/Display/MinimalDisplayListDto.cs | 1 + .../Models/DTO/Display/SmartDisplayDto.cs | 1 + .../DTO/Display/UpdateDisplayConfigNameDto.cs | 1 + adas-core.Domain/Models/DTO/MasterListDto.cs | 1 + .../DTO/MasterListWithPaginatedOptionsDto.cs | 1 + .../Models/DTO/ObservationAlarmDto.cs | 1 + adas-core.Domain/Models/DTO/ObservationDto.cs | 1 + .../Models/DTO/PaginationPairDto.cs | 1 + adas-core.Domain/Models/DTO/PatientDto.cs | 1 + adas-core.Domain/Models/DTO/PocAndUnitDto.cs | 2 + adas-core.Domain/Models/DTO/PointOfCareDto.cs | 2 + adas-core.Domain/Models/DTO/PumpDto.cs | 1 + .../Models/DTO/RecordingAlertDto.cs | 1 + adas-core.Domain/Models/DTO/TreatmentDto.cs | 1 + adas-core.Domain/Models/DTO/UnitInfoDto.cs | 1 + .../DTO/UpdateListNameAndDescriptionDto.cs | 1 + .../Models/DTO/UpdateMasterListDetailsDto.cs | 1 + .../Models/DTO/UpdateObservationDto.cs | 1 + .../Models/DTO/UpdateOptionMasterListDto.cs | 1 + .../Models/DTO/UpdatePasswordDto.cs | 1 + .../Models/DTO/UpdateUnitIdListDto.cs | 4 + .../Models/DTO/UpdateUserWithAuthDto.cs | 1 + adas-core.Domain/Models/Entity.cs | 1 + .../Models/Filter/FilterOptionListElement.cs | 1 + .../Models/Filter/FilteredRequest.cs | 1 + .../Models/Filter/PaginationFilter.cs | 3 + adas-core.Domain/Models/GroupedObservation.cs | 6 ++ .../Models/GroupedObservations/Field.cs | 1 + .../GroupedObservations/GroupedField.cs | 4 + .../Models/HistoricalLocations.cs | 6 ++ adas-core.Domain/Models/ManualRecording.cs | 2 + .../Models/Masters/AccessControlList.cs | 1 + .../Models/Masters/AllergyList.cs | 1 + .../Models/Masters/AltableOptionList.cs | 1 + .../Models/Masters/DestinationList.cs | 1 + .../Models/Masters/DiagnosisList.cs | 1 + .../Models/Masters/DischargeStatusList.cs | 1 + adas-core.Domain/Models/Masters/DoctorList.cs | 1 + .../Models/Masters/DoctorTypeList.cs | 1 + .../Models/Masters/GenericList.cs | 1 + .../Models/Masters/InsulationList.cs | 1 + .../Models/Masters/InternalDestinationList.cs | 1 + .../Models/Masters/LanguageBarrierList.cs | 1 + adas-core.Domain/Models/Masters/MasterList.cs | 3 + .../Models/Masters/MobilityOptionList.cs | 1 + adas-core.Domain/Models/Masters/OptionList.cs | 5 ++ adas-core.Domain/Models/Masters/OriginList.cs | 1 + .../Models/Masters/PassiveSittingList.cs | 1 + .../Models/Masters/PatientStatusList.cs | 1 + .../Models/Masters/ProcedureList.cs | 1 + .../Models/Masters/ServiceList.cs | 1 + adas-core.Domain/Models/Masters/TestList.cs | 1 + .../Models/Masters/TherapeuticCeilingList.cs | 1 + .../Models/Masters/TreatmentList.cs | 1 + .../Models/Masters/VisitOptionList.cs | 1 + adas-core.Domain/Models/Medicine.cs | 1 + .../Models/MongoModels/Admission.cs | 3 + .../Models/MongoModels/AlarmConfig.cs | 2 + .../Models/MongoModels/AlarmItem.cs | 2 + .../Models/MongoModels/Authorizations.cs | 1 + adas-core.Domain/Models/MongoModels/Box.cs | 1 + adas-core.Domain/Models/MongoModels/Camera.cs | 2 + .../Models/MongoModels/ConfigObservation.cs | 4 + .../Models/MongoModels/ConfigPumps.cs | 2 + .../Models/MongoModels/ConfigUnits.cs | 2 + adas-core.Domain/Models/MongoModels/Device.cs | 3 + .../Models/MongoModels/Discharge.cs | 1 + .../Models/MongoModels/Display.cs | 1 + .../Models/MongoModels/DisplayCardConfig.cs | 8 ++ .../MongoModels/DisplayCardDetailConfig.cs | 3 + .../Models/MongoModels/DisplayConfig.cs | 64 +++++++++++++ .../MongoModels/HistoricalConfigChanges.cs | 6 ++ .../Models/MongoModels/HistoricalIds.cs | 4 + .../Models/MongoModels/LightBeacon.cs | 2 + adas-core.Domain/Models/MongoModels/Notice.cs | 3 + .../Models/MongoModels/Patient.cs | 5 ++ .../Models/MongoModels/PatientCarePlan.cs | 1 + .../Models/MongoModels/PoCMapping.cs | 2 + .../Models/MongoModels/PoCSettings.cs | 2 + .../Models/MongoModels/PointOfCare.cs | 2 + .../Models/MongoModels/PumpElement.cs | 1 + adas-core.Domain/Models/MongoModels/Relay.cs | 3 + .../Models/MongoModels/Section.cs | 4 + .../Models/MongoModels/ServiceConfig.cs | 1 + .../MongoModels/ServiceConfigService.cs | 2 + .../Models/MongoModels/ServiceConfigTheme.cs | 2 + adas-core.Domain/Models/MongoModels/Step.cs | 2 + adas-core.Domain/Models/MongoModels/Unit.cs | 2 + adas-core.Domain/Models/MongoModels/User.cs | 1 + adas-core.Domain/Models/Note.cs | 2 + .../Models/ObservaitonRetentionResult.cs | 1 + adas-core.Domain/Models/ObservationData.cs | 1 + .../Models/Observations/BoolObservation.cs | 2 + .../Models/Observations/ChartObservation.cs | 2 + .../Models/Observations/DoubleObservation.cs | 2 + .../Models/Observations/FullObservation.cs | 2 + .../Models/Observations/Medication.cs | 14 +++ .../Models/Observations/Observation.cs | 1 + .../ObservationPaginatedResult.cs | 1 + .../Observations/ObservationsRequest.cs | 1 + .../PredictMedicationObservation.cs | 1 + .../Models/Observations/StringObservation.cs | 2 + .../Models/PatientAllergiesValue.cs | 2 + adas-core.Domain/Models/PatientAppointment.cs | 8 ++ adas-core.Domain/Models/PatientDiagnosis.cs | 2 + .../Models/PatientDrainagesValue.cs | 1 + adas-core.Domain/Models/PatientICCA.cs | 2 + .../Models/PatientIntravenousLinesValue.cs | 2 + adas-core.Domain/Models/PatientLocation.cs | 5 ++ .../Models/PatientLocationAction.cs | 3 + adas-core.Domain/Models/PatientObservation.cs | 6 ++ .../Models/PatientObservationAlarm.cs | 3 + .../Models/PatientRecordingAlert.cs | 2 + adas-core.Domain/Models/PatientTreatment.cs | 12 +++ adas-core.Domain/Models/Person.cs | 7 ++ adas-core.Domain/Models/PersonResource.cs | 1 + .../Models/PersonResourceAction.cs | 3 + .../Models/Providers/ProvidersSettings.cs | 1 + .../ResultModelPredictMedicationADAS.cs | 2 + .../Providers/ResultModelPredictOfStayADAS.cs | 2 + .../Models/Pumps/CommonPumpTypes.cs | 4 + .../Models/Pumps/PumpAlarmEvent.cs | 1 + .../Models/Pumps/PumpAlarmState.cs | 1 + .../Models/Pumps/PumpObservation.cs | 1 + adas-core.Domain/Models/Pumps/PumpState.cs | 1 + .../Models/Recording/AccessGrant.cs | 1 + adas-core.Domain/Models/Recording/Patient.cs | 1 + .../Models/Recording/RecordingData.cs | 3 + .../Models/Responses/BeaconResponse.cs | 3 + .../Responses/BoxObservationsResponse.cs | 1 + .../Responses/DisplayConfigMinimalResponse.cs | 1 + .../Models/Responses/LoginResponse.cs | 2 + .../Models/Responses/PaginationResponse.cs | 1 + adas-core.Domain/Models/Responses/Response.cs | 1 + adas-core.Domain/Models/SignalR/Message.cs | 2 + .../Models/SignalR/MessageData.cs | 1 + adas-core.Domain/Models/SignalR/Recording.cs | 1 + .../Models/SystemAlerts/ApiClients.cs | 1 + .../Models/SystemAlerts/Performance.cs | 1 + adas-core.Domain/Models/SystemAlerts/Queue.cs | 1 + adas-core.Domain/Models/Timing.cs | 1 + adas-core.Domain/Models/TreatmentRoute.cs | 2 + adas-core.Domain/Models/UiConfig.cs | 1 + adas-core.Domain/Models/ValueConfig.cs | 1 + .../Models/WebMessageNotification.cs | 1 + adas-core.Domain/Permissions.cs | 2 + adas-core.Domain/QueryCustomizer.cs | 7 ++ adas-core.Domain/Utils/AuthUtils.cs | 2 + adas-core.Domain/Utils/BsonUtils.cs | 3 + adas-core.Domain/Utils/CacheUtils.cs | 45 ++++++++++ .../Utils/CardConfigExtensions.cs | 1 + adas-core.Domain/Utils/CollectionsUtils.cs | 9 ++ .../Utils/ComparableDictionary.cs | 2 + .../Utils/ComplexObjectValueTypeSerializer.cs | 7 ++ adas-core.Domain/Utils/CryptoAdas.cs | 6 ++ .../Utils/DetailConfigExtension.cs | 2 + adas-core.Domain/Utils/DictionaryEx.cs | 4 + adas-core.Domain/Utils/EnumUtils.cs | 2 + adas-core.Domain/Utils/EquatableDictionary.cs | 3 + adas-core.Domain/Utils/GlobalData.cs | 2 + adas-core.Domain/Utils/Hl7Utils.cs | 2 + .../Utils/Interfaces/IMappingUtils.cs | 2 + adas-core.Domain/Utils/JsonExtensions.cs | 2 + adas-core.Domain/Utils/JwtHelper.cs | 4 + adas-core.Domain/Utils/Mapper.cs | 6 ++ adas-core.Domain/Utils/MappingUtils.cs | 3 + adas-core.Domain/Utils/MediaUtils.cs | 4 + adas-core.Domain/Utils/NumberUtils.cs | 3 + adas-core.Domain/Utils/ObjectIdConverter.cs | 7 ++ adas-core.Domain/Utils/ObjectUtils.cs | 3 + adas-core.Domain/Utils/RelayHelper.cs | 4 + adas-core.Domain/Utils/StringEx.cs | 5 ++ .../U_0_1_0_UpdateDataPatien.cs | 1 + .../U_0_1_1_UpdateDisplayConfigDriver.cs | 6 ++ .../U_0_1_2_UpdatePointOfCareConfig.cs | 3 + .../U_0_1_3_UpdateLanguageBarrier.cs | 1 + .../Repositories/AdmissionRepository.cs | 25 ++++++ .../Repositories/AlarmRepository.cs | 7 ++ .../AppointmentArchiveRepository.cs | 8 ++ .../Repositories/AppointmentRepository.cs | 20 +++++ .../ArchivePatientCarePlanRepository.cs | 11 +++ .../Repositories/AuthorityRepository.cs | 12 +++ .../Repositories/CameraRepository.cs | 16 ++++ .../ConfigObservationRepository.cs | 24 +++++ .../Repositories/ConfigPumpsRepository.cs | 8 ++ .../Repositories/ConfigUnitsRepository.cs | 4 + .../Repositories/DeviceRepository.cs | 9 ++ .../DiagnosisArchiveRepository.cs | 7 ++ .../Repositories/DiagnosisRepository.cs | 11 +++ .../Repositories/DischargeRepository.cs | 38 ++++++++ .../DisplayCardConfigRepository.cs | 10 +++ .../DisplayChartConfigRepository.cs | 9 ++ .../Repositories/DisplayConfigRepository.cs | 40 +++++++++ .../DisplayDetailConfigRepository.cs | 12 +++ .../Repositories/DisplayRepository.cs | 30 +++++++ .../HistoricalConfigChangesRepository.cs | 13 +++ .../Repositories/LightBeaconRepository.cs | 11 +++ .../Repositories/MasterListRepository.cs | 71 +++++++++++++++ .../Repositories/MedicineRepository.cs | 16 ++++ .../Repositories/MongoRepository.cs | 12 +++ .../Repositories/NoticeRepository.cs | 17 ++++ .../ObservationArchiveRepository.cs | 12 +++ .../Repositories/ObservationRepository.cs | 51 +++++++++++ .../Repositories/POCMappingRepository.cs | 3 + .../Repositories/PatientArchiveRepository.cs | 10 +++ .../Repositories/PatientCarePlanRepository.cs | 7 ++ .../Repositories/PatientRepository.cs | 29 ++++++ .../Repositories/PoCSettingsRepository.cs | 9 ++ .../Repositories/PointOfCareRepository.cs | 31 +++++++ .../Repositories/PumpAlarmEventRepository.cs | 12 +++ .../Repositories/PumpAlarmStateRepository.cs | 7 ++ .../Repositories/PumpArchiveRepository.cs | 5 ++ .../Repositories/PumpObservationRepository.cs | 15 ++++ .../Repositories/PumpStateRepository.cs | 5 ++ .../RecordingAlertArchiveRepository.cs | 6 ++ .../Repositories/RecordingAlertRepository.cs | 13 +++ .../Repositories/RelayRepository.cs | 11 +++ .../Repositories/SectionRepository.cs | 12 +++ .../Repositories/ServiceConfigRepository.cs | 4 + .../TreatmentArchiveRepository.cs | 6 ++ .../Repositories/TreatmentRepository.cs | 17 ++++ .../Repositories/UnitRepository.cs | 16 ++++ .../Repositories/UserRepository.cs | 14 +++ .../Services/PublisherService.cs | 4 + .../Services/ReceiverService.cs | 8 ++ .../Services/RelayService.cs | 16 ++++ .../Services/SendAlertService.cs | 13 +++ .../Utils/CacheHostBuilderExtension.cs | 1 + .../Utils/CustomPointOfCareConverter.cs | 2 + .../Utils/MongoDbHostBuilderExtension.cs | 5 ++ .../Utils/MongoMaps/AlarmMapContributor.cs | 2 + .../MongoMaps/AppointmentMapContributor.cs | 2 + .../Utils/MongoMaps/AuthMapContributor.cs | 2 + .../MongoMaps/BannerConfigMapContributor.cs | 2 + .../Utils/MongoMaps/BeaconMapContributor.cs | 2 + .../MongoMaps/BoxConfigMapContributor.cs | 1 + .../Utils/MongoMaps/CameraContributor.cs | 2 + .../Utils/MongoMaps/CardMapContributor.cs | 2 + .../Utils/MongoMaps/CellMapContributor.cs | 2 + .../MongoMaps/ColorConfigMapContributor.cs | 2 + .../ComunicationFlowMapContributor.cs | 2 + .../Utils/MongoMaps/DeviceMapContributor.cs | 2 + .../MongoMaps/DisplayHomeConfigContributor.cs | 2 + .../Utils/MongoMaps/DisplayMapContributor.cs | 2 + .../Utils/MongoMaps/FormMapContributor.cs | 2 + .../Utils/MongoMaps/GraphMapContributor.cs | 2 + .../Utils/MongoMaps/HeaderMapContributor.cs | 2 + .../Interfaz/IEntityMapContributor.cs | 1 + .../MongoMaps/MasterListMapContributor.cs | 2 + .../MongoMaps/NoticeControlMapContributor.cs | 2 + .../Utils/MongoMaps/ObsUnitMapContributor.cs | 2 + .../MongoMaps/ObservationMapContributor.cs | 2 + .../Utils/MongoMaps/PatientMapContributor.cs | 2 + .../Utils/MongoMaps/PoCMapContributor.cs | 2 + .../Utils/MongoMaps/PumpMapContributor.cs | 1 + .../Utils/MongoMaps/RelayContributor.cs | 2 + .../Utils/MongoMaps/RowMapContributor.cs | 2 + .../Utils/MongoMaps/SectionMapContributor.cs | 2 + .../MongoMaps/ServiceConfigMapContributor.cs | 2 + .../Utils/MongoMaps/StandardMapContributor.cs | 2 + .../MongoMaps/TreatmentMapContributor.cs | 2 + .../Utils/MongoMaps/UnitMapContributor.cs | 2 + adas-core.Infrastructure/Utils/MongoUtils.cs | 1 + .../Utils/PatientObservationAlarmConverter.cs | 7 ++ .../Utils/PatientObservationConverter.cs | 7 ++ .../Utils/PatientPumpObservationConverter.cs | 8 ++ .../Utils/PersonConverter.cs | 7 ++ .../Utils/RabbitConsumerErrorStrategy.cs | 4 + .../Utils/RabbitIErrorMessageSerializer.cs | 3 + adas-core.Infrastructure/Utils/TypesUtils.cs | 2 + .../Configuration/LDAPModule.cs | 2 + .../Configuration/LdapConfig.cs | 3 + .../Configuration/LdapConfigValidator.cs | 1 + adas-core.LdapLogin/IModule.cs | 2 + adas-core.LdapLogin/LdapLoginService.cs | 18 ++++ .../RegistrationExtension/LdapRegistration.cs | 2 + adas-core.LocalLogin/ILocalLoginRepository.cs | 6 ++ adas-core.LocalLogin/LocalLoginRepository.cs | 12 +++ adas-core.LocalLogin/LocalLoginServiceImpl.cs | 8 ++ .../LocalLoginExtension.cs | 2 + .../H12O/UCIN/CalculatedObservationsTest.cs | 6 ++ .../HPAZ/CalculatedObservationsTest.cs | 19 ++++ .../HRYC/CalculatedObservationsTest.cs | 2 + .../HUVH/UCIA/CalculatedObservationsTest.cs | 31 +++++++ .../HUVH/UCIN/CalculatedObservationsTest.cs | 21 +++++ adas-core.Test/Models/FakeLogger.cs | 12 +++ .../Models/SignalR/SubscriberGroupedTest.cs | 6 ++ .../Repositories/AdmissionRepositoryTest.cs | 18 ++++ .../Repositories/AlarmRepositoryTest.cs | 8 ++ .../AppointmentArchiveRepositoryTest.cs | 2 + .../Repositories/AppointmentRepositoryTest.cs | 9 ++ .../ConfigObservationRepositoryTest.cs | 6 ++ .../Repositories/ConfigPumpsRepositoryTest.cs | 4 + .../Repositories/ConfigUnitsRepositoryTest.cs | 3 + .../DiagnosisArchiveRepositoryTest.cs | 2 + .../Repositories/DiagnosisRepositoryTest.cs | 10 +++ .../Repositories/DischargeRepositoryTest.cs | 18 ++++ .../Repositories/DisplayConfigTest.cs | 3 + .../Repositories/DisplayRepisitoryTest.cs | 1 + .../HistoricalConfigChangesRepositoryTest.cs | 8 ++ adas-core.Test/Repositories/IntegrationDb.cs | 3 + .../Repositories/MasterListRepositoryTest.cs | 8 ++ .../Repositories/MedicineRepositoryTest.cs | 6 ++ .../Repositories/MongodbMigrationTest.cs | 6 ++ .../ObservationArchiveRepositoryTest.cs | 1 + .../Repositories/ObservationRepositoryTest.cs | 51 +++++++++++ .../PatientArchiveRepositoryTest.cs | 4 + .../Repositories/PatientRepositoryTest.cs | 14 +++ .../Repositories/PoCMappingRepositoryTest.cs | 3 + .../Repositories/PoCSettingsRepositoryTest.cs | 6 ++ .../PointOfCareRepositoryTests.cs | 9 ++ .../PumpAlarmEventRepositoryTest.cs | 16 ++++ .../PumpAlarmStateRepositoryTest.cs | 10 +++ .../Repositories/PumpArchiveRepositoryTest.cs | 1 + .../PumpObservationRepositoryTest.cs | 4 + .../Repositories/PumpStateRepositoryTest.cs | 6 ++ .../RecordingAlertArchiveRepositoryTest.cs | 2 + .../RecordingAlertRepositoryTest.cs | 8 ++ .../ServiceConfigRepositoryTest.cs | 3 + .../TreatmentArchiveRepositoryTest.cs | 3 + .../Repositories/TreatmentRepositoryTest.cs | 8 ++ .../Repositories/UnitRepositoryTest.cs | 8 ++ .../Repositories/UserRepositoryTest.cs | 2 + .../Services/AdmissionServiceTest.cs | 15 ++++ adas-core.Test/Services/AlarmServiceTest.cs | 5 ++ .../Services/CacheDispatcherTest.cs | 32 +++++++ adas-core.Test/Services/CacheServiceTest.cs | 7 ++ adas-core.Test/Services/CameraServiceTest.cs | 3 + .../Services/ConfigObservationServiceTest.cs | 19 ++++ .../Services/ConfigPumpsServiceTest.cs | 5 ++ .../Services/ConfigUnitsServiceTest.cs | 5 ++ .../Services/DiagnosisServiceTest.cs | 8 ++ .../Services/DischargeServiceTest.cs | 11 +++ adas-core.Test/Services/DisplayServiceTest.cs | 15 ++++ .../Services/GroupedObservationServiceTest.cs | 7 ++ .../HistoricalConfigChangesServiceTest.cs | 8 ++ .../Services/InMemoryLockProviderTest.cs | 7 ++ .../Services/LightBeaconServiceTest.cs | 2 + .../Services/MasterListServiceTest.cs | 6 ++ .../Services/MedicineServiceTest.cs | 2 + adas-core.Test/Services/NoCacheServiceTest.cs | 6 ++ .../Services/ObservationServiceTest.cs | 3 + adas-core.Test/Services/PatientServiceTest.cs | 45 ++++++++++ .../Services/PointOfCareServiceTest.cs | 9 ++ .../Services/PublisherServiceTest.cs | 3 + adas-core.Test/Services/PumpServiceTest.cs | 15 ++++ .../Services/RecordingAlertServiceTest.cs | 5 ++ .../Services/RecordingServiceTest.cs | 4 + .../Services/RedisLockProviderTest.cs | 6 ++ adas-core.Test/Services/RedisServiceTest.cs | 13 +++ adas-core.Test/Services/RelayServiceTest.cs | 6 ++ .../Services/SchedulerServiceTest.cs | 7 ++ .../Services/SendAlertServiceTest.cs | 4 + .../Services/SeviceConfigServiceTest.cs | 3 + .../Services/TreatmentServiceTest.cs | 6 ++ adas-core.Test/Services/UnitServiceTest.cs | 16 ++++ .../Utilities/CacheKeyClassifierTest.cs | 33 +++++++ adas-core.Test/Utilities/TestUtilities.cs | 12 +++ .../Devices/LightBeacon.cs | 7 ++ .../Devices/LightBeaconAbstract.cs | 6 ++ .../Devices/Turktbens2LightBeacon.cs | 17 ++++ .../Services/LightBeaconService.cs | 22 +++++ .../Devices/HttpDevice.cs | 6 ++ .../Devices/IProxyDevice.cs | 4 + .../ProxyDeviceSettings.cs | 2 + .../Services/IProxyDeviceService.cs | 3 + .../Services/ProxyDeviceService.cs | 9 ++ adas-core.module.Relays/Devices/FakeRelay.cs | 25 ++++++ .../Devices/KMTronicRelay.cs | 27 ++++++ .../Devices/KMTronicV2Relay.cs | 31 +++++++ .../Devices/RelayDevice.cs | 22 +++++ .../Models/PowerOutletsConfig.cs | 2 + .../Models/RelaySettings.cs | 1 + adas-core.module.Relays/Utils/HttpUtils.cs | 2 + adas-core/Configurations/ServiceExtension.cs | 4 + adas-core/Controllers/AdmissionController.cs | 13 +++ adas-core/Controllers/AlarmController.cs | 4 + .../Controllers/ApplicationController.cs | 10 +++ adas-core/Controllers/AuditController.cs | 3 + adas-core/Controllers/BoxController.cs | 4 + adas-core/Controllers/CameraController.cs | 7 ++ .../Controllers/ConfigDisplayController.cs | 57 ++++++++++++ .../ConfigObservationController.cs | 31 +++++++ adas-core/Controllers/DeviceController.cs | 7 ++ adas-core/Controllers/DiagnosisController.cs | 1 + adas-core/Controllers/DischargeController.cs | 6 ++ adas-core/Controllers/DisplayController.cs | 65 ++++++++++++++ .../GroupedObservationsController.cs | 1 + .../Controllers/LightBeaconController.cs | 9 ++ adas-core/Controllers/MasterListController.cs | 31 +++++++ adas-core/Controllers/MedicinesController.cs | 10 +++ adas-core/Controllers/NoticeController.cs | 6 ++ .../Controllers/ObservationsController.cs | 7 ++ .../PatientAppointmentController.cs | 1 + adas-core/Controllers/PatientController.cs | 27 ++++++ .../Controllers/PointOfCareController.cs | 18 ++++ .../Controllers/ProxyDeviceController.cs | 3 + adas-core/Controllers/PumpsController.cs | 8 ++ adas-core/Controllers/RabbitController.cs | 2 + .../Controllers/RecordingAlertController.cs | 2 + adas-core/Controllers/RelayController.cs | 15 ++++ adas-core/Controllers/SendAlertController.cs | 6 ++ .../Controllers/ServiceConfigController.cs | 1 + adas-core/Controllers/TreatmentsController.cs | 6 ++ adas-core/Controllers/UnitController.cs | 27 ++++++ adas-core/Controllers/UserController.cs | 24 +++++ .../ErrorMiddleware/ErrorHandlerMiddleware.cs | 2 + adas-core/Logging/LogExecutionContext.cs | 3 + adas-core/Logging/LogProvider.cs | 5 ++ adas-core/WebSocket/Hubs/UciHub.cs | 5 ++ .../WebSocket/WebSocketMessageService.cs | 31 +++++++ 654 files changed, 5260 insertions(+) diff --git a/adas-core.Application/Customizations/BD/CalculatedObservations.cs b/adas-core.Application/Customizations/BD/CalculatedObservations.cs index ddccb59a..566ad128 100644 --- a/adas-core.Application/Customizations/BD/CalculatedObservations.cs +++ b/adas-core.Application/Customizations/BD/CalculatedObservations.cs @@ -14,6 +14,7 @@ namespace adas_core.Application.Customizations.BD; /// /// This type is instantiated with a primary constructor that accepts an to resolve its dependencies. /// +/// public class CalculatedObservations(IServiceProvider serviceProvider) : ICalculatedObservations { private readonly ILogger _logger = @@ -29,6 +30,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The patient observation to map. /// Indicates whether the mapping should match observations by name only. /// A containing the provided observation. + /// public Task Map(T obs, bool onlyByName = false) where T : BasePatientObservation { return Task.FromResult(obs)!; @@ -39,6 +42,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The patient treatment instance to map. /// A completed containing the provided treatment. + /// public Task Map(PatientTreatment treatment) { return Task.FromResult(treatment); @@ -49,6 +53,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The instance to map. /// A containing the provided . + /// public Task Map(PatientDiagnosis diagnosis) { return Task.FromResult(diagnosis); @@ -59,6 +64,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The pump observation to be mapped. /// The mapped pump observation. + /// public async Task Map(PumpObservation pumpObservation) { if (pumpObservation.Code == "IHE PCD-04") @@ -71,6 +77,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The list of active medicines associated with the patient. /// The unique identifier of the patient for whom the observations are calculated. + /// public Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { return Task.CompletedTask; @@ -81,6 +88,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The unique identifier of the patient whose active bolus is being calculated. /// A task that represents the asynchronous calculation of the active bolus. + /// public Task CalculateActiveBolus(ObjectId patientId) { return Task.CompletedTask; @@ -92,6 +101,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The unique identifier of the patient whose active treatments are being requested. /// A task that represents the asynchronous operation, containing an of nullable entries for the patient's active treatments. /// Thrown to indicate that the method is not yet implemented. + /// public Task> GetActiveTreatmentsByPatient(ObjectId id) { throw new NotImplementedException(); @@ -103,6 +113,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The new patient observation to be reconciled against the last stored observation. /// A task that yields the time-corrected , or null when no correction is required or no prior observation exists. /// Thrown because the method has not been implemented yet. + /// public Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { throw new NotImplementedException(); @@ -114,6 +125,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The list of patient observations to be pre-mapped before insertion. /// A task containing the provided list of patient observations. + /// public Task> PreMapList(List listToInsert) { return Task.FromResult(listToInsert); @@ -126,6 +138,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The source alarm to be inserted/mapped into the observation. /// A that represents the asynchronous mapping operation, returning the resulting patient observation. /// Thrown because the method has not been implemented yet. + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { throw new NotImplementedException(); @@ -139,6 +152,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The optional alarm code that categorizes the alarm; may be null. /// A task that represents the asynchronous alarm sending operation. /// Thrown because the method is not yet implemented. + /// public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { throw new NotImplementedException(); @@ -152,6 +166,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The pump observation containing the alarm state, type, timestamps, and identifiers used to build the alarm patient observation. /// A completed representing the insert operation, which never faults since exceptions are caught internally. + /// private Task CreatePumpAlarmObservation(PumpObservation pumpObservation) { PatientObservation patientObservationAlarm = new() diff --git a/adas-core.Application/Customizations/CHUO/CalculatedObservations.cs b/adas-core.Application/Customizations/CHUO/CalculatedObservations.cs index e336105c..be68b0c2 100644 --- a/adas-core.Application/Customizations/CHUO/CalculatedObservations.cs +++ b/adas-core.Application/Customizations/CHUO/CalculatedObservations.cs @@ -14,6 +14,7 @@ namespace adas_core.Application.Customizations.CHUO; /// /// Instances are constructed with an used to resolve dependencies required by the implementation. /// +/// public class CalculatedObservations(IServiceProvider serviceProvider) : ICalculatedObservations { private readonly ILogger _logger = @@ -23,6 +24,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// Asynchronously calculates the active bolus for the specified patient. /// /// The unique identifier of the patient for whom the active bolus is being calculated. + /// public Task CalculateActiveBolus(ObjectId patientId) { return Task.CompletedTask; @@ -33,6 +35,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The pump observation to map. /// A containing the provided pump observation. + /// public async Task Map(PumpObservation pumpObservation) { return await Task.FromResult(pumpObservation); @@ -43,6 +46,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The list of medicines currently active for the patient. /// The identifier of the patient for whom the observation is calculated. + /// public Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { return Task.CompletedTask; @@ -55,6 +60,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The new patient observation to compare and reconcile against the last stored observation. /// A task that yields the corrected , or null when no time inconsistency is found. /// Thrown because the method has not been implemented yet. + /// public Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { throw new NotImplementedException(); @@ -66,6 +72,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The unique identifier of the patient whose active treatments are being requested. /// A task that represents the asynchronous operation. The task result contains a collection of nullable objects representing the patient's active treatments. /// Thrown to indicate that the method has not yet been implemented. + /// public Task> GetActiveTreatmentsByPatient(ObjectId id) { throw new NotImplementedException(); @@ -77,6 +84,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The patient observation to map. /// Indicates whether mapping should be performed by name only. /// A task containing the provided observation. + /// public Task Map(T obs, bool onlyByName = false) where T : BasePatientObservation { _logger.LogTrace("Mapping {name} observation {obs}", obs.Name, obs); @@ -91,6 +99,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The patient treatment to be mapped. /// A task that represents the asynchronous mapping operation, containing the resulting . /// Thrown when the method is invoked, as the mapping has not been implemented. + /// public Task Map(PatientTreatment treatment) { throw new NotImplementedException(); @@ -102,6 +111,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The patient diagnosis to be mapped. /// A task representing the asynchronous operation, containing the mapped . /// Thrown because the mapping logic has not yet been implemented. + /// public Task Map(PatientDiagnosis diagnosis) { throw new NotImplementedException(); @@ -113,6 +123,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The list of patient observations to be pre-mapped prior to insertion. /// A completed task containing the provided list of patient observations. + /// public Task> PreMapList(List listToInsert) { return Task.FromResult(listToInsert); @@ -124,6 +135,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The existing patient observation to be returned. /// The alarm to be associated with the observation (currently not applied). /// A completed containing the original observation. + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { return Task.FromResult(obs); @@ -135,6 +147,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The patient observation that triggers the alarm. /// The name of the alarm to send. /// The optional alarm code providing additional classification for the alarm. + /// public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { return Task.CompletedTask; diff --git a/adas-core.Application/Customizations/H12O/UCIN/CalculatedObservations.cs b/adas-core.Application/Customizations/H12O/UCIN/CalculatedObservations.cs index c64f833c..8f3f05c9 100644 --- a/adas-core.Application/Customizations/H12O/UCIN/CalculatedObservations.cs +++ b/adas-core.Application/Customizations/H12O/UCIN/CalculatedObservations.cs @@ -17,6 +17,7 @@ namespace adas_core.Application.Customizations.H12O.UCIN; /// raw observations and active entries, using the catalogue of /// codes, groups, and types configured in . /// +/// public class CalculatedObservations : ICalculatedObservations { private readonly List _complexityObservations = @@ -87,6 +88,8 @@ public class CalculatedObservations : ICalculatedObservations /// ONi, ventilation modes, ECMO, and notes indicating medication) from . /// /// The application's service provider used to resolve the required dependencies and configuration. + /// public CalculatedObservations(IServiceProvider serviceProvider) { _observationService = serviceProvider.GetRequiredService>(); //observationService; @@ -159,6 +162,8 @@ public class CalculatedObservations : ICalculatedObservations /// A that resolves to the (possibly transformed) observation, or /// when the input observation has no name. /// + /// public async Task Map(T obs, bool onlyByName) where T : BasePatientObservation { // Early exit: if the observation has no name, there's nothing to map @@ -244,6 +249,8 @@ public class CalculatedObservations : ICalculatedObservations /// The to be mapped. /// A task that represents the asynchronous mapping operation. The task result contains the processed . /// Thrown when the parameter is null. + /// public async Task Map(PatientTreatment treatment) { if (treatment.SingleDose) @@ -316,6 +323,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The pump observation to map. /// A task containing the same instance that was passed in. + /// public async Task Map(PumpObservation pumpObservation) { return await Task.FromResult(pumpObservation); @@ -330,6 +338,7 @@ public class CalculatedObservations : ICalculatedObservations /// The list of active instances currently associated with the patient. /// The unique identifier of the patient. /// A task that represents the asynchronous calculation operation. + /// public async Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { await CalculateMedicineObservation(activeMedicines, [], new PatientTreatment { PatientId = patientId }); @@ -342,6 +351,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The unique identifier of the patient. /// A task that represents the asynchronous calculation operation. + /// public async Task CalculateActiveBolus(ObjectId patientId) { // SIN RXA @@ -395,6 +405,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The unique identifier of the patient. /// A collection of active objects for the patient. + /// public async Task> GetActiveTreatmentsByPatient(ObjectId id) { var activeTreatments = await _treatmentService.Value.GetActiveTreatmentsByPatient(id); @@ -409,6 +420,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The to map. /// A task containing the same instance that was passed in. + /// public Task Map(PatientDiagnosis diagnosis) { return Task.FromResult(diagnosis); @@ -425,6 +437,8 @@ public class CalculatedObservations : ICalculatedObservations /// A task that represents the asynchronous operation. The task result contains the fixed /// if the input had a valid name; otherwise, . /// + /// public async Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { if (string.IsNullOrEmpty(newObservation.Name)) @@ -460,6 +474,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The list of patient observations to be pre-mapped. /// A task containing the original list of patient observations. + /// public Task> PreMapList(List listToInsert) { return Task.FromResult(listToInsert); @@ -473,6 +488,7 @@ public class CalculatedObservations : ICalculatedObservations /// The patient observation that triggered the alarm. /// The alarm metadata to be inserted alongside the observation. /// A task containing the same instance that was passed in. + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { return Task.FromResult(obs); @@ -487,6 +503,7 @@ public class CalculatedObservations : ICalculatedObservations /// The optional alarm code from . /// Never returns a result. /// Always thrown because alarm dispatch is not implemented in the UCIN customization. + /// public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { throw new NotImplementedException(); @@ -501,6 +518,8 @@ public class CalculatedObservations : ICalculatedObservations /// A task that represents the asynchronous insert operation. /// Thrown when cannot be cast to . /// Rethrown after the underlying exception is written to the console for diagnostics. + /// public async Task CheckSurgeryExpired(BasePatientObservation obs) { try @@ -536,6 +555,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation expected to be a . /// A task that represents the asynchronous operation. The task result contains the (possibly time-shifted) base patient observation. + /// public async Task CheckObsExistsAndIncrementTime(BasePatientObservation obs) { var pobs = (PatientObservation)obs; @@ -559,6 +579,8 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation expected to be a . /// A task that represents the asynchronous operation. The task result contains the (possibly time-shifted) base patient observation. + /// public async Task CheckObsWithSameTimeExistsAndIncrementTime(BasePatientObservation obs) { var pobs = (PatientObservation)obs; @@ -579,6 +601,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The observation that triggered the calculation (one of AirPressure_Mean, FiO2, or PaO2). /// A task that represents the asynchronous calculation operation. + /// public async Task CalculateOxygenationIndex(BasePatientObservation obs) { var toSearchList = new List(); @@ -655,6 +678,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The single-dose treatment whose end time is to be calculated. /// The same instance with its EndTime updated. + /// private static PatientTreatment CalculateSingleDoseEndDate(PatientTreatment treatment) { /* Deprecated calc finish treatment date on shift end. Now every treatment single dose is last 8 Hours @@ -690,6 +714,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The treatment whose medicines should be checked. /// A task that represents the asynchronous check operation. + /// public async Task CheckTreatmentMedicines(PatientTreatment treatment) { //sI TIENE UNA NOTA CON NPT SON DE TIPO NUTRICIÓN PARENTERAL Y SUMAN 1 @@ -784,6 +809,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The treatment to inspect for NPT indicators, or . /// A task that resolves to a instance describing the parenteral nutrition, or an unnamed, untyped instance when no NPT notes are present. + /// private static Task CalculateParentalNutritionMedicine(PatientTreatment? treatment) { List medicineType = []; @@ -818,6 +844,7 @@ public class CalculatedObservations : ICalculatedObservations /// The medicines to add or remove depending on OrderControl. /// The treatment that triggered the recalculation. /// A task that represents the asynchronous calculation operation. + /// public async Task CalculateMedicineObservation(List activeMedicines, List medicines, PatientTreatment treatment) { @@ -876,6 +903,7 @@ public class CalculatedObservations : ICalculatedObservations /// The list of active medicines used to derive the risk level. /// The treatment that triggered the recalculation. /// A task that represents the asynchronous calculation operation. + /// private async Task CalculateErMedication(List activeMedicines, PatientTreatment treatment) { //var activeTreatments = treatmentService.Value.GetActiveTreatmentsByPatient(treatment.patientid); @@ -908,6 +936,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The list of active medicines to evaluate. /// A task that resolves to the integer risk level (0–5). + /// private static Task CalculateErMedicineLevels(List activeMedicines) { var ironVitaminDCodes = new List { "374424002", "175041000140104" }; @@ -964,6 +993,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The respiratory-mode observation expected to be a . /// A task that represents the asynchronous insert operation. + /// public async Task CalculateVentilationMode(BasePatientObservation obs) { var pobs = (PatientObservation)obs; @@ -998,6 +1028,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation (expected to be a ). /// A task that resolves to the same base patient observation that was passed in. + /// public async Task CalculateAsistResp(BasePatientObservation obs) { //Comprobar si hay un resp_type más nuevo y si no lo hay ignorar @@ -1057,6 +1088,8 @@ public class CalculatedObservations : ICalculatedObservations /// /// The treatment whose ECMO state is being applied. /// A task that represents the asynchronous recalculation operation. + /// private async Task CalculateComplexityOnEcmo(PatientTreatment treatment) { var ecmoObs = new PatientObservation @@ -1102,6 +1135,7 @@ public class CalculatedObservations : ICalculatedObservations /// The base patient observation that triggered the recalculation. /// When , the supplied is not added to the calculation inputs (useful for synthetic observations like ECMO). /// A task that resolves to the same base patient observation that was passed in. + /// public async Task CalculateComplexity(BasePatientObservation obs, bool ignoreObs = false) { try @@ -1278,6 +1312,7 @@ public class CalculatedObservations : ICalculatedObservations /// early because the incoming observation is a duplicate insert (in which case the caller should /// not overwrite the stored observation). /// + /// public async Task CalculateIntravenousLineObservation(BasePatientObservation obs) { try @@ -1413,6 +1448,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation whose value represents the patient's weight. /// A task that resolves to the integer complexity contribution (0–7). + /// private async Task CalculateWeight(BasePatientObservation obs) { var complexityValueOfWeight = 0; @@ -1445,6 +1481,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation expected to be a with a numeric value. /// A task that resolves to the (possibly converted) base patient observation. + /// public Task ParseWeight(BasePatientObservation obs) { if (obs is not PatientObservation pobs || !double.TryParse(pobs.Value.ToString(), out var dValue)) @@ -1471,6 +1508,7 @@ public class CalculatedObservations : ICalculatedObservations /// derived from whichever type is supplied. /// /// A task that represents the asynchronous calculation operation. + /// public async Task CalculateMonitor(object monitorObservation) { var monitorValue = 0; @@ -1545,6 +1583,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The treatment that triggered the recalculation. /// A task that represents the asynchronous calculation operation. + /// private async Task CalculateSurgery(PatientTreatment treatment) { var surgeryScore = 0; @@ -1596,6 +1635,7 @@ public class CalculatedObservations : ICalculatedObservations /// The unique identifier of the patient. /// The optional new treatment to be included in the active-bolus set. /// A task that resolves to the list of treatments currently counted as active boluses. + /// private async Task> GetActiveBolus(ObjectId patientId, PatientTreatment? newTreatment) { var treatmentsProcessed = new List(); @@ -1660,6 +1700,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The treatment that triggered the recalculation and should be included in the active-bolus set. /// A task that represents the asynchronous insert operation. + /// private async Task CalculateBolus(PatientTreatment treatment) { var activeBolus = await GetActiveBolus(treatment.PatientId, treatment); @@ -1686,6 +1727,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the alert evaluation (TAm, Age_Gestational, or Age_Gestational_Fixed). /// A task that represents the asynchronous calculation operation. + /// public async Task CalculateTAmAlert(BasePatientObservation obs) { var pobs = (PatientObservation)obs; @@ -1749,6 +1791,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation (Temp_Patient or Temp_Incubator). /// A task that represents the asynchronous calculation operation. + /// public async Task CalculateTempGradient(BasePatientObservation obs) { List tempRetrievedesFromBd; diff --git a/adas-core.Application/Customizations/HGM/CalculatedObservations.cs b/adas-core.Application/Customizations/HGM/CalculatedObservations.cs index 59a2b41e..ea3c5800 100644 --- a/adas-core.Application/Customizations/HGM/CalculatedObservations.cs +++ b/adas-core.Application/Customizations/HGM/CalculatedObservations.cs @@ -14,6 +14,7 @@ namespace adas_core.Application.Customizations.HGM; /// /// Represents a collection of calculated observations, providing a concrete implementation of the contract. /// +/// public class CalculatedObservations : ICalculatedObservations { private readonly List _highFrequencyVentilation = []; @@ -51,6 +52,8 @@ public class CalculatedObservations : ICalculatedObservations /// The patient observation to be mapped. /// Flag indicating whether the mapping should be restricted to name-based criteria. /// The mapped patient observation, or the original observation if no applicable mapping is found. + /// public async Task Map(T obs, bool onlyByName = false) where T : BasePatientObservation { if (string.IsNullOrEmpty(obs.Name)) return obs; @@ -72,6 +75,7 @@ public class CalculatedObservations : ICalculatedObservations /// The instance to be mapped. /// A task that represents the asynchronous mapping operation, containing the resulting . /// Thrown to indicate that the method has not yet been implemented. + /// public Task Map(PatientTreatment treatment) { throw new NotImplementedException(); @@ -83,6 +87,7 @@ public class CalculatedObservations : ICalculatedObservations /// The patient diagnosis to be mapped. /// A task that represents the asynchronous mapping operation, containing the mapped . /// Thrown when the method is invoked, as the mapping logic has not been implemented yet. + /// public Task Map(PatientDiagnosis diagnosis) { throw new NotImplementedException(); @@ -93,6 +98,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The pump observation to map. /// A completed task containing the provided . + /// public async Task Map(PumpObservation pumpObservation) { return await Task.FromResult(pumpObservation); @@ -104,6 +110,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The unique identifier of the patient for whom the active bolus is calculated. /// The method is not yet implemented. + /// public Task CalculateActiveBolus(ObjectId patientId) { throw new NotImplementedException(); @@ -115,6 +122,7 @@ public class CalculatedObservations : ICalculatedObservations /// The list of active medicines currently associated with the patient. /// The unique identifier of the patient for whom the observation is being calculated. /// The method is not yet implemented. + /// public Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { throw new NotImplementedException(); @@ -126,6 +134,7 @@ public class CalculatedObservations : ICalculatedObservations /// The new patient observation to reconcile against the last recorded observation. /// A task that returns the corrected , or null when no last observation is available to compare against. /// The method is not yet implemented. + /// public Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { throw new NotImplementedException(); @@ -137,6 +146,7 @@ public class CalculatedObservations : ICalculatedObservations /// The identifier of the patient whose active treatments are being requested. /// A task that yields a collection of active entries for the patient. /// Thrown because the method has not been implemented yet. + /// public Task> GetActiveTreatmentsByPatient(ObjectId id) { throw new NotImplementedException(); @@ -147,6 +157,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The list of patient observations to be pre-mapped. /// A completed task containing the provided list of patient observations. + /// public Task> PreMapList(List listToInsert) { return Task.FromResult(listToInsert); @@ -158,6 +169,7 @@ public class CalculatedObservations : ICalculatedObservations /// The patient observation to return as the mapped result. /// The patient observation alarm to be considered during mapping. /// A containing the provided . + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { return Task.FromResult(obs); @@ -171,6 +183,7 @@ public class CalculatedObservations : ICalculatedObservations /// The optional alarm code identifying the alarm type. /// A task that represents the asynchronous alarm sending operation. /// Thrown when the method is invoked, as it is not yet implemented. + /// public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { throw new NotImplementedException(); @@ -180,6 +193,7 @@ public class CalculatedObservations : ICalculatedObservations /// Calculates and persists the ventilation mode (Resp_Type) for a patient observation by mapping the observed value against known high-frequency, invasive, and non-invasive ventilation vocabularies, defaulting to None when the value is empty or unrecognized. /// /// The base patient observation whose value is used to derive the respiration type; it is cast to to access the value. + /// private async Task CalculateVentilationMode(BasePatientObservation obs) { var pobs = (PatientObservation)obs; diff --git a/adas-core.Application/Customizations/HPAZ/CalculatedObservations.cs b/adas-core.Application/Customizations/HPAZ/CalculatedObservations.cs index acacd293..9be31de1 100644 --- a/adas-core.Application/Customizations/HPAZ/CalculatedObservations.cs +++ b/adas-core.Application/Customizations/HPAZ/CalculatedObservations.cs @@ -17,6 +17,7 @@ namespace adas_core.Application.Customizations.HPAZ; /// /// This class implements the contract, exposing the behavior defined by that interface while relying on constructor-injected services for its operations. /// +/// public class CalculatedObservations(IServiceProvider serviceProvider) : ICalculatedObservations { private readonly Lazy _alarmService = serviceProvider.GetRequiredService>(); @@ -42,6 +43,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// Asynchronously calculates the active bolus for the specified patient. /// /// The unique identifier of the patient whose active bolus is to be calculated. + /// public Task CalculateActiveBolus(ObjectId patientId) { return Task.CompletedTask; @@ -52,6 +55,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The list of medicines currently active for the patient. /// The unique identifier of the patient whose medicine observations are being calculated. + /// public Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { return Task.CompletedTask; @@ -63,6 +68,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The unique identifier of the patient whose active treatments are being retrieved. /// A task that represents the asynchronous operation, containing a collection of active records for the patient, or an empty collection if none exist. + /// public Task> GetActiveTreatmentsByPatient(ObjectId id) { return Task.FromResult>(new List()); @@ -75,6 +82,10 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// Observation /// True if the observation needs to generate an alert /// Mapped observation + /// + /// public async Task Map(T source, bool onlyByName) where T : BasePatientObservation { _logger.LogDebug("Mapping {obsName} mode observation {obs}", source.Name, source); @@ -113,6 +124,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The source to map. /// A task that represents the asynchronous mapping operation. The task result contains the mapped . + /// public async Task Map(PumpObservation pumpObservation) { try @@ -212,6 +225,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The to be mapped. /// A task representing the asynchronous operation, containing the mapped . /// Thrown in all cases because the method has not yet been implemented. + /// public Task Map(PatientTreatment treatment) { throw new NotImplementedException(); @@ -223,6 +237,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The to be mapped. /// A task that represents the asynchronous operation, containing the mapped . /// Thrown to indicate that the mapping logic has not been implemented. + /// public Task Map(PatientDiagnosis diagnosis) { throw new NotImplementedException(); @@ -234,6 +249,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The new patient observation to validate and potentially adjust for time consistency. /// The patient observation with its time corrected if a time inconsistency was detected, otherwise the original observation. + /// public async Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { if (string.IsNullOrEmpty(newObservation.Name)) @@ -267,6 +283,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The list of patient observations to process for mapping and blue code calculation. /// The original list of patient observations passed to the method. + /// public Task> PreMapList(List listToMap) { var mappedObsList = listToMap @@ -290,6 +307,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The target instance that will be updated with values from the alarm. /// The source whose values are applied to . /// A completed containing the updated . + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { if (!string.IsNullOrEmpty(alarmToInsert.EventId)) @@ -310,6 +328,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The name of the alarm to be sent. /// The optional alarm code identifying the type of alarm. /// Thrown because the method is not yet implemented. + /// Task ICalculatedObservations.SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { throw new NotImplementedException(); @@ -323,6 +342,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The name of the alarm. /// The optional alarm code identifier. /// The type of alarm to send. + /// private async Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code, AlarmEnum.Type type) { await _alarmService.Value.SendAlarm(obs, name, code, AlarmEnum.Severity.None, type); @@ -334,6 +354,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// Observation /// True if it needs to be ignored + /// private bool CheckIfObservationIsOlderAndShouldBeIgnored(PatientObservation obs) { if (obs.Time.ToUniversalTime().AddMinutes(_apiSettings.IgnoreCalcObservationsOlderInMinutesThan) < @@ -354,6 +375,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The patient observation whose alarm configuration should be resolved; its Name and PatientId are used to locate the configuration. /// The same instance with its Alarm property populated from the matching configuration, or null when no configuration is found. + /// private async Task CheckAlarmConfig(PatientObservation pobs) { var configObs = await _configObservationService.Get(new PatientObservation @@ -373,6 +395,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The alarm code used to identify the type of alarm; it is set as the Code and used to compose the Name. /// The source patient observation whose value, patient identifier, time, and alarm flag are copied into the new alarm observation. /// A new configured as an ADAS alarm observation based on the provided source. + /// private static PatientObservation CreateAlarmObservation(string name, PatientObservation pobs) { return new PatientObservation @@ -391,6 +414,10 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// Checks if a blue code observation Lists needs to be generated and inserts it. /// /// + /// + /// public async Task CalculateBlueCodeList(List? obsList) { //Las 3 observaciones vienen siempre juntas en el mismo mensaje @@ -461,6 +488,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// Sends a Blue Code alarm for the given patient observation. If the observation is null, the method returns without taking any action; otherwise it creates the corresponding alarm observation, validates it against the alarm configuration, persists it, and dispatches the alarm as an automatically triggered Blue alarm. /// /// The patient observation that triggers the Blue Code alarm; when null, the method short-circuits without processing. + /// private async Task SendBlueCode(PatientObservation? pobs) { if (pobs == null) @@ -486,6 +514,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The base patient observation value whose ventilation mode will be calculated and normalized. /// The patient observation with the normalized ventilation mode value. + /// private BasePatientObservationValue CalculateVentilationMode(BasePatientObservationValue obs) { var value = obs is PatientObservationAlarm oAlarm ? oAlarm.Value @@ -508,6 +537,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The patient observation to evaluate; non- instances are returned unchanged. /// The original observation, with its Time adjusted by one second when a matching observation is found. + /// private async Task CheckObsWithSameTimeExistsAndIncrementTime( BasePatientObservationValue obs) { @@ -529,6 +559,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The newly received patient observation that triggered the calculation; its Name must be either "FiO2" or "Sattc". /// The name of the observation, used to determine whether is the FiO2 or the Sattc value. + /// private async Task CalculateSf(BasePatientObservationValue obs, string name) { try @@ -590,6 +622,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// calculation if they are not /// in database then does nothing. /// + /// public async Task CalculateOxygenationIndex(BasePatientObservationValue obs, string name) { var toSearchList = new List(); @@ -665,6 +699,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The current patient observation that initiated the calculation; provides the patient identifier and timestamp used for the resulting observation. /// The name of the observation in , expected to be either FiO2 or PaO2_Tidal, which determines how the counterpart value is resolved. + /// private async Task CalculatePf(BasePatientObservationValue obs, string name) { try @@ -729,6 +764,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The alarm identifier used to build the observation Code and Name. /// The pump data source providing rack/auxiliary info, drug name, time, and optional patient id. /// A that yields the resulting observation, or null when the alarm configuration check rejects it. + /// private async Task CreatePumpAlarmObservation(string name, PumpObservation pumpObservation) { diff --git a/adas-core.Application/Customizations/HRYC/CalculatedObservations.cs b/adas-core.Application/Customizations/HRYC/CalculatedObservations.cs index 2a223921..9aafa59e 100644 --- a/adas-core.Application/Customizations/HRYC/CalculatedObservations.cs +++ b/adas-core.Application/Customizations/HRYC/CalculatedObservations.cs @@ -18,6 +18,7 @@ namespace adas_core.Application.Customizations.HRYC; /// Resp_Type, and Hour_Balance) from incoming raw observations and active configurations loaded from /// . /// +/// public class CalculatedObservations : ICalculatedObservations { private readonly IOptions _apiSettings; @@ -42,6 +43,7 @@ public class CalculatedObservations : ICalculatedObservations /// from . /// /// The application's service provider used to resolve the required dependencies and configuration. + /// public CalculatedObservations(IServiceProvider serviceProvider) { _observationService = serviceProvider.GetRequiredService>(); //observationService; @@ -86,6 +88,8 @@ public class CalculatedObservations : ICalculatedObservations /// A that resolves to the (possibly transformed) observation, /// or when the input observation has no name. /// + /// public async Task Map(T obs, bool onlyByName) where T : BasePatientObservation { _logger.LogTrace("Mapping {name} observation {obs}", obs.Name, obs); @@ -148,6 +152,7 @@ public class CalculatedObservations : ICalculatedObservations /// The treatment to map. /// Never returns a result. /// Always thrown because treatment mapping is not implemented in the HRYC customization. + /// public Task Map(PatientTreatment treatment) { throw new NotImplementedException(); @@ -161,6 +166,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The pump observation to map. /// A task containing the same instance that was passed in. + /// public async Task Map(PumpObservation pumpObservation) { return await Task.FromResult(pumpObservation); @@ -174,6 +180,7 @@ public class CalculatedObservations : ICalculatedObservations /// The list of active medicines (ignored). /// The unique identifier of the patient (ignored). /// A completed task. + /// public Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { return Task.CompletedTask; @@ -185,6 +192,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The unique identifier of the patient (ignored). /// A completed task. + /// public Task CalculateActiveBolus(ObjectId patientId) { return Task.CompletedTask; @@ -196,6 +204,8 @@ public class CalculatedObservations : ICalculatedObservations /// /// The unique identifier of the patient (ignored). /// A completed task containing an empty . + /// public Task> GetActiveTreatmentsByPatient(ObjectId id) { return Task.FromResult(new List().AsEnumerable()); @@ -207,6 +217,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The to map. /// A task containing the same instance that was passed in. + /// public Task Map(PatientDiagnosis diagnosis) { return Task.FromResult(diagnosis); @@ -224,6 +235,8 @@ public class CalculatedObservations : ICalculatedObservations /// A task that resolves to the (possibly time-shifted) . /// Returns the input unchanged when its Name is null or empty, logging the error. /// + /// public async Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { if (string.IsNullOrEmpty(newObservation.Name)) @@ -262,6 +275,7 @@ public class CalculatedObservations : ICalculatedObservations /// A task that resolves to the resulting list of observations (with Vent_Rate removed /// when it was inserted synchronously, or the original list otherwise). /// + /// public async Task> PreMapList(List listToInsert) { var ventRate = listToInsert.FirstOrDefault(obs => obs.Name == "MDC_VENT_RESP_RATE"); @@ -312,6 +326,7 @@ public class CalculatedObservations : ICalculatedObservations /// The patient observation that triggered the alarm. /// The alarm metadata to be inserted alongside the observation. /// A task containing the same instance that was passed in. + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { return Task.FromResult(obs); @@ -327,6 +342,7 @@ public class CalculatedObservations : ICalculatedObservations /// The optional alarm code from . /// Never returns a result. /// Always thrown because this overload is not used in the HRYC customization. + /// public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { throw new NotImplementedException(); @@ -339,6 +355,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation, expected to be a whose Name is NEWS. /// A task that represents the asynchronous alarm evaluation. + /// private async Task CalculateNews(BasePatientObservation obs) { var pobs = (PatientObservation)obs; @@ -382,6 +399,8 @@ public class CalculatedObservations : ICalculatedObservations /// The base patient observation that triggered the alarm (used to derive PatientId and Time). /// The describing the alarm kind (for example, NewsOff, NewsWarning, NewsAlert). /// A task that represents the asynchronous alarm dispatch. + /// private async Task SendAlarm(BasePatientObservation obs, AlarmEnum.Name name) { var pobs = (PatientObservation)obs; @@ -444,6 +463,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The beacon colour to apply. /// The patient whose associated beacon should be updated. + /// private void SendBeaconCode(AlarmEnum.BeaconColor color, Patient patient) { if (!patient.PointOfCareId.HasValue) @@ -478,6 +498,8 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation (SpO2, FiO2, or FR). /// A task that represents the asynchronous calculation operation. + /// private async Task CalculateIrox(BasePatientObservation obs) { try @@ -560,6 +582,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation (FR or Vent_Rate). /// A task that represents the asynchronous insert operation. + /// private async Task CalculateRespRate(BasePatientObservation obs) { var pobs = (PatientObservation)obs; @@ -627,6 +650,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation expected to be a with Name Hydric_Balance. /// A task that resolves to the (possibly time-shifted) base patient observation. + /// private async Task CalculateHydricBalance(BasePatientObservation obs) { var pobs = (PatientObservation)obs; @@ -650,6 +674,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation expected to be a with Name Hour_Balance. /// A task that resolves to the (possibly time-shifted) base patient observation. + /// private async Task CalculateHourBalance(BasePatientObservation obs) { var pobs = (PatientObservation)obs; @@ -677,6 +702,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation, expected to be a with Name Hydric_Balance. /// A task that represents the asynchronous insert operation. + /// private async Task CalculateHydricBalanceCalculated(BasePatientObservation obs) { //Hydric_Balance_Calculated @@ -753,6 +779,8 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation, expected to be a with Name Resp_Mode. /// A task that represents the asynchronous insert operation. + /// private async Task CalculateVentilationMode(BasePatientObservation obs) { _logger.LogDebug("CalculateVentilationMode {obs}", obs); @@ -800,6 +828,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation, expected to be a with Name Weight_Current. /// A task that represents the asynchronous insert operation. + /// private async Task CalculateWeight_DiffObservation(BasePatientObservation obs) { var toSearchList = new List(); @@ -839,6 +868,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation (Diuresis or Weight_Current). /// A task that represents the asynchronous insert operation. + /// private async Task CalculateDiureis_WeightObservation(BasePatientObservation obs) { var toSearchList = new List(); @@ -891,6 +921,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation, expected to be a with Name AllergiesObs and a collection-valued Value of . /// A task that represents the asynchronous insert operation. + /// private async Task CalculateAllergiesObservation(BasePatientObservation obs) { try @@ -967,6 +998,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation, expected to be a with Name DrainagesObs and a -typed Value. /// A task that represents the asynchronous insert operation. + /// private async Task CalculateDrainagesObservation(BasePatientObservation obs) { var pobs = (PatientObservation)obs; @@ -1013,6 +1045,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation (PEEP or Pleateu_Pressure). /// A task that represents the asynchronous insert operation. + /// private async Task CalculateDelta_PressureObservation(BasePatientObservation obs) { var toSearchList = new List(); @@ -1071,6 +1104,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation that triggered the calculation, expected to be a with Name Daily_Balance. /// A task that represents the asynchronous insert operation. + /// private async Task CalculateDaily_BalanceObservation(BasePatientObservation obs) { if (obs.Time.ToLocalTime().Hour == 8) @@ -1098,6 +1132,7 @@ public class CalculatedObservations : ICalculatedObservations /// when the observation has an Expires value and the current time /// is past the expiration instant; otherwise, . /// + /// private static bool CheckExpired(PatientObservation obs) { if (obs.Expires == null) return false; diff --git a/adas-core.Application/Customizations/HUVH/UCIA/CalculatedObservations.cs b/adas-core.Application/Customizations/HUVH/UCIA/CalculatedObservations.cs index 05682e36..3b5d6545 100644 --- a/adas-core.Application/Customizations/HUVH/UCIA/CalculatedObservations.cs +++ b/adas-core.Application/Customizations/HUVH/UCIA/CalculatedObservations.cs @@ -15,6 +15,7 @@ namespace adas_core.Application.Customizations.HUVH.UCIA; /// Represents a concrete implementation of the interface, /// providing functionality to manage a collection of calculated observations. /// +/// public class CalculatedObservations : ICalculatedObservations { private const string CodingSystem = "ADAS"; @@ -67,6 +68,8 @@ public class CalculatedObservations : ICalculatedObservations /// /// The identifier of the patient whose active bolus should be calculated. /// Thrown when the method is invoked, as the calculation logic has not yet been implemented. + /// public Task CalculateActiveBolus(ObjectId patientId) { throw new NotImplementedException(); @@ -79,6 +82,8 @@ public class CalculatedObservations : ICalculatedObservations /// The patient observation to map; may be replaced with the result of the matched asynchronous calculation when applicable. /// Indicates whether the mapping should be performed using only the observation's name. /// The processed patient observation, potentially updated by the applicable calculation. + /// public async Task Map(T obs, bool onlyByName = false) where T : BasePatientObservation { if (obs.Name is "PSI" or "RASS" or "TS") _ = CalculateOverSedation(obs); @@ -106,6 +111,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The patient treatment to map and update. /// The patient treatment with its order control set according to the evaluated business rules. + /// public async Task Map(PatientTreatment treatment) { var order = treatment.PlacerOrder?.EntityIdentifier; //aquí almacenamos el número de orden @@ -130,6 +136,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The pump observation to map. /// A completed task containing the provided . + /// public async Task Map(PumpObservation pumpObservation) { return await Task.FromResult(pumpObservation); @@ -141,6 +148,8 @@ public class CalculatedObservations : ICalculatedObservations /// /// The list of currently active medicines assigned to the patient. /// The unique identifier of the patient whose medication categories will be checked. + /// public Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { //Esto viene del schedulerService para chequear los medicamentos activos @@ -154,6 +163,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The unique identifier of the patient whose active treatments should be retrieved. /// A collection of objects representing the patient's active treatments. + /// public async Task> GetActiveTreatmentsByPatient(ObjectId id) { var activeTreatments = await _treatmentService.Value.GetActiveTreatmentsByPatient(id); @@ -167,6 +177,7 @@ public class CalculatedObservations : ICalculatedObservations /// The to be mapped. /// A task that represents the asynchronous mapping operation, containing the resulting . /// Thrown when the method is invoked, as the mapping logic has not yet been implemented. + /// public Task Map(PatientDiagnosis diagnosis) { throw new NotImplementedException(); @@ -179,6 +190,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The new patient observation whose timestamp should be adjusted to avoid time inconsistencies with prior observations. /// The patient observation, with its Time adjusted when a time collision is detected, or the original observation when its name is null or empty. + /// public async Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { if (string.IsNullOrEmpty(newObservation.Name)) @@ -211,6 +223,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The list of patient observations to pre-map before insertion. /// A completed task containing the provided list of patient observations. + /// public Task> PreMapList(List listToInsert) { return Task.FromResult(listToInsert); @@ -222,6 +235,7 @@ public class CalculatedObservations : ICalculatedObservations /// The patient observation to be returned as the mapping result. /// The patient observation alarm intended to be associated with the observation. /// A task containing the patient observation. + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { return Task.FromResult(obs); @@ -235,6 +249,7 @@ public class CalculatedObservations : ICalculatedObservations /// The optional alarm code categorizing the alarm, or null if no code is specified. /// A task that represents the asynchronous alarm sending operation. /// Thrown to indicate that the method has not yet been implemented. + /// public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { throw new NotImplementedException(); @@ -246,6 +261,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation to evaluate for the rehabilitation alarm condition. /// The observation with its status set to Alert when the six previous rehabilitation observations also fall within the 0-2 range; otherwise the observation is returned as-is. + /// private async Task CalculateRehabilitationAlarm(BasePatientObservation obs) { //En rojo si el grado es de 0 a 2 incluidos, por más de 7 días @@ -270,6 +286,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The incoming base patient observation; only instances whose /// Name is "Diuresis" or "Weight" are processed, otherwise the method returns without changes. + /// private async Task CalculateDiuresis(BasePatientObservation obs) { // Calculado como el sumatorio de la Diuresis de las últimas 6h @@ -350,6 +367,7 @@ public class CalculatedObservations : ICalculatedObservations /// Calculates the ROX Index by dividing the SpO2/FiO2 ratio by the respiratory rate (FR) and persists the result as a new Rox_Index observation. The method supports both directions of the calculation: when the incoming observation is the SpO2/FiO2 ratio, it retrieves the latest FR, and vice versa. It silently returns if the observation is not a PatientObservation, if the observation name is not recognized, if the required paired observation cannot be found, if its value cannot be parsed, or if the FR value is zero (to avoid division by zero). /// /// The base patient observation that triggers the ROX index calculation. Only observations named SpO2_FiO2_Ratio or FR are processed; any other type or name is ignored. + /// private async Task CalculateRoxIndex(BasePatientObservation obs) { // Cálculo dividiendo el ratio SpO2/FiO2 entre la FR @@ -402,6 +420,7 @@ public class CalculatedObservations : ICalculatedObservations /// Calculates the driving pressure for a patient as the difference between Pmeset and PEEP when a new Pmeset or PEEP observation is provided. Looks up the complementary observation to obtain the missing value, then creates and persists a "Driving_Pressure" observation. Returns early if the input is not a PatientObservation, the observation name is neither Pmeset nor PEEP, the complementary observation cannot be found, or its value cannot be parsed as an integer. /// /// The base patient observation that triggered the calculation; expected to represent a Pmeset or PEEP measurement. + /// private async Task CalculateDrivingPressure(BasePatientObservation obs) { //Diferencia entre la Pmeset y la PEEP @@ -458,6 +477,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The observation that triggered the evaluation; its value must be numeric and it is ignored if is provided (e.g., when invoked from a treatment context). /// The patient identifier when the evaluation is triggered by a treatment event; when null, it is derived from . + /// private async Task CalculateOverAnalgesia(BasePatientObservation? obs, ObjectId? patientId = null) { // Mandar observación 'SOBREANALGESIA' @@ -537,6 +557,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation to evaluate and potentially transform. /// A task that yields the observation, with its value normalized to "ECMO" when the original value is one of the recognized ECMO variants. + /// private Task CalculateEcmoLocation(BasePatientObservation obs) { //Las opciones pueden ser VV, VA o ECMO. @@ -564,6 +585,7 @@ public class CalculatedObservations : ICalculatedObservations /// anything. /// /// The incoming patient observation whose name drives the ventilation mode calculation. + /// private async Task CalculateVentilationMode(BasePatientObservation obs) { //- Si llega valor de PI pero NO COMPL, el tipo de ventilación es VMNI @@ -619,6 +641,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The triggering patient observation used to evaluate the sedation state. When provided, its name and value drive the initial validation; when null, the method relies on the parameter (typically from a treatment update). /// Optional identifier of the patient to evaluate. If null, it is derived from ; otherwise, the method performs a full evaluation using the patient's recent observations. + /// private async Task CalculateOverSedation(BasePatientObservation? obs, ObjectId? patientId = null) { //Mandar observación 'SOBRESEDACIÓN' @@ -700,6 +723,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The patient treatment to evaluate; may be null. /// true if the treatment has a start time and was started more than 24 hours ago; otherwise, false. + /// private static bool ExceedsAnalgesiaThreshold(PatientTreatment? treatment) { // Perfusiones de morfina, remifentanilo o fentanilo sostenidas > 24 h @@ -713,6 +737,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The patient treatment to evaluate, or null. /// true if the treatment is not null and any requested medication exceeds its defined sedation threshold; otherwise, false. + /// private static bool ExceedsSedationThreshold(PatientTreatment? treatment) { return (treatment != null && @@ -729,6 +754,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The patient treatment whose patient is used to look up the list of active treatments to evaluate. /// A task that returns the list of active patient treatments that were not discontinued. + /// private async Task> CheckExpiredPatientTreatments(PatientTreatment treatment) { //si el tratamiento ha expirado actualizamos el OrderControl a DC y devolvemos las que siguen activas @@ -757,6 +783,7 @@ public class CalculatedObservations : ICalculatedObservations /// further validation. /// /// The patient treatment whose requested medicines will be checked against the patient's active medicines. + /// private async Task CheckTreatmentMedicines(PatientTreatment treatment) { var newMedicines = (await Task.WhenAll(treatment.RequestedGiveCodes @@ -785,6 +812,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The identifier of the patient whose medication categories are being evaluated and linked to the created observations. /// The distinct list of medicines to be checked against the predefined category reference lists. + /// private void CheckMedicationCategories(ObjectId patientId, List uniqueMedicines) { var medicationCategories = new Dictionary?> @@ -821,6 +849,7 @@ public class CalculatedObservations : ICalculatedObservations /// The collection of medications whose names will be stored as the observation values. /// The identifier of the patient the observation belongs to. /// The name used to group and look up the previous observation for the same concept. + /// private async Task CreateMedicationMultivalueObservation(IEnumerable medications, ObjectId patientId, string obsName) { diff --git a/adas-core.Application/Customizations/HUVH/UCIN/CalculatedObservations.cs b/adas-core.Application/Customizations/HUVH/UCIN/CalculatedObservations.cs index 08a7bfc4..d1ecc5f7 100644 --- a/adas-core.Application/Customizations/HUVH/UCIN/CalculatedObservations.cs +++ b/adas-core.Application/Customizations/HUVH/UCIN/CalculatedObservations.cs @@ -16,6 +16,7 @@ namespace adas_core.Application.Customizations.HUVH.UCIN; /// Represents a concrete implementation of the interface, /// providing a collection of calculated observation data. /// +/// public class CalculatedObservations : ICalculatedObservations { private const string Spo2PreObservationName = "SpO2"; @@ -61,6 +62,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The unique identifier of the patient for whom the active bolus is calculated. /// Thrown because the method has not been implemented yet. + /// public Task CalculateActiveBolus(ObjectId patientId) { throw new NotImplementedException(); @@ -73,6 +75,8 @@ public class CalculatedObservations : ICalculatedObservations /// The patient observation to be mapped, which may be transformed depending on its name. /// Indicates whether the mapping should be performed using only the observation name. /// The mapped patient observation, potentially enriched with computed values, wrapped in a task. + /// public async Task Map(T obs, bool onlyByName = false) where T : BasePatientObservation { if (obs.Name is "Intervention_In" or "Intervention_Out") await CalculateInterventionMultiValueObservation(obs); @@ -105,6 +109,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The patient treatment to map, including its placer order, end time, and medicines. /// The mapped with its order control type and medicines updated. + /// public async Task Map(PatientTreatment treatment) { var order = treatment.PlacerOrder?.EntityIdentifier; //aquí almacenamos el número de orden @@ -129,6 +134,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The pump observation to map. /// A completed containing the provided . + /// public async Task Map(PumpObservation pumpObservation) { return await Task.FromResult(pumpObservation); @@ -140,6 +146,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The list of active medicines from which distinct medication names are extracted to build the observation value. /// The identifier of the patient for whom the medication observation is calculated and stored. + /// public async Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { var medicineObs = new PatientObservation @@ -171,6 +178,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The unique of the patient whose active treatments should be fetched. /// A task that represents the asynchronous operation, containing an of nullable instances for the patient. + /// public async Task> GetActiveTreatmentsByPatient(ObjectId id) { var activeTreatments = await _treatmentService.Value.GetActiveTreatmentsByPatient(id); @@ -184,6 +192,7 @@ public class CalculatedObservations : ICalculatedObservations /// The source instance to be mapped. /// A that represents the asynchronous mapping operation, containing the mapped . /// Thrown when the method is invoked, as the mapping logic has not yet been implemented. + /// public Task Map(PatientDiagnosis diagnosis) { throw new NotImplementedException(); @@ -195,6 +204,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The new patient observation whose time may be adjusted to follow the most recent observation for the same patient and measurement. /// The patient observation with a corrected time if a time conflict was detected, or the original observation if no adjustment was needed or the name was invalid. + /// public async Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { if (string.IsNullOrEmpty(newObservation.Name)) @@ -227,6 +237,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The list of patient observations to pre-map. /// A task that represents the asynchronous operation, containing the provided list of patient observations. + /// public Task> PreMapList(List listToInsert) { return Task.FromResult(listToInsert); @@ -238,6 +249,7 @@ public class CalculatedObservations : ICalculatedObservations /// The patient observation that the alarm is to be associated with. /// The alarm intended to be inserted into the observation. /// A task containing the patient observation, returned as-is. + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { return Task.FromResult(obs); @@ -250,6 +262,7 @@ public class CalculatedObservations : ICalculatedObservations /// The name associated with the alarm. /// The optional alarm code categorizing the type of alarm to be sent. /// Thrown because the method has not been implemented. + /// public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { throw new NotImplementedException(); @@ -261,6 +274,7 @@ public class CalculatedObservations : ICalculatedObservations /// Returns without creating a record when the observation is not a or when its name does not match any of the supported scales. /// /// The source patient observation used to derive the pain scale; only instances of with a supported name (ALPS, NPASS_Sedation, NPASS_Analgesia) are processed. + /// private async Task CalculatePainScale(BasePatientObservation obs) { if (obs is not PatientObservation pobs) return; @@ -314,6 +328,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The base patient observation to process. /// The original if it is not a ; otherwise, the with its value set to the locally formatted observation time. + /// private static BasePatientObservation CalculateLastDefecationValue(BasePatientObservation obs) { if (obs is not PatientObservation pobs) return obs; @@ -332,6 +347,7 @@ public class CalculatedObservations : ICalculatedObservations /// Calculates and persists a multi-value observation by appending the current value to the existing list of values for the corresponding "Multivalue" observation. Expirates the previous multi-value observation before inserting the new one. /// /// The base patient observation used to derive the multi-value observation; it must be a with a non-empty name and a string value. + /// private async Task CalculateMultiValueObservation(BasePatientObservation obs) { //El valor de la observación es un array de strings @@ -388,6 +404,7 @@ public class CalculatedObservations : ICalculatedObservations /// Calculates and persists a multi-value observation that aggregates the active intervention groups (e.g., devices, routes) for a patient based on incoming "_In" and "_Out" observations. Handles the insertion of new groups (with special duplicate prevention for respiratory devices) and the removal of groups when a corresponding "Out" event is received, expiring the previous multi-value observation and inserting a new one when the resulting set is not empty. /// /// The base patient observation that triggered the calculation; expected to be a with a non-empty name and a string value representing the intervention group. + /// private async Task CalculateInterventionMultiValueObservation(BasePatientObservation obs) { if (obs is not PatientObservation pobs || string.IsNullOrEmpty(obs.Name) || @@ -478,6 +495,7 @@ public class CalculatedObservations : ICalculatedObservations /// Observation text from which the leading token is taken as the candidate intervention code. /// When the method returns true, contains the resolved intervention's type, name, and group; otherwise null. /// true if a matching intervention was found; false if the code is not numeric or the lookup yields no result. + /// private bool GetInterventionValue(string valueObs, out (string type, string Name, string Group)? r) { var code = valueObs.Split(" ")[0]; // @@ -506,6 +524,7 @@ public class CalculatedObservations : ICalculatedObservations /// Calcula la complejidad del paciente en función de las observaciones registradas. /// /// Observación del paciente que se va a evaluar para recalcular su complejidad. + /// private async Task CalculateComplexity(BasePatientObservation obs) { var pobs = obs as PatientObservation; @@ -575,6 +594,7 @@ public class CalculatedObservations : ICalculatedObservations /// The name of the multivalue observation to look up and calculate complexity for. /// An optional pre-loaded observation that overrides the database lookup when supplied. /// The aggregated complexity value for the observation, or 0 if no observation or values are found. + /// private async Task CalculateMultivalueObservationComplexityValue(ObjectId patientId, string observationName, PatientObservation? observation = null) { @@ -602,6 +622,7 @@ public class CalculatedObservations : ICalculatedObservations /// The identifier of the patient whose newborn weight complexity is being calculated. /// An optional patient observation to use instead of the latest stored one; if provided with "kg" units, its value is converted. /// The calculated newborn weight complexity value, or 0 when no valid value is available. + /// private async Task CalculateWeightNewBornValue(ObjectId patientId, PatientObservation? pobs = null) { var result = @@ -644,6 +665,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The patient observation containing the weight value to parse and convert. /// The patient observation with the value converted to grams, or the original observation if the value could not be parsed. + /// private PatientObservation ParseWeight(PatientObservation obs) { if (!double.TryParse(obs.Value.ToString(), out var dValue)) @@ -664,6 +686,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The incoming patient observation (either a pre or post SpO2 measurement) used to drive the calculation and identify the counterpart observation. /// A task that represents the asynchronous insert of the derived observations. + /// private async Task CalculateSaturation_DiffObservation(BasePatientObservation obs) { var toSearchList = new List(); @@ -726,6 +749,8 @@ public class CalculatedObservations : ICalculatedObservations /// /// The patient treatment being evaluated, used to locate the existing record by its placer order entity identifier and to persist the updated state. /// A task that yields the list of active patient treatments for the patient that are not the same placer order as the supplied treatment. + /// private async Task> CheckExpiredPatientTreatments(PatientTreatment treatment) { //si el tratamiento ha expirado actualizamos el OrderControl a DC y devolvemos las que siguen activas @@ -763,6 +788,7 @@ public class CalculatedObservations : ICalculatedObservations /// medicines remain after filtering. /// /// The patient treatment whose requested give codes are inspected for medicines, nutrition items, and vasoactive drugs. + /// private async Task CheckTreatmentMedicines(PatientTreatment treatment) { var newMedicines = new List(); @@ -825,6 +851,7 @@ public class CalculatedObservations : ICalculatedObservations /// /// The feeding type value to record; if it contains "parenteral" (case-insensitive), the observation is stored as a parenteral entry. /// The identifier of the patient to whom the observation belongs. + /// private async Task CreateNutritionObservation(string value, ObjectId patientId) { var nutritionObs = new PatientObservation diff --git a/adas-core.Application/Customizations/NursePlan/CalculatedObservations.cs b/adas-core.Application/Customizations/NursePlan/CalculatedObservations.cs index eae9f0ce..df245c4f 100644 --- a/adas-core.Application/Customizations/NursePlan/CalculatedObservations.cs +++ b/adas-core.Application/Customizations/NursePlan/CalculatedObservations.cs @@ -10,6 +10,7 @@ namespace adas_core.Application.Customizations.NursePlan; /// /// Provides calculated observations by leveraging services obtained from the injected service provider. /// +/// public class CalculatedObservations(IServiceProvider serviceProvider) : ICalculatedObservations { private readonly Lazy _observationService = @@ -20,6 +21,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The unique identifier of the patient whose active bolus is to be calculated. /// Thrown when the method is invoked, as the calculation logic has not yet been implemented. + /// public Task CalculateActiveBolus(ObjectId patientId) { throw new NotImplementedException(); @@ -30,6 +32,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The PumpObservation to be mapped. /// A task containing the mapped PumpObservation. + /// public async Task Map(PumpObservation pumpObservation) { return await Task.FromResult(pumpObservation); @@ -42,6 +45,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The collection of medicines currently active for the patient. /// The identifier of the patient whose medicine observation is being calculated. /// The method is not yet implemented. + /// public Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { throw new NotImplementedException(); @@ -53,6 +57,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The new patient observation whose timestamps may need to be reconciled with the last recorded observation. /// A task that represents the asynchronous operation. The task result contains the fixed , or null when no time inconsistency is detected. /// Thrown because the method has not been implemented yet. + /// public Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { throw new NotImplementedException(); @@ -64,6 +69,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The unique identifier of the patient whose active treatments are being queried. /// A task representing the asynchronous operation, containing a collection of active PatientTreatment entries, which may include null values, for the specified patient. /// The method has not yet been implemented. + /// public Task> GetActiveTreatmentsByPatient(ObjectId id) { throw new NotImplementedException(); @@ -75,6 +81,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The patient observation to return. /// Reserved flag that is not used in the current implementation. /// A completed task containing the provided observation. + /// public Task Map(T obs, bool onlyByName = false) where T : BasePatientObservation { return Task.FromResult(obs)!; @@ -85,6 +92,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The patient treatment to map. /// A task containing the mapped patient treatment. + /// public Task Map(PatientTreatment treatment) { return Task.FromResult(treatment); @@ -95,6 +103,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The patient diagnosis to be returned as a completed task result. /// A completed containing the provided diagnosis. + /// public Task Map(PatientDiagnosis diagnosis) { return Task.FromResult(diagnosis); @@ -107,6 +116,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The patient observation to return. /// The patient observation alarm; not used in the current implementation. /// A completed task containing the original . + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { return Task.FromResult(obs); @@ -118,6 +128,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// The patient observation that triggers the alarm. /// The name associated with the alarm. /// The optional alarm code identifying the alarm type. + /// public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { return Task.CompletedTask; @@ -128,6 +139,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula /// /// The list of patient observations to be pre-mapped. /// A completed containing the original list of patient observations. + /// public Task> PreMapList(List listToInsert) { return Task.FromResult(listToInsert); diff --git a/adas-core.Application/Exceptions/APIRequestException.cs b/adas-core.Application/Exceptions/APIRequestException.cs index cb73352d..745814be 100644 --- a/adas-core.Application/Exceptions/APIRequestException.cs +++ b/adas-core.Application/Exceptions/APIRequestException.cs @@ -4,4 +4,5 @@ /// Represents errors that occur during API request processing, wrapping a descriptive message. /// /// The message that describes the error. +/// public class ApiRequestException(string message) : Exception($"Api request exception: {message}"); \ No newline at end of file diff --git a/adas-core.Application/Exceptions/BadRequestException.cs b/adas-core.Application/Exceptions/BadRequestException.cs index 6142a5a2..fb2bd1d6 100644 --- a/adas-core.Application/Exceptions/BadRequestException.cs +++ b/adas-core.Application/Exceptions/BadRequestException.cs @@ -6,12 +6,14 @@ namespace adas_core.Application.Exceptions; /// Represents an exception that is thrown when a bad or invalid request is received. /// It serves as a specialized error type derived from the base class for signaling client-side request failures. /// +/// public class BadRequestException : Exception { /// /// Initializes a new instance of the class with a specified error message. /// /// The error message defined in that describes the reason for the exception. + /// public BadRequestException(HttpEnum.ErrorMessage message) : base(((int)message).ToString()) { } @@ -20,6 +22,7 @@ public class BadRequestException : Exception /// Initializes a new instance of the class with a specified error message. /// /// The error message that describes the reason for the exception. + /// public BadRequestException(string message) : base(message) { } diff --git a/adas-core.Application/Exceptions/ConflictException.cs b/adas-core.Application/Exceptions/ConflictException.cs index 0ca24e73..9228f7cf 100644 --- a/adas-core.Application/Exceptions/ConflictException.cs +++ b/adas-core.Application/Exceptions/ConflictException.cs @@ -5,12 +5,14 @@ namespace adas_core.Application.Exceptions; /// /// Represents an exception that is thrown when a conflict is encountered, such as a resource state mismatch or a duplicate entry. /// +/// public class ConflictException : Exception { /// /// Initializes a new instance of the class with a specified error message. /// /// The error message that describes the conflict. + /// public ConflictException(HttpEnum.ErrorMessage message) : base(((int)message).ToString()) { } @@ -19,6 +21,7 @@ public class ConflictException : Exception /// Initializes a new instance of the class with a specified error message. /// /// The message that describes the error. + /// public ConflictException(string message) : base(message) { } diff --git a/adas-core.Application/Exceptions/CustomArgumentException.cs b/adas-core.Application/Exceptions/CustomArgumentException.cs index 874d2088..74fbafac 100644 --- a/adas-core.Application/Exceptions/CustomArgumentException.cs +++ b/adas-core.Application/Exceptions/CustomArgumentException.cs @@ -8,12 +8,14 @@ namespace adas_core.Application.Exceptions; /// /// This exception extends the base class to provide a domain-specific error type for argument validation failures. /// +/// public class CustomArgumentException : Exception { /// /// Initializes a new instance of the class with the specified error message. /// /// The error message from the enumeration. + /// public CustomArgumentException(HttpEnum.ErrorMessage message) : base(((int)message).ToString()) { } @@ -22,6 +24,7 @@ public class CustomArgumentException : Exception /// Initializes a new instance of the class with a specified error message. /// /// The error message that describes the reason for the exception. + /// public CustomArgumentException(string message) : base(message) { } diff --git a/adas-core.Application/Exceptions/ForbbidenException.cs b/adas-core.Application/Exceptions/ForbbidenException.cs index d27d1cdb..85953e58 100644 --- a/adas-core.Application/Exceptions/ForbbidenException.cs +++ b/adas-core.Application/Exceptions/ForbbidenException.cs @@ -8,12 +8,14 @@ namespace adas_core.Application.Exceptions; /// /// This exception is intended to signal that a requested action violates access rules or restrictions, allowing callers to handle forbidden scenarios distinctly from other error conditions. /// +/// public class ForbbidenException : Exception { /// /// Initializes a new instance of the class with a specified error message from the enumeration. /// /// The enumeration value whose integer representation is used as the exception message. + /// public ForbbidenException(HttpEnum.ErrorMessage message) : base(((int)message).ToString()) { } @@ -22,6 +24,7 @@ public class ForbbidenException : Exception /// Initializes a new instance of the class with a specified error message. /// /// The message that describes the error. + /// public ForbbidenException(string message) : base(message) { } diff --git a/adas-core.Application/Exceptions/InvalidFormatException.cs b/adas-core.Application/Exceptions/InvalidFormatException.cs index 2896a24c..56965c83 100644 --- a/adas-core.Application/Exceptions/InvalidFormatException.cs +++ b/adas-core.Application/Exceptions/InvalidFormatException.cs @@ -5,12 +5,15 @@ namespace adas_core.Application.Exceptions; /// /// Represents the exception that is thrown when data is encountered in a format that is not valid or expected. /// +/// public class InvalidFormatException : Exception { /// /// Initializes a new instance of the class with a specified error message. /// /// The error message that describes the reason for the exception. + /// public InvalidFormatException(HttpEnum.ErrorMessage message) : base(((int)message).ToString()) { } @@ -19,6 +22,7 @@ public class InvalidFormatException : Exception /// Initializes a new instance of the class with a specified error message. /// /// The error message that describes the reason for the exception. + /// public InvalidFormatException(string message) : base(message) { } diff --git a/adas-core.Application/Exceptions/NotFoundException.cs b/adas-core.Application/Exceptions/NotFoundException.cs index 6fe77ef3..5cae3504 100644 --- a/adas-core.Application/Exceptions/NotFoundException.cs +++ b/adas-core.Application/Exceptions/NotFoundException.cs @@ -5,11 +5,13 @@ namespace adas_core.Application.Exceptions; /// /// Represents an exception that is thrown when a requested resource or item cannot be found. /// +/// public class NotFoundException : Exception { /// /// Initializes a new instance of the class. /// + /// public NotFoundException() { } @@ -18,6 +20,7 @@ public class NotFoundException : Exception /// Initializes a new instance of the class with a specified error message. /// /// The message that describes the error. + /// public NotFoundException(HttpEnum.ErrorMessage message) : base(((int)message).ToString()) { } @@ -26,6 +29,7 @@ public class NotFoundException : Exception /// Initializes a new instance of the class with a specified error message. /// /// The message that describes the error. + /// public NotFoundException(string message) : base(message) { } diff --git a/adas-core.Application/Exceptions/TokenException.cs b/adas-core.Application/Exceptions/TokenException.cs index 508c7925..467b09c3 100644 --- a/adas-core.Application/Exceptions/TokenException.cs +++ b/adas-core.Application/Exceptions/TokenException.cs @@ -4,4 +4,5 @@ /// Represents an exception that is thrown when a token-related error occurs. /// /// The message that describes the error. +/// public class TokenException(string message) : Exception(message); \ No newline at end of file diff --git a/adas-core.Application/Exceptions/UnauthorizedException.cs b/adas-core.Application/Exceptions/UnauthorizedException.cs index 4dbbfeb0..96a39d83 100644 --- a/adas-core.Application/Exceptions/UnauthorizedException.cs +++ b/adas-core.Application/Exceptions/UnauthorizedException.cs @@ -5,12 +5,14 @@ namespace adas_core.Application.Exceptions; /// /// Exception thrown when a user lacks authorization to perform an operation. /// +/// public class UnauthorizedException : Exception { /// /// Initializes a new instance of the class. /// /// The error message associated with the exception. + /// public UnauthorizedException(HttpEnum.ErrorMessage message) : base(((int)message).ToString()) { } @@ -19,6 +21,7 @@ public class UnauthorizedException : Exception /// Initializes a new instance of the class. /// /// The message that describes the error. + /// public UnauthorizedException(string message) : base(message) { } diff --git a/adas-core.Application/Exceptions/UnprocessableEntityException.cs b/adas-core.Application/Exceptions/UnprocessableEntityException.cs index 7cdefa2e..f8a87eba 100644 --- a/adas-core.Application/Exceptions/UnprocessableEntityException.cs +++ b/adas-core.Application/Exceptions/UnprocessableEntityException.cs @@ -8,12 +8,14 @@ namespace adas_core.Application.Exceptions; /// /// This exception is typically used to signal that a request or entity was understood but could not be processed, similar to the semantics of an HTTP 422 (Unprocessable Entity) response. /// +/// public class UnprocessableEntityException : Exception { /// /// Initializes a new instance of the class with a specified error message enum. /// /// The error message enum containing the error code. + /// public UnprocessableEntityException(HttpEnum.ErrorMessage message) : base(((int)message).ToString()) { } @@ -22,6 +24,7 @@ public class UnprocessableEntityException : Exception /// Initializes a new instance of the class with a specified error message. /// /// The message that describes the error. + /// public UnprocessableEntityException(string message) : base(message) { } diff --git a/adas-core.Application/Providers/AdasProvider.cs b/adas-core.Application/Providers/AdasProvider.cs index 05b38503..c5a5c712 100644 --- a/adas-core.Application/Providers/AdasProvider.cs +++ b/adas-core.Application/Providers/AdasProvider.cs @@ -29,6 +29,7 @@ public class AdasProvider(IOptions providerSettings, IHttpCli /// /// The patient for whom observations are being calculated. /// A task that represents the asynchronous operation, returning a list of patient observations. + /// public override async Task> GetObservations(Patient patient) { var calculatedObservations = new List(); @@ -88,6 +89,7 @@ public class AdasProvider(IOptions providerSettings, IHttpCli /// /// The list of ADAS medication prediction results to be serialized. Only the first five entries are included. /// A string containing the selected medication prediction entries joined by the "^" delimiter. + /// private static string ParseAdasMedicationsToMedicationObservation( List medicationPredict) { @@ -100,6 +102,7 @@ public class AdasProvider(IOptions providerSettings, IHttpCli /// /// The unique identifier of the patient whose ADAS stay prediction is being requested. /// A task containing the deserialized result on success, or null if the patient number is null, the response is unsuccessful, or the call throws. + /// private async Task GetPredictOfStay(string? patientNumber) { if (patientNumber == null) @@ -140,6 +143,7 @@ public class AdasProvider(IOptions providerSettings, IHttpCli /// /// The unique identifier of the patient whose ADAS medication predictions are being retrieved. /// A task containing a list of with the predicted medication data, or null if the request fails or the patient number is null. + /// private async Task?> GetPredictMedications(string? patientNumber) { if (patientNumber == null) @@ -176,6 +180,7 @@ public class AdasProvider(IOptions providerSettings, IHttpCli /// Creates a new instance and configures it with the configured base address URL. /// /// An with its set to the configured Url. + /// private HttpClient GetClient() { var client = HttpClientFactory.CreateClient(); diff --git a/adas-core.Application/Providers/BaseProvider.cs b/adas-core.Application/Providers/BaseProvider.cs index b11ae8c8..19a4e195 100644 --- a/adas-core.Application/Providers/BaseProvider.cs +++ b/adas-core.Application/Providers/BaseProvider.cs @@ -21,5 +21,6 @@ public abstract class BaseProvider( /// /// The patient whose observations are being requested. /// A task that represents the asynchronous operation, containing a list of entries for the patient. + /// public abstract Task> GetObservations(Patient patient); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IAdmissionRepository.cs b/adas-core.Application/Repositories/Interfaces/IAdmissionRepository.cs index 06d21b4b..28213a24 100644 --- a/adas-core.Application/Repositories/Interfaces/IAdmissionRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IAdmissionRepository.cs @@ -12,12 +12,14 @@ public interface IAdmissionRepository : IMongoRepository /// Deletes the entity identified by the specified identifier. /// /// The unique identifier of the entity to delete. + /// Task Delete(ObjectId id); /// /// Updates the specified admission record asynchronously. /// /// The admission entity containing the updated information. + /// Task Update(Admission admission); /// @@ -25,6 +27,7 @@ public interface IAdmissionRepository : IMongoRepository /// /// The unique identifier of the entity whose location is to be updated. /// The identifier of the new location to assign to the entity. + /// Task UpdateLocation(ObjectId id, ObjectId newLocation); /// @@ -32,12 +35,14 @@ public interface IAdmissionRepository : IMongoRepository /// /// The unique identifier of the patient to update. /// The patient object containing the updated information to apply. + /// Task UpdatePatient(ObjectId id, Person patient); /// /// Asynchronously retrieves all admission records. /// /// A task that represents the asynchronous operation. The task result contains an with all available admissions. + /// Task> FindAll(); /// @@ -45,6 +50,7 @@ public interface IAdmissionRepository : IMongoRepository /// /// The of the to look up. /// A task that represents the asynchronous operation. The task result contains the matching , or null if no admission exists with the specified identifier. + /// Task FindById(ObjectId id); /// @@ -52,6 +58,7 @@ public interface IAdmissionRepository : IMongoRepository /// /// The NHC (clinical history number) used to look up the admission. /// A task that resolves to the matching , or null if no admission is found for the given NHC. + /// Task FindByNhc(string nhc); //Task?> FindByUnit(string unit); @@ -61,6 +68,7 @@ public interface IAdmissionRepository : IMongoRepository /// /// The patient location used to filter and find the relevant admissions. /// A task that represents the asynchronous operation, containing a list of admissions matching the given location. + /// Task> FindByLocation(PatientLocation location); /// @@ -68,12 +76,14 @@ public interface IAdmissionRepository : IMongoRepository /// /// The origin value used to filter the admissions. /// A task that represents the asynchronous operation, containing a collection of matching admissions, or null if no admissions are found for the given origin. + /// Task?> FindByOrigin(string origin); /// /// Asynchronously inserts a new record into the data store and returns the resulting entity. /// /// The entity to be inserted. /// A task that represents the asynchronous insert operation, containing the inserted , or null if no result is returned. + /// Task InsertOneAsyncAndReturn(Admission origin); /// /// Searches for an admission matching the specified patient number and unit, returning a distinct result. @@ -81,30 +91,35 @@ public interface IAdmissionRepository : IMongoRepository /// The patient's identifier used to locate the admission. /// The unique identifier of the unit to filter the search. /// A if a matching record is found; otherwise, null. + /// Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId); /// /// Asynchronously retrieves a list of admissions associated with the specified unit, excluding Point of Care (PoC) entries. /// /// The unique identifier of the unit whose admissions are being retrieved. /// A task that represents the asynchronous operation, containing a list of records linked to the given unit, with PoC entries excluded. + /// Task> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId); /// /// Retrieves a list of admissions associated with the specified point of care identifier. /// /// The unique identifier of the point of care used to filter the admissions. /// A task that represents the asynchronous operation, containing the list of admissions matching the specified point of care identifier. + /// Task> FindByPointOfCareId(ObjectId pocId); /// /// Asynchronously retrieves a list of admissions associated with the specified unit identifiers. /// /// The list of unit identifiers used to look up the corresponding admissions. /// A task that represents the asynchronous operation, containing the list of admissions matching the provided unit identifiers. + /// Task> FindByUnitIds(List unitIds); /// /// Asynchronously counts the number of records associated with the specified unit identifier. /// /// The identifier of the unit used to filter the records. /// A task that represents the asynchronous operation. The task result contains the count of matching records. + /// Task CountByUnitId(ObjectId unitId); /// @@ -114,6 +129,7 @@ public interface IAdmissionRepository : IMongoRepository /// The data transfer object containing the new master list option values to apply. /// The name of the option type to be updated. /// A task that represents the asynchronous operation, containing the collection of admissions affected by the update. + /// Task> UpdateMasterListOption(List unitIds, UpdateOptionMasterListDto opt, string typeName); @@ -124,11 +140,13 @@ public interface IAdmissionRepository : IMongoRepository /// The option to be removed from the master list. /// The name of the type associated with the master list option. /// A task that represents the asynchronous operation, containing the collection of records affected by the deletion. + /// Task> DeleteMasterListOption(List unitIds, OptionList opt, string typeName); /// /// Asynchronously deletes admissions associated with the specified unit identifier. /// /// The identifier of the unit whose admissions will be deleted. /// A task that represents the asynchronous operation, containing a value indicating the result of the deletion. + /// Task DeleteAdmissionsByUnitId(ObjectId unitId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IAlarmRepository.cs b/adas-core.Application/Repositories/Interfaces/IAlarmRepository.cs index d73bd766..b1790a79 100644 --- a/adas-core.Application/Repositories/Interfaces/IAlarmRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IAlarmRepository.cs @@ -13,6 +13,7 @@ public interface IAlarmRepository : IMongoRepository /// The unique identifier of the patient whose last observations should be aggregated. /// An optional list of fields used to restrict which observation types are included in the aggregation; when null, all available observations are considered. /// A task that resolves to the list of aggregated entries representing the patient's latest observations. + /// Task> AggregatedPatientLastObservationsByField(ObjectId patientId, List? filterObservations = null); @@ -23,6 +24,7 @@ public interface IAlarmRepository : IMongoRepository /// An optional list of fields used to restrict which observations are considered. If null, no field-based filtering is applied. /// The list of configuration observation definitions used to build and aggregate the resulting alarms. /// A task that represents the asynchronous operation, containing a list of aggregated entries for the patient. + /// Task> AggregatedPatientNotExpiredObservationsByField(ObjectId patientId, List? filterObservations, List configAlarm); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IAppointmentArchiveRepository.cs b/adas-core.Application/Repositories/Interfaces/IAppointmentArchiveRepository.cs index 22cc6be8..7631c986 100644 --- a/adas-core.Application/Repositories/Interfaces/IAppointmentArchiveRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IAppointmentArchiveRepository.cs @@ -8,16 +8,19 @@ public interface IAppointmentArchiveRepository /// Asynchronously inserts a single patient appointment into the underlying data store. /// /// The patient appointment entity to be persisted. + /// Task InsertOneAsync(PatientAppointment patientAppointment); /// /// Asynchronously deletes records that have a date earlier than the specified cutoff date. /// /// The cutoff date; records dated before this value will be removed. + /// Task DeleteBeforeDate(DateTime date); /// /// Inserts a batch of patient appointments asynchronously, typically as part of a bulk import or synchronization process. /// /// The collection of patient appointments to be inserted. /// A task that represents the asynchronous insert operation, containing a long value that represents the result of the batch insertion. + /// Task InsertBatch(IEnumerable appointment); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IAppointmentRepository.cs b/adas-core.Application/Repositories/Interfaces/IAppointmentRepository.cs index 226dd1ed..c035f932 100644 --- a/adas-core.Application/Repositories/Interfaces/IAppointmentRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IAppointmentRepository.cs @@ -12,17 +12,20 @@ public interface IAppointmentRepository : IMongoRepository /// /// The unique identifier of the patient whose appointments are being retrieved. /// A task that represents the asynchronous operation, containing a list of objects for the specified patient. + /// Task> GetByPatient(ObjectId patientId); /// /// Asynchronously inserts a single patient appointment record into the data store. /// /// The patient appointment entity to be inserted. + /// new Task InsertOneAsync(PatientAppointment appointment); /// /// Updates an existing patient appointment asynchronously. /// /// The patient appointment containing the updated information. + /// Task Update(PatientAppointment appointment); /// /// Updates the field identified by across many records, replacing the existing value with the new value . @@ -30,22 +33,26 @@ public interface IAppointmentRepository : IMongoRepository /// The name of the field that contains the to update. /// The new value to assign to matching records. /// The current value to be replaced. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); /// /// Asynchronously deletes the entity identified by the specified identifier. /// /// The ObjectId of the entity to delete. + /// new Task DeleteAsync(ObjectId id); /// /// Asynchronously retrieves a cursor of records associated with the specified patient identifier. /// /// The unique of the patient whose appointments are being queried. /// A that yields the matching patient appointments; the cursor may be empty if no appointments are found for the given patient. + /// Task> FindByPatientIdAsync(ObjectId patientId); /// /// Asynchronously deletes records associated with the specified patient identifier. /// /// The unique ObjectId of the patient whose related records should be removed. + /// Task DeleteByPatientId(ObjectId patientId); /// /// Asynchronously retrieves a matching the specified patient identifier and visit number. @@ -53,6 +60,7 @@ public interface IAppointmentRepository : IMongoRepository /// The unique identifier of the patient whose appointment should be located. /// The visit number used to identify the specific appointment for the patient. /// A task that represents the asynchronous operation. The task result contains the matching if found; otherwise, null. + /// Task FindByPatientAndVisitNumber(ObjectId patientId, string visitNumber); /// /// Asynchronously retrieves a patient appointment matching the specified patient identifier and appointment reason. @@ -61,17 +69,20 @@ public interface IAppointmentRepository : IMongoRepository /// The unique identifier of the patient whose appointment should be located. /// The appointment reason used to filter the lookup, or null to match any reason. /// A that resolves to the matching , or null if none exists. + /// Task FindByPatientAndReason(ObjectId patientId, string? appointmentReason); /// /// Retrieves a list of patient appointments associated with the specified location. /// /// The patient location used to filter and retrieve matching appointments. /// A task that represents the asynchronous operation, containing a list of entries for the given location. + /// Task> FindByLocation(PatientLocation location); /// /// Asynchronously retrieves the list of patient appointments associated with the specified point of care. /// /// The point of care used to filter the patient appointments. /// A task that represents the asynchronous operation. The task result contains a list of patient appointments for the given point of care. + /// Task> FindByPoC(PointOfCare poc); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IArchivePatientCarePlanRepository.cs b/adas-core.Application/Repositories/Interfaces/IArchivePatientCarePlanRepository.cs index 1bad7c2c..b88bf1de 100644 --- a/adas-core.Application/Repositories/Interfaces/IArchivePatientCarePlanRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IArchivePatientCarePlanRepository.cs @@ -10,23 +10,27 @@ public interface IArchivePatientCarePlanRepository : IMongoRepository /// The unique identifier of the patient whose care plans should be retrieved. /// A task that returns a list of objects for the given patient, or null when no care plans are found. + /// Task?> FindByPatientId(ObjectId patientId); /// /// Retrieves the list of patient care plans associated with the specified patient identifier. /// /// The unique identifier of the patient whose care plans are being queried. /// A task that represents the asynchronous operation. The task result contains a list of for the given patient, or null if no care plans are found. + /// Task?> FindByPatientId(string patientId); /// /// Asynchronously retrieves the list of care plans associated with the specified patient number, returning null when no matching care plans are found. /// /// The patient number used to look up the associated care plans. /// A task representing the asynchronous operation, containing a list of entries for the patient, or null if none exist. + /// Task?> FindByPatientNumber(string patientId); /// /// Asynchronously retrieves all patient care plans from the data store. /// /// A task that represents the asynchronous operation, containing a list of all entries. + /// Task> FindAll(); /// @@ -36,6 +40,7 @@ public interface IArchivePatientCarePlanRepository : IMongoRepositoryAn optional legacy patient ID string used as an additional lookup criterion. /// An optional legacy patient number string used as an additional lookup criterion. /// A containing a nullable list of records, or null if no matching care plans are found. + /// Task?> FindByIds(ObjectId oldPatientId, string? oldPatientPatientId, string? oldPatientPatientNumber); @@ -43,5 +48,6 @@ public interface IArchivePatientCarePlanRepository : IMongoRepository /// The list of records to be inserted. + /// Task InsertManyAsync(List patientCarePla); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IAuthorityRepository.cs b/adas-core.Application/Repositories/Interfaces/IAuthorityRepository.cs index 90b7cf3e..82b5511a 100644 --- a/adas-core.Application/Repositories/Interfaces/IAuthorityRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IAuthorityRepository.cs @@ -10,46 +10,54 @@ public interface IAuthorityRepository : IMongoRepository /// /// The unique identifier of the authorization to retrieve. /// A task that represents the asynchronous operation, containing the that matches the specified identifier. + /// public Task GetById(ObjectId authId); /// /// Creates a new authority assignment for the specified user with the given role name. /// /// The name of the role to assign as the new authority. /// The identifier of the user to whom the authority will be assigned. + /// void CreateNewAuthority(string roleName, ObjectId userId); /// /// Retrieves the list of authorizations (authorities/permissions) associated with the specified user. /// /// The unique identifier of the user whose authorities are being requested. /// A task that represents the asynchronous operation. The task result contains the list of entries assigned to the user. + /// public Task> GetUserAuthorities(ObjectId userId); /// /// Asynchronously retrieves all available authorizations. /// /// A task that represents the asynchronous operation. The task result contains a list of all objects. + /// public Task> GetAllAuthorities(); /// /// Asynchronously deletes all authorities associated with the specified user. /// /// The unique identifier of the user whose authorities will be removed. /// A task that represents the asynchronous operation. The task result is true if authorities were deleted; otherwise, false. + /// public Task DeleteAllAuthoritiesByUser(ObjectId userId); /// /// Deletes all authorities associated with the specified unit. /// /// The unique identifier of the unit whose authorities should be removed. /// A task that resolves to true if the authorities were successfully deleted; otherwise, false. + /// Task DeleteAllAuthoritiesByUnit(ObjectId unitId); /// /// Deletes all authorities associated with the specified display identifier. /// /// The identifier of the display whose related authorities should be removed. /// A task that resolves to a boolean indicating the outcome of the deletion operation. + /// Task DeleteAllAuthoritiesByDisplay(ObjectId displayId); /// /// Retrieves a list of authorizations associated with the specified unit identifier. /// /// The unique identifier of the unit whose authorizations are being requested. /// A task that represents the asynchronous operation, containing a list of objects matching the provided unit identifier. + /// Task> GetByUnitId(ObjectId unitId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/ICameraRepository.cs b/adas-core.Application/Repositories/Interfaces/ICameraRepository.cs index aa044190..c85db4dc 100644 --- a/adas-core.Application/Repositories/Interfaces/ICameraRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/ICameraRepository.cs @@ -12,30 +12,35 @@ public interface ICameraRepository : IMongoRepository /// /// The unique identifier of the camera to look up. /// A task that represents the asynchronous operation. The task result contains the matching , or null if no camera is found with the specified identifier. + /// Task GetById(ObjectId cameraId); /// /// Asynchronously retrieves a camera by its name, returning null if no matching camera is found. /// /// The name of the camera to look up. /// A that resolves to the matching , or null if no camera with the specified name exists. + /// Task GetByName(string name); /// /// Retrieves the list of objects associated with the specified configuration relays. /// /// The list of values identifying the configuration relays whose cameras should be returned. /// A containing the cameras linked to the provided configuration relays; returns an empty list when no matching cameras are found. + /// List GetCameraInList(List configurationRelayList); /// /// Retrieves a paginated, fluent queryable collection of cameras based on the supplied pagination filter. /// /// The pagination filter containing the page number and page size used to page the camera results. /// An representing the paged query of cameras. + /// IFindFluent GetPaginatedCameras(PaginationFilter request); /// /// Inserts a new camera record into the data store and returns the persisted entity, or null if the camera could not be inserted. /// /// The instance containing the data to be inserted. /// A that resolves to the inserted , or null when the insertion is not performed. + /// Task InsertOneCamera(Camera camera); /// /// Asynchronously updates an existing camera identified by the specified object identifier. @@ -43,11 +48,13 @@ public interface ICameraRepository : IMongoRepository /// The unique identifier of the camera to update. /// The camera object containing the updated information. /// A task that represents the asynchronous update operation. The task result contains the updated , or null if no camera with the specified identifier was found. + /// Task UpdateCameraAsync(ObjectId objectId, Camera camera); /// /// Asynchronously searches for cameras whose name matches the specified text. /// /// The text used to filter cameras by name. /// A task that represents the asynchronous operation, containing a list of objects matching the search criteria. + /// Task> GetSearchByNameCameras(string textToSearch); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IConfigObservationRepository.cs b/adas-core.Application/Repositories/Interfaces/IConfigObservationRepository.cs index 95101666..2c3c60c2 100644 --- a/adas-core.Application/Repositories/Interfaces/IConfigObservationRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IConfigObservationRepository.cs @@ -11,6 +11,7 @@ public interface IConfigObservationRepository : IMongoRepository /// The unique identifier of the configuration observation to locate. /// A task that represents the asynchronous operation. The task result contains the if found, or null if no observation matches the specified identifier. + /// Task FindById(ObjectId id); /// @@ -19,6 +20,7 @@ public interface IConfigObservationRepository : IMongoRepository /// The configuration observation containing the updated values to persist. /// A task that resolves to the updated , or null if the observation does not exist. + /// Task Update(ConfigObservation configObservation); /// @@ -26,18 +28,21 @@ public interface IConfigObservationRepository : IMongoRepository /// The unique identifier of the configuration observation to delete. /// A task that represents the asynchronous delete operation. The task result contains the deleted configuration observation, or null if no observation with the specified identifier was found. + /// Task Delete(ObjectId id); /// /// Asynchronously retrieves all available identifiers, returning them as a list of values. /// /// A that represents the asynchronous operation, containing a list of all instances found. + /// Task> FindAllIds(); /// /// Retrieves all configuration observations available in the system. /// /// A task that represents the asynchronous operation. The task result contains a collection of instances. + /// Task> FindAll(); /// @@ -45,28 +50,33 @@ public interface IConfigObservationRepository : IMongoRepository /// The identifier used to look up the configuration names. /// A task that represents the asynchronous operation, containing a list of configuration names. + /// Task> GetConfigNames(string id); /// /// Asynchronously retrieves the list of available configuration names. /// /// A task that represents the asynchronous operation, containing the list of configuration names. + /// Task> GetConfigNames(); /// /// Asynchronously retrieves the total count of items. /// /// A task that represents the asynchronous operation, containing the total count as a . + /// Task Count(); /// /// Retrieves a paginated collection of configuration observations based on the specified filter. /// /// The pagination filter that defines the page size, page number, and any additional criteria used to retrieve the observations. /// A task that represents the asynchronous operation, containing a collection of items that match the pagination criteria. + /// Task> GetPaginatedItems(PaginationFilter filter); /// /// Retrieves a configuration observation that matches the specified name. /// /// The name of the configuration observation to find. /// A task that represents the asynchronous operation. The task result contains the matching ConfigObservation if found; otherwise, null. + /// Task FindByName(string name); /// /// Retrieves a matching the specified coding system and code. @@ -74,18 +84,21 @@ public interface IConfigObservationRepository : IMongoRepositoryThe coding system identifier used to look up the configuration observation. /// The code value within the specified coding system used to look up the configuration observation. /// A task that represents the asynchronous operation. The task result contains the matching if found; otherwise, null. + /// Task GetByCodeSysAndCode(string? codingSystem, string? code); /// /// Asynchronously inserts the specified configuration observation item and returns the persisted entity. /// /// The configuration observation to insert. /// A task that represents the asynchronous insert operation, containing the inserted . + /// Task InsertOneAsyncAndReturn(ConfigObservation configObservationItem); /// /// Asynchronously retrieves all records matching the specified name. /// /// The name used to look up the configuration observations. /// A task that represents the asynchronous operation. The task result contains a list of objects matching the given name, or an empty list if none are found. + /// Task> FindAllByName(string name); /// @@ -96,6 +109,7 @@ public interface IConfigObservationRepository : IMongoRepositoryThe name used to look up the configuration observation item, or if not specified. /// The original name used to look up the configuration observation item, or if not specified. /// A task that represents the asynchronous operation. The task result contains the matching item, or if no item matches the specified criteria. + /// Task GetSingleConfigObservationItem(string? code, string? codingSystem, string? name, string? originalName); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IConfigPumpsRepository.cs b/adas-core.Application/Repositories/Interfaces/IConfigPumpsRepository.cs index c061ed21..5dfd2dc5 100644 --- a/adas-core.Application/Repositories/Interfaces/IConfigPumpsRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IConfigPumpsRepository.cs @@ -10,11 +10,13 @@ public interface IConfigPumpsRepository : IMongoRepository /// /// The unique identifier of the configuration to look up. /// A task that yields the matching ConfigPumps instance, or null if no configuration is found for the specified id. + /// Task FindById(string id); /// /// Retrieves all pump configurations asynchronously. /// /// A task that represents the asynchronous operation, containing a list of if found, or null if no configurations are available. + /// Task?> GetAllConfigs(); /// @@ -22,11 +24,13 @@ public interface IConfigPumpsRepository : IMongoRepository /// /// The pumps configuration to be persisted. /// A task that resolves to the updated instance, or if the configuration could not be found. + /// Task UpdateConfig(ConfigPumps config); /// /// Asynchronously deletes the specified pump configuration. /// /// The pump configuration to delete. /// A task that represents the asynchronous operation. The task result contains true if the configuration was successfully deleted; otherwise, false. + /// Task DeleteConfig(ConfigPumps config); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IConfigUnitsRepository.cs b/adas-core.Application/Repositories/Interfaces/IConfigUnitsRepository.cs index c9d86c0a..dc6aabc5 100644 --- a/adas-core.Application/Repositories/Interfaces/IConfigUnitsRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IConfigUnitsRepository.cs @@ -10,5 +10,6 @@ public interface IConfigUnitsRepository : IMongoRepository /// /// The unique identifier of the configuration unit to look up. /// A task that represents the asynchronous operation, containing the matching or null if no entity is found. + /// Task FindById(string id); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IDeviceRepository.cs b/adas-core.Application/Repositories/Interfaces/IDeviceRepository.cs index de13c229..bda99a8f 100644 --- a/adas-core.Application/Repositories/Interfaces/IDeviceRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IDeviceRepository.cs @@ -11,24 +11,28 @@ public interface IDeviceRepository : IMongoRepository /// /// The MAC address used to look up the device. /// A task that represents the asynchronous operation, containing the matching or null when no device is found. + /// Task FindByMacAddr(string deviceDtoMacAddr); /// /// Finds and returns the device matching the specified serial number, or null if no matching device is found. /// /// The serial number used to look up the device. /// A instance if a match is found; otherwise, null. + /// Task FindBySerialNumber(string deviceDtoSerialNumber); /// /// Asynchronously finds a device by its unique identifier (UUID) and returns the matching device, or null if no device is found. /// /// The UUID string used to look up the device. /// A that resolves to the matching , or null when no device matches the provided UUID. + /// Task FindByUuid(string deviceDtoUuid); /// /// Retrieves a device by its unique key identifier. /// /// The key identifier of the device to look up. /// A task that represents the asynchronous operation. The task result contains the if a matching device is found, or null if no device corresponds to the specified key. + /// Task FindByKey(string deviceDtoKey); /// /// Updates the statistics of an existing device identified by the specified identifier. @@ -36,5 +40,6 @@ public interface IDeviceRepository : IMongoRepository /// The unique identifier of the device whose statistics will be updated. /// The device data transfer object representing the existing device to be updated. /// A task that represents the asynchronous update operation. + /// Task UpdateDeviceStats(ObjectId id,DeviceDto deviceExist); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IDiagnosisArchiveRepository.cs b/adas-core.Application/Repositories/Interfaces/IDiagnosisArchiveRepository.cs index c8f94d33..c3a545e8 100644 --- a/adas-core.Application/Repositories/Interfaces/IDiagnosisArchiveRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IDiagnosisArchiveRepository.cs @@ -9,16 +9,19 @@ public interface IDiagnosisArchiveRepository /// /// The patient diagnosis entity to be persisted. /// A task that represents the asynchronous insert operation. + /// Task InsertOneAsync(PatientDiagnosis patientDiagnosis); /// /// Asynchronously deletes items that occurred before the specified cutoff date. /// /// The cutoff date; items dated prior to this value will be deleted. + /// Task DeleteBeforeDate(DateTime date); /// /// Inserts a batch of patient diagnosis records into the data store. /// /// The collection of entities to insert. /// A representing the asynchronous operation, containing the result of the batch insertion. + /// Task InsertBatch(IEnumerable diagnosis); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IDiagnosisRepository.cs b/adas-core.Application/Repositories/Interfaces/IDiagnosisRepository.cs index 27dd3065..f21b6b3b 100644 --- a/adas-core.Application/Repositories/Interfaces/IDiagnosisRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IDiagnosisRepository.cs @@ -11,17 +11,20 @@ public interface IDiagnosisRepository : IMongoRepository /// /// The unique identifier of the patient whose diagnoses are to be retrieved. /// A task that represents the asynchronous operation, containing a list of objects for the specified patient. + /// Task> GetByPatient(ObjectId patientId); /// /// Asynchronously inserts a single patient diagnosis record into the data store. /// /// The patient diagnosis entity to insert. + /// new Task InsertOneAsync(PatientDiagnosis diagnosis); /// /// Asynchronously deletes the entity identified by the specified identifier. /// /// The unique identifier of the entity to delete. + /// new Task DeleteAsync(ObjectId id); /// /// Updates many records by replacing the existing identified by with the new , scoped to the specified . @@ -29,17 +32,20 @@ public interface IDiagnosisRepository : IMongoRepository /// The identifier of the field or collection on which the update is performed. /// The new value to assign. /// The existing value to be replaced. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); /// /// Asynchronously finds all patient diagnoses associated with the specified patient identifier, returning a cursor to iterate over the matching documents. /// /// The unique identifier of the patient whose diagnoses should be retrieved. /// A task that represents the asynchronous operation, containing an IAsyncCursor of PatientDiagnosis that yields the matching documents. + /// Task> FindByPatientIdAsync(ObjectId patientId); /// /// Asynchronously deletes records associated with the specified patient identifier. /// /// The unique of the patient whose related records should be removed. + /// Task DeleteByPatientId(ObjectId patientId); /// /// Asynchronously retrieves the associated with the specified patient, diagnosis code, and coding system. @@ -49,5 +55,6 @@ public interface IDiagnosisRepository : IMongoRepository /// The diagnosis code to match. May be null. /// The coding system of the diagnosis code (for example, ICD-10 or SNOMED). May be null. /// A task that resolves to the matching , or null if no diagnosis matches the given criteria. + /// Task FindByPatientIdAndCode(ObjectId patientId, string? diagnosisCode, string? codingSystem); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IDischargeRepository.cs b/adas-core.Application/Repositories/Interfaces/IDischargeRepository.cs index 6779e7f1..902553df 100644 --- a/adas-core.Application/Repositories/Interfaces/IDischargeRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IDischargeRepository.cs @@ -12,12 +12,14 @@ public interface IDischargeRepository : IMongoRepository /// Deletes the entity identified by the specified identifier. /// /// The unique identifier of the entity to delete. + /// Task Delete(ObjectId id); /// /// Asynchronously updates an existing discharge record. /// /// The discharge entity containing the updated information to be persisted. + /// Task Update(Discharge discharge); /// @@ -25,6 +27,7 @@ public interface IDischargeRepository : IMongoRepository /// /// The unique identifier of the object whose unit will be updated. /// The new unit value to assign to the object. + /// Task UpdateUnit(ObjectId id, string unit); /// @@ -32,12 +35,14 @@ public interface IDischargeRepository : IMongoRepository /// /// The unique identifier of the patient to update. /// The patient object containing the updated information to be applied to the existing record. + /// Task UpdatePatient(ObjectId id, Patient patient); /// /// Asynchronously retrieves all discharge records. /// /// A task that represents the asynchronous operation. The task result contains a collection of all entities. + /// Task> FindAll(); /// @@ -45,6 +50,7 @@ public interface IDischargeRepository : IMongoRepository /// /// The unique identifier of the discharge record to find. /// A task that represents the asynchronous operation. The task result contains the if a matching record is found; otherwise, null. + /// Task FindById(ObjectId id); /// @@ -52,6 +58,7 @@ public interface IDischargeRepository : IMongoRepository /// /// The unit identifier used to filter the discharge records. /// A task that represents the asynchronous operation. The result is an of containing the matching records, or when no records are found. + /// Task?> FindByUnit(string unit); /// @@ -59,6 +66,7 @@ public interface IDischargeRepository : IMongoRepository /// /// The ObjectId of the unit whose associated records will be counted. /// A task that represents the asynchronous operation. The task result contains the count of records for the specified unit. + /// Task CountByUnitId(ObjectId unitId); /// @@ -66,6 +74,7 @@ public interface IDischargeRepository : IMongoRepository /// /// The destination identifier used to look up matching discharge records. /// A task that yields an of matching discharge records, or null if no records are found for the given destination. + /// Task?> FindByDestination(string destination); /// @@ -74,12 +83,14 @@ public interface IDischargeRepository : IMongoRepository /// /// The service identifier used to look up matching discharge records. /// A task that represents the asynchronous operation. The result is an of entries for the specified service, or null if none are found. + /// Task?> FindByService(string service); /// /// Asynchronously retrieves a collection of records associated with the specified unit identifiers. /// /// The collection of unit identifiers used to look up the matching discharges. May be null. /// A task that represents the asynchronous operation, containing a collection of objects, or null when no matching discharges are available. + /// Task?> GetDischargesByUnitIds(IEnumerable? unitIds); @@ -88,12 +99,14 @@ public interface IDischargeRepository : IMongoRepository /// /// The patient location used to look up the associated discharge record. /// A task that represents the asynchronous operation. The task result contains the matching if found; otherwise, null. + /// Task GetDischargeByLocation(PatientLocation location); /// /// Retrieves the discharge record associated with the specified patient identifier, or if no discharge exists for that patient. /// /// The unique identifier of the patient whose discharge record is being requested. /// A that resolves to the matching , or when no record is found. + /// Task GetByPatientId(ObjectId patientId); /// @@ -101,12 +114,14 @@ public interface IDischargeRepository : IMongoRepository /// /// The point-of-care identifier used to look up the associated discharges. /// A task that returns an of records, or if no discharges are found for the given point-of-care identifier. + /// Task?> FindByPoCId(ObjectId pocId); /// /// Retrieves the discharge associated with the specified point of care identifier. /// /// The identifier of the point of care used to look up the discharge. /// A task that returns the matching if one is found; otherwise, null. + /// Task GetDischargeByPointOfCareId(ObjectId poc); /// @@ -116,6 +131,7 @@ public interface IDischargeRepository : IMongoRepository /// The update option master list data transfer object containing the new option details. /// The name of the type to which the master list option applies. /// A task that represents the asynchronous operation. The task result contains a collection of updated Discharge records. + /// Task> UpdateMasterListOption(List unitIds, UpdateOptionMasterListDto opt, string typeName); @@ -126,11 +142,13 @@ public interface IDischargeRepository : IMongoRepository /// The master list option to delete. /// The type name associated with the option. /// A task that represents the asynchronous operation, containing the collection of objects resulting from the deletion. + /// Task> DeleteMasterListOption(List unitIds, OptionList opt, string typeName); /// /// Deletes the entity associated with the specified unit identifier. /// /// The unique identifier of the unit whose associated record should be removed. /// A task that represents the asynchronous operation. The result is true if a record was deleted; otherwise, false. + /// Task DeleteByUnitId(ObjectId unitId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IDisplayCardConfigRepository.cs b/adas-core.Application/Repositories/Interfaces/IDisplayCardConfigRepository.cs index 195c4052..ca1313c4 100644 --- a/adas-core.Application/Repositories/Interfaces/IDisplayCardConfigRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IDisplayCardConfigRepository.cs @@ -10,29 +10,34 @@ public interface IDisplayCardConfigRepository : IMongoRepository /// Asynchronously retrieves all available card configurations. /// /// A task that represents the asynchronous operation. The task result contains a list of all items. + /// Task> GetAll(); /// /// Retrieves a card configuration by its unique identifier, returning null when no matching configuration is found. /// /// The unique identifier of the card configuration to look up. /// A that yields the matching if found; otherwise, null. + /// Task GetById(ObjectId configId); /// /// Asynchronously inserts a new into the data store and returns the persisted record, which may include database-generated values. /// /// The instance to insert. /// A that yields the inserted , or null if the record could not be persisted. + /// Task InsertOneAsyncAndReturn(CardConfig config); /// /// Updates a single record based on the provided configuration. /// /// The to update. May be null to indicate no update payload was provided. /// A task that resolves to an containing the updated , or null if no matching record was found. + /// Task> UpdateOne(CardConfig? config); /// /// Deletes a single card configuration identified by the specified identifier, returning the removed configuration when found. /// /// The unique identifier of the card configuration to delete. /// A task that represents the asynchronous delete operation. The task result contains the deleted , or null if no configuration with the specified identifier exists. + /// Task DeleteOne(ObjectId configId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IDisplayChartConfigRepository.cs b/adas-core.Application/Repositories/Interfaces/IDisplayChartConfigRepository.cs index ae7d01df..486579bf 100644 --- a/adas-core.Application/Repositories/Interfaces/IDisplayChartConfigRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IDisplayChartConfigRepository.cs @@ -10,29 +10,34 @@ public interface IDisplayChartConfigRepository : IMongoRepository /// Asynchronously retrieves all chart configurations. /// /// A task that represents the asynchronous operation, containing a list of objects. + /// Task> GetAll(); /// /// Asynchronously retrieves a by its unique identifier, returning null if no matching configuration is found. /// /// The identifier of the chart configuration to look up. /// A task that yields the matching , or null when no configuration exists for the specified id. + /// Task GetById(ObjectId configId); /// /// Asynchronously inserts a new chart configuration into the data store and returns the persisted entity, which may be null if no record is produced. /// /// The chart configuration to insert. /// A task that represents the asynchronous insert operation, containing the inserted or null when the operation yields no result. + /// Task InsertOneAsyncAndReturn(ChartConfig config); /// /// Updates a single chart configuration and returns the operation result wrapped in an update response. /// /// The chart configuration to update. May be null. /// A task containing the update response with the updated chart configuration, which may be null. + /// Task> UpdateOne(ChartConfig? config); /// /// Deletes a single chart configuration identified by its unique identifier. Returns the deleted configuration, or if no matching configuration was found. /// /// The unique identifier of the chart configuration to delete. /// A task that resolves to the deleted , or if no configuration with the specified id exists. + /// Task DeleteOne(ObjectId configId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IDisplayConfigRepository.cs b/adas-core.Application/Repositories/Interfaces/IDisplayConfigRepository.cs index 9ec0d716..02c68294 100644 --- a/adas-core.Application/Repositories/Interfaces/IDisplayConfigRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IDisplayConfigRepository.cs @@ -15,18 +15,21 @@ public interface IDisplayConfigRepository : IMongoRepository /// Asynchronously retrieves all display configurations. /// /// A task that represents the asynchronous operation. The task result contains a list of all entries. + /// Task> GetAll(); /// /// Retrieves a paginated set of entities projected as . /// /// The pagination filter applied to the query. /// An that produces the paginated results. + /// IFindFluent GetAllPaginated(PaginationFilter request); /// /// Asynchronously retrieves the list of display configurations that match the specified display type. /// /// The display type used to filter the returned display configurations. /// A task that represents the asynchronous operation, containing the list of entries matching the specified type. + /// Task> GetByType(DisplayConfigEnums.DisplayType type); /// /// Retrieves a entity by its unique identifier asynchronously. @@ -34,6 +37,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// /// The unique identifier of the display configuration to retrieve. /// A task that represents the asynchronous operation. The task result contains the if found, or null if no matching record exists. + /// Task GetById(ObjectId id); /// /// Asynchronously retrieves the default for the specified display type. @@ -41,12 +45,14 @@ public interface IDisplayConfigRepository : IMongoRepository /// /// The display type used to look up the default configuration. /// A task that represents the asynchronous operation. The task result contains the default for the given type, or null if no default exists. + /// Task GetDefault(DisplayConfigEnums.DisplayType type); /// /// Asynchronously inserts a new and returns the persisted entity, typically populated with any server-generated values. /// /// The to insert. /// A task that represents the asynchronous operation. The task result contains the inserted , or when no result is returned. + /// Task InsertOneAsyncAndReturn(DisplayConfig config); /// /// Updates the smart display configuration identified by the specified ID with the provided new configuration. @@ -54,6 +60,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// The unique identifier of the smart display configuration to update. /// The new smart display configuration to apply. /// A task that represents the asynchronous update operation, containing the updated smart display configuration, or null if no configuration with the given ID was found. + /// Task UpdateSmartDisplay(ObjectId displayConfigId, SmartDisplay? newDisplayConfig); /// @@ -63,6 +70,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// The new display nurse configuration data, or null if not provided. /// The list of nurse observations to associate with the configuration. /// A task that represents the asynchronous operation, containing the updated or null if not found. + /// Task UpdateDisplayNurse(ObjectId displayConfigId, DisplayNurseDto? newDisplayConfig, List nurseObs); @@ -73,6 +81,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// The identifier of the unit whose default display configuration is being requested. /// The display type used to filter the configuration lookup. /// A task containing the matching , or null if no default configuration is found for the given unit and display type. + /// Task GetDefaultByUnitIdAndType(ObjectId unitId, DisplayConfigEnums.DisplayType displayType); /// /// Asynchronously updates the color configuration for the specified config display entry. @@ -80,6 +89,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// The unique identifier of the config display whose color configuration will be updated. /// The new color configuration to apply to the config display. /// A task that resolves to true if the color configuration was successfully updated; otherwise, false. + /// Task UpdateConfigColor(ObjectId objectIdConfigDisplay, ColorConfig colorConfig); /// /// Updates the home banner configuration identified by the specified config display ObjectId with the provided list of banner items. @@ -87,6 +97,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// The ObjectId of the config display whose home banner set will be updated. /// The collection of banner items to apply to the home banner set. /// A task that resolves to true if the home banner set was updated successfully; otherwise, false. + /// Task UpdateSetHomeBanner(ObjectId objectIdConfigDisplay, List bannerItems); /// /// Updates the base display configuration identified by the specified object identifier with the provided configuration data. @@ -94,6 +105,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// The object identifier of the configuration display entry to update. /// The new base display configuration values to apply. /// A task that represents the asynchronous operation. The result is true if the update succeeded; otherwise, false. + /// Task UpdateBaseConfig(ObjectId objectIdConfigDisplay, DisplayConfig baseConfig); /// /// Updates an existing header configuration associated with the specified configuration display identifier. @@ -101,6 +113,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// The unique identifier of the configuration display whose header configuration is being updated. /// The new header configuration values to apply. /// A task that represents the asynchronous operation. The task result is true if the header configuration was successfully updated; otherwise, false. + /// Task UpdateHeaderConfig(ObjectId objectIdConfigDisplay, HeaderConfig headerConfig); /// /// Updates the hospital name associated with the specified display configuration. @@ -108,6 +121,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// The identifier of the display configuration to update. /// The new hospital name to apply to the display configuration. /// A task that represents the asynchronous operation. The task result is true if the update succeeded; otherwise, false. + /// Task UpdateDisplayConfigHospitalName(ObjectId objectIdConfigDisplay, string name); /// /// Updates the field list associated with the specified configuration display. @@ -115,29 +129,34 @@ public interface IDisplayConfigRepository : IMongoRepository /// The identifier of the configuration display whose field list is being updated. /// The list of fields to apply to the configuration display. /// A task that resolves to true if the field list was updated successfully; otherwise, false. + /// Task UpdateFieldList(ObjectId objectIdConfigDisplay, List fields); /// /// Deletes a display configuration identified by the specified object ID. /// /// The object ID of the display configuration to delete. /// A task that represents the asynchronous delete operation. The task result contains the deleted display configuration, or null if no configuration was found with the specified ID. + /// Task DeleteDisplayConfig(ObjectId objectIdConfigDisplay); /// /// Retrieves all display configurations in a compact, minimal representation. /// /// A task containing a list of objects representing the display configurations. + /// Task> GetAllCompact(); /// /// Retrieves all object identifiers associated with the specified card configuration identifier. /// /// The identifier of the card configuration whose related objects should be returned. /// A task that represents the asynchronous operation, containing a list of values linked to the given card configuration. + /// Task> GetAllByCardConfigId(ObjectId cardConfigId); /// /// Asynchronously retrieves a list of ObjectIds associated with the specified card configuration that are marked as rotating. /// /// The ObjectId of the card configuration used to filter the results. /// A task representing the asynchronous operation, containing a list of ObjectIds that match the given card configuration and rotating criteria. + /// Task> GetAllByCardConfigIdAndRotating(ObjectId cardConfigId); /// /// Updates the card configuration identifier for the specified display configuration and result. @@ -145,6 +164,7 @@ public interface IDisplayConfigRepository : IMongoRepository /// The identifier of the display configuration whose card configuration will be updated. /// The identifier of the result associated with the card configuration update. /// A task that resolves to true if the update succeeded; otherwise, false. + /// Task UpdateCardConfigId(ObjectId? displayConfigId, ObjectId? resultId); /// /// Adds a chart identifier to the specified display configuration asynchronously. @@ -152,18 +172,21 @@ public interface IDisplayConfigRepository : IMongoRepository /// The identifier of the display configuration to which the chart ID will be added, or null when no specific configuration is targeted. /// The chart identifier to add. /// A task that represents the asynchronous operation. The task result is true if the chart identifier was successfully added; otherwise, false. + /// Task AddChartId(ObjectId? displayConfigId, ObjectId newChartIdToAdd); /// /// Updates the configuration of a chart that was previously deleted, using the specified identifier. /// /// The identifier of the deleted chart configuration to update. /// A task that represents the asynchronous update operation, containing the result of the update. + /// Task UpdateDeletedChartConfig(ObjectId deletedId); /// /// Asynchronously retrieves the chart configuration associated with the specified chart object identifier. /// /// The unique object identifier of the chart configuration to retrieve. /// A task that represents the asynchronous operation, containing the associated with the specified identifier. + /// Task GetChartConfig(ObjectId objectIdConfigChart); /// /// Asynchronously updates the detail configuration identifier, associating it with the specified result identifier. @@ -171,11 +194,13 @@ public interface IDisplayConfigRepository : IMongoRepository /// The nullable identifier of the display configuration to update. /// The nullable identifier of the result to associate with the configuration. /// A task that represents the asynchronous operation, containing a boolean indicating whether the update was successful. + /// Task UpdateDetailConfigId(ObjectId? displayConfigId, ObjectId? resultId); /// /// Asynchronously retrieves a list of identifiers associated with the specified card detail base configuration. /// /// The identifier of the card detail base configuration to filter by. /// A task that represents the asynchronous operation, containing a list of values matching the provided base configuration identifier. + /// Task> GetAllByCardDetailConfigId(ObjectId baseConfigId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IDisplayDetailConfigRepository.cs b/adas-core.Application/Repositories/Interfaces/IDisplayDetailConfigRepository.cs index 3390d550..f5d2b543 100644 --- a/adas-core.Application/Repositories/Interfaces/IDisplayDetailConfigRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IDisplayDetailConfigRepository.cs @@ -10,6 +10,7 @@ public interface IDisplayDetailConfigRepository : IMongoRepository /// A task that represents the asynchronous operation. The task result contains a list of all entries. + /// Task> GetAll(); /// /// Retrieves a by its unique identifier. @@ -17,23 +18,27 @@ public interface IDisplayDetailConfigRepository : IMongoRepository /// The identifier of the card details configuration to retrieve. /// A task that represents the asynchronous operation, containing the matching or if not found. + /// Task GetById(ObjectId configId); /// /// Asynchronously inserts a new card details configuration and returns the inserted entity. /// /// The card details configuration to insert. /// A task representing the asynchronous operation, containing the inserted , or null if no entity was returned. + /// Task InsertOneAsyncAndReturn(CardDetailsConfig config); /// /// Updates a single card details configuration record asynchronously. /// /// The card details configuration to update. May be . /// A task that represents the asynchronous operation, containing the update response with the updated or when no configuration is found. + /// Task> UpdateOne(CardDetailsConfig? config); /// /// Deletes a single identified by its unique identifier. /// /// The unique identifier of the to delete. /// A task that represents the asynchronous operation, containing the deleted , or null if no matching configuration was found. + /// Task DeleteOne(ObjectId configId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IDisplayRepository.cs b/adas-core.Application/Repositories/Interfaces/IDisplayRepository.cs index 3e8d16c1..ef7cae2c 100644 --- a/adas-core.Application/Repositories/Interfaces/IDisplayRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IDisplayRepository.cs @@ -14,6 +14,7 @@ public interface IDisplayRepository : IMongoRepository /// Retrieves every display stored in the collection. /// /// A representing the asynchronous operation. The task result contains all displays, or an empty list if none exist. + /// Task> GetAll(); @@ -22,6 +23,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The to filter by. /// A representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist. + /// Task> GetByPointOfCare(PointOfCare pointOfCare); // Task> GetByUser(); @@ -31,6 +33,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The display name to look up. /// A representing the asynchronous operation. The task result contains the if found; otherwise, . + /// Task GetByName(string name); /// @@ -38,6 +41,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The of the display to retrieve. /// A representing the asynchronous operation. The task result contains the if found; otherwise, . + /// Task GetById(ObjectId id); /// @@ -45,6 +49,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The of the display to retrieve. /// A representing the asynchronous operation. The task result contains the with its config populated if found; otherwise, . + /// Task GetByIdWithConfigDisplay(ObjectId id); /// @@ -52,6 +57,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The of the unit. /// A representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist. + /// Task> GetByUnitId(ObjectId id); /// @@ -59,6 +65,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The of the display configuration to filter by. /// A representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist. + /// Task> GetByConfigId(ObjectId id); /// @@ -67,6 +74,7 @@ public interface IDisplayRepository : IMongoRepository /// The of the display to update. /// The new list of values representing the point-of-cares to associate with the display. /// A representing the asynchronous operation. The task result contains the updated if the update succeeded; otherwise, . + /// Task UpdatePointOfCareList(ObjectId objectId, List listPocObId); /// @@ -75,6 +83,7 @@ public interface IDisplayRepository : IMongoRepository /// The of the display whose configuration should be replaced. /// The new instance to assign to the display. /// A representing the asynchronous operation. The task result contains the updated if the update succeeded; otherwise, . + /// Task UpdateConfig(ObjectId oldDisplayId, DisplayConfig newDisplayConfigCast); /// @@ -83,6 +92,7 @@ public interface IDisplayRepository : IMongoRepository /// The of the display to update. /// The of the display-config preset to associate. /// A representing the asynchronous operation. The task result contains the updated if the update succeeded; otherwise, . + /// Task UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay); /// @@ -91,6 +101,7 @@ public interface IDisplayRepository : IMongoRepository /// The instance to update. Its is used to identify the document. /// The new display name. /// A representing the asynchronous operation. The task result contains the updated . + /// Task UpdateName(Display display, string name); /// @@ -98,6 +109,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The containing pagination and filter criteria. /// An instance that can be used to further refine and execute the query. + /// IFindFluent GetPaginatedDisplays(PaginationFilter filter); /// @@ -105,6 +117,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The of the display configuration to check for usage. /// A representing the asynchronous operation. The task result contains the number of displays referencing the configuration. + /// Task IsDisplayConfigInUse(ObjectId displayConfigId); /// @@ -113,6 +126,7 @@ public interface IDisplayRepository : IMongoRepository /// The of the display to update. /// The new of the display configuration to associate with the display. /// A representing the asynchronous operation. The task result contains the updated if the update succeeded; otherwise, . + /// Task UpdateConfigId(ObjectId objectId, ObjectId displayConfigId); /// @@ -120,6 +134,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The of the unit. /// A representing the asynchronous operation. The task result contains the number of displays for the unit. + /// Task CountByUnitId(ObjectId unitId); /// @@ -127,6 +142,7 @@ public interface IDisplayRepository : IMongoRepository /// /// The of the unit whose displays should be removed. /// A representing the asynchronous operation. The task result is when at least one display was deleted; otherwise, . + /// Task DeleteManyByUnitId(ObjectId unitId); /// @@ -134,5 +150,6 @@ public interface IDisplayRepository : IMongoRepository /// /// The of the card configuration to filter by. /// A representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist. + /// Task> GetByCardConfigId(ObjectId configId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IHistoricalConfigChangesRepository.cs b/adas-core.Application/Repositories/Interfaces/IHistoricalConfigChangesRepository.cs index b0ee6f55..5813bfe8 100644 --- a/adas-core.Application/Repositories/Interfaces/IHistoricalConfigChangesRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IHistoricalConfigChangesRepository.cs @@ -12,6 +12,7 @@ public interface IHistoricalConfigChangesRepository : IMongoRepository /// The unique identifier of the historical configuration changes record to look up. /// A task that represents the asynchronous operation. The task result contains the matching record, or null if no record with the specified identifier exists. + /// Task FindById(ObjectId id); /// @@ -19,6 +20,7 @@ public interface IHistoricalConfigChangesRepository : IMongoRepository /// The historical config change entity containing the values to persist. /// A task that represents the asynchronous update operation. The result is the updated historical config change, or null if the record was not found. + /// Task Update(HistoricalConfigChanges historicalConfigChange); /// @@ -27,24 +29,28 @@ public interface IHistoricalConfigChangesRepository : IMongoRepository /// The unique identifier of the historical configuration change to delete. /// A task that represents the asynchronous delete operation, containing the deleted record, or null if no matching record exists. + /// Task Delete(ObjectId id); /// /// Asynchronously retrieves a list of all object identifiers. /// /// A task that represents the asynchronous operation. The task result contains a list of ObjectId values. + /// Task> FindAllIds(); /// /// Asynchronously retrieves all historical configuration changes. /// /// A task that represents the asynchronous operation. The task result contains a collection of records. + /// Task> FindAll(); /// /// Asynchronously inserts a new record into the data store. /// /// The historical config change entity to insert. /// A task that represents the asynchronous insert operation, containing the inserted entity, or null if the insertion did not produce a result. + /// new Task InsertOneAsync(HistoricalConfigChanges patientObservation); /// @@ -53,6 +59,7 @@ public interface IHistoricalConfigChangesRepository : IMongoRepositoryThe configuration type used to filter the historical changes. /// The maximum number of recent changes to return. Defaults to 10. /// A task that returns a collection of historical configuration changes matching the specified type, ordered from most recent. + /// Task> FindLastHistoricalConfigChangesByType( DisplayConfigEnums.ConfigTypes cfgType, int num = 10); @@ -63,6 +70,7 @@ public interface IHistoricalConfigChangesRepository : IMongoRepositoryOptional. The configuration type to filter the results by. If null, changes across all configuration types are returned. /// The maximum number of historical changes to return. Defaults to 10. /// A task representing the asynchronous operation, containing a collection of historical configuration changes for the user. + /// Task> FindLastHistoricalConfigChangesByUser(string user, DisplayConfigEnums.ConfigTypes? cfgType = null, int num = 10); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/ILightBeaconRepository.cs b/adas-core.Application/Repositories/Interfaces/ILightBeaconRepository.cs index cf88029f..18189d2d 100644 --- a/adas-core.Application/Repositories/Interfaces/ILightBeaconRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/ILightBeaconRepository.cs @@ -12,35 +12,41 @@ public interface ILightBeaconRepository : IMongoRepository /// /// The collection of configuration relay values used to look up the corresponding light beacons. /// A containing the light beacons matching the provided configuration relay identifiers; returns an empty list if no matches are found. + /// List GetLightBeaconInList(List configurationRelayList); /// /// Retrieves a light beacon by its associated relay identifier. /// /// The unique identifier of the relay used to look up the corresponding light beacon. /// A task that represents the asynchronous operation. The task result contains the matching , or null if no beacon is found for the specified relay. + /// Task GetById(ObjectId relayId); /// /// Asynchronously retrieves a by its name. /// /// The name of the light beacon to look up. /// A task that returns the matching , or null if no beacon with the specified name is found. + /// Task GetByName(string name); /// /// Asynchronously inserts a new LightBeacon and returns the persisted entity, or null if the insertion did not produce a result. /// /// The LightBeacon entity to insert. /// A task containing the inserted LightBeacon, or null when no entity was returned by the underlying operation. + /// Task InsertOneAsyncAndReturn(LightBeacon beacon); /// /// Retrieves a paginated, queryable collection of light beacons (relays) based on the supplied pagination filter. /// /// The pagination filter that controls paging parameters applied to the relay list. /// An exposing the paginated relay result set for further querying or enumeration. + /// IFindFluent GetPaginatedRelays(PaginationFilter filter); /// /// Asynchronously retrieves a list of objects whose name matches the specified search text. /// /// The text used to search for matching entries by name. /// A task that represents the asynchronous operation, containing a list of objects that match the search criteria. + /// Task> GetSearchByName(string textToSearch); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IMasterListRepository.cs b/adas-core.Application/Repositories/Interfaces/IMasterListRepository.cs index b74437c2..e17f3b2d 100644 --- a/adas-core.Application/Repositories/Interfaces/IMasterListRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IMasterListRepository.cs @@ -12,11 +12,13 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// Deletes the entity identified by the specified identifier. /// /// The identifier of the entity to delete. + /// Task Delete(ObjectId id); /// /// Asynchronously updates the specified collection of items. /// /// The collection of items to update. + /// Task Update(T list); /// /// Asynchronously retrieves an entity identified by the specified , optionally resolving localized content using the given . Returns null when no matching entity is found. @@ -24,6 +26,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The unique identifier of the entity to look up. /// The optional locale used to resolve localized fields of the retrieved entity. /// A task that yields the matching entity, or null if the entity is not found. + /// Task FindById(ObjectId id, LocaleEnum? locale); /// /// Asynchronously retrieves an entity of type by its unique identifier. @@ -31,6 +34,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// /// The unique identifier of the entity to locate. /// A task that represents the asynchronous operation. The task result contains the entity of type if found, or null otherwise. + /// Task FindById(ObjectId id); /// /// Asynchronously retrieves an item identified by the specified master and option identifiers for the given locale. @@ -40,6 +44,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The identifier of the specific option item to retrieve within the master scope. /// The locale used to select the localized version of the option item. /// A that yields the matching , or null if no item is found. + /// Task FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale); /// /// Asynchronously retrieves an identified by the given master and option identifiers. @@ -47,17 +52,20 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The identifier of the master record that owns the option list. /// The identifier of the specific option item to locate within the master. /// A that yields the matching , or null when no item is found. + /// Task FindOptionItemById(ObjectId masterId, ObjectId optionId); /// /// Asynchronously retrieves all items of type T. /// /// A task that represents the asynchronous operation. The task result contains an enumerable collection of all items of type T. + /// Task> GetAll(); /// /// Retrieves all master list entries without applying optional filters or including related option data. /// Used to fetch the complete set of master list records for scenarios such as full enumeration or bulk operations. /// /// A task that represents the asynchronous operation, containing an with all available master list entries. + /// Task> GetAllWithoutOptions(); /// /// Asynchronously finds and returns an entity of type matching the specified . @@ -65,6 +73,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// /// The name used to look up the entity. /// A task that represents the asynchronous lookup, containing the matched entity of type or null if no match exists. + /// Task FindByName(string name); /// /// Retrieves a master list of option list entries filtered by the specified identifier and an optional text search that performs a contains match. @@ -72,6 +81,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The identifier used to scope the option list entries to be returned. /// An optional text used to filter entries whose content contains the specified value; may be null to skip text-based filtering. /// A task representing the asynchronous operation, containing a list of entries that match the identifier and the optional text search criteria. + /// Task> GetMasterListByIdAndTextSearchContaining(ObjectId id, string? textSearch); /// /// Asynchronously adds a to the master option list identified by the given . @@ -79,6 +89,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The identifier of the master option list to which the element will be added. /// The filter option list element to add to the master list. /// A task that represents the asynchronous operation. The task result contains the resulting , or null if no list is returned. + /// Task AddOptionToMasterList(ObjectId id, FilterOptionListElement opt); /// /// Updates an existing master list option identified by the specified identifier using the provided option data and locale, returning the updated option list. @@ -87,6 +98,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The new option list data to apply to the master list option. /// The locale used for the update operation. /// A task that represents the asynchronous operation, containing the updated if found, or null if no matching master list option exists. + /// Task UpdateMasterListOption(ObjectId id, OptionList newOpt, LocaleEnum locale); /// /// Updates an existing master list option identified by the given id with the provided data, returning the updated option or null if no matching option is found. @@ -94,6 +106,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The unique identifier of the master list option to update. /// The new option data to replace the existing master list option. /// A task representing the asynchronous operation, containing the updated , or null if no option with the specified id exists. + /// Task UpdateFullMasterListOption(ObjectId id, OptionList newOpt); /// /// Updates an existing master list option identified by the specified id with the provided new option data. @@ -101,6 +114,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The unique identifier of the master list option to update. /// The new option data to apply to the existing master list option. /// A task that represents the asynchronous operation, containing the updated , or null if no matching option was found. + /// Task UpdateMasterListOption(ObjectId id, OptionList newOpt); /// /// Deletes a master list option identified by the specified option ID. @@ -108,6 +122,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The identifier of the master list containing the option to delete. /// The identifier of the option to be deleted from the master list. /// A task that represents the asynchronous operation. The task result contains a boolean indicating whether the option was successfully deleted. + /// Task DeleteMasterListOption(ObjectId id, ObjectId deleteOptId); /// /// Updates the option details of an existing entry in the master list identified by the specified id. @@ -115,6 +130,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The unique identifier of the master list entry to update. /// The update payload containing the new option details to apply. /// A task that represents the asynchronous operation, containing the updated master list details, or null if no matching entry is found. + /// Task UpdateOptionDetailsToMasterList(ObjectId id, UpdateMasterListDetailsDto opt); /// /// Updates the name of an existing master list identified by the specified identifier. @@ -122,6 +138,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The unique identifier of the master list to update. /// The new name to assign to the master list. /// A task that represents the asynchronous operation. The task result is true if the master list was updated successfully; otherwise, false. + /// Task UpdateMasterListName(ObjectId id, string name); /// /// Asynchronously updates the description of a master list identified by the specified identifier. @@ -129,6 +146,7 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The unique identifier of the master list to update. /// The new description to set for the master list. /// A task that represents the asynchronous operation. The task result is if the update was successful; otherwise, . + /// Task UpdateMasterListDescription(ObjectId id, string description); /// /// Asynchronously removes the specified option from the master list associated with the given identifier. @@ -136,12 +154,14 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The identifier of the master list from which the option will be removed. /// The option to be removed from the master list. /// A task that represents the asynchronous removal operation. The task result contains true if the option was successfully removed; otherwise, false. + /// Task RemoveMasterListOption(ObjectId id, OptionList oldOpt); /// /// Retrieves a paginated master list using the specified pagination filter, returning a fluent queryable result. /// /// The pagination filter that defines the paging criteria applied to the master list query. /// An that represents the paginated queryable master list. + /// IFindFluent GetPaginatedMasterList(PaginationFilter filter); /// /// Retrieves a paginated collection of options associated with the specified list identifier, applying the provided pagination filter to control the result set. @@ -149,11 +169,13 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The pagination filter defining page size, page number, and related pagination constraints. /// The unique identifier of the list whose options should be retrieved. /// A task representing the asynchronous operation, containing a list of items for the requested page. + /// Task> GetPaginatedOptions(PaginationFilter filter, ObjectId listId); /// /// Asynchronously counts the number of items and returns the total. /// /// A task that represents the asynchronous operation. The task result contains the total count of items. + /// Task Count(); /// /// Retrieves a master list of entries identified by the given id, optionally applying the provided search and filtering options. @@ -161,5 +183,6 @@ public interface IMasterListRepository : IMongoRepository where T : Master /// The identifier of the master list to retrieve. /// Optional filter criteria used to narrow the returned options. May be null to return the full list without additional filtering. /// A task that represents the asynchronous operation, containing the list of items that match the specified id and filter, or an empty list if no matching entries are found. + /// Task> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement? filterOption); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IMedicineRepository.cs b/adas-core.Application/Repositories/Interfaces/IMedicineRepository.cs index 6d7cbb2b..65873920 100644 --- a/adas-core.Application/Repositories/Interfaces/IMedicineRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IMedicineRepository.cs @@ -12,6 +12,7 @@ public interface IMedicineRepository : IMongoRepository /// /// The code used to look up the medicine. /// A task that returns the matching if found, or null if no medicine matches the specified code. + /// Task GetMedicine(string code); /// @@ -19,17 +20,20 @@ public interface IMedicineRepository : IMongoRepository /// /// The list of codes or notes used to look up the medicines. /// A task that represents the asynchronous operation, containing the list of matching medicines. + /// Task> GetMedicineByCodeOrNote(List codeNotes); /// /// Retrieves a entity by its name asynchronously. /// /// The name of the medicine to look up. /// A that resolves to the matching , or null if no medicine with the specified name is found. + /// Task GetMedicineByName(string name); /// /// Asynchronously retrieves all medicines from the data source. /// /// A task that represents the asynchronous operation. The task result contains a list of objects; an empty list is returned when no medicines are found. + /// Task> GetAll(); /// /// Retrieves a medicine entity by its unique identifier from the data store. @@ -37,29 +41,34 @@ public interface IMedicineRepository : IMongoRepository /// /// The unique of the medicine to retrieve. /// A containing the matching if found, or when no record exists for the given identifier. + /// Task GetMedicineById(ObjectId medicineId); /// /// Asynchronously creates and posts a new medicine entry, returning the persisted on success or null when no result is produced. /// /// The medicine entity to be created and submitted. /// A task that resolves to the newly created , or null if the operation does not yield a result. + /// Task PostMedicine(Medicine medicine); /// /// Updates an existing medicine record with the provided information. /// /// The medicine entity containing the updated data, typically identified by its primary key. /// A task that represents the asynchronous operation. The task result contains the updated , or null if no matching medicine was found. + /// Task UpdateMedicine(Medicine medicine); /// /// Asynchronously deletes a medicine record from the data store using the specified identifier. /// /// The unique identifier of the medicine to delete. + /// Task DeleteMedicineById(ObjectId medicineId); /// /// Builds a MongoDB aggregation pipeline that retrieves the distinct values for the specified field. /// /// The name of the field whose distinct values should be queried. /// An representing the distinct field data query. + /// IAggregateFluent GetDistinctFieldDataQuery(string field); /// @@ -67,5 +76,6 @@ public interface IMedicineRepository : IMongoRepository /// /// The pagination filter containing the page number and page size used to control the result set. /// A fluent query interface for the paginated medicines. + /// IFindFluent GetPaginatedMedicines(PaginationFilter filter); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IMongoRepository.cs b/adas-core.Application/Repositories/Interfaces/IMongoRepository.cs index 401d90af..99d18d44 100644 --- a/adas-core.Application/Repositories/Interfaces/IMongoRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IMongoRepository.cs @@ -11,23 +11,27 @@ public interface IMongoRepository /// Gets the name of the collection. /// /// The name of the collection. + /// string GetCollectionName(); /// /// Asynchronously inserts a single object of type . /// /// The object to insert. /// A task that represents the asynchronous insert operation. + /// Task InsertOneAsync(T obj); /// /// Asynchronously deletes the entity identified by the specified identifier and returns the deleted entity. /// /// The unique identifier of the entity to delete. /// A task that represents the asynchronous operation, containing the deleted entity of type , or null if no matching entity was found. + /// Task DeleteAsync(ObjectId id); /// /// Asynchronously updates an existing document identified by the specified identifier with the provided object data. /// /// The unique identifier of the document to update. /// The object containing the updated values to persist. + /// Task UpdateOneAsync(ObjectId id, T obj); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/INoticeRepository.cs b/adas-core.Application/Repositories/Interfaces/INoticeRepository.cs index 688ecc7e..19b16d27 100644 --- a/adas-core.Application/Repositories/Interfaces/INoticeRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/INoticeRepository.cs @@ -9,39 +9,46 @@ public interface INoticeRepository : IMongoRepository /// Deletes the entity identified by the specified . /// /// The of the entity to delete. + /// Task Delete(ObjectId id); /// /// Asynchronously updates an existing notice with the provided information. /// /// The notice entity containing the updated data to be persisted. + /// Task Update(Notice notice); /// /// Asynchronously retrieves all notices. /// /// A task that represents the asynchronous operation. The task result contains an enumerable collection of all objects. + /// Task> FindAll(); /// /// Retrieves a by its unique identifier. Returns null when no matching notice is found. /// /// The identifier of the notice to look up. /// A task that yields the matching , or null if no notice exists for the specified . + /// Task FindById(ObjectId id); /// /// Asynchronously retrieves the collection of notices that match the specified date. /// /// The date used to filter the notices to be retrieved. /// A task that represents the asynchronous operation. The task result contains a collection of objects for the specified date, or null if no matching notices are found. + /// Task?> FindByDate(DateTime date); /// /// Asynchronously retrieves the entries that match the specified type. /// /// The notice type used to filter the lookup. /// A task containing the matching items, or null when no results are available. + /// Task?> FindByType(string type); /// /// Asynchronously retrieves the entities associated with the specified display identifier. /// /// The display identifier used to locate the matching notices. /// A task that yields the collection of matching items, or null if no notices are found. + /// Task?> FindByDisplayId(ObjectId displayId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IObservationArchiveRepository.cs b/adas-core.Application/Repositories/Interfaces/IObservationArchiveRepository.cs index 07180bea..60813684 100644 --- a/adas-core.Application/Repositories/Interfaces/IObservationArchiveRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IObservationArchiveRepository.cs @@ -9,17 +9,20 @@ public interface IObservationArchiveRepository : IMongoRepository into the data store. /// /// The patient observation to insert. + /// new Task InsertOneAsync(PatientObservation patientObservation); /// /// Deletes the records that have a date earlier than the specified cutoff date. /// /// The cutoff date; records dated before this value will be removed. + /// Task DeleteBeforeDate(DateTime date); /// /// Asynchronously inserts a batch of patient observation records into the underlying data store. /// /// The collection of entities to be inserted. /// A that represents the asynchronous insert operation, returning a value (such as the number of affected rows or a generated identifier) produced by the batch insertion. + /// Task InsertBatch(IEnumerable observations); /// @@ -30,6 +33,7 @@ public interface IObservationArchiveRepository : IMongoRepositoryThe cutoff date; only observations on or before this date are considered. /// An optional list of observation names to restrict the results to; pass an empty or null list to include all observations. /// A task that resolves to a list of entries representing the aggregated last observations matching the criteria. + /// Task> AggregatedPatientLastObservations(ObjectId patientId, int num, DateTime lastDate, List filterObservations); @@ -38,5 +42,6 @@ public interface IObservationArchiveRepository : IMongoRepository /// The identifier of the patient whose observations are being retrieved. /// A task that represents the asynchronous operation, containing a list of records for the patient. + /// Task> FindAllFromPatient(ObjectId patientId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IObservationRepository.cs b/adas-core.Application/Repositories/Interfaces/IObservationRepository.cs index d2b5126c..49896994 100644 --- a/adas-core.Application/Repositories/Interfaces/IObservationRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IObservationRepository.cs @@ -15,6 +15,7 @@ public interface IObservationRepository : IMongoRepository /// The identifier of the patient whose observations will be aggregated. /// The field used to group the patient's observations during aggregation. /// A task that represents the asynchronous operation, containing a list of BSON documents with the aggregated results. + /// Task> AggregatedPatientGroupedObservations(ObjectId patientId, GroupedField groupedField); /// @@ -26,6 +27,7 @@ public interface IObservationRepository : IMongoRepository /// The maximum number of most recent observations to return. /// An optional list of observation identifiers used to restrict the returned results; if null, no filter is applied. /// A task representing the asynchronous operation, containing a list of the patient's most recent records. + /// Task> AggregatedPatientLastObservations(ObjectId patientId, int num, List? filterObservations = null); @@ -37,6 +39,7 @@ public interface IObservationRepository : IMongoRepository /// The cutoff date; only observations on or before this date are considered. /// An optional list of observation names to restrict the results to. If null, no observation-name filter is applied. /// A task that represents the asynchronous operation, containing the list of aggregated entries that match the criteria. + /// Task> AggregatedPatientLastObservationsByLastDate(ObjectId patientId, int num, DateTime lastDate, List? filterObservations = null); @@ -46,6 +49,7 @@ public interface IObservationRepository : IMongoRepository /// The unique identifier of the patient whose observations are being retrieved. /// An optional list of fields to filter the observations by; if null, observations for all fields are returned. /// A task that represents the asynchronous operation. The task result contains a list of the latest patient observations grouped by field. + /// Task> AggregatedPatientLastObservationsByField(ObjectId patientId, List? filterObservations = null); @@ -57,6 +61,7 @@ public interface IObservationRepository : IMongoRepository /// The specific code within the coding system identifying the type of observation to retrieve. /// The maximum number of most recent observations to return. Defaults to 2. /// A task that yields a collection of the matching records, ordered from most recent to oldest, containing at most entries. + /// Task> FindLastObservations(ObjectId patientId, string codingSystem, string code, int num = 2); @@ -67,6 +72,7 @@ public interface IObservationRepository : IMongoRepository /// The coding system used to filter the observations. /// The maximum number of recent observations to return. Defaults to 10. /// A task that represents the asynchronous operation, containing a list of the patient's most recent observations matching the coding system. + /// Task> FindLastObservationsByCodingSystem(ObjectId patientId, string codingSystem, int num = 10); @@ -77,12 +83,14 @@ public interface IObservationRepository : IMongoRepository /// The optional name of the observation to filter by. If null, observations of any name are considered. /// The cutoff date; only observations recorded strictly before this date are eligible. /// A task that resolves to the matching if found, or null if no observation exists before the specified date. + /// Task FindLastObservationBeforeDate(ObjectId patientId, string? name, DateTime date); /// /// Asynchronously updates the state of patient observations that have expired, applying the appropriate expiration handling to each item in the provided list. /// /// The list of patient observations that have expired and require their state to be updated. + /// Task UpdateExpiredObservations(List expiredObservations); /// @@ -92,6 +100,7 @@ public interface IObservationRepository : IMongoRepository /// The optional name of the observation to match; if null, observations of any name are considered. /// The date used to match observations recorded on the same day. /// A task that returns a list of matching instances, or null if no matching observations are found. + /// Task?> FindAnyWithSameDate(ObjectId patientId, string? name, DateTime date); /// /// Asynchronously retrieves all patient observations recorded for the specified patient before the given date. @@ -99,6 +108,7 @@ public interface IObservationRepository : IMongoRepository /// The unique identifier of the patient whose observations are being queried. /// The cutoff date; only observations recorded prior to this date are returned. /// A task that represents the asynchronous operation, containing a list of patient observations found before the specified date. + /// Task> FindAnyBeforeDate(ObjectId patientId, DateTime date); /// @@ -108,23 +118,27 @@ public interface IObservationRepository : IMongoRepository /// The name used to match the relevant patient observations. /// An optional expiration value in seconds used to control the time window for the lookup; if null, no expiration is applied. /// A task that resolves to a list of the latest unique records matching the specified name for the patient. The list is empty if no matching observations are found. + /// Task> FindLatestUniqueValuesByName(ObjectId patientId, string name, int? expires); /// /// Asynchronously inserts a single record into the underlying data store. /// /// The patient observation entity to persist. + /// new Task InsertOneAsync(PatientObservation patientObservation); /// /// Deletes records associated with the specified patient identifier. /// /// The ObjectId of the patient whose related records should be removed. + /// Task DeleteByPatientId(ObjectId id); /// /// Asynchronously retrieves the collection of patient observations associated with the specified patient identifier. /// /// The unique identifier of the patient whose observations are to be retrieved. /// A task that represents the asynchronous operation, containing an of instances to iterate through the matching records. + /// Task> FindByPatientIdAsync(ObjectId patientId); /// @@ -135,6 +149,7 @@ public interface IObservationRepository : IMongoRepository /// The coding system used to classify the observations (e.g., LOINC, SNOMED). /// The name of the observation to filter within the coding system. /// A that yields an streaming the matching documents. + /// Task> FindByPatientIdAndCodingSystemAsync(ObjectId patientId, string codingSystem, string name); @@ -143,6 +158,7 @@ public interface IObservationRepository : IMongoRepository /// /// The unique identifier of the entity to delete. /// A task that represents the asynchronous delete operation. + /// new Task DeleteAsync(ObjectId id); /// /// Asynchronously deletes patient observations older than the specified retention period and returns the records that were removed. @@ -150,6 +166,7 @@ public interface IObservationRepository : IMongoRepository /// The identifier used to locate the relevant patient observations to be evaluated for deletion. /// The retention period in days; observations older than this value will be deleted. /// A task that represents the asynchronous operation, containing a list of the deleted records. + /// Task> DeleteOlderDaysAsync(string name, int retentionPolicyValue); /// /// Asynchronously deletes patient observations based on the specified name and retention policy value. @@ -157,6 +174,7 @@ public interface IObservationRepository : IMongoRepository /// The name used to identify or filter the patient observations to be deleted. /// The retention policy threshold value that determines which older observations should be removed. /// A task representing the asynchronous operation, containing the list of patient observations that were deleted. + /// Task> DeleteOlderNumberAsync(string name, int retentionPolicyValue); /// /// Asynchronously checks whether a record exists for the specified patient identified by the given system identifier. @@ -164,6 +182,7 @@ public interface IObservationRepository : IMongoRepository /// The unique identifier of the patient whose record is being checked. /// The system identifier used to look up the patient's record. /// A task that represents the asynchronous operation. The task result is true if a matching record exists; otherwise, false. + /// Task ExistBySystemId(ObjectId patientid, string systemId); /// /// Asynchronously deletes patient observations older than the specified number of seconds and returns the affected records. @@ -171,17 +190,20 @@ public interface IObservationRepository : IMongoRepository /// The name used to identify the patient observations to filter for deletion. /// The age threshold in seconds; observations older than this value will be deleted. /// A task that represents the asynchronous operation, containing the list of deleted patient observations. + /// Task> DeleteOlderSecondsAsync(string name, int value); /// /// Retrieves the aggregated active intravenous lines observations for the specified patient. /// /// The unique identifier of the patient whose active intravenous lines observations are being retrieved. /// A task that represents the asynchronous operation, containing a list of entries representing the patient's active intravenous lines observations, where each entry may be null. + /// Task> AggregatedPatientActiveIntravenousLinesObservations(ObjectId patientId); /// /// Asynchronously retrieves the most recent observation timestamp for every patient, returning a mapping of patient identifiers to their last observation times. /// /// A task that represents the asynchronous operation. The task result contains a dictionary where each key is a patient and the associated value is the date and time of that patient's last observation. + /// Task> FindAllLastPatientObservationTime(); /// @@ -189,6 +211,7 @@ public interface IObservationRepository : IMongoRepository /// /// The unique identifier of the patient observation to locate. /// A that resolves to the matching , or null if no observation exists for the given identifier. + /// Task FindById(ObjectId id); /// @@ -196,11 +219,13 @@ public interface IObservationRepository : IMongoRepository /// /// The unique identifier of the patient whose observations are being retrieved. /// A task containing a list of objects for the specified patient, or null if no observations are found. + /// Task?> FindByPatientId(ObjectId id); /// /// Updates an existing patient observation with the provided data. /// /// The patient observation containing the updated information to be persisted. + /// Task Update(PatientObservation observation); /// /// Updates many records by replacing the specified old ObjectId with the new ObjectId identified by the given name. @@ -208,6 +233,7 @@ public interface IObservationRepository : IMongoRepository /// The name identifier used to locate the target collection or field to update. /// The new ObjectId to assign to the matching records. /// The existing ObjectId that identifies the records to be updated. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); /// @@ -215,6 +241,7 @@ public interface IObservationRepository : IMongoRepository /// /// An optional list of observation identifiers used to narrow the result set. May be null or contain null entries. /// A task that resolves to a collection of non-expired instances matching the filter criteria. + /// Task> FindNotExpired(List? filterObservations); /// @@ -223,6 +250,7 @@ public interface IObservationRepository : IMongoRepository /// The name used to look up the patient observations. /// The optional date used to filter the observations; when null, results are not restricted by date. /// A task that represents the asynchronous operation, containing a collection of entries that match the criteria. + /// Task> FindByName(string name, DateTime? date); /// @@ -230,18 +258,22 @@ public interface IObservationRepository : IMongoRepository /// /// The collection of patient observations to update. /// The update definition describing the modifications to apply to each patient observation. + /// Task UpdateMany(IEnumerable patientObservations, UpdateDefinition update); /// /// Retrieves all patient observation records. /// /// A task representing the asynchronous operation, containing a collection of entries. + /// Task> FindAll(); /// /// Asynchronously processes and expires the specified configuration observations that have met their expiration criteria. /// /// The list of configuration observations to expire. + /// Task ExpireExpiredObservations(List configObservationsToExpire); //Task> GetPaginatedObservations(PaginationFilter filter); @@ -250,6 +282,7 @@ public interface IObservationRepository : IMongoRepository /// /// The pagination filter that defines the page size, page number, and sorting criteria applied to the observations. /// An for that allows further refinement and execution of the paginated query. + /// IFindFluent GetPaginatedObservations(PaginationFilter filter); /// @@ -260,6 +293,7 @@ public interface IObservationRepository : IMongoRepository /// Optional pagination cursor indicating the number of results to skip. /// Optional maximum number of observations to return. /// A task that represents the asynchronous operation, containing a collection of matching objects. + /// Task> FindLastNotExpiredObservatonsByPatient(ObjectId patientId, string name, int? endAfter = null, int? num = null); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPatientArchiveRepository.cs b/adas-core.Application/Repositories/Interfaces/IPatientArchiveRepository.cs index cacbab35..ff0ef5cd 100644 --- a/adas-core.Application/Repositories/Interfaces/IPatientArchiveRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPatientArchiveRepository.cs @@ -10,12 +10,14 @@ public interface IPatientArchiveRepository : IMongoRepository /// /// The unique patient number used to look up the patient. /// A instance if a match is found; otherwise, . + /// Task FindByPatientNumber(string patientNumber); /// /// Retrieves all patients from the data source. /// /// A task that represents the asynchronous operation, containing a list of all entities. + /// Task> FindAll(); /// /// Searches for a patient by patient number within a specific distinct unit. @@ -23,5 +25,6 @@ public interface IPatientArchiveRepository : IMongoRepository /// The patient number used to locate the patient. /// The identifier of the distinct unit in which to perform the search. /// A task that represents the asynchronous operation. The task result contains the matching if found; otherwise, null. + /// Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPatientCarePlanRepository.cs b/adas-core.Application/Repositories/Interfaces/IPatientCarePlanRepository.cs index 9284da7d..0805ddcb 100644 --- a/adas-core.Application/Repositories/Interfaces/IPatientCarePlanRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPatientCarePlanRepository.cs @@ -10,17 +10,20 @@ public interface IPatientCarePlanRepository : IMongoRepository /// /// The unique identifier of the patient whose care plans are being requested. /// A task that represents the asynchronous operation, containing a list of records for the patient, or an empty list if no care plans are found. + /// Task> FindByPatientId(ObjectId patientId); /// /// Asynchronously retrieves the list of patient care plans associated with the specified user identifier. /// /// The unique identifier of the user whose patient care plans are being requested. /// A task that represents the asynchronous operation, containing a list of objects linked to the specified user. + /// Task> FindByUserId(ObjectId userId); /// /// Asynchronously retrieves all patient care plans from the data store. /// /// A task representing the asynchronous operation, containing a list of all records. + /// Task> FindAll(); /// /// Updates all records that reference the specified old ObjectId so they are associated with the new patient ObjectId. @@ -28,5 +31,6 @@ public interface IPatientCarePlanRepository : IMongoRepository /// The string identifier of the patient whose related records will be updated. /// The new ObjectId that will replace the previous identifier in the matching records. /// The previous ObjectId whose references should be replaced across the matching records. + /// Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPatientRepository.cs b/adas-core.Application/Repositories/Interfaces/IPatientRepository.cs index e5d2174b..e26012ab 100644 --- a/adas-core.Application/Repositories/Interfaces/IPatientRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPatientRepository.cs @@ -14,36 +14,42 @@ public interface IPatientRepository : IMongoRepository /// Deletes the item identified by the specified identifier. /// /// The identifier of the item to delete. + /// Task Delete(ObjectId id); /// /// Asynchronously retrieves a associated with the specified location, or if no patient is found at that location. /// /// The location used to look up the patient. /// A task that represents the asynchronous operation, containing the if found; otherwise, . + /// Task FindByLocation(PatientLocation location); /// /// Retrieves a patient by their unique identifier, returning null when no matching patient exists. /// /// The unique of the patient to look up. /// A that resolves to the matching , or null if no patient is found. + /// Task FindById(ObjectId id); /// /// Asynchronously updates the location of a patient identified by the specified identifier. /// /// The unique identifier of the patient whose location is to be updated. /// The new patient location data to apply to the existing record. + /// Task UpdateLocation(ObjectId id, PatientLocation location); /// /// Updates the location of the entity identified by the specified identifier. /// /// The identifier of the entity whose location will be updated. /// The identifier of the new location to associate with the entity. + /// Task UpdateLocation(ObjectId id, ObjectId location); /// /// Updates the attending doctor for the record identified by the specified id. /// /// The identifier of the record whose attending doctor will be updated. /// The person to be set as the new attending doctor. + /// Task UpdateAttendingDoctor(ObjectId id, Person attendingDoctor); /// /// Updates the patient data identified by the specified id, optionally updating the patient number when is true. @@ -52,11 +58,13 @@ public interface IPatientRepository : IMongoRepository /// The patient number associated with the patient. /// The new person data to apply to the patient record. /// Indicates whether the patient number should be updated; defaults to true. + /// Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true); /// /// Updates the information of an existing patient in the system. /// /// The patient entity containing the updated information to be persisted. + /// Task Update(Patient patient); /// /// Asynchronously retrieves a by their unique patient number. @@ -64,68 +72,83 @@ public interface IPatientRepository : IMongoRepository /// /// The unique patient number used to look up the patient. /// A containing the matching , or null if no patient is found. + /// Task FindByPatientNumber(string patientNumber); /// /// Asynchronously retrieves a that matches the specified patient identifier. /// /// The unique identifier of the patient to look up. /// A task that represents the asynchronous operation, containing the matching if found; otherwise, null. + /// Task FindByPatientId(string patientId); /// /// Asynchronously retrieves all records. /// /// A task that represents the asynchronous operation, containing a list of all entities. + /// Task> FindAll(); /// /// Asynchronously retrieves a list of patients associated with the specified point of care. /// /// The point of care identifier used to filter patients. /// A task that represents the asynchronous operation, containing a list of patients matching the specified point of care. + /// Task> FindByPointOfCare(string pointOfCare); /// /// Asynchronously retrieves the list of patients associated with the specified point of care. /// /// The unique identifier of the point of care used to filter patients. /// A task that represents the asynchronous operation, containing the list of patients matching the specified point of care. + /// Task> FindByPointOfCare(ObjectId pointOfCare); /// /// Retrieves a patient by their point-of-care identifier, returning null when no matching patient is found. /// /// The unique identifier of the point-of-care location used to look up the patient. /// A task that resolves to the matching , or null if no patient is associated with the specified point-of-care id. + /// Task FindByPointOfCareId(ObjectId pointOfCare); /// /// Asynchronously retrieves a list of patients who have been discharged. /// /// A task representing the asynchronous operation, containing a list of discharged records. + /// Task> FindDischargedPatients(); /// /// Updates an existing patient record and returns the updated patient, or if the patient was not found. /// /// The patient containing the updated information. /// A task that represents the asynchronous operation. The task result contains the updated , or if no matching patient exists. + /// Task UpdateOne(Patient updatedPatient); /// /// Asynchronously retrieves a list of patients who have an inactive Point of Care (PoC) assignment. /// /// A task that represents the asynchronous operation. The task result contains a list of objects with inactive PoC status. + /// Task> FindInActivePoC(); /// /// Asynchronously retrieves a list of patients who are currently marked as inactive points of contact (PoC). /// /// A task that represents the asynchronous operation. The task result contains a list of inactive PoC patients. + /// + /// Task> FindInInactivePoC(); /// /// Retrieves a list of patients whose records have not been updated since the specified date. /// /// The cutoff date; patients last updated before this date will be included in the result. /// A task that represents the asynchronous operation. The task result contains a list of objects that have not been updated since the specified date. + /// Task> FindPatientsNotUpdatedSince(DateTime date); /// /// Asynchronously retrieves a patient from the data store by their unique identifier. /// /// The unique identifier of the patient to look up. /// A task that represents the asynchronous operation. The task result contains the matching if one is found; otherwise, null. + /// Task FindByPatientId(ObjectId patientId); /// /// Updates the incoming data for the specified patient and returns the updated patient record. @@ -133,6 +156,7 @@ public interface IPatientRepository : IMongoRepository /// The unique identifier of the patient whose incoming data should be updated. /// The patient object containing the incoming data to apply. /// A task that represents the asynchronous operation. The task result contains the updated , or null if the patient was not found. + /// Task UpdatePatientIncomingData(ObjectId patientId, Patient person); /// /// Updates the demographic data of an existing patient identified by the given identifier. @@ -140,6 +164,7 @@ public interface IPatientRepository : IMongoRepository /// The unique identifier of the patient whose demographic data is to be updated. /// The patient object containing the updated demographic information. /// A task that represents the asynchronous operation. The task result contains the updated , or null if the patient was not found. + /// Task UpdatePatientDemographicData(ObjectId patientId, Patient person); /// /// Asynchronously retrieves the patient matching the specified unit and point of care identifier. @@ -147,12 +172,14 @@ public interface IPatientRepository : IMongoRepository /// The identifier of the unit used to locate the patient. /// The point of care identifier used together with the unit to locate the patient. /// A task that resolves to the associated with the given unit and point of care. + /// Task FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare); /// /// Asynchronously retrieves the total count of records associated with the specified unit identifier. /// /// The identifier of the unit whose associated records should be counted. /// A task that represents the asynchronous operation, containing the total count of matching records. + /// Task CountByUnitId(ObjectId unitId); /// /// Asynchronously searches for a patient by their patient number within a specific unit, ensuring the patient is associated with a distinct unit. @@ -160,30 +187,35 @@ public interface IPatientRepository : IMongoRepository /// The unique patient number used to identify the patient. /// The identifier of the unit to constrain the search to a distinct unit context. /// A task that represents the asynchronous operation. The task result contains the matching if found; otherwise, null. + /// Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId); /// /// Retrieves a paginated, fluent query of patients based on the specified pagination filter. /// /// The pagination filter that defines page size, page number, and additional criteria applied to the patient query. /// An representing the paginated patient query that can be further composed before execution. + /// IFindFluent GetPaginatedPatients(PaginationFilter filter); /// /// Asynchronously retrieves all patients who have completed procedures, filtering by the number of minutes that have elapsed since the procedure end date for archival purposes. /// /// The number of minutes after the procedure end date used to determine which finished procedures are eligible for archive retrieval. /// A task that represents the asynchronous operation. The task result contains a list of patients with finished procedures matching the archive criteria. + /// Task> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes); /// /// Asynchronously retrieves all patients whose tests have finished based on the specified archive end date threshold. /// /// The number of minutes after which a test is considered finished and eligible for retrieval. /// A task that represents the asynchronous operation, containing a list of patients with finished tests. + /// Task> FindAllPatientWithFinishedTests(int archiveTestEndDateAfterMinutes); /// /// Retrieves all patients whose treatment has been finished and is eligible for archival based on the specified end date threshold. /// /// The number of minutes after the treatment end date used as the archival threshold. /// A task that represents the asynchronous operation, containing a list of patients with finished treatments that meet the archival criteria. + /// Task> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes); /// /// Updates a master list option for the specified units and returns the patients affected by the change. @@ -192,6 +224,7 @@ public interface IPatientRepository : IMongoRepository /// The DTO containing the master list option update details. /// The name of the option type being updated. /// A task that resolves to the list of patients impacted by the master list option update. + /// Task> UpdateMasterListOption(List unitIds, UpdateOptionMasterListDto opt, string typeName); /// /// Asynchronously retrieves a list of objects associated with the specified unit identifiers and patient type. @@ -199,6 +232,7 @@ public interface IPatientRepository : IMongoRepository /// The list of unit identifiers used to filter the patients to be returned. /// The name of the patient type used to further refine the query results. /// A that represents the asynchronous operation, containing a list of objects matching the provided unit identifiers and type. + /// Task> GetPatientsByUnitIds(List unitIds, string typeName); /// /// Deletes the specified master list option and returns the patients affected by its removal. @@ -207,5 +241,6 @@ public interface IPatientRepository : IMongoRepository /// The master list option to remove. /// The name of the master list type to which the option belongs. /// A task that yields the collection of patients impacted by deleting the master list option. + /// Task> DeleteMasterListOption(List unitIds, OptionList opt, string typeName); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPoCMappingRepository.cs b/adas-core.Application/Repositories/Interfaces/IPoCMappingRepository.cs index 73bee6be..71f97b93 100644 --- a/adas-core.Application/Repositories/Interfaces/IPoCMappingRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPoCMappingRepository.cs @@ -10,10 +10,12 @@ public interface IPoCMappingRepository /// /// The key used to look up the . /// A task that represents the asynchronous operation. The task result contains the if found, or null if no mapping exists for the specified key. + /// Task FindByKey(string key); /// /// Retrieves the name of the collection associated with the current context or entity. /// /// The collection name as a string. + /// string GetCollectionName(); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPoCSettingsRepository.cs b/adas-core.Application/Repositories/Interfaces/IPoCSettingsRepository.cs index 05e4e823..e6e67ee3 100644 --- a/adas-core.Application/Repositories/Interfaces/IPoCSettingsRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPoCSettingsRepository.cs @@ -10,6 +10,7 @@ public interface IPoCSettingsRepository : IMongoRepository /// Asynchronously deletes the entity identified by the specified . /// /// The of the entity to delete. + /// Task Delete(ObjectId id); /// @@ -17,6 +18,7 @@ public interface IPoCSettingsRepository : IMongoRepository /// /// The patient location used to look up the corresponding PoC settings. /// A task that returns the matching if found; otherwise, null. + /// Task FindByLocation(PatientLocation location); /// @@ -24,6 +26,7 @@ public interface IPoCSettingsRepository : IMongoRepository /// /// The unique identifier of the PoC settings to retrieve. /// A task that represents the asynchronous operation. The result contains the matching if found, or null when no settings exist for the given identifier. + /// Task FindById(ObjectId id); /// @@ -31,11 +34,13 @@ public interface IPoCSettingsRepository : IMongoRepository /// /// The PoC settings to be applied. /// A task that represents the asynchronous update operation. + /// Task Update(PoCSettings pocSettings); /// /// Asynchronously retrieves all records. /// /// A task that represents the asynchronous operation. The task result contains a list of all entries. + /// Task> FindAll(); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPointOfCareRepository.cs b/adas-core.Application/Repositories/Interfaces/IPointOfCareRepository.cs index 2e44b9ea..4174630c 100644 --- a/adas-core.Application/Repositories/Interfaces/IPointOfCareRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPointOfCareRepository.cs @@ -14,12 +14,14 @@ public interface IPointOfCareRepository : IMongoRepository /// Asynchronously deletes the entity identified by the specified . /// /// The of the entity to delete. + /// Task Delete(ObjectId id); /// /// Asynchronously updates the specified entity. /// /// The instance containing the updated data to be persisted. + /// Task Update(PointOfCare pointOfCare); /// @@ -27,6 +29,7 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The identifier of the object whose unit will be updated. /// The unit value to apply to the object. + /// Task UpdateUnitId(ObjectId id, Unit unit); /// @@ -34,6 +37,7 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The unique identifier of the point of care configuration to update. /// The new configuration values to apply to the existing point of care record. + /// Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration); /// @@ -41,6 +45,7 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The unique identifier of the point of care to locate. /// A task that yields the matching , or null if no record exists for the given identifier. + /// Task FindById(ObjectId id); /// @@ -48,6 +53,7 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The of the unit whose points of care should be returned. /// A task that yields an of for the matching unit, or null when no results are found. + /// Task?> FindAllByUnitId(ObjectId unit); /// @@ -55,6 +61,7 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The room identifier used to look up the corresponding points of care. /// A task that represents the asynchronous operation. The result is a collection of matching the specified room, or if no matching points of care are found. + /// Task?> FindByRoom(string room); /// @@ -63,6 +70,7 @@ public interface IPointOfCareRepository : IMongoRepository /// The filter definition used to match entities in the data store. /// An optional projection definition that limits or shapes the fields returned in each result. If null, the full entity is returned. /// A task that represents the asynchronous operation, containing a list of entities that satisfy the filter. Returns an empty list when no matching entities are found. + /// Task> FindByFilter(FilterDefinition filter, ProjectionDefinition? projection = null); @@ -71,22 +79,26 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The bed identifier used to look up the associated points of care. /// A task that yields an of when matches exist, or null if none are found. + /// Task?> FindByBed(string bed); /// /// Asynchronously retrieves all available points of care. /// /// A task that represents the asynchronous operation. The task result is a list of instances, or null if no points of care are available. + /// Task?> GetAll(); /// /// Retrieves all Point of Care configurations available in the system. /// /// A task containing a list of configurations, or null if no configurations are found. + /// Task?> GetAllConfigs(); /// /// Retrieves all Point of Care location information. /// /// A task that resolves to a list of locations, or null if no location data is available. + /// Task?> GetAllLocationInfo(); /// @@ -95,6 +107,7 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The unique identifier of the Point of Care whose configuration is being requested. /// A task that resolves to the matching configuration, or null if no configuration is found. + /// Task GetPoCConfiguration(ObjectId pocId); @@ -104,6 +117,7 @@ public interface IPointOfCareRepository : IMongoRepository /// The bed identifier used to locate the point of care; may be . /// The identifier of the unit in which the bed is located. /// A that yields the matching , or if none is found. + /// Task FindByBedAndUnitId(string? bed, ObjectId unitId); /// @@ -111,6 +125,7 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The patient location used to look up the corresponding point of care. /// A task that represents the asynchronous operation. The task result contains the matching , or null if no point of care is found for the given patient location. + /// Task FindByPatientLocation(PatientLocation patientLocation); /// @@ -121,6 +136,7 @@ public interface IPointOfCareRepository : IMongoRepository /// The point-of-care status used to filter the results. /// When set to true, virtual points of care are excluded from the returned collection. /// A task that represents the asynchronous operation. The task result contains an of points of care matching the specified unit and status. + /// Task> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare status, bool excludeVirtual = false); @@ -129,12 +145,14 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The unique identifier of the point of contact whose relay configuration is being updated. /// The collection of relay entries to apply to the configuration. + /// Task UpdateRelayConfig(ObjectId pocId, List relayConfig); /// /// Updates the relay configuration for the specified point of configuration (POC) using the provided list of relay configuration identifiers. /// /// The unique identifier of the point of configuration whose relay configuration will be updated. /// The list of relay configuration identifiers to apply to the specified POC. + /// Task UpdateRelayConfig(ObjectId pocId, List relayConfig); /// @@ -142,24 +160,28 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The pagination filter that defines paging parameters such as page number and page size. /// An representing the paginated query against the PoCs collection. + /// IFindFluent GetPaginatedPoCs(PaginationFilter filter); /// /// Asynchronously counts the number of entities associated with the specified unit identifier. /// /// The identifier of the unit used to filter the entities to be counted. /// A that represents the asynchronous operation, containing the total count of matching entities. + /// Task CountByUnitId(ObjectId unitId); /// /// Asynchronously counts the number of virtuals associated with the specified unit. /// /// The identifier of the unit whose virtuals will be counted. /// A task that represents the asynchronous operation. The task result contains the count of virtuals for the given unit. + /// Task CountVirtualsByUnitId(ObjectId unitId); /// /// Deletes multiple records associated with the specified unit identifier asynchronously. /// /// The unique identifier of the unit whose related records should be deleted. /// A task that represents the asynchronous operation, containing a boolean value indicating whether the deletion was successful. + /// Task DeleteManyByUnitId(ObjectId unitId); /// /// Retrieves a entity by its identifier, including all associated configuration data. @@ -167,26 +189,31 @@ public interface IPointOfCareRepository : IMongoRepository /// /// The unique identifier of the point of care to retrieve. /// A task that resolves to the matching with all configuration, or if not found. + /// Task FindByIdAllConfig(ObjectId id); /// /// Asynchronously retrieves the set of camera identifiers that are currently in use. /// /// A task that represents the asynchronous operation, containing a hash set of values for all cameras in use. + /// Task> FindAllIdCamerasInUse(); /// /// Asynchronously retrieves all ID relays that are currently in use, returning them as a hash set for efficient lookup. /// /// A task that represents the asynchronous operation. The task result contains a hash set of the values of all ID relays currently in use. + /// Task> FindAllIdRelaysInUse(); /// /// Asynchronously retrieves the set of all ID beacons that are currently in use. /// /// A task that represents the asynchronous operation. The task result contains a with the identifiers of all ID beacons currently in use. + /// Task> FindAllIdBeaconsInUse(); /// /// Retrieves all points of care associated with the specified unit identifier, including their related devices. /// /// The unique identifier of the unit whose points of care and associated devices are to be retrieved. /// A task that represents the asynchronous operation. The task result contains an enumerable collection of points of care with their associated devices, or null if no points of care are found for the specified unit. + /// Task?> FindAllByUnitIdWithDevices(ObjectId unitId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPumpAlarmEventRepository.cs b/adas-core.Application/Repositories/Interfaces/IPumpAlarmEventRepository.cs index 212f35ec..f16710d2 100644 --- a/adas-core.Application/Repositories/Interfaces/IPumpAlarmEventRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPumpAlarmEventRepository.cs @@ -9,6 +9,7 @@ public interface IPumpAlarmEventRepository /// Asynchronously inserts a pump alarm event into the underlying data store. /// /// The pump alarm event to be persisted. + /// Task InsertAsync(PumpAlarmEvent alarmEvent); /// @@ -19,6 +20,7 @@ public interface IPumpAlarmEventRepository /// Optional end of the date range used to filter the events. /// Optional maximum number of alarm events to return. /// A task that represents the asynchronous operation, containing the collection of pump alarm events matching the criteria. + /// Task> FindByDeviceIdAsync( string deviceId, DateTime? from = null, @@ -31,6 +33,7 @@ public interface IPumpAlarmEventRepository /// /// The unique identifier of the device whose last pump alarm event is to be retrieved. /// A task that represents the asynchronous operation, containing the most recent for the device, or null if none exists. + /// Task FindLastByDeviceIdAsync(string deviceId); // cleanup @@ -38,6 +41,7 @@ public interface IPumpAlarmEventRepository /// Deletes records associated with the specified patient identifier. /// /// The unique identifier of the patient whose records should be deleted. + /// Task DeleteByPatientId(ObjectId patientId); /// @@ -47,5 +51,6 @@ public interface IPumpAlarmEventRepository /// The new ObjectId value to assign to the matching records. /// The existing ObjectId value used to identify the records to be updated. /// A task that represents the asynchronous operation, containing the number of records that were updated. + /// Task UpdateManyObjectIdByFiledNameAsync(string fieldName, ObjectId newId, ObjectId oldId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPumpAlarmStateRepository.cs b/adas-core.Application/Repositories/Interfaces/IPumpAlarmStateRepository.cs index 66f220fc..d7def3d7 100644 --- a/adas-core.Application/Repositories/Interfaces/IPumpAlarmStateRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPumpAlarmStateRepository.cs @@ -14,6 +14,7 @@ public interface IPumpAlarmStateRepository /// The optional alarm type to filter the search by; if null, no alarm type filter is applied. /// The optional MDC alarm code to further filter the search; if null, no alarm code filter is applied. /// A containing the active , or null if no matching active alarm state exists. + /// Task FindActiveAsync( string deviceId, PumpEnum.AlarmType? alarmType, @@ -24,12 +25,14 @@ public interface IPumpAlarmStateRepository /// /// The unique identifier of the device whose active pump alarm states are being queried. /// A task representing the asynchronous operation, containing a collection of active entries for the given device. + /// Task> FindAllActiveByDeviceAsync(string deviceId); /// /// Inserts a new active pump alarm state or updates the existing one, maintaining the current state for the alarm. /// /// The pump alarm state to upsert as the active record. + /// Task UpsertActiveAsync(PumpAlarmState state); /// @@ -38,6 +41,7 @@ public interface IPumpAlarmStateRepository /// The identifier of the device whose alarms should be removed. /// The optional alarm type to filter the removal; when null, all alarm types are considered. /// The optional alarm code (MDC) to further filter the removal; when null, no code filter is applied. + /// Task RemoveAsync( string deviceId, PumpEnum.AlarmType? alarmType, @@ -48,6 +52,7 @@ public interface IPumpAlarmStateRepository /// Deletes records associated with the specified patient identifier. /// /// The unique identifier of the patient whose related records should be removed. + /// Task DeleteByPatientId(ObjectId patientId); /// @@ -57,5 +62,6 @@ public interface IPumpAlarmStateRepository /// The new value to assign. /// The existing value to be replaced. /// A that represents the asynchronous operation. The task result contains the number of documents updated. + /// Task UpdateManyObjectIdByFieldNameAsync(string fieldName, ObjectId newId, ObjectId oldId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPumpArchiveRepository.cs b/adas-core.Application/Repositories/Interfaces/IPumpArchiveRepository.cs index 58d20005..345c937c 100644 --- a/adas-core.Application/Repositories/Interfaces/IPumpArchiveRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPumpArchiveRepository.cs @@ -14,16 +14,20 @@ namespace adas_core.Application.Repositories.Interfaces /// /// Inserta una observación de bomba en la colección de archivo. /// + /// Task InsertAsync(PumpObservation obs); /// /// Inserta múltiples observaciones en la colección de archivo. /// + /// Task InsertManyAsync(IEnumerable observations); /// /// Búsqueda por paciente para auditoría o restauración. /// + /// Task> FindByPatientIdAsync(ObjectId patientId, DateTime? from = null, DateTime? to = null, int? limit = null); } diff --git a/adas-core.Application/Repositories/Interfaces/IPumpObservationRepository.cs b/adas-core.Application/Repositories/Interfaces/IPumpObservationRepository.cs index bb5c5066..91054d7f 100644 --- a/adas-core.Application/Repositories/Interfaces/IPumpObservationRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPumpObservationRepository.cs @@ -9,11 +9,13 @@ public interface IPumpObservationRepository /// Asynchronously inserts a pump observation into the underlying data store. /// /// The pump observation entity to persist. + /// Task InsertAsync(PumpObservation obs); /// /// Asynchronously inserts a collection of pump observations into the underlying data store. /// /// The collection of records to be persisted. + /// Task InsertManyAsync(IEnumerable observations); /// @@ -24,6 +26,7 @@ public interface IPumpObservationRepository /// Optional inclusive upper bound for the observation timestamp; when null, no upper bound is applied. /// Optional maximum number of observations to return; when null, all matching observations are returned. /// A task that represents the asynchronous operation, yielding an enumerable collection of instances matching the criteria. + /// Task> FindByDeviceIdAsync( string deviceId, DateTime? from = null, @@ -35,11 +38,13 @@ public interface IPumpObservationRepository /// /// The unique identifier of the device whose last observation is being queried. /// A task that represents the asynchronous operation. The task result contains the last for the device, or null if no observation exists for the given device. + /// Task FindLastByDeviceIdAsync(string deviceId); /// /// Asynchronously retrieves the most recent observation time for all patients, returning a mapping of patient identifiers to their last observation timestamps. /// /// A task that represents the asynchronous operation. The task result contains a dictionary where each key is a patient and the associated value is the of that patient's last observation. + /// Task> FindAllLastPatientObservationTimeAsync(); /// @@ -47,6 +52,7 @@ public interface IPumpObservationRepository /// /// The identifier of the patient whose pump observations are being queried. May be . /// A task that represents the asynchronous operation. The task result contains the collection of items found for the patient, or an empty collection if no observations are found. + /// Task> FindByPatientId(ObjectId? patientId); /// @@ -55,11 +61,13 @@ public interface IPumpObservationRepository /// The unique identifier of the patient whose observations are being queried. /// The maximum number of observations to return. Defaults to 100. /// A task that represents the asynchronous operation, containing a list of the patient's most recent entries. + /// Task> AggregatedPatientLastObservations(ObjectId patientId, int num = 100); /// /// Deletes all records associated with the specified patient identifier. If the patient identifier is null, no deletion is performed. /// /// The optional patient identifier whose related records should be removed. + /// Task DeleteByPatientId(ObjectId? patientId); /// /// Asynchronously deletes records older than the specified number of days, optionally filtered by name, and returns the number of items removed. @@ -67,12 +75,14 @@ public interface IPumpObservationRepository /// The age threshold in days; only records older than this value will be deleted. /// An optional name used to filter which records are targeted for deletion. If null, deletion applies to all records regardless of name. /// A that represents the asynchronous operation, containing the total count of deleted records. + /// Task DeleteOlderThanDaysAsync(int days, string? name = null); /// /// Asynchronously deletes items, retaining only the most recent entries, and returns the number of items that were removed. /// /// The maximum number of most recent items to keep after the deletion. /// A task representing the asynchronous operation, containing the count of items that were deleted. + /// Task DeleteKeepLastNAsync(int maxCount); /// @@ -82,5 +92,6 @@ public interface IPumpObservationRepository /// The new ObjectId value to assign to the field. /// The optional current ObjectId value used as a filter; when , the update is applied without filtering by the previous value. /// A that represents the asynchronous operation, containing the number of records updated. + /// Task UpdateManyObjectIdByFieldAsync(string fieldName, ObjectId newId, ObjectId? oldId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IPumpStateRepository.cs b/adas-core.Application/Repositories/Interfaces/IPumpStateRepository.cs index 31e36f5b..b6d0efbc 100644 --- a/adas-core.Application/Repositories/Interfaces/IPumpStateRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IPumpStateRepository.cs @@ -10,17 +10,20 @@ public interface IPumpStateRepository /// /// The unique identifier of the device whose pump state is being looked up. /// A task that resolves to the PumpState if a match is found, or null if no pump state exists for the specified device. + /// Task FindByDeviceIdAsync(string deviceId); /// /// Asynchronously creates or updates a pump state record in the data store. /// /// The pump state to be inserted if it does not exist, or updated if it already exists. + /// Task UpsertAsync(PumpState state); /// /// Asynchronously retrieves all available pump states. /// /// A task that represents the asynchronous operation. The task result contains a collection of all objects. + /// Task> GetAllAsync(); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IRecordingAlertArchiveRepository.cs b/adas-core.Application/Repositories/Interfaces/IRecordingAlertArchiveRepository.cs index 86a2507c..99152d13 100644 --- a/adas-core.Application/Repositories/Interfaces/IRecordingAlertArchiveRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IRecordingAlertArchiveRepository.cs @@ -8,16 +8,19 @@ public interface IRecordingAlertArchiveRepository : IMongoRepository /// The patient recording alert to be inserted. + /// new Task InsertOneAsync(PatientRecordingAlert recordingAlert); /// /// Asynchronously deletes records that have a date earlier than the specified threshold. /// /// The cutoff date; records with a date value before this will be removed. + /// Task DeleteBeforeDate(DateTime date); /// /// Inserts a batch of entities into the data store in a single operation. /// /// The collection of patient recording alerts to insert. /// A task that represents the asynchronous batch insert operation, containing the number of affected or inserted records. + /// Task InsertBatch(IEnumerable recordingAlerts); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IRecordingAlertRepository.cs b/adas-core.Application/Repositories/Interfaces/IRecordingAlertRepository.cs index a624e876..de80d771 100644 --- a/adas-core.Application/Repositories/Interfaces/IRecordingAlertRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IRecordingAlertRepository.cs @@ -12,6 +12,7 @@ public interface IRecordingAlertRepository : IMongoRepositoryThe unique identifier of the patient whose recent alerts are being retrieved. /// The maximum number of recent observations to return. /// A task that represents the asynchronous operation, containing a list of entries for the patient's last observations. + /// Task> AggregatedPatientLastObservations(ObjectId patientId, int num); /// @@ -21,17 +22,20 @@ public interface IRecordingAlertRepository : IMongoRepositoryThe name of the observation to filter by. /// The maximum number of recent observations to return. Defaults to 2. /// A task that represents the asynchronous operation. The task result contains a list of entries representing the matching observations. + /// Task> FindLastObservations(ObjectId patientId, string name, int num = 2); /// /// Asynchronously inserts a single into the underlying data store. /// /// The patient recording alert to be inserted. + /// new Task InsertOneAsync(PatientRecordingAlert patientRecordingAlert); /// /// Asynchronously deletes records older than the specified number of days, identified by the given name. /// /// The identifier or key used to locate the records to be evaluated for deletion. /// The age threshold, in days, used to determine which records are considered older and eligible for deletion. + /// Task DeleteOlderDaysAsync(string name, int value); /// /// Asynchronously deletes a number record matching the specified name and value. @@ -39,11 +43,14 @@ public interface IRecordingAlertRepository : IMongoRepositoryThe name associated with the number to delete. /// The numeric value of the record to delete. /// A task that represents the asynchronous delete operation. + /// Task DeleteOlderNumberAsync(string name, int value); /// /// Asynchronously deletes records associated with the specified patient identifier. /// /// The unique of the patient whose related records should be removed. + /// Task DeleteByPatientId(ObjectId patientId); /// /// Updates many records by replacing the specified with the new within the collection identified by . @@ -51,11 +58,13 @@ public interface IRecordingAlertRepository : IMongoRepositoryThe name or identifier of the collection in which the update is performed. /// The new ObjectId to assign to the matching records. /// The existing ObjectId used to locate the records to be updated. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); /// /// Asynchronously retrieves all patient recording alerts associated with the specified patient identifier. /// /// The unique identifier of the patient whose recording alerts are being queried. /// A task that represents the asynchronous operation, containing an asynchronous cursor over the matching documents. + /// Task> FindByPatientIdAsync(ObjectId patientId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IRelayRepository.cs b/adas-core.Application/Repositories/Interfaces/IRelayRepository.cs index cd075259..bfb62abc 100644 --- a/adas-core.Application/Repositories/Interfaces/IRelayRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IRelayRepository.cs @@ -13,6 +13,7 @@ public interface IRelayRepository : IMongoRepository /// /// The unique identifier of the relay to retrieve. /// A task that represents the asynchronous operation. The task result contains the if found; otherwise, null. + /// Task GetById(ObjectId relayId); /// /// Retrieves the relays of the specified type from the provided configuration relay list. @@ -20,24 +21,28 @@ public interface IRelayRepository : IMongoRepository /// The list of relay object identifiers to search through. /// The relay type used to filter the configuration relay list. /// A list of relays matching the specified type; an empty list if no relays of that type are found. + /// List GetRelayByTypeInList(List configurationRelayList, RelayEnum.Type type); /// /// Retrieves the objects that correspond to the supplied configuration relay identifiers. /// /// The list of values identifying the configuration relays to look up. /// A containing the relays that match the provided configuration relay identifiers. + /// List GetRelayInList(List configurationRelayList); /// /// Retrieves a paginated, filterable query of relays based on the specified pagination filter. /// /// The pagination filter used to control paging and additional query criteria for the relay lookup. /// An representing the paginated query that can be further refined and executed. + /// IFindFluent GetPaginatedRelays(PaginationFilter filter); /// /// Asynchronously inserts a single record and returns the inserted entity, or if the insertion did not produce a result. /// /// The entity to be inserted. /// A task that represents the asynchronous insert operation. The result is the inserted , or when no relay is returned. + /// Task InsertOneRelayAsync(Relay request); /// /// Updates an existing relay identified by the specified object identifier. @@ -45,11 +50,13 @@ public interface IRelayRepository : IMongoRepository /// The unique identifier of the relay to update. /// The relay object containing the updated information. /// A task that represents the asynchronous operation. The task result contains the updated relay, or if no relay with the specified identifier was found. + /// Task UpdateRelayAsync(ObjectId objectId, Relay relay); /// /// Retrieves a relay by its name asynchronously, returning null if no matching relay is found. /// /// The name of the relay to look up. May be null. /// A task that represents the asynchronous lookup. The task result contains the matching relay, or null if no relay with the specified name exists. + /// Task GetByName(string? requestRelayName); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/ISectionRepository.cs b/adas-core.Application/Repositories/Interfaces/ISectionRepository.cs index 56e407b3..611ef684 100644 --- a/adas-core.Application/Repositories/Interfaces/ISectionRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/ISectionRepository.cs @@ -10,12 +10,14 @@ public interface ISectionRepository : IMongoRepository
///
/// The patient location used to filter the sections. /// A task that represents the asynchronous operation. The task result contains the list of sections matching the specified patient location. + /// Task> FindByLocation(PatientLocation location); /// /// Asynchronously retrieves a by its identifier, returning null when no matching section is found. /// /// The identifier of the section to look up. /// A task that represents the asynchronous operation. The task result contains the matching , or null if no section with the specified identifier exists. + /// Task FindById(object id); /// /// Asynchronously retrieves the that matches the specified identifier. @@ -23,23 +25,27 @@ public interface ISectionRepository : IMongoRepository
///
/// The unique identifier of the section to look up. /// A that resolves to the matching , or null if no section is found. + /// Task FindById(string id); /// /// Asynchronously retrieves a that matches the specified section identifier. /// /// The section name or identifier used to look up the matching . /// A that yields the matching , or null if no section is found. + /// Task FindBySection(string section); /// /// Asynchronously retrieves the associated with the specified point of care. /// /// The point of care identifier used to look up the section. /// A task that returns the matching , or null if no section is found for the given point of care. + /// Task FindByPointOfCare(string pointOfCare); /// /// Asynchronously retrieves all sections. /// /// A task that represents the asynchronous operation. The task result contains a list of all items. + /// Task> GetAll(); /// @@ -47,6 +53,7 @@ public interface ISectionRepository : IMongoRepository
///
/// The section entity containing the updated information. /// A task that represents the asynchronous update operation, containing the updated section, or null if the section was not found. + /// Task UpdateSection(Section section); //Task UpdateSectionItems(Section section); //Task UpdateSectionConfig(Section section); @@ -57,5 +64,6 @@ public interface ISectionRepository : IMongoRepository
///
/// The instance to be inserted. /// A that resolves to the inserted , or if no section was inserted. + /// Task InsertOneSection(Section section); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IServiceConfigRepository.cs b/adas-core.Application/Repositories/Interfaces/IServiceConfigRepository.cs index 4e055eed..e13422e5 100644 --- a/adas-core.Application/Repositories/Interfaces/IServiceConfigRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IServiceConfigRepository.cs @@ -11,11 +11,13 @@ public interface IServiceConfigRepository : IMongoRepository ///
/// The unique identifier of the service configuration to look up. /// A matching the provided identifier, or null if no configuration exists for that id. + /// Task FindById(ObjectId oid); /// /// Retrieves a by its identifier, returning when no matching configuration is found. /// /// The unique identifier of the service configuration to look up. /// A task that resolves to the matching , or if no configuration exists for the given id. + /// Task FindById(string id); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/ITreatmentArchiveRepository.cs b/adas-core.Application/Repositories/Interfaces/ITreatmentArchiveRepository.cs index 44b7fc1a..9320c537 100644 --- a/adas-core.Application/Repositories/Interfaces/ITreatmentArchiveRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/ITreatmentArchiveRepository.cs @@ -9,17 +9,20 @@ public interface ITreatmentArchiveRepository /// Asynchronously inserts a new patient treatment record into the underlying data store. ///
/// The patient treatment entity to insert. + /// Task InsertOneAsync(PatientTreatment patientTreatment); /// /// Asynchronously deletes items whose associated date is earlier than the specified cutoff date. /// /// The cutoff date; items dated before this value are removed. + /// Task DeleteBeforeDate(DateTime date); /// /// Asynchronously inserts a batch of records. /// /// The collection of patient treatment entities to be inserted. /// A task that represents the asynchronous operation. The task result contains a value associated with the batch insertion. + /// Task InsertBatch(IEnumerable treatments); /// @@ -27,5 +30,6 @@ public interface ITreatmentArchiveRepository /// /// The unique identifier of the patient whose treatments are being queried. /// A task that represents the asynchronous operation, containing a list of records for the given patient. + /// Task> FindAllFromPatient(ObjectId patientId); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/ITreatmentRepository.cs b/adas-core.Application/Repositories/Interfaces/ITreatmentRepository.cs index 583d2c44..5fdf5e54 100644 --- a/adas-core.Application/Repositories/Interfaces/ITreatmentRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/ITreatmentRepository.cs @@ -12,6 +12,7 @@ public interface ITreatmentRepository : IMongoRepository ///
/// The unique identifier of the patient whose treatments are being queried. /// A task that represents the asynchronous operation. The task result contains an of treatments for the patient; the collection is empty if no treatments are found. + /// Task> GetByPatientId(ObjectId patientId); /// /// Asynchronously retrieves a patient treatment record from the data store that matches the specified identifier. @@ -19,35 +20,41 @@ public interface ITreatmentRepository : IMongoRepository /// /// The unique of the patient treatment record to retrieve. /// A that yields a cursor containing the matching patient treatment, if any. + /// Task> GetById(ObjectId id); /// /// Asynchronously inserts a new record into the data store. /// /// The patient treatment entity to be persisted. /// A that represents the asynchronous insert operation. + /// new Task InsertOneAsync(PatientTreatment treatment); /// /// Asynchronously deletes the entity identified by the specified identifier. /// /// The unique identifier of the entity to delete. + /// new Task DeleteAsync(ObjectId id); /// /// Updates an existing record in the data store asynchronously. /// /// The entity containing the updated information. /// A that represents the asynchronous update operation. The task result contains true if the update was successful; otherwise, false. + /// Task Update(PatientTreatment treatment); /// /// Asynchronously retrieves the collection of records associated with the specified patient identifier, returning the results as a cursor for streaming access. /// /// The unique identifier of the patient whose treatments are being queried. /// A task that yields an of records matching the given patient identifier. + /// Task> FindByPatientIdAsync(ObjectId patientId); /// /// Asynchronously retrieves the collection of patient treatments associated with the specified patient identifier. /// /// The unique identifier of the patient whose treatments are being queried. /// A task that represents the asynchronous operation, containing an enumerable collection of records for the given patient. + /// Task> FindByPatientId(ObjectId patientId); /// @@ -55,12 +62,14 @@ public interface ITreatmentRepository : IMongoRepository /// /// The unique identifier of the patient whose record should be deleted. /// A task that represents the asynchronous operation. The task result is true if the record was successfully deleted; otherwise, false. + /// Task DeleteByPatientId(ObjectId patientId); /// /// Asynchronously retrieves the list of bolus treatments associated with the specified patient. /// /// The unique identifier of the patient whose bolus treatments are being queried. /// A task that represents the asynchronous operation, containing a list of entries representing the patient's bolus treatments. + /// Task> FindBolusTreatments(ObjectId patientId); /// /// Updates many records that reference a specific ObjectId, replacing the existing ObjectId with a new one. @@ -69,12 +78,14 @@ public interface ITreatmentRepository : IMongoRepository /// The name of the field/property that contains the ObjectId reference to be updated. /// The new ObjectId value that will replace the existing reference. /// The current ObjectId value to match and be replaced. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); /// /// Retrieves a paginated, fluent queryable collection of patient treatments based on the provided pagination filter. /// /// The pagination filter containing page size, page number, and other pagination criteria. /// An for that supports further fluent query composition and pagination. + /// IFindFluent GetPaginatedTreatments(PaginationFilter filter); /// /// Asynchronously retrieves a list of active patient treatments for the specified patient, ordered according to the provided ordering criterion. @@ -82,5 +93,6 @@ public interface ITreatmentRepository : IMongoRepository /// The unique identifier of the patient whose active treatments are to be retrieved. /// The ordering criterion applied to the returned list of treatments. /// A task that represents the asynchronous operation, containing a list of active objects for the specified patient. + /// Task> GetActiveTreatmentsByPatientIdAndOrder(ObjectId patientId, string order); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IUnitRepository.cs b/adas-core.Application/Repositories/Interfaces/IUnitRepository.cs index fe6cfcfd..cd154e02 100644 --- a/adas-core.Application/Repositories/Interfaces/IUnitRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IUnitRepository.cs @@ -15,6 +15,7 @@ public interface IUnitRepository : IMongoRepository /// /// The identifier of the to locate. /// A task that resolves to the matching , or null if no entity is found. + /// Task FindById(object id); /// @@ -22,6 +23,7 @@ public interface IUnitRepository : IMongoRepository /// /// The name of the section to search for. /// A task that represents the asynchronous operation. The task result contains the unit if found; otherwise, null. + /// Task FindByName(string section); //Task FindByPointOfCare(PointOfCare pointOfCare); @@ -29,18 +31,21 @@ public interface IUnitRepository : IMongoRepository /// Asynchronously retrieves all available units and returns them as a list. /// /// A task that represents the asynchronous operation, containing a list of all entities. + /// Task> GetAll(); /// /// Updates an existing unit in the underlying store and returns the updated entity. /// /// The unit containing the updated data to persist. /// A task that resolves to the updated , or null when the unit cannot be found. + /// Task UpdateUnit(Unit section); /// /// Inserts a single record and returns the inserted entity, or if the insertion did not produce a result. /// /// The entity to insert. /// A task that represents the asynchronous insert operation. The task result contains the inserted , or when no unit is returned. + /// Task InsertOneUnit(Unit unit); /// /// Retrieves the collection of units associated with the specified master list identifier and master list type. @@ -48,18 +53,21 @@ public interface IUnitRepository : IMongoRepository /// The unique identifier of the master list whose units should be retrieved. /// The type of the master list used to filter or scope the unit lookup. /// A task that represents the asynchronous operation, containing the collection of units linked to the specified master list. + /// Task> FindByMasterListId(ObjectId id, MasterListType masterListType); /// /// Asynchronously retrieves the collection of entities associated with the specified master list identifier. /// /// The of the master list whose units are being requested. /// A task that represents the asynchronous operation. The task result contains an with the units linked to the given master list. + /// Task> FindByMasterListId(ObjectId id); /// /// Updates the unit master list based on the provided unit identifiers. Returns the updated when the operation succeeds, or null when no matching unit is found. /// /// The data transfer object containing the list of unit identifiers to update. /// A task that represents the asynchronous operation. The task result contains the updated , or null if no unit was updated. + /// Task UpdateUnitMasterList(UpdateUnitIdListDto updateUnitListDto); /// /// Updates the name and title of an existing unit identified by the specified identifier. @@ -68,6 +76,7 @@ public interface IUnitRepository : IMongoRepository /// The new name to assign to the unit. /// The new title to assign to the unit. /// A task that represents the asynchronous update operation. The task result contains the updated , or null if the unit was not found. + /// Task UpdateUnitInfo(ObjectId unitId, string name, string title); /// /// Updates the configuration of a unit identified by the specified identifier. @@ -75,12 +84,14 @@ public interface IUnitRepository : IMongoRepository /// The parsed object identifier of the unit whose configuration will be updated. /// The new configuration values to apply to the unit. /// A task that represents the asynchronous operation. The task result is true if the configuration was successfully updated; otherwise, false. + /// Task UpdateConfiguration(ObjectId unitIdParsed, UnitConfiguration unitConfiguration); /// /// Retrieves a paginated collection of records based on the provided pagination criteria. /// /// The pagination filter that defines the page size, page number, and any additional filtering criteria. /// An representing the fluent query for the paginated units. + /// IFindFluent GetPaginatedUnits(PaginationFilter filter); /// /// Asynchronously counts the number of units associated with the master list identified by the specified identifier and type. @@ -88,5 +99,6 @@ public interface IUnitRepository : IMongoRepository /// The unique identifier of the master list whose units should be counted. /// The type of the master list used to resolve the appropriate unit collection. /// A task that represents the asynchronous operation, containing the total number of units matching the specified master list. + /// Task CountUnitsByMasterListId(ObjectId id, MasterListType masterListType); } \ No newline at end of file diff --git a/adas-core.Application/Repositories/Interfaces/IUserRepository.cs b/adas-core.Application/Repositories/Interfaces/IUserRepository.cs index 057ee5e4..cd607829 100644 --- a/adas-core.Application/Repositories/Interfaces/IUserRepository.cs +++ b/adas-core.Application/Repositories/Interfaces/IUserRepository.cs @@ -14,30 +14,35 @@ public interface IUserRepository : IMongoRepository /// The username used to look up the user account. /// The password used to authenticate the user. /// A task that resolves to the authenticated , or null if no user matches the provided credentials. + /// Task GetUser(string username, string password); /// /// Retrieves a user by their unique identifier asynchronously. /// /// The unique identifier of the user to retrieve. /// A task that represents the asynchronous operation. The task result contains the if found; otherwise, . + /// Task GetById(ObjectId id); /// /// Asynchronously retrieves a user matching the specified username. Returns null if no user is found. /// /// The username to look up. /// A task that represents the asynchronous operation, containing the matching or null if not found. + /// Task GetByUserName(string name); /// /// Asynchronously retrieves a user by their name, returning null if no matching user is found. /// /// The name of the user to look up. /// A task that represents the asynchronous operation. The task result contains the user with the specified name, or null if no matching user exists. + /// Task GetByName(string name); /// /// Asynchronously retrieves the user associated with the specified authorities name. /// /// The authorities name used to look up the user. /// A task that represents the asynchronous operation. The task result contains the matching if found; otherwise, null. + /// Task GetByUserAndAuthoritesName(string name); /// /// Updates an existing user in the system, optionally updating the user's password when the flag is set. @@ -45,16 +50,19 @@ public interface IUserRepository : IMongoRepository /// The user entity containing the updated information to be persisted. /// A flag indicating whether the user's password should also be updated as part of this operation. /// A task that returns the updated entity, or null if the user was not found. + /// Task UpdateUser(User user, bool updatePass); /// /// Retrieves a paginated, fluent queryable collection of entities based on the supplied pagination filter. /// /// The pagination filter that defines paging parameters such as page number and page size. /// An representing the queryable, paginated user results. + /// IFindFluent GetPaginatedUsers(PaginationFilter filter); /// /// Retrieves the existing system user, creating a new one if it does not already exist. /// /// The existing or newly created system . + /// Task GetOrCreateSystemUser(); } \ No newline at end of file diff --git a/adas-core.Application/Services/AdminPanelService.cs b/adas-core.Application/Services/AdminPanelService.cs index fc66111b..78d5ce8c 100644 --- a/adas-core.Application/Services/AdminPanelService.cs +++ b/adas-core.Application/Services/AdminPanelService.cs @@ -45,6 +45,7 @@ public class AdminPanelService( /// The patient to archive. /// true if the patient was archived successfully. /// Rethrows any exception thrown by the underlying patient service after logging it to the console. + /// public async Task ArchivePatient(Patient patient) { try @@ -66,6 +67,7 @@ public class AdminPanelService( /// /// The ADMPanel request containing the data used to populate the new patient. /// The newly created with its generated identifier. + /// public async Task CreatePatient(AdmPanelRequest admRequest) { var patient = new Patient @@ -88,6 +90,7 @@ public class AdminPanelService( /// Thrown when the target PointOfCareId is already occupied by another patient. /// Thrown when the requested PointOfCareId does not exist. /// The asynchronous representing the update operation. + /// private async Task UpdateNewPatient(Patient patient, AdmPanelRequest admRequest) { if (!string.IsNullOrEmpty(admRequest.PatientNumber)) patient.PatientNumber = admRequest.PatientNumber; @@ -159,6 +162,7 @@ public class AdminPanelService( /// The unique identifier of the patient to look up. /// The patient matching the provided identifier. /// Thrown when no patient is found for the specified identifier. + /// public async Task FindPatientById(ObjectId id) { return await patientService.FindById(id) ?? @@ -171,6 +175,7 @@ public class AdminPanelService( /// /// The location to search for a patient at. /// A if one is found at the specified location; otherwise, null. + /// public async Task FindPatientByLocation(PatientLocation location) { return await patientService.FindByLocation(location); @@ -182,6 +187,7 @@ public class AdminPanelService( /// /// The unique patient number used to look up the patient. /// A if a match is found; otherwise, null. + /// public async Task FindPatientByPatientNumber(string patientNumber) { return await patientService.FindByPatientNumber(patientNumber); @@ -194,6 +200,7 @@ public class AdminPanelService( /// The existing patient record currently stored in the database that will be updated. /// A task that resolves to true when the patient data is successfully updated. /// Thrown when the request is missing the patient number, the patient payload is null, or the patient payload is empty. + /// public async Task UpdatePatientData(AdmPanelRequest request, Patient oldPatient) { //traer el paciente que se quiere actualizar con los valores que tenga en la base de datos a una variable @@ -264,6 +271,7 @@ public class AdminPanelService( /// The admission panel request containing the patient identification data and optional location used to locate the patient. /// The matching if found. /// Thrown when no patient matches the provided request criteria. + /// public async Task FindPatient(AdmPanelRequest request) { var findByLocation = !request.Location?.IsFullEmpty(); @@ -278,6 +286,7 @@ public class AdminPanelService( /// The location used to look up the patient. /// The patient found at the specified location. /// Thrown when no patient is found for the given location. + /// public async Task FindByLocation(PatientLocation location) { return await patientService.FindByLocation(location) ?? @@ -295,6 +304,7 @@ public class AdminPanelService( /// The configuration observation containing the data to persist. /// A task that resolves to true when the configuration is created successfully. /// Thrown when the configuration creation fails, indicated by a null result from the service call. + /// public async Task CreateConfig(ConfigObservation configObservation) { _ = await configObservationService.CreateConfig(configObservation) ?? @@ -308,6 +318,7 @@ public class AdminPanelService( /// The configuration observation to update. /// A task that resolves to true when the configuration is successfully updated. /// Thrown when the underlying update operation fails, as indicated by a null result from the service. + /// public async Task UpdateConfig(ConfigObservation configObservation) { _ = await configObservationService.UpdateConfig(configObservation) ?? @@ -321,6 +332,7 @@ public class AdminPanelService( /// The unique identifier of the config observation item to delete. /// true when the config observation item is successfully removed. /// Thrown when the removal operation returns a null result, signaling a conflict with the delete request. + /// public async Task DeleteConfigObservationItem(ObjectId id) { _ = await configObservationService.RemoveConfigItem(id) ?? @@ -338,6 +350,7 @@ public class AdminPanelService( /// /// The unit to be inserted. /// The inserted unit with its associated Point of Care identifiers, or null if the unit could not be inserted. + /// public async Task InsertUnit(Unit unit) { //Insertamos la unidad y creamos los PoCs por defecto para esa unidad @@ -375,6 +388,7 @@ public class AdminPanelService( /// /// The unit for which to build the dependency information DTO. /// A task that resolves to a containing the unit's dependency counts, or null if an error occurs while retrieving the counts. + /// public async Task GetUnitDependencyDto(Unit unit) { try @@ -405,6 +419,12 @@ public class AdminPanelService( /// true if the unit and its related resources were successfully deleted; otherwise, false when an error is caught and logged. /// Thrown when no unit is found for the specified . /// Thrown when the unit has patients assigned to it, preventing deletion. + /// + /// + /// public async Task DeleteUnitById(ObjectId unitId) { try @@ -455,6 +475,7 @@ public class AdminPanelService( /// The unique identifier of the medicine to retrieve. /// The medicine matching the specified identifier. /// Thrown when no medicine is found with the specified identifier. + /// public async Task GetMedicineById(ObjectId medicineId) { return await medicineService.GetMedicineById(medicineId) ?? @@ -467,6 +488,7 @@ public class AdminPanelService( /// The medicine to be created. /// The created . /// Thrown when the medicine service fails to create the medicine. + /// public async Task PostMedicine(Medicine medicine) { var newMedicine = await medicineService.PostMedicine(medicine) ?? @@ -481,6 +503,7 @@ public class AdminPanelService( /// The medicine entity containing the updated information to persist. /// The updated returned by the service. /// Thrown when the update operation fails and the service returns a null result. + /// public async Task UpdateMedicine(Medicine medicine) { var updatedMedicine = await medicineService.UpdateMedicine(medicine) ?? @@ -495,6 +518,8 @@ public class AdminPanelService( /// A task that resolves to true when the medicine has been successfully deleted. /// Thrown when is not a valid ObjectId format. /// Thrown when the medicine still exists after the delete operation, indicating the deletion failed. + /// public async Task DeleteMedicineById(string medicineId) { if (!ObjectId.TryParse(medicineId, out var objectId)) diff --git a/adas-core.Application/Services/AdmissionService.cs b/adas-core.Application/Services/AdmissionService.cs index 2256b58a..a4eab572 100644 --- a/adas-core.Application/Services/AdmissionService.cs +++ b/adas-core.Application/Services/AdmissionService.cs @@ -44,6 +44,7 @@ public class AdmissionService( /// Deletes the specified admission by delegating to the delete operation using the admission's identifier. ///
/// The admission entity to delete, identified by its . + /// public async Task DeleteAdmissionAsync(Admission admission) { await DeleteAdmissionByIdAsync(admission.Id); @@ -53,6 +54,7 @@ public class AdmissionService( /// Deletes an admission identified by the given id. If the admission is not found, the operation is skipped and logged; otherwise the admission is removed, any associated point of care is detached (clearing its AdmissionId and Admission) and set to Available when not currently Locked or InUse, a delete broadcast is sent, and an audit log entry is created. ///
/// The identifier of the admission to delete. + /// public async Task DeleteAdmissionByIdAsync(ObjectId admissionId) { var admissionAux = await admissionRepository.FindById(admissionId); @@ -90,6 +92,7 @@ public class AdmissionService( /// Asynchronously deletes all admissions associated with the specified unit identifier by delegating the operation to the admission repository. ///
/// The unique identifier of the unit whose admissions should be removed. + /// public async Task DeleteAdmissionsByUnitId(ObjectId unitId) { _ = await admissionRepository.DeleteAdmissionsByUnitId(unitId); @@ -101,6 +104,7 @@ public class AdmissionService( ///
/// The unique identifier of the admission to retrieve. /// The matching with its populated when applicable, or null if no admission is found. + /// public async Task GetAdmissionByIdAsync(ObjectId admissionId) { var result = await admissionRepository.FindById(admissionId); @@ -118,6 +122,7 @@ public class AdmissionService( ///
/// A task that represents the asynchronous operation. The task result contains a collection of objects with patient location details populated for those linked to a point of care. /// Thrown when the admission repository returns no results. + /// public async Task> GetAdmissionsAsync() { var resultList = await admissionRepository.FindAll() ?? @@ -141,6 +146,8 @@ public class AdmissionService( /// The newly inserted , or null if no result is produced. /// Thrown when an admission with the same NHC already exists, or when the insertion fails to return a result. /// Thrown when the specified Point of Care does not exist. + /// public async Task InsertAdmission(Admission admission) { var admissionAux = await admissionRepository.FindByNhc(admission.Nhc); @@ -183,6 +190,7 @@ public class AdmissionService( /// If the admission is not found, the method returns without making changes; point of care lookups are only applied when a PointOfCareId is present and yields a result. ///
/// The admission entity containing the updated information to persist. + /// public async Task UpdateAdmissionAsync(Admission admission) { var oldAdmission = await admissionRepository.FindById(admission.Id); @@ -212,6 +220,7 @@ public class AdmissionService( ///
/// The admission data used to create the patient and populate location, diagnosis, allergies, and other attributes. /// When false, the admission record is deleted after a successful patient insertion; when true, the admission is retained. + /// public async Task AdmitPatient(Admission admission, bool isNew = false) { if (admission.PointOfCareId == null) @@ -329,6 +338,7 @@ public class AdmissionService( /// Returns a patient to the admissions workflow by creating a new admission record, removing any existing discharge, and archiving the patient. Validates that the patient and its associated unit exist before proceeding, and only builds the admission when a point of care is assigned. ///
/// The identifier of the patient to be returned to admissions. + /// public async Task ReturnPatientToAdmissions(ObjectId patientId) { var patient = await patientService.FindById(patientId); @@ -383,6 +393,7 @@ public class AdmissionService( ///
/// The unique identifier of the patient to be returned to admissions. /// The admission context used to resolve the unit and point of care for the new admission record. + /// public async Task ReturnPatientToAdmissions(ObjectId patientId, Admission adm) { var patient = await patientService.FindById(patientId); @@ -437,6 +448,7 @@ public class AdmissionService( ///
/// The patient location used to filter admissions. /// A task that represents the asynchronous operation. The task result contains a list of admissions matching the specified location, or an empty list if an error occurs. + /// public async Task> GetAdmissionByLocation(PatientLocation location) { try @@ -456,6 +468,7 @@ public class AdmissionService( ///
/// The identifier of the point of care whose admissions should be retrieved. /// A task representing the asynchronous operation, containing the list of admissions for the given point of care, or an empty list if an error occurs. + /// public async Task> GetAdmissionByPointOfCareId(ObjectId pocId) { try @@ -482,6 +495,7 @@ public class AdmissionService( /// The identifier of the point of care whose admissions will be retrieved. /// The locale used to translate the admission fields. /// A task that represents the asynchronous operation, containing a list of admissions with their fields translated to the specified locale. + /// public async Task> GetAdmissionByPointOfCareIdAndLocale(ObjectId pocId, LocaleEnum locale) { var admissions = await GetAdmissionByPointOfCareId(pocId); @@ -500,6 +514,7 @@ public class AdmissionService( ///
/// The identifier of the unit whose admissions (without PoC) are being requested. /// A task that returns a list of objects for the given unit, or an empty list if an error occurs. + /// public async Task> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId) { try @@ -520,6 +535,7 @@ public class AdmissionService( ///
/// The identifier of the unit whose admissions should be counted. /// A task that represents the asynchronous operation. The task result contains the number of admissions for the given unit, or 0 if an error occurs. + /// public async Task CountAdmissionsByUnitId(ObjectId unitId) { try @@ -540,6 +556,7 @@ public class AdmissionService( /// The unique patient number used as the primary search key. /// The identifier of the unit used to filter the archived patient and admission searches. /// A aggregating the current patient, archived patient, and admission data, including flags indicating whether the patient exists only in the archive and whether any of the three sources returned a result. + /// public async Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId) { var patient = await patientService.FindByPatientNumber(patientNumber); @@ -570,6 +587,7 @@ public class AdmissionService( ///
/// The patient's clinical record number (NHC) used to look up the admission. /// A task that resolves to the matching if found, or null when no admission exists for the given patient number. + /// public Task GetAdmissionByPatientNumber(string patientNumber) { return admissionRepository.FindByNhc(patientNumber); @@ -581,6 +599,7 @@ public class AdmissionService( /// The master list update options to apply to the matching admissions. /// The collection of units whose admissions are affected by the update. /// The name of the master list type being modified. + /// public async Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable unitList, string typeName) { @@ -601,6 +620,7 @@ public class AdmissionService( /// The master list option to remove from the admissions. /// The collection of units whose admissions will be processed for the deletion. /// The name of the option type being deleted. + /// public async Task DeletePatientMasterListItem(OptionList opt, IEnumerable unitList, string typeName) { var unitIds = unitList.Select(x => x.Id).ToList(); @@ -622,6 +642,7 @@ public class AdmissionService( /// Required fields (Nhc, Origin, and Diagnosis) are validated before insert and update operations, and the method exits early when the admission or any required value is missing. ///
/// The API request containing the admission payload and the operation type to execute. + /// public async Task SaveRequest(ApiRequest apiRequest) { try @@ -681,6 +702,7 @@ public class AdmissionService( ///
/// The API request to persist. /// A task that represents the asynchronous save operation. + /// public Task SaveRequestAsync(ApiRequest apiRequest) { return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); })); @@ -691,6 +713,7 @@ public class AdmissionService( ///
/// The current admission containing the updated PointOfCare identifier. /// The previous admission state used to identify the original PointOfCare to release. + /// private async Task HandlePointOfCareChange(Admission admission, Admission oldAdmission) { // Check if PointOfCare has changed. @@ -747,6 +770,7 @@ public class AdmissionService( ///
/// The identifier of the point of care whose status will be updated. /// The new status to assign to the point of care. + /// private async Task SetPointOfCareStatus(ObjectId pointOfCareId, StatusEnum.PointOfCare status) { var pointOfCare = await pointOfCareService.FindById(pointOfCareId); @@ -761,6 +785,7 @@ public class AdmissionService( ///
/// The admission record to broadcast. /// The operation type associated with the broadcast. + /// private async void SendAdmissionBroadcast(Admission admission, OperationType operation) { try @@ -783,6 +808,7 @@ public class AdmissionService( ///
/// The admission whose broadcast is being sent; its Point of Care is used to select subscribers and locale-specific content. /// The type of operation to send to the subscribers. + /// private async Task SendAdmissionBroadcastByPoC(Admission admission, OperationType operation) { if (!admission.PointOfCareId.HasValue) @@ -821,6 +847,7 @@ public class AdmissionService( ///
/// The admission to broadcast, which supplies the target unit identifier. /// The operation type associated with the broadcast message. + /// private async Task SendAdmissionByUnitId(Admission admission, OperationType operation) { if (admission.UnitId == ObjectId.Empty) @@ -855,6 +882,7 @@ public class AdmissionService( /// The admission whose reference names will be updated with localized values. /// The locale used to retrieve the appropriate master list translations. /// The same instance with its localized reference names applied when available. + /// private async Task GetAdmissionWithLocale(Admission admission, LocaleEnum locale) { var unit = await unitService.FindById(admission.UnitId); diff --git a/adas-core.Application/Services/AlarmService.cs b/adas-core.Application/Services/AlarmService.cs index cfe9d0ff..a7c34aae 100644 --- a/adas-core.Application/Services/AlarmService.cs +++ b/adas-core.Application/Services/AlarmService.cs @@ -21,6 +21,7 @@ namespace adas_core.Application.Services; /// Provides the concrete implementation of the contract, /// encapsulating the business logic for managing and processing alarms within the application. ///
+/// public class AlarmService : IAlarmService { private readonly IAlarmRepository _alarmRepository; @@ -122,6 +123,7 @@ public class AlarmService : IAlarmService /// The API request containing patient, location, observation, and alarm data to process. /// Thrown when both the patient number and location unit name are missing. /// Thrown when the API request type is not valid for observations. + /// public async Task SaveRequest(ApiRequest apiRequest) { if ( @@ -178,6 +180,7 @@ public class AlarmService : IAlarmService /// Asynchronously saves the specified API request by delegating to the underlying save operation. ///
/// The API request to be saved. + /// public async Task SaveRequestAsync(ApiRequest apiRequest) { await SaveRequest(apiRequest); @@ -190,6 +193,7 @@ public class AlarmService : IAlarmService /// The patient observation alarm to be mapped. /// If true, mapping is performed by name only; otherwise the full mapping is applied. /// A mapped if both mapping steps succeed; otherwise, null. + /// public async Task MapObservation(PatientObservationAlarm obs, bool onlyByName = false) { try @@ -229,6 +233,7 @@ public class AlarmService : IAlarmService /// The identifier of the patient whose last observations should be retrieved. /// An optional list of fields used to restrict which observations are returned; when null, no field filter is applied. /// A task that represents the asynchronous operation, containing a list of the patient's last entries. + /// public async Task> FindLastObservationsByField(ObjectId patientId, List? filterObservations = null) { @@ -244,6 +249,7 @@ public class AlarmService : IAlarmService /// The list of fields used to filter the observations included in the aggregation. /// The list of alarm configurations that define the criteria applied during the aggregation. /// A task that resolves to a list of the latest non-expired entries matching the criteria. + /// public async Task> FindLastValuesNotExpired(ObjectId patientId, List filterObservations, List configAlarm) { @@ -258,6 +264,7 @@ public class AlarmService : IAlarmService ///
/// The patient observation alarm to be mapped by name. /// A task that returns the mapped if a matching configuration is found; otherwise, null. + /// public async Task MapObservationsByName(PatientObservationAlarm obs) { return await _configObservationService.Map(obs, true); @@ -271,6 +278,7 @@ public class AlarmService : IAlarmService /// The patient the alarms are associated with. /// The message time assigned to each alarm. /// Optional parent observation metadata applied to all alarms in the batch. + /// public async Task ProcessAlarmObservations(List alarmObservations, List observations, Patient patient, DateTime messageTime, ObservationData? observationData = null) @@ -398,6 +406,7 @@ public class AlarmService : IAlarmService /// The patient observation alarm to insert. /// Indicates whether the observation should be persisted to the repository. Defaults to true and is forced to false if the observation's Persist property is false. /// Indicates whether the observation should be mapped before being processed. Set to false only when the observation originates from the inner refactor job. + /// private async Task InsertObservation(PatientObservationAlarm obs, bool persistObs = true, bool mapObs = true) { try @@ -436,6 +445,7 @@ public class AlarmService : IAlarmService /// Skips observations without a name and returns silently when the associated patient cannot be resolved from the observation or the patient service. ///
/// The patient observation to be sent to matching subscribers as an alarm operation. + /// private async Task SendObsBroadcast(BasePatientObservation obs) { if (obs.Name == null) return; @@ -473,6 +483,7 @@ public class AlarmService : IAlarmService /// Evaluates alarm configuration rules for a patient observation and, when matching conditions and preconditions are satisfied, generates a new alert observation, logs it, and triggers the corresponding alarm notification. ///
/// The patient observation whose value is evaluated against configured alert rules and preconditions. + /// public async Task CheckObservationAlarm(PatientObservation obs) { //ConfigObservations @@ -551,6 +562,7 @@ public class AlarmService : IAlarmService /// The configuration observation providing the coding system, code, name, and alarm settings. /// The status type to assign to the new observation. /// A new populated with the merged values from the source observation and configuration. + /// private static PatientObservation CreateNewObservation(PatientObservation obs, ConfigObservation config, StatusEnum.Type type) { @@ -572,6 +584,7 @@ public class AlarmService : IAlarmService ///
/// The patient observation whose alarm configuration will be checked and updated. /// The patient observation with the configured alarm applied, or with a null alarm if no configuration was found. + /// private async Task CheckAlarmConfig(PatientObservation pobs) { var configObs = await _configObservationService.Get(new PatientObservation @@ -596,6 +609,10 @@ public class AlarmService : IAlarmService /// /// /// New alarm created + /// + /// public async Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code, AlarmEnum.Severity severity, AlarmEnum.Type type) { @@ -775,6 +792,8 @@ public class AlarmService : IAlarmService ///
/// The patient observation value used to look up the alarm configuration and identify the target patient. /// The name associated with the observation, used for logging and alarm context. + /// public async Task CalculateAlarmTest(BasePatientObservationValue source, string name) { if (source is not PatientObservation obs) return; @@ -824,6 +843,7 @@ public class AlarmService : IAlarmService ///
/// The beacon color to transmit to the light beacon service. /// The patient whose associated point of care device should display the beacon color. + /// private Task SendBeaconCode(AlarmEnum.BeaconColor color, Patient patient) { if (!patient.PointOfCareId.HasValue) @@ -862,6 +882,12 @@ public class AlarmService : IAlarmService /// /// /// + /// + /// + /// private async Task StartRecording(ObjectId patientId, DateTime eventTime, AlarmItem? recording, AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, string? alarmDescription, int? endAfter, AlarmEnum.Type type = AlarmEnum.Type.Manual) @@ -896,6 +922,7 @@ public class AlarmService : IAlarmService ///
/// The identifier of the patient whose relay should be powered on. /// The type of relay to power on, used to locate the matching configuration in the point of care's relay list. + /// private async Task RelayPowerOn(ObjectId patientId, RelayEnum.Type type) { try @@ -922,6 +949,7 @@ public class AlarmService : IAlarmService /// Starts a periodic background timer that retrieves the list of locations and periodically checks for expired alarms, using a semaphore to ensure thread-safe execution. /// Logs any errors encountered during timer initialization or execution without rethrowing them. ///
+ /// private async void StartTimer() { try @@ -957,6 +985,7 @@ public class AlarmService : IAlarmService /// Asynchronously checks for expired alarms by running the beacon and relay expiration checks in parallel. ///
/// The list of points of care to be evaluated for expired beacon alarms. + /// private async Task CheckExpiredAlarms(List pocList) { _logger.LogTrace("Checking Expired Alarms Started"); @@ -981,6 +1010,7 @@ public class AlarmService : IAlarmService /// the still-valid observations. ///
/// The list of points of care whose beacons should be turned off when no alarms are active. + /// private async Task CheckExpiredBeaconsAsync(List pocList) { await _beaconListSemaphore.WaitAsync(); @@ -1050,6 +1080,7 @@ public class AlarmService : IAlarmService /// patients without an assigned PointOfCareId are processed, and the relay alarm list is /// synchronized under a lock with the filtered non-expired observations. ///
+ /// private async Task CheckExpiredRelayAsync() { var now = DateTime.UtcNow; diff --git a/adas-core.Application/Services/AlertValuesService.cs b/adas-core.Application/Services/AlertValuesService.cs index c0055c28..b3bc0759 100644 --- a/adas-core.Application/Services/AlertValuesService.cs +++ b/adas-core.Application/Services/AlertValuesService.cs @@ -11,6 +11,7 @@ namespace adas_core.Application.Services; /// Provides an implementation of the IAlertValuesService interface for managing alert values /// using a configuration observation repository. ///
+/// public class AlertValuesService(IConfigObservationRepository alertValueRepository) : IAlertValuesService { /// @@ -20,6 +21,7 @@ public class AlertValuesService(IConfigObservationRepository alertValueRepositor /// The unique identifier of the configuration observation to retrieve. /// The matching if found. /// Thrown when no configuration observation exists for the specified . + /// public async Task FindByKey(ObjectId key) { return await alertValueRepository.FindById(key) ?? diff --git a/adas-core.Application/Services/AppointmentService.cs b/adas-core.Application/Services/AppointmentService.cs index c34e1708..d1048f2a 100644 --- a/adas-core.Application/Services/AppointmentService.cs +++ b/adas-core.Application/Services/AppointmentService.cs @@ -47,6 +47,7 @@ public class AppointmentService( /// /// The API request containing the patient number, location, type, observations, diagnosis, and related data to be processed. /// Thrown when the has a null or empty patient number. + /// public async Task SaveRequest(ApiRequest apiRequest) { if (string.IsNullOrEmpty(apiRequest.PatientNumber)) @@ -91,6 +92,7 @@ public class AppointmentService( ///
/// The API request containing the HL7 message type, timestamp, and appointment payload to process. /// The patient associated with the request; if null, the method returns without processing. + /// public async Task ProcessApiRequest(ApiRequest apiRequest, Patient? patient) { if (patient == null) @@ -232,6 +234,7 @@ public class AppointmentService( ///
/// The API request to be saved. /// A task that represents the asynchronous save operation. + /// public Task SaveRequestAsync(ApiRequest apiRequest) { return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); })); @@ -241,6 +244,7 @@ public class AppointmentService( /// Archives the specified patient by delegating the operation to using the patient's identifier. ///
/// The patient to be archived. + /// public async Task Archive(Patient patient) { await ArchiveByPatientId(patient.Id); @@ -250,6 +254,7 @@ public class AppointmentService( /// Archives all appointments associated with the specified patient by copying them to the appointment archive repository and then deleting them from the source collection. ///
/// The unique identifier of the patient whose appointments should be archived. + /// public async Task ArchiveByPatientId(ObjectId id) { logger.LogDebug("Archive Appointments by patientId {id}", id); @@ -268,6 +273,7 @@ public class AppointmentService( ///
/// The unique identifier of the patient whose appointments are being requested. /// A task that represents the asynchronous operation, containing a list of records for the given patient. + /// public async Task> GetByPatient(ObjectId patientId) { return await appointmentRepository.GetByPatient(patientId); @@ -280,6 +286,7 @@ public class AppointmentService( /// The unique identifier of the patient whose appointments are being queried. /// Cancellation token used to cancel the asynchronous operation. /// A task that resolves to a list of instances scheduled for today; an empty list is returned when no appointments match. + /// public async Task> GetTodayByPatient( ObjectId patientId, CancellationToken ct = default) @@ -320,6 +327,7 @@ public class AppointmentService( /// The identifier of the point of care whose appointments should be retrieved. /// A cancellation token to cancel the asynchronous operation. /// A task that represents the asynchronous operation, containing the list of patient appointments scheduled for today at the specified point of care. + /// public async Task> GetTodayByPoc( ObjectId pocId, CancellationToken ct = default) @@ -361,6 +369,7 @@ public class AppointmentService( ///
/// The unique identifier of the patient whose appointments are to be retrieved. /// A task that represents the asynchronous operation, containing an async cursor over the matching documents. + /// public Task> FindByPatientIdAsync(ObjectId patientId) { return appointmentRepository.FindByPatientIdAsync(patientId); @@ -371,6 +380,7 @@ public class AppointmentService( ///
/// The location used to filter the patient appointments. /// A task that represents the asynchronous operation, containing a list of patient appointments for the specified location. + /// public async Task> FindByLocation(PatientLocation location) { return await appointmentRepository.FindByLocation(location); @@ -381,6 +391,7 @@ public class AppointmentService( /// Deletes all appointments associated with the specified patient identifier, invalidates the appointments cache, and records the action in the audit log. /// /// The unique identifier of the patient whose appointments will be deleted. + /// public async Task DeleteByPatientId(ObjectId id) { var patientApp = await FindByPatientIdAsync(id); @@ -399,6 +410,7 @@ public class AppointmentService( /// The identifier used to scope which appointment records are affected by the update. /// The new ObjectId that will replace the existing one in the matching records. /// The current ObjectId to be replaced in the matching records. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await appointmentRepository.UpdateManyObjectId(nameId, id, oldId); @@ -409,6 +421,7 @@ public class AppointmentService( /// /// The patient appointment whose resource groups and locations will be broadcast to subscribers. /// The optional operation type describing the change performed on the appointment; passed along to the subscriber message. + /// private async Task SendBroadcast(PatientAppointment appointment, OperationType? operationType) { //RECORRE LOS DIFERENTES LOCATIONS DE LA CITA diff --git a/adas-core.Application/Services/ArchivePatientCarePlanService.cs b/adas-core.Application/Services/ArchivePatientCarePlanService.cs index c98ad904..8d34bb1f 100644 --- a/adas-core.Application/Services/ArchivePatientCarePlanService.cs +++ b/adas-core.Application/Services/ArchivePatientCarePlanService.cs @@ -29,6 +29,8 @@ public class ArchivePatientCarePlanService( /// /// The patient care plan to be archived and inserted. /// The inserted patient care plan, or if no plan was provided. + /// public async Task InsertOneAsync(PatientCarePlan patient) { await archivedPatientRepository.InsertOneAsync(patient); @@ -43,6 +45,7 @@ public class ArchivePatientCarePlanService( /// Asynchronously inserts a batch of archived patient care plans into the repository and creates an audit log entry for each one using the current HTTP context user. /// /// The list of patient care plans to insert and audit. + /// public async Task InsertManyAsync(List patientCarePla) { await archivedPatientRepository.InsertManyAsync(patientCarePla); @@ -61,6 +64,7 @@ public class ArchivePatientCarePlanService( /// /// The unique identifier of the patient whose archived care plans are being searched. /// A task that represents the asynchronous operation. The task result contains a list of for the patient, or null if no records are found. + /// public async Task?> FindByPatientId(ObjectId patientId) { return await archivedPatientRepository.FindByPatientId(patientId); @@ -72,6 +76,7 @@ public class ArchivePatientCarePlanService( /// /// The unique identifier of the patient whose archived care plans are being retrieved. /// A list of entries for the patient, or null if no records exist. + /// public async Task?> FindByPatientId(string patientId) { return await archivedPatientRepository.FindByPatientId(patientId); @@ -83,6 +88,7 @@ public class ArchivePatientCarePlanService( /// /// The unique identifier of the patient whose archived care plans are being searched. /// A list of objects for the specified patient, or null if no records are found. + /// public async Task?> FindByPatientNumber(string patientId) { return await archivedPatientRepository.FindByPatientNumber(patientId); @@ -92,6 +98,7 @@ public class ArchivePatientCarePlanService( /// Retrieves all archived patient care plans by delegating to the archived patient repository. /// /// A task that resolves to a list of objects representing all archived patient care plans. + /// public Task> FindAll() { return archivedPatientRepository.FindAll(); diff --git a/adas-core.Application/Services/ArchivePatientObservationsService.cs b/adas-core.Application/Services/ArchivePatientObservationsService.cs index 73d88ff9..761dac66 100644 --- a/adas-core.Application/Services/ArchivePatientObservationsService.cs +++ b/adas-core.Application/Services/ArchivePatientObservationsService.cs @@ -20,6 +20,7 @@ public class ArchivePatientObservationsService(IObservationArchiveRepository arc /// /// The unique identifier of the patient whose archived observations are being requested. /// A task that represents the asynchronous operation, containing a list of archived records for the patient. + /// public async Task> FindArchivedPatientObservationsFromPatient(ObjectId patientId) { return await archivedPatientObservationService.FindAllFromPatient(patientId); diff --git a/adas-core.Application/Services/ArchivedPatientService.cs b/adas-core.Application/Services/ArchivedPatientService.cs index 8928c870..326ef1c4 100644 --- a/adas-core.Application/Services/ArchivedPatientService.cs +++ b/adas-core.Application/Services/ArchivedPatientService.cs @@ -10,12 +10,14 @@ namespace adas_core.Application.Services; /// /// This class uses an to perform operations on archived patient records, following the repository pattern. /// +/// public class ArchivedPatientService(IPatientArchiveRepository archivedPatientRepository) : IArchivedPatientService { /// /// Retrieves all archived patients by delegating to the archived patient repository. /// /// A task representing the asynchronous operation, containing a list of all archived entities. + /// public async Task> FindAllPatients() { return await archivedPatientRepository.FindAll(); diff --git a/adas-core.Application/Services/ArchivedPatientTreatmentService.cs b/adas-core.Application/Services/ArchivedPatientTreatmentService.cs index 36063634..90eb04ed 100644 --- a/adas-core.Application/Services/ArchivedPatientTreatmentService.cs +++ b/adas-core.Application/Services/ArchivedPatientTreatmentService.cs @@ -17,6 +17,7 @@ public class ArchivedPatientTreatmentService(ITreatmentArchiveRepository archive /// /// The unique identifier of the patient whose archived treatments are being retrieved. /// A task that represents the asynchronous operation, containing a list of records for the specified patient. + /// public async Task> FindAllPatientTreatmentsByPatient(ObjectId patientId) { return await archivedPatientTreatmentService.FindAllFromPatient(patientId); diff --git a/adas-core.Application/Services/AuthService.cs b/adas-core.Application/Services/AuthService.cs index 7dd2b9a1..b71f1817 100644 --- a/adas-core.Application/Services/AuthService.cs +++ b/adas-core.Application/Services/AuthService.cs @@ -16,6 +16,7 @@ namespace adas_core.Application.Services; /// Provides an implementation of the interface, offering /// authentication-related services to consuming components. /// +/// public class AuthService : IAuthService { private readonly IAuthorityRepository _authorityRepository; @@ -49,6 +50,7 @@ public class AuthService : IAuthService /// Asynchronously obtains a login token from the recording API using the configured client credentials and caches it for reuse via . /// /// A containing the authentication token when the request succeeds and the response is valid; otherwise, null if the API URL is not configured, the request fails, the returned token is empty, or an exception is caught and logged. + /// public async Task GetLoginResponse() { try @@ -100,6 +102,7 @@ public class AuthService : IAuthService /// Otherwise, attempts a fresh login and returns the new token, falling back to an empty string when no token is obtained. /// /// A task that resolves to the authentication token, or an empty string if the token could not be obtained. + /// public async Task GetToken() { var loginResponse = AuthUtils.Instance.GetLoginResponse(); @@ -115,6 +118,7 @@ public class AuthService : IAuthService /// /// The unique identifier of the unit whose authorizations are being retrieved. /// A task that represents the asynchronous operation, containing a list of objects for the specified unit. + /// public async Task> GetByUnitId(ObjectId unitId) { return await _authorityRepository.GetByUnitId(unitId); @@ -125,6 +129,7 @@ public class AuthService : IAuthService /// /// The unique identifier of the user whose authorities are being requested. /// A task that represents the asynchronous operation, containing a list of entries for the user. + /// public async Task> GetUserAuthorities(ObjectId id) { return await _authorityRepository.GetUserAuthorities(id); @@ -135,6 +140,7 @@ public class AuthService : IAuthService /// /// The identifier of the unit whose authorities are to be removed. /// A task that represents the asynchronous operation. The task result is true if the deletion was successful; otherwise, false. + /// public async Task DeleteByUnitId(ObjectId unitId) { return await _authorityRepository.DeleteAllAuthoritiesByUnit(unitId); @@ -145,6 +151,7 @@ public class AuthService : IAuthService /// /// The unique identifier of the display whose related authorities should be removed. /// A task that resolves to true if authorities were successfully deleted; otherwise, false. + /// public async Task DeleteByDisplayId(ObjectId displayId) { return await _authorityRepository.DeleteAllAuthoritiesByDisplay(displayId); @@ -153,6 +160,7 @@ public class AuthService : IAuthService /// /// Ensures the authentication utilities are initialized with a valid login token. Returns early if the recording API URL is not configured; otherwise, requests a new token when the current one is missing or expired, and updates the shared instance with the refreshed response when successful. /// + /// private async Task InstanceAuthUtils() { if (_recordingSettings.RecordingApiUrl.IsEmpty()) diff --git a/adas-core.Application/Services/Caching/CacheDispatcher.cs b/adas-core.Application/Services/Caching/CacheDispatcher.cs index 09aac7a3..94ee7d60 100644 --- a/adas-core.Application/Services/Caching/CacheDispatcher.cs +++ b/adas-core.Application/Services/Caching/CacheDispatcher.cs @@ -12,6 +12,7 @@ namespace adas_core.Application.Services.Caching /// según CacheSettings y la entidad del key. /// Implementa ICacheService y delega en el backend elegido. /// + /// public class CacheDispatcher( RedisService redis, CacheService memory, @@ -27,6 +28,7 @@ namespace adas_core.Application.Services.Caching /// /// The cache key used to determine the entity type and the corresponding cache backend. /// The instance that should handle caching for the supplied key. + /// private ICacheService SelectBackend(string key) { var entity = CacheKeyClassifier.Classify(key); @@ -56,6 +58,7 @@ namespace adas_core.Application.Services.Caching /// The grouped field whose name contributes to the key. /// The identifier of the patient associated with the grouped observation. /// A formatted key string in the form GroupedObs:{patientId}:{gf.Name}. + /// private static string BuildGroupedKey(GroupedField gf, ObjectId patientId) => $"GroupedObs:{patientId}:{gf.Name}"; @@ -65,6 +68,7 @@ namespace adas_core.Application.Services.Caching /// The grouped field used to derive the cache key. /// The patient identifier used to derive the cache key. /// The backend associated with the built grouped key. + /// private ICacheService SelectBackend(GroupedField groupedField, ObjectId patientId) => SelectBackend(BuildGroupedKey(groupedField, patientId)); @@ -78,6 +82,7 @@ namespace adas_core.Application.Services.Caching /// An optional time-to-live duration for the cached object. If null, the backend's default expiration is applied. /// A token to observe while waiting for the operation to complete. /// A task that represents the asynchronous operation, containing the retrieved or newly created object of type . + /// public Task GetOrSetObjectAsync( string key, Func> factory, @@ -94,6 +99,7 @@ namespace adas_core.Application.Services.Caching /// An asynchronous function that produces the value to cache when no existing entry is found. /// An optional time-to-live duration after which the cached entry expires. If null, the backend's default TTL is used. /// A task that represents the asynchronous operation, containing the cached or loaded string value, or null if no value could be obtained. + /// public Task GetOrSetValueAsync( string key, Func> loader, @@ -113,6 +119,7 @@ namespace adas_core.Application.Services.Caching /// An optional time-to-live applied to the cached object. When null, the backend's default expiration is used. /// The token to observe for canceling the asynchronous operation. /// A task that represents the asynchronous get-or-set operation, containing the retrieved or newly created object. + /// public Task GetOrSetObjectAsync( GroupedField groupedField, ObjectId patientId, @@ -129,6 +136,7 @@ namespace adas_core.Application.Services.Caching /// /// The key used to select the backend and identify the value to set. /// The value to associate with the specified key. + /// public void SetValue(string key, string value) => SelectBackend(key).SetValue(key, value); @@ -137,6 +145,7 @@ namespace adas_core.Application.Services.Caching /// /// The key used to select the backend and retrieve the associated value. /// The value associated with the key, or null if the selected backend returns no value. + /// public string? GetValue(string key) => SelectBackend(key).GetValue(key); @@ -146,6 +155,7 @@ namespace adas_core.Application.Services.Caching /// The identifier used to select the appropriate backend and to look up the object. /// Indicates whether the underlying backend should perform an update during retrieval. Defaults to true. /// A task that represents the asynchronous retrieval operation, containing the object of type or null if not found. + /// public Task GetObjectAsync(string key, bool upd = true) => SelectBackend(key).GetObjectAsync(key, upd); @@ -157,6 +167,7 @@ namespace adas_core.Application.Services.Caching /// The object to store in the selected backend. /// Indicates whether an update operation should be performed. Defaults to true. /// A task that represents the asynchronous store operation. + /// public Task SetObjectAsync(string key, T obj, bool upd = true) => SelectBackend(key).SetObjectAsync(key, obj, upd); @@ -167,6 +178,7 @@ namespace adas_core.Application.Services.Caching /// An optional time-to-live applied to the object; if null, the backend's default is used. /// A flag indicating whether the retrieval should update the object's state (e.g., refresh expiration). /// A task containing the deserialized object, or null if the object is not found in the selected backend. + /// public Task GetObjectAsync(string key, TimeSpan? ttl, bool upd) => SelectBackend(key).GetObjectAsync(key, ttl, upd); @@ -178,6 +190,8 @@ namespace adas_core.Application.Services.Caching /// The optional time-to-live duration for the stored object. /// Indicates whether to update an existing entry or create a new one. /// A task that represents the asynchronous set operation. + /// public Task SetObjectAsync(string key, T obj, TimeSpan? ttl, bool upd) => SelectBackend(key).SetObjectAsync(key, obj, ttl, upd); @@ -186,6 +200,7 @@ namespace adas_core.Application.Services.Caching /// /// The identifier of the object to delete, also used to resolve the responsible backend. /// A task that represents the asynchronous delete operation. + /// public Task DeleteObjectAsync(string key) => SelectBackend(key).DeleteObjectAsync(key); @@ -194,12 +209,14 @@ namespace adas_core.Application.Services.Caching /// /// The pattern used to match entries for deletion in both storage backends. /// The combined total number of entries deleted from Redis and in-memory storage. + /// public async Task DeleteByPatternAsync(string pattern) => await redis.DeleteByPatternAsync(pattern) + await memory.DeleteByPatternAsync(pattern); /// /// Clears all cached data from both the in-memory cache and the Redis cache, ensuring that stale entries are removed across all configured cache providers. /// + /// public void CleanCache() { memory.CleanCache(); diff --git a/adas-core.Application/Services/Caching/CacheService.cs b/adas-core.Application/Services/Caching/CacheService.cs index 03cdc7fe..9f48a99d 100644 --- a/adas-core.Application/Services/Caching/CacheService.cs +++ b/adas-core.Application/Services/Caching/CacheService.cs @@ -10,6 +10,7 @@ namespace adas_core.Application.Services.Caching /// mediante LockManagerService + InMemoryLockProvider. /// Compatible con la interfaz ICacheService incluyendo GetOrSet. /// + /// public class CacheService(LockManagerService lockManager) : ICacheService { private readonly ConcurrentDictionary _mem = new(); @@ -21,6 +22,7 @@ namespace adas_core.Application.Services.Caching /// The grouped field whose name is included in the key. /// The identifier of the patient the key is scoped to. /// A formatted key string in the form GroupedObs:{patientId}:{gf.Name}. + /// private static string BuildGroupedKey(GroupedField gf, ObjectId patientId) => $"GroupedObs:{patientId}:{gf.Name}"; @@ -34,6 +36,8 @@ namespace adas_core.Application.Services.Caching /// Optional time-to-live associated with the cached object. /// A token to observe for cancellation requests. /// The cached or newly created object of type . + /// public async Task GetOrSetObjectAsync( string key, Func> factory, @@ -71,6 +75,8 @@ namespace adas_core.Application.Services.Caching /// The asynchronous function invoked to load the value when no cached entry exists for the key. /// An optional time span that overrides the default time-to-live for the cached value. /// The cached or newly loaded string value, or null when the underlying cache entry is absent or cannot be cast to a string. + /// public async Task GetOrSetValueAsync( string key, Func> loader, @@ -94,6 +100,8 @@ namespace adas_core.Application.Services.Caching /// Optional time-to-live for the cached entry. /// Token used to cancel the asynchronous operation. /// A task containing the cached or newly created object. + /// public async Task GetOrSetObjectAsync( GroupedField groupedField, ObjectId patientId, @@ -131,6 +139,7 @@ namespace adas_core.Application.Services.Caching /// /// The key that identifies where the value will be stored. /// The value to associate with the specified key. + /// public void SetValue(string key, string value) => _mem[key] = value; @@ -140,6 +149,7 @@ namespace adas_core.Application.Services.Caching /// /// The key used to look up the value in the underlying store. /// The string representation of the stored value if the key exists; otherwise, null. + /// public string? GetValue(string key) => _mem.TryGetValue(key, out var v) ? v.ToString() : null; @@ -150,6 +160,7 @@ namespace adas_core.Application.Services.Caching /// The cache key used to look up the stored object. /// Indicates whether the entry's expiration should be refreshed on access. Not currently used by this implementation. /// A containing the cached value cast to , or null if no entry exists for the given key. + /// public Task GetObjectAsync(string key, bool updateExpiration = true) { return Task.FromResult( @@ -163,6 +174,8 @@ namespace adas_core.Application.Services.Caching /// The cache key under which the object will be stored. /// The object to store in the cache. /// Indicates whether the cache entry's expiration should be refreshed. + /// public Task SetObjectAsync(string key, T obj, bool updateExpiration = true) { _mem[key] = obj!; @@ -176,6 +189,7 @@ namespace adas_core.Application.Services.Caching /// An optional time-to-live override accepted by this overload but ignored when delegating to the underlying retrieval call. /// A flag indicating whether the retrieval should trigger an update on the stored object. /// A task that represents the asynchronous operation, containing the retrieved object of type or null if no object is found for the given key. + /// public Task GetObjectAsync(string key, TimeSpan? ttlOverride, bool upd) => GetObjectAsync(key, upd); @@ -187,6 +201,7 @@ namespace adas_core.Application.Services.Caching /// An optional time-to-live override for the stored entry; not applied by this overload. /// A flag indicating whether the operation should update an existing entry. /// A task that represents the asynchronous set operation. + /// public Task SetObjectAsync(string key, T obj, TimeSpan? ttlOverride, bool upd) => SetObjectAsync(key, obj, upd); @@ -196,6 +211,7 @@ namespace adas_core.Application.Services.Caching /// Asynchronously removes the object associated with the specified key from the in-memory store. The operation succeeds silently whether or not the key exists. /// /// The identifier of the object to delete. + /// public Task DeleteObjectAsync(string key) { _mem.TryRemove(key, out _); @@ -207,6 +223,7 @@ namespace adas_core.Application.Services.Caching /// /// The pattern to match against cache keys. Asterisk (*) characters are removed and the remaining text is used as a substring match. /// A task that represents the asynchronous operation, containing the count of entries that were removed. + /// public Task DeleteByPatternAsync(string pattern) { var p = pattern.Replace("*", ""); @@ -223,6 +240,7 @@ namespace adas_core.Application.Services.Caching /// /// Clears all entries from the in-memory cache, removing any previously stored data. /// + /// public void CleanCache() => _mem.Clear(); } } \ No newline at end of file diff --git a/adas-core.Application/Services/Caching/InMemoryLockProvider.cs b/adas-core.Application/Services/Caching/InMemoryLockProvider.cs index a74ad58d..df27c8c5 100644 --- a/adas-core.Application/Services/Caching/InMemoryLockProvider.cs +++ b/adas-core.Application/Services/Caching/InMemoryLockProvider.cs @@ -8,6 +8,7 @@ namespace adas_core.Application.Services.Caching /// Se basa en SemaphoreSlim y solo controla concurrencia DENTRO del proceso. /// Para CacheService (in-memory). /// + /// public class InMemoryLockProvider : ILockProvider { private readonly ConcurrentDictionary _locks = new(StringComparer.Ordinal); @@ -15,6 +16,7 @@ namespace adas_core.Application.Services.Caching /// /// Crea u obtiene un semáforo asociado a la clave. /// + /// private SemaphoreSlim GetOrCreate(string key) { return _locks.GetOrAdd(key, _ => new SemaphoreSlim(1, 1)); @@ -23,6 +25,12 @@ namespace adas_core.Application.Services.Caching /// /// Intenta adquirir el lock por clave. /// + /// + /// + /// public async Task AcquireAsync(string key, TimeSpan timeout) { var sem = GetOrCreate(key); @@ -42,6 +50,8 @@ namespace adas_core.Application.Services.Caching /// /// Libera el lock (si existe y no está ya liberado). /// + /// public Task ReleaseAsync(string key) { if (!_locks.TryGetValue(key, out var sem)) diff --git a/adas-core.Application/Services/Caching/LockManagerService.cs b/adas-core.Application/Services/Caching/LockManagerService.cs index 843c1c10..c3ce7db7 100644 --- a/adas-core.Application/Services/Caching/LockManagerService.cs +++ b/adas-core.Application/Services/Caching/LockManagerService.cs @@ -8,6 +8,10 @@ namespace adas_core.Application.Services.Caching /// CacheService lo usará para evitar condiciones de carrera en GetOrSet. /// Funciona igual para locks locales o distribuidos. /// + /// + /// public class LockManagerService( ILogger logger, ILockProvider provider) @@ -15,6 +19,18 @@ namespace adas_core.Application.Services.Caching /// /// Ejecuta una función que devuelve un valor bajo un lock por clave. /// + /// + /// + /// + /// + /// + /// public async Task WithLockAsync( string key, TimeSpan timeout, @@ -57,6 +73,7 @@ namespace adas_core.Application.Services.Caching /// /// Version Task (sin valor). /// + /// public Task WithLockAsync( string key, TimeSpan timeout, @@ -77,6 +94,7 @@ namespace adas_core.Application.Services.Caching /// /// Libera el lock y registra posibles errores sin interrumpir el flujo. /// + /// private async Task SafeReleaseAsync(string key) { try diff --git a/adas-core.Application/Services/Caching/NoCacheService.cs b/adas-core.Application/Services/Caching/NoCacheService.cs index 026412cb..55b0ec58 100644 --- a/adas-core.Application/Services/Caching/NoCacheService.cs +++ b/adas-core.Application/Services/Caching/NoCacheService.cs @@ -9,6 +9,7 @@ namespace adas_core.Application.Services.Caching /// No almacena nada, no devuelve nada y no interfiere con el flujo. /// Se usa cuando el CacheMode es "None". /// + /// public class NoCacheService : ICacheService { /// @@ -16,6 +17,7 @@ namespace adas_core.Application.Services.Caching /// /// The identifier used to reference the value. /// The value intended to be associated with the key. + /// public void SetValue(string key, string value) { // No hacer nada @@ -27,6 +29,8 @@ namespace adas_core.Application.Services.Caching /// /// The key used to look up the associated value. /// The value associated with , or null if no value is found. + /// public string? GetValue(string key) { return null; @@ -38,6 +42,7 @@ namespace adas_core.Application.Services.Caching /// The identifier of the object to retrieve. /// Indicates whether the expiration of the entry should be updated upon retrieval. /// A that represents the asynchronous retrieval, containing the object associated with the key or the default value of if not found. + /// public Task GetObjectAsync(string key, bool updateExpiration = true) { return Task.FromResult(default); @@ -50,6 +55,7 @@ namespace adas_core.Application.Services.Caching /// The unique identifier used to store and later retrieve the object. /// The object to store in the data store. /// Indicates whether the expiration time of the cached entry should be updated. Defaults to true. + /// public Task SetObjectAsync(string key, T obj, bool updateExpiration = true) { return Task.CompletedTask; @@ -63,6 +69,7 @@ namespace adas_core.Application.Services.Caching /// An optional time-to-live value that, when provided, overrides the default expiration for the entry. /// Indicates whether the expiration of the entry should be refreshed upon a successful retrieval. /// A that represents the asynchronous operation, containing the retrieved object or null if no value is found. + /// public Task GetObjectAsync(string key, TimeSpan? ttlOverride, bool updateExpiration) { return Task.FromResult(default); @@ -76,6 +83,7 @@ namespace adas_core.Application.Services.Caching /// An optional time-to-live value that overrides the default expiration period; null uses the default. /// A value indicating whether the expiration time should be updated. /// A task that represents the asynchronous set operation. + /// public Task SetObjectAsync(string key, T obj, TimeSpan? ttlOverride, bool updateExpiration) { return Task.CompletedTask; @@ -87,6 +95,7 @@ namespace adas_core.Application.Services.Caching /// /// The pattern used to identify the items to delete. /// A representing the asynchronous operation, with a result of 0 indicating that no items were deleted. + /// public Task DeleteByPatternAsync(string pattern) { return Task.FromResult(0L); @@ -98,6 +107,7 @@ namespace adas_core.Application.Services.Caching /// /// The identifier of the object to delete. /// A that represents the asynchronous delete operation. + /// public Task DeleteObjectAsync(string key) { return Task.CompletedTask; @@ -106,6 +116,7 @@ namespace adas_core.Application.Services.Caching /// /// Performs a cleanup operation on the cache. Currently, this method has no implementation and does not perform any cleanup actions. /// + /// public void CleanCache() { // Nada que limpiar @@ -142,6 +153,7 @@ namespace adas_core.Application.Services.Caching /// The asynchronous function used to load the value. /// An optional time-to-live duration for the value. /// A task that represents the asynchronous operation, containing the loaded value as a nullable string. + /// public async Task GetOrSetValueAsync( string key, Func> loader, diff --git a/adas-core.Application/Services/Caching/RedisLockProvider.cs b/adas-core.Application/Services/Caching/RedisLockProvider.cs index 4f857a13..0553381d 100644 --- a/adas-core.Application/Services/Caching/RedisLockProvider.cs +++ b/adas-core.Application/Services/Caching/RedisLockProvider.cs @@ -8,6 +8,7 @@ namespace adas_core.Application.Services.Caching /// Lock distribuido en Redis. Usa token por adquisición (owner) /// y liberación segura con script Lua: borra la key solo si el valor coincide. /// + /// public class RedisLockProvider(Func getDatabase) : ILockProvider { private readonly string _prefix = "lock:"; @@ -31,6 +32,7 @@ namespace adas_core.Application.Services.Caching /// The identifier of the resource to lock. /// The maximum duration to keep retrying before giving up. /// true if the lock was successfully acquired; otherwise, false. + /// public async Task AcquireAsync(string key, TimeSpan timeout) { var redis = getDatabase(); @@ -58,6 +60,7 @@ namespace adas_core.Application.Services.Caching /// Asynchronously releases the token associated with the specified key by removing it from the in-memory token store and executing a Lua release script against Redis. If the key is not found in the local store, or the Redis database is unavailable, the method returns without performing any further action. /// /// The identifier of the token to release. + /// public async Task ReleaseAsync(string key) { if (!_tokens.TryRemove(key, out var token)) diff --git a/adas-core.Application/Services/Caching/RedisService.cs b/adas-core.Application/Services/Caching/RedisService.cs index b7f91f4f..263a4bed 100644 --- a/adas-core.Application/Services/Caching/RedisService.cs +++ b/adas-core.Application/Services/Caching/RedisService.cs @@ -16,6 +16,7 @@ namespace adas_core.Application.Services.Caching /// /// Represents a Redis-based implementation of the interface for caching operations. /// + /// public class RedisService : ICacheService { private readonly ILogger _logger; @@ -59,6 +60,7 @@ namespace adas_core.Application.Services.Caching /// Optional time-to-live duration for the cached object. If null, the cache default is used. /// The token used to cancel the asynchronous operation. /// A task that represents the asynchronous operation, containing the cached or newly created object. + /// public async Task GetOrSetObjectAsync( string key, Func> factory, @@ -100,6 +102,8 @@ namespace adas_core.Application.Services.Caching /// The asynchronous function invoked to produce the value when it is not present in the cache. /// Optional time-to-live applied to the cached value; if not provided, the default caching policy is used. /// The cached value when available, or the value produced by the loader when the cache is empty or Redis is unavailable. + /// public async Task GetOrSetValueAsync( string key, Func> loader, @@ -136,6 +140,7 @@ namespace adas_core.Application.Services.Caching /// The grouped field whose name is used to identify the observation group. /// The identifier of the patient the observation belongs to. /// A formatted string key combining the GroupedObs prefix, the patient identifier, and the grouped field name. + /// private static string BuildGroupedKey(GroupedField gf, ObjectId patientId) => $"GroupedObs:{patientId}:{gf.Name}"; @@ -148,6 +153,7 @@ namespace adas_core.Application.Services.Caching /// Optional time-to-live applied to the stored cache entry. If null, no expiration is set. /// Token used to cancel the distributed lock operation. /// The cached object if present, otherwise the object produced by . + /// public async Task GetOrSetObjectAsync( GroupedField groupedField, ObjectId patientId, @@ -190,6 +196,7 @@ namespace adas_core.Application.Services.Caching /// /// The key under which the value will be stored. /// The string value to persist. + /// public void SetValue(string key, string value) => _database?.StringSet(key, value, GetEntityTtl(key), true); @@ -198,6 +205,7 @@ namespace adas_core.Application.Services.Caching /// /// The identifier of the value to look up in the data store. /// The stored string value, or null if the key does not exist or the data store is unavailable. + /// public string? GetValue(string key) { var val = _database?.StringGet(key); @@ -214,6 +222,7 @@ namespace adas_core.Application.Services.Caching /// When true (the default), resets the key's time-to-live to the configured entity TTL on a successful read, implementing sliding expiration. /// A containing the deserialized object, or default if Redis is unavailable or the key is missing/empty. /// Thrown when the stored JSON payload cannot be deserialized into ; the original exception is wrapped and rethrown. + /// public async Task GetObjectAsync(string key, bool updateExpiration = true) { if (!_isRedisAvailable) @@ -248,6 +257,7 @@ namespace adas_core.Application.Services.Caching /// The key under which the object will be stored. /// The object to store. /// Indicates whether the expiration time of the entry should be updated. + /// public async Task SetObjectAsync( string key, T obj, @@ -261,6 +271,7 @@ namespace adas_core.Application.Services.Caching /// The object to serialize and persist to Redis. /// An optional time-to-live override; when null, the entity's default TTL is applied. /// Flag indicating whether the expiration should be updated. + /// public async Task SetObjectAsync( string key, T obj, @@ -283,6 +294,7 @@ namespace adas_core.Application.Services.Caching /// When the Redis backend is unavailable, the call is skipped silently as a no-op fallback. /// /// The unique identifier of the cached object to remove. + /// public async Task DeleteObjectAsync(string key) { if (_isRedisAvailable) @@ -295,6 +307,7 @@ namespace adas_core.Application.Services.Caching /// /// The pattern used to match Redis keys to be deleted. /// The number of keys that were deleted. + /// public async Task DeleteByPatternAsync(string pattern) { if (!_isRedisAvailable || _server == null) @@ -311,6 +324,7 @@ namespace adas_core.Application.Services.Caching /// /// Clears all cached data by flushing the underlying server database. If the server instance is , the call is safely skipped as a no-op. /// + /// public void CleanCache() => _server?.FlushDatabase(); @@ -321,6 +335,7 @@ namespace adas_core.Application.Services.Caching /// /// The cache key used to classify the entity type and determine the applicable TTL. /// A representing the configured TTL, or null if the resolved seconds value is not positive. + /// private TimeSpan? GetEntityTtl(string key) { var entity = CacheKeyClassifier.Classify(key); @@ -341,6 +356,7 @@ namespace adas_core.Application.Services.Caching /// /// The key identifying the entity whose TTL presence is being checked. /// true if a TTL value is found for the specified key; otherwise, false. + /// private bool ShouldRenewTtl(string key) => GetEntityTtl(key) != null; @@ -349,6 +365,7 @@ namespace adas_core.Application.Services.Caching /// /// Initializes the Redis connection for caching by connecting asynchronously, obtaining the database and server, and marking the connection as available on success. Returns early without establishing a connection when the configured Redis connection string is null, and logs any exception that occurs during initialization without rethrowing, leaving the connection marked as unavailable. /// + /// private async Task InitializeRedisConnectionAsync() { _isRedisAvailable = false; @@ -377,6 +394,7 @@ namespace adas_core.Application.Services.Caching /// An optional time-to-live override; not applied by this overload. /// When true, the expiration of the cached entry is refreshed on retrieval. /// A task that resolves to the cached object, or null if no entry exists for the specified key. + /// public Task GetObjectAsync(string key, TimeSpan? ttlOverride, bool updateExpiration) => GetObjectAsync(key, updateExpiration); } diff --git a/adas-core.Application/Services/CalculatedObservationsService.cs b/adas-core.Application/Services/CalculatedObservationsService.cs index cb04f05f..179be900 100644 --- a/adas-core.Application/Services/CalculatedObservationsService.cs +++ b/adas-core.Application/Services/CalculatedObservationsService.cs @@ -11,6 +11,7 @@ namespace adas_core.Application.Services; /// /// Implements the contract, providing a service for working with calculated observations. /// +/// public class CalculatedObservationsService : ICalculatedObservationsService { private static ICalculatedObservations? _service; @@ -78,6 +79,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// The patient observation to map. /// When true, restricts the mapping to lookups by name only. /// The mapped , or null when the service yields no result; the input is returned unchanged when no mapping service is configured. + /// public virtual async Task Map(PatientObservation obs, bool onlyByName = false) { if (_service == null) return obs; @@ -94,6 +96,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// The patient observation alarm to be mapped. /// When true, restricts the mapping to a name-based lookup only. /// The mapped , or null if the service mapped it to null, or the original when no service is configured. + /// public virtual async Task Map(PatientObservationAlarm obs, bool onlyByName = false) { if (_service == null) return obs; @@ -110,6 +113,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// /// The pump observation to be mapped. /// A task that yields the mapped , or if no mapping service is available. + /// public virtual async Task Map(PumpObservation obs) { if (_service == null) return null; @@ -122,6 +126,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// /// The instance to be mapped. /// The mapped , the original if no service is available, or null if the service returned no result. + /// public async Task Map(PatientRecordingAlert obs) { if (_service == null) return obs; @@ -137,6 +142,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// /// The patient treatment instance to be mapped or transformed. /// A task that represents the asynchronous mapping operation, containing the mapped or null if the service returns no result. + /// public async Task Map(PatientTreatment treatment) { if (_service == null) return treatment; @@ -149,6 +155,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// /// The patient diagnosis to be mapped. /// A task that yields the mapped , or null if the underlying service returns no result. + /// public virtual async Task Map(PatientDiagnosis diagnosis) { if (_service == null) return diagnosis; @@ -162,6 +169,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// /// The list of medicines currently active for the patient. /// The unique identifier of the patient whose medicine observations are being calculated. + /// public virtual async Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { if (_service != null) await _service.CalculateMedicineObservation(activeMedicines, patientId); @@ -172,6 +180,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// If the service dependency is not initialized, the call is skipped silently as a no-op fallback. /// /// The unique identifier of the patient for whom the active bolus opiates calculation is performed. + /// public async Task CalculateBolusOpiates(ObjectId patientId) { if (_service != null) await _service.CalculateActiveBolus(patientId); @@ -183,6 +192,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// /// The unique identifier of the patient whose active treatments should be retrieved. /// A task that yields the collection of active entries for the patient, or an empty list when the service is unavailable. + /// public virtual async Task> GetActiveTreatmentsByPatient(ObjectId id) { if (_service != null) return await _service.GetActiveTreatmentsByPatient(id); @@ -194,6 +204,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// /// The list of patient observations to be mapped. /// A task containing the mapped list of patient observations, or an empty list if no service is configured. + /// public virtual async Task> MapList(List listToInsert) { if (_service != null) return await _service.PreMapList(listToInsert); @@ -206,6 +217,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService /// The patient observation onto which the source alarm will be mapped. /// The source alarm to be applied to the observation. /// The produced by the service mapping, or the original when no service is configured. + /// public virtual async Task MapSourceAlarm(PatientObservation observation, PatientObservationAlarm observationAlarm) { diff --git a/adas-core.Application/Services/CameraService.cs b/adas-core.Application/Services/CameraService.cs index 244dd1f0..a1e3cc63 100644 --- a/adas-core.Application/Services/CameraService.cs +++ b/adas-core.Application/Services/CameraService.cs @@ -15,6 +15,7 @@ namespace adas_core.Application.Services; /// /// This service implements and serves as the application-layer entry point for camera functionality. /// +/// public class CameraService(ILogger logger, ICameraRepository cameraRepository, IPointOfCareService pointOfCareService) : ICameraService { private ICameraRepository _cameraRepository = cameraRepository; @@ -24,6 +25,7 @@ public class CameraService(ILogger logger, ICameraRepository came /// /// The unique identifier of the relay used to look up the camera. /// A task that represents the asynchronous operation. The task result contains the matching , or null if no camera is found. + /// public Task GetById(ObjectId relayId) { return _cameraRepository.GetById(relayId); @@ -33,6 +35,7 @@ public class CameraService(ILogger logger, ICameraRepository came /// /// The list of configuration relay identifiers used to look up the corresponding cameras. /// A containing the cameras linked to the provided configuration relay identifiers. + /// public List GetCameraInList(List configurationRelayList) { return _cameraRepository.GetCameraInList(configurationRelayList); @@ -43,6 +46,7 @@ public class CameraService(ILogger logger, ICameraRepository came /// /// The pagination filter that controls page number, page size, and optional filtering criteria such as the in-use flag. /// A paginated response containing the requested cameras, the current page metadata, and the total document count; if no data is found, an empty paginated response is returned. + /// public async Task> GetPaginatedCameras(PaginationFilter filter) { var usedCameraIds = await pointOfCareService.FindAllIdCamerasInUse(); @@ -91,6 +95,7 @@ public class CameraService(ILogger logger, ICameraRepository came /// The inserted camera, or null if the insertion did not return a result. /// Thrown when the camera name is null. /// Thrown when a camera with the same name already exists. + /// public async Task InsertCamera(Camera camera) { if (camera.Name == null) throw new Exception("Camera name cannot be null"); @@ -105,6 +110,7 @@ public class CameraService(ILogger logger, ICameraRepository came /// The unique identifier of the camera to update. /// The camera data containing the updated values. /// A task that represents the asynchronous operation. The task result contains the updated , or null if no camera with the specified identifier was found. + /// public async Task UpdateCameraById(ObjectId objectId, Camera camera) { return await _cameraRepository.UpdateCameraAsync(objectId, camera); @@ -115,6 +121,7 @@ public class CameraService(ILogger logger, ICameraRepository came /// /// The unique identifier of the camera to delete. /// true if the camera was successfully deleted; otherwise, false. + /// public async Task DeleteCamera(ObjectId objectId) { try @@ -138,6 +145,7 @@ public class CameraService(ILogger logger, ICameraRepository came /// /// The search text used to find cameras by name. /// A task that represents the asynchronous operation, containing a list of objects that match the search criteria. + /// public async Task> GetSearchByNameCameras(string textToSearch) { return await _cameraRepository.GetSearchByNameCameras(textToSearch); diff --git a/adas-core.Application/Services/ConfigObservationService.cs b/adas-core.Application/Services/ConfigObservationService.cs index 2721fe1c..cd0cbc3c 100644 --- a/adas-core.Application/Services/ConfigObservationService.cs +++ b/adas-core.Application/Services/ConfigObservationService.cs @@ -27,6 +27,7 @@ namespace adas_core.Application.Services; /// /// Acts as the default service type that fulfills the configuration observation interface. /// +/// public class ConfigObservationService : IConfigObservationService { private static readonly ConcurrentDictionary CachedConfigObservations = new(); @@ -96,6 +97,7 @@ public class ConfigObservationService : IConfigObservationService /// /// A token to monitor for cancellation requests. /// A collection of all entries, sourced from cache when available or from the repository otherwise. + /// public async Task> GetAllConfigs(CancellationToken ct = default) { @@ -115,6 +117,7 @@ public class ConfigObservationService : IConfigObservationService /// Retrieves a compact representation of all configuration observations by returning the total item count. /// /// A containing the total number of configuration observations. + /// public async Task GetAllCompact() { var count = await _configObservationRepository.Count(); @@ -126,6 +129,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The pagination filter containing the requested page number and page size used to retrieve the items and populate the response metadata. /// A containing the items for the requested page and the total count of all available items. + /// public async Task> GetPaginatedItems(PaginationFilter filter) { var result = await _configObservationRepository.GetPaginatedItems(filter); @@ -141,6 +145,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The unique identifier of the configuration observation to retrieve. /// The configuration observation matching the specified identifier, or null if not found. + /// public async Task GetConfigById(ObjectId id) { return await _configObservationRepository.FindById(id) ?? null; @@ -151,6 +156,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The identifier used to look up the related configuration names. /// A task that represents the asynchronous operation, containing the list of configuration names matching the given identifier. + /// public async Task> GetConfigNames(string id) { return await _configObservationRepository.GetConfigNames(id); @@ -160,6 +166,7 @@ public class ConfigObservationService : IConfigObservationService /// Retrieves the list of configuration names from the configuration observation repository. /// /// A task that represents the asynchronous operation. The task result contains a list of configuration names. + /// public async Task> GetConfigNames() { return await _configObservationRepository.GetConfigNames(); @@ -172,6 +179,8 @@ public class ConfigObservationService : IConfigObservationService /// The patient observation type, constrained to . /// The patient observation for which the retention action is being evaluated. /// A task containing the resolved , or null when no configuration is available. + /// public async Task RetentionActions(T obs) where T : BasePatientObservation { var conf = await Get(obs); @@ -192,6 +201,7 @@ public class ConfigObservationService : IConfigObservationService /// The optional minimum reference value included in the mapping. /// The optional maximum reference value included in the mapping. /// A task that resolves to the computed from the mapped observation, or when no applicable configuration or mapping status is found. + /// public async Task GroupedObservationStatus(GroupedField groupedField, GroupedObservationEnum.Result result, string name, object value, double? min, double? max) @@ -228,6 +238,7 @@ public class ConfigObservationService : IConfigObservationService /// The patient observation to be mapped. /// If true, the configuration lookup is performed by name only; otherwise the full lookup is used. /// The mapped observation, the original observation when unknown observations are allowed, or null when mapping is ignored or the configuration is invalid. + /// public async Task Map(T obs, bool onlyByName = false) where T : BasePatientObservation { var conf = onlyByName ? await Get(obs, onlyByName) : await Get(obs); @@ -253,6 +264,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The unique identifier of the configuration observation to remove. /// The removed if it was found and deleted; otherwise, null. + /// public async Task RemoveConfigItem(ObjectId id) { var item = await _configObservationRepository.FindById(id); @@ -272,6 +284,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The patient treatment whose requested give codes are resolved against the configuration store. /// The original if a valid configuration is found, or null when the treatment should be discarded. + /// public async Task Map(PatientTreatment treatment) { ConfigObservation? conf = null; @@ -292,6 +305,7 @@ public class ConfigObservationService : IConfigObservationService /// The patient observation whose matching configuration should be resolved. /// When true, the lookup is restricted to matching by only; otherwise matching also considers code, coding system, and parent observation data. /// A containing the matched processed via Process, or null if no configuration items are available or no match is found. + /// public async Task Get(T obs, bool onlyByName = false) where T : BasePatientObservation { @@ -369,6 +383,7 @@ public class ConfigObservationService : IConfigObservationService /// The coding system identifier used to filter the observation. May be . /// The code value used to filter the observation. May be . /// A processed if a match is found; otherwise, . + /// public async Task GetByCodeSysAndCode(string? codingSystem, string? code) { var filteredResult = await _configObservationRepository.GetByCodeSysAndCode(codingSystem, code); @@ -384,6 +399,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The name of the configuration to look up; if null or empty, the method returns null. /// A when a matching configuration is found and successfully processed; otherwise, null. + /// public async Task Get(string? name) { if (string.IsNullOrEmpty(name)) return null; @@ -406,6 +422,7 @@ public class ConfigObservationService : IConfigObservationService /// The configuration observation payload containing the identifier of the record to update. /// The updated . /// Thrown when no configuration observation exists for the supplied id. + /// public async Task UpdateConfig(ConfigObservation configObservationItem) { // if (!configObservationItem.Id.HasValue) @@ -429,6 +446,7 @@ public class ConfigObservationService : IConfigObservationService /// The name used to look up the configuration observation items. /// A collection of items matching the specified name. /// Thrown when no configuration observation items are found for the given name. + /// public async Task?> GetConfigObservationItem(string name) { var configObservationItems = await _configObservationRepository.FindAllByName(name); @@ -448,6 +466,7 @@ public class ConfigObservationService : IConfigObservationService /// The original name of the configuration observation item. /// The matching item. /// Thrown when no matching configuration observation item is found. + /// public async Task GetSingleConfigObservationItem(string? code, string? codingSystem, string? name, string? originalName) { @@ -466,6 +485,7 @@ public class ConfigObservationService : IConfigObservationService /// The configuration observation item to delete; its identifier is used to locate the existing record. /// A task that resolves to true when the item is successfully deleted. /// Thrown when no configuration observation is found with the specified identifier, or when the underlying delete operation fails. + /// public async Task DeleteSingleConfigObservationItem(ConfigObservation configObservationItem) { var configObservation = await _configObservationRepository.FindById(configObservationItem.Id) ?? @@ -489,6 +509,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The name used to filter configuration observation items. /// A collection of items matching the specified name. + /// public async Task> GetConfigObservationItemsByName(string name) { return await _configObservationRepository.FindAllByName(name); @@ -500,6 +521,7 @@ public class ConfigObservationService : IConfigObservationService /// The configuration observation entity to persist. /// The created if the operation succeeds. /// Thrown when a configuration observation with the same identifier already exists. + /// public async Task CreateConfig(ConfigObservation configObservation) { @@ -520,6 +542,7 @@ public class ConfigObservationService : IConfigObservationService /// The name of the configuration item to remove. /// The removed , or null if the repository did not return a result. /// Thrown when no configuration item is found with the specified name. + /// public async Task RemoveConfigItem(string itemName) { var configObservation = await GetConfigByName(itemName) ?? @@ -543,6 +566,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The unique identifier of the configuration observation to retrieve. /// The configuration observation obtained from cache or repository, or a new empty instance when no matching record exists. + /// public async Task GetConfig(ObjectId configObservationId) { RefreshCachedConfigObservations(); @@ -570,6 +594,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The case-insensitive name of the configuration observation to look up. /// The matching , or null if not found or the name is invalid. + /// public async Task GetConfigByName(string name) { if (string.IsNullOrWhiteSpace(name)) return null; @@ -602,6 +627,7 @@ public class ConfigObservationService : IConfigObservationService /// Removes expired entries from the cached configuration observations when a refresh timeout is configured, /// performing an early return if no refresh timeout is set. /// + /// private void RefreshCachedConfigObservations() { if (!_refreshTimeout.HasValue) return; @@ -620,6 +646,7 @@ public class ConfigObservationService : IConfigObservationService /// /// The configuration observation to process. Its retention policy and retention policy value are updated in place. /// A task containing the processed . + /// private Task Process(ConfigObservation confItem) { confItem.RetentionPolicy ??= _defaultRetentionPolicy; @@ -641,6 +668,7 @@ public class ConfigObservationService : IConfigObservationService /// If no refresh timeout is set, the method returns without performing any cleanup. /// Any exceptions encountered during the cleanup are caught and logged. /// + /// private void RefreshCachedConfigObservationKeys() { try @@ -670,6 +698,7 @@ public class ConfigObservationService : IConfigObservationService /// The observation instance to enrich with configuration values. Modified in place. /// The configuration observation providing thresholds, colors, expiration, and other settings to apply. /// The mapped observation, returned as-is when the observation's coding system is configured to skip status calculation. + /// private async Task MapConf(T obs, ConfigObservation conf) where T : BasePatientObservation { _logger.LogTrace("Mapping observation: {obs}", obs); @@ -819,6 +848,7 @@ public class ConfigObservationService : IConfigObservationService /// /// This type is intended to be used internally to store and reuse configuration observation results. /// + /// private class ConfigObservationCached { public DateTime NextRefresh { get; set; } @@ -828,6 +858,7 @@ public class ConfigObservationService : IConfigObservationService /// /// Represents a private cache entry for configuration observation keys, used to store and retrieve previously computed key values associated with configuration observations. /// + /// private class ConfigObservationKeyCached { public DateTime NextRefresh { get; set; } diff --git a/adas-core.Application/Services/ConfigPumpsService.cs b/adas-core.Application/Services/ConfigPumpsService.cs index a6dd56d1..62ef8a72 100644 --- a/adas-core.Application/Services/ConfigPumpsService.cs +++ b/adas-core.Application/Services/ConfigPumpsService.cs @@ -40,6 +40,7 @@ public class ConfigPumpsService( /// /// The pump observation to map, containing the alarm type used for configuration lookup. /// The mapped pump observation, or the original observation when mapping is skipped or the configuration lookup yields no result. + /// public async Task Map(PumpObservation obs) { if (!_configPumpsRequired) return obs; @@ -57,6 +58,7 @@ public class ConfigPumpsService( /// Retrieves all available pump configurations from the underlying repository. /// /// A task that represents the asynchronous operation, containing a list of if any are available, or null when no configurations exist. + /// public async Task?> GetAllPumpConfigs() { return await configPumpsRepository.GetAllConfigs(); @@ -68,6 +70,7 @@ public class ConfigPumpsService( /// /// The unique identifier of the pump configuration to retrieve. /// A instance if a matching configuration is found; otherwise, null. + /// public async Task GetPumpConfigById(string id) { return await configPumpsRepository.FindById(id); @@ -78,6 +81,7 @@ public class ConfigPumpsService( /// /// The unique identifier of the config pump to look up. /// A task that resolves to the list of entries, or null if the config pump does not exist. + /// public async Task?> GetConfigItems(string id) { var result = await configPumpsRepository.FindById(id); @@ -91,6 +95,7 @@ public class ConfigPumpsService( /// The pump configuration to update, identified by its . /// A task representing the asynchronous operation, containing the updated . /// Thrown when the update operation fails. + /// public async Task UpdatePumpConfig(ConfigPumps pumpConfig) { var oldPumpConfig = configPumpsRepository.FindById(pumpConfig.Id); @@ -106,6 +111,8 @@ public class ConfigPumpsService( /// The pump configuration to insert. /// The inserted on success; otherwise, null when an error occurs during the operation. /// Thrown when the inserted configuration cannot be found in the repository after insertion. + /// public async Task InsertPumpConfig(ConfigPumps pumpConfig) { try @@ -128,6 +135,7 @@ public class ConfigPumpsService( /// /// The instance representing the pump configuration to delete. /// A task that resolves to true when the configuration is deleted and the audit log is recorded; false when the delete operation fails or an exception occurs. + /// public async Task DeletePumpConfig(ConfigPumps config) { try @@ -156,6 +164,7 @@ public class ConfigPumpsService( /// /// The pump observation for which to evaluate the retention policy. /// A task containing the retention result with the applicable policy and associated value, or a default NoDelete result when no policy is configured. + /// public async Task RetentionActions(PumpObservation obs) { //TODO sacarlo de la configuración específica de Bombas @@ -171,6 +180,7 @@ public class ConfigPumpsService( /// The pump observation that will receive the UI configuration. /// The configuration source whose UI configuration is applied to when present. /// A completed containing the updated observation. + /// private static Task MapConf(PumpObservation obs, ConfigPumpItem conf) { if (conf.UiConfiguration != null && conf.UiConfiguration.Count != 0) @@ -184,6 +194,7 @@ public class ConfigPumpsService( /// /// The string representation of the alarm type to look up; if it cannot be parsed into a valid , the method returns null. /// A whose AlarmType matches the parsed value, or null if parsing fails or no matching item is found. + /// private async Task Get(string alarmType) { if (!Enum.TryParse(alarmType, out PumpEnum.AlarmType alarmTypeParsed)) @@ -198,6 +209,7 @@ public class ConfigPumpsService( /// /// The pump observation whose MessageType is used to locate the corresponding configuration entry. /// A matching the observation's message type, or null if the configuration is unavailable or no matching item exists. + /// private async Task Get(PumpObservation pobs) { var config = await GetConfig(); @@ -208,6 +220,7 @@ public class ConfigPumpsService( /// Returns a null list if the underlying configuration is not available. /// /// A task containing a list of objects, or null if the configuration could not be retrieved. + /// public async Task?> Get() { var result = await GetConfig(); @@ -220,6 +233,7 @@ public class ConfigPumpsService( /// Falls back to fetching from the repository when the cache is missing or stale, and returns null if an error occurs during retrieval. /// /// A task containing the instance if available; otherwise, null when the repository lookup fails. + /// private async Task GetConfig() { try diff --git a/adas-core.Application/Services/ConfigUnitsService.cs b/adas-core.Application/Services/ConfigUnitsService.cs index 36330d0b..e10e91f6 100644 --- a/adas-core.Application/Services/ConfigUnitsService.cs +++ b/adas-core.Application/Services/ConfigUnitsService.cs @@ -37,6 +37,7 @@ public class ConfigUnitsService( /// /// The patient observation to be mapped. /// The mapped observation when a matching unit configuration is resolved; otherwise, the original observation. + /// public async Task Map(T obs) where T : BasePatientObservation { if (!_configUnitsRequired) return obs; @@ -52,6 +53,7 @@ public class ConfigUnitsService( /// /// The to be mapped. /// The mapped , returned as-is when units configuration is not required or after pump value mapping otherwise. + /// public async Task Map(PumpObservation obs) { if (!_configUnitsRequired) return obs; @@ -68,6 +70,7 @@ public class ConfigUnitsService( /// /// Recorre recursivamente las propiedades del objeto para encontrar y convertir PumpValues. /// + /// private async Task MapPumpValues(object? targetObject) { if (targetObject == null) return; @@ -106,6 +109,7 @@ public class ConfigUnitsService( /// The base patient observation to which the configured unit value will be applied. /// The configuration unit item whose Value is used as the unit to assign. /// The input observation, with Units set from when applicable, or the unchanged observation when it is not a . + /// private T MapConf(T obs, ConfigUnitItem conf) where T : BasePatientObservation { if (obs is not PatientObservation pobs) return obs; @@ -122,6 +126,7 @@ public class ConfigUnitsService( /// /// The unique code identifier of the configuration unit item to look up. /// A task that represents the asynchronous operation. The task result contains the matching , or null if the configuration is unavailable or no item is found. + /// public async Task Get(string code) { var result = await GetConfig(); @@ -138,6 +143,7 @@ public class ConfigUnitsService( /// A containing the cached or freshly fetched , or /// null if the repository lookup fails. /// + /// private async Task GetConfig() { try diff --git a/adas-core.Application/Services/DefaultCalculatedObservations.cs b/adas-core.Application/Services/DefaultCalculatedObservations.cs index 1be375d3..1d91094d 100644 --- a/adas-core.Application/Services/DefaultCalculatedObservations.cs +++ b/adas-core.Application/Services/DefaultCalculatedObservations.cs @@ -9,6 +9,7 @@ namespace adas_core.Application.Services; /// /// Provides the default implementation of the interface. /// +/// public class DefaultCalculatedObservations : ICalculatedObservations { /// @@ -16,6 +17,8 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// /// The list of medicines currently active for the patient, used as the basis for the observation calculation. /// The identifier of the patient whose medicine observations are being calculated. + /// public Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId) { return Task.CompletedTask; @@ -25,6 +28,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// Calculates the active bolus for the specified patient. /// /// The unique identifier of the patient whose active bolus is being calculated. + /// public Task CalculateActiveBolus(ObjectId patientId) { return Task.CompletedTask; @@ -36,6 +40,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// The patient observation to map. /// A flag indicating whether mapping should be performed by name only. /// A completed containing the provided observation. + /// public Task Map(T obs, bool onlyByName) where T : BasePatientObservation { return Task.FromResult(obs)!; @@ -46,6 +51,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// /// The patient treatment to map. /// A that completes with the supplied . + /// public Task Map(PatientTreatment treatment) { return Task.FromResult(treatment); @@ -57,6 +63,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// /// The unique identifier of the patient whose active treatments are being retrieved. /// A task representing the asynchronous operation, containing an enumerable collection of the patient's active treatments, or an empty collection if none are found. + /// public Task> GetActiveTreatmentsByPatient(ObjectId id) { return Task.FromResult>(new List()); @@ -67,6 +74,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// /// The patient diagnosis to map. /// A task that represents the asynchronous operation, containing the provided patient diagnosis. + /// public Task Map(PatientDiagnosis diagnosis) { return Task.FromResult(diagnosis); @@ -78,6 +86,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// The source to be mapped. /// A task that represents the asynchronous mapping operation, containing the resulting . /// Thrown when the method is invoked, as the mapping logic has not been implemented yet. + /// public Task Map(PumpObservation pumpObservation) { throw new NotImplementedException(); @@ -88,6 +97,8 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// /// The new patient observation to evaluate for time consistency with the prior observation. /// A task that represents the asynchronous operation, containing the provided patient observation. + /// public Task FixTimeInconsistencyWithLast(PatientObservation newObservation) { return Task.FromResult(newObservation); @@ -98,6 +109,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// /// The list of patient observations to be pre-mapped. /// A completed task containing the provided list of patient observations. + /// public Task> PreMapList(List listToInsert) { return Task.FromResult(listToInsert); @@ -110,6 +122,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// The patient observation to be returned by the mapping. /// The patient observation alarm intended to be associated with the observation. /// A completed containing the . + /// public Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert) { return Task.FromResult(obs); @@ -122,6 +135,8 @@ public class DefaultCalculatedObservations : ICalculatedObservations /// The name associated with the alarm being sent. /// The optional alarm code that categorizes the type of alarm; may be null when no specific code applies. /// Thrown in all cases, as the method has not been implemented yet. + /// public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code) { throw new NotImplementedException(); diff --git a/adas-core.Application/Services/DeviceService.cs b/adas-core.Application/Services/DeviceService.cs index 91c039c1..54fc05f8 100644 --- a/adas-core.Application/Services/DeviceService.cs +++ b/adas-core.Application/Services/DeviceService.cs @@ -13,6 +13,7 @@ namespace adas_core.Application.Services; /// Provides the concrete implementation of the contract, /// handling device-related service operations defined by the interface. /// +/// public class DeviceService : IDeviceService { private readonly IDeviceRepository _deviceRepository; @@ -53,6 +54,7 @@ public class DeviceService : IDeviceService /// /// The data transfer object containing the device information to convert. /// A new entity populated with the values from the supplied DTO. + /// public Device ToEntity(DeviceDto dto) { return new Device() @@ -78,6 +80,8 @@ public class DeviceService : IDeviceService /// /// The data transfer object containing the device information to be mapped and stored. /// The created entity after successful insertion, or if the device could not be created. + /// public async Task Create(DeviceDto deviceDto) { var device = ToEntity(deviceDto); @@ -93,6 +97,7 @@ public class DeviceService : IDeviceService /// /// The unique identifier of the object to delete. /// A task that resolves to true if the object was deleted; otherwise, false. + /// public async Task Delete(ObjectId objectId) { return await _deviceRepository.DeleteAsync(objectId) != null; @@ -103,6 +108,8 @@ public class DeviceService : IDeviceService /// /// The data transfer object containing the updated device information. /// The updated entity, or null if no device is returned. + /// public async Task Update(DeviceDto deviceDto) { var device = ToEntity(deviceDto); @@ -116,6 +123,7 @@ public class DeviceService : IDeviceService /// /// The data transfer object containing the device information from the event, used for lookup and creation. /// The existing or newly created associated with the event. + /// public async Task ReceiveEvent(DeviceDto deviceDto) { Device? deviceExist = null; @@ -168,6 +176,7 @@ public class DeviceService : IDeviceService /// /// The existing device whose configured action settings determine which action to execute. /// The incoming device event payload providing the click type that triggers the action. + /// private async Task ManageDeviceButton(Device deviceExist, DeviceDto deviceDto) { if (deviceExist.Settings?.Action?.Type != null && deviceDto.Event?.ClickType != null) @@ -193,6 +202,7 @@ public class DeviceService : IDeviceService /// The device action containing the configuration observation and the per-click-type alarm values to use. /// The click event that triggered the action, which determines which value from the device action is sent. /// The list of point of care identifiers whose patients should receive the alarm. + /// private async Task SendAlarmOnAction( DeviceAction settingsAction, ClickType eventClickType, @@ -256,6 +266,7 @@ public class DeviceService : IDeviceService /// The type of click event that triggered the action; selects which value (single, double, or hold) is assigned to the observation. /// The list of point of care identifiers whose resolved patients will receive the generated observation. /// A task that represents the asynchronous send operation; no meaningful business result is returned. + /// private async Task SendObservationOnAction( DeviceAction settingsAction, ClickType eventClickType, diff --git a/adas-core.Application/Services/DiagnosisService.cs b/adas-core.Application/Services/DiagnosisService.cs index f2af030d..42b72f9f 100644 --- a/adas-core.Application/Services/DiagnosisService.cs +++ b/adas-core.Application/Services/DiagnosisService.cs @@ -19,6 +19,7 @@ namespace adas_core.Application.Services; /// Provides the implementation of the contract, /// offering diagnosis-related operations as defined by the interface. /// +/// public class DiagnosisService : IDiagnosisService { private readonly ILocalAuditService _auditService; @@ -104,6 +105,7 @@ public class DiagnosisService : IDiagnosisService /// Archives the specified patient by delegating to the archival routine keyed by the patient's identifier. /// /// The patient to be archived. Its Id is used to locate the record to archive. + /// public async Task Archive(Patient patient) { await ArchiveByPatientId(patient.Id); @@ -113,6 +115,7 @@ public class DiagnosisService : IDiagnosisService /// Archives all diagnoses associated with the specified patient by copying them to the diagnosis archive repository and then deleting the original records. /// /// The identifier of the patient whose diagnoses will be archived. + /// public async Task ArchiveByPatientId(ObjectId id) { _logger.LogDebug("Archive Diagnoses by Patient Id {id}", id); @@ -130,6 +133,7 @@ public class DiagnosisService : IDiagnosisService /// Deletes all diagnoses associated with the specified patient identifier and records an audit log entry capturing the previous state of the records. /// /// The unique identifier of the patient whose diagnoses should be deleted. + /// public async Task DeleteByPatientId(ObjectId id) { _logger.LogDebug("Delete Diagnoses by Patient Id {id}", id); @@ -143,6 +147,7 @@ public class DiagnosisService : IDiagnosisService /// /// The unique identifier of the patient whose diagnoses are being retrieved. /// A task that represents the asynchronous operation, containing a list of records for the given patient. + /// public async Task> GetByPatientId(ObjectId patientId) { var diagnosis = await _diagnosisRepository.GetByPatient(patientId); @@ -156,6 +161,7 @@ public class DiagnosisService : IDiagnosisService /// /// The API request to save. /// A task that represents the asynchronous save operation. + /// public Task SaveRequest(ApiRequest apiRequest) { return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest, null); })); @@ -166,6 +172,7 @@ public class DiagnosisService : IDiagnosisService /// /// The API request instance to persist. /// A task that represents the asynchronous save operation. + /// public Task SaveRequestAsync(ApiRequest apiRequest) { return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest, null); })); @@ -177,6 +184,7 @@ public class DiagnosisService : IDiagnosisService /// The API request containing the observation codes, values, message time, and optional observation time used to build the diagnosis. /// The patient associated with the diagnosis, whose identifier is assigned to the new . /// A task that represents the asynchronous insertion of the resulting . + /// public async Task ProcessDiagnosisObservation(ApiRequest apiRequest, Patient patient) { _logger.LogDebug("INSERT DiagnosisObservation from obsservation"); @@ -248,6 +256,7 @@ public class DiagnosisService : IDiagnosisService /// The API request containing the type, patient identifiers, location, and observation data to be processed. /// An optional pre-resolved patient; when null, the patient is resolved via the patient service using the request data. /// Thrown when both the patient number and the location unit name are missing from the request, or when the request type is not valid for diagnosis processing. + /// public async Task SaveRequest(ApiRequest apiRequest, Patient? patient) { if (patient == null) @@ -319,6 +328,7 @@ public class DiagnosisService : IDiagnosisService /// The list of patient diagnoses to be processed and inserted. /// The patient whose identifier is assigned to each diagnosis entry. /// The timestamp assigned to each diagnosis entry during processing. + /// public async Task ProcessDiagnosis(List diagnosis, Patient patient, DateTime messageTime) { _logger.LogDebug("INSERT DiagnosisObservation from diagnosis"); @@ -337,6 +347,7 @@ public class DiagnosisService : IDiagnosisService /// The name of the identifier field used to locate the records to update. /// The new ObjectId to assign to the matching records. /// The existing ObjectId to be replaced in the matching records. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await _diagnosisRepository.UpdateManyObjectId(nameId, id, oldId); @@ -347,6 +358,7 @@ public class DiagnosisService : IDiagnosisService /// /// The unique identifier of the patient whose diagnoses are being requested. /// A task that represents the asynchronous operation, containing a list of records for the given patient. + /// public async Task> GetByPatient(ObjectId id) { return await _diagnosisRepository.GetByPatient(id); @@ -357,6 +369,7 @@ public class DiagnosisService : IDiagnosisService /// If the diagnosis cannot be mapped (returns null), the insert and broadcast operations are skipped. /// /// The patient diagnosis to insert. + /// public async Task Insert(PatientDiagnosis diagnosis) { _logger.LogDebug("Insert {diagnosis}", diagnosis); @@ -374,6 +387,7 @@ public class DiagnosisService : IDiagnosisService /// /// The patient diagnosis to be mapped. /// The mapped produced by the calculated observations mapper, or if the diagnosis was ignored. + /// private async Task MapDiagnosis(PatientDiagnosis diagnosis) { var diagnosis2 = await _calculatedObservations.Value.Map(diagnosis); @@ -386,6 +400,7 @@ public class DiagnosisService : IDiagnosisService /// Sends a patient diagnosis broadcast to all subscribers whose registered location matches the patient's location (unit, room, and bed). Returns early without broadcasting if the patient cannot be found. /// /// The patient diagnosis payload to broadcast to the matching subscribers. + /// private async Task SendBroadcast(PatientDiagnosis diagnosis) { var patient = await _patientService.Value.FindById(diagnosis.PatientId); @@ -412,6 +427,7 @@ public class DiagnosisService : IDiagnosisService /// /// The unique identifier of the patient whose diagnosis records are to be retrieved. /// A task that represents the asynchronous operation, containing an asynchronous cursor over the matching records. + /// public Task> FindByPatientIdAsync(ObjectId patientId) { return _diagnosisRepository.FindByPatientIdAsync(patientId); @@ -424,6 +440,7 @@ public class DiagnosisService : IDiagnosisService /// A broadcast is dispatched asynchronously after a successful insert or update. /// /// The patient diagnosis to persist. + /// public async Task InsertDiagnosis(PatientDiagnosis diagnosis) { try diff --git a/adas-core.Application/Services/DischargeService.cs b/adas-core.Application/Services/DischargeService.cs index 2f2893df..0542a2f1 100644 --- a/adas-core.Application/Services/DischargeService.cs +++ b/adas-core.Application/Services/DischargeService.cs @@ -22,6 +22,7 @@ namespace adas_core.Application.Services; /// This service acts as the default in-memory or infrastructure-backed implementation /// of the discharge operations defined by . /// +/// public class DischargeService : IDischargeService { private readonly ILocalAuditService _auditService; @@ -80,6 +81,10 @@ public class DischargeService : IDischargeService /// discharge status), and otherwise falls back to deleting the discharge by its identifier. /// /// The discharge entity to be deleted. + /// + /// public async Task DeleteDischargeAsync(Discharge discharge) { //var patient = await _patientServiceLazy.Value.FindById(discharge.PatientId); @@ -97,6 +102,7 @@ public class DischargeService : IDischargeService /// Deletes a discharge record by its identifier. If the discharge is not found, an error is logged and the operation is skipped; otherwise the record is removed, an audit log entry is created, and a delete broadcast is sent. /// /// The unique identifier of the discharge to delete. + /// public async Task DeleteDischargeByIdAsync(ObjectId dischargeId) { try @@ -132,6 +138,7 @@ public class DischargeService : IDischargeService /// /// The identifier of the unit whose discharge records will be counted. /// A task representing the asynchronous operation, containing the total number of discharges for the given unit. + /// public async Task CountDischargesByUnitId(ObjectId unitId) { return await _dischargeRepository.CountByUnitId(unitId); @@ -146,6 +153,7 @@ public class DischargeService : IDischargeService /// information if a point of care is linked; otherwise the discharge as stored. /// Thrown when no discharge is found for the specified /// . + /// public async Task GetDischargeByIdAsync(ObjectId dischargeId) { var result = await _dischargeRepository.FindById(dischargeId) ?? @@ -163,6 +171,7 @@ public class DischargeService : IDischargeService /// Asynchronously retrieves all discharge records from the repository. /// /// A task that represents the asynchronous operation, containing an enumerable collection of records. + /// public async Task> GetDischargesAsync() { return await _dischargeRepository.FindAll(); @@ -173,6 +182,7 @@ public class DischargeService : IDischargeService /// /// The unique identifier of the patient whose discharge record should be retrieved. /// A object populated with patient location information when a point of care is associated, or null if no discharge is found or an error occurs. + /// public async Task GetDischargeByPatientId(ObjectId patientId) { try @@ -202,6 +212,7 @@ public class DischargeService : IDischargeService /// The discharge entity to be inserted. /// The persisted entity retrieved from the repository after insertion. /// Thrown when the inserted discharge cannot be found by its identifier, indicating that the creation failed. + /// public async Task InsertDischarge(Discharge discharge) { await _dischargeRepository.InsertOneAsync(discharge); @@ -220,6 +231,7 @@ public class DischargeService : IDischargeService /// /// The patient location used to look up the associated discharge record. /// A if one is found for the given location; otherwise, null when an error occurs. + /// public async Task GetDischargeByLocation(PatientLocation location) { try @@ -240,6 +252,7 @@ public class DischargeService : IDischargeService /// /// The point of care identifier used to look up the discharge record. /// A with the patient location populated when available, or null if the discharge is not found or an error occurs. + /// public async Task GetDischargeByPointOfCareId(ObjectId poc) { try @@ -269,6 +282,7 @@ public class DischargeService : IDischargeService /// The ObjectId identifying the point of care (location) whose discharge record should be retrieved. /// The locale used to localize the discharge data when the associated unit is found. /// A containing the localized discharge, the unmodified discharge when its unit cannot be found, or null when no discharge exists for the specified location. + /// public async Task GetDischargeByPointOfCareIdWithLocale(ObjectId location, LocaleEnum dataLocale) { var discharge = await GetDischargeByPointOfCareId(location); @@ -284,6 +298,7 @@ public class DischargeService : IDischargeService /// /// The discharge entity to be updated. /// Thrown when no discharge is found with the specified identifier, preventing the update from proceeding. + /// public async Task UpdateDischargeAsync(Discharge discharge) { var oldDischarge = await GetDischargeByIdAsync(discharge.Id) ?? @@ -300,6 +315,10 @@ public class DischargeService : IDischargeService /// /// The API request containing the discharge payload and the operation type to perform. /// + /// + /// public async Task SaveRequest(ApiRequest apiRequest) { try @@ -367,6 +386,7 @@ public class DischargeService : IDischargeService /// /// The API request to save. /// A task that completes when the request has been saved. + /// public Task SaveRequestAsync(ApiRequest apiRequest) { return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); })); @@ -378,6 +398,7 @@ public class DischargeService : IDischargeService /// /// The discharge whose point of care is used to locate matching subscribers and whose data is sent in the broadcast. /// The operation type associated with the outgoing message sent to each subscriber. + /// public async void SendDischargeBroadcast(Discharge discharge, OperationType operation) { try @@ -419,6 +440,7 @@ public class DischargeService : IDischargeService /// The master list update options to apply to the discharges. /// The collection of units whose associated discharges will be updated. /// The name of the master list type used to target the update. + /// public async Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable unitList, string typeName) { @@ -440,6 +462,8 @@ public class DischargeService : IDischargeService /// The option list entry to be removed from the patient master list. /// The collection of units whose identifiers are used to scope the deletion. /// The name of the master list type/category to which the option belongs. + /// public async Task DeletePatientMasterListItem(OptionList opt, IEnumerable unitList, string typeName) { var unitIds = unitList.Select(x => x.Id).ToList(); @@ -457,6 +481,7 @@ public class DischargeService : IDischargeService /// Asynchronously deletes all discharge records associated with the specified unit identifier by delegating the operation to the discharge repository. /// /// The unique identifier of the unit whose discharge records should be removed. + /// public async Task DeleteDischargesByUnitId(ObjectId unitId) { await _dischargeRepository.DeleteByUnitId(unitId); @@ -471,6 +496,7 @@ public class DischargeService : IDischargeService /// Discharge instance whose option names may be translated in place. /// Target locale used to load the appropriate master list; when set to , the discharge is returned without changes. /// The same instance, with translated option names when a matching locale-specific entry is found. + /// private async Task GetDischargeWithLocale(Unit? unit, Discharge discharge, LocaleEnum locale) { if (unit == null) diff --git a/adas-core.Application/Services/DisplayConfigService.cs b/adas-core.Application/Services/DisplayConfigService.cs index 690c78ae..eaec6f6e 100644 --- a/adas-core.Application/Services/DisplayConfigService.cs +++ b/adas-core.Application/Services/DisplayConfigService.cs @@ -43,6 +43,7 @@ public class DisplayConfigService( /// Configurations for which the minimal display section cannot be resolved are excluded from the result. /// /// A task that represents the asynchronous operation. The task result contains a list of enriched items, omitting any entries that could not be enriched. + /// public async Task> GetAll() { var result = await displayConfigRepository.GetAll(); @@ -62,6 +63,7 @@ public class DisplayConfigService( /// /// The pagination filter containing the page number, page size, and any filtering criteria used to retrieve and paginate the display configurations. /// A task that represents the asynchronous operation, containing a with the compact display configurations, current page metadata, and total document count. + /// public async Task> GetAllCompactPaginated(PaginationFilter filter) { var result = displayConfigRepository.GetAllPaginated(filter); @@ -89,6 +91,7 @@ public class DisplayConfigService( /// /// The display type used to filter the configurations. /// A list of enriched display configurations; entries whose display section could not be resolved are omitted. + /// public async Task> GetByType(DisplayConfigEnums.DisplayType type) { var result = await displayConfigRepository.GetByType(type); @@ -109,6 +112,7 @@ public class DisplayConfigService( /// The unique identifier of the display configuration to retrieve. /// The display configuration with the minimal display section applied. /// Thrown when no display configuration exists for the specified . + /// public async Task GetById(ObjectId id) { return await AddDisplaySectionMinimal(await displayConfigRepository.GetById(id)) ?? @@ -122,6 +126,7 @@ public class DisplayConfigService( /// The unit identifier used to look up the default configuration. /// The display type used to look up the default configuration. /// The current configuration, the default configuration, the merged configuration, or null when neither is available. + /// public async Task GetById(ObjectId? configId, ObjectId unitId, DisplayConfigEnums.DisplayType displayType) { @@ -160,6 +165,7 @@ public class DisplayConfigService( /// /// The display configuration to insert. /// The inserted display configuration, or null if no entity was returned by the repository. + /// public async Task InsertOne(DisplayConfig config) { await auditService.CreateAuditLogAsync(httpContextAccessor.HttpContext?.User!, null, config); @@ -171,6 +177,7 @@ public class DisplayConfigService( /// /// The DTO containing the hospital and display type used to build the new configuration entity. /// The inserted entity, or null if the repository did not return a result. + /// public async Task InsertOneMinimal(CreateDisplayConfigDto config) { DisplayConfig newDisplayConfig; @@ -198,6 +205,7 @@ public class DisplayConfigService( /// Inserts test records for the DisplayNurse and SmartDisplay display configuration types into the repository and returns the inserted DisplayNurse record. /// /// The inserted instance of type DisplayNurse. + /// public async Task InsertOneTest() { var d = new DisplayNurse @@ -220,6 +228,7 @@ public class DisplayConfigService( /// The new configuration payload, deserialized internally into the appropriate DTO based on its Type. /// The updated when the corresponding update succeeds; otherwise the method throws. /// Thrown when the configuration's Type is not handled, or when the underlying update returns no result. + /// public async Task UpdateConfig(ObjectId displayConfigId, object newDisplayConfig) { var baseType = JsonConvert.DeserializeObject(newDisplayConfig.ToString()!); @@ -273,6 +282,7 @@ public class DisplayConfigService( /// The unique identifier of the display configuration whose field list is being updated. /// The collection of fields to be associated with the display configuration. /// A task that represents the asynchronous operation, containing a boolean value indicating whether the update was successful. + /// public Task UpdateFieldList(ObjectId objectIdConfigDisplay, List fields) { return displayConfigRepository.UpdateFieldList(objectIdConfigDisplay, fields); @@ -285,6 +295,7 @@ public class DisplayConfigService( /// The new color configuration to apply to the display. /// True if the color configuration was updated successfully; otherwise, false. /// Thrown when the display configuration identified by cannot be found before or after the update. + /// public async Task UpdateConfigColor(ObjectId objectIdConfigDisplay, ColorConfig colorConfig) { var oldDisplayConfig = await displayConfigRepository.GetById(objectIdConfigDisplay) ?? @@ -311,6 +322,7 @@ public class DisplayConfigService( /// The new header configuration to apply to the display configuration. /// A task that represents the asynchronous operation. The task result is true if the update was successful; otherwise, false. /// Thrown when the display configuration is not found before the update, or when the updated display configuration cannot be retrieved afterwards. + /// public async Task UpdateHeaderConfig(ObjectId objectIdConfigDisplay, HeaderConfig headerConfig) { var oldDisplayConfig = await displayConfigRepository.GetById(objectIdConfigDisplay) ?? @@ -330,6 +342,7 @@ public class DisplayConfigService( /// The list of banner items to set for the home banner. /// A task that resolves to true if the update succeeds; otherwise, false. /// Thrown when the display configuration cannot be found before or after the update. + /// public async Task UpdateSetHomeBanner(ObjectId objectIdConfigDisplay, List bannerItems) { var oldDisplayConfig = await displayConfigRepository.GetById(objectIdConfigDisplay) ?? @@ -348,6 +361,7 @@ public class DisplayConfigService( /// The display configuration containing the updated values, identified by its . /// A task that represents the asynchronous operation. The result indicates whether the update was successful. /// Thrown when the display configuration with the specified identifier does not exist before or after the update. + /// public async Task UpdateBaseConfig(DisplayConfig baseConfig) { var oldDisplayConfig = await displayConfigRepository.GetById(baseConfig.Id) ?? @@ -367,6 +381,7 @@ public class DisplayConfigService( /// The new hospital name to apply to the display configuration. /// A task that resolves to true if the update was successful; otherwise, false. /// Thrown when the display configuration identified by cannot be found before or after the update. + /// public async Task UpdateDisplayConfigHospitalName(ObjectId objectIdConfigDisplay, string name) { var oldDisplayConfig = await displayConfigRepository.GetById(objectIdConfigDisplay) ?? @@ -385,6 +400,7 @@ public class DisplayConfigService( /// The identifier of the display configuration to delete. /// A task that resolves to true if the configuration was successfully deleted; otherwise, false. /// Thrown when no default configuration is found for the related display type, or when reassigning a display to the default configuration fails. + /// public async Task DeleteDisplayConfig(ObjectId objectIdConfigDisplay) { var displays = await displayService.Value.GetByConfigId(objectIdConfigDisplay); @@ -413,6 +429,7 @@ public class DisplayConfigService( /// /// The identifier of the configuration display whose locations are being retrieved. /// A task that returns a list of items for the given configuration display. + /// public async Task> GetDisplayConfigLocations(ObjectId objectIdConfigDisplay) { return await displayService.Value.GetDisplayConfigLocations(objectIdConfigDisplay); @@ -422,6 +439,7 @@ public class DisplayConfigService( /// Asynchronously retrieves a compact list of all display configurations from the repository. /// /// A task that represents the asynchronous operation, containing a list of objects representing the compact display configuration data. + /// public async Task> GetAllCompact() { return await displayConfigRepository.GetAllCompact(); @@ -434,6 +452,7 @@ public class DisplayConfigService( /// The display type of the configuration to create; determines which template subtype is expected and produced. /// The hospital to associate with the newly created configuration. /// The inserted when the template is found and matches the requested type; otherwise, null. + /// public async Task InsertOneWithTemplate(string objectId, DisplayConfigEnums.DisplayType configType, string? configHospital) { @@ -491,6 +510,7 @@ public class DisplayConfigService( /// /// The card configuration to update. /// True if the update was applied (repository reported changes); otherwise, false. + /// public async Task UpdateCardConfig(CardConfig baseConfig) { var result = await displayCardConfigRepository.UpdateOne(baseConfig); @@ -520,6 +540,7 @@ public class DisplayConfigService( /// /// The card detail configuration to update, identified by its Id. /// A task that resolves to true when the update affected one or more records; false when no changes were made. + /// public async Task UpdateDetailConfig(CardDetailsConfig baseConfig) { var result = await displayDetailConfigRepository.UpdateOne(baseConfig); @@ -535,6 +556,7 @@ public class DisplayConfigService( /// /// The chart configuration to be updated. /// A task that resolves to true if the update changed at least one record; otherwise, false. + /// public async Task UpdateChartConfig(ChartConfig baseConfig) { var result = await displayChartRepository.UpdateOne(baseConfig); @@ -548,6 +570,7 @@ public class DisplayConfigService( /// /// The object ID of the chart configuration display to delete. /// true if the chart configuration was successfully deleted; false if no matching configuration was found. + /// public async Task DeleteChartConfig(ObjectId objectIdConfigDisplay) { var res = await displayChartRepository.DeleteOne(objectIdConfigDisplay); @@ -565,6 +588,7 @@ public class DisplayConfigService( /// /// The unique identifier of the chart configuration to retrieve. /// A task that represents the asynchronous operation. The task result contains the if found; otherwise, null. + /// public async Task GetChartConfig(ObjectId objectIdConfigChart) { return await displayChartRepository.GetById(objectIdConfigChart); @@ -575,6 +599,7 @@ public class DisplayConfigService( /// /// The DTO containing the detail configuration to insert and, optionally, the ID of the display configuration to associate it with. /// The newly inserted , or null when no detail configuration is provided in the DTO. + /// public async Task InsertCardDetailConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto) { if (updateDisplayConfigNameDto.DetailConfig == null) return null; @@ -596,6 +621,7 @@ public class DisplayConfigService( /// /// The data transfer object containing the chart configuration to insert and, optionally, the target display configuration identifier. /// The inserted , or null if the supplied chart configuration is null. + /// public async Task InsertChartConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto) { if (updateDisplayConfigNameDto.ChartConfig == null) return null; @@ -616,6 +642,7 @@ public class DisplayConfigService( /// /// The DTO containing the card configuration to insert and, optionally, the display configuration id to associate it with. /// The inserted , or null when the provided card configuration is null. + /// public async Task InsertCardConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto) { if (updateDisplayConfigNameDto.CardConfig == null) return null; @@ -635,6 +662,7 @@ public class DisplayConfigService( /// Asynchronously retrieves all card configurations from the display card config repository. /// /// A task that represents the asynchronous operation, containing a list of all entities. + /// public async Task> GetCardConfigAll() { return await displayCardConfigRepository.GetAll(); @@ -645,6 +673,7 @@ public class DisplayConfigService( /// /// The unique identifier of the card configuration to retrieve. /// The matching if found; otherwise, null. + /// public async Task GetCardConfigById(ObjectId id) { return await displayCardConfigRepository.GetById(id); @@ -656,6 +685,7 @@ public class DisplayConfigService( /// /// The display type used to look up the default configuration. /// A representing the default configuration for the specified type, or if no default is found. + /// public async Task GetDefaultConfig(DisplayConfigEnums.DisplayType type) { return await displayConfigRepository.GetDefault(type); @@ -668,6 +698,7 @@ public class DisplayConfigService( /// The identifier of the unit whose default display configuration is being requested. /// The display type used to filter the default configuration lookup. /// A instance if a default is found; otherwise, null. + /// private async Task GetDefaultByUnitIdAndType(ObjectId unitId, DisplayConfigEnums.DisplayType displayType) { @@ -682,6 +713,7 @@ public class DisplayConfigService( /// The display configuration to augment with minimal display section data, or . /// The updated , or if the input was . /// Thrown when the display configuration cannot be found in the repository by its identifier. + /// private async Task AddDisplaySectionMinimal(DisplayConfig? displayConfig) { if (displayConfig == null) return null; @@ -715,6 +747,7 @@ public class DisplayConfigService( /// Updates the chart configuration to mark the specified entry as deleted by delegating to the display configuration repository. /// /// The identifier of the chart configuration entry to mark as deleted. + /// private async Task UpdateDeletedChartConfig(ObjectId deletedId) { await displayConfigRepository.UpdateDeletedChartConfig(deletedId); @@ -726,6 +759,7 @@ public class DisplayConfigService( /// The identifier of the display configuration to which the chart ID will be associated. May be null. /// The identifier of the chart result to add to the display configuration. /// A task that represents the asynchronous operation. The task result contains a boolean indicating whether the chart ID was successfully added. + /// private async Task AddChartId(ObjectId? displayConfigId, ObjectId resultId) { var result = await displayConfigRepository.AddChartId(displayConfigId, resultId); @@ -738,6 +772,7 @@ public class DisplayConfigService( /// The identifier of the display configuration to update, or null to skip. /// The identifier of the result to associate with the card configuration, or null to skip. /// A task that resolves to true if the update was successful; otherwise, false. + /// private async Task UpdateCardConfigId(ObjectId? displayConfigId, ObjectId? resultId) { var result = await displayConfigRepository.UpdateCardConfigId(displayConfigId, resultId); @@ -750,6 +785,7 @@ public class DisplayConfigService( /// The display configuration identifier to associate with the result, or null if not specified. /// The result identifier whose detail configuration should be updated, or null if not specified. /// A task that resolves to true if the update was successful; otherwise, false. + /// private async Task UpdateDetailConfigId(ObjectId? displayConfigId, ObjectId? resultId) { var result = await displayConfigRepository.UpdateDetailConfigId(displayConfigId, resultId); @@ -764,6 +800,7 @@ public class DisplayConfigService( /// The identifier of the display configuration whose change should be broadcast to related subscribers. /// The type of operation performed on the configuration (e.g., create, update, delete) to convey to subscribers. /// The new display configuration payload to send to subscribers, or null if not applicable for the operation. + /// private async void SendDisplayConfigBroadcast(ObjectId displayConfigId, OperationType operationType, object? newDisplayConfig) { @@ -793,6 +830,7 @@ public class DisplayConfigService( /// The identifier of the display configuration used to look up the associated displays and to broadcast the global update. /// The new SmartDisplay configuration to propagate to subscribers, or null when not available. /// The previous SmartDisplay configuration used to build the update payload, or null when not available. + /// private async void SendSmartDisplayConfigBroadcast(ObjectId displayConfigId, SmartDisplay? newDisplayConfig, SmartDisplay? oldDisplayConfig) { @@ -827,6 +865,7 @@ public class DisplayConfigService( /// The list of WebSocket subscribers that will receive the display configuration update messages. /// The previous smart display configuration, or null if there is no prior configuration to compare against. /// The new smart display configuration whose values will be sent to subscribers. + /// private void SendSmartDisplayConfigUpdate(List subscribers, SmartDisplay? oldDisplayDisplayConfig, SmartDisplay? newDisplayDisplayConfig) { diff --git a/adas-core.Application/Services/DisplayService.cs b/adas-core.Application/Services/DisplayService.cs index e8a8d111..46fee8dd 100644 --- a/adas-core.Application/Services/DisplayService.cs +++ b/adas-core.Application/Services/DisplayService.cs @@ -57,6 +57,7 @@ public class DisplayService( /// The display to insert. Its DisplayConfigId is assigned from the resolved default configuration. /// The inserted with its DisplayConfigId populated. /// Thrown when no default configuration is found for the specified display type. + /// public async Task InsertOne(Display display) { var defaultConfig = await displayConfigService.GetDefaultConfig(display.Type) ?? @@ -71,6 +72,7 @@ public class DisplayService( /// Inserts a test Display record into the repository and records a corresponding audit log entry using the current HTTP context user. /// /// The newly created entity. + /// public async Task InsertOneTest() { var d = new Display @@ -92,6 +94,7 @@ public class DisplayService( /// Retrieves all displays from the repository and maps them to a compact representation. /// /// A task that represents the asynchronous operation, containing a list of with the mapped display data. + /// public async Task> GetAllCompact() { var result = await displayRepository.GetAll(); @@ -106,6 +109,7 @@ public class DisplayService( /// The user name used to filter the display items, or to retrieve all items. /// A task that represents the asynchronous operation. The task result contains a list of items. /// The method has not been implemented yet. + /// public Task> GetAll(string? userName) { throw new NotImplementedException(); @@ -116,6 +120,7 @@ public class DisplayService( /// /// The pagination filter containing the page number and page size used to determine the slice of results to return. /// A containing the requested page of displays, the current page number, the page size, and the total number of documents. + /// public async Task> GetPaginatedDisplays(PaginationFilter filter) { var result = displayRepository.GetPaginatedDisplays(filter); @@ -138,6 +143,7 @@ public class DisplayService( /// The username whose displays should be retrieved; when null, the method returns an empty list. /// A task that yields a list of containing the displays the user can access along with their permissions. /// Thrown when permissions for a unit-scoped display cannot be obtained for the user. + /// public async Task> GetAllByUser(string? userName) { var start = DateTime.Now; @@ -208,6 +214,7 @@ public class DisplayService( /// The identifier of the display to look up, compared as a string. /// The collection of display-with-permissions entries to search through. /// true if a non-null display with a matching identifier is found; otherwise, false. + /// private static bool FindDisplayInPerms(string displayId, List perms) { return perms.Any(p => p.Display != null && p.Display.Id.ToString() == displayId); @@ -219,6 +226,7 @@ public class DisplayService( /// /// The display type used to filter the display configurations. /// A list of displays matching the specified type, each with its related configuration assigned; an empty list is returned when no displays are found. + /// public async Task> GetByType(DisplayConfigEnums.DisplayType type) { var configs = await displayConfigService.GetByType(type); @@ -238,6 +246,7 @@ public class DisplayService( /// /// The point of care used to filter the displays. /// A task that represents the asynchronous operation. The task result contains the list of displays matching the specified point of care. + /// public async Task> GetByPointOfCare(PointOfCare pointOfCare) { return await displayRepository.GetByPointOfCare(pointOfCare); @@ -248,6 +257,7 @@ public class DisplayService( /// /// The configuration identifier used to look up the associated displays. /// A task that returns the list of objects matching the given configuration identifier. + /// public Task> GetByConfigId(ObjectId configId) { return displayRepository.GetByConfigId(configId); @@ -258,6 +268,7 @@ public class DisplayService( /// /// The unique identifier of the card configuration used to look up the associated displays. /// A task that represents the asynchronous operation, containing a list of objects matching the provided card configuration identifier. + /// public Task> GetByCardConfigId(ObjectId configId) { return displayRepository.GetByCardConfigId(configId); @@ -269,6 +280,7 @@ public class DisplayService( /// The name of the display to look up. /// The that matches the specified name. /// Thrown when no display is found for the given name. + /// public async Task GetByName(string name) { return await displayRepository.GetByName(name) ?? @@ -280,6 +292,7 @@ public class DisplayService( /// /// The unique identifier of the display to retrieve. /// The matching if found; otherwise, null. + /// public async Task GetById(ObjectId id) { return await displayRepository.GetById(id); @@ -292,6 +305,7 @@ public class DisplayService( /// The locale used to localize the related point-of-care information. /// A containing the display and its associated permissions. /// Thrown when the current user cannot be identified from the JWT or when no display is found for the specified . + /// public async Task GetByIdWithPermissions(ObjectId id, LocaleEnum localeEnum) { var username = JwtHelper.GetUsernameFromPrincipal(httpContextAccessor.HttpContext?.User!) ?? @@ -333,6 +347,7 @@ public class DisplayService( /// /// The unique identifier of the unit whose displays should be counted. /// A task that represents the asynchronous operation. The task result contains the total number of displays for the given unit. + /// public async Task CountDisplaysByUnitId(ObjectId unitId) { return await displayRepository.CountByUnitId(unitId); @@ -353,6 +368,7 @@ public class DisplayService( /// If true, retrieves the full display including its configuration (cached); otherwise retrieves the base display. /// Cancellation token to cancel the operation. /// The requested , or null if no display is found for the given id. + /// public async Task GetInfo(ObjectId id, string? userName, List? authorizations, @@ -429,6 +445,8 @@ public class DisplayService( /// The identifier of the display to load. /// The cancellation token used to cancel the asynchronous operation. /// The with its configuration populated, or null if no display exists for the given . + /// private async Task BuildDisplayWithConfig(ObjectId id, CancellationToken ct) { var display = await displayRepository.GetById(id); @@ -465,6 +483,7 @@ public class DisplayService( /// The username used to look up the user and their authorities; if null, an empty list is returned. /// Optional pre-fetched list of user authorities; when null, authorities are retrieved from the authority service. /// A task that resolves to a list of items accessible to the user and matching the specified display type. + /// public async Task> GetDisplaySectionByUser( DisplayConfigEnums.DisplayType type, ObjectId? currentDisplay, @@ -539,6 +558,7 @@ public class DisplayService( /// Asynchronously retrieves all display configurations of type DisplayNurse and SmartDisplay, mapping them into minimal display sections and grouping them within a display list DTO. /// /// A task that represents the asynchronous operation. The task result contains a MinimalDisplayListDto with the populated DisplayNurse and SmartDisplay collections. + /// public async Task GetAllDisplaySection() { var minimalDisplayListDto = new MinimalDisplayListDto(); @@ -572,6 +592,7 @@ public class DisplayService( /// /// The identifier of the unit whose displays should be returned. /// A task that represents the asynchronous operation, containing the list of objects for the given unit. + /// public async Task> GetByUnitId(ObjectId unitId) { return await displayRepository.GetByUnitId(unitId); @@ -584,6 +605,8 @@ public class DisplayService( /// When set to true, virtual points of care are excluded from the result; otherwise, they are included. /// A containing the available points of care and their associated unit details. /// Thrown when a unit associated with one of the resolved display identifiers cannot be found. + /// public async Task GetAllAvailablePoc(List displayIds, bool excludeVirtual = false) { try @@ -635,6 +658,7 @@ public class DisplayService( /// /// The ObjectId of the display whose points of care should be retrieved. /// A list of points of care linked to the display, or an empty list if the display cannot be found or if an error is encountered. + /// public async Task> GetAllPocsByDisplayId(ObjectId id) { try @@ -664,6 +688,7 @@ public class DisplayService( /// /// The identifier of the display configuration whose locations are being retrieved. /// A task that represents the asynchronous operation. The task result contains a list of objects with display and unit information. + /// public async Task> GetDisplayConfigLocations(ObjectId displayConfigId) { var displays = await GetByConfigId(displayConfigId); @@ -687,6 +712,7 @@ public class DisplayService( /// /// The unique identifier of the display configuration to check. /// true if the display configuration is referenced by at least one entity; otherwise, false. + /// public async Task IsDisplayConfigInUse(ObjectId displayConfigId) { return await displayRepository.IsDisplayConfigInUse(displayConfigId) > 0; @@ -708,6 +734,7 @@ public class DisplayService( /// The updated instance after the point of care list change. /// Thrown when no display exists for the specified . /// Thrown when the point of care list update cannot be persisted. + /// public async Task UpdatePointOfCareList(ObjectId objectId, List listPocObId) { var oldDisplay = await displayRepository.GetById(objectId) ?? @@ -729,6 +756,10 @@ public class DisplayService( /// The existing display whose configuration will be updated. /// The new configuration to apply, or null if no update is provided. /// The updated if the configuration was successfully applied; otherwise, null. + /// + /// public async Task UpdateConfig(Display oldDisplay, DisplayConfig? newDisplayConfig) { var newDisplayConfigCast = new DisplayConfig(); @@ -766,6 +797,7 @@ public class DisplayService( /// The display whose configuration ID is being updated. /// The new configuration ID to assign to the display. /// The updated display, or null if the display was not found. + /// public async Task UpdateConfigId(Display oldDisplay, ObjectId configId) { var displayToReturn = await displayRepository.UpdateConfigId(oldDisplay.Id, configId); @@ -787,6 +819,8 @@ public class DisplayService( /// The updated entity, or null if the update could not be completed. /// Thrown when the update result or the resolved configuration is null. /// Thrown when the configuration type is not one of the handled display types. + /// public async Task UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay) { var oldConfig = await displayConfigService.GetById(objectIdConfigDisplay); @@ -824,6 +858,7 @@ public class DisplayService( /// The new name to assign to the display. /// The updated instance, or null if the update could not be performed. /// Thrown when no display is found for the specified . + /// public async Task UpdateName(ObjectId id, string name) { var display = await displayRepository.GetById(id) ?? @@ -846,6 +881,7 @@ public class DisplayService( /// The unique identifier of the display to delete. /// A task that resolves to true when the display has been successfully deleted. /// Thrown when no display is found for the specified . + /// public async Task DeleteDisplay(ObjectId id) { var display = await displayRepository.GetById(id) ?? @@ -865,6 +901,7 @@ public class DisplayService( /// Deletes all displays associated with the specified unit identifier, invalidates the displays cache, and removes related authority data for the unit. /// /// The unique identifier of the unit whose displays and related authority data will be removed. + /// public async Task DeleteDisplaysByUnitId(ObjectId unitId) { await displayRepository.DeleteManyByUnitId(unitId); @@ -883,6 +920,7 @@ public class DisplayService( /// /// The list of WebSocket subscribers that will receive the smart display configuration update. /// The smart display configuration to broadcast. May be null if no configuration is provided. + /// private void SendSmartDisplayBroadcast(List subscribers, SmartDisplay? config) { foreach (var subscriber in subscribers) @@ -894,6 +932,7 @@ public class DisplayService( /// /// The list of WebSocket subscribers that will receive the nurse display configuration update. /// The nurse display configuration to broadcast, which may be null. + /// private void SendNurseDisplayBroadcast(List subscribers, DisplayNurse? config) { foreach (var subscriber in subscribers) @@ -906,6 +945,7 @@ public class DisplayService( /// /// The display whose subscribers will receive the broadcast; used to filter the subscriber list by its identifier. /// The type of operation being broadcast, which determines the action taken on matching subscribers. + /// private void SendDisplayBroadcast(Display display, OperationType operation) { var subscribers = subscribersService.GetSubscribers().Where(s => diff --git a/adas-core.Application/Services/FileService.cs b/adas-core.Application/Services/FileService.cs index 1b27430e..e698db77 100644 --- a/adas-core.Application/Services/FileService.cs +++ b/adas-core.Application/Services/FileService.cs @@ -14,6 +14,7 @@ namespace adas_core.Application.Services; /// /// Provides a concrete implementation of the contract for performing file-related operations. /// +/// public class FileService : IFileService { private readonly string? _assetsDirectory; @@ -47,6 +48,7 @@ public class FileService : IFileService /// /// The collection of uploaded form files to be written to the update directory. /// A task that resolves to true when every file is successfully copied, or false when the update directory is not configured. + /// public async Task CopyUpdateFiles(ICollection files) { if (string.IsNullOrWhiteSpace(_updateDirectory)) return false; @@ -66,6 +68,7 @@ public class FileService : IFileService /// The collection of uploaded form files to persist to the assets directory. /// The asset theme used to determine the subdirectory in which the files will be stored. /// A task that resolves to true when the files are successfully written, or false when the assets directory path is not configured. + /// public async Task UploadAssetFiles(ICollection files, FileEnum.AssetTheme themeParse) { if (string.IsNullOrWhiteSpace(_assetsDirectory)) return false; @@ -87,6 +90,7 @@ public class FileService : IFileService /// /// The theme used to locate the corresponding subdirectory within the assets directory. /// A list of objects containing the name, extension, and full path of each file found; an empty list if the assets directory is not configured or an error occurs. + /// public List GetAllAssetFile(FileEnum.AssetTheme themeParse) { try @@ -125,6 +129,7 @@ public class FileService : IFileService /// /// The path of the directory to search for files. /// A list of file paths found in the directory, or an empty list if the directory does not exist or an error occurs. + /// public List GetFilesInDirectory(string directoryPath) { List fileList = []; diff --git a/adas-core.Application/Services/GroupedObservationService.cs b/adas-core.Application/Services/GroupedObservationService.cs index 2c07937d..f8a635d5 100644 --- a/adas-core.Application/Services/GroupedObservationService.cs +++ b/adas-core.Application/Services/GroupedObservationService.cs @@ -17,6 +17,7 @@ namespace adas_core.Application.Services; /// /// Provides a concrete implementation of for managing and exposing grouped observation data. /// +/// public class GroupedObservationService : IGroupedObservationService { private readonly CacheSettings? _cacheSettings; @@ -61,6 +62,7 @@ public class GroupedObservationService : IGroupedObservationService /// When true, the cache is bypassed and observations are always recomputed; when false, results are obtained through the cache with the configured TTL. /// Token used to cancel the asynchronous operation. /// A containing the patient id, group, name, and the list of computed entries. + /// public async Task GenerateGroupedObservation( ObjectId patientId, GroupedField groupedField, @@ -357,6 +359,7 @@ public class GroupedObservationService : IGroupedObservationService /// The new patient observation to be incorporated into the grouped observation. /// The time zone identifier used when a full recalculation is required. Defaults to "Romance Standard Time". /// A task that resolves to the generated for the patient, either from an incrementally updated cache entry or from a full recalculation. + /// public async Task GenerateGroupedObservation( ObjectId patientId, GroupedField groupedField, @@ -408,6 +411,7 @@ public class GroupedObservationService : IGroupedObservationService /// The maximum number of recent observations to return. Defaults to 2. /// An optional list of observation identifiers used to restrict the result set. When null, no filtering is applied. /// A task that represents the asynchronous operation, containing a list of entries representing the patient's most recent observations. + /// public async Task> FindLastObservations(ObjectId patientId, int num = 2, List? filterObservations = null) { @@ -420,6 +424,7 @@ public class GroupedObservationService : IGroupedObservationService /// /// The grouped subscriber context that supplies the group, names, regularity, max window, and cache key used to derive the next observations. /// A containing the resulting observations adjusted to the configured time window based on (Minute, Second, or default hour-based). + /// public async Task CreateNextEmptyObs(WsSubscriberGrouped ws) { var gf = new GroupedField @@ -525,6 +530,7 @@ public class GroupedObservationService : IGroupedObservationService /// The existing grouped observation documents to be completed with missing intervals. /// The grouping configuration that defines the names, maximum number of intervals, regularity and result types to use when generating the placeholders. /// A list of entries ordered by time, containing the original data and any added zero-valued filler entries for missing intervals. + /// public List FillHours(List result, GroupedField groupedField) { var now = DateTime.UtcNow; @@ -725,6 +731,7 @@ public class GroupedObservationService : IGroupedObservationService /// The grouped field containing either a list of names to iterate over or a single name used as fallback when the list is empty. /// The identifier of the patient whose observations are being calculated. /// A task that returns a list of BsonDocument containing the calculated last filled observations. + /// public async Task> CalculateLastFilledObservations(List result, GroupedField groupedField, ObjectId patientId) { @@ -751,6 +758,7 @@ public class GroupedObservationService : IGroupedObservationService /// The patient identifier used to query the last observation before the earliest expected date. /// The name assigned to the generated BsonDocument _id entries. /// The result list with missing time-slot entries filled using the last-filled value, ordered by time. + /// private async Task> LastFilledCalc(List result, GroupedField groupedField, ObjectId patientId, string? name) { @@ -875,6 +883,7 @@ public class GroupedObservationService : IGroupedObservationService /// The list of shift observations to be aggregated. /// The grouped field configuration whose Result property determines whether a Sum aggregation is applied. /// A list of containing the aggregated shift observations, or the original list when no Sum operation is required. + /// public List CalculateShiftObservations(List shiftGroupObservations, GroupedField groupedField) { @@ -923,6 +932,7 @@ public class GroupedObservationService : IGroupedObservationService /// grouped into half-hour intervals and enriched with a "halfhour" field in place. /// The same instance with the "halfhour" field populated /// according to the half-hour grouping rules. + /// public List CalculateHalfHourObservations(List result) { //HalfHour añadir que se rellenen las horas que no existen @@ -1000,6 +1010,7 @@ public class GroupedObservationService : IGroupedObservationService /// The list of aggregated BsonDocuments to enrich; each document is modified in place to include the day and shift elements. /// The grouping configuration providing the ordered list of shift start times used to determine the assigned shift. /// The same list with day and shift elements added to each successfully processed document. + /// public List GenerateShiftObservations(List result, GroupedField groupedField) { result.ForEach(item => @@ -1095,6 +1106,7 @@ public class GroupedObservationService : IGroupedObservationService /// The patient observation to match against or insert into the group. /// The grouped field providing the regularity, result aggregation types, maximum retention count, and shift configuration. /// The updated list of grouped observations, limited to entries whose time is within the allowed date range. + /// private List LocateCurrentObsInGroup(List group, PatientObservation obs, GroupedField groupedField) { @@ -1241,6 +1253,7 @@ public class GroupedObservationService : IGroupedObservationService /// The observation date whose time of day is evaluated against the configured shifts. /// The list of shift start time strings used to build the shift intervals; must contain at least one entry to produce a result. /// The zero-based index of the matching shift, -1 if no shift matches, or null if is empty. + /// private int? GetShift(DateTime currentObsDate, List groupedFieldStartTimeShift) { if (groupedFieldStartTimeShift.Count == 0) return null; @@ -1264,6 +1277,7 @@ public class GroupedObservationService : IGroupedObservationService /// /// A list of time span string representations to be parsed and adjusted. /// A list of TimeSpan values where each entry is the original time plus one minute, or the subsequent time span if adding one minute would exceed it. + /// private List GetTimeSpan(List groupedFieldStartTimeShift) { List timeSpans = []; @@ -1294,6 +1308,7 @@ public class GroupedObservationService : IGroupedObservationService /// The optional minimum bound used in the status evaluation. /// The optional maximum bound used in the status evaluation. /// A task that resolves to the representing the status of the grouped observation. + /// private async Task GroupedObservationStatus(GroupedField groupedField, GroupedObservationEnum.Result result, string name, object value, double? min, double? max) { @@ -1306,6 +1321,7 @@ public class GroupedObservationService : IGroupedObservationService /// The grouped observation containing the timestamp of the last recorded observation. /// The grouped field whose regularity (second, minute, hour, or day) defines the time unit used in the calculation. /// A tuple containing the number of times left to create an empty observation (the ceiling of the elapsed time in the selected unit) and the multiplier factor associated with the regularity unit. + /// private (int timesLeft, int multiplierFactor) TimesLeftToCreateEmptyObs(GroupedObservationObs obs, GroupedField gf) { var currentDateTime = DateTime.Now; @@ -1346,6 +1362,8 @@ public class GroupedObservationService : IGroupedObservationService /// The grouped field providing the list of result property names to copy and the regularity used to determine shift handling. /// The number of seconds to add to the source observation's time for the new observation. /// A new populated with values derived from ; when the regularity is , the shift date and shift are also assigned. + /// private GroupedObservationObs CreateNextObs(GroupedObservationObs sourceObs, GroupedField gf, int seconsToAdd) { var lastObs = new GroupedObservationObs diff --git a/adas-core.Application/Services/HistoricalConfigChangesService.cs b/adas-core.Application/Services/HistoricalConfigChangesService.cs index 167a8492..6c6b1f65 100644 --- a/adas-core.Application/Services/HistoricalConfigChangesService.cs +++ b/adas-core.Application/Services/HistoricalConfigChangesService.cs @@ -30,6 +30,7 @@ public class HistoricalConfigChangesService( /// Deletes a historical configuration change record by its identifier and creates an audit log entry recording the deletion. /// /// The unique identifier of the historical configuration change to delete. + /// public async Task DeleteHistoricalConfigChange(ObjectId id) { var filter = Builders.Filter.Eq("_id", id); @@ -44,6 +45,7 @@ public class HistoricalConfigChangesService( /// /// The configuration type used to look up the last historical change. /// The most recent entry, or null if no changes exist for the given type. + /// public async Task FindLastConfigChanges(DisplayConfigEnums.ConfigTypes configType) { var result = await historicalConfigChangesRepository.FindLastHistoricalConfigChangesByType(configType); @@ -57,6 +59,7 @@ public class HistoricalConfigChangesService( /// /// The unique identifier of the historical configuration change to retrieve. /// The matching record, or null if no record is found. + /// public async Task Get(ObjectId id) { return await historicalConfigChangesRepository.FindById(id); @@ -66,6 +69,7 @@ public class HistoricalConfigChangesService( /// Retrieves all historical configuration changes from the repository. /// /// A task that represents the asynchronous operation, containing a collection of all records. + /// public async Task> GetAll() { return await historicalConfigChangesRepository.FindAll(); @@ -77,6 +81,7 @@ public class HistoricalConfigChangesService( /// The configuration type used to filter the historical changes. /// The maximum number of recent changes to return. Defaults to 10. /// A collection of the latest entries matching the specified type. + /// public async Task> GetByType(DisplayConfigEnums.ConfigTypes type, int num = 10) { return await historicalConfigChangesRepository.FindLastHistoricalConfigChangesByType(type, num); @@ -90,6 +95,7 @@ public class HistoricalConfigChangesService( /// Optional filter for the configuration type; when null, all configuration types are included. /// The maximum number of historical change entries to return. Defaults to 10. /// A task that represents the asynchronous operation, containing a collection of the user's historical configuration changes. + /// public async Task> GetByUser(string user, DisplayConfigEnums.ConfigTypes? configTypes = null, int num = 10) { @@ -103,6 +109,7 @@ public class HistoricalConfigChangesService( /// The historical configuration change entity to insert. /// The inserted entity, or null if the operation fails. /// Thrown when the repository returns null after the insert operation. + /// public async Task InsertOne(HistoricalConfigChanges historicalConfigChanges) { try @@ -127,6 +134,10 @@ public class HistoricalConfigChangesService( /// The historical configuration change entity containing the updated values to persist. /// The updated entity on success, or null if an error occurs during the operation. /// Thrown when no existing historical configuration change is found with the specified Id. + /// + /// public async Task UpdateHistoricalConfigChange( HistoricalConfigChanges historicalConfigChanges) { @@ -155,6 +166,7 @@ public class HistoricalConfigChangesService( /// The type of configuration that was changed. /// The new configuration value after the change. /// The previous configuration value before the change. + /// public async Task LogConfigChanged(string user, DisplayConfigEnums.ConfigTypes configType, string newConfig, string oldConfig) { diff --git a/adas-core.Application/Services/Interfaces/IAPIRequestService.cs b/adas-core.Application/Services/Interfaces/IAPIRequestService.cs index 488275a6..f677c706 100644 --- a/adas-core.Application/Services/Interfaces/IAPIRequestService.cs +++ b/adas-core.Application/Services/Interfaces/IAPIRequestService.cs @@ -8,10 +8,12 @@ public interface IApiRequestService /// Asynchronously persists the specified . /// /// The API request to be saved. + /// Task SaveRequestAsync(ApiRequest apiRequest); /// /// Asynchronously saves the specified API request. /// /// The API request to persist. + /// Task SaveRequest(ApiRequest apiRequest); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IAdminPanelService.cs b/adas-core.Application/Services/Interfaces/IAdminPanelService.cs index d68abdd5..cdc8e34c 100644 --- a/adas-core.Application/Services/Interfaces/IAdminPanelService.cs +++ b/adas-core.Application/Services/Interfaces/IAdminPanelService.cs @@ -13,12 +13,14 @@ public interface IAdminPanelService /// /// The unique identifier of the unit to delete. /// A task that represents the asynchronous operation. The task result is true if the unit was successfully deleted; otherwise, false if the unit was not found. + /// Task DeleteUnitById(ObjectId unitId); /// /// Inserts a new into the data store and returns the inserted entity. /// /// The to insert. /// A that resolves to the inserted , or if the insert could not be completed. + /// Task InsertUnit(Unit unit); #region Patient @@ -28,18 +30,21 @@ public interface IAdminPanelService /// /// The admin panel request containing the data needed to create the patient. /// A task that represents the asynchronous operation. The task result contains the created , or null if no patient was created. + /// Task CreatePatient(AdmPanelRequest apiRequest); /// /// Asynchronously retrieves the patient associated with the specified location. /// /// The location used to look up the associated patient. /// A task that resolves to the found at the given location, or null if no patient is associated with that location. + /// Task FindPatientByLocation(PatientLocation location); /// /// Asynchronously retrieves a by their unique patient number. /// /// The unique identifier of the patient to look up. /// A that yields the matching , or null if no patient is found with the specified number. + /// Task FindPatientByPatientNumber(string patientNumber); /// @@ -48,6 +53,7 @@ public interface IAdminPanelService /// /// The unique identifier of the patient to retrieve. /// A task that represents the asynchronous operation. The task result contains the patient if found; otherwise, null. + /// Task FindPatientById(ObjectId id); //List FindAllPatient(); @@ -57,6 +63,7 @@ public interface IAdminPanelService /// /// The admission panel request containing the search criteria used to locate the patient. /// A that yields the matching if found, or null otherwise. + /// Task FindPatient(AdmPanelRequest request); /// /// Asynchronously retrieves the dependency information DTO for the specified . @@ -64,6 +71,7 @@ public interface IAdminPanelService /// /// The unit for which to retrieve dependency information. /// A that yields the unit dependency DTO, or null if none is found. + /// Task GetUnitDependencyDto(Unit unit); /// @@ -71,6 +79,7 @@ public interface IAdminPanelService /// /// The admission panel request containing the patient location details to update. /// A task that represents the asynchronous operation. The task result is true if the update was successful; otherwise, false. + /// Task UpdatePatientLocation(AdmPanelRequest request); /// /// Updates the patient data based on the provided admission panel request, using the existing patient record as a reference. @@ -78,12 +87,14 @@ public interface IAdminPanelService /// The admission panel request containing the updated patient data. /// The existing patient record to be updated. /// A task that represents the asynchronous operation. The task result is true if the patient data was successfully updated; otherwise, false. + /// Task UpdatePatientData(AdmPanelRequest request, Patient oldPatient); /// /// Archives the specified patient, marking them as inactive while preserving their record. /// /// The patient to be archived. /// A task that represents the asynchronous operation. The task result contains true if the patient was successfully archived; otherwise, false. + /// Task ArchivePatient(Patient patient); #endregion @@ -94,18 +105,21 @@ public interface IAdminPanelService /// /// The observation data used to create the configuration. /// A task that represents the asynchronous create operation, containing a value indicating whether the configuration was created successfully. + /// Task CreateConfig(ConfigObservation configObservation); /// /// Asynchronously updates the configuration based on the provided , applying any required changes derived from the observation data. /// /// The observation data used to determine and apply configuration updates. /// A that represents the asynchronous update operation, containing a value indicating whether the configuration was successfully updated. + /// Task UpdateConfig(ConfigObservation configObservation); /// /// Deletes the configuration observation item identified by the specified identifier. /// /// The unique identifier of the configuration observation item to delete. /// A task that represents the asynchronous operation. The task result is true if the item was successfully deleted; otherwise, false. + /// Task DeleteConfigObservationItem(ObjectId id); #endregion @@ -118,24 +132,28 @@ public interface IAdminPanelService /// /// The unique of the medicine to look up. /// A that resolves to the matching , or null if not found. + /// Task GetMedicineById(ObjectId medicineId); /// /// Asynchronously creates and persists a new medicine record. /// /// The medicine entity to be created and posted. /// A task that represents the asynchronous operation, containing the newly created , or null if the operation fails. + /// Task PostMedicine(Medicine medicine); /// /// Updates an existing medicine record in the system. /// /// The medicine entity containing the updated information to be persisted. /// A task that represents the asynchronous operation. The task result contains the updated if found, or null if the medicine does not exist. + /// Task UpdateMedicine(Medicine medicine); /// /// Deletes a medicine identified by its unique identifier. /// /// The unique identifier of the medicine to delete. /// A task that represents the asynchronous operation. The task result contains true if the medicine was successfully deleted; otherwise, false. + /// Task DeleteMedicineById(string medicineId); #endregion diff --git a/adas-core.Application/Services/Interfaces/IAdmissionService.cs b/adas-core.Application/Services/Interfaces/IAdmissionService.cs index 656597e6..b8e8d23b 100644 --- a/adas-core.Application/Services/Interfaces/IAdmissionService.cs +++ b/adas-core.Application/Services/Interfaces/IAdmissionService.cs @@ -14,21 +14,25 @@ public interface IAdmissionService : IApiRequestService /// /// The unique identifier of the admission to retrieve. /// A task that represents the asynchronous operation, containing the if found, or null if no admission matches the specified identifier. + /// Task GetAdmissionByIdAsync(ObjectId admissionId); /// /// Asynchronously deletes an admission record identified by the specified admission ID. /// /// The unique identifier of the admission to delete. + /// Task DeleteAdmissionByIdAsync(ObjectId admissionId); /// /// Asynchronously deletes the specified admission record. /// /// The admission entity to remove. + /// Task DeleteAdmissionAsync(Admission admission); /// /// Deletes all admissions associated with the specified unit identifier. /// /// The identifier of the unit whose admissions will be deleted. + /// Task DeleteAdmissionsByUnitId(ObjectId unitId); /// @@ -36,46 +40,54 @@ public interface IAdmissionService : IApiRequestService /// /// The admission entity containing the updated data to be persisted. /// A task that represents the asynchronous update operation. + /// Task UpdateAdmissionAsync(Admission admission); /// /// Asynchronously retrieves a collection of admissions. /// /// A task that represents the asynchronous operation. The task result contains an enumerable collection of objects. + /// Task> GetAdmissionsAsync(); /// /// Asynchronously inserts a new admission record and returns the created entry, or if the insertion was not performed. /// /// The admission entity to be inserted into the data store. /// A task that represents the asynchronous operation. The task result contains the inserted , or when no record is produced. + /// Task InsertAdmission(Admission admission); /// /// Admits a patient based on the provided admission details, optionally registering the patient as new. /// /// The admission information used to process the patient admission. /// Indicates whether the patient is being admitted for the first time. Defaults to false. + /// Task AdmitPatient(Admission admission, bool isNew = false); /// /// Processes the return of a patient to the admissions workflow, typically used when a patient needs to be re-queued or reinstated for admission processing. /// /// The unique identifier of the patient to be returned to admissions. + /// Task ReturnPatientToAdmissions(ObjectId patientId); /// /// Asynchronously returns a patient to the admissions workflow using the specified admission record. /// /// The unique identifier of the patient being returned to admissions. /// The admission record associated with the patient being returned. + /// Task ReturnPatientToAdmissions(ObjectId patientId, Admission adm); /// /// Retrieves a list of admissions associated with the specified patient location. /// /// The patient location used to filter the admissions. /// A task that represents the asynchronous operation, containing a list of admissions for the given location. + /// Task> GetAdmissionByLocation(PatientLocation location); /// /// Asynchronously retrieves the list of admissions associated with the specified point of care identifier. /// /// The of the point of care used to filter the admissions. /// A task that represents the asynchronous operation. The task result contains a list of objects matching the specified point of care id, or an empty list if no admissions are found. + /// Task> GetAdmissionByPointOfCareId(ObjectId id); /// /// Retrieves the list of admissions associated with the specified point of care, localized for the given locale. @@ -83,18 +95,21 @@ public interface IAdmissionService : IApiRequestService /// The identifier of the point of care whose admissions are being queried. /// The locale used to localize the returned admission data. /// A task that resolves to the list of admissions matching the point of care and locale; an empty list when no matches are found. + /// Task> GetAdmissionByPointOfCareIdAndLocale(ObjectId pocId, LocaleEnum locale); /// /// Retrieves a list of admissions associated with the specified unit identifier, excluding any Point of Care (PoC) related admissions. /// /// The unique identifier of the unit whose admissions should be retrieved. /// A task that represents the asynchronous operation. The task result contains a list of admissions for the specified unit, excluding PoC admissions. + /// Task> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId); /// /// Asynchronously counts the number of admissions associated with the specified unit identifier. /// /// The MongoDB ObjectId of the unit whose admissions should be counted. /// A task that represents the asynchronous operation, containing the total count of admissions for the given unit. + /// Task CountAdmissionsByUnitId(ObjectId unitId); /// @@ -103,12 +118,14 @@ public interface IAdmissionService : IApiRequestService /// The patient number used to identify the patient. /// The identifier of the unit in which the patient is being searched. /// A task that returns the matching if found; otherwise, null. + /// Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId); /// /// Retrieves the admission record associated with the specified patient number, returning null when no matching admission is found. /// /// The unique patient number used to look up the admission. /// A task that resolves to the matching , or null if no admission exists for the given patient number. + /// Task GetAdmissionByPatientNumber(string patientNumber); /// @@ -118,6 +135,7 @@ public interface IAdmissionService : IApiRequestService /// The collection of units associated with the master list item change. /// The name of the type used to identify the master list item category. /// A task that represents the asynchronous update operation. + /// Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable unitList, string typeName); /// /// Deletes a patient master list item identified by the specified options, units, and type name. @@ -125,5 +143,6 @@ public interface IAdmissionService : IApiRequestService /// The option list used to identify the master list item to delete. /// The collection of units associated with the master list item. /// The name of the type associated with the master list item. + /// Task DeletePatientMasterListItem(OptionList opt, IEnumerable unitList, string typeName); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IAlarmService.cs b/adas-core.Application/Services/Interfaces/IAlarmService.cs index 301634ba..8b64303f 100644 --- a/adas-core.Application/Services/Interfaces/IAlarmService.cs +++ b/adas-core.Application/Services/Interfaces/IAlarmService.cs @@ -14,6 +14,7 @@ public interface IAlarmService : IApiRequestService /// The identifier of the patient whose last observations should be retrieved. /// An optional list of fields to restrict the returned observations; when null, no field filter is applied. /// A task that resolves to the list of the patient's most recent records. + /// public Task> FindLastObservationsByField(ObjectId patientId, List? filterObservations = null); @@ -24,6 +25,7 @@ public interface IAlarmService : IApiRequestService /// The list of fields used to identify and filter the patient observation alarm data. /// The list of configuration observations that define the alarm criteria, including expiration rules. /// A task that represents the asynchronous operation, containing the list of the latest non-expired entries for the patient. + /// Task> FindLastValuesNotExpired(ObjectId patientId, List dataAlarmfields, List configAlarm); @@ -33,12 +35,14 @@ public interface IAlarmService : IApiRequestService /// The patient observation alarm to be mapped. /// When true, limits the mapping to lookups performed by name only. /// A task that resolves to the mapped patient observation alarm, or null if no corresponding alarm is found. + /// public Task MapObservation(PatientObservationAlarm obs, bool onlyByName = false); /// /// Maps the given patient observation alarm to a corresponding record by name, returning a null result when no matching observation is found. /// /// The patient observation alarm to be mapped by name. /// A task containing the mapped , or null if no matching observation exists. + /// public Task MapObservationsByName(PatientObservationAlarm obs); /// @@ -46,6 +50,7 @@ public interface IAlarmService : IApiRequestService /// /// The base patient observation value used as input for the alarm evaluation. /// The name that identifies the alarm test to be calculated. + /// Task CalculateAlarmTest(BasePatientObservationValue source, string name); /// @@ -57,6 +62,7 @@ public interface IAlarmService : IApiRequestService /// The severity level assigned to the alarm. /// The type category of the alarm. /// A task that represents the asynchronous alarm sending operation. + /// Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code, AlarmEnum.Severity severity, AlarmEnum.Type type); @@ -64,6 +70,7 @@ public interface IAlarmService : IApiRequestService /// Asynchronously checks the observation alarm for the specified patient observation. /// /// The patient observation to evaluate for alarm conditions. + /// Task CheckObservationAlarm(PatientObservation obs4); /// @@ -74,6 +81,7 @@ public interface IAlarmService : IApiRequestService /// The patient to whom the observations and alarms belong. /// The timestamp associated with the message being processed. /// Optional additional observation data used during processing. + /// Task ProcessAlarmObservations(List alarmObservations, List observations, Patient patient, DateTime messageTime, ObservationData? observationData = null); diff --git a/adas-core.Application/Services/Interfaces/IAlertValuesService.cs b/adas-core.Application/Services/Interfaces/IAlertValuesService.cs index f7481b04..1fae21f5 100644 --- a/adas-core.Application/Services/Interfaces/IAlertValuesService.cs +++ b/adas-core.Application/Services/Interfaces/IAlertValuesService.cs @@ -11,5 +11,6 @@ public interface IAlertValuesService /// /// The identifier of the configuration observation to look up. /// A task that yields the matching , or null if no record is found. + /// Task FindByKey(ObjectId key); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IAppointmentService.cs b/adas-core.Application/Services/Interfaces/IAppointmentService.cs index c148b462..e9584952 100644 --- a/adas-core.Application/Services/Interfaces/IAppointmentService.cs +++ b/adas-core.Application/Services/Interfaces/IAppointmentService.cs @@ -12,12 +12,14 @@ public interface IAppointmentService : IApiRequestService /// /// The patient location used to filter and locate the relevant appointments. /// A task that represents the asynchronous operation, containing a list of items matching the given location. + /// Task> FindByLocation(PatientLocation location); /// /// Retrieves all appointments associated with the specified patient asynchronously. /// /// The identifier of the patient whose appointments are being retrieved. /// A task that represents the asynchronous operation, containing a list of entries for the patient. + /// Task> GetByPatient(ObjectId patientId); /// /// Retrieves the list of patient appointments scheduled for today for the specified patient. @@ -25,6 +27,7 @@ public interface IAppointmentService : IApiRequestService /// The unique identifier of the patient whose appointments are being queried. /// A cancellation token to observe while waiting for the task to complete. /// A task that represents the asynchronous operation, containing a list of entries for the given patient for the current day. + /// Task> GetTodayByPatient(ObjectId patientId, CancellationToken ct = default); /// /// Retrieves the list of patient appointments scheduled for today at the specified point of care. @@ -32,33 +35,39 @@ public interface IAppointmentService : IApiRequestService /// The identifier of the point of care whose appointments will be returned. /// The cancellation token used to cancel the asynchronous operation. /// A task that represents the asynchronous operation, containing a list of today's patient appointments for the specified point of care. + /// Task> GetTodayByPoc(ObjectId pocId, CancellationToken ct = default); /// /// Asynchronously finds all records associated with the specified patient identifier. /// /// The unique identifier of the patient whose appointments are being retrieved. /// A task that represents the asynchronous operation, containing an for iterating over the matching documents. + /// Task> FindByPatientIdAsync(ObjectId patientId); /// /// Asynchronously archives the specified patient, marking the record as archived in the system. /// /// The patient whose record should be archived. + /// Task Archive(Patient patient); /// /// Asynchronously archives records associated with the specified patient identifier. /// /// The of the patient whose related records should be archived. + /// Task ArchiveByPatientId(ObjectId id); /// /// Deletes a record associated with the specified patient identifier. /// /// The of the patient whose related record should be removed. + /// Task DeleteByPatientId(ObjectId id); /// /// Processes an incoming API request in the context of the specified patient, handling the required business logic and returning when the processing completes. /// /// The API request to be processed. /// The patient associated with the API request. + /// Task ProcessApiRequest(ApiRequest apiRequest, Patient patient); /// /// Updates multiple records by replacing the old with the new one for the field identified by . @@ -66,5 +75,6 @@ public interface IAppointmentService : IApiRequestService /// The name of the field whose value should be updated. /// The new value to set on matching records. /// The existing value to be replaced. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IArchivePatientCarePlanService.cs b/adas-core.Application/Services/Interfaces/IArchivePatientCarePlanService.cs index 118a996b..8cbb07b9 100644 --- a/adas-core.Application/Services/Interfaces/IArchivePatientCarePlanService.cs +++ b/adas-core.Application/Services/Interfaces/IArchivePatientCarePlanService.cs @@ -10,24 +10,28 @@ public interface IArchivePatientCarePlanService /// /// The unique identifier of the patient whose care plans are being retrieved. /// A task that represents the asynchronous operation. The task result contains a list of objects if found, or null if no care plans exist for the patient. + /// Task?> FindByPatientId(ObjectId id); /// /// Retrieves the list of care plans associated with the specified patient identifier. /// /// The unique identifier of the patient whose care plans should be retrieved. /// A task that returns a list of records for the patient, or null if no care plans are found. + /// Task?> FindByPatientId(string id); /// /// Retrieves a list of patient care plans associated with the specified patient number. /// /// The patient number used to locate the associated care plans. /// A task that returns a list of for the given patient number, or null if no care plans are found. + /// Task?> FindByPatientNumber(string id); /// /// Asynchronously retrieves all patient care plans. /// /// A task that represents the asynchronous operation, containing a list of objects. + /// Task> FindAll(); // Task UpdateTreatment(PatientCarePlan patientCarePla, List options); @@ -37,11 +41,13 @@ public interface IArchivePatientCarePlanService /// /// The patient care plan to insert. /// A that represents the asynchronous insert operation, containing the inserted or null if no entity was returned. + /// Task InsertOneAsync(PatientCarePlan patientCarePla); /// /// Asynchronously inserts a collection of patient care plans into the data store in a single bulk operation. /// /// The list of entities to be inserted. + /// Task InsertManyAsync(List patientCarePla); // Task Update(PatientCarePlan oldPatientCarePla, PatientCarePlan newPatientCarePla); diff --git a/adas-core.Application/Services/Interfaces/IArchivedPatientObservationService.cs b/adas-core.Application/Services/Interfaces/IArchivedPatientObservationService.cs index 4678f2c9..3d6d1291 100644 --- a/adas-core.Application/Services/Interfaces/IArchivedPatientObservationService.cs +++ b/adas-core.Application/Services/Interfaces/IArchivedPatientObservationService.cs @@ -10,5 +10,6 @@ public interface IArchivedPatientObservationService /// /// The unique identifier of the patient whose archived observations are to be retrieved. /// A task that represents the asynchronous operation, containing a list of objects representing the archived observations for the patient. + /// public Task> FindArchivedPatientObservationsFromPatient(ObjectId patientId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IArchivedPatientService.cs b/adas-core.Application/Services/Interfaces/IArchivedPatientService.cs index 09800f67..976dc2fe 100644 --- a/adas-core.Application/Services/Interfaces/IArchivedPatientService.cs +++ b/adas-core.Application/Services/Interfaces/IArchivedPatientService.cs @@ -8,5 +8,6 @@ public interface IArchivedPatientService /// Asynchronously retrieves all patients from the data store. /// /// A task that represents the asynchronous operation. The task result contains a list of all patients. + /// public Task> FindAllPatients(); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IArchivedPatientTreatmentService.cs b/adas-core.Application/Services/Interfaces/IArchivedPatientTreatmentService.cs index 4c775432..859bb2f8 100644 --- a/adas-core.Application/Services/Interfaces/IArchivedPatientTreatmentService.cs +++ b/adas-core.Application/Services/Interfaces/IArchivedPatientTreatmentService.cs @@ -10,5 +10,6 @@ public interface IArchivedPatientTreatmentService /// /// The unique identifier of the patient whose treatments are being retrieved. /// A task that represents the asynchronous operation, containing a list of records for the given patient. + /// Task> FindAllPatientTreatmentsByPatient(ObjectId patientId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IAuthService.cs b/adas-core.Application/Services/Interfaces/IAuthService.cs index ecd73f17..1bc35772 100644 --- a/adas-core.Application/Services/Interfaces/IAuthService.cs +++ b/adas-core.Application/Services/Interfaces/IAuthService.cs @@ -10,34 +10,40 @@ public interface IAuthService /// Asynchronously retrieves the current login response, returning null when no login state is available. /// /// A that resolves to the current , or null if no login response exists. + /// Task GetLoginResponse(); /// /// Asynchronously retrieves a token. /// /// A task that represents the asynchronous operation. The task result contains the retrieved token string. + /// Task GetToken(); /// /// Retrieves a list of authorizations associated with the specified unit identifier. /// /// The unique identifier of the unit whose authorizations are being queried. /// A task that represents the asynchronous operation, containing a list of objects matching the provided unit identifier. + /// Task> GetByUnitId(ObjectId unitId); /// /// Asynchronously deletes the record identified by the specified display identifier. /// /// The display identifier of the record to delete. /// A task that represents the asynchronous operation, containing a value indicating whether the record was successfully deleted. + /// Task DeleteByDisplayId(ObjectId displayId); /// /// Asynchronously deletes the entity associated with the specified unit identifier. /// /// The unique identifier of the unit whose associated entity should be deleted. /// A task that represents the asynchronous operation, containing a value indicating whether the deletion was successful. + /// Task DeleteByUnitId(ObjectId unitId); /// /// Retrieves the list of authorizations associated with the specified user identifier. /// /// The unique identifier of the user whose authorizations are being retrieved. /// A task that represents the asynchronous operation, containing the list of authorizations for the user. + /// Task> GetUserAuthorities(ObjectId id); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ICacheService.cs b/adas-core.Application/Services/Interfaces/ICacheService.cs index e33faafe..68cb4b35 100644 --- a/adas-core.Application/Services/Interfaces/ICacheService.cs +++ b/adas-core.Application/Services/Interfaces/ICacheService.cs @@ -11,12 +11,14 @@ namespace adas_core.Application.Services.Interfaces /// /// The identifier used to associate the value. /// The value to store for the specified key. + /// void SetValue(string key, string value); /// /// Retrieves the string value associated with the specified key. /// /// The key used to look up the value. /// The value associated with the key, or null if the key is not found. + /// string? GetValue(string key); /// /// Asynchronously retrieves an object associated with the specified , returning null if no entry is found. @@ -25,6 +27,7 @@ namespace adas_core.Application.Services.Interfaces /// The unique identifier of the object to retrieve. /// Indicates whether the expiration of the entry should be extended when it is successfully retrieved. Defaults to true. /// A task that represents the asynchronous retrieval operation. The task result contains the object of type associated with the key, or null if no matching entry exists. + /// Task GetObjectAsync(string key, bool updateExpiration = true); /// /// Asynchronously stores an object of type using the specified key, optionally updating its expiration time. @@ -33,6 +36,7 @@ namespace adas_core.Application.Services.Interfaces /// The identifier under which the object will be stored. /// The object to be stored. /// Specifies whether the expiration time of the entry should be refreshed. Defaults to true. + /// Task SetObjectAsync(string key, T obj, bool updateExpiration = true); /// /// Asynchronously retrieves an object of type associated with the specified . @@ -43,6 +47,7 @@ namespace adas_core.Application.Services.Interfaces /// An optional time-to-live value that overrides the default expiration period; if , the default TTL is used. /// A value indicating whether the object's expiration should be extended when it is successfully retrieved. /// A that represents the asynchronous operation, containing the retrieved object of type , or if the object is not found. + /// Task GetObjectAsync(string key, TimeSpan? ttlOverride, bool updateExpiration); /// /// Asynchronously stores the specified object associated with the given key, using an optional time-to-live override and expiration update behavior. @@ -52,21 +57,25 @@ namespace adas_core.Application.Services.Interfaces /// An optional that overrides the default time-to-live for the stored object. /// A value indicating whether the expiration of the stored object should be updated based on the provided TTL. /// A that represents the asynchronous storage operation. + /// Task SetObjectAsync(string key, T obj, TimeSpan? ttlOverride, bool updateExpiration); /// /// Asynchronously deletes an object identified by the specified key. /// /// The unique identifier of the object to delete. + /// Task DeleteObjectAsync(string key); /// /// Asynchronously deletes entries matching the specified pattern and returns the number of deleted items. /// /// The pattern used to match the entries to be deleted. /// A task that represents the asynchronous delete operation. The task result contains the total number of entries that were deleted. + /// Task DeleteByPatternAsync(string pattern); /// /// Clears the application cache, removing all cached entries. /// + /// void CleanCache(); @@ -80,6 +89,7 @@ namespace adas_core.Application.Services.Interfaces /// The asynchronous function invoked to produce the value when no cached entry exists for the specified key. /// An optional time-to-live duration that overrides the default expiration for the cached entry; when null, the default TTL is used. /// A task that represents the asynchronous operation. The result is the cached or freshly loaded string value, or null when no value is available. + /// Task GetOrSetValueAsync(string key, Func> loader, TimeSpan? ttlOverride = null); /// /// Asynchronously retrieves an object associated with the specified key from the cache, or invokes the factory to create and cache a new one when the key is not found. @@ -89,6 +99,7 @@ namespace adas_core.Application.Services.Interfaces /// The optional expiration period for the cached entry; if null, the default cache lifetime is applied. /// The token used to cancel the asynchronous operation. /// A task that resolves to the cached or newly created object of type . + /// Task GetOrSetObjectAsync( string key, Func> factory, @@ -105,6 +116,7 @@ namespace adas_core.Application.Services.Interfaces /// The optional time-to-live duration applied to the cached entry. /// The token to monitor for cancellation requests. /// A task containing the cached or newly created object of type . + /// Task GetOrSetObjectAsync( GroupedField groupedField, ObjectId patientId, diff --git a/adas-core.Application/Services/Interfaces/ICalculatedObservations.cs b/adas-core.Application/Services/Interfaces/ICalculatedObservations.cs index b94939bd..3b16a22d 100644 --- a/adas-core.Application/Services/Interfaces/ICalculatedObservations.cs +++ b/adas-core.Application/Services/Interfaces/ICalculatedObservations.cs @@ -13,18 +13,21 @@ public interface ICalculatedObservations /// The source patient observation to be mapped. /// When set to true, the mapping is performed considering only the observation name; otherwise, additional mapping criteria are applied. Defaults to false. /// A that represents the asynchronous mapping operation. The result is the mapped observation of type , or null when no matching mapping is found. + /// Task Map(T obs, bool onlyByName = false) where T : BasePatientObservation; /// /// Asynchronously maps the specified to a result. /// /// The patient treatment instance to map. /// A task that represents the asynchronous mapping operation. The task result contains the mapped . + /// Task Map(PatientTreatment treatment); /// /// Asynchronously maps a to a representation. /// /// The patient diagnosis to be mapped. /// A task that represents the asynchronous mapping operation, containing the mapped . + /// Task Map(PatientDiagnosis diagnosis); /// @@ -32,6 +35,7 @@ public interface ICalculatedObservations /// /// The to be mapped. /// A representing the asynchronous operation, containing the mapped . + /// Task Map(PumpObservation pumpObservation); /// @@ -39,12 +43,14 @@ public interface ICalculatedObservations /// /// The list of medicines currently active for the patient. /// The unique identifier of the patient whose observation is being calculated. + /// Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId); /// /// Calculates the active bolus for the specified patient. /// /// The unique identifier of the patient whose active bolus is to be calculated. + /// Task CalculateActiveBolus(ObjectId patientId); /// @@ -52,6 +58,7 @@ public interface ICalculatedObservations /// /// The unique identifier of the patient whose active treatments are being queried. /// A task that represents the asynchronous operation, containing a collection of nullable entries that represent the active treatments for the specified patient. + /// Task> GetActiveTreatmentsByPatient(ObjectId id); /// @@ -59,12 +66,14 @@ public interface ICalculatedObservations /// /// The new patient observation to validate and reconcile against the previous observation's time information. /// A task that yields the fixed , or null when no time inconsistency is detected or no correction is required. + /// Task FixTimeInconsistencyWithLast(PatientObservation newObservation); /// /// Performs pre-insertion mapping on a list of patient observations, transforming or preparing the data before it is persisted. /// /// The list of patient observations to be pre-mapped prior to insertion. /// A task that represents the asynchronous operation, containing the mapped list of patient observations. + /// Task> PreMapList(List listToInsert); /// /// Maps the source alarm onto the specified patient observation and returns the resulting observation. @@ -72,6 +81,7 @@ public interface ICalculatedObservations /// The patient observation to which the source alarm will be mapped. /// The patient observation alarm to insert and map as the source alarm. /// A task representing the asynchronous operation, containing the patient observation with the source alarm mapped. + /// Task MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert); /// @@ -80,5 +90,7 @@ public interface ICalculatedObservations /// The patient observation that triggered the alarm. /// The name associated with the alarm. /// An optional alarm code categorizing the type of alarm to send. + /// Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ICalculatedObservationsService.cs b/adas-core.Application/Services/Interfaces/ICalculatedObservationsService.cs index e6f28c76..e6aac281 100644 --- a/adas-core.Application/Services/Interfaces/ICalculatedObservationsService.cs +++ b/adas-core.Application/Services/Interfaces/ICalculatedObservationsService.cs @@ -12,6 +12,7 @@ public interface ICalculatedObservationsService /// The source to be mapped. /// When true, restricts the mapping to be performed by name only; otherwise, additional criteria are used. /// A that resolves to the mapped , or null if no match is found. + /// Task Map(PatientObservation obs, bool onlyByName = false); /// /// Asynchronously maps a instance, optionally performing the mapping @@ -23,41 +24,48 @@ public interface ICalculatedObservationsService /// full mapping logic is applied. Defaults to false. /// A task that represents the asynchronous operation. The task result contains the mapped /// , or null if no mapping is found. + /// Task Map(PatientObservationAlarm obs, bool onlyByName = false); /// /// Maps a instance to a projected representation asynchronously. /// /// The source to be mapped. /// A that represents the asynchronous mapping operation. The result is the mapped , or if no mapping could be produced. + /// Task Map(PatientTreatment treatment); /// /// Maps the provided to a result, returning when no mapping is produced. /// /// The source to be mapped. /// A containing the mapped , or if the mapping yields no result. + /// Task Map(PumpObservation obs); /// /// Asynchronously maps the specified to a resulting , returning when no mapping is produced. /// /// The source instance to map. /// A that contains the mapped , or if the source cannot be mapped. + /// Task Map(PatientRecordingAlert obs); /// /// Maps a instance to its corresponding representation, returning when no mapping is available. /// /// The source to map. /// A containing the mapped , or if the source cannot be mapped. + /// Task Map(PatientDiagnosis obs); /// /// Maps a list of patient observations for insertion, returning the transformed list asynchronously. /// /// The list of patient observations to be mapped for insertion. /// A task representing the asynchronous operation, containing the mapped list of patient observations. + /// Task> MapList(List listToInsert); /// /// Asynchronously calculates the bolus dose of opiates for the specified patient. /// /// The unique identifier of the patient for whom the bolus opiates calculation is performed. + /// Task CalculateBolusOpiates(ObjectId patientId); /// /// Asynchronously calculates medicine observations for a patient based on their active medicines. @@ -65,12 +73,14 @@ public interface ICalculatedObservationsService /// The list of medicines currently active for the patient. /// The unique identifier of the patient. /// A task that represents the asynchronous calculation operation. + /// Task CalculateMedicineObservation(List activeMedicines, ObjectId patientId); /// /// Retrieves the active patient treatments associated with the specified patient identifier. /// /// The unique identifier of the patient whose active treatments are being requested. /// A task that represents the asynchronous operation, containing an enumerable collection of active PatientTreatment entries for the patient. + /// Task> GetActiveTreatmentsByPatient(ObjectId id); /// /// Maps a source alarm from a onto a , producing an observation enriched with the corresponding alarm information. @@ -78,5 +88,6 @@ public interface ICalculatedObservationsService /// The patient observation that serves as the base for the mapping. /// The source alarm whose data is mapped onto the observation. /// A task that represents the asynchronous operation. The task result contains the populated with the mapped alarm data. + /// Task MapSourceAlarm(PatientObservation observation, PatientObservationAlarm observationAlarm); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ICameraService.cs b/adas-core.Application/Services/Interfaces/ICameraService.cs index bb490bc6..bfccb6a3 100644 --- a/adas-core.Application/Services/Interfaces/ICameraService.cs +++ b/adas-core.Application/Services/Interfaces/ICameraService.cs @@ -12,24 +12,28 @@ public interface ICameraService /// /// The unique identifier of the relay used to look up the camera. /// A task that represents the asynchronous operation. The task result contains the if a matching record is found; otherwise, null. + /// Task GetById(ObjectId relayId); /// /// Retrieves the list of cameras associated with the specified configuration relay identifiers. /// /// The list of configuration relay object identifiers used to look up the associated cameras. /// A list of cameras that correspond to the provided configuration relay identifiers. + /// List GetCameraInList(List configurationRelayList); /// /// Retrieves a paginated list of cameras based on the provided pagination filter. /// /// The pagination filter containing the page size, page number, and optional search criteria used to query cameras. /// A task that represents the asynchronous operation. The task result contains a with the requested page of cameras and pagination metadata. + /// Task> GetPaginatedCameras(PaginationFilter request); /// /// Inserts a new camera into the system asynchronously. /// /// The camera entity to insert. /// A task that represents the asynchronous operation. The task result contains the inserted camera with its generated identifier, or null if the camera could not be inserted. + /// Task InsertCamera(Camera camera); /// /// Updates an existing camera identified by the specified object identifier with the provided camera data. @@ -38,17 +42,20 @@ public interface ICameraService /// The unique identifier of the camera to update. /// The camera data containing the updated values to apply. /// A task that represents the asynchronous operation. The task result contains the updated camera, or if the camera was not found. + /// Task UpdateCameraById(ObjectId objectId, Camera camera); /// /// Deletes a camera identified by the specified object identifier. /// /// The unique identifier of the camera to delete. /// A task that represents the asynchronous delete operation. The result is true if the camera was successfully deleted; otherwise, false. + /// Task DeleteCamera(ObjectId objectId); /// /// Asynchronously retrieves a list of cameras whose names match the specified search text. /// /// The text used to search camera names. /// A task that represents the asynchronous operation. The task result contains a list of objects matching the search criteria; an empty list is returned if no matches are found. + /// Task> GetSearchByNameCameras(string textToSearch); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IClientMessageService.cs b/adas-core.Application/Services/Interfaces/IClientMessageService.cs index 30b571b3..4b49bf57 100644 --- a/adas-core.Application/Services/Interfaces/IClientMessageService.cs +++ b/adas-core.Application/Services/Interfaces/IClientMessageService.cs @@ -13,6 +13,7 @@ public interface IClientMessageService /// The optional operation type used to classify the message. /// The optional message payload to be sent. /// A task that represents the asynchronous send operation. + /// Task SendAsync(string receiverId, OperationType? type, object? msg); /// /// Asynchronously broadcasts a message of the specified operation type to all connected recipients. @@ -20,16 +21,20 @@ public interface IClientMessageService /// The operation type that classifies the broadcast message. /// The message payload to send, or null when no payload is required. /// A task that represents the asynchronous broadcast operation. + /// Task SendToAllAsync(OperationType type, object? msg); /// /// Processes an incoming message within the context of the specified connection. /// /// The message to be processed. /// The identifier of the connection context associated with the message. + /// Task ProcessMessage(Message msg, string contextConnectionId); /// /// Sends an update message to the specified list of patient location boxes. /// /// The list of patient locations that will receive the update message. + /// void SendUpdateMessageToBoxes(List boxes); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IConfigObservationService.cs b/adas-core.Application/Services/Interfaces/IConfigObservationService.cs index 407dbe70..3d2f88fa 100644 --- a/adas-core.Application/Services/Interfaces/IConfigObservationService.cs +++ b/adas-core.Application/Services/Interfaces/IConfigObservationService.cs @@ -19,6 +19,7 @@ public interface IConfigObservationService /// The coding system used to identify the configuration observation (e.g., ICD, SNOMED). /// The code within the given coding system that uniquely identifies the configuration observation. /// A if a match is found; otherwise, null. + /// Task GetByCodeSysAndCode(string codingSystem, string code); /// /// Asynchronously retrieves a identified by the given name. @@ -26,6 +27,7 @@ public interface IConfigObservationService /// /// The name of the configuration observation to retrieve. /// A that yields the matching , or if no observation is found. + /// Task Get(string name); /// @@ -34,6 +36,7 @@ public interface IConfigObservationService /// The patient observation whose corresponding configuration observation is being requested. /// When true, limits the lookup to a name-based match; otherwise, other matching criteria may be applied. /// A task that represents the asynchronous operation. The task result contains the matching , or null if no matching observation is found. + /// Task Get(T obs, bool onlyByName = false) where T : BasePatientObservation; /// @@ -41,6 +44,7 @@ public interface IConfigObservationService /// /// The patient observation of type on which retention actions will be executed. /// A task that represents the asynchronous retention operation. The task result contains the produced by the retention actions, or null when no retention result is produced. + /// Task RetentionActions(T obs) where T : BasePatientObservation; /// /// Maps a patient observation to a corresponding target observation of the same type, optionally restricting the lookup to name-based matching only. @@ -48,12 +52,14 @@ public interface IConfigObservationService /// The source patient observation to be mapped. /// When set to true, the mapping is performed using the observation's name only; otherwise, additional matching criteria are considered. Defaults to false. /// A task that represents the asynchronous operation. The task result contains the mapped patient observation of type , or null if no matching observation is found. + /// Task Map(T obs, bool onlyByName = false) where T : BasePatientObservation; /// /// Asynchronously maps the specified to a populated instance, returning when the treatment cannot be resolved. /// /// The to be mapped. /// A that yields the mapped , or if no mapping result is available. + /// Task Map(PatientTreatment treatment); /// @@ -66,6 +72,7 @@ public interface IConfigObservationService /// The optional minimum threshold for the value. /// The optional maximum threshold for the value. /// A task that represents the asynchronous operation. The task result contains the evaluated for the grouped observation. + /// Task GroupedObservationStatus(GroupedField groupedField, GroupedObservationEnum.Result result, string name, object value, double? min, double? max); @@ -74,64 +81,75 @@ public interface IConfigObservationService /// /// The cancellation token used to cancel the asynchronous operation. /// A task that represents the asynchronous operation. The task result contains a collection of objects representing all available configurations. + /// Task> GetAllConfigs(CancellationToken ct = default); /// /// Retrieves a paginated collection of items based on the supplied filter criteria. /// /// The pagination filter that defines the page size, page number, and query criteria used to retrieve the configuration observations. /// A task that represents the asynchronous operation, containing a with the requested items and pagination metadata. + /// Task> GetPaginatedItems(PaginationFilter filter); /// /// Retrieves all configuration observations in a compact format. /// /// A task representing the asynchronous operation that returns a containing the compact representation of all configuration observations. + /// Task GetAllCompact(); /// /// Retrieves a configuration observation by its unique identifier. /// /// The unique identifier of the configuration observation to retrieve. /// A task that represents the asynchronous operation. The task result contains the if a matching record is found, or null if no configuration exists for the specified id. + /// Task GetConfigById(ObjectId id); /// /// Asynchronously retrieves a list of configuration names associated with the specified identifier. /// /// The identifier used to look up the associated configuration names. /// A task that represents the asynchronous operation. The task result contains a list of configuration names. + /// Task> GetConfigNames(string id); /// /// Asynchronously retrieves the list of available configuration names. /// /// A task that represents the asynchronous operation, containing a list of configuration names. + /// Task> GetConfigNames(); /// /// Updates an existing configuration observation and returns the updated result. /// /// The configuration observation containing the data to update. /// A task that resolves to the updated , or null when no matching configuration is found. + /// Task UpdateConfig(ConfigObservation configObservation); /// /// Asynchronously creates a new configuration based on the provided observation data. /// /// The observation data used to create the configuration. /// A task that represents the asynchronous operation, containing the created , or null if the configuration could not be created. + /// Task CreateConfig(ConfigObservation configObservation); /// /// Asynchronously removes the configuration item with the specified name. /// /// The name of the configuration item to remove. /// A task that represents the asynchronous operation. The task result contains a describing the removed item, or null if no matching item was found. + /// Task RemoveConfigItem(string itemName); /// /// Asynchronously removes the configuration item identified by the specified identifier and returns the resulting observation. /// /// The unique identifier of the configuration item to remove. /// A task that represents the asynchronous operation. The task result contains the describing the removed configuration item, or null if no matching item was found. + /// Task RemoveConfigItem(ObjectId id); /// /// Retrieves the configuration observation items associated with the specified name. /// /// The name used to look up the configuration observation items. /// A task that represents the asynchronous operation. The result contains a collection of items matching the provided name, or null if no matching items are found. + /// Task?> GetConfigObservationItem(string name); /// @@ -142,6 +160,7 @@ public interface IConfigObservationService /// The name of the configuration observation item. /// The original name of the configuration observation item. /// A task that represents the asynchronous operation. The task result contains the matching , or null if no item is found. + /// Task GetSingleConfigObservationItem(string? code, string? codingSystem, string? name, string? originalName); @@ -150,11 +169,13 @@ public interface IConfigObservationService /// /// The configuration observation item to be deleted. /// A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the deletion was successful. + /// Task DeleteSingleConfigObservationItem(ConfigObservation configObservationItem); /// /// Retrieves configuration observation items that match the specified name. /// /// The name used to filter the configuration observation items. /// A task that represents the asynchronous operation. The task result contains the collection of items matching the specified name. + /// Task> GetConfigObservationItemsByName(string name); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IConfigPumpsService.cs b/adas-core.Application/Services/Interfaces/IConfigPumpsService.cs index fb73bade..bf1d61b4 100644 --- a/adas-core.Application/Services/Interfaces/IConfigPumpsService.cs +++ b/adas-core.Application/Services/Interfaces/IConfigPumpsService.cs @@ -11,11 +11,13 @@ public interface IConfigPumpsService /// /// The source PumpObservation to be mapped. /// A task that represents the asynchronous mapping operation, containing the resulting PumpObservation. + /// Task Map(PumpObservation obs); /// /// Retrieves all available pump configurations from the configuration store. /// /// A task containing a list of with all pump configurations, or null if no configurations are available. + /// Task?> GetAllPumpConfigs(); /// /// Asynchronously retrieves the configuration pump items associated with the specified identifier. @@ -23,36 +25,42 @@ public interface IConfigPumpsService /// /// The unique identifier used to look up the configuration items. /// A task containing a list of ConfigPumpItem objects if found, or null if no items exist for the specified id. + /// Task?> GetConfigItems(string id); /// /// Asynchronously retrieves the pump configuration that matches the specified identifier. /// /// The unique identifier of the pump configuration to look up. /// A task that represents the asynchronous operation. The task result contains the matching configuration if found; otherwise, null when no configuration exists for the given identifier. + /// Task GetPumpConfigById(string id); /// /// Updates the pump configuration asynchronously and returns the updated configuration. /// /// The pump configuration to update. /// A task that represents the asynchronous operation, containing the updated , or null if the configuration was not found. + /// Task UpdatePumpConfig(ConfigPumps pumpConfig); /// /// Inserts a new pump configuration into the data store. /// /// The pump configuration to insert. /// The inserted entity, or null if the insertion was not performed. + /// Task InsertPumpConfig(ConfigPumps pumpConfig); /// /// Asynchronously deletes the specified pump configuration. /// /// The pump configuration to delete. /// A task that represents the asynchronous operation. The task result contains a boolean indicating whether the deletion was successful. + /// Task DeletePumpConfig(ConfigPumps config); /// /// Asynchronously evaluates and applies retention actions for a pump observation, returning the resulting retention outcome. /// /// The pump observation to process for retention actions. /// A task that represents the asynchronous operation, containing the retention result, or null if no retention action applies. + /// Task RetentionActions(PumpObservation obs); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IConfigUnitsService.cs b/adas-core.Application/Services/Interfaces/IConfigUnitsService.cs index 2a3cfd4b..e7b2cd76 100644 --- a/adas-core.Application/Services/Interfaces/IConfigUnitsService.cs +++ b/adas-core.Application/Services/Interfaces/IConfigUnitsService.cs @@ -11,11 +11,13 @@ public interface IConfigUnitsService /// The specific patient observation type, constrained to . /// The patient observation instance to be mapped. /// A task that represents the asynchronous mapping operation, yielding the mapped patient observation. + /// Task Map(T obs) where T : BasePatientObservation; /// /// Asynchronously maps the specified to a resulting . /// /// The pump observation to be mapped. /// A task that represents the asynchronous mapping operation, containing the resulting . + /// Task Map(PumpObservation obs); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IDeviceService.cs b/adas-core.Application/Services/Interfaces/IDeviceService.cs index 71ded200..3f7a448f 100644 --- a/adas-core.Application/Services/Interfaces/IDeviceService.cs +++ b/adas-core.Application/Services/Interfaces/IDeviceService.cs @@ -11,18 +11,21 @@ public interface IDeviceService /// /// The data transfer object containing the information used to create the device. /// A task that represents the asynchronous create operation. The task result contains the created , or if the device could not be created. + /// Task Create(DeviceDto device); /// /// Asynchronously deletes the object identified by the specified identifier. /// /// The unique identifier of the object to delete. /// A task that represents the asynchronous delete operation. The result is true if the object was deleted; otherwise, false. + /// Task Delete(ObjectId objectId); /// /// Updates an existing device using the provided data transfer object. /// /// The data transfer object containing the updated device information. /// A task that represents the asynchronous operation. The task result contains the updated device, or null if the device was not found. + /// Task Update(DeviceDto device); /// /// Processes an incoming event for the specified device and returns the associated . @@ -30,5 +33,6 @@ public interface IDeviceService /// /// The device data transfer object carrying the event information to be processed. /// A task that represents the asynchronous operation, containing the resolved or null if no matching device was found. + /// Task ReceiveEvent(DeviceDto device); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IDiagnosisService.cs b/adas-core.Application/Services/Interfaces/IDiagnosisService.cs index 362419ef..a4f6d11a 100644 --- a/adas-core.Application/Services/Interfaces/IDiagnosisService.cs +++ b/adas-core.Application/Services/Interfaces/IDiagnosisService.cs @@ -11,33 +11,39 @@ public interface IDiagnosisService : IApiRequestService /// /// The unique identifier of the patient whose diagnoses are being retrieved. /// A task representing the asynchronous operation, containing a list of records for the specified patient; an empty list is returned if no diagnoses are found. + /// Task> GetByPatientId(ObjectId patientId); /// /// Deletes records associated with the specified patient identifier. /// /// The unique identifier of the patient whose related records should be removed. + /// Task DeleteByPatientId(ObjectId id); /// /// Asynchronously archives the specified patient, marking the patient record as archived rather than permanently deleting it. /// /// The patient to archive. + /// Task Archive(Patient patient); /// /// Archives the records associated with the specified patient identifier. /// /// The unique identifier of the patient whose records will be archived. + /// Task ArchiveByPatientId(ObjectId id); /// /// Processes a diagnosis observation for the specified patient based on the supplied API request data. /// /// The API request containing the diagnosis observation payload and contextual information to process. /// The patient to whom the diagnosis observation pertains. + /// Task ProcessDiagnosisObservation(ApiRequest apiRequest, Patient patient); /// /// Persists the specified API request along with its associated patient data. /// /// The API request to be saved. /// The patient associated with the API request. + /// Task SaveRequest(ApiRequest apiRequest, Patient patient); /// /// Processes the provided list of patient diagnoses for the specified patient at the given message time. @@ -45,6 +51,7 @@ public interface IDiagnosisService : IApiRequestService /// The list of patient diagnoses to be processed. /// The patient associated with the diagnoses. /// The timestamp of the message triggering the diagnosis processing. + /// Task ProcessDiagnosis(List diagnosis, Patient patient, DateTime messageTime); /// /// Updates multiple records by replacing the with the new in the field identified by . @@ -52,5 +59,6 @@ public interface IDiagnosisService : IApiRequestService /// The identifier of the field or property whose ObjectId values will be updated. /// The new ObjectId value to assign to the matching records. /// The existing ObjectId value to be replaced in the matching records. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IDischargeService.cs b/adas-core.Application/Services/Interfaces/IDischargeService.cs index f6eea063..e0cad345 100644 --- a/adas-core.Application/Services/Interfaces/IDischargeService.cs +++ b/adas-core.Application/Services/Interfaces/IDischargeService.cs @@ -14,56 +14,66 @@ public interface IDischargeService : IApiRequestService /// /// The unique identifier of the discharge to look up. /// A task that represents the asynchronous operation, containing the if found, or null when no record matches the provided identifier. + /// Task GetDischargeByIdAsync(ObjectId dischargeId); /// /// Asynchronously counts the number of discharge records associated with the specified unit. /// /// The identifier of the unit whose discharges should be counted. /// A task that represents the asynchronous operation, containing the total number of discharges for the specified unit. + /// Task CountDischargesByUnitId(ObjectId unitId); /// /// Asynchronously deletes a discharge record identified by the specified identifier. /// /// The unique identifier of the discharge to delete. + /// Task DeleteDischargeByIdAsync(ObjectId dischargeId); /// /// Asynchronously deletes the specified discharge record. /// /// The discharge entity to be removed. + /// Task DeleteDischargeAsync(Discharge discharge); /// /// Asynchronously updates an existing discharge record in the data store. /// /// The entity containing the updated information to persist. + /// Task UpdateDischargeAsync(Discharge discharge); /// /// Asynchronously retrieves a collection of discharge records. /// /// A task that represents the asynchronous operation. The task result contains an enumerable collection of objects. + /// Task> GetDischargesAsync(); /// /// Inserts a new discharge record into the data store. Returns the inserted entity, or if the record could not be created. /// /// The entity containing the data to be inserted. /// A that resolves to the inserted , or when the insertion does not produce a result. + /// Task InsertDischarge(Discharge discharge); /// /// Retrieves the discharge record associated with the specified patient location, returning null if no matching discharge is found. /// /// The patient location used to look up the discharge record. /// A task that represents the asynchronous operation. The task result contains the matching if found, or null if no discharge is associated with the specified location. + /// Task GetDischargeByLocation(PatientLocation location); /// /// Retrieves the discharge record associated with the specified patient identifier. /// /// The unique identifier of the patient whose discharge record is being requested. /// A that resolves to the matching if found; otherwise, null. + /// Task GetDischargeByPatientId(ObjectId patientId); /// /// Retrieves a discharge record associated with the specified point of care location identifier. /// /// The ObjectId of the point of care location used to look up the discharge. /// A task that represents the asynchronous operation. The task result contains the matching if found, or null if no discharge exists for the specified point of care location. + /// Task GetDischargeByPointOfCareId(ObjectId location); /// /// Retrieves the discharge associated with the specified point of care location, returning localized data for the requested locale. @@ -72,12 +82,14 @@ public interface IDischargeService : IApiRequestService /// The identifier of the point of care location whose discharge should be retrieved. /// The locale used to determine the language of the returned discharge data. /// A task containing the matching , or null if no discharge exists for the given location. + /// Task GetDischargeByPointOfCareIdWithLocale(ObjectId location, LocaleEnum dataLocale); /// /// Sends a broadcast notification for the specified discharge based on the given operation type. /// /// The discharge entity to be included in the broadcast. /// The type of operation (e.g., create, update, delete) that determines the broadcast context. + /// void SendDischargeBroadcast(Discharge discharge, OperationType operation); /// /// Updates a patient master list item change using the provided update options, applying the change across the specified unit list and master list type. @@ -85,6 +97,7 @@ public interface IDischargeService : IApiRequestService /// The update options describing the change to apply to the patient master list item. /// The collection of units to which the master list item change should be applied. /// The name of the master list type that identifies which list the item belongs to. + /// Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable unitList, string typeName); /// /// Deletes the specified patient master list item associated with the given option list and units. @@ -93,10 +106,12 @@ public interface IDischargeService : IApiRequestService /// The collection of units associated with the item to be deleted. /// The name of the type used to identify the patient master list item. /// A task that represents the asynchronous delete operation. + /// Task DeletePatientMasterListItem(OptionList opt, IEnumerable unitList, string typeName); /// /// Deletes discharge records associated with the specified unit identifier. /// /// The unique identifier of the unit whose discharge records should be removed. + /// Task DeleteDischargesByUnitId(ObjectId unitId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IDisplayConfigService.cs b/adas-core.Application/Services/Interfaces/IDisplayConfigService.cs index 88250a5c..330303f0 100644 --- a/adas-core.Application/Services/Interfaces/IDisplayConfigService.cs +++ b/adas-core.Application/Services/Interfaces/IDisplayConfigService.cs @@ -14,24 +14,28 @@ public interface IDisplayConfigService /// Retrieves all display configurations asynchronously. /// /// A task that represents the asynchronous operation. The task result contains a list of all entries. + /// Task> GetAll(); /// /// Retrieves a paginated list of display configurations in a compact (minimal) representation. /// /// The pagination filter that controls page size, page number, and sorting criteria. /// A task that represents the asynchronous operation, containing a with the compact display configuration entries. + /// Task> GetAllCompactPaginated(PaginationFilter request); /// /// Retrieves a list of display configurations filtered by the specified display type. /// /// The display type used to filter the configurations. /// A task that represents the asynchronous operation, containing a list of objects matching the specified type. + /// Task> GetByType(DisplayConfigEnums.DisplayType type); /// /// Asynchronously retrieves a by its identifier. /// /// The unique identifier of the display configuration to retrieve. /// A task that represents the asynchronous operation, containing the matching the specified identifier. + /// Task GetById(ObjectId id); /// /// Asynchronously retrieves a identified by the specified configuration identifier, unit identifier, and display type. @@ -40,23 +44,27 @@ public interface IDisplayConfigService /// The identifier of the unit the display configuration belongs to. /// The display type used to filter or scope the lookup. /// A that resolves to the matching , or null if no configuration is found. + /// Task GetById(ObjectId? configId, ObjectId unitId, DisplayConfigEnums.DisplayType displayType); /// /// Inserts a single display configuration asynchronously and returns the resulting configuration, or null when no record is produced. /// /// The display configuration to insert. /// A task that represents the asynchronous insert operation, containing the inserted or null. + /// Task InsertOne(DisplayConfig config); /// /// Inserts a new display configuration in a minimal fashion and returns the created , or null when no configuration could be produced. /// /// The data transfer object containing the values used to create the new display configuration. /// A that yields the created when successful, or null when no result is available. + /// Task InsertOneMinimal(CreateDisplayConfigDto config); /// /// Performs a test insertion operation that returns a instance, used to validate insertion behavior. /// /// A representing the asynchronous test insertion result. + /// Task InsertOneTest(); /// /// Updates the display configuration identified by the specified identifier with the provided new configuration data. @@ -64,6 +72,7 @@ public interface IDisplayConfigService /// The unique identifier of the display configuration to update. /// The new display configuration data to apply to the existing configuration. /// The updated , or null if no display configuration with the specified identifier is found. + /// Task UpdateConfig(ObjectId displayConfigId, object newDisplayConfig); /// /// Updates the list of fields associated with the specified configuration display. @@ -71,6 +80,7 @@ public interface IDisplayConfigService /// The identifier of the configuration display whose field list will be updated. /// The list of fields to be applied to the configuration display. /// A task that represents the asynchronous operation. The task result contains a value indicating whether the update was successful. + /// Task UpdateFieldList(ObjectId objectIdConfigDisplay, List fields); /// /// Updates the color configuration for the specified config display. @@ -78,6 +88,7 @@ public interface IDisplayConfigService /// The identifier of the config display whose color configuration will be updated. /// The color configuration data to apply to the config display. /// A task that represents the asynchronous operation. The task result contains true if the update was successful; otherwise, false. + /// Task UpdateConfigColor(ObjectId objectIdConfigDisplay, ColorConfig colorConfigDto); /// /// Asynchronously updates the header configuration associated with the specified config display identifier. @@ -85,6 +96,7 @@ public interface IDisplayConfigService /// The identifier of the config display whose header configuration will be updated. /// The new header configuration to apply. /// A task that represents the asynchronous operation. The task result contains true if the update was successful; otherwise, false. + /// Task UpdateHeaderConfig(ObjectId objectIdConfigDisplay, HeaderConfig headerConfig); /// /// Updates the home banner configuration for the specified config display with the provided list of banner items. @@ -92,12 +104,14 @@ public interface IDisplayConfigService /// The identifier of the config display whose home banner will be updated. /// The list of banner items to set as the home banner configuration. /// A task that represents the asynchronous operation. The task result contains true if the home banner was updated successfully; otherwise, false. + /// Task UpdateSetHomeBanner(ObjectId objectIdConfigDisplay, List bannerItems); /// /// Updates the base display configuration with the specified settings. /// /// The display configuration to apply as the new base configuration. /// A task that represents the asynchronous update operation. The task result contains a boolean value indicating whether the update was successful. + /// Task UpdateBaseConfig(DisplayConfig baseConfig); /// /// Asynchronously updates the hospital name associated with the specified display configuration. @@ -105,29 +119,34 @@ public interface IDisplayConfigService /// The identifier of the display configuration whose hospital name will be updated. /// The new hospital name to apply to the display configuration. /// A task that resolves to true if the update was applied successfully; otherwise, false. + /// Task UpdateDisplayConfigHospitalName(ObjectId objectIdConfigDisplay, string name); /// /// Deletes a display configuration identified by the specified object identifier. /// /// The unique identifier of the display configuration to delete. /// A task that represents the asynchronous delete operation. The task result contains a boolean value indicating whether the display configuration was successfully deleted. + /// Task DeleteDisplayConfig(ObjectId objectIdConfigDisplay); /// /// Asynchronously retrieves the default display configuration for the specified display type. /// /// The display type used to look up the default configuration. /// A task that represents the asynchronous operation, containing the default for the given display type, or null if no default configuration is available. + /// Task GetDefaultConfig(DisplayConfigEnums.DisplayType type); /// /// Retrieves the list of display configuration locations associated with the specified configuration display identifier. /// /// The ObjectId of the configuration display whose locations are to be retrieved. /// A task that represents the asynchronous operation, containing a list of DisplayConfigLocationDto objects for the specified configuration display. + /// Task> GetDisplayConfigLocations(ObjectId objectIdConfigDisplay); /// /// Asynchronously retrieves all display configurations in a compact (minimal) representation. /// /// A task that represents the asynchronous operation. The task result contains a list of objects representing the compact display configurations. + /// Task> GetAllCompact(); /// @@ -137,6 +156,7 @@ public interface IDisplayConfigService /// The type of display configuration template to use for the insertion. /// The optional hospital identifier used to scope the configuration; may be null when the configuration is not hospital-specific. /// A task that represents the asynchronous operation, containing the inserted , or null if the configuration could not be created. + /// Task InsertOneWithTemplate(string objectId, DisplayConfigEnums.DisplayType configType, string? configHospital); @@ -145,17 +165,20 @@ public interface IDisplayConfigService /// /// The card configuration to be updated. /// A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the update was successful. + /// Task UpdateCardConfig(CardConfig baseConfig); /// /// Inserts a new card configuration using the supplied data and returns the resulting , or null if no card config is created. /// /// The DTO containing the data used to create the display config card. /// A task that resolves to the inserted , or null if the insert did not produce a card config. + /// Task InsertCardConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto); /// /// Asynchronously retrieves all card configurations. /// /// A task that represents the asynchronous operation. The task result contains a list of all items. + /// Task> GetCardConfigAll(); /// /// Retrieves the card configuration associated with the specified identifier. @@ -163,41 +186,48 @@ public interface IDisplayConfigService /// /// The unique identifier of the card configuration to retrieve. /// A task that represents the asynchronous operation. The task result contains the if found; otherwise, null. + /// Task GetCardConfigById(ObjectId id); /// /// Asynchronously updates the card details configuration based on the provided base configuration. /// /// The base card details configuration to apply during the update. /// A task that represents the asynchronous operation, containing a boolean value indicating whether the update was successful. + /// Task UpdateDetailConfig(CardDetailsConfig baseConfig); /// /// Inserts a new card detail configuration based on the provided display config data. /// /// The DTO containing the data required to create the card detail configuration. /// A task that resolves to the created , or null if the configuration could not be inserted. + /// Task InsertCardDetailConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto); /// /// Inserts a new chart configuration based on the provided display config card data. /// /// The data transfer object containing the details of the chart configuration to create. /// A task that represents the asynchronous operation, containing the newly inserted , or null if the insertion was not successful. + /// Task InsertChartConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto); /// /// Asynchronously updates the chart configuration based on the provided base configuration and returns a value indicating whether the update was successful. /// /// The base chart configuration to apply during the update. /// A task that represents the asynchronous operation. The result is true if the chart configuration was updated successfully; otherwise, false. + /// Task UpdateChartConfig(ChartConfig baseConfig); /// /// Asynchronously deletes a chart configuration identified by the specified configuration display identifier. /// /// The of the chart configuration display to delete. /// A task that represents the asynchronous delete operation, containing a value indicating whether the deletion was successful. + /// Task DeleteChartConfig(ObjectId objectIdConfigDisplay); /// /// Asynchronously retrieves the chart configuration associated with the specified chart identifier. /// /// The unique identifier of the chart whose configuration should be fetched. /// A task that represents the asynchronous operation. The task result contains the associated with the provided identifier, or null if no configuration is found. + /// Task GetChartConfig(ObjectId objectIdConfigChart); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IDisplayService.cs b/adas-core.Application/Services/Interfaces/IDisplayService.cs index b52404f1..93db9017 100644 --- a/adas-core.Application/Services/Interfaces/IDisplayService.cs +++ b/adas-core.Application/Services/Interfaces/IDisplayService.cs @@ -16,6 +16,7 @@ public interface IDisplayService /// Asynchronously retrieves all displays in a compact format containing only minimal identifying information. /// /// A task that represents the asynchronous operation. The task result contains a list of objects representing all available displays in a compact projection. + /// Task> GetAllCompact(); /// /// Retrieves all displays along with their associated permissions for the specified user. @@ -23,30 +24,35 @@ public interface IDisplayService /// /// The username used to look up the associated displays and permissions. May be null. /// A task that represents the asynchronous operation, containing a list of entries for the user. + /// Task> GetAllByUser(string? userName); /// /// Asynchronously retrieves a list of entries filtered by the specified display type. /// /// The display type used to filter the returned collection. /// A task that represents the asynchronous operation, containing the list of items matching the specified type. + /// Task> GetByType(DisplayConfigEnums.DisplayType type); /// /// Asynchronously retrieves the list of displays associated with the specified point of care. /// /// The point of care used to filter the displays to be returned. /// A task that represents the asynchronous operation, containing the list of items linked to the given point of care. + /// Task> GetByPointOfCare(PointOfCare pointOfCare); /// /// Retrieves a list of displays associated with the specified configuration identifier. /// /// The unique identifier of the configuration used to filter the displays. /// A task that represents the asynchronous operation. The task result contains a list of displays matching the specified configuration identifier. + /// Task> GetByConfigId(ObjectId configId); /// /// Retrieves a list of entities associated with the specified card configuration identifier. /// /// The unique identifier of the card configuration whose associated displays are to be retrieved. /// A task that represents the asynchronous operation, containing a list of objects linked to the given card configuration. + /// Task> GetByCardConfigId(ObjectId configId); // Task> GetByUser(); @@ -56,12 +62,14 @@ public interface IDisplayService /// /// The name of the display to look up. /// A that resolves to the matching , or null if none is found. + /// Task GetByName(string name); /// /// Retrieves a entity by its unique identifier. /// /// The unique identifier of the display to retrieve. /// A task that represents the asynchronous operation. The task result contains the if found; otherwise, null. + /// Task GetById(ObjectId id); /// /// Asynchronously retrieves a display representation of an entity along with its associated permissions, localized for the specified locale. @@ -69,12 +77,14 @@ public interface IDisplayService /// The unique identifier of the entity to retrieve. /// The locale used to localize the returned display data. /// A task that represents the asynchronous operation, containing the localized display data with permissions. + /// Task GetByIdWithPermissions(ObjectId id, LocaleEnum localeEnum); /// /// Asynchronously counts the number of displays associated with the specified unit identifier. /// /// The unique identifier of the unit whose displays should be counted. /// A task that represents the asynchronous operation. The task result contains the count of displays linked to the specified unit. + /// Task CountDisplaysByUnitId(ObjectId unitId); /// @@ -90,6 +100,7 @@ public interface IDisplayService /// When true, includes the display configuration in the result. /// Token used to cancel the asynchronous operation. /// A that resolves to the if found, or null if no display matches the specified . + /// Task GetInfo( ObjectId id, string? userName, @@ -111,6 +122,7 @@ public interface IDisplayService /// The user name used to resolve user-specific sections, or null if not applicable. /// The list of authorizations used to authorize and filter the returned sections, or null if no authorization filtering is required. /// A task that yields the list of instances matching the supplied criteria. + /// Task> GetDisplaySectionByUser( DisplayConfigEnums.DisplayType type, ObjectId? currentDisplay, @@ -121,12 +133,14 @@ public interface IDisplayService /// Asynchronously retrieves all display sections as a minimal display list. /// /// A task that represents the asynchronous operation, containing the with the display section data. + /// Task GetAllDisplaySection(); /// /// Retrieves a list of records associated with the specified unit identifier. /// /// The that identifies the unit whose displays are being requested. /// A task that represents the asynchronous operation, containing a of displays linked to the given unit. + /// Task> GetByUnitId(ObjectId id); /// /// Retrieves all available Points of Contact (POCs) along with their associated unit information, optionally filtered by the provided display identifiers and allowing exclusion of virtual entries. @@ -134,23 +148,27 @@ public interface IDisplayService /// The list of display identifiers used to filter the available POCs. /// When set to true, excludes virtual POCs from the results; otherwise, virtual POCs are included. /// A task that represents the asynchronous operation. The task result contains a with the matching POCs and their unit details. + /// Task GetAllAvailablePoc(List displayIds, bool excludeVirtual = false); /// /// Asynchronously retrieves all Points of Care (POCs) associated with the specified display identifier. /// /// The display identifier used to look up the associated Points of Care. /// A task representing the asynchronous operation, containing a list of Points of Care matching the specified display identifier. + /// Task> GetAllPocsByDisplayId(ObjectId id); /// /// Inserts a new display record into the data store and returns the persisted entity. /// /// The display entity to insert. /// A task that represents the asynchronous operation, containing the inserted . + /// Task InsertOne(Display display); /// /// Asynchronously inserts a single test record and returns the persisted result. /// /// A that represents the asynchronous insert operation, containing the inserted . + /// Task InsertOneTest(); /// /// Updates the configuration of an existing display using the provided new configuration. @@ -158,6 +176,7 @@ public interface IDisplayService /// The current display whose configuration will be updated. /// The new display configuration to apply, or null to leave the configuration unchanged. /// A task that represents the asynchronous operation. The task result contains the updated , or null if the update was not performed. + /// Task UpdateConfig(Display oldDisplay, DisplayConfig? newDisplayConfig); /// /// Updates the configuration identifier associated with the specified display. @@ -165,6 +184,7 @@ public interface IDisplayService /// The existing display whose configuration identifier will be updated. /// The new configuration identifier to associate with the display. /// A task that resolves to the updated , or null if no result is available. + /// Task UpdateConfigId(Display oldDisplay, ObjectId configId); /// /// Updates the point of care list associated with the specified object identifier, replacing or merging it with the provided list of point of care object identifiers. @@ -172,6 +192,7 @@ public interface IDisplayService /// The identifier of the object whose point of care list is being updated. /// The collection of point of care object identifiers to apply to the target object. /// A task that represents the asynchronous operation, containing the resulting when the update succeeds, or null when no matching object is found. + /// Task UpdatePointOfCareList(ObjectId objectId, List listPocObId); /// /// Updates the configuration preset associated with the specified display using the provided configuration display. @@ -179,6 +200,7 @@ public interface IDisplayService /// The unique identifier of the display whose configuration preset will be updated. /// The unique identifier of the configuration display to apply as the preset. /// A task that resolves to the updated , or null if no matching display is found. + /// Task UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay); /// /// Updates the name of the entity identified by the given identifier and returns the resulting . @@ -186,34 +208,40 @@ public interface IDisplayService /// The identifier of the entity whose name should be updated. /// The new name to apply to the entity. /// A task that represents the asynchronous update operation, containing the updated or null if no entity was found. + /// Task UpdateName(ObjectId id, string name); /// /// Retrieves a paginated collection of displays based on the provided filter criteria. /// /// The pagination filter that defines the page size, page number, and any additional filtering criteria for the display results. /// A task that represents the asynchronous operation, containing a with the requested page of displays and pagination metadata. + /// Task> GetPaginatedDisplays(PaginationFilter filter); /// /// Asynchronously deletes the display identified by the specified identifier. /// /// The unique identifier of the display to delete. /// A task that represents the asynchronous operation, containing a value indicating whether the display was successfully deleted. + /// Task DeleteDisplay(ObjectId id); /// /// Retrieves the list of display configuration locations associated with the specified display configuration. /// /// The unique identifier of the display configuration whose locations are being retrieved. /// A task that represents the asynchronous operation, containing a list of objects for the specified display configuration. + /// Task> GetDisplayConfigLocations(ObjectId displayConfigId); /// /// Asynchronously determines whether the specified display configuration is currently in use. /// /// The identifier of the display configuration to check. /// A task that represents the asynchronous operation. The task result is true if the display configuration is in use; otherwise, false. + /// Task IsDisplayConfigInUse(ObjectId displayConfigId); /// /// Deletes display records associated with the specified unit identifier. /// /// The identifier of the unit whose displays should be removed. + /// Task DeleteDisplaysByUnitId(ObjectId unitId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IFileService.cs b/adas-core.Application/Services/Interfaces/IFileService.cs index a4289992..b2b11f19 100644 --- a/adas-core.Application/Services/Interfaces/IFileService.cs +++ b/adas-core.Application/Services/Interfaces/IFileService.cs @@ -13,6 +13,7 @@ public interface IFileService /// /// The collection of update files to be copied. /// A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the copy operation succeeded. + /// Task CopyUpdateFiles(ICollection files); /// /// Uploads the provided asset files categorized by the specified theme, returning a value indicating whether the operation completed successfully. @@ -20,12 +21,14 @@ public interface IFileService /// The collection of uploaded form files to process and store as assets. /// The asset theme used to classify and organize the uploaded files. /// A task that resolves to true if the asset files were uploaded successfully; otherwise, false. + /// Task UploadAssetFiles(ICollection files, FileEnum.AssetTheme themeParse); /// /// Retrieves all asset files for the specified asset theme as a list of asset data transfer objects. /// /// The asset theme used to retrieve the corresponding assets. /// A containing the asset data transfer objects for the specified theme. + /// List GetAllAssetFile(FileEnum.AssetTheme themeParse); /// @@ -33,5 +36,6 @@ public interface IFileService /// /// The path of the directory from which to retrieve the files. /// A list of strings representing the names of the files in the specified directory. + /// List GetFilesInDirectory(string directoryPath); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IGroupedObservationService.cs b/adas-core.Application/Services/Interfaces/IGroupedObservationService.cs index 8b7d2423..0484103c 100644 --- a/adas-core.Application/Services/Interfaces/IGroupedObservationService.cs +++ b/adas-core.Application/Services/Interfaces/IGroupedObservationService.cs @@ -16,6 +16,8 @@ public interface IGroupedObservationService /// Indicates whether the cache should be consulted before generating the result. Defaults to false. /// The cancellation token used to cancel the operation. /// A task that represents the asynchronous generation, producing the resulting . + /// Task GenerateGroupedObservation(ObjectId id, GroupedField groupedField, string timeZoneId = "Romance Standard Time", bool cacheIsChecked = false, CancellationToken ct = default); @@ -30,6 +32,7 @@ public interface IGroupedObservationService /// The patient observation to be processed and grouped. /// The time zone identifier used when computing date and time values for the grouped observation. Defaults to "Romance Standard Time". /// A that resolves to the generated grouped observation for the patient. + /// Task GenerateGroupedObservation(ObjectId obsPatientId, GroupedField groupedField, List wsgLastGroupedObservationObs, PatientObservation obs, string timeZoneId = "Romance Standard Time"); @@ -41,6 +44,7 @@ public interface IGroupedObservationService /// The maximum number of recent observations to return. Defaults to 2. /// An optional list of observation names to include; if null, all observation types are considered. /// A task that resolves to a list of the most recent entries for the patient. + /// Task> FindLastObservations(ObjectId patientId, int num = 2, List? filterObservations = null); @@ -49,6 +53,7 @@ public interface IGroupedObservationService /// /// The grouped web service subscriber for which the next empty observation is created. /// A task that represents the asynchronous operation, containing the newly created . + /// Task CreateNextEmptyObs(WsSubscriberGrouped ws); /* * diff --git a/adas-core.Application/Services/Interfaces/IHistoricalConfigChangesService.cs b/adas-core.Application/Services/Interfaces/IHistoricalConfigChangesService.cs index d8c16c78..178b5bec 100644 --- a/adas-core.Application/Services/Interfaces/IHistoricalConfigChangesService.cs +++ b/adas-core.Application/Services/Interfaces/IHistoricalConfigChangesService.cs @@ -10,6 +10,7 @@ public interface IHistoricalConfigChangesService /// Asynchronously retrieves all historical configuration changes recorded in the system. /// /// A task that represents the asynchronous operation. The task result contains a collection of all entries. + /// Task> GetAll(); /// /// Asynchronously retrieves a historical configuration change entry by its unique identifier. @@ -17,6 +18,7 @@ public interface IHistoricalConfigChangesService /// /// The unique identifier of the historical configuration change to retrieve. /// A task that represents the asynchronous operation, containing the matching or null if not found. + /// Task Get(ObjectId id); /// /// Asynchronously retrieves a collection of historical configuration changes filtered by the specified configuration type. @@ -24,6 +26,7 @@ public interface IHistoricalConfigChangesService /// The configuration type used to filter the historical changes. /// The maximum number of historical change records to return. /// A task that represents the asynchronous operation, containing a collection of for the specified type. + /// Task> GetByType(DisplayConfigEnums.ConfigTypes type, int num); /// @@ -34,6 +37,7 @@ public interface IHistoricalConfigChangesService /// The optional configuration type used to filter the results; if null, changes for all configuration types are returned. /// The maximum number of historical configuration change records to return. /// A task that represents the asynchronous operation, containing the collection of historical configuration changes matching the specified criteria. + /// Task> GetByUser(string user, DisplayConfigEnums.ConfigTypes? configTypes, int num); @@ -43,6 +47,7 @@ public interface IHistoricalConfigChangesService /// /// The configuration type used to look up the most recent historical changes. /// A task that represents the asynchronous operation. The task result contains the last for the specified type, or null if no changes are available. + /// Task FindLastConfigChanges(DisplayConfigEnums.ConfigTypes configTypes); @@ -52,18 +57,21 @@ public interface IHistoricalConfigChangesService /// /// The historical configuration change entity to be inserted. /// A task that represents the asynchronous operation, containing the inserted entity, or null if the insertion did not produce a result. + /// Task InsertOne(HistoricalConfigChanges historicalConfigChanges); /// /// Updates an existing historical configuration change record with the provided data and returns the updated entity. /// /// The historical configuration change entity containing the updated values to be persisted. /// A task that resolves to the updated , or null if the record was not found. + /// Task UpdateHistoricalConfigChange(HistoricalConfigChanges historicalConfigChanges); /// /// Deletes a historical configuration change identified by the specified identifier. /// /// The identifier of the historical configuration change to delete. + /// Task DeleteHistoricalConfigChange(ObjectId id); /// @@ -73,5 +81,6 @@ public interface IHistoricalConfigChangesService /// The type of configuration that was changed. /// The new configuration value after the change. /// The previous configuration value before the change. + /// Task LogConfigChanged(string user, DisplayConfigEnums.ConfigTypes configType, string newConfig, string oldConfig); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ILightBeaconService.cs b/adas-core.Application/Services/Interfaces/ILightBeaconService.cs index acc6bba0..38889167 100644 --- a/adas-core.Application/Services/Interfaces/ILightBeaconService.cs +++ b/adas-core.Application/Services/Interfaces/ILightBeaconService.cs @@ -14,6 +14,7 @@ public interface ILightBeaconService /// /// The identifier of the point of control that targets the light beacon. /// The color to apply to the light beacon. + /// Task SendColor(ObjectId pocId, LightBeaconColor color); /// /// Sends a color command to the light beacon of the specified point of care device, @@ -22,34 +23,41 @@ public interface ILightBeaconService /// The identifier of the point of care device whose light beacon will be updated. /// The color to apply to the light beacon. /// A task that represents the asynchronous color send operation. + /// Task SendColor(PointOfCare pocId, LightBeaconColor color); /// /// Sends a light beacon broadcast for the specified point of care, setting the beacon to display the specified color. /// /// The point of care device or location whose beacon will be updated. /// The color to display on the light beacon. + /// Task SendBeaconBroadcast(PointOfCare poc, LightBeaconColor color); /// /// Sends a broadcast signal to the beacon associated with the specified point of care identifier using the given beacon color. /// /// The identifier of the point of care (or beacon) that will receive the broadcast. /// The color of the light beacon used for the broadcast. + /// Task SendBeaconBroadcast(ObjectId poc, LightBeaconColor color); /// /// Asynchronously powers off the LED associated with the specified point of connection identifier. /// /// The identifier of the point of connection whose LED will be turned off. + /// Task PowerOffLed(ObjectId pocId); /// /// Asynchronously powers off the LED indicator associated with the specified point of care. /// /// The point of care whose LED indicator should be turned off. + /// Task PowerOffLed(PointOfCare poc); /// /// Generates a color-coded alert based on the provided patient observation. /// /// The patient observation used to determine the alert level and color. + /// void GenerateColorAlert(PatientObservation obs); //TODO refactor, one patient can have multiple beacons @@ -58,12 +66,14 @@ public interface ILightBeaconService /// /// The identifier of the point of care whose light beacon color is being requested. /// A task that represents the asynchronous operation, containing the for the specified point of care. + /// public Task GetColor(ObjectId pocId); /// /// Asynchronously retrieves the light beacon color associated with the specified point of care. /// /// The point of care for which to look up the light beacon color. /// A task that represents the asynchronous operation. The task result contains the for the specified point of care. + /// public Task GetColor(PointOfCare poc); /// /// Updates a single light beacon record in the data store. @@ -71,23 +81,27 @@ public interface ILightBeaconService /// /// The light beacon containing the updated values to persist. /// A task that represents the asynchronous operation, containing the updated , or if no matching beacon was found. + /// Task UpdateOne(LightBeacon beacon); /// /// Inserts a single light beacon into the data store. /// /// The light beacon entity to insert. /// A task that resolves to the inserted , or null when no result is produced. + /// Task InsertOne(LightBeacon beacon); /// /// Asynchronously retrieves a paginated collection of light beacons based on the specified pagination filter. /// /// The pagination filter containing the criteria used to page the beacon results. /// A task that represents the asynchronous operation, containing a pagination response with the requested light beacons. + /// Task> GetPaginatedBeacons(PaginationFilter request); /// /// Asynchronously searches for light beacons by name using the specified search text. /// /// The text used to search for matching light beacons by name. /// A task that represents the asynchronous operation. The task result contains a list of objects matching the search criteria. + /// Task> GetSearchByName(string textToSearch); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ILocalAuditService.cs b/adas-core.Application/Services/Interfaces/ILocalAuditService.cs index d9e36dbd..4a91ff80 100644 --- a/adas-core.Application/Services/Interfaces/ILocalAuditService.cs +++ b/adas-core.Application/Services/Interfaces/ILocalAuditService.cs @@ -12,11 +12,13 @@ public interface ILocalAuditService /// The modified state of the data after the change. May be null when the action deletes an existing record. /// An optional explanation or justification for the change. Defaults to null when no reason is provided. /// A task that represents the asynchronous creation of the audit log entry. + /// Task CreateAuditLogAsync(ClaimsPrincipal? user, object? dataOriginal, object? dataModified, string? reason = null); /// /// Asynchronously creates a deep copy of the specified data, producing a new independent instance of the same type. /// /// The data instance to be deep copied. /// A task that represents the asynchronous operation, containing the deep-copied instance of type , or null if the copy could not be produced. + /// Task DeepCopyAsync(T data); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ILockProvider.cs b/adas-core.Application/Services/Interfaces/ILockProvider.cs index 18f310ed..3b815a25 100644 --- a/adas-core.Application/Services/Interfaces/ILockProvider.cs +++ b/adas-core.Application/Services/Interfaces/ILockProvider.cs @@ -10,11 +10,14 @@ /// /// Intenta adquirir el lock para una clave dentro del timeout. /// + /// Task AcquireAsync(string key, TimeSpan timeout); /// /// Libera el lock para la clave (idempotente). /// + /// Task ReleaseAsync(string key); } } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IMasterListService.cs b/adas-core.Application/Services/Interfaces/IMasterListService.cs index 2023a50d..f79d28c9 100644 --- a/adas-core.Application/Services/Interfaces/IMasterListService.cs +++ b/adas-core.Application/Services/Interfaces/IMasterListService.cs @@ -13,17 +13,20 @@ public interface IMasterListService where T : MasterList /// Asynchronously retrieves the complete master list of items of type . /// /// A task that represents the asynchronous operation. The task result contains an with all items from the master list. + /// Task> GetAllMasterList(); /// /// Retrieves all master list entries, excluding items categorized as options. /// /// A task that represents the asynchronous operation. The task result contains a collection of items representing the master list without options. + /// Task> GetAllMasterListWithoutOptions(); /// /// Retrieves a paginated collection of master list items with their associated options based on the specified pagination filter. /// /// The pagination filter containing paging criteria such as page number and page size. /// A task that represents the asynchronous operation, containing an enumerable collection of items for the requested page. + /// Task> GetAllMasterListWithPaginatedOptions(PaginationFilter request); /// /// Retrieves a master list entry identified by the specified , optionally resolving localized content based on the provided . Returns null when no matching entry is found. @@ -31,6 +34,7 @@ public interface IMasterListService where T : MasterList /// The unique identifier of the master list entry to retrieve. /// The optional locale used to resolve localized fields; when null, a default or non-localized representation is returned. /// A task that resolves to the matching master list entry of type , or null if the entry does not exist. + /// Task GetMasterListById(ObjectId id, LocaleEnum? locale); /// @@ -40,6 +44,7 @@ public interface IMasterListService where T : MasterList /// The unique identifier of the master list to retrieve. /// The pagination filter used to control the paginated options returned with the master list. /// A task that represents the asynchronous operation. The task result contains the if a matching master list is found, otherwise null. + /// Task GetMasterListByIdWithPaginatedOptions(ObjectId id, PaginationFilter request); @@ -48,6 +53,7 @@ public interface IMasterListService where T : MasterList /// /// The unique identifier of the master list whose option names are being retrieved. /// A task that represents the asynchronous operation, containing a list of option names for the specified master list. + /// Task> GetMasterListOptionsNamesById(ObjectId id); /// /// Retrieves a master list of entries filtered by the specified identifier and an optional text search criterion. @@ -55,6 +61,7 @@ public interface IMasterListService where T : MasterList /// The unique identifier used to scope the master list lookup. /// An optional text string used to further filter the results; may be null to return all matching entries. /// A task that represents the asynchronous operation, containing a list of items matching the provided identifier and text search. + /// Task> GetMasterListByIdAndTextSearch(ObjectId id, string? textSearch); /// /// Asynchronously retrieves a master list of options associated with the specified identifier, applying the provided search and filter criteria. @@ -62,29 +69,34 @@ public interface IMasterListService where T : MasterList /// The identifier used to locate the master list to retrieve. /// The filter and search options used to refine the returned list. /// A task that represents the asynchronous operation, containing the list of entries that match the specified id and filter options. + /// Task> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement filterOption); /// /// Asynchronously retrieves a master list that matches the specified name. /// /// The name used to look up the master list. /// A task that represents the asynchronous operation. The result is the matching master list of type , or null if no master list with the specified name is found. + /// Task GetMasterListByName(string name); /// /// Inserts the specified item into the master list and returns the resulting entry, or null if the operation did not produce a result. /// /// The item to insert into the master list. /// A that resolves to the inserted item, or null when no result is available. + /// Task InsertMasterList(T item); /// /// Updates the master list with the specified item. /// /// The item to be updated in the master list. /// A task that represents the asynchronous update operation, containing the updated item or null if the update could not be performed. + /// Task UpdateMasterList(T item); /// /// Deletes a master list identified by the specified identifier. /// /// The unique identifier of the master list to delete. + /// Task DeleteMasterListById(ObjectId id); /// /// Adds the specified option element to the master option list identified by the given identifier. @@ -92,6 +104,7 @@ public interface IMasterListService where T : MasterList /// The unique identifier of the master option list to which the option will be added. /// The filter option list element to append to the master list. /// A task that returns the updated , or null if the master list could not be found. + /// Task AddOptionToMasterList(ObjectId id, FilterOptionListElement opt); /// /// Updates an option in a master list, localized for the specified locale, and returns the updated option list. @@ -101,6 +114,7 @@ public interface IMasterListService where T : MasterList /// The name of the master list type that owns the option. /// The locale used to resolve or apply localized values. /// A task that returns the updated , or null if the option could not be found. + /// Task UpdateMasterListOption(ObjectId id, OptionList opt, string typeName, LocaleEnum locale); /// /// Updates the full master list option identified by the specified identifier and type name. @@ -109,6 +123,7 @@ public interface IMasterListService where T : MasterList /// The option list containing the updated values. /// The name of the type associated with the master list option. /// A task that represents the asynchronous operation. The task result contains the updated , or null if the option was not found. + /// Task UpdateFullMasterListOption(ObjectId id, OptionList opt, string typeName); /// /// Updates a master list option for the specified type with the provided option data. @@ -117,6 +132,7 @@ public interface IMasterListService where T : MasterList /// The option data to apply to the master list. /// The name of the master list type containing the option. /// The updated , or null if the option is not found. + /// Task UpdateMasterListOption(ObjectId id, OptionList opt, string typeName); /// /// Asynchronously retrieves an option list item identified by the specified master ID, option ID, and locale. @@ -125,6 +141,7 @@ public interface IMasterListService where T : MasterList /// The identifier of the specific option item to find. /// The locale used to retrieve the localized option item. /// A task that represents the asynchronous operation, containing the matching or null if no item is found. + /// Task FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale); /// /// Updates the option details of a master list entry identified by the specified id. @@ -132,6 +149,7 @@ public interface IMasterListService where T : MasterList /// The identifier of the master list entry to update. /// The master list details to apply to the entry. /// A task that returns the updated master list details, or null if no matching entry is found. + /// Task UpdateOptionDetailsToMasterList(ObjectId id, UpdateMasterListDetailsDto opt); /// /// Updates the name of an existing master list identified by the specified identifier. @@ -139,6 +157,7 @@ public interface IMasterListService where T : MasterList /// The identifier of the master list to update. /// The new name to assign to the master list. /// A task that represents the asynchronous operation. The task result is true if the master list was successfully updated; otherwise, false. + /// Task UpdateMasterListName(ObjectId id, string name); /// /// Updates the description (name) of a master list entry identified by the specified identifier. @@ -146,6 +165,7 @@ public interface IMasterListService where T : MasterList /// The unique identifier of the master list entry to update. /// The new description to apply to the master list entry. /// A task that represents the asynchronous operation. The task result is true if the update was successful; otherwise, false. + /// Task UpdateMasterListDescription(ObjectId id, string name); /// /// Asynchronously removes the specified option from the master list identified by the given id. @@ -153,17 +173,20 @@ public interface IMasterListService where T : MasterList /// The identifier of the master list from which the option will be removed. /// The option entry to be removed from the master list. /// A task that represents the asynchronous operation. The task result is true if the option was successfully removed; otherwise, false. + /// Task RemoveMasterListOption(ObjectId id, OptionList oldOpt); /// /// Asynchronously retrieves the total count of all items in the master list. /// /// A task that represents the asynchronous operation. The task result contains the total number of items in the master list. + /// Task GetAllMasterListCount(); /// /// Retrieves a paginated master list of items based on the specified filter criteria. /// /// The pagination filter that defines paging parameters such as page number and page size. /// A task that represents the asynchronous operation, containing the paginated response with the requested master list items. + /// Task> GetPaginatedMasterList(PaginationFilter filter); /// /// Asynchronously deletes a master list option identified by the supplied identifiers. @@ -172,6 +195,7 @@ public interface IMasterListService where T : MasterList /// The identifier of the specific option to remove from the master list. /// The name of the master list type to which the option belongs. /// A task that resolves to true if the option was successfully deleted; otherwise, false. + /// Task DeleteMasterListOption(ObjectId id, ObjectId optId, string typeName); /// @@ -180,6 +204,7 @@ public interface IMasterListService where T : MasterList /// The pagination filter applied to the master list results. /// The pagination filter applied to the associated options. /// A task that represents the asynchronous operation, containing the paginated response with master list and options data. + /// Task> GetPaginatedMasterListWithPaginatedOptions( PaginationFilter listFilter, PaginationFilter optionsFilter); @@ -189,6 +214,7 @@ public interface IMasterListService where T : MasterList /// The pagination parameters used to control the page size and page index of the returned results. /// The identifier of the list whose options should be retrieved. /// A task that represents the asynchronous operation, containing a with the requested options. + /// Task> GetPaginatedOptions(PaginationFilter filter, ObjectId listId); /// /// Retrieves the associated list identifier for the given object based on the specified master list types. @@ -197,11 +223,13 @@ public interface IMasterListService where T : MasterList /// The first master list type used to determine the association. /// The second master list type used to determine the association. /// A task that returns the associated if found, or null if no association exists. + /// Task GetAssociatedList(ObjectId id, MasterListType masterListType1, MasterListType masterListType2); /// /// Retrieves the available options associated with the specified list identifier. /// /// The unique identifier of the list whose options are being retrieved. /// A task that represents the asynchronous operation, containing a list of option strings for the specified list. + /// Task> GetOptionsOfList(ObjectId id); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IMasterListServiceFactory.cs b/adas-core.Application/Services/Interfaces/IMasterListServiceFactory.cs index 07a91daa..f772f5a2 100644 --- a/adas-core.Application/Services/Interfaces/IMasterListServiceFactory.cs +++ b/adas-core.Application/Services/Interfaces/IMasterListServiceFactory.cs @@ -15,12 +15,14 @@ public interface IMasterListServiceFactory /// A service object of type , or null if there is no service /// object of that type registered. /// + /// object GetService(Type serviceType); /// /// Retrieves a service instance from the master list based on the specified service name. /// /// The identifier used to look up the desired service. /// An representing the resolved service, or if no matching service is found. + /// object GetService(MasterListType serviceName); /// /// Retrieves a typed representation of the specified based on the given . @@ -28,12 +30,14 @@ public interface IMasterListServiceFactory /// The type that determines how the master list should be converted or filtered. /// The master list to be returned in a typed form. /// A typed object representing the master list, or null if no matching type is found. + /// object? GetTypedMasterList(MasterListType masterListType, MasterList masterList); /// /// Gets the specific associated with the given master list type, mapping the master list category to its corresponding implementation type. /// /// The master list type whose associated should be returned. /// The that corresponds to the specified . + /// Type GetMasterListSpecificType(MasterListType masterListType); /// /// Inserts a new record based on the specified . @@ -41,6 +45,7 @@ public interface IMasterListServiceFactory /// The type of master list to insert. /// The master list entity to be inserted. /// A task that represents the asynchronous insert operation. The result contains the inserted master list data, or null if the insert was not successful. + /// Task InsertMasterList(MasterListType masterListType, MasterList masterList); /// /// Asynchronously updates an existing master list entry based on the specified master list type and master list data. @@ -48,6 +53,7 @@ public interface IMasterListServiceFactory /// The type of master list to update, used to determine the target list or category. /// The master list entity containing the updated data to be persisted. /// A task that represents the asynchronous update operation. The result is an object containing the updated master list information, or null if no matching record was found. + /// Task UpdateMasterList(MasterListType masterListType, MasterList masterList); /// /// Retrieves a master list entry by its identifier and type, optionally filtered by the specified data locale. @@ -56,11 +62,13 @@ public interface IMasterListServiceFactory /// The unique identifier of the master list entry to retrieve. /// The optional locale used to resolve localized data; when null, no locale filtering is applied. /// A task that yields the matching master list entry as an object, or null if no entry is found. + /// Task GetMasterListById(MasterListType masterListType, ObjectId masterListId, LocaleEnum? dataLocale); /// /// Retrieves a list of nurse observation entries as string values. /// /// A of containing the nurse observation data. + /// List StringNurseObs(); /// /// Retrieves a translated based on the provided and . @@ -70,6 +78,7 @@ public interface IMasterListServiceFactory /// The target locale for the translation. May be null. /// The patient to be translated. May be null. /// A that resolves to the translated , or null if no translation is available. + /// Task GetPatientTraslated(Unit? unit, LocaleEnum? locale, Patient? patient); /// @@ -81,6 +90,7 @@ public interface IMasterListServiceFactory /// The identifier of the master list option to retrieve. /// The optional locale used to localize the returned option data. /// A task that yields the matching master list option as an , or if not found. + /// Task GetMasterListOptionById(MasterListType masterListType, ObjectId masterListId, ObjectId masterListOptionId, LocaleEnum? dataLocale); diff --git a/adas-core.Application/Services/Interfaces/IMedicineService.cs b/adas-core.Application/Services/Interfaces/IMedicineService.cs index b1854479..d3926323 100644 --- a/adas-core.Application/Services/Interfaces/IMedicineService.cs +++ b/adas-core.Application/Services/Interfaces/IMedicineService.cs @@ -13,83 +13,98 @@ public interface IMedicineService /// /// The unique code used to look up the medicine. /// A task that represents the asynchronous operation, containing the matching or null if not found. + /// Task GetByCode(string code); /// /// Retrieves a list of medicines that match the provided codes or notes. /// /// A list of strings representing the codes or notes used to look up medicines. /// A task that represents the asynchronous operation. The task result contains a list of objects matching the provided codes or notes. + /// Task> GetByCodeOrNote(List codeNote); /// /// Retrieves a medicine by its name, returning null if no matching medicine is found. /// /// The name of the medicine to look up. /// A task that represents the asynchronous operation, containing the matching or null if not found. + /// Task GetByName(string name); /// /// Retrieves the medicines associated with the specified patient treatments. /// /// The collection of patient treatments, which may include null entries, whose medicines are to be obtained. /// A task that represents the asynchronous operation, containing the collection of medicines linked to the provided treatments. + /// Task> GetMedicinesOfTreatments(IEnumerable treatments); /// /// Asynchronously retrieves the collection of active medicines associated with the specified patient. /// /// The unique identifier of the patient whose active medicines are being queried. /// A task that represents the asynchronous operation, containing an enumerable collection of active records for the patient. + /// Task> GetActiveMedicinesByPatient(ObjectId patientId); /// /// Retrieves a paginated list of medicines based on the provided filter criteria. /// /// The pagination filter containing page size, page number, and optional search criteria. /// A task that represents the asynchronous operation, containing a with the requested items and pagination metadata. + /// Task> GetPaginatedMedicines(PaginationFilter filter); /// /// Asynchronously retrieves all medicines from the data store. /// /// A task that represents the asynchronous operation, containing a list of all entities. + /// Task> GetAll(); /// /// Retrieves a medicine by its unique identifier. /// /// The unique identifier of the medicine to retrieve. /// A task that represents the asynchronous operation, containing the if found; otherwise, null. + /// Task GetMedicineById(ObjectId medicineId); /// /// Asynchronously posts a new medicine and returns the created medicine, or null if the operation fails. /// /// The medicine entity to be posted. /// A task that represents the asynchronous operation. The task result contains the posted , or null if the medicine could not be posted. + /// Task PostMedicine(Medicine medicine); /// /// Updates an existing medicine in the data store and returns the updated entity, or null if no matching medicine was found. /// /// The medicine entity containing the updated values to be persisted. /// A task that represents the asynchronous update operation. The result is the updated when the update succeeds, or null when the medicine does not exist. + /// Task UpdateMedicine(Medicine medicine); /// /// Deletes a medicine record identified by the specified identifier. /// /// The unique identifier of the medicine to delete. + /// Task DeleteMedicineById(ObjectId medicineId); /// /// Asynchronously retrieves all available types as a list of string identifiers. /// /// A task representing the asynchronous operation, containing a list of type identifiers. + /// Task> GetAllTypes(); /// /// Asynchronously retrieves all available groups, returning their identifiers or names as a list of strings. /// /// A task that represents the asynchronous operation. The task result contains a list of strings representing all groups. + /// Task> GetAllGroups(); /// /// Asynchronously retrieves all available names. /// /// A task that represents the asynchronous operation. The task result contains a list of all names. + /// Task> GetAllNames(); /// /// Asynchronously retrieves the complete list of available codes from the data source. /// /// A task representing the asynchronous operation, containing a list of code strings. + /// Task> GetAllCodes(); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/INoticeService.cs b/adas-core.Application/Services/Interfaces/INoticeService.cs index 13a851a4..4667ba28 100644 --- a/adas-core.Application/Services/Interfaces/INoticeService.cs +++ b/adas-core.Application/Services/Interfaces/INoticeService.cs @@ -11,11 +11,13 @@ public interface INoticeService /// /// The notice to delete. /// A task that represents the asynchronous delete operation. + /// Task DeleteNoticeAsync(Notice notice); /// /// Asynchronously deletes a notice identified by the specified identifier. /// /// The unique identifier of the notice to delete. + /// Task DeleteNoticeByIdAsync(ObjectId noticeId); /// /// Asynchronously retrieves a entity by its unique identifier from the data store. @@ -23,6 +25,7 @@ public interface INoticeService /// /// The that uniquely identifies the notice to retrieve. /// A containing the matching , or if no notice is found. + /// Task GetNoticeByIdAsync(ObjectId noticeId); /// /// Asynchronously retrieves a collection of notices filtered by the specified notice type. @@ -30,37 +33,44 @@ public interface INoticeService /// /// The type of notice to filter by. /// A task containing an enumerable of matching objects, or null if none are found. + /// Task?> GetNoticeByTypeAsync(string noticeType); /// /// Asynchronously retrieves a collection of notices. /// /// A task that represents the asynchronous operation. The task result contains an enumerable collection of objects. + /// Task> GetNoticesAsync(); /// /// Inserts a new notice into the data store. /// /// The notice entity to insert. /// A task that represents the asynchronous operation. The task result contains the inserted , or null if the notice could not be inserted. + /// Task InsertNotice(Notice notice); /// /// Asynchronously updates an existing notice in the system. /// /// The notice entity containing the updated information to be persisted. + /// Task UpdateNoticeAsync(Notice notice); /// /// Persists the provided API request to the data store. /// /// The API request to be saved. + /// Task SaveRequest(ApiRequest apiRequest); /// /// Asynchronously persists the specified API request. /// /// The API request to save. + /// Task SaveRequestAsync(ApiRequest apiRequest); /// /// Asynchronously retrieves the collection of notices associated with the specified display identifier. /// /// The identifier of the display whose notices should be retrieved. /// A task that returns the notices for the display, or null when no notices are found for the given display. + /// Task?> GetNoticesByDisplayId(ObjectId displayId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IObservationDemoService.cs b/adas-core.Application/Services/Interfaces/IObservationDemoService.cs index c97be5a7..d235fabc 100644 --- a/adas-core.Application/Services/Interfaces/IObservationDemoService.cs +++ b/adas-core.Application/Services/Interfaces/IObservationDemoService.cs @@ -12,6 +12,7 @@ public interface IObservationDemoService /// The patient for whom the observations are being generated. /// The collection of fields used to drive the observation generation. /// A task representing the asynchronous operation that returns the list of generated patient observations. + /// Task> GenerateObservationByField(Patient patient, List dataFields); /// /// Generates a grouped observation for the specified patient based on the provided grouped field configuration. @@ -19,6 +20,7 @@ public interface IObservationDemoService /// The patient for whom the grouped observation is generated. /// The grouped field definition that determines the grouping criteria for the observation. /// A task that represents the asynchronous operation. The task result contains the generated . + /// Task GenerateGroupedObservation(Patient patient, GroupedField groupedField); /// /// Generates a list of patient observation alarms for the specified patient based on the provided data alarm fields. @@ -26,5 +28,6 @@ public interface IObservationDemoService /// The patient for whom the observation alarms are generated. /// The list of fields used to determine and generate the data alarms. /// A task that represents the asynchronous operation, containing a list of objects generated for the patient. + /// Task> GenerateAlarmByField(Patient patient, List dataAlarmfields); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IObservationService.cs b/adas-core.Application/Services/Interfaces/IObservationService.cs index 4601e6a3..bbb8db16 100644 --- a/adas-core.Application/Services/Interfaces/IObservationService.cs +++ b/adas-core.Application/Services/Interfaces/IObservationService.cs @@ -19,6 +19,7 @@ public interface IObservationService : IApiRequestService /// /// The unique identifier of the patient whose observations are to be retrieved. /// A task that returns an of instances for the given patient. + /// Task> FindByPatientIdAsync(ObjectId patientId); /// @@ -28,6 +29,7 @@ public interface IObservationService : IApiRequestService /// The coding system used to classify the observations (e.g., LOINC, SNOMED). /// The name of the observation to filter by. /// A task that represents the asynchronous operation, containing an of matching the criteria. + /// Task> FindByPatientIdAndCodingSystemAsync(ObjectId patientId, string codingSystem, string name); @@ -38,6 +40,7 @@ public interface IObservationService : IApiRequestService /// The maximum number of most recent observations to return. Defaults to 2. /// An optional list of observation codes used to restrict the result set; if null, observations are not filtered by code. /// A task that resolves to a list of the most recent entries matching the criteria. + /// Task> FindLastObservations(ObjectId patientId, int num = 2, List? filterObservations = null); @@ -45,14 +48,17 @@ public interface IObservationService : IApiRequestService /// Updates the status of the provided patient observations that have reached their expiration. /// /// The list of patient observations to update as expired. + /// Task UpdateExpiredObservations(List expiredObservations); /// /// Asynchronously expires observations that are no longer valid and recalculates the dependent data. /// + /// Task ExpireObservationsAndRecalculateAsync(); /// /// Asynchronously expires active alerts and powers off the device. /// + /// Task ExpireAlertsAndPowerOffAsync(); /// @@ -62,6 +68,7 @@ public interface IObservationService : IApiRequestService /// The name of the observation to filter by. /// Optional expiration time in seconds applied to the cached results. If null, no expiration is applied. /// A task that represents the asynchronous operation. The task result contains a list of the latest unique values matching the specified patient and name. + /// Task> FindLatestUniqueValuesByName(ObjectId patientId, string name, int? expires); /// @@ -72,6 +79,7 @@ public interface IObservationService : IApiRequestService /// Indicates whether the returned observations should be mapped (default true) or returned in their raw form. /// The cancellation token used to cancel the asynchronous operation. /// A task that resolves to a list of the patient's most recent entries. + /// Task> FindLastObservationsByField(ObjectId patientId, List? filterObservations = null, bool mapped = true, CancellationToken ct = default); @@ -80,6 +88,7 @@ public interface IObservationService : IApiRequestService /// /// The unique identifier of the patient whose intravenous line observations are being queried. /// A task that represents the asynchronous operation. The task result contains a list of nullable entries representing the latest intravenous line observations by location, where individual entries may be null when no data is available. + /// Task> FindLastIntravenousLinesObservationByLocation(ObjectId patientId); /// /// Asynchronously inserts a patient observation, with options to control whether the observation is persisted and whether it is mapped. @@ -87,6 +96,7 @@ public interface IObservationService : IApiRequestService /// The patient observation to insert. /// Indicates whether the observation should be persisted; defaults to true. /// Indicates whether the observation should be mapped; defaults to true. + /// Task InsertObservation(PatientObservation patientObservation, bool persistObs = true, bool mapObs = true); /// /// Inserts the specified patient observation only if it has changed, optionally persisting the observation and applying a mapping during the insert. @@ -96,22 +106,26 @@ public interface IObservationService : IApiRequestService /// Indicates whether the observation should be persisted when it is inserted. Defaults to true. /// Indicates whether the observation should be mapped as part of the insert operation. Defaults to true. /// A task that returns true if the observation was inserted because a change was detected; otherwise, false if no insert was performed. + /// Task InsertIfChanged(string name, PatientObservation observation, bool persistObs = true, bool mapObs = true); /// /// Inserts a new nurse observation for a patient into the underlying data store. /// /// The patient observation data recorded by the nurse to be persisted. + /// Task InsertNurseObservation(PatientObservation obs); /// /// Asynchronously deletes records associated with the specified patient identifier. /// /// The of the patient whose related records should be removed. + /// Task DeleteByPatientId(ObjectId id); /// /// Asynchronously archives the specified patient observation, preserving it for historical or compliance purposes while removing it from the active set. /// /// The patient observation to archive. /// A task that represents the asynchronous archive operation. + /// Task Archive(PatientObservation observation); /// /// Asynchronously maps a to a corresponding observation, optionally restricting the lookup to name-based matching. Returns when no matching observation is found. @@ -119,27 +133,32 @@ public interface IObservationService : IApiRequestService /// The source to be mapped. /// When , restricts the lookup to name-based matching; otherwise, the default mapping behavior is applied. /// A containing the mapped , or if no match is found. + /// Task MapObservation(PatientObservation obs, bool onlyByName = false); /// /// Asynchronously retrieves the most recent observation time for each patient, returning a mapping of patient identifiers to their last observation timestamps. /// /// A task that represents the asynchronous operation. The task result contains a dictionary where each key is a patient and the associated value is the of that patient's latest observation. + /// Task> FindAllLastPatientObservationTime(); /// /// Asynchronously maps or looks up a based on the name of the provided observation, returning the matching observation or null when no match is found. /// /// The whose name is used to perform the mapping or lookup. /// A that resolves to the matching , or null if no corresponding observation is found. + /// Task MapObservationsByName(PatientObservation obs); /// /// Archives the specified patient, moving their record out of the active set so that it is retained for historical or compliance purposes while no longer appearing in routine operational queries. /// /// The patient whose record is to be archived. + /// Task Archive(Patient patient); /// /// Archives records associated with the specified patient identifier. /// /// The unique identifier of the patient whose records should be archived. + /// Task ArchiveByPatientId(ObjectId id); /// @@ -147,6 +166,7 @@ public interface IObservationService : IApiRequestService /// /// The patient observation containing the updated information. /// A task that represents the asynchronous update operation. + /// Task UpdateObservation(PatientObservation observation); /// /// Updates the specified identifier field () across multiple objects, replacing the existing value with the new value . @@ -155,24 +175,28 @@ public interface IObservationService : IApiRequestService /// The new value to assign to the field. /// The current value to be replaced. /// A task that represents the asynchronous bulk update operation. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); /// /// Asynchronously broadcasts a patient observation to subscribed listeners or endpoints. /// /// The base patient observation to be broadcast. + /// Task SendObsBroadcast(BasePatientObservation obs); /// /// Sends a broadcast containing the specified patient observations to the given patient location. /// /// The list of patient observations to include in the broadcast. /// The target patient location that will receive the broadcast. + /// Task SendObsBroadcast(List obs, PatientLocation location); /// /// Asynchronously sends a broadcast of patient observations to the specified Point of Care (POC) system. /// /// The list of patient observations to be transmitted in the broadcast. /// The identifier of the Point of Care system that will receive the observations. + /// Task SendObsBroadcast(List obs, ObjectId pocId); /// @@ -182,6 +206,7 @@ public interface IObservationService : IApiRequestService /// The cutoff date; only observations recorded strictly before this date are considered. /// The optional name of the observation to filter by, or null to match any observation. /// A task that represents the asynchronous operation. The task result contains the latest matching , or null if none was found before the given date. + /// Task FindLastBeforeDate(ObjectId patientId, DateTime date, string? obsName); /// @@ -191,6 +216,7 @@ public interface IObservationService : IApiRequestService /// The date used to match observations. /// The optional observation name used to filter the results. When null, observations are not filtered by name. /// A task that represents the asynchronous operation. The task result contains a list of matching records, or null when no observations match the criteria. + /// Task?> FindAnyWithSameDate(ObjectId patientId, DateTime date, string? obsName); //TODO To implement @@ -201,6 +227,7 @@ public interface IObservationService : IApiRequestService /// The cutoff date; only observations recorded before this date will be returned. /// An optional list of observation identifiers used to restrict the results to specific observation types. When null, all observation types are included. /// A task that resolves to a list of PatientObservation instances matching the criteria. + /// Task> FindAllBeforeDate(ObjectId patientId, DateTime date, List? filterObservations = null); @@ -212,6 +239,7 @@ public interface IObservationService : IApiRequestService /// The cutoff date; only observations with a timestamp after this value are returned. /// An optional list of observation names to restrict the result to. When null or empty, all observations after the date are returned. /// A that yields the list of matching entries. + /// Task> FindAllAfterDate(ObjectId patientId, DateTime date, List? filterObservations = null); @@ -225,6 +253,7 @@ public interface IObservationService : IApiRequestService /// When true, observations are retrieved from archived records; otherwise, only active records are considered. /// An optional pagination filter applied to the result set. /// A task that resolves to a list of entries matching the provided criteria. + /// Task> FindAllBetweenDates(ObjectId patientId, DateTime? startDate, DateTime? endDate, List? filterObservations = null, bool fromArchived = false, PaginationFilter? filter = null); @@ -236,6 +265,7 @@ public interface IObservationService : IApiRequestService /// Optional parameter that defines the pagination boundary; when provided, observations are returned starting after this position. /// Optional parameter that limits the maximum number of observations returned. /// A task representing the asynchronous operation, containing a collection of matching non-expired records; an empty collection is returned if none are found. + /// Task> FindLastNotExpiredObservatonsByPatient(ObjectId patientId, string name, int? endAfter = null, int? num = null); @@ -243,12 +273,14 @@ public interface IObservationService : IApiRequestService /// /// Checks observations and expires those that meet the expiration criteria. /// + /// Task CheckAndExpireObservations(); /// /// Retrieves patient observations that have not been marked as expired but should be, based on their validity period or business rules. /// /// An asynchronous stream of instances that are not expired but meet the criteria to be expired. + /// IAsyncEnumerable FindNotExpiredObservationsShouldBeExpired(); @@ -259,12 +291,14 @@ public interface IObservationService : IApiRequestService /// The patient associated with the observations. /// The timestamp of the message containing the observations. /// Optional additional data related to the observations. + /// void ProcessObservations(List observations, Patient patient, DateTime messageTime, ObservationData? observationData = null); /// /// Asynchronously processes and expires observations that have exceeded their validity period. /// + /// Task ExpireObservations(); /// @@ -272,16 +306,19 @@ public interface IObservationService : IApiRequestService /// /// The patient observation to insert. /// A task that represents the asynchronous insert operation. + /// Task InsertSimpleObservation(PatientObservation observation); /// /// Asynchronously retrieves a paginated collection of patient observations based on the specified filter criteria. /// /// The pagination filter that controls the page size, page number, and any additional query criteria applied to the patient observations. /// A task that represents the asynchronous operation, containing a of with the requested page of results. + /// Task> GetPaginatedObservations(PaginationFilter filter); /// /// Asynchronously saves a nurse observation request. /// /// The API request containing the nurse observation data to save. + /// Task SaveRequestNurseObsAsync(ApiRequest request); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IPatientCarePlanService.cs b/adas-core.Application/Services/Interfaces/IPatientCarePlanService.cs index cb326089..f6587a4c 100644 --- a/adas-core.Application/Services/Interfaces/IPatientCarePlanService.cs +++ b/adas-core.Application/Services/Interfaces/IPatientCarePlanService.cs @@ -11,34 +11,40 @@ public interface IPatientCarePlanService /// /// The unique identifier of the patient whose care plans are being retrieved. /// A task that represents the asynchronous operation, containing a list of records for the given patient. + /// Task> FindByPatientId(ObjectId patientId); /// /// Retrieves a list of patient care plans associated with the specified user identifier. /// /// The unique identifier of the user whose patient care plans are being retrieved. /// A task that represents the asynchronous operation. The task result contains a list of patient care plans associated with the user. + /// Task> FindByUserId(ObjectId userId); /// /// Retrieves all patient care plans from the system. /// /// A task containing a list of all records. + /// Task> FindAll(); /// /// Asynchronously inserts a single patient care plan into the underlying data store. /// /// The patient care plan to insert. + /// Task InsertOneAsync(PatientCarePlan patientCarePlan); /// /// Archives the care plan associated with a finished procedure for the specified patient, processing the provided list of items to be archived. /// /// The patient whose procedure has been completed and whose care plan should be archived. /// The collection of option list items to be archived as part of the care plan archival process. + /// Task ArchiveCarePlanFromJob(Patient patientWithFinishedProcedure, List itemsToArchive); /// /// Asynchronously archives records associated with the specified patient identifier. /// /// The unique identifier of the patient whose records are to be archived. + /// Task ArchiveByPatientId(ObjectId patientid); /// /// Updates the ObjectId references from the specified old identifier to a new one across multiple records associated with the given patient. @@ -46,5 +52,7 @@ public interface IPatientCarePlanService /// The string identifier of the patient whose related records will be updated. /// The ObjectId of the patient used to locate the records to update. /// The existing ObjectId value to be replaced in the matched records. + /// Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IPatientService.cs b/adas-core.Application/Services/Interfaces/IPatientService.cs index 0f582870..1371f571 100644 --- a/adas-core.Application/Services/Interfaces/IPatientService.cs +++ b/adas-core.Application/Services/Interfaces/IPatientService.cs @@ -17,6 +17,7 @@ public interface IPatientService : IApiRequestService /// The unique identifier of the patient to find. /// When set to true, includes location details in the returned patient; otherwise, only basic patient data is returned. /// A task that represents the asynchronous operation. The task result contains the found , or null if no patient matches the specified identifier. + /// Task FindByPatientId(string patientId, bool withLocation = false); /// /// Asynchronously retrieves a patient by their unique identifier, applying the specified locale for localized data. @@ -24,12 +25,14 @@ public interface IPatientService : IApiRequestService /// The unique identifier of the patient to locate. /// The locale to use when retrieving or formatting localized patient information. /// A task that resolves to the matching patient, or null if no patient is found for the given identifier. + /// Task FindByPatientIdWithLocale(string patientId, LocaleEnum localeEnum); /// /// Asynchronously retrieves an archived matching the specified patient number, returning null when no matching archived record is found. /// /// The unique patient number used to look up the archived patient record. /// A that yields the matching archived , or null if no archived patient is found. + /// Task FindByPatientNumberArchived(string patientNumber); /// /// Retrieves a patient by their unique patient number, optionally including location information in the result. @@ -37,6 +40,7 @@ public interface IPatientService : IApiRequestService /// The unique patient number used to look up the patient. /// When true, location information is included in the returned patient; otherwise, it is omitted. /// A task that yields the matching if one is found, or null when no patient matches the given number. + /// Task FindByPatientNumber(string patientNumber, bool withLocation = false); /// /// Asynchronously retrieves a patient associated with the specified location. @@ -44,12 +48,14 @@ public interface IPatientService : IApiRequestService /// /// The patient location used to search for a matching patient. May be . /// A that yields the matching , or if no patient is found. + /// Task FindByLocation(PatientLocation? location); /// /// Asynchronously retrieves a patient associated with the specified Point of Care identifier. /// /// The ObjectId representing the Point of Care identifier used to look up the patient. /// A task that represents the asynchronous operation. The task result contains the matching if found; otherwise, null. + /// Task FindByPointOfCareId(ObjectId pocId); /// /// Asynchronously retrieves a patient identified by the specified unit and point-of-care identifiers. @@ -57,18 +63,21 @@ public interface IPatientService : IApiRequestService /// The unique identifier of the unit to search within. /// The unique identifier of the point-of-care associated with the patient. /// A task that yields the matching , or null if no patient is found for the given unit and point-of-care. + /// Task FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare); /// /// Asynchronously retrieves a list of patients associated with the specified point of care. /// /// The point of care identifier used to locate matching patients. /// A task that represents the asynchronous operation, containing a list of objects that match the specified point of care. + /// Task> FindByPointOfCare(string pointOfCare); /// /// Asynchronously counts the number of patients associated with the specified unit identifier. /// /// The ObjectId of the unit whose patients should be counted. /// A task that represents the asynchronous operation, containing the total count of patients for the given unit. + /// Task CountPatientsByUnitId(ObjectId unitId); /// @@ -82,6 +91,7 @@ public interface IPatientService : IApiRequestService /// instead of the patient identifiers. /// A that yields the matching , or /// null if no patient is found. + /// Task FindPatient(string? patientId, string? patientNumber, PatientLocation? location, bool findByLocation = false); @@ -89,33 +99,39 @@ public interface IPatientService : IApiRequestService /// Asynchronously inserts a new patient record into the data store. /// /// The patient entity to be inserted. + /// Task Insert(Patient patient); /// /// Asynchronously inserts the specified into the data store. /// /// The patient entity to be persisted. + /// Task InsertAsync(Patient patient); /// /// Archives the specified patient record. /// /// The patient to archive. + /// Task ArchivePatient(Patient patient); /// /// Archives the patient data identified by the specified patient identifier. /// /// The unique identifier of the patient whose data should be archived. + /// Task ArchivePatientData(ObjectId patientid); /// /// Merges the specified patient record with the existing patient identified by the old patient number. /// /// The patient data to merge into the existing record. /// The identifier of the existing patient record to be merged. + /// Task MergePatient(Patient patient, string oldPatienNumber); /// /// Updates the location of a patient identified by the specified object identifier. /// /// The unique identifier of the patient whose location will be updated. /// The new patient location, or null if no location is provided. + /// Task UpdateLocation(ObjectId id, PatientLocation? location); /// /// Updates the attending doctor for the entity identified by the specified identifier. @@ -123,6 +139,7 @@ public interface IPatientService : IApiRequestService /// The identifier of the entity whose attending doctor will be updated. /// The new attending doctor to assign to the entity. /// A task that represents the asynchronous update operation. + /// Task UpdateAttendingDoctor(ObjectId id, Person doctor); /// /// Updates the data of an existing patient identified by the given identifier, optionally replacing the patient number when the flag is true. @@ -131,6 +148,7 @@ public interface IPatientService : IApiRequestService /// The patient number to be applied to the patient. /// The person data to assign to the patient. /// Indicates whether the patient number should also be updated; defaults to true. + /// Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true); /// /// Updates the patient data for the specified patient identified by and , applying the changes from the provided object. When is true, the patient number is also updated as part of the operation; otherwise, only the remaining patient fields are updated. @@ -140,11 +158,13 @@ public interface IPatientService : IApiRequestService /// The patient object containing the updated data to be applied. /// A flag indicating whether the patient number should also be updated; defaults to true. /// A that represents the asynchronous update operation. + /// Task UpdatePatientData(ObjectId id, string patientNumber, Patient patient, bool updatePatientNumber = true); /// /// Updates the specified patient record. /// /// The patient whose information will be updated. + /// Task Update(Patient patient); /// /// Moves the specified patient from the old point of care to the new point of care. @@ -153,6 +173,7 @@ public interface IPatientService : IApiRequestService /// The identifier of the destination point of care. /// The identifier of the source point of care. /// A task that resolves to true if the move was successful; otherwise, false. + /// Task Move(Patient patient, ObjectId newPocId, ObjectId oldPocId); /// /// Retrieves a patient by their unique identifier, optionally including location information. @@ -161,6 +182,7 @@ public interface IPatientService : IApiRequestService /// The used to look up the patient. /// When true, includes the patient's location data in the result; otherwise, location data is omitted. /// A that resolves to the matching , or null if no patient is found. + /// Task FindById(ObjectId id, bool withLocation = false); /// /// Retrieves a associated with the specified , returning when no box is found for the given point of care. @@ -169,6 +191,7 @@ public interface IPatientService : IApiRequestService /// When , observations are included with the returned box; otherwise, observations are omitted. /// An optional list of observation identifiers used to restrict which observations are loaded when is . /// A that resolves to the matching , or if no box exists for the specified point of care. + /// Task GetBox(PointOfCare poc, bool observations = false, List? filterObservations = null); /// /// Creates a instance from the provided , optionally ignoring location information during the creation process. @@ -176,35 +199,41 @@ public interface IPatientService : IApiRequestService /// The API request containing the data used to construct the patient. /// When true, location information is ignored during patient creation. Defaults to false. /// A task that represents the asynchronous operation. The task result contains the created , or null if the patient could not be created. + /// Task CreatePatientFromRequest(ApiRequest apiRequest, bool ignoreLocation = false); /// /// Asynchronously finds a patient based on the information provided in the specified API request. /// /// The API request containing the data used to look up the patient. /// A task that represents the asynchronous operation. The task result contains the matching if found, or null if no patient matches the request. + /// Task FindPatientByApiRequest(ApiRequest apiRequest); /// /// Archives patients who have no observations recorded since the specified date. /// /// The cutoff date; patients without observations after this date are archived. + /// Task ArchivePatientWithoutObservationsSinceDate(DateTime date); /// /// Archives patient records for patients who have been discharged longer than the specified time threshold. /// /// The number of hours a patient must have been discharged before being archived. + /// Task ArchiveDischargedPatients(int hoursBeforeArchive); /// /// Retrieves all patients, optionally including their location data when requested. /// /// Indicates whether location information should be included in the returned patient records. /// A task that represents the asynchronous operation, containing a list of objects. + /// Task> FindAll(bool withLocation = false); /// /// Retrieves a paginated list of patients based on the provided pagination filter. /// /// The pagination filter that defines the paging criteria used to retrieve patients. /// A task that represents the asynchronous operation. The task result contains a with the requested page of patients. + /// Task> GetPaginatedPatients(PaginationFilter filter); /// @@ -212,34 +241,40 @@ public interface IPatientService : IApiRequestService /// /// The date used to identify patients that have been inactive since this point in time. /// The number of hours of inactivity that must elapse before a discharged patient is archived. + /// Task DischargeInactivePatients(DateTime sinceDate, int hoursBeforeArchive); /// /// Updates an existing patient record with the provided patient data. Returns the updated patient, or null if no matching patient was found. /// /// The patient object containing the updated information to be persisted. /// A that resolves to the updated , or null if the patient could not be found. + /// Task UpdateOne(Patient updatedPatient); /// /// Sends an asynchronous broadcast notification to inform relevant subscribers or systems about a newly registered patient. /// /// The patient whose information will be included in the broadcast notification. + /// Task SendNewPatientBroadcast(Patient patient); /// /// Asynchronously sends a broadcast notification about an update to the specified patient. /// /// The patient whose update information will be broadcast. + /// Task SendPatientUpdateBroadcast(Patient patient); /// /// Asynchronously retrieves the list of inactive Patients of Care (PoC), allowing consumers to identify /// patients that are no longer active in the system for reporting, cleanup, or follow-up workflows. /// /// A task representing the asynchronous operation, containing a list of inactive records. + /// Task> FindInActivePoC(); /// /// Retrieves a list of patients associated with inactive PoC records. /// /// A task that represents the asynchronous operation. The task result contains a list of objects associated with inactive PoC records. + /// Task> FindInInactivePoC(); /// @@ -250,6 +285,7 @@ public interface IPatientService : IApiRequestService /// Indicates whether the patient's observations should be included in the returned patient. /// An optional list of observation identifiers used to filter which observations are returned when is true. /// A that resolves to the matching , or null if no patient is found for the given point of care. + /// Task GetByPointOfCare(PointOfCare item, bool observations = false, List? filterObservations = null); @@ -260,6 +296,7 @@ public interface IPatientService : IApiRequestService /// An optional unit that further filters the lookup. /// An optional locale used to scope the search. /// A task that yields the matching , or null when no patient is found. + /// Task GetByPointOfCareAndLocale(PointOfCare item, Unit? unit, LocaleEnum? localeEnum); /// /// Updates the altable (allergy table) information for the specified patient and returns the updated patient. @@ -268,12 +305,14 @@ public interface IPatientService : IApiRequestService /// The option list containing the altable data to apply to the patient. /// The user performing the update, or null when no user context is available. /// A task that resolves to the updated , or null if the patient was not found. + /// Task UpdatePatientAltable(ObjectId patientId, OptionList altable, User? user); /// /// Exits a patient identified by the given identifier, optionally archiving the patient record. /// /// The unique identifier of the patient to exit. /// When true, the patient record is archived as part of the exit process; when false, archiving is skipped. + /// Task ExitPatientById(ObjectId id, bool archivePatient = true); /// @@ -285,6 +324,7 @@ public interface IPatientService : IApiRequestService /// The user performing the update, or null if not specified. /// Optional care plan log entries associated with the update. /// A task that returns the updated , or null if the patient was not found. + /// Task UpdatePatientMasterList(ObjectId patientId, MasterListType typeName, List updatedOptions, User? user, List? carePlanLog); @@ -297,6 +337,7 @@ public interface IPatientService : IApiRequestService /// The patient for whom the nurse care plan is generated and inserted. /// The user associated with the care plan generation. May be null. /// A task that completes when the nurse care plan has been generated and inserted. + /// Task GenerateNurseCarePlanAndInsert(MasterListType carePlanType, List? options, Patient patient, User? user); @@ -305,6 +346,7 @@ public interface IPatientService : IApiRequestService /// /// The unique identifier of the patient whose incoming data is being updated. /// The patient object containing the incoming data to be applied to the patient record. + /// Task UpdatePatientIncomingData(ObjectId patientId, Patient person); /// /// Asynchronously updates the demographic data of an existing patient identified by the specified patient identifier. @@ -312,6 +354,7 @@ public interface IPatientService : IApiRequestService /// The unique identifier of the patient whose demographic data is to be updated. /// The patient object containing the new demographic information to apply. /// The user performing the update operation, or if no user context is available. + /// Task UpdatePatientDemographicData(ObjectId patientId, Patient person, User? user); /// /// Searches for a patient by their patient number within a distinct unit. @@ -319,24 +362,28 @@ public interface IPatientService : IApiRequestService /// The patient number used to identify the patient. /// The identifier of the distinct unit where the patient is registered. /// A task that represents the asynchronous operation. The task result contains the matching if found; otherwise, . + /// Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId); /// /// Asynchronously retrieves all patients whose procedures have been finished, filtering based on the specified archive threshold for procedure end times. /// /// The number of minutes after the procedure end date used as the archive threshold to qualify patients with finished procedures. /// A task that represents the asynchronous operation, containing a list of objects that match the finished procedures criteria. + /// Task> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes); /// /// Asynchronously retrieves all patients who have completed a test, using the specified archive window in minutes to determine which tests are considered finished. /// /// The time window in minutes applied to the test end date to identify tests that should be treated as finished/archived. /// A task that represents the asynchronous operation, containing a list of instances with finished tests. + /// Task> FindAllPatientWithFinishedTest(int archiveTestEndDateAfterMinutes); /// /// Retrieves a list of patients whose treatments have finished, based on the specified archive time threshold in minutes after the treatment end date. /// /// The number of minutes after the treatment end date used to determine which finished treatments should be included. /// A task representing the asynchronous operation, containing a list of patients with finished treatment matching the specified criteria. + /// Task> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes); /// @@ -346,6 +393,7 @@ public interface IPatientService : IApiRequestService /// The patient entity associated with the update. /// The income data changes to apply to the patient. /// The user performing the update operation. + /// Task UpdatePatientIncomingData(ObjectId patientId, Patient person, PatientIncomeData personDataChange, User user); @@ -355,6 +403,7 @@ public interface IPatientService : IApiRequestService /// The update options for the master list item. /// The collection of units associated with the update. /// The name of the type used to categorize the master list item. + /// Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable unitList, string typeName); @@ -364,5 +413,6 @@ public interface IPatientService : IApiRequestService /// The option list containing the details of the patient master list item to delete. /// The collection of units associated with the patient master list item. /// The name of the type identifying the patient master list item to be deleted. + /// Task DeletePatientMasterListItem(OptionList opt, IEnumerable unitList, string typeName); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IPermissionService.cs b/adas-core.Application/Services/Interfaces/IPermissionService.cs index 644f1fb6..e108e246 100644 --- a/adas-core.Application/Services/Interfaces/IPermissionService.cs +++ b/adas-core.Application/Services/Interfaces/IPermissionService.cs @@ -12,6 +12,7 @@ public interface IPermissionService /// The display for which permissions are being evaluated. /// The user whose permissions for the display are being retrieved. /// A task that represents the asynchronous operation, containing the granted to the user for the display. + /// public Task GetPermissionsForDisplay(Display display, User user); /// /// Retrieves the display-friendly permission types applicable to the specified user for the given unit. @@ -19,18 +20,21 @@ public interface IPermissionService /// The identifier of the unit whose permissions are being queried. /// The user whose permissions for the unit should be evaluated. /// A task that represents the asynchronous operation, containing the for the specified unit and user. + /// public Task GetPermissionsForUnit(string unitId, User user); /// /// Retrieves the panel permission types associated with the specified user. /// /// The user whose panel permissions are being queried. /// The granted to the specified user. + /// public PanelPermissionTypes GetPermissionsForPanel(User user); /// /// Retrieves the panel permission types associated with the specified user. /// /// The identifier or name of the user whose panel permissions are being requested. /// A task that represents the asynchronous operation, containing the granted to the user. + /// public Task GetPermissionsForPanel(string user); /// @@ -41,6 +45,7 @@ public interface IPermissionService /// The source permission type considered when evaluating access. /// The identifier of the display for which access is being checked. /// A task that represents the asynchronous operation. The task result is true if the user has access to the display; otherwise, false. + /// Task HasAccessToDisplay(string username, PermissionEnum.RolesType role, PermissionEnum.SourcePermissionsEnum source, string displayId); @@ -52,6 +57,7 @@ public interface IPermissionService /// The permission source used to resolve the user's access rights. /// The identifier of the unit to check access against. /// A task that resolves to true if the user has access to the specified unit; otherwise, false. + /// Task HasAccessToUnit(string username, PermissionEnum.RolesType role, PermissionEnum.SourcePermissionsEnum source, string unitId); @@ -62,6 +68,7 @@ public interface IPermissionService /// The role assigned to the user, used to resolve applicable permissions. /// The source permission being checked against the user's access rights. /// A task that resolves to true if the user has access to the panel; otherwise, false. + /// Task HasAccessToPanel(string username, PermissionEnum.RolesType role, PermissionEnum.SourcePermissionsEnum source); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IPoCMappingService.cs b/adas-core.Application/Services/Interfaces/IPoCMappingService.cs index 1fe3a559..833c6612 100644 --- a/adas-core.Application/Services/Interfaces/IPoCMappingService.cs +++ b/adas-core.Application/Services/Interfaces/IPoCMappingService.cs @@ -9,5 +9,6 @@ public interface IPoCMappingService /// /// The source patient location to map from. /// A task that yields the mapped , or null if no mapping result is available. + /// Task Map(PatientLocation original); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IPointOfCareService.cs b/adas-core.Application/Services/Interfaces/IPointOfCareService.cs index ad90c6f1..4d4912f7 100644 --- a/adas-core.Application/Services/Interfaces/IPointOfCareService.cs +++ b/adas-core.Application/Services/Interfaces/IPointOfCareService.cs @@ -14,6 +14,7 @@ public interface IPointOfCareService /// /// The unique identifier of the entity to delete. /// A task that represents the asynchronous delete operation. + /// Task Delete(ObjectId id); /// @@ -21,6 +22,7 @@ public interface IPointOfCareService /// /// The point of care entity containing the updated data. /// A task representing the asynchronous operation, containing the updated point of care, or null if no matching record was found. + /// Task Update(PointOfCare pointOfCare); /// @@ -28,22 +30,26 @@ public interface IPointOfCareService /// /// The unique identifier of the unit to update. /// The unit data to apply to the existing record. + /// Task UpdateUnit(ObjectId id, Unit unit); /// /// Retrieves all PointOfCare records asynchronously. /// /// A task that represents the asynchronous operation. The task result contains a list of all PointOfCare entries. + /// Task> GetAll(); /// /// Asynchronously retrieves all PointOfCare configurations. /// /// A task that represents the asynchronous operation. The task result contains a list of all configurations. + /// Task> GetAllConfigs(); /// /// Asynchronously retrieves all point-of-care location information. /// /// A task representing the asynchronous operation, containing a list of all locations. + /// Task> GetAllLocationInfo(); /// @@ -51,6 +57,7 @@ public interface IPointOfCareService /// /// The unique identifier of the point of care configuration to update. /// The new configuration data to apply. + /// Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration); /// @@ -58,12 +65,14 @@ public interface IPointOfCareService /// /// The unique identifier of the to look up. /// A task that represents the asynchronous lookup operation. The task result contains the matching if found, or null when no entity with the specified identifier exists. + /// Task FindById(ObjectId id); /// /// Retrieves a entity by its identifier, including all of its associated configuration data. /// /// The of the to locate. /// A task that yields the matching with its full configuration, or null if no entity is found for the supplied identifier. + /// Task FindByIdAllConfig(ObjectId id); /// @@ -71,6 +80,7 @@ public interface IPointOfCareService /// /// The unique identifier of the unit whose PointOfCare records should be retrieved. /// A task that returns a collection of PointOfCare records for the specified unit, or null if no records are found. + /// Task?> FindAllByUnitId(ObjectId unit); /// @@ -78,6 +88,7 @@ public interface IPointOfCareService /// /// The room identifier used to look up the associated Points of Care. /// A task that represents the asynchronous operation. The task result contains an enumerable of Points of Care found for the given room, or null if no matching results are found. + /// Task?> FindByRoom(string room); /// @@ -85,6 +96,7 @@ public interface IPointOfCareService /// /// The bed identifier used to look up the associated points of care. /// A task that represents the asynchronous operation. The task result contains a collection of instances matching the bed, or null if no match is found. + /// Task?> FindByBed(string bed); /// @@ -92,6 +104,7 @@ public interface IPointOfCareService /// /// The list of unit identifiers used to look up the associated points of care. /// A task that represents the asynchronous operation, containing the list of points of care matching the provided unit identifiers. + /// Task> FindAllByUnitIds(List unitIds); /// @@ -103,6 +116,7 @@ public interface IPointOfCareService /// When true, associated patient data is included in the result; when false, only the point of care information is returned. /// Token to cancel the asynchronous operation. /// A task that yields the corresponding to the given identifier, or null if it is not found. + /// Task GetInfo(ObjectId id, LocaleEnum? locale = null, bool fillPatientData = true, CancellationToken ct = default); /// @@ -110,12 +124,14 @@ public interface IPointOfCareService /// /// The entity to be inserted. /// A containing the inserted , or null if the insertion was not performed. + /// Task InsertPointOfCare(PointOfCare pointOfCare); /// /// Retrieves the Point of Care associated with the specified patient identifier. /// /// The unique identifier of the patient whose Point of Care is being looked up. /// A task that yields the associated with the patient, or null if no Point of Care is found for the given patient identifier. + /// Task FindPoCByPatientId(ObjectId patientId); /// @@ -124,6 +140,7 @@ public interface IPointOfCareService /// The unique identifier of the entity whose Point of Care status will be updated. /// The Point of Care status to assign to the entity. /// A task that represents the asynchronous status update operation. + /// Task SetPointOfCareStatus(ObjectId id, StatusEnum.PointOfCare status); /// @@ -133,6 +150,7 @@ public interface IPointOfCareService /// The point-of-care status used to filter the results. /// When true, virtual points of care are excluded from the results; otherwise, they are included. /// A task that returns the matching collection of entries. + /// Task> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare poc, bool excludeVirtual = false); @@ -140,6 +158,7 @@ public interface IPointOfCareService /// Checks the next admission for the specified patient location. /// /// The optional identifier of the patient location to check. + /// void CheckNextAdmission(ObjectId? patientLocation); /// /// Retrieves a associated with the specified bed and unit identifier, returning null when no matching record is found. @@ -147,11 +166,13 @@ public interface IPointOfCareService /// The bed identifier used to locate the point of care. /// The MongoDB of the unit the point of care belongs to. /// A that resolves to the matching or null if no record matches the supplied bed and unit. + /// Task FindByBedAndUnitId(string? bed, ObjectId? unitId); /// /// Updates the relay configuration associated with the specified point-of-care device. /// /// The point-of-care device whose relay configuration should be updated. + /// Task UpdateRelayConfig(PointOfCare poc); /// /// Asynchronously retrieves the Point of Care (PoC) associated with the specified patient number. @@ -159,6 +180,7 @@ public interface IPointOfCareService /// /// The unique patient number used to look up the associated Point of Care. /// A task that represents the asynchronous operation. The task result contains the if found, or null if no match exists. + /// Task FindPoCByPatientNumber(string patientNumber); /// @@ -166,43 +188,51 @@ public interface IPointOfCareService /// /// The unique identifier of the unit whose PoCs should be counted. /// A task that represents the asynchronous operation, containing the total number of PoCs linked to the given unit. + /// Task CountPoCsByUnitId(ObjectId unitId); /// /// Asynchronously retrieves the total number of virtual Proofs of Concept (PoCs) associated with the specified unit. /// /// The unique identifier of the unit whose virtual PoCs should be counted. /// A that represents the asynchronous operation, containing the count of virtual PoCs for the given unit. + /// Task CountVirtualPoCsByUnitId(ObjectId unitId); /// /// Retrieves a paginated collection of Points of Care based on the provided filter. /// /// The pagination parameters used to control page size and page number. /// A task that represents the asynchronous operation, containing the paginated response of Points of Care. + /// Task> GetPaginatedPoCs(PaginationFilter filter); /// /// Deletes all PoCs associated with the specified unit identifier. /// /// The unique identifier of the unit whose PoCs should be removed. + /// Task DeletePoCsByUnitId(ObjectId unitId); /// /// Asynchronously retrieves the set of all camera identifiers that are currently in use. /// /// A task that represents the asynchronous operation. The task result contains a HashSet of ObjectId values representing the cameras currently in use. + /// Task> FindAllIdCamerasInUse(); /// /// Asynchronously retrieves the set of all ID relays that are currently in use. /// /// A task that represents the asynchronous operation. The task result contains a of the ID relays currently in use. + /// Task> FindAllIdRelaysInUse(); /// /// Asynchronously retrieves the set of all ID beacons currently in use. /// /// A task containing a of the ID beacons that are active or in use. + /// Task> FindAllIdBeaconsInUse(); /// /// Retrieves all Point of Care entries associated with the specified unit, including their related devices. /// /// The unique identifier of the unit whose Point of Care entries should be retrieved. /// A task that represents the asynchronous operation. The task result contains a collection of Point of Care entries with their devices, or null if no entries are found for the given unit. + /// Task?> FindAllByUnitIdWithDevices(ObjectId unitId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IPublisherService.cs b/adas-core.Application/Services/Interfaces/IPublisherService.cs index 1b515c3b..e3ce9473 100644 --- a/adas-core.Application/Services/Interfaces/IPublisherService.cs +++ b/adas-core.Application/Services/Interfaces/IPublisherService.cs @@ -7,6 +7,7 @@ public interface IPublisherService /// /// The name of the queue to create. /// A task that represents the asynchronous operation. The task result is if the queue was created successfully; otherwise, . + /// Task CreateQueue(string queueName); /// /// Asynchronously sends an error message to the specified message queue. @@ -14,6 +15,7 @@ public interface IPublisherService /// The error payload or message object to be sent to the queue. /// The name of the target message queue. /// A task that represents the asynchronous operation, containing a boolean value that indicates whether the message was successfully sent. + /// Task SendMessageError(object obj, string queueName); /// /// Asynchronously sends the specified object as a message to the named queue. @@ -21,6 +23,7 @@ public interface IPublisherService /// The object payload to serialize and publish to the queue. /// The name of the target queue that will receive the message. /// A task that resolves to true if the message was sent successfully, otherwise false. + /// Task SendMessage(object obj, string queueName); /// /// Asynchronously sends a message to the specified message queue and returns a value indicating whether the operation succeeded. @@ -28,5 +31,6 @@ public interface IPublisherService /// The message content to be sent to the queue. /// The name of the target queue where the message will be delivered. /// A task that represents the asynchronous operation. The task result is true if the message was sent successfully; otherwise, false. + /// Task SendMessage(string message, string queueName); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IPumpService.cs b/adas-core.Application/Services/Interfaces/IPumpService.cs index 07fb3aba..cb6e03ef 100644 --- a/adas-core.Application/Services/Interfaces/IPumpService.cs +++ b/adas-core.Application/Services/Interfaces/IPumpService.cs @@ -14,6 +14,7 @@ public interface IPumpService: IApiRequestService /// Asynchronously inserts a pump observation record into the underlying data store. /// /// The pump observation to persist. + /// Task InsertPumpObservation(PumpObservation obs); // Mapping @@ -22,6 +23,7 @@ public interface IPumpService: IApiRequestService /// /// The source pump observation to be mapped. /// A task that represents the asynchronous mapping operation, containing the resulting or null if no result is available. + /// Task MapPumpObservation(PumpObservation obs); // Consultas por paciente @@ -31,11 +33,13 @@ public interface IPumpService: IApiRequestService /// The unique identifier of the patient whose pump observations are being queried. /// The maximum number of recent observations to return. Defaults to 1. /// A task that represents the asynchronous operation. The task result contains a list of the most recent pump observations for the patient, up to the specified count. + /// Task> FindLastPumpObservations(ObjectId patientId, int num = 1); /// /// Asynchronously retrieves the most recent observation timestamp for every patient, returning a dictionary keyed by patient identifier. /// /// A task that represents the asynchronous operation. The task result contains a dictionary mapping each patient's to their last observation . + /// Task> FindAllLastPatientObservationTime(); // Gestión de configuración @@ -44,35 +48,41 @@ public interface IPumpService: IApiRequestService /// /// The unique identifier used to look up the configuration pump items. /// A task that resolves to a list of objects matching the given identifier, or null when no items are found. + /// Task?> GetItemsById(string id); /// /// Asynchronously retrieves the full list of pump configurations from the underlying data source. /// /// A task that resolves to a containing all pump configurations, or null if no configurations are available. + /// Task?> GetAllPumpConfig(); /// /// Asynchronously retrieves the pump configuration associated with the specified identifier. /// /// The unique identifier of the pump configuration to retrieve. /// A task that represents the asynchronous operation. The task result contains the instance matching the specified identifier, or if no configuration is found. + /// Task GetPumpConfigsById(string id); /// /// Asynchronously updates the pump configuration. /// /// The pump configuration to update. /// A task that represents the asynchronous operation, containing the updated or null if not found. + /// Task UpdatePumpConfig(ConfigPumps config); /// /// Inserts a new pump configuration into the system asynchronously. /// /// The pump configuration to be inserted. /// A task that represents the asynchronous operation, containing the inserted or null if the insertion fails. + /// Task InsertPumpConfig(ConfigPumps config); /// /// Deletes the specified pump configuration. /// /// The pump configuration to delete. /// A task that represents the asynchronous delete operation. The task result is true if the configuration was deleted successfully; otherwise, false. + /// Task DeletePumpConfig(ConfigPumps config); // Paginación @@ -82,6 +92,7 @@ public interface IPumpService: IApiRequestService /// /// The pagination filter that defines page size, page number, and any additional filtering criteria applied to the pump observations. /// A task that resolves to a containing the matching pump observations, or null when no results are found. + /// Task?> GetPaginatedPump(PaginationFilter filter); // Archivado / limpieza @@ -89,17 +100,20 @@ public interface IPumpService: IApiRequestService /// Asynchronously deletes records associated with the specified patient identifier. /// /// The ObjectId of the patient whose related records should be deleted. + /// Task DeleteByPatientId(ObjectId id); /// /// Archives the specified patient, marking the patient record as archived in the system. /// /// The patient to be archived. + /// Task Archive(Patient patient); /// /// Asynchronously archives the data associated with the specified patient identifier. /// /// The unique identifier of the patient whose data should be archived. /// A task that represents the asynchronous archive operation. + /// Task ArchiveByPatientId(ObjectId id); // Mantenimiento ids @@ -109,5 +123,6 @@ public interface IPumpService: IApiRequestService /// The name of the field whose ObjectId value should be updated. /// The new ObjectId value to assign. /// The existing ObjectId value to be replaced. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IRecordingAlertService.cs b/adas-core.Application/Services/Interfaces/IRecordingAlertService.cs index b22926ee..f2d7974c 100644 --- a/adas-core.Application/Services/Interfaces/IRecordingAlertService.cs +++ b/adas-core.Application/Services/Interfaces/IRecordingAlertService.cs @@ -12,21 +12,25 @@ public interface IRecordingAlertService : IApiRequestService /// The identifier of the patient whose recording alerts are being queried. /// The maximum number of most recent recording alerts to return. Defaults to 2. /// A task representing the asynchronous operation, containing a list of the patient's most recent recording alerts. + /// Task> FindLastRecordingAlert(ObjectId patientId, int num = 2); /// /// Deletes records associated with the specified patient identifier. /// /// The unique identifier of the patient whose related records should be removed. + /// Task DeleteByPatientId(ObjectId id); /// /// Asynchronously archives the specified patient, moving their record out of the active set. /// /// The patient to archive. + /// Task Archive(Patient patient); /// /// Archives the records associated with the specified patient identifier. /// /// The identifying the patient whose related records should be archived. + /// Task ArchiveByPatientId(ObjectId id); /// @@ -36,5 +40,6 @@ public interface IRecordingAlertService : IApiRequestService /// The identifier used to select the target records to update. /// The new ObjectId value to assign to the matching records. /// The existing ObjectId value to be replaced in the matching records. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IRecordingService.cs b/adas-core.Application/Services/Interfaces/IRecordingService.cs index 19a1869c..c5c3f7a5 100644 --- a/adas-core.Application/Services/Interfaces/IRecordingService.cs +++ b/adas-core.Application/Services/Interfaces/IRecordingService.cs @@ -15,6 +15,7 @@ public interface IRecordingService : IApiRequestService /// The patient whose recording should be cancelled. /// The point of care associated with the recording to be cancelled. /// A task that represents the asynchronous operation, containing a boolean value indicating the outcome of the cancel recording request. + /// Task SendCancelRecordingToRecordingApi(Patient patient, PointOfCare poc); /// @@ -31,6 +32,7 @@ public interface IRecordingService : IApiRequestService /// The description of the alarm, if applicable. /// Indicates whether to start the recording (default is true). /// The type of alarm (default is Manual). + /// Task SendRecordingDataToQueue(Patient patient, PointOfCare poc, DateTime? date, DateTime? endDate, DateTime? eventDate, AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, string? alarmDescription, bool start = true, AlarmEnum.Type type = AlarmEnum.Type.Manual); @@ -42,6 +44,7 @@ public interface IRecordingService : IApiRequestService /// The point of care associated with the recording. /// The manual recording payload to transmit. /// A flag indicating whether the recording is being started or stopped. + /// Task SendRecordingData(Patient patient, PointOfCare poc, ManualRecording manualRecording, bool start); /// @@ -51,6 +54,7 @@ public interface IRecordingService : IApiRequestService /// The point of care where the recording was taken. /// The automatic recording data to be sent. /// A task that represents the asynchronous operation, containing a boolean indicating whether the data was sent successfully. + /// Task SendAutoRecordingData(Patient patient, PointOfCare poc, RecordingData automaticRecording); /// @@ -58,5 +62,6 @@ public interface IRecordingService : IApiRequestService /// /// The identifier of the room whose recordings are being requested. /// A task that returns a list of for the room, or null if no recordings are available. + /// Task?> GetRecordings(int roomName); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IRelayService.cs b/adas-core.Application/Services/Interfaces/IRelayService.cs index 47b8c12a..4e118445 100644 --- a/adas-core.Application/Services/Interfaces/IRelayService.cs +++ b/adas-core.Application/Services/Interfaces/IRelayService.cs @@ -13,23 +13,27 @@ public interface IRelayService /// /// The relay whose status is being checked. /// A task that represents the asynchronous operation, containing the current of the relay. + /// Task CheckRelayStatus(Relay relay); /// /// Asynchronously checks the current status of the relay identified by the specified identifier. /// /// The unique identifier of the relay whose status is being queried. /// A task that represents the asynchronous operation, containing the of the requested relay. + /// Task CheckRelayStatus(ObjectId relayId); /// /// Powers on the specified relay. /// /// The relay to power on. + /// Task PowerOn(Relay relay); /// /// Powers off the specified relay by sending a command to deactivate it. /// /// The relay to power off. + /// Task PowerOff(Relay relay); /// /// Sets a manual relay with the specified status for the given point of contact and relay type. @@ -37,18 +41,21 @@ public interface IRelayService /// The status to apply to the manual relay. /// The identifier of the point of contact associated with the relay. /// The type of relay to set manually. + /// Task SetManualRelay(RelayEnum.Status status, ObjectId pocId, RelayEnum.Type type); /// /// Retrieves a relay by its unique identifier, returning null if no matching relay is found. /// /// The unique identifier of the relay to look up. /// A that resolves to the if found, or null if no relay matches the provided identifier. + /// Task GetById(ObjectId relay); /// /// Retrieves the list of objects corresponding to the specified collection of relay identifiers. /// /// The list of values identifying the relays to retrieve. May be null. /// A containing the relays found for the provided identifiers. + /// List GetRelayInList(List? relayList); /// /// Retrieves the relays of a specified type from the provided configuration relay list. @@ -56,6 +63,7 @@ public interface IRelayService /// The list of relay ObjectIds to filter, or null if no configuration relays are available. /// The relay type to match against the configuration relays. /// A list of objects that match the specified . + /// List GetRelayByTypeInList(List? configurationRelayList, RelayEnum.Type type); /// @@ -63,12 +71,14 @@ public interface IRelayService /// /// The pagination filter containing the criteria used to retrieve the relays. /// A task that represents the asynchronous operation, containing the paginated response with the requested relays. + /// Task> GetPaginatedRelays(PaginationFilter request); /// /// Inserts a new relay record based on the provided request data. /// /// The relay entity to be inserted. /// A task that resolves to the inserted , or null if the insert did not return a value. + /// Task InsertRelay(Relay request); /// /// Updates an existing relay identified by the specified with the provided data. @@ -77,5 +87,6 @@ public interface IRelayService /// The unique identifier of the relay to update. /// The relay data containing the updated values. /// A task that resolves to the updated , or null if the relay was not found. + /// Task UpdateRelayById(ObjectId objectId, Relay relay); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ISendAlertService.cs b/adas-core.Application/Services/Interfaces/ISendAlertService.cs index 55b3e0be..79ccf966 100644 --- a/adas-core.Application/Services/Interfaces/ISendAlertService.cs +++ b/adas-core.Application/Services/Interfaces/ISendAlertService.cs @@ -8,15 +8,18 @@ public interface ISendAlertService /// Asynchronously retrieves a list of available queues. /// /// A task that represents the asynchronous operation, containing the list of instances. + /// Task> GetQueues(); /// /// Retrieves a list of performance records. /// /// A list of objects. + /// List GetPerformance(); /// /// Retrieves a list of API clients. /// /// A task that represents the asynchronous operation. The task result contains a list of . + /// Task> GetApiClients(); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IServiceConfigService.cs b/adas-core.Application/Services/Interfaces/IServiceConfigService.cs index 534634e3..1818052f 100644 --- a/adas-core.Application/Services/Interfaces/IServiceConfigService.cs +++ b/adas-core.Application/Services/Interfaces/IServiceConfigService.cs @@ -9,5 +9,6 @@ public interface IServiceConfigService /// /// The identifier of the service configuration to retrieve. /// A task that represents the asynchronous operation. The task result contains the matching if found, or null if no configuration exists for the given identifier. + /// Task Get(string id); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ISubscriberGroupedService.cs b/adas-core.Application/Services/Interfaces/ISubscriberGroupedService.cs index 396490c4..5344fea0 100644 --- a/adas-core.Application/Services/Interfaces/ISubscriberGroupedService.cs +++ b/adas-core.Application/Services/Interfaces/ISubscriberGroupedService.cs @@ -11,34 +11,40 @@ public interface ISubscriberGroupedService /// Retrieves a list of subscribers organized into groups. /// /// A list of instances representing the grouped subscribers. + /// List GetGrouped(); /// /// Removes grouped observations associated with the specified patient identifier. /// /// The unique identifier of the patient whose grouped observations should be removed. + /// void RemoveGroupedObsByPatientId(string patientId); /// /// Removes a WebSocket subscriber associated with the specified patient based on the provided location. /// /// The identifier of the patient whose WebSocket subscriber should be removed. /// The new patient location used to identify the subscriber to remove, or null to remove without location filtering. + /// void RemoveWsSubscriberByLocation(string patientId, PatientLocation? newLocation); /// /// Removes the specified workstation identifier associated with a patient's WS subscriber entry. /// /// The identifier of the patient whose WS subscriber entry will be updated. /// The workstation identifier to remove from the patient's WS subscriber entry. + /// void RemoveWsSubscriberPatientIdAndWsId(string patientId, string wsIdToRemove); /// /// Validates the provided instance to identify empty subscriber groups. /// /// The subscriber group instance to be checked for empty groups. /// A containing validation messages for any empty subscriber groups found; returns an empty list if all groups are valid. + /// List CheckEmptySubscriberGroup(WsSubscriberGrouped wsl); /// /// Adds a new subscriber together with its associated group information to the system. /// /// The web service representation of the subscriber and its group assignments to be added. + /// void AddSubscriberGrouped(WsSubscriberGrouped wsSubscriberGrouped); /// @@ -49,6 +55,7 @@ public interface ISubscriberGroupedService /// The time zone identifier used for the observation context. /// The connection identifier for the current request or session. /// The grouped observation to be checked against the subscription. + /// void CheckOnSubscriptionGroup(GroupedField groupedField, ObjectId patientId, string timeZoneId, string connectionId, GroupedObservation go); @@ -57,5 +64,6 @@ public interface ISubscriberGroupedService /// /// The hash code identifying the group whose last grouped observation should be updated. /// The new grouped observation to set as the last grouped observation in the group. + /// void UpdateLastGroupedObsInGroup(string wsgHashCode, GroupedObservation newGroupedObservation); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ISubscribersService.cs b/adas-core.Application/Services/Interfaces/ISubscribersService.cs index 54e555de..1c241a8d 100644 --- a/adas-core.Application/Services/Interfaces/ISubscribersService.cs +++ b/adas-core.Application/Services/Interfaces/ISubscribersService.cs @@ -9,28 +9,33 @@ public interface ISubscribersService /// Retrieves the list of subscribers. /// /// A list of instances representing the subscribers. + /// List GetSubscribers(); /// /// Retrieves a associated with the specified context connection identifier. /// /// The unique identifier of the context connection used to look up the subscriber. /// The matching the given connection identifier, or null if no subscriber is found. + /// WsSubscriber? GetById(string contextConnectionId); /// /// Retrieves the list of subscribers associated with the specified point of contact (POC) identifier. /// /// The identifier of the point of contact whose subscribers should be returned. /// A list of instances matching the provided POC identifier. + /// List GetByPocId(ObjectId pocId); /// /// Removes a connection identified by the specified context connection identifier. /// /// The unique identifier of the connection to remove. /// An integer indicating the result of the removal operation. + /// int RemoveConnectionById(string contextConnectionId); /// /// Registers the specified WebSocket subscriber to receive notifications or messages. /// /// The instance to be added to the collection of subscribers. + /// void AddSubscriber(WsSubscriber subscriber); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/ITreatmentService.cs b/adas-core.Application/Services/Interfaces/ITreatmentService.cs index fc8c953e..4432271f 100644 --- a/adas-core.Application/Services/Interfaces/ITreatmentService.cs +++ b/adas-core.Application/Services/Interfaces/ITreatmentService.cs @@ -13,33 +13,39 @@ public interface ITreatmentService : IApiRequestService /// Inserts a new record into the underlying data store. /// /// The patient treatment entity to be added. + /// Task Insert(PatientTreatment treatment); /// /// Asynchronously deletes an entity associated with the specified patient identifier. /// /// The representing the unique identifier of the patient whose related entity should be removed. /// A containing true if the deletion was successful; otherwise, false. + /// Task DeleteByPatientId(ObjectId id); /// /// Asynchronously deletes the entity identified by the specified identifier. /// /// The unique identifier of the entity to delete. + /// Task DeleteById(ObjectId id); /// /// Archives records associated with the specified patient identifier. /// /// The ObjectId of the patient whose records should be archived. + /// Task ArchiveByPatientId(ObjectId id); /// /// Archives the specified patient, marking them as archived in the system. /// /// The patient to archive. + /// Task Archive(Patient patient); /// /// Updates an existing patient treatment record in the system. /// /// The patient treatment entity containing the updated information to be persisted. /// A task that represents the asynchronous operation. The task result contains true if the treatment was updated successfully; otherwise, false. + /// Task UpdateTreatment(PatientTreatment patientTreatment); /// /// Updates many records by replacing the specified old ObjectId with the new ObjectId in the field identified by nameId. @@ -47,42 +53,49 @@ public interface ITreatmentService : IApiRequestService /// The name of the field that contains the ObjectId to be updated. /// The new ObjectId value that will replace the existing one. /// The existing ObjectId value to be replaced. + /// Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); /// /// Retrieves all treatments associated with the specified patient identifier. /// /// The unique identifier of the patient whose treatments are to be retrieved. /// A task that represents the asynchronous operation, containing a collection of PatientTreatment objects for the specified patient. + /// Task> GetTreatmentsByPatientId(ObjectId id); /// /// Retrieves the active treatment records associated with the specified patient identifier. /// /// The unique identifier of the patient whose active treatments should be retrieved. /// A task that represents the asynchronous operation, containing an enumerable collection of active records, which may include null entries. + /// Task> GetActiveTreatmentsByPatient(ObjectId id); /// /// Asynchronously retrieves a cursor over the records associated with the specified patient identifier. /// /// The unique identifier of the patient whose treatments should be returned. /// A yielding an that iterates the matching documents. + /// Task> FindByPatientIdAsync(ObjectId patientId); /// /// Asynchronously retrieves all patient treatments associated with the specified patient identifier. /// /// The unique identifier of the patient whose treatments are being queried. /// A task that represents the asynchronous operation, containing a collection of instances for the specified patient. + /// Task> FindByPatientId(ObjectId patientId); /// /// Retrieves the list of bolus treatments associated with the specified patient. /// /// The unique identifier of the patient whose bolus treatments are being retrieved. /// A task that represents the asynchronous operation, containing a list of records representing the patient's bolus treatments. + /// Task> GetBolusTreatments(ObjectId patientId); /// /// Retrieves a paginated list of patient treatments based on the specified filter criteria. /// /// The pagination filter used to control the page number, page size, and other query options. /// A task that represents the asynchronous operation, containing the paginated patient treatment results. + /// Task> GetPaginatedTreatments(PaginationFilter filter); /// /// Retrieves the list of active treatments associated with the specified patient, sorted according to the provided order parameter. @@ -90,5 +103,6 @@ public interface ITreatmentService : IApiRequestService /// The unique identifier of the patient whose active treatments are being queried. /// A string defining the ordering criteria applied to the returned treatments. /// A task that represents the asynchronous operation, containing a list of active entries for the patient. + /// Task> GetActiveTreatmentsByPatientIdAndOrder(ObjectId patientId, string order); } \ No newline at end of file diff --git a/adas-core.Application/Services/Interfaces/IUnitService.cs b/adas-core.Application/Services/Interfaces/IUnitService.cs index 8b21f112..3d333c40 100644 --- a/adas-core.Application/Services/Interfaces/IUnitService.cs +++ b/adas-core.Application/Services/Interfaces/IUnitService.cs @@ -15,11 +15,13 @@ public interface IUnitService /// /// Indicates whether the returned units should include their associated POCs. /// A task representing the asynchronous operation, containing the list of units. + /// Task> GetAll(bool withPocs = false); /// /// Asynchronously retrieves a compact list of all units, returning minimal summary information for each unit. /// /// A task that represents the asynchronous operation. The task result contains a list of objects with the compact information of all units. + /// Task> GetAllCompact(); /// @@ -27,6 +29,7 @@ public interface IUnitService /// /// The unique identifier of the unit to retrieve. /// A task that represents the asynchronous operation, containing the compact unit information. + /// Task GetOneCompact(ObjectId id); // Task GetByCodeSysAndCode(string unit); @@ -35,6 +38,7 @@ public interface IUnitService /// /// The name of the unit to look up. /// A task that represents the asynchronous operation. The task result contains the matching if found; otherwise, null. + /// Task GetByName(string unit); // Task GetByPointOfCare(PointOfCare pointOfCare); @@ -46,6 +50,7 @@ public interface IUnitService /// When , populates the related lists on the returned unit. /// When , includes the unit's points of contact in the result. /// A task that yields the located , or if no unit matches the given id. + /// Task GetInfo(ObjectId id, LocaleEnum? dataLocale, bool fillLists = true, bool withPoCs = false); /// /// Retrieves information about a unit identified by the specified , optionally including related points of contact and devices. @@ -54,6 +59,7 @@ public interface IUnitService /// Indicates whether related points of contact should be included in the result. Defaults to true. /// Indicates whether related devices should be included in the result. Defaults to true. /// A task that represents the asynchronous operation. The task result contains the Unit if found, or null if no unit matches the specified identifier. + /// Task GetInfo(ObjectId id, bool withPoCs = true, bool withDevices = true); /// @@ -61,6 +67,7 @@ public interface IUnitService /// /// The unique identifier of the patient whose unit is being looked up. /// A task that represents the asynchronous lookup, containing the matching if found, or null if no unit is associated with the patient. + /// Task FindByPatientId(ObjectId patientId); // Task?> FindByLocation(PatientLocation location); @@ -69,12 +76,14 @@ public interface IUnitService /// /// The unique identifier of the to retrieve. May be null. /// A task that represents the asynchronous operation. The task result contains the if found; otherwise, null. + /// Task FindById(ObjectId? id); /// /// Asynchronously retrieves a entity matching the specified name. /// /// The name used to look up the unit. Can be null. /// A task that resolves to the matching if found; otherwise, null. + /// Task FindByName(string? name); /// @@ -84,6 +93,8 @@ public interface IUnitService /// The unit name to search for. May be null. /// The point-of-contact (POC) name to search for. May be null. /// A containing the matched , or null if no unit is found. + /// Task FindByUnitNameOrPocName(string? name, string? pocName); //Task FindByPointOfCare(PointOfCare pointOfCare); @@ -92,12 +103,14 @@ public interface IUnitService /// /// The instance to be inserted. /// A task that resolves to the inserted , or null if the insertion did not produce a result. + /// Task InsertOne(Unit unit); /// /// Updates the specified unit in the system. /// /// The unit containing the updated information to persist. /// A task that returns the updated , or null if the unit was not found. + /// Task UpdateUnit(Unit unit); /// /// Asynchronously retrieves the collection of units associated with the specified master list identifier and master list type. @@ -106,6 +119,7 @@ public interface IUnitService /// The unique identifier of the master list whose units should be retrieved. /// The type of the master list used to scope the unit lookup. /// A task that returns an of when matches exist, or null when no matching units are found. + /// Task?> FindUnitsByMasterListId(ObjectId masterListId, MasterListType masterListType); /// /// Asynchronously counts the number of units associated with the specified master list, filtered by the given master list type. @@ -113,18 +127,21 @@ public interface IUnitService /// The unique identifier of the master list whose units should be counted. /// The type of the master list used to scope the count to the appropriate unit category. /// A that represents the asynchronous operation, containing the total number of units matching the specified master list. + /// Task CountUnitsByMasterListId(ObjectId masterListId, MasterListType masterListType); /// /// Asynchronously retrieves the collection of units associated with the specified master list identifier. /// /// The identifier of the master list whose units are to be retrieved. /// A task that represents the asynchronous operation, containing the collection of units that belong to the specified master list. + /// Task> FindUnitsByMasterListId(ObjectId masterListId); /// /// Updates the unit master list based on the provided unit ID list DTO. /// /// The DTO containing the list of unit IDs to be used for updating the master list. /// A task that represents the asynchronous operation. The task result contains the updated , or null if the update was not applicable. + /// Task UpdateUnitMasterList(UpdateUnitIdListDto updateUnitListDto); /// /// Asynchronously updates the configuration for the specified unit using the provided configuration data. @@ -132,12 +149,14 @@ public interface IUnitService /// The parsed identifier of the unit whose configuration will be updated. /// The new configuration values to apply to the unit. /// A task that resolves to true if the configuration was successfully updated; otherwise, false. + /// Task UpdateConfiguration(ObjectId unitIdParsed, UnitConfiguration unitConfiguration); /// /// Asynchronously deletes a unit identified by the provided entity's identifier. /// /// The unit entity whose identifier is used to locate and delete the record. /// A that represents the asynchronous operation, containing a value indicating whether the unit was successfully deleted. + /// Task DeleteUnitById(Unit unit); /// /// Updates the information of an existing unit identified by , including its name, title, and optionally its configuration object ID. @@ -148,6 +167,7 @@ public interface IUnitService /// The new title to assign to the unit. /// An optional configuration object ID to associate with the unit. /// A task that yields the updated , or null if the unit does not exist. + /// Task UpdateUnitInfo(ObjectId unitId, string name, string title, string? configObsId = null); /// /// Retrieves a paginated list of units based on the provided filter, optionally including their associated points of contact. @@ -155,5 +175,6 @@ public interface IUnitService /// The pagination filter that defines the page size, page number, and any additional query criteria. /// A flag indicating whether the response should include the points of contact associated with each unit. /// A task that represents the asynchronous operation, containing the paginated response of units. + /// Task> GetPaginatedUnits(PaginationFilter filter, bool withPoCs); } \ No newline at end of file diff --git a/adas-core.Application/Services/LocalAuditService.cs b/adas-core.Application/Services/LocalAuditService.cs index 5e797b2d..cae454a1 100644 --- a/adas-core.Application/Services/LocalAuditService.cs +++ b/adas-core.Application/Services/LocalAuditService.cs @@ -21,6 +21,7 @@ public class LocalAuditService( /// The original data before the change. /// The modified data after the change. /// An optional reason for the change; when null, the audit log is created without supplying a reason. + /// public async Task CreateAuditLogAsync(ClaimsPrincipal? user, object? dataOriginal, object? dataModified, string? reason) { @@ -48,6 +49,7 @@ public class LocalAuditService( /// /// The data to be deep copied. /// A task representing the asynchronous operation, containing the deep copy of the data, or null if both copy methods fail. + /// public async Task DeepCopyAsync(T data) { try diff --git a/adas-core.Application/Services/MasterListService.cs b/adas-core.Application/Services/MasterListService.cs index f3bc3ac2..dca1880d 100644 --- a/adas-core.Application/Services/MasterListService.cs +++ b/adas-core.Application/Services/MasterListService.cs @@ -23,6 +23,7 @@ namespace adas_core.Application.Services; /// Acts as the concrete implementation of the contract for master list operations. /// /// The type of master list entity managed by the service. Must derive from and expose a public parameterless constructor. +/// public class MasterListService : IMasterListService where T : MasterList, new() { private readonly Lazy _admissionService; @@ -88,6 +89,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The identifier of the master list to delete. /// Thrown when the master list is currently in use and cannot be deleted. + /// public async Task DeleteMasterListById(ObjectId id) { var repository = GetRepository(); @@ -133,6 +135,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier of the master list to which the option will be added. /// The filter option element to add to the master list. /// The resulting entry if the option is successfully added; null if the master list cannot be found, no result is produced, or an error is encountered during the operation. + /// public async Task AddOptionToMasterList(ObjectId id, FilterOptionListElement opt) { try @@ -172,6 +175,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The type name used when propagating the update to the patient item list. /// The locale used for the master list option update and retrieval of the updated entity for auditing. /// The updated , or null if the update failed, the result was null, or an exception occurred. + /// public async Task UpdateMasterListOption(ObjectId id, OptionList opt, string typeName, LocaleEnum locale) { @@ -210,6 +214,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The option containing the new values to apply. /// The name of the type used when updating the associated patient item list. /// The updated if the operation succeeds, or null if the master list is not found or an exception is thrown. + /// public async Task UpdateMasterListOption(ObjectId id, OptionList opt, string typeName) { try @@ -249,6 +254,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The option with the new values to apply to the master list. /// The name of the entity type used when updating the related patient item list. /// The updated when the operation succeeds; null when the update fails or an error is caught. + /// public async Task UpdateFullMasterListOption(ObjectId id, OptionList opt, string typeName) { try @@ -286,6 +292,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier of the option to remove from the master list. /// The name of the type used when cascading the deletion to related patient item lists. /// A task that resolves to true when the option is successfully deleted and the side-effects are applied; otherwise, false. + /// public async Task DeleteMasterListOption(ObjectId id, ObjectId optId, string typeName) { try @@ -322,6 +329,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier of the master list whose option details will be updated. /// The new option details to apply to the master list. /// A task that yields the updated on success, or null when the update fails or an exception is caught and logged. + /// public async Task UpdateOptionDetailsToMasterList(ObjectId id, UpdateMasterListDetailsDto opt) { @@ -354,6 +362,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier of the master list to rename. /// The new name to assign to the master list. /// A task that resolves to true if the master list name was updated successfully; otherwise, false. + /// public async Task UpdateMasterListName(ObjectId id, string name) { try @@ -384,6 +393,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier of the master list to update. /// The new description to apply to the master list. /// A task that resolves to true if the update succeeded; otherwise, false when the update fails or an exception is caught and logged. + /// public async Task UpdateMasterListDescription(ObjectId id, string name) { try @@ -414,6 +424,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier of the master list from which the option will be removed. /// The option to remove from the master list. /// A task that resolves to true if the option was successfully removed; false if the operation failed or an error occurred. + /// public async Task RemoveMasterListOption(ObjectId id, OptionList oldOpt) { try @@ -444,6 +455,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// If an exception occurs during retrieval, the error is logged and an empty collection is returned as a fallback. /// /// A task that represents the asynchronous operation. The task result contains all retrieved entries, or an empty collection if an error occurs. + /// public async Task> GetAllMasterList() { try @@ -463,6 +475,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// If an error occurs, the exception is logged and an empty collection is returned as a fallback. /// /// A task that represents the asynchronous operation, containing a collection of items, or an empty collection if an error is encountered. + /// public async Task> GetAllMasterListWithoutOptions() { try @@ -485,6 +498,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier of the specific option to locate. /// The locale used to resolve the localized option item. /// A containing the matching , or null if no item is found or an error occurs. + /// public async Task FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale) { try @@ -505,6 +519,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The pagination filter whose page size is applied when building each result entry. /// A task that yields an enumerable of containing the mapped master lists, or an empty enumerable if an error occurs. + /// public async Task> GetAllMasterListWithPaginatedOptions( PaginationFilter request) { @@ -534,6 +549,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// Returns 0 if an error occurs while accessing the repository. /// /// A task that represents the asynchronous operation. The task result contains the total count of records, or 0 if an error was encountered. + /// public async Task GetAllMasterListCount() { try @@ -555,6 +571,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The unique identifier of the master list to retrieve. /// The optional locale used to localize the retrieved master list. /// The master list of type if found; otherwise, null. + /// public async Task GetMasterListById(ObjectId id, LocaleEnum? locale) { try @@ -576,6 +593,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The unique identifier of the master list to retrieve. /// The pagination filter that determines the page size for the returned options. /// A task that yields a when the master list is found; otherwise, null. + /// public async Task GetMasterListByIdWithPaginatedOptions(ObjectId id, PaginationFilter request) { @@ -604,6 +622,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The identifier of the master list whose option names are to be retrieved. /// A list of option names for the found master list, or an empty list if the list is not found or an error is encountered. + /// public async Task> GetMasterListOptionsNamesById(ObjectId id) { try @@ -629,6 +648,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier used to locate the master list in the repository. /// The optional text search term used to filter the results; may be null. /// A task that represents the asynchronous operation, containing the list of entries that match the specified identifier and text search criteria. + /// public async Task> GetMasterListByIdAndTextSearch(ObjectId id, string? textSearch) { try @@ -649,6 +669,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier used to locate the master list. /// The filter options applied to narrow the search within the master list. /// A task that represents the asynchronous operation, containing a list of items matching the given criteria. + /// public async Task> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement filterOption) { @@ -661,6 +682,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The name of the master list entry to look up. /// A task that resolves to the matching item of type T, or null when no item is found or the lookup fails. + /// public async Task GetMasterListByName(string name) { try @@ -681,6 +703,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The pagination filter containing the page number and page size used to determine the subset of records to return. /// A task that represents the asynchronous operation. The task result contains a with the paginated data, the current page number, the page size, and the total document count. + /// public async Task> GetPaginatedMasterList(PaginationFilter filter) { var repository = GetRepository(); @@ -707,6 +730,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// Pagination parameters (page number and page size) used to slice the master list result set. /// Pagination parameters whose page size is applied to the options associated with each returned master list item. /// A containing a of with the requested page of master lists, their paginated options, the current page metadata, and the total document count. + /// public async Task> GetPaginatedMasterListWithPaginatedOptions( PaginationFilter listFilter, PaginationFilter optionFilter) { @@ -741,6 +765,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The pagination filter that defines the page number and page size to apply to the results. /// The identifier of the list whose options are being retrieved. /// A containing the requested page of options, the current page metadata, and the total count of available options. + /// public async Task> GetPaginatedOptions(PaginationFilter filter, ObjectId listId) { var repository = GetRepository(); @@ -757,6 +782,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The master list entity to insert. /// The inserted entity retrieved from the repository, or null if the operation fails. + /// public async Task InsertMasterList(T item) { try @@ -781,6 +807,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The item to update in the master list. /// The updated item retrieved from the repository, or null if an error occurred during the update. + /// public async Task UpdateMasterList(T item) { try @@ -810,6 +837,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The master list type used to find the unit (e.g., the primary list reference on the unit). /// The master list type that determines which associated list identifier is returned from the resolved unit. /// A task that yields the associated when a matching list exists, or null when no unit is found or the type is not mapped. + /// public async Task GetAssociatedList(ObjectId id, MasterListType masterListType1, MasterListType masterListType2) { @@ -855,6 +883,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The identifier of the list whose options should be retrieved. /// A list of option names belonging to the matching list, or an empty list if the list is not found. + /// public async Task> GetOptionsOfList(ObjectId id) { var repository = GetRepository(); @@ -869,6 +898,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// Resolves and returns the master list repository instance for the current entity type from the dependency injection service provider. /// /// The instance retrieved from the configured . + /// private IMasterListRepository GetRepository() { return _serviceProvider.GetRequiredService>(); @@ -880,6 +910,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The identifier of the master list whose dependent units and related records need to be updated. /// The update payload describing the master list change to apply to the related patient records. /// The name of the master list type used to scope the update across the affected services. + /// private async Task UpdatePatientItemList(ObjectId id, UpdateOptionMasterListDto opt, string typeName) { // Necesito saber que unidades tienen el id de lista que estamos modificando @@ -897,6 +928,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The master list identifier used to locate the units that reference it. /// The option list containing the item to be removed from the affected records. /// The type name of the master list item to delete. + /// private async Task DeletePatientItemList(ObjectId id, OptionList opt, string typeName) { // Necesito saber que unidades tienen el id de lista que estamos modificando @@ -912,6 +944,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// Asynchronously saves the specified API request by offloading the save operation to a background task. /// /// The API request to be saved. + /// public Task SaveRequestAsync(ApiRequest apiRequest) { return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); })); @@ -921,6 +954,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// Saves the specified API request. /// /// The API request to save. + /// public Task SaveRequest(ApiRequest apiRequest) { return Task.CompletedTask; @@ -932,6 +966,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The master list entity triggering the broadcast; its runtime type name is used to determine the master list category. /// The operation performed on the master list, which is sent to each subscriber along with the localized master list options. + /// private async Task SendMasterListBroadcast(T masterList, OperationType operation) { try @@ -974,6 +1009,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// The new or modified option list item, included in add and update operations. /// The previous option list item, included in delete and update operations. /// The operation type that determines the structure of the broadcast message sent to subscribers. + /// private async Task SendMasterListItemBroadcast(T masterList, OptionList? updatedItem, OptionList? oldItem, OperationType operation) { @@ -1043,6 +1079,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The master list whose associated units should be retrieved. Its identifier and list type are used to look up the related units. /// A task that represents the asynchronous operation, containing a list of instances for the units linked to the specified list, or an empty list if none exist. + /// private async Task> IsInUse(T list) { var units = await _unitService.Value.FindUnitsByMasterListId(list.Id, list.ListType); @@ -1063,6 +1100,7 @@ public class MasterListService : IMasterListService where T : MasterList, /// /// The master list entity whose associated unit count is being queried. /// A task that represents the asynchronous operation. The task result contains the number of units referencing the master list. + /// private async Task IsInUseCount(T list) { return await _unitService.Value.CountUnitsByMasterListId(list.Id, list.ListType); diff --git a/adas-core.Application/Services/MasterListServiceFactory .cs b/adas-core.Application/Services/MasterListServiceFactory .cs index 7942420a..4466c4c2 100644 --- a/adas-core.Application/Services/MasterListServiceFactory .cs +++ b/adas-core.Application/Services/MasterListServiceFactory .cs @@ -35,6 +35,7 @@ public class MasterListServiceFactory( /// An object representing the resolved service instance for the requested master list type. /// Thrown when the type corresponding to cannot be resolved in the adas_core.Domain.Models.Masters namespace. /// Thrown when the generic service type cannot be constructed for the resolved type parameter. + /// public object GetService(MasterListType serviceName) { var typeParameter = Type.GetType($"adas_core.Domain.Models.Masters.{serviceName}, adas-core.Domain") ?? @@ -53,6 +54,7 @@ public class MasterListServiceFactory( /// The type of the service to resolve. Must be a generic type based on MasterListService<> to be successfully handled. /// The resolved service instance implementing for the corresponding item type. /// Thrown when the requested is not a generic MasterListService<>, or when no implementation of can be resolved for the requested item type. + /// public object GetService(Type serviceType) { // Verifica si el tipo es genérico y está basado en MasterList @@ -81,6 +83,7 @@ public class MasterListServiceFactory( /// /// The enumeration value identifying which master list category to resolve to its concrete type. /// The that implements the requested master list category, or when no specific type applies. + /// public Type GetMasterListSpecificType(MasterListType masterListType) { // mapear cada valor de MasterListType a su respectivo tipo específico @@ -118,6 +121,7 @@ public class MasterListServiceFactory( /// The discriminator used to resolve the concrete subtype to create. /// The source whose properties are mapped onto the created specific instance. /// The created specific instance with mapped properties, or null if reflection failed to create the instance. + /// public object? GetTypedMasterList(MasterListType masterListType, MasterList masterList) { // Obtiene el tipo específico de MasterList basado en masterListType @@ -141,6 +145,7 @@ public class MasterListServiceFactory( /// The master list entity to be converted and inserted. /// The result produced by the dynamically invoked InsertMasterList method, or null when the awaited task exposes no result value. /// Thrown when no service is registered for the specified , when the master list cannot be converted to its expected typed instance, or when the InsertMasterList method cannot be found on the resolved service. + /// public async Task InsertMasterList(MasterListType masterListType, MasterList masterList) { dynamic service = GetService(masterListType) ?? @@ -167,6 +172,7 @@ public class MasterListServiceFactory( /// Thrown when no service is registered for the specified . /// Thrown when the provided cannot be converted to its specific typed master list. /// Thrown when the resolved service does not expose an UpdateMasterList method matching the typed master list argument. + /// public async Task UpdateMasterList(MasterListType masterListType, MasterList masterList) { dynamic service = GetService(masterListType) ?? @@ -192,6 +198,7 @@ public class MasterListServiceFactory( /// An optional locale used to localize the returned data; may be null when localization is not required. /// A task that resolves to the retrieved master list item as an , or null when the awaited result has no value. /// Thrown when no service is registered for the supplied , or when the target service does not expose a compatible GetMasterListById method matching the expected parameters. + /// public async Task GetMasterListById(MasterListType masterListType, ObjectId masterListId, LocaleEnum? dataLocale) { @@ -221,6 +228,7 @@ public class MasterListServiceFactory( /// A task that resolves to the located master list option as an , or if the underlying task produced no result. /// Thrown when no service implementation is registered for the given . /// Thrown when the resolved service does not expose the expected FindOptionItemById method. + /// public async Task GetMasterListOptionById(MasterListType masterListType, ObjectId masterListId, ObjectId masterListOptionId, LocaleEnum? dataLocale) @@ -248,6 +256,7 @@ public class MasterListServiceFactory( /// and appending the fixed observation "PatientIncomingData". /// /// A list of nurse observation names, including all configured manual observations and the fixed "PatientIncomingData" entry. + /// public List StringNurseObs() { var stringNurseObs = new List(); @@ -286,6 +295,7 @@ public class MasterListServiceFactory( /// The target locale for translation; when set to Default, no translation is performed. /// The patient whose option list values will be translated in place. /// A task that resolves to the same instance with translated option names, or null if the input patient is null. + /// public async Task GetPatientTraslated(Unit? unit, LocaleEnum? locale, Patient? patient) { if (patient == null) @@ -368,6 +378,7 @@ public class MasterListServiceFactory( /// /// The instance whose property values are read. /// The target object that receives the matching property values. + /// private void MapMasterListProperties(MasterList source, object destination) { // Obtiene las propiedades del tipo de origen y destino diff --git a/adas-core.Application/Services/MedicineService.cs b/adas-core.Application/Services/MedicineService.cs index b9d9be3e..f087787f 100644 --- a/adas-core.Application/Services/MedicineService.cs +++ b/adas-core.Application/Services/MedicineService.cs @@ -36,6 +36,7 @@ public class MedicineService( /// Retrieves all medicines from the repository asynchronously. /// /// A task representing the asynchronous operation, containing a list of all entities. + /// public async Task> GetAll() { return await medicineRepository.GetAll(); @@ -46,6 +47,7 @@ public class MedicineService( /// /// The unique code identifier of the medicine to retrieve. /// A instance if a medicine with the specified code exists; otherwise, null. + /// public async Task GetByCode(string code) { return await medicineRepository.GetMedicine(code); @@ -56,6 +58,7 @@ public class MedicineService( /// /// A list of strings representing the codes or notes used to search for matching medicines. /// A task that represents the asynchronous operation, containing the list of objects that match the specified codes or notes. + /// public async Task> GetByCodeOrNote(List codeNote) { return await medicineRepository.GetMedicineByCodeOrNote(codeNote); @@ -67,6 +70,7 @@ public class MedicineService( /// /// The name of the medicine to look up. /// A if a match is found; otherwise, null. + /// public async Task GetByName(string name) { return await medicineRepository.GetMedicineByName(name); @@ -77,6 +81,7 @@ public class MedicineService( /// /// The patient treatments to resolve medicines for. Null entries are skipped. /// An enumerable of medicines resolved from the supplied treatments, aggregating types, codes, groups, and notes when a treatment specifies a RequestedGiveTreatment name. + /// public async Task> GetMedicinesOfTreatments(IEnumerable treatments) { var totalMedicines = new List(); @@ -165,6 +170,7 @@ public class MedicineService( /// /// The unique identifier of the patient whose active medicines are being queried. /// A task that represents the asynchronous operation, containing an enumerable collection of instances linked to the patient's active treatments. + /// public async Task> GetActiveMedicinesByPatient(ObjectId patientId) { var activeTreatments = await treatmentService.GetActiveTreatmentsByPatient(patientId); @@ -177,6 +183,7 @@ public class MedicineService( /// /// The pagination filter containing the page number and page size used to determine which subset of medicines to return. /// A task that represents the asynchronous operation. The task result contains a with the medicines for the requested page, the current page number, the page size, and the total count of medicines matching the query. + /// public async Task> GetPaginatedMedicines(PaginationFilter filter) { var result = medicineRepository.GetPaginatedMedicines(filter); @@ -201,6 +208,7 @@ public class MedicineService( /// The unique identifier of the medicine to retrieve. /// The entity if found; otherwise, the method throws an exception. /// Thrown when no medicine is found for the specified . + /// public async Task GetMedicineById(ObjectId medicineId) { return await medicineRepository.GetMedicineById(medicineId) ?? @@ -213,6 +221,7 @@ public class MedicineService( /// The medicine entity to create. /// The newly created entity. /// Thrown when the repository returns a null result, indicating the creation failed. + /// public async Task PostMedicine(Medicine medicine) { var result = await medicineRepository.PostMedicine(medicine) ?? @@ -226,6 +235,7 @@ public class MedicineService( /// /// The medicine entity containing the updated information. /// The updated , or null if the update did not produce a result. + /// public async Task UpdateMedicine(Medicine medicine) { var oldMedicine = GetMedicineById(medicine.Id); @@ -239,6 +249,7 @@ public class MedicineService( /// Captures the existing medicine state prior to deletion to preserve audit trail details. /// /// The unique identifier of the medicine to delete. + /// public async Task DeleteMedicineById(ObjectId medicineId) { var oldMedicine = GetMedicineById(medicineId); @@ -250,6 +261,7 @@ public class MedicineService( /// Asynchronously retrieves all distinct medicine types from the repository. Returns an empty list if an exception occurs during the retrieval process. /// /// A task representing the asynchronous operation, containing a list of distinct medicine type strings, or an empty list if an error occurs. + /// public async Task> GetAllTypes() { try @@ -269,6 +281,7 @@ public class MedicineService( /// Returns an empty list if an error occurs while fetching or converting the data. /// /// A task that represents the asynchronous operation, containing a list of distinct group strings, or an empty list if an exception is encountered. + /// public async Task> GetAllGroups() { try @@ -287,6 +300,7 @@ public class MedicineService( /// Retrieves all distinct medicine names from the repository asynchronously, returning an empty list if any error occurs during the data retrieval or mapping process. /// /// A task that represents the asynchronous operation. The task result contains a list of medicine names, or an empty list if the operation fails. + /// public async Task> GetAllNames() { try @@ -306,6 +320,7 @@ public class MedicineService( /// Returns an empty list if an exception occurs during retrieval. /// /// A task representing the asynchronous operation, containing a list of code strings, or an empty list if an error occurs. + /// public async Task> GetAllCodes() { try @@ -327,6 +342,7 @@ public class MedicineService( /// /// The patient treatment whose notes are used to derive the parental nutrition medicine. /// A task containing the calculated , or null when no "NPT" note is found or when an error is logged during processing. + /// private Task CalculateParentalNutritionMedicine(PatientTreatment treatment) { Medicine? medicine = null; diff --git a/adas-core.Application/Services/NoticeService.cs b/adas-core.Application/Services/NoticeService.cs index 5af6aee2..1d3912dd 100644 --- a/adas-core.Application/Services/NoticeService.cs +++ b/adas-core.Application/Services/NoticeService.cs @@ -35,6 +35,7 @@ public class NoticeService( /// Deletes the specified notice by delegating to the ID-based deletion routine. /// /// The notice to delete; its Id is used to identify the record to remove. + /// public async Task DeleteNoticeAsync(Notice notice) { await DeleteNoticeByIdAsync(notice.Id); @@ -44,6 +45,7 @@ public class NoticeService( /// Deletes a notice identified by its unique ID, creating an audit log entry and broadcasting the deletion when successful. If the notice is not found, the operation is logged and the method returns without making changes; any unexpected exception is logged without being rethrown. /// /// The unique identifier of the notice to delete. + /// public async Task DeleteNoticeByIdAsync(ObjectId noticeId) { try @@ -72,6 +74,7 @@ public class NoticeService( /// /// The unique of the notice to retrieve. /// A instance if found; otherwise, null when an exception is thrown during the search. + /// public async Task GetNoticeByIdAsync(ObjectId noticeId) { try @@ -92,6 +95,7 @@ public class NoticeService( /// The type of notice to filter the search by. /// A task that represents the asynchronous operation, containing a collection of objects matching the specified type. /// Thrown when no notices are found for the specified . + /// public async Task?> GetNoticeByTypeAsync(string noticeType) { return await noticeRepository.FindByType(noticeType) ?? @@ -102,6 +106,7 @@ public class NoticeService( /// Retrieves all notices from the repository asynchronously. /// /// A task that represents the asynchronous operation. The task result contains a collection of all entities. + /// public async Task> GetNoticesAsync() { return await noticeRepository.FindAll(); @@ -112,6 +117,7 @@ public class NoticeService( /// /// The notice to insert. A new identifier is assigned before persistence. /// The inserted notice with its newly assigned identifier, or null if the operation fails. + /// public async Task InsertNotice(Notice notice) { try @@ -138,6 +144,7 @@ public class NoticeService( /// /// The notice entity containing the updated data. /// Thrown when the notice cannot be found in the repository. + /// public async Task UpdateNoticeAsync(Notice notice) { try @@ -158,6 +165,7 @@ public class NoticeService( /// Processes an API request to create, update, or delete a notice based on the request type. Validates required fields for new and updated notices, skips processing when the notice or its description is missing, and logs any exceptions encountered. /// /// The API request containing the notice payload and the operation type (NewNotice, UpdateNotice, or DeleteNotice) to perform. + /// public async Task SaveRequest(ApiRequest apiRequest) { try @@ -209,6 +217,7 @@ public class NoticeService( /// /// The API request to save. /// A task that represents the asynchronous save operation. + /// public Task SaveRequestAsync(ApiRequest apiRequest) { return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); })); @@ -220,6 +229,7 @@ public class NoticeService( /// /// The ObjectId of the display used to look up associated notices. /// A task containing an of objects matching the display, or null if the operation fails. + /// public async Task?> GetNoticesByDisplayId(ObjectId displayId) { try @@ -239,6 +249,8 @@ public class NoticeService( /// /// The notice to broadcast. Its DisplayId is used to resolve the target display and its subscribers. /// The operation type that identifies the kind of notice being broadcast and is forwarded to each subscriber. + /// private async void SendNoticeBroadcast(Notice notice, OperationType operation) { try diff --git a/adas-core.Application/Services/ObservationDemoService.cs b/adas-core.Application/Services/ObservationDemoService.cs index 41d08db7..7afc8660 100644 --- a/adas-core.Application/Services/ObservationDemoService.cs +++ b/adas-core.Application/Services/ObservationDemoService.cs @@ -26,6 +26,7 @@ public class ObservationDemoService( /// The patient to associate with the generated alarms. /// The list of fields used to look up alarm configurations and produce alarms. /// A task that represents the asynchronous operation, containing the list of mapped instances that were successfully resolved. + /// public async Task> GenerateAlarmByField(Patient patient, List dataAlarmfields) { var listToReturn = new List(); @@ -87,6 +88,7 @@ public class ObservationDemoService( /// The patient to associate the generated observations with. /// The list of fields used to look up observation configurations and drive observation generation. /// A task that returns the list of generated instances; entries are omitted when no configuration is found for a field. + /// public async Task> GenerateObservationByField(Patient patient, List dataFields) { var listToReturn = new List(); @@ -161,6 +163,7 @@ public class ObservationDemoService( /// The patient to associate the generated grouped observation with. /// The grouped field configuration that defines the names, results, regularity, and maximum number of observations to generate. /// A task that returns the populated containing the generated observations. + /// public async Task GenerateGroupedObservation(Patient patient, GroupedField groupedField) { if (groupedField.Names.IsNullOrEmpty() && groupedField.Name != null) groupedField.Names.Add(groupedField.Name); @@ -235,6 +238,7 @@ public class ObservationDemoService( /// The configuration observation whose DemoConfig drives the value generation. If null or its DemoConfig is null, the method returns "-". /// The previous value, passed through to PickSingleValue as context for the new random value generation. /// A list of generated values when the configuration indicates an array, or a single generated value otherwise. Null is returned when no value could be picked. + /// private static object? GenerateValueRandom(ConfigObservation? firstCof, object? prevValue) { if (firstCof?.DemoConfig == null) @@ -261,6 +265,8 @@ public class ObservationDemoService( /// The configuration that defines how the value should be selected, including the list of options, the numeric range, and the selection mode. /// The previously selected value, used as the base for percentage-based variation when generating a new numeric value; ignored when no previous integer value is available. /// A randomly selected value from the configured options or a generated numeric value clamped within the defined range; null when the configuration does not allow a value to be produced. + /// private static object? PickSingleValue(DemoConfig? config, object? prevValue) { if (config == null) return null; diff --git a/adas-core.Application/Services/ObservationService.cs b/adas-core.Application/Services/ObservationService.cs index b95bee00..4fd34714 100644 --- a/adas-core.Application/Services/ObservationService.cs +++ b/adas-core.Application/Services/ObservationService.cs @@ -24,6 +24,7 @@ namespace adas_core.Application.Services; /// Provides the concrete implementation of the contract, /// encapsulating the business logic required to manage and expose observation-related operations. /// +/// public class ObservationService : IObservationService { private readonly ICacheService _cacheService; @@ -170,6 +171,7 @@ public class ObservationService : IObservationService /// The maximum number of recent observations to return. Defaults to 2. /// An optional list of observation codes/names used to narrow down which observations are considered. /// A task that represents the asynchronous operation, containing a list of the patient's most recent entries. + /// public async Task> FindLastObservations(ObjectId patientId, int num = 2, List? filterObservations = null) { @@ -185,6 +187,7 @@ public class ObservationService : IObservationService /// Optional list of fields to filter the aggregated observations by; entries with null or whitespace names are ignored when building the cache key. When null, an empty field set is used. /// Cancellation token forwarded to the cache and repository operations. /// A task containing the list of values, either served from cache or freshly aggregated from the repository on a cache miss. + /// private async Task> AggregatedLastObsCached( ObjectId patientId, List? filterObservations, @@ -227,6 +230,7 @@ public class ObservationService : IObservationService /// When true (default), applies a name-based mapping to each observation; when false, returns the raw results as they come from the cache. /// Cancellation token to cancel the asynchronous operation. /// A task containing the list of patient observations, either as raw cached entries or as mapped values depending on . + /// public async Task> FindLastObservationsByField( ObjectId patientId, List? filterObservations = null, @@ -256,6 +260,7 @@ public class ObservationService : IObservationService /// /// The patient observation to be mapped. /// A task that represents the asynchronous operation. The task result contains the mapped , or null if no matching mapping is found. + /// public async Task MapObservationsByName(PatientObservation obs) { return await _configObservationService.Map(obs, true); @@ -267,6 +272,7 @@ public class ObservationService : IObservationService /// The patient observation to be mapped. /// When true, restricts the mapping to name-based lookups only. /// A task containing the mapped , or null if the observation is ignored, not found, or an exception is raised during processing. + /// public async Task MapObservation(PatientObservation obs, bool onlyByName = false) { try @@ -311,6 +317,10 @@ public class ObservationService : IObservationService /// Observation /// /// True if it needs to be inserted + /// + /// public async Task InsertObservation(PatientObservation obs, bool persistObs = true, bool mapObs = true) { try @@ -369,6 +379,7 @@ public class ObservationService : IObservationService /// Any exception thrown during the operation is caught and logged. /// /// The patient observation provided by the nurse to be mapped, persisted, cached, broadcast, and audited. + /// public async Task InsertNurseObservation(PatientObservation obs) { try @@ -416,6 +427,7 @@ public class ObservationService : IObservationService /// Indicates whether the new observation should be persisted when inserted. /// Indicates whether the new observation should be mapped when inserted. /// A task that resolves to true if the observation was inserted because the value changed, or false if the most recent observation already has the same value and no insertion was made. + /// public async Task InsertIfChanged(string name, PatientObservation observation, bool persistObs = true, bool mapObs = true) { @@ -434,6 +446,7 @@ public class ObservationService : IObservationService /// /// The list of patient observations to send to matching subscribers. /// The patient location used to identify subscribers to notify. + /// public Task SendObsBroadcast(List obsList, PatientLocation location) { // Display Subscription @@ -458,6 +471,7 @@ public class ObservationService : IObservationService /// /// The collection of patient observations to be sent to the matched subscribers. /// The point of care identifier used to filter the subscribers by their configured location identifiers. + /// public Task SendObsBroadcast(List obsList, ObjectId pocId) { // Display Subscription @@ -479,6 +493,7 @@ public class ObservationService : IObservationService /// The method skips the broadcast if the observation has no name, and falls back to looking up the patient by id when it is not included in the observation. /// /// The patient observation to broadcast. May include the patient or require a lookup via . + /// public async Task SendObsBroadcast(BasePatientObservation obs) { if (obs.Name == null) return; @@ -515,6 +530,10 @@ public class ObservationService : IObservationService /// The patient to whom the observations belong. /// The timestamp associated with the source message. /// Optional parent observation metadata used to populate the parent data of each observation. + /// + /// public async void ProcessObservations(List observations, Patient patient, DateTime messageTime, ObservationData? observationData = null) { @@ -575,6 +594,7 @@ public class ObservationService : IObservationService /// /// The API request containing the nurse observation data to be persisted. /// A task that represents the asynchronous nurse observation save operation. + /// public Task SaveRequestNurseObsAsync(ApiRequest request) { return Task.Run(() => SaveRequestNurseObs(request)); @@ -589,6 +609,7 @@ public class ObservationService : IObservationService /// /// The incoming API request containing patient/location identifiers, message type, and observation data. /// Thrown when both the patient number and location are null or empty, or when the request type is not valid for observations. + /// public async Task SaveRequest(ApiRequest apiRequest) { if ( @@ -688,6 +709,7 @@ public class ObservationService : IObservationService /// /// The API request to be saved. /// A task that represents the asynchronous save operation. + /// public Task SaveRequestAsync(ApiRequest apiRequest) { //return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); })); @@ -700,6 +722,7 @@ public class ObservationService : IObservationService /// /// The unique identifier of the patient whose observations are being queried. /// An that iterates over the matching patient observations. + /// public async Task> FindByPatientIdAsync(ObjectId patientId) { return await _observationRepository.FindByPatientIdAsync(patientId); @@ -712,6 +735,7 @@ public class ObservationService : IObservationService /// The coding system used to classify the observations. /// The name associated with the observations to filter by. /// An asynchronous cursor over the matching documents. + /// public async Task> FindByPatientIdAndCodingSystemAsync(ObjectId patientId, string codingSystem, string name) { @@ -724,6 +748,7 @@ public class ObservationService : IObservationService /// Any exception encountered during the process is logged and swallowed without being rethrown. /// /// The unique identifier of the patient whose observations should be deleted. + /// public async Task DeleteByPatientId(ObjectId id) { try @@ -751,6 +776,7 @@ public class ObservationService : IObservationService /// Archives a patient observation by persisting it to the archive repository, removing it from the active observations, and invalidating the related cache entries for the patient's latest observations. /// /// The patient observation to be archived. + /// public async Task Archive(PatientObservation observation) { await _observationArchiveRepository.InsertOneAsync(observation); @@ -763,6 +789,7 @@ public class ObservationService : IObservationService /// Archives the specified patient by delegating to the archive operation keyed by the patient's identifier. /// /// The patient to be archived. Its identifier is used to locate and archive the corresponding record. + /// public async Task Archive(Patient patient) { await ArchiveByPatientId(patient.Id); @@ -772,6 +799,7 @@ public class ObservationService : IObservationService /// Archives all observations associated with the specified patient by copying them into the archive repository with newly generated identifiers, then removes the originals and invalidates the related cache entries. /// /// The unique identifier of the patient whose observations should be archived. + /// public async Task ArchiveByPatientId(ObjectId id) { _logger.LogDebug("Archive Observations by Patient Id {id}", id); @@ -794,6 +822,7 @@ public class ObservationService : IObservationService /// /// The unique identifier of the patient whose intravenous lines observations are being queried. /// A task that represents the asynchronous operation. The task result contains a list of objects, which may include null entries, representing the latest active intravenous lines observations grouped by location. + /// public async Task> FindLastIntravenousLinesObservationByLocation(ObjectId patientId) { return await _observationRepository.AggregatedPatientActiveIntravenousLinesObservations(patientId); @@ -803,6 +832,7 @@ public class ObservationService : IObservationService /// Retrieves the most recent observation time for all patients by delegating to the observation repository. /// /// A task that represents the asynchronous operation, containing a dictionary mapping patient values to their last observation . + /// public async Task> FindAllLastPatientObservationTime() { return await _observationRepository.FindAllLastPatientObservationTime(); @@ -814,6 +844,7 @@ public class ObservationService : IObservationService /// If no observation with the specified identifier is found, the method performs no action. /// /// The patient observation containing the updated data to be persisted. + /// public async Task UpdateObservation(PatientObservation observation) { var obs = await _observationRepository.FindById(observation.Id); @@ -835,6 +866,7 @@ public class ObservationService : IObservationService /// The upper bound date; only observations recorded prior to this date are considered. /// The optional name of the observation to filter by. When null, observations of any name are considered. /// The latest recorded before the specified date, or null if none was found. + /// public async Task FindLastBeforeDate(ObjectId patientId, DateTime date, string? obsName) { return await _observationRepository.FindLastObservationBeforeDate(patientId, obsName, date); @@ -848,6 +880,7 @@ public class ObservationService : IObservationService /// The date used to find observations recorded on the same day. /// The optional name of the observation to filter by; when null, observations of any name on the given date are considered. /// A task that resolves to a list of matching instances, or null if no observations match the specified criteria. + /// public async Task?> FindAnyWithSameDate(ObjectId patientId, DateTime date, string? obsName) { @@ -862,6 +895,8 @@ public class ObservationService : IObservationService /// The cutoff date; observations recorded before this date will be returned. /// An optional list of observation identifiers to filter the results. /// A task representing the asynchronous operation, containing a list of entries found before the specified date. + /// public async Task> FindAllBeforeDate(ObjectId patientId, DateTime date, List? filterObservations = null) { @@ -875,6 +910,7 @@ public class ObservationService : IObservationService /// The name of the observation to search for. /// An optional expiration value (in seconds) applied to the query. /// A task that represents the asynchronous operation, containing a list of the latest unique values. + /// public async Task> FindLatestUniqueValuesByName(ObjectId patientId, string name, int? expires) { @@ -890,6 +926,7 @@ public class ObservationService : IObservationService /// An optional list of observation identifiers used to narrow the returned results. /// A task that represents the asynchronous operation, containing a list of patient observations matching the criteria. /// Thrown when the method is invoked, as the implementation has not yet been provided. + /// public Task> FindAllAfterDate(ObjectId patientId, DateTime date, List? filterObservations = null) { @@ -904,6 +941,7 @@ public class ObservationService : IObservationService /// Optional threshold used to restrict which observations are considered; if null, no end-after filter is applied. /// Optional maximum number of observations to return; if null, all matching observations are returned. /// A task that represents the asynchronous operation, containing an enumerable collection of matching instances. + /// public async Task> FindLastNotExpiredObservatonsByPatient(ObjectId patientId, string name, int? endAfter = null, int? num = null) { @@ -916,6 +954,7 @@ public class ObservationService : IObservationService /// current time /// mark as expired in bd. /// + /// public async Task CheckAndExpireObservations() { var count = 0; @@ -940,6 +979,7 @@ public class ObservationService : IObservationService /// Updates the repository to mark a list of patient observations as expired, invalidates the corresponding cache entries, and creates audit log entries capturing the pre-update state of each observation. /// /// The list of patient observations to be marked as expired. + /// public async Task UpdateExpiredObservations(List patientObservations) { await _observationRepository.UpdateExpiredObservations(patientObservations); @@ -959,6 +999,7 @@ public class ObservationService : IObservationService /// For each candidate observation, the patient is validated; missing patients trigger cleanup of their observations and cached entries. Observations with missing names or unparsable expiration values are skipped, and only those whose expected expiration time (observation time plus configured minutes) has passed are yielded. /// /// An asynchronous stream of instances that are not expired in storage but whose effective expiration time has elapsed. + /// public async IAsyncEnumerable FindNotExpiredObservationsShouldBeExpired() { var expiringObservations = await _configObservationService.GetAllConfigs(); @@ -1008,6 +1049,7 @@ public class ObservationService : IObservationService /// /// Retrieves all observation configurations and expires those whose Expires value is set to a positive number, ignoring configurations with a null or non-positive expiry. /// + /// public async Task ExpireObservations() { //TODO expire each section @@ -1022,6 +1064,7 @@ public class ObservationService : IObservationService /// /// Expires patient observations that should no longer be active and recalculates the latest observation values per configured field. Sets a global flag while running to signal that expiration is in progress, processes expirations in batches of 1000 to limit memory usage, and clears the patient observations cache once finished; any error is logged and swallowed without rethrowing. /// + /// public async Task ExpireObservationsAndRecalculateAsync() { try @@ -1094,6 +1137,7 @@ public class ObservationService : IObservationService /// The name identifier of the field whose value should be updated across matching records. /// The new value to assign to the matching records. /// The existing value to be replaced. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await _observationRepository.UpdateManyObjectId(nameId, id, oldId); @@ -1103,6 +1147,7 @@ public class ObservationService : IObservationService /// Inserts a simple patient observation into the repository and records an audit log entry for the operation using the current HTTP context user. /// /// The patient observation to insert. + /// public async Task InsertSimpleObservation(PatientObservation observation) { await _observationRepository.InsertOneAsync(observation); @@ -1119,6 +1164,8 @@ public class ObservationService : IObservationService /// When true, queries the archived observation collection; otherwise, queries the active observation collection. /// Optional pagination settings controlling the page number and page size of the returned results. /// A task that resolves to the list of records matching the specified criteria. + /// public async Task> FindAllBetweenDates( ObjectId patientId, DateTime? startDate = null, @@ -1174,6 +1221,7 @@ public class ObservationService : IObservationService /// Asynchronously processes alert expiration and powers off beacon LEDs for points of care that are not currently in use. /// Skips patients located in virtual/moved/deleted/pushed/unknown locations and ignores emulated beacons and configurations with disabled alarms. /// + /// public async Task ExpireAlertsAndPowerOffAsync() { try @@ -1260,6 +1308,7 @@ public class ObservationService : IObservationService /// /// The pagination filter that specifies the page number and page size used to compute the skip/limit range. /// A containing the page of patient observations along with pagination metadata. + /// public async Task> GetPaginatedObservations(PaginationFilter filter) { var result = _observationRepository.GetPaginatedObservations(filter); @@ -1284,6 +1333,7 @@ public class ObservationService : IObservationService /// or the observation name is empty, and logs any errors that occur during processing. /// /// The patient observation used to resolve the retention policy and identify which records to delete. + /// private async Task DoRetentionActions(PatientObservation obs) { try @@ -1329,6 +1379,7 @@ public class ObservationService : IObservationService /// in the group's names or where the group does not consider the observation relevant. /// /// The incoming patient observation used to find and update matching groups. + /// private async void CheckForGroupedObs(PatientObservation obs) { try @@ -1387,6 +1438,7 @@ public class ObservationService : IObservationService /// /// The API request containing the observation text, parent data, message time, and additional observations used to build the intravenous line record. /// The patient to associate the resulting observation with. + /// private async Task ProcessIntravenousLinesObservation(ApiRequest apiRequest, Patient patient) { var isInsertable = false; @@ -1473,6 +1525,7 @@ public class ObservationService : IObservationService /// /// The API request containing the observation data and coded allergy entries to process. /// The patient associated with the allergies observation being recorded. + /// private async Task ProcessAllergiesObservation(ApiRequest apiRequest, Patient patient) { _logger.LogDebug("INSERT AllergiesObservation"); @@ -1582,6 +1635,7 @@ public class ObservationService : IObservationService /// /// The incoming API request whose ObservationData is inspected for the isolation marker text and timestamp. /// The patient associated with the observation, used to assign the patient identifier to the new record. + /// private async Task ProcessIsolationObservation(ApiRequest apiRequest, Patient patient) { if (apiRequest.ObservationData is { Text: "Aislamiento", Time: not null }) @@ -1615,6 +1669,7 @@ public class ObservationService : IObservationService /// /// The incoming API request containing the observation data, observations collection, and message timestamp to be processed. /// The patient associated with the observation; its identifier is stored in the resulting . + /// private async Task ProcessPositionObservation(ApiRequest apiRequest, Patient patient) { if (apiRequest.ObservationData != null && @@ -1662,6 +1717,7 @@ public class ObservationService : IObservationService /// /// The API request containing the observation data, time, and the list of observations to be processed. /// The patient associated with the drainage observation being recorded. + /// private async Task ProcessDrainageObservation(ApiRequest apiRequest, Patient patient) { _logger.LogDebug("INSERT DrainageObservation"); @@ -1742,6 +1798,8 @@ public class ObservationService : IObservationService /// The API request containing the data required to locate the patient and the observations to be saved. /// A task that represents the asynchronous save operation. /// Thrown when is null. + /// public async Task SaveRequestNurseObs(ApiRequest apiRequest) { var patient = await _patientService.FindPatientByApiRequest(apiRequest); @@ -1768,6 +1826,7 @@ public class ObservationService : IObservationService /// The list of point of care configurations used to locate the configuration associated with the patient. /// The observation configurations from which the recording end-after time is derived, falling back to when no recording alarms are configured. /// The default end-after value applied when no observation configuration specifies a recording alarm. + /// private async Task CheckRecordings(Patient patient, List configs, IEnumerable obsConfigList, int defaultValue) { @@ -1828,6 +1887,7 @@ public class ObservationService : IObservationService /// The patient whose relay state is being evaluated; must have a valid PointOfCareId. /// Collection of observation configurations used to determine the relay end-after threshold via the OpenDoor alarm. /// Fallback value used for the relay end-after threshold when no OpenDoor alarm configuration is present. + /// private async Task CheckRelay(Patient patient, IEnumerable obsConfigList, int defaultValue) { @@ -1874,6 +1934,7 @@ public class ObservationService : IObservationService /// The patient whose beacon state is being evaluated; its identifier and point of care assignment are used to locate recent observations and target the beacon. /// The list of observation configurations used to determine the maximum beacon end-after value from the alarms that are both enabled and have their beacon enabled, falling back to when no configuration matches or the beacon is null. /// The fallback value used for the beacon end-after period when no configuration provides a value or when the matching configuration's beacon is null. + /// private async Task CheckBeacon(Patient patient, IEnumerable obsConfigList, int defaultValue) { diff --git a/adas-core.Application/Services/PatientCarePlanService.cs b/adas-core.Application/Services/PatientCarePlanService.cs index 17a50aad..622e90dc 100644 --- a/adas-core.Application/Services/PatientCarePlanService.cs +++ b/adas-core.Application/Services/PatientCarePlanService.cs @@ -13,6 +13,7 @@ namespace adas_core.Application.Services; /// Provides operations for managing patient care plans, implementing the contract defined by . /// Serves as the concrete service layer responsible for handling care plan related business logic. /// +/// public class PatientCarePlanService : IPatientCarePlanService { private readonly IArchivePatientCarePlanService _archivePatientCarePlanService; @@ -55,6 +56,7 @@ public class PatientCarePlanService : IPatientCarePlanService /// /// The unique identifier of the patient whose care plans are to be retrieved. /// A task representing the asynchronous operation, containing a list of for the patient, or an empty list if an error occurs. + /// public async Task> FindByPatientId(ObjectId patientId) { try @@ -74,6 +76,7 @@ public class PatientCarePlanService : IPatientCarePlanService /// /// The unique identifier of the user whose patient care plans are being retrieved. /// A task that represents the asynchronous operation, containing a list of objects for the user, or an empty list if an error occurs. + /// public async Task> FindByUserId(ObjectId userId) { try @@ -92,6 +95,7 @@ public class PatientCarePlanService : IPatientCarePlanService /// Retrieves all patient care plans from the repository, returning an empty list if an error occurs while fetching the data. /// /// A task that represents the asynchronous operation, containing a list of objects, or an empty list if the retrieval fails. + /// public async Task> FindAll() { try @@ -109,6 +113,7 @@ public class PatientCarePlanService : IPatientCarePlanService /// Inserts a new patient care plan into the repository, stamping it with the current UTC time, and records an audit log entry for the operation. Any errors encountered during the insertion or audit logging are caught and logged without rethrowing. /// /// The patient care plan entity to be inserted into the repository. + /// public async Task InsertOneAsync(PatientCarePlan patientCarePlan) { try @@ -129,6 +134,7 @@ public class PatientCarePlanService : IPatientCarePlanService /// /// The patient associated with the finished procedure whose care plan items are being archived. /// The list of care plan options to archive. + /// public async Task ArchiveCarePlanFromJob(Patient patientWithFinishedProcedure, List itemsToArchive) { var systemUser = await _userRepository.GetOrCreateSystemUser(); @@ -153,6 +159,7 @@ public class PatientCarePlanService : IPatientCarePlanService /// Archives all care plans associated with the specified patient by moving them to the archive service, removing them from the active repository, and creating audit log entries for each archived record. /// /// The identifier of the patient whose care plans will be archived. + /// public async Task ArchiveByPatientId(ObjectId patientid) { var carePlansToArchive = await FindByPatientId(patientid); @@ -170,6 +177,7 @@ public class PatientCarePlanService : IPatientCarePlanService /// The unique identifier of the patient whose care plan records will be updated. /// The new object identifier that will replace the old identifier in the matching care plan records. /// The existing object identifier to be replaced by the new identifier. + /// public async Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId) { await _patientCarePlanRepository.UpdateManyObjectId(patientid, patientId, oldId); diff --git a/adas-core.Application/Services/PatientService.cs b/adas-core.Application/Services/PatientService.cs index e28bd261..deebb67e 100644 --- a/adas-core.Application/Services/PatientService.cs +++ b/adas-core.Application/Services/PatientService.cs @@ -27,6 +27,7 @@ namespace adas_core.Application.Services; /// Provides a concrete implementation of the interface, /// encapsulating patient-related service operations. /// +/// public class PatientService : IPatientService { private readonly Lazy _admissionService; @@ -171,6 +172,7 @@ public class PatientService : IPatientService /// Inserts a new patient into the repository after validating it. If the patient fails validation, the method returns without performing the insertion. After a successful insert, a new patient broadcast notification is dispatched asynchronously. /// /// The patient entity to be inserted into the repository. + /// public async Task Insert(Patient patient) { if (!CheckPatient(patient)) @@ -189,6 +191,7 @@ public class PatientService : IPatientService /// The string representation of the patient identifier to parse and look up. /// The locale used to translate the patient data via the master list service. /// A task containing the translated patient, the untranslated patient if the unit is not found, or null if the patient has no associated unit. + /// public async Task FindByPatientIdWithLocale(string patientId, LocaleEnum localeEnum) { ObjectId.TryParse(patientId, out var id); @@ -206,6 +209,7 @@ public class PatientService : IPatientService /// On a successful insert, an audit log is created and a broadcast is dispatched to notify other components. /// /// The patient entity to be inserted into the system. + /// public async Task InsertAsync(Patient patient) { if (!CheckPatient(patient)) @@ -223,6 +227,7 @@ public class PatientService : IPatientService /// The identifier of the destination point of care. /// The identifier of the source point of care that the patient is leaving. /// A task that resolves to true when the patient is successfully moved; otherwise, false if the new point of care is null, the old point of care is null, or the new point of care is already in use or locked. + /// public async Task Move(Patient patient, ObjectId newPocId, ObjectId oldPocId) { var newPoc = await _pointOfCareService.GetInfo(newPocId); @@ -289,6 +294,7 @@ public class PatientService : IPatientService /// When true, enriches the patient with location information such as bed, room, and unit name. /// A containing the found patient, or null if no patient matches the identifier or the identifier is empty. /// Thrown when the patient has an associated point of care that cannot be found. + /// public async Task FindById(ObjectId id, bool withLocation = false) { if (id == ObjectId.Empty) @@ -330,6 +336,7 @@ public class PatientService : IPatientService /// /// The patient location containing the unit name and bed used to locate the patient. /// A if one is found for the given location; otherwise, . + /// public async Task FindByLocation(PatientLocation? location) { if (location?.UnitName == null || location.Bed == null) @@ -347,6 +354,7 @@ public class PatientService : IPatientService /// /// The point of care identifier used to locate the patient. /// A if one is found with the specified point of care identifier; otherwise, null. + /// public async Task FindByPointOfCareId(ObjectId pocId) { return await _patientRepository.FindByPointOfCareId(pocId); @@ -357,6 +365,7 @@ public class PatientService : IPatientService /// /// The of the unit whose patients should be counted. /// A that resolves to the number of patients linked to the given unit. + /// public async Task CountPatientsByUnitId(ObjectId unitId) { return await _patientRepository.CountByUnitId(unitId); @@ -366,6 +375,7 @@ public class PatientService : IPatientService /// Archives a patient according to the configured : either inserts the patient into the archive repository (with the current UTC time as the archive date) or simply performs no archival step. The patient record is then deleted, an audit log entry is created, associated patient data is archived, and if the patient was assigned to a point of care, a delete broadcast is sent and that point of care is set to Available. /// /// The patient to archive. If its DisTime is null, it is set to the current UTC time before further processing. + /// public async Task ArchivePatient(Patient patient) { patient.DisTime ??= DateTime.UtcNow; @@ -402,6 +412,7 @@ public class PatientService : IPatientService /// Archives or deletes all data associated with a patient based on the configured OnArchiveAction. When the action is set to Archive (the default), patient observations, treatments, diagnoses, appointments, pumps, recording alerts, and care plans are archived; when set to Delete, observations, treatments, diagnoses, appointments, pumps, and recording alerts are deleted (care plan archival is not performed in this case). /// /// The of the patient whose related data should be archived or deleted. + /// public async Task ArchivePatientData(ObjectId patientid) { _logger.LogDebug("Archiving patient data action: {onArchiveAction} : {patientid}", _onArchiveAction, @@ -434,6 +445,7 @@ public class PatientService : IPatientService /// Updates a patient record in the repository, handling special cases such as resolving duplicated "Sin cama" bed assignments from ICCADB by generating a unique bed identifier, and assigning a patient number when missing. Also creates an audit log comparing the previous and updated patient and asynchronously broadcasts the update. /// /// The patient entity to update. + /// public async Task Update(Patient patient) { var oldPatient = await _patientRepository.FindById(patient.Id); @@ -468,6 +480,7 @@ public class PatientService : IPatientService /// /// The identifier of the patient whose location will be updated. /// The new patient location, or null to abort the update. + /// public async Task UpdateLocation(ObjectId id, PatientLocation? location) { try @@ -558,6 +571,7 @@ public class PatientService : IPatientService /// The unique identifier of the patient whose attending doctor is being updated. /// The new attending doctor to assign to the patient. /// Thrown when the patient cannot be found by id before or after the update operation. + /// public async Task UpdateAttendingDoctor(ObjectId id, Person doctor) { var oldPatient = await _patientRepository.FindById(id) ?? @@ -578,6 +592,7 @@ public class PatientService : IPatientService /// The new data to apply to the patient. /// When true, the patient number is also updated; otherwise only the personal data is changed. /// Thrown when the patient cannot be found by either before or after the update operation. + /// public async Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true) { @@ -600,6 +615,7 @@ public class PatientService : IPatientService /// The patient entity containing the updated data. /// Indicates whether the patient number should be updated as part of the operation. /// Thrown when the patient cannot be found before or after the update operation. + /// public async Task UpdatePatientData(ObjectId id, string patientNumber, Patient patient, bool updatePatientNumber = true) { @@ -624,6 +640,7 @@ public class PatientService : IPatientService /// The unique identifier of the patient to retrieve. /// When true, additional lookups are performed to populate the patient's bed, room, and unit information; otherwise only the patient record is returned. /// The matching the specified identifier, or null if no patient is found. + /// public async Task FindByPatientId(string patientId, bool withLocation = false) { @@ -653,6 +670,7 @@ public class PatientService : IPatientService /// The unique identifier of the patient to look up. /// When set to true, populates the returned patient with bed and room information from the point of care and the unit name from the unit service, provided the patient has associated location identifiers. /// A containing the matching if found; otherwise, null. + /// public async Task FindByPatientNumber(string patientNumber, bool withLocation = false) { var patient = await _patientRepository.FindByPatientNumber(patientNumber); @@ -681,6 +699,7 @@ public class PatientService : IPatientService /// /// The unique patient number used to look up the archived patient. /// The archived if found; otherwise, null. + /// public async Task FindByPatientNumberArchived(string patientNumber) { return await _patientArchiveRepository.FindByPatientNumber(patientNumber); @@ -695,6 +714,7 @@ public class PatientService : IPatientService /// any unexpected failure causes the original exception to be rethrown after logging. /// /// The cutoff date; patients with no observations updated after this date will be archived. + /// public async Task ArchivePatientWithoutObservationsSinceDate(DateTime date) { try @@ -777,6 +797,7 @@ public class PatientService : IPatientService /// and any error encountered during archiving is logged rather than propagated. /// /// The number of hours that must elapse after a patient's discharge time before they are eligible for archiving. + /// public async Task ArchiveDischargedPatients(int hoursBeforeArchive) { var disBeforeDate = DateTime.Now.AddHours(-hoursBeforeArchive); @@ -806,6 +827,7 @@ public class PatientService : IPatientService /// The patient location used for a location-based lookup; the search only proceeds when both the unit name and the bed are set, and the location is mapped through the POC mapping service before being applied to the resulting patient. /// When true, allows a location-based lookup even if the corresponding configuration option is disabled. /// The matching if found by any of the attempted criteria, or null when no patient can be located. + /// public async Task FindPatient(string? patientId, string? patientNumber, PatientLocation? location, bool findPatientByLocation = false) { @@ -842,6 +864,8 @@ public class PatientService : IPatientService /// Indicates whether related observations should be included in the result. /// Optional list of observation identifiers used to filter observations when they are included. /// A task that resolves to the matching , or null if the lookup fails. + /// public async Task GetByPointOfCare(PointOfCare item, bool observations = false, List? filterObservations = null) { @@ -863,6 +887,7 @@ public class PatientService : IPatientService /// The unit used to determine the translation; when null, the patient is returned without translation. /// The target locale for translation; when null, the patient is returned without translation. /// The matching , or null if the patient is not found or an error occurs. + /// public async Task GetByPointOfCareAndLocale(PointOfCare item, Unit? unit, LocaleEnum? localeEnum) { try @@ -885,6 +910,8 @@ public class PatientService : IPatientService /// When true, the most recent observations for the patient are loaded and mapped by name; when false, only patient data is returned. /// Optional list of observation names used to restrict which observations are retrieved; applies only when is true. /// A containing the populated box. The HasPatient flag is set to false if no patient is found for the point of care, and the box's Observations are populated only when requested. + /// public async Task GetBox(PointOfCare poc, bool observations = false, List? filterObservations = null) { @@ -931,6 +958,7 @@ public class PatientService : IPatientService /// /// The patient whose arrival should be broadcast to matching subscribers. /// A completed task once the broadcast has been dispatched. + /// public Task SendNewPatientBroadcast(Patient patient) { var subscribers = new List(); @@ -959,6 +987,7 @@ public class PatientService : IPatientService /// If the patient has no point of care id, the update is skipped and an error is logged. /// /// The patient whose update will be broadcast; its point of care id is used to filter subscribers and its unit is used to resolve translations. + /// public async Task SendPatientUpdateBroadcast(Patient patient) { if (!patient.PointOfCareId.HasValue) @@ -989,6 +1018,7 @@ public class PatientService : IPatientService /// /// The API request to be saved. /// A that represents the asynchronous save operation. + /// public Task SaveRequestAsync(ApiRequest apiRequest) { return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); })); @@ -999,6 +1029,7 @@ public class PatientService : IPatientService /// /// The API request containing the ADT type, patient identifiers, locations, and related clinical data to be processed. /// Thrown when both the patient number and location unit name are missing for non-ICCA requests, or when the request type is not a valid patient ADT type. + /// public async Task SaveRequest(ApiRequest apiRequest) { if (string.IsNullOrEmpty(apiRequest.PatientNumber) && @@ -1399,6 +1430,7 @@ public class PatientService : IPatientService /// The API request containing the data used to initialize the new patient. /// When true, location information from the request is ignored during the patient update. /// The newly created patient. + /// public async Task CreatePatientFromRequest(ApiRequest apiRequest, bool ignoreLocation = false) { var patient = new Patient @@ -1417,6 +1449,7 @@ public class PatientService : IPatientService /// /// The incoming API request containing the patient identifier, location, facility, request type, and optional person/doctor information used to resolve or create the patient. /// A that resolves to the resolved or newly created , or null if the point of care cannot be mapped, the request is not handled, no matching patient is found and creation is disabled, or an error occurs while processing the request. + /// public async Task FindPatientByApiRequest(ApiRequest apiRequest) { Patient? patient = null; @@ -1737,6 +1770,7 @@ public class PatientService : IPatientService /// /// When true, populates each patient's , , and by looking up the related point of care and unit; when false, returns the patients without performing those lookups. /// A task containing the list of patients, with location fields populated when is true and the corresponding identifiers are present. + /// public async Task> FindAll(bool withLocation = false) { var patients = await _patientRepository.FindAll(); @@ -1767,6 +1801,7 @@ public class PatientService : IPatientService /// Asynchronously retrieves a list of inactive patients of care (PoC) by delegating to the patient repository. /// /// A task representing the asynchronous operation, containing a list of inactive records. + /// public async Task> FindInActivePoC() { return await _patientRepository.FindInActivePoC(); @@ -1776,6 +1811,7 @@ public class PatientService : IPatientService /// Retrieves a list of patients currently in active Point of Care (PoC). /// /// A task that represents the asynchronous operation, containing the list of patients in active PoC. + /// public async Task> FindInInactivePoC() { return await _patientRepository.FindInInactivePoC(); @@ -1787,6 +1823,7 @@ public class PatientService : IPatientService /// /// The pagination filter containing the page number and page size used to calculate the skip and limit for the query. /// A task that represents the asynchronous operation. The task result contains a with the patients for the requested page, along with the total count and pagination metadata. + /// public async Task> GetPaginatedPatients(PaginationFilter filter) { var result = _patientRepository.GetPaginatedPatients(filter); @@ -1810,6 +1847,7 @@ public class PatientService : IPatientService /// The identifier of the unit to search by. /// The identifier of the point of care to search by. /// A if a match is found; otherwise, . + /// public async Task FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare) { return await _patientRepository.FindByUnitAndPocId(unit, pointOfCare); @@ -1820,6 +1858,7 @@ public class PatientService : IPatientService /// /// The point of care identifier used to filter patients. /// A task that represents the asynchronous operation, containing the list of entities matching the specified point of care. + /// public async Task> FindByPointOfCare(string pointOfCare) { return await _patientRepository.FindByPointOfCare(pointOfCare); @@ -1833,6 +1872,8 @@ public class PatientService : IPatientService /// The target patient that will absorb the old patient's data. /// The patient number of the patient to be merged into . /// A task representing the asynchronous merge operation. + /// public async Task MergePatient(Patient patient, string oldPatientNumber) { var oldLocation = patient.PointOfCareId; // sectionService.FindByPatient(patient.id); @@ -1874,6 +1915,7 @@ public class PatientService : IPatientService /// /// The cutoff date used to archive patients who have not had any observations since this time. /// The number of hours of inactivity used to determine which discharged and inactive point-of-care patients should be archived. + /// public async Task DischargeInactivePatients(DateTime sinceDate, int hoursBeforeArchive) { try @@ -1897,6 +1939,7 @@ public class PatientService : IPatientService /// /// The patient object containing the updated information, identified by its Id. /// The updated patient, or null if no matching patient was found or the update did not produce a result. + /// public async Task UpdateOne(Patient updatedPatient) { var oldPatient = await _patientRepository.FindById(updatedPatient.Id); @@ -1912,6 +1955,7 @@ public class PatientService : IPatientService /// The new altable option to assign to the patient. /// The user performing the operation, used to attribute the generated nurse observation. /// The updated , or null if no patient was found with the specified id. + /// public async Task UpdatePatientAltable(ObjectId patientId, OptionList altable, User? user) { var patient = await _patientRepository.FindByPatientId(patientId); @@ -1986,6 +2030,7 @@ public class PatientService : IPatientService /// /// /// + /// public async Task ExitPatientById(ObjectId id, bool archivePatient = true) { try @@ -2025,6 +2070,7 @@ public class PatientService : IPatientService /// The user performing the update, used for audit purposes and observation generation. /// An optional list of care plan options used when generating care plans for Treatment, Procedure, and Test list types. /// The updated if the operation succeeds; otherwise, null if the patient is not found or an exception is caught. + /// public async Task UpdatePatientMasterList(ObjectId patientId, MasterListType typeName, List updatedOptions, User? user, List? carePlanLog) { @@ -2150,6 +2196,7 @@ public class PatientService : IPatientService /// The list of options to evaluate against the patient's current items; may be null. /// The patient whose care plan is being generated. /// The user performing the action; may be null. + /// public async Task GenerateNurseCarePlanAndInsert(MasterListType carePlanType, List? options, Patient patient, User? user) { @@ -2296,6 +2343,7 @@ public class PatientService : IPatientService /// The unique identifier of the patient to update. /// The patient object containing the updated incoming data. /// Thrown when the patient cannot be found by the given identifier, or when the incoming data update operation fails. + /// public async Task UpdatePatientIncomingData(ObjectId patientId, Patient person) { var oldPatient = await _patientRepository.FindByPatientId(patientId) ?? @@ -2315,6 +2363,7 @@ public class PatientService : IPatientService /// The patient entity containing the updated information to apply. /// The patient income information to store as a new observation. /// The user performing the operation, recorded as the author of the observation. + /// public async Task UpdatePatientIncomingData(ObjectId patientId, Patient person, PatientIncomeData patientIncomeData, User user) { @@ -2337,6 +2386,7 @@ public class PatientService : IPatientService /// The master list option update data to apply to the patients. /// The collection of units whose associated patients will have the master list option updated. /// The name of the master list type used to identify which option to update. + /// public async Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable unitList, string typeName) { @@ -2359,6 +2409,7 @@ public class PatientService : IPatientService /// The master list option to be removed from patient records. /// The collection of units whose associated patients will be updated. /// The name of the master list type from which the option is being deleted. + /// public async Task DeletePatientMasterListItem(OptionList opt, IEnumerable unitList, string typeName) { var unitIds = unitList.Select(x => x.Id).ToList(); @@ -2388,6 +2439,8 @@ public class PatientService : IPatientService /// The patient object containing the updated demographic data. /// The user performing the update, used for audit logging; may be null. /// Thrown when no patient is found for the specified patient ID. + /// public async Task UpdatePatientDemographicData(ObjectId patientId, Patient person, User? user) { var oldPatient = await _patientRepository.FindByPatientId(patientId) ?? @@ -2411,6 +2464,7 @@ public class PatientService : IPatientService /// The patient number to search for. /// The identifier of the unit used to find a patient that is distinct from it. /// A task containing the found , or null if no matching patient is found. + /// public Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId) { return _patientRepository.SearchByPatientNumberAndDistinctUnit(patientNumber, unitId); @@ -2421,6 +2475,7 @@ public class PatientService : IPatientService /// /// The minimum age, in minutes, of a finished procedure's end date used as the cutoff for including patients in the result. /// A task that represents the asynchronous operation, containing a list of instances associated with finished procedures matching the specified threshold. + /// public async Task> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes) { return await _patientRepository.FindAllPatientWithFinishedProcedures(archiveProcedureEndDateAfterMinutes); @@ -2431,6 +2486,7 @@ public class PatientService : IPatientService /// /// The number of minutes after the archive test end date used to determine which finished tests to include. /// A task that represents the asynchronous operation, containing a list of patients with finished tests. + /// public async Task> FindAllPatientWithFinishedTest(int archiveTestEndDateAfterMinutes) { return await _patientRepository.FindAllPatientWithFinishedTests(archiveTestEndDateAfterMinutes); @@ -2441,6 +2497,7 @@ public class PatientService : IPatientService /// /// The minimum number of minutes that must have elapsed since the treatment end date for a patient to be included in the result. /// A task representing the asynchronous operation, containing a list of patients with finished treatments matching the archive criteria. + /// public async Task> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes) { return await _patientRepository.FindAllPatientWithFinishedTreatment(archiveTreatmentEndDateAfterMinutes); @@ -2452,6 +2509,7 @@ public class PatientService : IPatientService /// /// The patient instance to validate before insertion. /// true if the patient passes all validation checks; otherwise, false. + /// private bool CheckPatient(Patient patient) { //patient.AdmTime ??= DateTime.UtcNow; @@ -2491,6 +2549,7 @@ public class PatientService : IPatientService /// The optional identifier of the previous point of care; when present, subscribers still associated /// with it but not with are removed from the subscription group. /// The patient whose grouped observations are generated and dispatched to the subscribers. + /// private async Task SendLastGroupedObsToSubscriberByPoc(ObjectId newPoc, ObjectId? oldPoc, Patient patient) { @@ -2548,6 +2607,7 @@ public class PatientService : IPatientService /// /// The Point of Care used to look up the list of relevant subscribers. /// The patient whose last observations are retrieved and forwarded to the subscribers. + /// private async Task SendLastObsToSubscriberByPoc(PointOfCare newPoc, Patient patient) { // Obtén la lista de suscriptores @@ -2589,6 +2649,7 @@ public class PatientService : IPatientService /// The identifier of the patient whose location will be updated. /// The identifier of the new unit the patient is being moved to. /// The identifier of the new point-of-care the patient is being moved to. + /// private async Task UpdateLocation(ObjectId id, ObjectId unitId, ObjectId pocId) { try @@ -2689,6 +2750,8 @@ public class PatientService : IPatientService /// /// New location where patient is getting updated /// Object Id for patient + /// private void CheckLocationForWsSubscriber(PatientLocation? newLocation, ObjectId? patientId) { if (patientId == null || newLocation == null) return; @@ -2712,6 +2775,12 @@ public class PatientService : IPatientService /// hoursBeforeArchive /// . /// + /// + /// + /// public async Task ArchiveNotUpdatedPatientsInInactivePoCSince(int hoursBeforeArchive) { _logger.LogDebug( @@ -2736,6 +2805,8 @@ public class PatientService : IPatientService /// The patient associated with the location update. /// The patient location information to broadcast. /// The list of point-of-care location identifiers used to filter eligible subscribers. If null or empty, no broadcast is performed. + /// public Task SendPatientLocationBroadcast(object patient, PatientLocation location, List? pocs) { @@ -2764,6 +2835,7 @@ public class PatientService : IPatientService /// /// The unique identifier of the patient whose attending doctor assignment should be broadcast. /// The representing the doctor now attending the patient, included in the broadcast payload. + /// private async Task SendPatientAttendingDoctorBroadcast(ObjectId patientid, Person attendingDoctor) { var patient = await FindById(patientid); @@ -2794,6 +2866,7 @@ public class PatientService : IPatientService /// /// The unique identifier of the patient whose data will be broadcast. /// The person data payload to be sent to the matching subscribers. + /// private async Task SendPatientDataBroadcast(ObjectId patientid, Person data) { var patient = await FindById(patientid); @@ -2816,6 +2889,7 @@ public class PatientService : IPatientService /// Sends an asynchronous patient update broadcast to all subscribers whose location matches the patient's point of care, grouped by their locale. Falls back to the default locale when a group has no locale key, and translates the patient data per locale before dispatching each message as a fire-and-forget send. /// /// The patient whose information is being broadcast; its PointOfCareId is used to match subscribers and its UnitId is used to resolve the unit for translation. + /// private async Task SendPatientBroadcast(Patient patient) { var subscribersGroup = @@ -2843,6 +2917,7 @@ public class PatientService : IPatientService /// /// The unique identifier of the patient whose deletion will be broadcast. /// The point of care location identifier used to filter the targeted subscribers. + /// private Task SendDeletePatientBroadcast(ObjectId patientid, ObjectId pocId) { var subscribers = _subscribersService.GetSubscribers().Where(s => s.LocationIds.Any(x => x == pocId)).ToList(); @@ -2871,6 +2946,7 @@ public class PatientService : IPatientService /// /// The patient entity to be updated in place. /// The API request providing the source data for the update. + /// private void UpdatePatientFromRequestToIdList(Patient patient, ApiRequest apiRequest) { if (apiRequest.AdmTime.HasValue) patient.AdmTime = apiRequest.AdmTime; @@ -2910,6 +2986,7 @@ public class PatientService : IPatientService /// The API request containing operational data such as the discharge time used to set the patient's discharge timestamp. /// The patient to be moved, updated with the new point of care, unit, and location information. /// The virtual point of care identifier used to look up the destination bed, room, and unit. + /// private async Task RemovePatientAndSendToVirtualPoc(ApiRequest apiRequest, Patient patient, VirtualPointOfCare virtualPocEnum) { @@ -2951,6 +3028,7 @@ public class PatientService : IPatientService /// Handles three main cases: creating/updating patients present in ICCA but not in the DB, matching existing patients by number, and moving patients absent from ICCA to a temporal/unknown bed. Also persists patients from ICCA locations that are outside the configured point-of-care boxes, falling back to a default unknown point-of-care when a matching location is not found. /// /// The API request containing the list of ICCA patients to synchronize with the local database. + /// private async Task ProcessIccaSync(ApiRequest apiRequest) { //var sections = await _sectionService.GetAll(); @@ -3077,6 +3155,7 @@ public class PatientService : IPatientService /// /// The API request containing the patient number, patient data, and target location information used for the move operation. /// The optional patient to be moved; if null, a new patient is created from the request. + /// private async Task ProcessAdtMovePatient(ApiRequest apiRequest, Patient? patient) { try @@ -3234,6 +3313,7 @@ public class PatientService : IPatientService /// /// /// The Inserted patient or null. + /// private async Task ProcessAdtPatientAdmit(ApiRequest apiRequest) { Patient? patient; @@ -3374,6 +3454,7 @@ public class PatientService : IPatientService /// /// The patient whose properties will be updated with the values from the admission. /// The admission record providing the source values to be merged into the patient. + /// private async Task MergePatientWithAdmission(Patient patient, Admission patientInAdmission) { patient.Insulation = patientInAdmission.Insulation; @@ -3414,6 +3495,8 @@ public class PatientService : IPatientService /// The patient entity to mutate with values coming from the request. /// The incoming API request whose non-empty fields are applied to the patient. /// When true, skips unit and point-of-care lookups and any location-based updates. + /// private async Task UpdatePatientFromRequest(Patient patient, ApiRequest apiRequest, bool ignoreLocation = false) { @@ -3507,6 +3590,7 @@ public class PatientService : IPatientService /// /// The patient whose location will be updated. /// The API request containing the new location information. + /// private async Task ProcessUpdatePatientLocationWithOru(Patient patient, ApiRequest apiRequest) { await UpdateLocation(patient.Id, apiRequest.Location); @@ -3518,6 +3602,7 @@ public class PatientService : IPatientService /// /// The incoming patient to be updated with merged data. /// The previous patient record whose missing treatments, procedures and tests are preserved during the merge. + /// public async Task UpdatePatientFromMerge(Patient patient, Patient oldPatient) { var listObsName = _masterListServiceFactory.StringNurseObs(); @@ -3627,6 +3712,8 @@ public class PatientService : IPatientService /// The list of option values for the observation, or null to default to an empty list. /// The identifier of the patient associated with the observation. /// The user creating the observation, whose identifier is assigned to the observation; may be null. + /// private async Task GenerateNurseObsAndInsert(string name, List? value, ObjectId patientId, User? user) { var obs = GenerateObs( @@ -3645,6 +3732,7 @@ public class PatientService : IPatientService /// The list of values for the observation, or null to use an empty list. /// The identifier of the patient associated with the observation. /// A new populated with the provided data, the current date/time, and manual insert mode. + /// private PatientObservation GenerateObs(string name, List? value, ObjectId patientId) { var valueList = value ?? []; @@ -3664,6 +3752,8 @@ public class PatientService : IPatientService /// /// The name of the property in whose associated manual observation name should be returned. Must match the property name exactly. /// The ManualObservationName of the resolved , or a descriptive error string if the property is not found or the property value is not a . + /// public string GetManualObservationName(string masterListNameString) { // 1. Obtener el tipo de la clase ListSettings. diff --git a/adas-core.Application/Services/PermissionService.cs b/adas-core.Application/Services/PermissionService.cs index 7db76a4c..332f8428 100644 --- a/adas-core.Application/Services/PermissionService.cs +++ b/adas-core.Application/Services/PermissionService.cs @@ -34,6 +34,7 @@ public class PermissionService( /// The user whose authorizations and roles are evaluated to determine the applicable display permissions. /// A containing the display permission configuration corresponding to the matched role. /// Thrown when the user has no authorizations available, or when none of the user's authorities match the given display or its unit. + /// public async Task GetPermissionsForDisplay(Display display, User user) { var authorities = user.Authorization; @@ -92,6 +93,7 @@ public class PermissionService( /// The user whose authorizations and role are used to determine the permissions for the unit. /// A that resolves to the permission configuration matching the user's role for the specified unit. /// Thrown when the user has no authorizations, or when no authorization entry matches the provided . + /// public Task GetPermissionsForUnit(string unitId, User user) { var authorities = user.Authorization; @@ -165,6 +167,7 @@ public class PermissionService( /// The username of the user whose panel permissions are being requested. /// The that apply to the user based on their authorities. /// Thrown when no user is found with the specified username. + /// public async Task GetPermissionsForPanel(string user) { var userFound = await userRepository.Value.GetByUserName(user); @@ -179,6 +182,7 @@ public class PermissionService( /// The user whose panel permissions are being resolved; must carry authorization data. /// The associated with the matched role. /// Thrown when the user has no authorities or no authority grants panel access. + /// public PanelPermissionTypes GetPermissionsForPanel(User user) { var authorities = user.Authorization; @@ -222,6 +226,7 @@ public class PermissionService( /// The source permission context used when evaluating access to the display. /// The string identifier of the display; must be parseable as an ObjectId or access is denied. /// A task that resolves to true if the user's role and authorities grant access to the specified display; otherwise, false. + /// public async Task HasAccessToDisplay(string username, PermissionEnum.RolesType userRole, PermissionEnum.SourcePermissionsEnum source, string displayId) { @@ -246,6 +251,7 @@ public class PermissionService( /// The source permission context associated with the access evaluation. /// The identifier of the unit to check access against. /// A task that resolves to true if the user has the required access to the unit; otherwise, false. + /// public async Task HasAccessToUnit(string username, PermissionEnum.RolesType userRole, PermissionEnum.SourcePermissionsEnum source, string unitId) { @@ -265,6 +271,8 @@ public class PermissionService( /// The role required to access the panel. /// The source permission context used for the access check. /// true if the user exists and has the required role within the panel; otherwise, false. + /// public async Task HasAccessToPanel(string username, PermissionEnum.RolesType userRole, PermissionEnum.SourcePermissionsEnum source) { @@ -286,6 +294,7 @@ public class PermissionService( /// The list of authorizations to search; a null or empty value causes the method to return false. /// The role to find within the matched authorizations or the display's unit. /// true if the role is found in any matched authorization or in the display's unit; otherwise, false. + /// private static bool SearchRoleInDisplay(Display display, List? authorities, PermissionEnum.RolesType role) { @@ -309,6 +318,7 @@ public class PermissionService( /// The list of authorizations to inspect; if null, the method short-circuits and returns false. /// The role type to look for within the authorities of the specified unit. /// true if an authority exists for with a role equal to ; otherwise, false. + /// private static bool SearchRoleInUnit(string unitId, List? authorities, PermissionEnum.RolesType role) { if (authorities == null) @@ -331,6 +341,8 @@ public class PermissionService( /// The role to look for within the panel-authorized entries. /// true if at least one entry has PanelAuthorization enabled and matches the specified role; otherwise, false. /// Thrown when an entry's Rol value cannot be parsed into a valid . + /// private static bool SearchRoleInPanel(List? authorities, PermissionEnum.RolesType role) { if (authorities == null) diff --git a/adas-core.Application/Services/PoCMappingService.cs b/adas-core.Application/Services/PoCMappingService.cs index 48d71a80..11f0bbd8 100644 --- a/adas-core.Application/Services/PoCMappingService.cs +++ b/adas-core.Application/Services/PoCMappingService.cs @@ -11,6 +11,7 @@ namespace adas_core.Application.Services; /// Provides a proof-of-concept implementation of the IPoCMappingService interface, /// delivering the mapping functionality defined by that contract. /// +/// public class PoCMappingService : IPoCMappingService { private readonly string _key; @@ -41,6 +42,8 @@ public class PoCMappingService : IPoCMappingService /// /// location /// mapped location + /// public async Task Map(PatientLocation original) { var pocMapping = await GetMapping(); @@ -55,6 +58,8 @@ public class PoCMappingService : IPoCMappingService /// Return mapping from cache of database based on refreshTime /// /// + /// private async Task GetMapping() { if (_mapping == null || DateTime.Now > _nextRefresh) diff --git a/adas-core.Application/Services/PointOfCareService.cs b/adas-core.Application/Services/PointOfCareService.cs index e617e8e3..1af6f0e5 100644 --- a/adas-core.Application/Services/PointOfCareService.cs +++ b/adas-core.Application/Services/PointOfCareService.cs @@ -52,6 +52,7 @@ public class PointOfCareService( /// /// The point of care to be inserted; its UnitId is validated against the existing unit and reassigned to the resolved unit's identifier. /// A task that resolves to the newly inserted , or null when the referenced unit is not found or the operation fails. + /// public async Task InsertPointOfCare(PointOfCare pointOfCare) { try @@ -81,6 +82,7 @@ public class PointOfCareService( /// The deletion is skipped if the record cannot be found or if it is linked to an admission. /// /// The unique identifier of the Point of Care record to delete. + /// public async Task Delete(ObjectId id) { var poc = await FindById(id); @@ -98,6 +100,7 @@ public class PointOfCareService( /// Deletes all Points of Care associated with the specified unit identifier and removes the corresponding cached entries. /// /// The identifier of the unit whose Points of Care records will be removed. + /// public async Task DeletePoCsByUnitId(ObjectId unitId) { await pointOfCareRepository.DeleteManyByUnitId(unitId); @@ -110,6 +113,7 @@ public class PointOfCareService( /// Asynchronously retrieves the set of camera identifiers that are currently in use by delegating to the point of care repository. /// /// A task that represents the asynchronous operation, containing a of camera identifiers in use. + /// public async Task> FindAllIdCamerasInUse() { return await pointOfCareRepository.FindAllIdCamerasInUse(); @@ -118,6 +122,7 @@ public class PointOfCareService( /// Asynchronously retrieves the set of all ID relay identifiers currently in use by delegating to the point of care repository. /// /// A task that represents the asynchronous operation. The task result contains a of values representing the ID relays that are in use. + /// public async Task> FindAllIdRelaysInUse() { return await pointOfCareRepository.FindAllIdRelaysInUse(); @@ -126,6 +131,7 @@ public class PointOfCareService( /// Asynchronously retrieves the set of beacon identifiers that are currently in use from the point of care repository. /// /// A task that represents the asynchronous operation. The task result contains a with the identifiers of all beacons in use. + /// public async Task> FindAllIdBeaconsInUse() { return await pointOfCareRepository.FindAllIdBeaconsInUse(); @@ -137,6 +143,7 @@ public class PointOfCareService( /// /// The unique identifier of the unit whose points of care are being queried. /// A task that represents the asynchronous operation. The task result contains a collection of with their devices, or an empty collection if the repository returns no results. + /// public async Task?> FindAllByUnitIdWithDevices(ObjectId unitId) { var result = await pointOfCareRepository.FindAllByUnitIdWithDevices(unitId); @@ -151,6 +158,7 @@ public class PointOfCareService( /// /// The point of care entity containing the updated information to persist. /// The updated , or null if the record was not found after the update. + /// public async Task Update(PointOfCare pointOfCare) { var oldPoc = await pointOfCareRepository.FindById(pointOfCare.Id); @@ -169,6 +177,7 @@ public class PointOfCareService( /// /// The identifier of the point of care to update. /// The unit to assign to the point of care. + /// public async Task UpdateUnit(ObjectId id, Unit unit) { var poc = await FindById(id); @@ -187,6 +196,7 @@ public class PointOfCareService( /// Asynchronously retrieves all points of care from the repository, returning an empty list when the repository yields a null result. /// /// A task representing the asynchronous operation, containing the list of points of care, or an empty list if none are available. + /// public async Task> GetAll() { var c = await pointOfCareRepository.GetAll(); @@ -198,6 +208,7 @@ public class PointOfCareService( /// Returns an empty list if the repository result is null. /// /// A list of PointOfCare configurations, or an empty list when no configurations are available. + /// public async Task> GetAllConfigs() { var c = await pointOfCareRepository.GetAllConfigs(); @@ -209,6 +220,7 @@ public class PointOfCareService( /// Returns an empty list when the repository yields no results, ensuring callers never receive a null collection. /// /// A task that resolves to a list of entries, or an empty list if no locations are found. + /// public async Task> GetAllLocationInfo() { var c = await pointOfCareRepository.GetAllLocationInfo(); @@ -221,6 +233,7 @@ public class PointOfCareService( /// /// The pagination filter containing the page number and page size used to compute the skip offset and limit the number of returned items. /// A containing the requested page of points of care, the current page number, page size, and the total document count. + /// public async Task> GetPaginatedPoCs(PaginationFilter filter) { var result = pointOfCareRepository.GetPaginatedPoCs(filter); @@ -241,6 +254,7 @@ public class PointOfCareService( /// The new configuration values to persist. /// A task that represents the asynchronous update operation. /// Thrown when no existing Point of Care configuration is found for the specified identifier. + /// public async Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration) { var old = await pointOfCareRepository.GetPoCConfiguration(id) ?? @@ -258,6 +272,7 @@ public class PointOfCareService( /// /// The unique identifier of the point of care to retrieve. /// The matching with all configurations, or null if no point of care is found. + /// public async Task FindById(ObjectId id) { return await pointOfCareRepository.FindByIdAllConfig(id); @@ -267,6 +282,7 @@ public class PointOfCareService( /// /// The unique identifier of the point of care to retrieve. /// The matching with all configuration when found; otherwise, null. + /// public async Task FindByIdAllConfig(ObjectId id) { return await pointOfCareRepository.FindByIdAllConfig(id); @@ -278,6 +294,7 @@ public class PointOfCareService( /// /// The unique identifier of the unit whose points of care should be retrieved. /// A task that represents the asynchronous operation, containing a collection of points of care for the given unit, or an empty collection if none are found. + /// public async Task?> FindAllByUnitId(ObjectId unit) { var result = await pointOfCareRepository.FindAllByUnitId(unit); @@ -292,6 +309,7 @@ public class PointOfCareService( /// The point of care status used to filter the results. /// When set to true, virtual points of care are excluded from the returned collection. /// A task that represents the asynchronous operation. The task result contains the collection of points of care matching the specified unit and status. + /// public async Task> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare poc, bool excludeVirtual = false) { @@ -302,6 +320,7 @@ public class PointOfCareService( /// Check nex admission when patient has exit from poc /// /// PoC id + /// public async void CheckNextAdmission(ObjectId? patientLocation) { try @@ -347,6 +366,7 @@ public class PointOfCareService( /// The bed identifier used to locate the point of care. /// The unit identifier; when null, the method short-circuits and returns null. /// A containing the matching , or null if no input is valid or no record is found. + /// public async Task FindByBedAndUnitId(string? bed, ObjectId? unitId) { if (unitId == null || string.IsNullOrEmpty(bed)) return null; @@ -358,6 +378,7 @@ public class PointOfCareService( /// The update, cache invalidation, and audit logging are only performed when and its RelayIdList are not null. /// /// The Point of Care whose relay configuration will be updated. + /// public async Task UpdateRelayConfig(PointOfCare poc) { var oldPoc = await pointOfCareRepository.GetPoCConfiguration(poc.Id); @@ -374,6 +395,7 @@ public class PointOfCareService( /// /// The room identifier used to look up matching points of care. /// A task that represents the asynchronous operation. The task result contains an of points of care for the given room, or null if no matching points of care are found. + /// public async Task?> FindByRoom(string room) { return await pointOfCareRepository.FindByRoom(room); @@ -384,6 +406,7 @@ public class PointOfCareService( /// /// The bed identifier used to look up the associated points of care. /// A task that returns an of points of care linked to the given bed, or null if no points of care are found. + /// public async Task?> FindByBed(string bed) { return await pointOfCareRepository.FindByBed(bed); @@ -394,6 +417,7 @@ public class PointOfCareService( /// /// The list of unit identifiers used to filter the points of care. /// A task that represents the asynchronous operation, containing the list of matching points of care. + /// public async Task> FindAllByUnitIds(List unitIds) { var filter = Builders.Filter.In(p => p.UnitId, unitIds); @@ -407,6 +431,7 @@ public class PointOfCareService( /// The identifier of the point of care to retrieve. /// If true, loads and attaches the related patient and admission (when an admission id is present) to the returned point of care. /// A task that yields the with resolved related data, or null if no point of care is found for the given id. + /// public async Task GetInfo(ObjectId id, bool fillPatientData = true) { var poc = await FindById(id); @@ -446,6 +471,7 @@ public class PointOfCareService( /// When true, enriches the result with unit, patient, and admission data; when false, returns the point of care as-is. /// Token used to cancel the asynchronous operation. /// The retrieved and optionally enriched , or null if no point of care is found for the given identifier. + /// public async Task GetInfo(ObjectId id, LocaleEnum? locale, bool fillPatientData = true, CancellationToken ct = default) { @@ -487,6 +513,7 @@ public class PointOfCareService( /// /// The unique identifier of the patient whose Point of Care is being requested. /// The associated with the patient if one is assigned; otherwise, null. + /// public async Task FindPoCByPatientId(ObjectId patientId) { var patient = await patientService.Value.FindById(patientId); @@ -501,6 +528,7 @@ public class PointOfCareService( /// /// The unique patient number used to look up the patient. /// A task that represents the asynchronous operation, containing the associated if found; otherwise, null. + /// public async Task FindPoCByPatientNumber(string patientNumber) { var patient = await patientService.Value.FindByPatientNumber(patientNumber); @@ -514,6 +542,7 @@ public class PointOfCareService( /// /// The unique identifier of the unit whose PoCs should be counted. /// A task representing the asynchronous operation, containing the total number of PoCs linked to the given unit. + /// public async Task CountPoCsByUnitId(ObjectId unitId) { return await pointOfCareRepository.CountByUnitId(unitId); @@ -524,6 +553,7 @@ public class PointOfCareService( /// /// The unique identifier of the unit whose virtual PoCs are being counted. /// A representing the asynchronous operation, containing the total number of virtual PoCs linked to the given unit. + /// public async Task CountVirtualPoCsByUnitId(ObjectId unitId) { return await pointOfCareRepository.CountVirtualsByUnitId(unitId); @@ -537,6 +567,7 @@ public class PointOfCareService( /// /// The unique identifier of the point of care whose status should be updated. /// The new point of care status to apply. + /// public async Task SetPointOfCareStatus(ObjectId id, StatusEnum.PointOfCare status) { var pointOfCare = await GetInfo(id, null); @@ -562,6 +593,7 @@ public class PointOfCareService( /// /// The patient location used to look up the associated Point of Care. /// A task that yields the matching , or null if no Point of Care is found for the given location. + /// public async Task FindPoCByPatientLocation(PatientLocation patientLocation) { return await pointOfCareRepository.FindByPatientLocation(patientLocation); @@ -573,6 +605,7 @@ public class PointOfCareService( /// /// The point of care whose related subscribers should receive the notification. Its Id is used to match subscriber location identifiers. /// The type of operation (e.g., create, update, delete) being broadcast, sent as the message payload. + /// private void SendPointOfCareBroadcast(PointOfCare pointOfCare, OperationType operation) { try diff --git a/adas-core.Application/Services/PumpService.cs b/adas-core.Application/Services/PumpService.cs index edf35e83..05401fc6 100644 --- a/adas-core.Application/Services/PumpService.cs +++ b/adas-core.Application/Services/PumpService.cs @@ -27,6 +27,7 @@ namespace adas_core.Application.Services /// - Snapshot (pump_state) /// - Broadcast de snapshots (PumpState + PumpAlarmState) /// + /// public class PumpService( IPumpObservationRepository pumpObservationRepository, IPumpStateRepository pumpStateRepo, @@ -57,6 +58,7 @@ namespace adas_core.Application.Services /// Processes an incoming by normalizing its pump observations, resolving or creating the associated patient, and handling each observation according to its message type (HL7 PCD-01/04/10 or AlarisPump). For each observation, it dispatches to the appropriate observation or alarm pipeline, updates the pump state snapshot, broadcasts the resulting snapshots with any active device alarms, and applies retention rules on the historical observations. AlarisPump observations without a PatientId are discarded, and per-observation processing errors are logged without aborting the whole request. /// /// The API request containing the pump observations and message type to be persisted and broadcast. + /// public async Task SaveRequest(ApiRequest req) { // Normalizar single vs list (Alaris puede mandar 1 sola) @@ -142,6 +144,7 @@ namespace adas_core.Application.Services /// Processes a pump observation by assigning an identifier and expiration, mapping it to the persistence model, and persisting it together with an audit log entry when the mapping succeeds. /// /// The pump observation to process. Its Id and Expires are populated before mapping. + /// private async Task ProcessObservation(PumpObservation obs) { logger.LogDebug("Insertando OBSERVATION DeviceId={dev} Time={time}", obs.DeviceId, obs.Time); @@ -165,6 +168,7 @@ namespace adas_core.Application.Services /// Persists a pump alarm event derived from the supplied observation and updates the associated alarm state. /// /// The pump observation providing the device, infusion, alarm, and patient context used to build the alarm event. + /// private async Task ProcessAlarm(PumpObservation obs) { logger.LogDebug("Insertando ALARM DeviceId={dev}, Phase={phase}, Type={type}", @@ -205,6 +209,7 @@ namespace adas_core.Application.Services /// Updates the alarm state for a pump observation, removing the active alarm when the event phase is "end" and upserting a new alarm state record for start or continue phases. /// /// The pump observation providing the event phase, device identifier, alarm type, and related alarm metadata used to drive the alarm state change. + /// private async Task UpdateAlarmState(PumpObservation obs) { if (obs.EventPhase == null) return; @@ -251,6 +256,7 @@ namespace adas_core.Application.Services /// /// The pump observation whose values are merged into the current state and used to locate the device's existing record. /// The updated instance reflecting the merged observation and the new LastUpdated timestamp. + /// private async Task UpdatePumpState(PumpObservation obs) { var current = await pumpStateRepo.FindByDeviceIdAsync(obs.DeviceId!) @@ -274,6 +280,8 @@ namespace adas_core.Application.Services /// /// The target instance whose fields will be updated in place. /// The instance supplying the new candidate values to merge. + /// private static void MergePumpState(PumpState state, PumpObservation obs) { // Identidad / físico @@ -343,6 +351,7 @@ namespace adas_core.Application.Services /// /// The nullable pump value to inspect. /// true when is not null and its Value is not null; otherwise, false. + /// private static bool HasValue(CommonPumpTypes.PumpValue? v) => v is { Value: not null }; // MAP @@ -352,6 +361,8 @@ namespace adas_core.Application.Services /// /// The pump observation to be transformed through the mapping pipeline. /// A task that yields the mapped , or null when the calculated observations stage produces no result. + /// public async Task MapPumpObservation(PumpObservation obs) { var obs2 = await configPumpsService.Map(obs); @@ -371,6 +382,7 @@ namespace adas_core.Application.Services /// /// The API request to be saved. /// A task that represents the asynchronous save operation. + /// public Task SaveRequestAsync(ApiRequest req) => SaveRequest(req); @@ -381,6 +393,7 @@ namespace adas_core.Application.Services /// The unique identifier of the patient whose pump observations are being retrieved. /// The maximum number of recent pump observations to return. Defaults to 1. /// A task that resolves to a list of the most recent records for the patient, or an empty list when none are available. + /// public async Task> FindLastPumpObservations(ObjectId patientId, int num = 1) { var list = await pumpObservationRepository.FindByPatientId(patientId); @@ -396,6 +409,7 @@ namespace adas_core.Application.Services /// Asynchronously retrieves the most recent pump observation timestamp for every patient by delegating to the pump observation repository. /// /// A task that resolves to a dictionary mapping each patient's to the of their last pump observation. + /// public async Task> FindAllLastPatientObservationTime() { return await pumpObservationRepository.FindAllLastPatientObservationTimeAsync(); @@ -407,6 +421,7 @@ namespace adas_core.Application.Services /// /// The unique identifier of the patient whose related pump data should be removed. /// A task that represents the asynchronous deletion of the patient's data across the pump observation, alarm event, and alarm state repositories. + /// public async Task DeleteByPatientId(ObjectId id) { logger.LogDebug("Delete Pump data by Patient Id {id}", id); @@ -420,6 +435,7 @@ namespace adas_core.Application.Services /// Archives the specified patient by delegating the operation to the archive routine identified by the patient's identifier. /// /// The patient to be archived. + /// public async Task Archive(Patient patient) => await ArchiveByPatientId(patient.Id); // Archivo → por PatientId (mueve a archive_pumpobservations y elimina del activo) @@ -427,6 +443,7 @@ namespace adas_core.Application.Services /// Archives all pump observations associated with the specified patient by moving them to the archive repository and then deleting the active data. If no pump observations are found for the patient, the archive insertion is skipped while the deletion of active data still proceeds. /// /// The unique identifier of the patient whose pump observations should be archived. + /// public async Task ArchiveByPatientId(ObjectId id) { var list = await pumpObservationRepository.FindByPatientId(id); @@ -446,6 +463,7 @@ namespace adas_core.Application.Services /// The new ObjectId to assign. /// The existing ObjectId to be replaced. /// Thrown when is null, empty, or whitespace. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { @@ -476,6 +494,7 @@ namespace adas_core.Application.Services /// /// The identifier used to look up the configuration pump items. /// A task that represents the asynchronous operation. The task result is a list of matching the given identifier, or null if no items are found. + /// public async Task?> GetItemsById(string id) => await configPumpsService.GetConfigItems(id); @@ -485,6 +504,7 @@ namespace adas_core.Application.Services /// /// A task that represents the asynchronous operation, containing a list of configurations. /// Thrown when the underlying service returns a null result, meaning the pump configuration resource was not found. + /// public async Task?> GetAllPumpConfig() => await configPumpsService.GetAllPumpConfigs() ?? throw new NotFoundException(HttpEnum.ErrorMessage.NotFoundResourceMissing); @@ -496,6 +516,8 @@ namespace adas_core.Application.Services /// The unique identifier of the pump configuration to retrieve. /// The matching instance, or null if the service returns one; otherwise a is thrown. /// Thrown when the configuration service returns null, indicating that the requested resource is missing. + /// public async Task GetPumpConfigsById(string id) => await configPumpsService.GetPumpConfigById(id) ?? throw new NotFoundException(HttpEnum.ErrorMessage.NotFoundResourceMissing); @@ -506,6 +528,7 @@ namespace adas_core.Application.Services /// The pump configuration containing the updated values to persist. /// The updated configuration if the update succeeds. /// Thrown when the underlying update operation does not return a configuration, indicating the resource is missing. + /// public async Task UpdatePumpConfig(ConfigPumps config) { var oldConfig = await configPumpsService.GetPumpConfigById(config.Id); @@ -520,6 +543,8 @@ namespace adas_core.Application.Services /// The pump configuration to insert. /// The newly inserted , or if the operation yields no result. /// Thrown when the pump configuration could not be created by the underlying service. + /// public async Task InsertPumpConfig(ConfigPumps config) { await auditService.CreateAuditLogAsync(httpContextAccessor.HttpContext?.User!, null, config); @@ -533,6 +558,7 @@ namespace adas_core.Application.Services /// The pump configuration to delete. /// A task that represents the asynchronous operation, containing a value indicating whether the deletion was successful. /// Thrown when the underlying deletion operation fails. + /// public async Task DeletePumpConfig(ConfigPumps config) { var result = await configPumpsService.DeletePumpConfig(config); @@ -547,6 +573,8 @@ namespace adas_core.Application.Services /// /// The pagination and filter criteria, including page number, page size, optional patient identifier, device identifier, and date range. /// A task that yields the paginated response of pump observations, or null if the operation cannot be performed. + /// public async Task?> GetPaginatedPump(PaginationFilter filter) { // Implementación compatible sin nuevos métodos en los repos: @@ -600,6 +628,8 @@ namespace adas_core.Application.Services /// Inserts a pump observation into the repository, applying default values for missing identifier and timestamp, and triggers post-insertion side effects such as audit logging, state updates, snapshot broadcasting, and retention actions. If the mapped observation is null, no further action is taken. Observations with a number of zero are skipped from post-insertion processing when zero-value emissions are disabled. /// /// The pump observation to insert. Its Id is generated if not set, and its Time defaults to UTC now if set to . + /// public async Task InsertPumpObservation(PumpObservation obs) { logger.LogDebug("Insert {obs}", obs); @@ -627,6 +657,7 @@ namespace adas_core.Application.Services /// Applies the configured retention policy to pump observations, executing deletion by age (days) or by count (keeping the last N), and logging a warning for unrecognized policies. Returns early when no retention policy value is available. /// /// The pump observation used to resolve the applicable retention configuration. + /// private async Task DoRetentionActions(PumpObservation obs) { var result = await configPumpsService.RetentionActions(obs); @@ -679,6 +710,7 @@ namespace adas_core.Application.Services /// Optional patient identifier used to resolve the patient and derive the target location; when null the request location is used instead. /// Optional API request whose Location is used as a fallback to resolve the target location when no patient identifier is provided. /// A that completes once the pump state and all active alarms have been dispatched, or immediately when there are no matching subscribers. + /// private async Task SendSnapshotsBroadcast( PumpState state, IEnumerable activeAlarms, @@ -734,6 +766,7 @@ namespace adas_core.Application.Services /// The API request that may contain a patient id to be parsed and assigned. /// The pump observation whose patient id is being updated in place. /// An optional patient id obtained from a prior lookup, used as a fallback when the observation has no patient id assigned. + /// private static void UpdatePatientFromRequest(ApiRequest req, PumpObservation obs, ObjectId? foundPatientId) { if (obs.PatientId == null && foundPatientId != null) diff --git a/adas-core.Application/Services/RecordingAlertService.cs b/adas-core.Application/Services/RecordingAlertService.cs index 54c8038d..c1981774 100644 --- a/adas-core.Application/Services/RecordingAlertService.cs +++ b/adas-core.Application/Services/RecordingAlertService.cs @@ -17,6 +17,22 @@ namespace adas_core.Application.Services; /// Uses and for alert persistence, and lazily resolves through . /// /// +/// +/// +/// +/// +/// +/// +/// +/// public class RecordingAlertService( Lazy patientService, IConfigObservationService configObservationService, @@ -34,6 +50,7 @@ public class RecordingAlertService( /// /// The patient to be archived. /// A task that represents the asynchronous archive operation. + /// public async Task Archive(Patient patient) { await ArchiveByPatientId(patient.Id); @@ -44,6 +61,7 @@ public class RecordingAlertService( /// to the archive repository and then deleting them from the source repository. /// /// The unique identifier of the patient whose recording alerts should be archived. + /// public async Task ArchiveByPatientId(ObjectId id) { logger.LogDebug("Archive Recording Alerts by Patient Id {id}", id); @@ -61,6 +79,7 @@ public class RecordingAlertService( /// Deletes all recording alerts associated with the specified patient identifier by delegating to the recording alert repository. /// /// The unique identifier of the patient whose recording alerts should be removed. + /// public async Task DeleteByPatientId(ObjectId id) { logger.LogDebug("Delete Recording Alerts by Patient Id {id}", id); @@ -73,6 +92,7 @@ public class RecordingAlertService( /// The unique identifier of the patient whose recording alerts are being queried. /// The maximum number of recent alerts to return. Defaults to 2. /// A task that represents the asynchronous operation, containing a list of the patient's most recent entries. + /// public async Task> FindLastRecordingAlert(ObjectId patientId, int num = 2) { return await recordingAlertRepository.AggregatedPatientLastObservations(patientId, num); @@ -84,6 +104,7 @@ public class RecordingAlertService( /// /// The API request to save. /// A task that represents the asynchronous save operation. + /// public Task SaveRequestAsync(ApiRequest apiRequest) { return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); })); @@ -95,6 +116,7 @@ public class RecordingAlertService( /// /// The API request containing patient or location identifiers and the recording alerts to persist. /// Thrown when .Type is not a valid type for Observations. + /// public async Task SaveRequest(ApiRequest apiRequest) { if (string.IsNullOrEmpty(apiRequest.PatientNumber) && string.IsNullOrEmpty(apiRequest.Location?.UnitName) && @@ -164,6 +186,7 @@ public class RecordingAlertService( /// The name identifier used to filter the records to update. /// The new value to assign to the matching records. /// The existing value to be replaced in the matching records. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await recordingAlertRepository.UpdateManyObjectId(nameId, id, oldId); @@ -173,6 +196,7 @@ public class RecordingAlertService( /// Inserts a new patient recording alert by persisting it, creating an audit log entry, broadcasting the alert, and executing any associated retention actions. /// /// The patient recording alert to be inserted and processed. + /// private async Task InsertRecordingAlert(PatientRecordingAlert recAlert) { logger.LogDebug("Insert {recAlert}", recAlert); @@ -186,6 +210,7 @@ public class RecordingAlertService( /// Asynchronously broadcasts a patient observation to subscribers whose registered locations include the patient's point of care, sending a recording alert when the observation is a recording alert and a generic observation otherwise. The method returns early without sending any message if the observation has no name, the patient cannot be resolved, or the patient has no point of care assigned. /// /// The patient observation to broadcast to matching subscribers. + /// private async Task SendObsBroadcast(BasePatientObservation recAlert) { if (recAlert.Name == null) return; @@ -210,6 +235,7 @@ public class RecordingAlertService( /// /// The patient recording alert whose retention actions will be evaluated and applied. /// Thrown when the resolved value is not handled by the switch statement. + /// private async Task DoRetentionActions(PatientRecordingAlert recAlert) { var result = await configObservationService.RetentionActions(recAlert); diff --git a/adas-core.Application/Services/RecordingService.cs b/adas-core.Application/Services/RecordingService.cs index 6e7de36d..c3510540 100644 --- a/adas-core.Application/Services/RecordingService.cs +++ b/adas-core.Application/Services/RecordingService.cs @@ -21,6 +21,7 @@ namespace adas_core.Application.Services; /// /// Provides functionality for recording operations as defined by the contract. /// +/// public class RecordingService : IRecordingService { private readonly IAuthService _authService; @@ -95,6 +96,7 @@ public class RecordingService : IRecordingService /// The point of care associated with the recording. /// A task that resolves to true if the cancel request succeeded; otherwise, false. /// Thrown when the recording API URL is not defined or the authentication token is null or empty. + /// public async Task SendCancelRecordingToRecordingApi(Patient patient, PointOfCare poc) { var token = await _authService.GetToken(); @@ -125,6 +127,7 @@ public class RecordingService : IRecordingService /// The point of care where the recording was performed. /// The manual recording whose start and stop times are forwarded to the queue. /// A flag indicating whether the recording is being started or stopped. + /// public async Task SendRecordingData(Patient patient, PointOfCare poc, ManualRecording manualRecording, bool start) { @@ -140,6 +143,7 @@ public class RecordingService : IRecordingService /// The point of care where the recording was captured. /// The automatic recording payload, including alarm name, start/stop/event timestamps, severity, and description. /// A task that resolves to true if the recording data was queued successfully; otherwise, false when the alarm name cannot be parsed or the send operation fails. + /// public async Task SendAutoRecordingData(Patient patient, PointOfCare poc, RecordingData automaticRecording) { try @@ -178,6 +182,7 @@ public class RecordingService : IRecordingService /// Flag indicating whether the recording is a start event; defaults to true. /// The alarm type for the recording; defaults to . /// Thrown when the point of care status is not , including the serialized point of care in the message. + /// public async Task SendRecordingDataToQueue(Patient patient, PointOfCare poc, DateTime? date, DateTime? endDate, DateTime? eventDate, AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, string? alarmDescription, bool start = true, AlarmEnum.Type type = AlarmEnum.Type.Manual) @@ -242,6 +247,8 @@ public class RecordingService : IRecordingService /// /// The identifier of the room whose recordings should be fetched. /// A task that resolves to a list of for the room, an empty list when the request fails or the room has no recordings, or null when the recording API URL or authentication token is not configured or when the maximum number of retries is reached. + /// public async Task?> GetRecordings(int roomId) { var retryCount = 1; @@ -331,6 +338,7 @@ public class RecordingService : IRecordingService /// /// The API request whose recording data and patient information will be sent to the Recording API. /// Rethrown via Task.FromException when a non-HTTP error occurs while sending the recording request. + /// public async Task SaveRequestAsync(ApiRequest apiRequest) { var retryCount = 1; @@ -420,6 +428,7 @@ public class RecordingService : IRecordingService /// /// The API request to save. /// Always thrown because the method has not been implemented. + /// public Task SaveRequest(ApiRequest apiRequest) { //return Task.CompletedTask; @@ -442,6 +451,7 @@ public class RecordingService : IRecordingService /// A textual description of the alarm. /// The alarm type, defaulting to when not specified. /// A configured instance, or null if any required identifier is invalid. + /// private RecordingData? GenerateRecordingData(Patient patient, PointOfCare poc, DateTime? startDate, DateTime? endDate, DateTime? eventTime, int? minToExpired, AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, @@ -502,6 +512,7 @@ public class RecordingService : IRecordingService /// and silently returns when the patient cannot be resolved. /// /// The list of recording entries to broadcast; the first item is used to resolve the patient and room context. + /// private async Task SendRecordingBroadcast(List recording) { if (!recording.IsNullOrEmpty()) @@ -534,6 +545,7 @@ public class RecordingService : IRecordingService /// /// The text to encode. /// The Base64 encoded representation of the input text. + /// protected static string Base64Encode(string plainText) { var plainTextBytes = Encoding.UTF8.GetBytes(plainText); diff --git a/adas-core.Application/Services/SchedulerService.cs b/adas-core.Application/Services/SchedulerService.cs index cdbcd1fb..0470a611 100644 --- a/adas-core.Application/Services/SchedulerService.cs +++ b/adas-core.Application/Services/SchedulerService.cs @@ -19,6 +19,7 @@ namespace adas_core.Application.Services; /// /// Provides scheduling functionality as a service to manage and coordinate timed or periodic operations. /// +/// public class SchedulerService { private readonly bool _activateCheckExpiredAlerts; @@ -73,6 +74,7 @@ public class SchedulerService /// Factory used to create HTTP clients for provider integrations. /// Lazy provider of calculated observations operations. /// Lazy provider of patient care plan operations. + /// public SchedulerService(IOptions apiSettings, IOptions> providersSettings, Lazy patientService, @@ -167,6 +169,8 @@ public class SchedulerService /// /// Initializes the Quartz scheduler by wiring up service dependencies for background jobs, creating job and trigger definitions, and conditionally scheduling them based on feature flag configuration settings before starting the scheduler. /// + /// private async Task InitScheduler() { //TODO con el cambio a .net core y el repaso a la inyección de dependencias de estructure map @@ -398,6 +402,7 @@ public class SchedulerService /// /// The DisallowConcurrentExecution attribute prevents overlapping executions of this job. /// +/// [DisallowConcurrentExecution] public class CheckHydricBalanceRyCJob : IJob { @@ -413,6 +418,7 @@ public class CheckHydricBalanceRyCJob : IJob /// All exceptions raised during processing are caught and logged, allowing the job to finish without interrupting the scheduler. /// /// The Quartz job execution context provided by the scheduler when the job trigger fires. + /// public async Task Execute(IJobExecutionContext context) { var start = DateTime.Now; @@ -457,6 +463,7 @@ public class CheckHydricBalanceRyCJob : IJob /// /// The DisallowConcurrentExecution attribute ensures that only one instance of this job can execute at any given time. /// +/// [DisallowConcurrentExecution] public class CheckActiveTreatmentsJob : IJob { @@ -474,6 +481,7 @@ public class CheckActiveTreatmentsJob : IJob /// Executes the scheduled job that iterates through all patients, retrieves their active treatments and the associated medicines (excluding nutrition-type medicines), and calculates medicine observations for each patient. Exceptions are caught and logged without rethrowing, and the total execution duration is logged upon completion. /// /// The job execution context provided by the scheduler. + /// public async Task Execute(IJobExecutionContext context) { var start = DateTime.Now; @@ -525,6 +533,7 @@ public class CheckActiveTreatmentsJob : IJob /// /// The attribute prevents multiple instances of this job from running at the same time. /// +/// [DisallowConcurrentExecution] public class CheckActiveAppointmentsJob : IJob { @@ -540,6 +549,7 @@ public class CheckActiveAppointmentsJob : IJob /// Executes the scheduled check active appointments job, logging the start and completion times along with the total elapsed time. Any exception thrown during execution is caught and logged without being rethrown. /// /// The Quartz scheduler context that provides runtime information for the job execution. + /// public async Task Execute(IJobExecutionContext context) { var start = DateTime.Now; @@ -567,6 +577,7 @@ public class CheckActiveAppointmentsJob : IJob /// /// The DisallowConcurrentExecution attribute prevents multiple instances of this job from running simultaneously. /// +/// [DisallowConcurrentExecution] public class CheckInactivePatientsJob : IJob { @@ -579,6 +590,7 @@ public class CheckInactivePatientsJob : IJob /// Skips processing when another instance is already running, as indicated by the global isCheckingInactivePatients flag, and logs the elapsed execution time. /// /// The Quartz job execution context whose data map supplies the inactivity and discharge thresholds. + /// public async Task Execute(IJobExecutionContext context) { //LogExecutionContext.TrySetTraceIdentifier(Guid.NewGuid().ToString(), true); @@ -617,6 +629,7 @@ public class CheckInactivePatientsJob : IJob /// /// The DisallowConcurrentExecution attribute ensures that overlapping executions of this job are prevented, guaranteeing that only one instance runs at a time. /// +/// [DisallowConcurrentExecution] public class CheckOpiateBolusesJob : IJob { @@ -630,6 +643,8 @@ public class CheckOpiateBolusesJob : IJob /// logging any errors that occur and reporting the total execution time upon completion. /// /// The Quartz job execution context provided by the scheduler for this job run. + /// public async Task Execute(IJobExecutionContext context) { var start = DateTime.Now; @@ -660,6 +675,7 @@ public class CheckOpiateBolusesJob : IJob /// /// The attribute ensures that only one instance of this job can execute at a given time, preventing overlapping runs that could lead to duplicate processing of expired observations. /// +/// [DisallowConcurrentExecution] public class CheckExpiredObservationsJob : IJob { @@ -672,6 +688,7 @@ public class CheckExpiredObservationsJob : IJob /// Executes the scheduled job that checks and expires observations, recalculating dependent data. Uses a global flag to prevent concurrent execution of the expiration logic, and logs the start, duration, and any errors encountered. /// /// The job execution context provided by the scheduler. + /// public async Task Execute(IJobExecutionContext context) { var start = DateTime.Now; @@ -705,6 +722,7 @@ public class CheckExpiredObservationsJob : IJob /// /// Job for calculate NEWS based on FR, SPo2, Temperature, Tas and FC /// +/// [DisallowConcurrentExecution] public class CalculateNewsJob : IJob { @@ -728,6 +746,7 @@ public class CalculateNewsJob : IJob /// the latest underlying observation is not expired. /// /// The Quartz job execution context provided by the scheduler. + /// public async Task Execute(IJobExecutionContext context) { //Filter patients in real locations @@ -885,6 +904,7 @@ public class CalculateNewsJob : IJob /// /// This job is decorated with the to prevent overlapping executions of the same job instance. /// +/// [DisallowConcurrentExecution] public class CheckExpiredAlertsJob : IJob { @@ -898,6 +918,7 @@ public class CheckExpiredAlertsJob : IJob /// Runs the expiration logic only when the global "isCheckingAlertsExpiration" flag is absent or set to false; any exception is caught and logged without being rethrown. /// /// The Quartz job execution context provided by the scheduler when the job trigger fires. + /// public async Task Execute(IJobExecutionContext context) { var start = DateTime.Now; @@ -929,6 +950,7 @@ public class CheckExpiredAlertsJob : IJob /// /// The attribute ensures that the job will not be triggered while a previous execution is still running. /// +/// [DisallowConcurrentExecution] public class ArchiveNurseDataJob : IJob { @@ -945,6 +967,7 @@ public class ArchiveNurseDataJob : IJob /// Executes the ArchiveNurseDataJob which archives finished nurse procedures, tests, and treatments for patients whose associated end dates exceed the configured thresholds defined in . Each archive category is only processed when its corresponding setting flag is active, and any exception is caught and logged without interrupting the remaining work. /// /// The Quartz.NET job execution context that provides runtime information for the scheduled job execution. + /// public async Task Execute(IJobExecutionContext context) { var start = DateTime.Now; @@ -1053,6 +1076,7 @@ public class ArchiveNurseDataJob : IJob /// Represents a scheduled job that retrieves observations associated with providers. /// /// The DisallowConcurrentExecution attribute prevents overlapping executions of this job instance. +/// [DisallowConcurrentExecution] public class GetProvidersObservationsJob : IJob { @@ -1073,6 +1097,7 @@ public class GetProvidersObservationsJob : IJob /// skips providers whose type or required constructor cannot be found, and logs and recovers from any exception raised during processing. /// /// The Quartz job execution context provided by the scheduler when the job is triggered. + /// public async Task Execute(IJobExecutionContext context) { var start = DateTime.Now; diff --git a/adas-core.Application/Services/ServiceConfigService.cs b/adas-core.Application/Services/ServiceConfigService.cs index eef53a76..af34d424 100644 --- a/adas-core.Application/Services/ServiceConfigService.cs +++ b/adas-core.Application/Services/ServiceConfigService.cs @@ -30,6 +30,7 @@ public class ServiceConfigService( /// The identifier of the service configuration to retrieve. May be a string id or a valid ObjectId representation. /// The matching , or null when no record is found for the provided id. /// Thrown when the resource cannot be found after attempting both the string id and the parsed lookup. + /// public async Task Get(string id) { var result = await serviceConfigRepository.FindById(id); diff --git a/adas-core.Application/Services/SubscribersService.cs b/adas-core.Application/Services/SubscribersService.cs index bcf0270a..89159cf4 100644 --- a/adas-core.Application/Services/SubscribersService.cs +++ b/adas-core.Application/Services/SubscribersService.cs @@ -8,6 +8,7 @@ namespace adas_core.Application.Services; /// Provides operations for managing subscribers by implementing the contract. /// Acts as the concrete service layer responsible for subscriber-related functionality. /// +/// public class SubscribersService : ISubscribersService { private readonly List _subscribers = []; @@ -17,6 +18,7 @@ public class SubscribersService : ISubscribersService /// Retrieves a thread-safe snapshot of the current list of WebSocket subscribers. /// /// A new containing a copy of the current subscribers. + /// public List GetSubscribers() { lock (_subscribers) @@ -32,6 +34,7 @@ public class SubscribersService : ISubscribersService /// /// The unique connection identifier of the subscriber to look up. /// The matching if found; otherwise, null. + /// public WsSubscriber? GetById(string contextConnectionId) { lock (_subscribers) @@ -46,6 +49,7 @@ public class SubscribersService : ISubscribersService /// /// The point-of-contact identifier used to match subscribers by their location list. /// A list of instances that have in their location identifiers; returns an empty list when no matches are found. + /// public List GetByPocId(ObjectId pocId) { lock (_subscribers) @@ -59,6 +63,7 @@ public class SubscribersService : ISubscribersService /// /// The unique identifier of the connection to remove. /// The number of connections that were removed from the subscribers list. + /// public int RemoveConnectionById(string contextConnectionId) { lock (_subscribers) @@ -72,6 +77,7 @@ public class SubscribersService : ISubscribersService /// Ensures that concurrent calls to add subscribers are serialized to prevent race conditions. /// /// The WebSocket subscriber to add to the collection. + /// public void AddSubscriber(WsSubscriber subscriber) { lock (_subscribers) diff --git a/adas-core.Application/Services/TreatmentService.cs b/adas-core.Application/Services/TreatmentService.cs index 08bb63b3..8e9b33eb 100644 --- a/adas-core.Application/Services/TreatmentService.cs +++ b/adas-core.Application/Services/TreatmentService.cs @@ -25,6 +25,7 @@ namespace adas_core.Application.Services; /// (OMP_O09, ORM_O01, RAS_O17) and emits broadcasts to /// subscribers based on the patient's point of care. /// +/// public class TreatmentService( ITreatmentRepository treatmentRepository, ITreatmentArchiveRepository treatmentArchiveRepository, @@ -47,6 +48,7 @@ public class TreatmentService( /// A task that represents the asynchronous operation. The task result contains /// an of for the patient. /// + /// public async Task> GetTreatmentsByPatientId(ObjectId id) { return await treatmentRepository.GetByPatientId(id); @@ -62,6 +64,7 @@ public class TreatmentService( /// If the treatment cannot be mapped, it is silently ignored. A broadcast /// is dispatched asynchronously upon successful insertion. /// + /// public async Task Insert(PatientTreatment treatment) { logger.LogDebug("Insert {treatment}", treatment); @@ -88,6 +91,7 @@ public class TreatmentService( /// Thrown when the patient has no treatments to delete (no record was found) /// or when the underlying delete operation fails. /// + /// public async Task DeleteByPatientId(ObjectId id) { var treatmentToDelete = await FindByPatientId(id) ?? @@ -108,6 +112,7 @@ public class TreatmentService( /// /// The whose treatments will be archived. /// A task that represents the asynchronous archive operation. + /// public async Task Archive(Patient patient) { await ArchiveByPatientId(patient.Id); @@ -119,6 +124,7 @@ public class TreatmentService( /// /// The of the patient whose treatments will be archived. /// A task that represents the asynchronous archive operation. + /// public async Task ArchiveByPatientId(ObjectId id) { logger.LogDebug("ArchiveB Treatments by Patient Id PatientId {id}", id); @@ -144,6 +150,7 @@ public class TreatmentService( /// /// Thrown when the treatment does not exist or the update operation fails. /// + /// public async Task UpdateTreatment(PatientTreatment patientTreatment) { var oldTreatment = await treatmentRepository.GetById(patientTreatment.Id) ?? @@ -166,6 +173,7 @@ public class TreatmentService( /// A task that represents the asynchronous operation. The task result contains /// an of . /// + /// public async Task> FindByPatientIdAsync(ObjectId patientId) { return await treatmentRepository.FindByPatientIdAsync(patientId); @@ -179,6 +187,7 @@ public class TreatmentService( /// A task that represents the asynchronous operation. The task result contains /// an of . /// + /// public async Task> FindByPatientId(ObjectId patientId) { return await treatmentRepository.FindByPatientId(patientId); @@ -192,6 +201,7 @@ public class TreatmentService( /// A task that represents the asynchronous operation. The task result contains /// a of representing the bolus treatments. /// + /// public async Task> GetBolusTreatments(ObjectId patientId) { return await treatmentRepository.FindBolusTreatments(patientId); @@ -202,6 +212,7 @@ public class TreatmentService( /// /// The inbound to process. /// A task that represents the asynchronous save operation. + /// public async Task SaveRequestAsync(ApiRequest apiRequest) { await SaveRequest(apiRequest); @@ -221,6 +232,7 @@ public class TreatmentService( /// The method also enforces the unit's AutoAdt configuration when the /// request does not originate from a panel. /// + /// public async Task SaveRequest(ApiRequest apiRequest) { if (string.IsNullOrEmpty(apiRequest.PatientNumber)) @@ -307,6 +319,7 @@ public class TreatmentService( /// representing the active treatments. Treatments marked as Dc or /// outside their validity window are excluded. /// + /// public async Task> GetActiveTreatmentsByPatient(ObjectId id) { var treatments = await treatmentRepository.GetByPatientId(id); @@ -330,6 +343,7 @@ public class TreatmentService( /// The new value. /// The previous value being replaced. /// A task that represents the asynchronous operation. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await treatmentRepository.UpdateManyObjectId(nameId, id, oldId); @@ -346,6 +360,7 @@ public class TreatmentService( /// A task that represents the asynchronous operation. The task result contains /// a of . /// + /// public async Task> GetPaginatedTreatments(PaginationFilter filter) { var result = treatmentRepository.GetPaginatedTreatments(filter); @@ -371,6 +386,7 @@ public class TreatmentService( /// A task that represents the asynchronous operation. The task result contains /// a of . /// + /// public async Task> GetActiveTreatmentsByPatientIdAndOrder(ObjectId patientId, string order) { return await treatmentRepository.GetActiveTreatmentsByPatientIdAndOrder(patientId, order); @@ -385,6 +401,7 @@ public class TreatmentService( /// /// Thrown when the treatment does not exist. /// + /// public async Task DeleteById(ObjectId id) { var oldTreatment = await treatmentRepository.GetById(id) ?? @@ -407,6 +424,7 @@ public class TreatmentService( /// If the configuration-observation service returns , /// the treatment is considered ignored and a debug entry is logged. /// + /// private async Task MapTreatment(PatientTreatment treatment) { var treatment2 = await calculatedObservationsService.Value.Map(treatment); @@ -428,6 +446,7 @@ public class TreatmentService( /// If the patient cannot be located or has no PointOfCareId, the /// broadcast is skipped. /// + /// private async Task SendBroadcast(PatientTreatment treatment, OperationType operationType) { var patient = await patientService.FindById(treatment.PatientId); @@ -452,6 +471,8 @@ public class TreatmentService( /// discontinued () and the current UTC /// time lies within its validity window; otherwise, . /// + /// private static bool IsValidTreatment(PatientTreatment treatment) { if (treatment.PlacerOrder == null) @@ -478,6 +499,7 @@ public class TreatmentService( /// The most recent treatment whose is /// Nw or Xo, or if none qualifies. /// + /// private static PatientTreatment? GetMostRecentActiveTreatment(IGrouping group) { return group diff --git a/adas-core.Application/Services/UnitService.cs b/adas-core.Application/Services/UnitService.cs index 124a1d99..11b271ce 100644 --- a/adas-core.Application/Services/UnitService.cs +++ b/adas-core.Application/Services/UnitService.cs @@ -41,6 +41,7 @@ public class UnitService( /// /// If true, loads and assigns the PointOfCares for each unit; if false, returns units without their PointOfCares. /// A task representing the asynchronous operation, containing the list of all units, with PointOfCares populated when requested. + /// public async Task> GetAll(bool withPoCs = false) { var units = await unitRepository.GetAll(); @@ -59,6 +60,7 @@ public class UnitService( /// Retrieves all units in a compact representation, mapping each unit to a containing its identifier, name, and title, with null name and title values safely replaced by empty strings. /// /// A task that represents the asynchronous operation. The task result contains a list of objects for all available units. + /// public async Task> GetAllCompact() { var units = await unitRepository.GetAll(); @@ -78,6 +80,7 @@ public class UnitService( /// /// The unique identifier of the unit to retrieve. /// A containing the compact unit information, or a DTO with null/empty fields if the unit does not exist. + /// public async Task GetOneCompact(ObjectId id) { var unit = await unitRepository.FindById(id); @@ -97,6 +100,7 @@ public class UnitService( /// The pagination parameters controlling the page number, page size, and total count. /// Indicates whether the response units should be populated with their related Points of Care. Defaults to false. /// A containing the requested page of units along with pagination metadata. + /// public async Task> GetPaginatedUnits(PaginationFilter filter, bool withPoCs = false) { var result = unitRepository.GetPaginatedUnits(filter); @@ -133,6 +137,8 @@ public class UnitService( /// When , also loads and assigns the Points of Care associated with the unit; when (default), the Points of Care collection is not populated. /// A that yields the requested with its optional related lists and Points of Care, or when no unit matches the identifier. /// Thrown when no unit is found for the supplied . + /// public async Task GetInfo(ObjectId id, LocaleEnum? dataLocale, bool fillLists = true, bool withPoCs = false) { var unit = await Get(id.ToString()) ?? @@ -252,6 +258,8 @@ public class UnitService( /// Flag intended to control device inclusion alongside the points of care. /// The matching instance. /// Thrown when no unit exists for the supplied . + /// public async Task GetInfo(ObjectId id, bool withPoCs = true, bool withDevices = true) { var unit = await Get(id.ToString()) ?? @@ -271,6 +279,7 @@ public class UnitService( /// The name of the unit to search for. /// The unit matching the specified name. /// Thrown when no unit exists with the provided name. + /// public async Task GetByName(string itemUnitName) { return await unitRepository.FindByName(itemUnitName) ?? @@ -284,6 +293,8 @@ public class UnitService( /// The identifier of the patient whose associated unit should be retrieved. /// A containing the associated if found, or null when no matching unit exists. /// Thrown when the patient has no associated UnitId (i.e., the resource is missing). + /// public async Task FindByPatientId(ObjectId patientId) { //var sections = await GetAll(); @@ -305,6 +316,7 @@ public class UnitService( /// The identifier of the master list used to find the associated units. /// The type of the master list used to filter the units. /// A task that represents the asynchronous operation, containing a collection of entities if found, or null if an error occurs. + /// public async Task?> FindUnitsByMasterListId(ObjectId masterListId, MasterListType masterListType) { try @@ -327,6 +339,7 @@ public class UnitService( /// The unique identifier of the master list whose units should be counted. /// The type of the master list used to filter the units to be counted. /// A representing the asynchronous operation, containing the total number of units that match the given master list identifier and type. + /// public async Task CountUnitsByMasterListId(ObjectId masterListId, MasterListType masterListType) { return await unitRepository.CountUnitsByMasterListId(masterListId, masterListType); @@ -338,6 +351,7 @@ public class UnitService( /// /// The identifier of the master list whose units should be retrieved. /// A task that yields the collection of items matching the master list identifier, or an empty list if an error occurs. + /// public async Task> FindUnitsByMasterListId(ObjectId masterListId) { try @@ -362,6 +376,8 @@ public class UnitService( /// The updated if the operation succeeds; otherwise, null when the underlying update returns no result. /// Thrown when no unit is found matching the identifier specified in . /// Thrown when the update operation performed by the repository fails to produce a result. + /// public async Task UpdateUnitMasterList(UpdateUnitIdListDto updateUnitListDto) { var unit = await FindById(updateUnitListDto.UnitId) ?? @@ -380,6 +396,8 @@ public class UnitService( /// A task that resolves to true when the configuration was successfully updated; otherwise, false. /// Thrown when the unit cannot be found either before or after the update operation. /// Thrown when the underlying update operation fails to persist the new configuration. + /// public async Task UpdateConfiguration(ObjectId unitIdParsed, UnitConfiguration unitConfiguration) { var oldConfig = await FindById(unitIdParsed) ?? @@ -398,6 +416,7 @@ public class UnitService( /// /// The identifier of the unit to find. /// The unit matching the specified identifier, or null if the identifier is null. + /// public async Task FindById(ObjectId? id) { if (id == null) @@ -411,6 +430,7 @@ public class UnitService( /// /// The name of the unit to look up. Can be or empty. /// A containing the matching , or if no name was provided. + /// public async Task FindByName(string? name) { if (string.IsNullOrEmpty(name)) @@ -426,6 +446,7 @@ public class UnitService( /// The name of the unit to search for. Takes precedence over when provided. /// The point of care bed identifier used as a fallback to locate the unit when is not supplied. /// A task containing the matching , or null if no unit can be resolved from the given inputs. + /// public async Task FindByUnitNameOrPocName(string? name, string? pocName) { if (!string.IsNullOrEmpty(name)) @@ -451,6 +472,7 @@ public class UnitService( /// The unit entity to be inserted. /// The newly created unit returned by the repository. /// Thrown when the repository returns null, indicating that the unit could not be created. + /// public async Task InsertOne(Unit unit) { var newUnit = await unitRepository.InsertOneUnit(unit) ?? @@ -465,6 +487,7 @@ public class UnitService( /// The unit containing the updated information, including the identifier of the existing unit to modify. /// The updated if the operation succeeded; null if the repository could not persist the update. /// Thrown when no unit exists with the specified identifier. + /// public async Task UpdateUnit(Unit unit) { var oldUnit = await FindById(unit.Id) ?? @@ -488,6 +511,8 @@ public class UnitService( /// The updated unit when the operation succeeds; otherwise, null. /// Thrown when no unit is found for the provided identifier. /// Thrown when the underlying unit update operation fails. + /// public async Task UpdateUnitInfo(ObjectId unitId, string name, string title, string? configObsId = null) { var oldUnit = await FindById(unitId) ?? @@ -507,6 +532,7 @@ public class UnitService( /// The unit entity to delete, identified by its Id. /// A task that resolves to true when the unit is successfully deleted. /// Thrown when the delete operation fails (returns null). + /// public async Task DeleteUnitById(Unit unit) { //if (unit is not { Status: null }) throw new ConflictException(ErrorMessage.Conflict_ResourceInUse); @@ -521,6 +547,7 @@ public class UnitService( /// /// The identifier used to locate the unit. It can be an ObjectId, a title, or a name. /// The matching if found; otherwise, null. + /// public async Task Get(string id) { Unit? section = null; @@ -541,6 +568,7 @@ public class UnitService( /// /// The providing the Bed and UnitName values used to filter the results. /// A task containing a list of entries whose point of care matches the given location, or null if an error occurs while retrieving the data. + /// public async Task?> FindByLocation(PatientLocation location) { try @@ -564,6 +592,7 @@ public class UnitService( /// /// The unit whose operation is being broadcast. /// The type of operation performed on the unit, sent as part of the broadcast message. + /// private async void SendUnitBroadcast(Unit unit, OperationType operation) { try diff --git a/adas-core.Application/Subscriptions/SubscriberGroupedService.cs b/adas-core.Application/Subscriptions/SubscriberGroupedService.cs index 866b0737..6f5a0dac 100644 --- a/adas-core.Application/Subscriptions/SubscriberGroupedService.cs +++ b/adas-core.Application/Subscriptions/SubscriberGroupedService.cs @@ -14,6 +14,7 @@ namespace adas_core.Application.Subscriptions; /// /// This service depends on an optional cache, a grouped observation service, a logger, and a lazily-initialized client message service to support its subscriber-related operations. /// +/// public class SubscriberGroupedService( ICacheService? cacheService, IGroupedObservationService groupedObservationService, @@ -48,6 +49,7 @@ public class SubscriberGroupedService( /// Returns a thread-safe snapshot of the grouped subscribers as a new list. The internal collection is locked during the copy to ensure consistency and prevent concurrent modification. /// /// A new containing a copy of the grouped subscribers. + /// public List GetGrouped() { lock (_subscriberGrouped) @@ -60,6 +62,7 @@ public class SubscriberGroupedService( /// Removes all grouped observations associated with the specified patient identifier from the subscriber collection in a thread-safe manner. /// /// The string representation of the patient identifier used to locate and remove the matching grouped observations. + /// public void RemoveGroupedObsByPatientId(string patientId) { lock (_subscriberGrouped) @@ -76,6 +79,10 @@ public class SubscriberGroupedService( /// /// objectId on db for Patient /// + /// + /// public void RemoveWsSubscriberByLocation(string patientId, PatientLocation? newLocation) { lock (_subscriberGrouped) @@ -100,6 +107,7 @@ public class SubscriberGroupedService( /// /// The patient identifier used to locate the subscriber groups to update. /// The WebSocket subscriber ID to remove from the matching subscriber and group collections. + /// public void RemoveWsSubscriberPatientIdAndWsId(string patientId, string wsIdToRemove) { lock (_subscriberGrouped) @@ -139,6 +147,8 @@ public class SubscriberGroupedService( /// Object with properties to generate new grouped observations, clients using those /// grouped obsercations and the generated list of grouped observations /// + /// public List CheckEmptySubscriberGroup(WsSubscriberGrouped? wsSubscriberGrouped) { lock (_subscriberGrouped) @@ -179,6 +189,7 @@ public class SubscriberGroupedService( /// Uses locking to ensure that concurrent calls do not corrupt the subscriber list. /// /// The grouped WebSocket subscriber instance to be added to the collection. + /// public void AddSubscriberGrouped(WsSubscriberGrouped wsSubscriberGrouped) { lock (_subscriberGrouped) @@ -195,6 +206,7 @@ public class SubscriberGroupedService( /// The optional time zone identifier applied to the new subscription when one is created. /// The unique identifier of the client connection being registered. /// The most recent observation in the group, used to initialize a new subscription. + /// public void CheckOnSubscriptionGroup(GroupedField groupedField, ObjectId patientId, string? timeZoneId, string connectionId, GroupedObservation lastObsInGroup) { @@ -235,6 +247,7 @@ public class SubscriberGroupedService( /// /// The hash code used to identify the target subscriber group whose last grouped observation should be updated. /// The new to set as the last grouped observation in the matched group. + /// public void UpdateLastGroupedObsInGroup(string wsgHashCode, GroupedObservation newGroupedObservation) { lock (_subscriberGrouped) @@ -247,6 +260,7 @@ public class SubscriberGroupedService( /// Creates the next empty grouped observation for the supplied WebSocket subscriber group and distributes it asynchronously to every subscriber in the group, applying the subscriber-specific group value resolved from the group mapping. /// /// The grouped WebSocket subscriber context whose next empty observation is generated and whose subscribers will receive the notification. + /// private async Task AddEmptyObs(WsSubscriberGrouped ws) { var gobs = await groupedObservationService.CreateNextEmptyObs(ws); diff --git a/adas-core.Application/Subscriptions/WsSubscriberGrouped.cs b/adas-core.Application/Subscriptions/WsSubscriberGrouped.cs index 48e4ca67..95763f6c 100644 --- a/adas-core.Application/Subscriptions/WsSubscriberGrouped.cs +++ b/adas-core.Application/Subscriptions/WsSubscriberGrouped.cs @@ -16,6 +16,7 @@ namespace adas_core.Application.Subscriptions; /// /// Represents a grouped WebSocket subscriber that aggregates and manages multiple related subscription registrations. /// +/// public class WsSubscriberGrouped { private readonly EventHandler _sendEvent; @@ -30,6 +31,8 @@ public class WsSubscriberGrouped /// The most recent passed to to initialize the last-observation state. /// The invoked by the timer to forward outgoing messages to the subscriber. /// + /// public WsSubscriberGrouped(ObjectId patientId, string wsId, string? timeZoneId, GroupedField gf, GroupedObservation lastGroupedObservationObs, EventHandler sendEvent) { @@ -74,6 +77,7 @@ public class WsSubscriberGrouped /// Refreshes the cached last observations by matching each known name against the supplied grouped observation, falling back to the most recent observation when no match is found. /// /// The source grouped observation whose observations are searched to populate the last-observation cache. + /// public void UpdateLastGo(GroupedObservation lastGroupedObservationObs) { LastGroupedObservationObs.Clear(); @@ -150,6 +154,7 @@ public class WsSubscriberGrouped /// /// Restarts the timer by recalculating its interval through SetUpTimerInterval and then starting it. /// + /// private void TimerReestart() { Timer.Interval = SetUpTimerInterval(); @@ -160,6 +165,7 @@ public class WsSubscriberGrouped /// Calculates the timer interval in milliseconds until the next scheduled occurrence based on the configured , supporting Second, Minute, Day, and a default (Hour) case, and adds a per-regularity grace time. /// /// The number of milliseconds to wait until the next interval, including the grace time. + /// private int SetUpTimerInterval() { var currentDateTime = DateTime.Now; @@ -230,6 +236,7 @@ public class WsSubscriberGrouped /// /// Provides static extension methods to enhance WebSocket subscriber functionality. /// +/// public static class WsSubscriberExtension { /// @@ -239,6 +246,7 @@ public static class WsSubscriberExtension /// The to compare against the source. /// The patient identifier to match against the source patient identifier. /// true if all compared properties are equal; otherwise, false. + /// public static bool Compare(this WsSubscriberGrouped source, GroupedField r, ObjectId patientId) { return r.Regularity == source.Regularity && @@ -256,6 +264,7 @@ public static class WsSubscriberExtension /// The target shift list to compare. /// The source shift list to compare against. /// true if both lists are null or if their sequence of strings is equal; otherwise, false. + /// private static bool CompareStringShiftList(List? shift, List? sourceShift) { if (shift != null && sourceShift != null) return sourceShift.SequenceEqual(shift); @@ -271,6 +280,7 @@ public static class WsSubscriberExtension /// The fallback candidate list of names to compare against when cannot be used. /// The source list of names being compared. /// true if is a sequence match for either or ; otherwise, false. + /// private static bool CompareNamesStringList(List names, List name, List sourceNames) { if (!CollectionsUtils.IsEmptyOrNull(names) && sourceNames.SequenceEqual(names)) return true; @@ -281,6 +291,8 @@ public static class WsSubscriberExtension /// Check if the incoming observation affect to the group and is new info or is irrelevant /// /// + /// public static bool IsNewObservationRelevantForGroup(this WsSubscriberGrouped group, PatientObservation obs) { double.TryParse(obs.Value.ToString(), out var pobsValue); diff --git a/adas-core.Application/Subscriptions/WsSuscriber.cs b/adas-core.Application/Subscriptions/WsSuscriber.cs index efb2e1ca..cfefe9fc 100644 --- a/adas-core.Application/Subscriptions/WsSuscriber.cs +++ b/adas-core.Application/Subscriptions/WsSuscriber.cs @@ -9,6 +9,7 @@ namespace adas_core.Application.Subscriptions; /// /// Represents a WebSocket subscriber identified by a unique string identifier. /// +/// public class WsSubscriber(string id) { public string? UserName; diff --git a/adas-core.Authentication/Attributes/AuthorizeRolesAttribute.cs b/adas-core.Authentication/Attributes/AuthorizeRolesAttribute.cs index d913fbd7..c9234905 100644 --- a/adas-core.Authentication/Attributes/AuthorizeRolesAttribute.cs +++ b/adas-core.Authentication/Attributes/AuthorizeRolesAttribute.cs @@ -13,6 +13,8 @@ namespace adas_core.Authentication.Attributes; /// Constrained by to , the attribute is configured at construction with the required . /// /// +/// [AttributeUsage(AttributeTargets.Method)] public class AuthorizeRolesAttribute(PermissionEnum.RolesType type) : Attribute, IAuthorizationFilter { @@ -22,6 +24,7 @@ public class AuthorizeRolesAttribute(PermissionEnum.RolesType type) : Attribute, /// and otherwise responds with a forbid result when no user role starts with the permission type value. /// /// The authorization filter context providing access to the HTTP context and where the authorization result is assigned. + /// public void OnAuthorization(AuthorizationFilterContext context) { var user = context.HttpContext.User; diff --git a/adas-core.Authentication/Attributes/AuthorizeUserByService.cs b/adas-core.Authentication/Attributes/AuthorizeUserByService.cs index 04664b46..2d326bb5 100644 --- a/adas-core.Authentication/Attributes/AuthorizeUserByService.cs +++ b/adas-core.Authentication/Attributes/AuthorizeUserByService.cs @@ -19,6 +19,7 @@ public class AuthorizePermissionsAttribute( /// Handles authorization by validating the presence of the Displayid request header and ensuring the authenticated user exists in the user service. If the header is missing or the user cannot be found, the request is short-circuited with a . /// /// The for the current request, providing access to the HTTP context, user identity, and the ability to set the action result. + /// public void OnAuthorization(AuthorizationFilterContext context) { var user = context.HttpContext.User; diff --git a/adas-core.Authentication/Attributes/PermissionAuthorizeAttribute.cs b/adas-core.Authentication/Attributes/PermissionAuthorizeAttribute.cs index 5e29aea2..69051b40 100644 --- a/adas-core.Authentication/Attributes/PermissionAuthorizeAttribute.cs +++ b/adas-core.Authentication/Attributes/PermissionAuthorizeAttribute.cs @@ -27,6 +27,7 @@ public class PermissionAuthorizeAttribute(string source, string? resourceIdHeade /// /// The for the current authorization request, providing access to the HTTP context, services, and the result to set when authorization fails. /// Thrown when the cannot be resolved from the request services. + /// public async Task OnAuthorizationAsync(AuthorizationFilterContext context) { // Obtener el servicio de permisos. diff --git a/adas-core.Authentication/AuthorityService.cs b/adas-core.Authentication/AuthorityService.cs index 0c48c208..aba0a20d 100644 --- a/adas-core.Authentication/AuthorityService.cs +++ b/adas-core.Authentication/AuthorityService.cs @@ -25,6 +25,7 @@ public class AuthorityService( /// /// The name of the role to associate with the authority. /// The unique identifier of the user for whom the authority is being created. + /// public void CreateNew(string roleName, ObjectId userId) { authorityRepository.CreateNewAuthority(roleName, userId); @@ -34,6 +35,7 @@ public class AuthorityService( /// Inserts a new into the authority repository and records an audit log entry for the operation using the current HTTP context user. /// /// The authorization entity to be inserted and tracked in the audit log. + /// public async Task InsertOne(Authorization authorization) { await authorityRepository.InsertOneAsync(authorization); @@ -44,6 +46,7 @@ public class AuthorityService( /// Updates an existing authorization record in the repository and records an audit log entry capturing the previous and updated states for the current user. /// /// The authorization entity containing the identifier of the record to update and its new values. + /// public async Task updateOne(Authorization authorization) { var oldAuth = await authorityRepository.GetById(authorization.Id); @@ -56,6 +59,7 @@ public class AuthorityService( /// /// /// A list of the user's authorities. + /// public Task> GetUserAuthorities(ObjectId userId) { return authorityRepository.GetUserAuthorities(userId); @@ -65,6 +69,7 @@ public class AuthorityService( /// Retrieves all available authorities from the underlying repository. /// /// A task that represents the asynchronous operation, containing a list of all records. + /// public Task> GetAllAuthorities() { return authorityRepository.GetAllAuthorities(); @@ -75,6 +80,7 @@ public class AuthorityService( /// /// The unique identifier of the user whose authorities should be deleted. /// true if the authorities were successfully deleted; otherwise, false. + /// public async Task DeleteAuthoritiesForUser(ObjectId id) { try @@ -99,6 +105,7 @@ public class AuthorityService( /// /// The authorization entity to be created and stored. /// The created entity. + /// public async Task CreateNewUserAuthority(Authorization authorization) { await authorityRepository.InsertOneAsync(authorization); @@ -112,6 +119,7 @@ public class AuthorityService( /// /// The parsed identifier of the user authority to delete. /// true if the user authority was successfully deleted; otherwise, false. + /// public async Task DeleteUserAuthority(ObjectId userAuthorityIdParsed) { try @@ -135,6 +143,7 @@ public class AuthorityService( /// /// The authorization entity containing the updated information to persist. /// The updated on success, or null if an error occurs during the operation. + /// public async Task EditUserAuthority(Authorization authorization) { try diff --git a/adas-core.Authentication/Interfaces/IAuthorityService.cs b/adas-core.Authentication/Interfaces/IAuthorityService.cs index e13afada..86d2617b 100644 --- a/adas-core.Authentication/Interfaces/IAuthorityService.cs +++ b/adas-core.Authentication/Interfaces/IAuthorityService.cs @@ -10,29 +10,34 @@ public interface IAuthorityService /// /// The unique identifier of the user whose authorizations are being requested. /// A task that represents the asynchronous operation, containing a list of objects for the user. + /// public Task> GetUserAuthorities(ObjectId userId); /// /// Creates a new role with the specified name and associates it with the given user. /// /// The name of the role to create. /// The identifier of the user to associate with the new role. + /// public void CreateNew(string roleName, ObjectId userId); /// /// Inserts a new authorization record into the data store. /// /// The authorization entity to insert. /// A task that represents the asynchronous insert operation. + /// public Task InsertOne(Authorization authorization); /// /// Updates a single authorization record. /// /// The authorization object containing the data to be updated. + /// public Task updateOne(Authorization authorization); /// /// Asynchronously retrieves all authorizations. /// /// A task that represents the asynchronous operation. The task result contains a list of all authorization objects. + /// public Task> GetAllAuthorities(); /// @@ -40,23 +45,27 @@ public interface IAuthorityService /// /// The unique identifier of the user whose authorities should be removed. /// A task that represents the asynchronous operation. The task result contains true if authorities were deleted; otherwise, false. + /// Task DeleteAuthoritiesForUser(ObjectId id); /// /// Creates a new user authority based on the provided . /// /// The authorization data used to create the new user authority. /// A task that represents the asynchronous operation. The task result contains the created , or null if the authority could not be created. + /// Task CreateNewUserAuthority(Authorization authorization); /// /// Asynchronously deletes a user authority identified by the provided parsed identifier. /// /// The parsed identifier of the user authority to delete. /// A task that represents the asynchronous delete operation. The task result is if the user authority was successfully deleted; otherwise, . + /// Task DeleteUserAuthority(ObjectId userAuthorityIdParsed); /// /// Edits the user authority using the provided authorization data. /// /// The authorization object containing the user authority details to be updated. /// A task that represents the asynchronous operation. The task result contains the updated , or null if the authorization was not found. + /// Task EditUserAuthority(Authorization authorization); } \ No newline at end of file diff --git a/adas-core.Authentication/Interfaces/ILoginService.cs b/adas-core.Authentication/Interfaces/ILoginService.cs index 309f00e2..a37f57bb 100644 --- a/adas-core.Authentication/Interfaces/ILoginService.cs +++ b/adas-core.Authentication/Interfaces/ILoginService.cs @@ -15,12 +15,14 @@ public interface ILoginService /// The username of the user attempting to log in. /// The password associated with the username. /// A representing the asynchronous operation, containing the authenticated . + /// Task Login(string username, string password); /// /// Authenticates a user based on the provided HTTP context. /// /// The HTTP context containing the request information used to perform the login. /// A task that represents the asynchronous login operation. The task result contains the authenticated . + /// Task Login(HttpContext context); /// @@ -29,29 +31,34 @@ public interface ILoginService /// The username of the user to authenticate. /// The password of the user to authenticate. /// A task that represents the asynchronous operation. The task result contains the authenticated . + /// Task Authenticate(string username, string password); /// /// Retrieves a user by their unique identifier, returning null if no matching user is found. /// /// The unique identifier of the user to look up. /// The user with the specified identifier, or null if no user is found. + /// Task GetById(ObjectId id); /// /// Retrieves a user from the data store by their email address, or returns null if no matching user is found. /// /// The email address used to look up the user. /// A task that resolves to the matching the provided email, or null if no user is found. + /// Task GetByEmail(string email); /// /// Retrieves a user by their username asynchronously, returning null if no matching user is found. /// /// The username to look up. /// A that resolves to the matching , or null if no user exists with the specified username. + /// Task GetByUsername(string username); /// /// Asynchronously retrieves a list of all users in the system. /// /// A task that represents the asynchronous operation, containing a list of all entities. + /// Task> GetAllUsers(); } \ No newline at end of file diff --git a/adas-core.Authentication/Interfaces/ITokenService.cs b/adas-core.Authentication/Interfaces/ITokenService.cs index 67b6ee32..f2ae8c97 100644 --- a/adas-core.Authentication/Interfaces/ITokenService.cs +++ b/adas-core.Authentication/Interfaces/ITokenService.cs @@ -13,12 +13,14 @@ public interface ITokenService /// The username used to look up the security token. /// The list of claims associated with the token. /// A if a matching token is found; otherwise, . + /// SecurityToken? GetToken(string username, List claims); /// /// Retrieves the current refresh token used to obtain new access tokens for authentication. /// /// The refresh token as a string. + /// string GetRefreshToken(); /// @@ -26,5 +28,6 @@ public interface ITokenService /// /// The security token to serialize. /// A string containing the serialized form of the security token. + /// string Serialize(SecurityToken token); } \ No newline at end of file diff --git a/adas-core.Authentication/Interfaces/IUserService.cs b/adas-core.Authentication/Interfaces/IUserService.cs index cdf547ba..0c991077 100644 --- a/adas-core.Authentication/Interfaces/IUserService.cs +++ b/adas-core.Authentication/Interfaces/IUserService.cs @@ -20,6 +20,7 @@ public interface IUserService /// The username of the user attempting to log in. /// The password associated with the specified username. /// A task that represents the asynchronous login operation, containing the with the authentication token information. + /// Task Login(string username, string password); /// /// Authenticates a user based on the provided username and password and returns the corresponding user. @@ -27,12 +28,14 @@ public interface IUserService /// The username of the user to authenticate. /// The password of the user to authenticate. /// A task that represents the asynchronous operation. The task result contains the authenticated . + /// Task GetUser(string username, string password); /// /// Refreshes an authentication token using the provided refresh token and returns the resulting token information. /// /// The refresh token used to obtain a new access token. /// A that represents the asynchronous operation, containing the with the refreshed token details. + /// Task RefreshToken(string refreshToken); /// @@ -40,6 +43,7 @@ public interface IUserService /// /// The access token used to authenticate the user. /// A task that represents the asynchronous login operation, containing the with the outcome of the authentication. + /// Task LoginWithAccessToken(string token); /// /// Validates the specified token according to its type and outputs the corresponding . @@ -47,6 +51,7 @@ public interface IUserService /// The token string to be validated. /// The type of the token, used to determine the appropriate validation strategy. /// When the method returns, contains the validated if validation succeeds. + /// void ValidateToken(string token, string tokenType, out SecurityToken securityToken); /// /// Retrieves the user associated with the provided JWT security token. @@ -54,6 +59,7 @@ public interface IUserService /// /// The JWT security token used to identify the user. May be null. /// A task that resolves to the associated with the token, or null if the token is invalid or no user matches. + /// Task GetUserByToken(JwtSecurityToken? jwtToken); /// /// Asynchronously retrieves a user by validating a CAS (Central Authentication Service) ticket against the specified service. @@ -61,41 +67,48 @@ public interface IUserService /// The service URL or identifier that the ticket was issued for and must be validated against. /// The CAS ticket string used to authenticate and identify the user. /// A task that represents the asynchronous operation. The task result contains the associated if the ticket is valid, or null if the user cannot be found. + /// Task GetUserByCasTicket(string service, string ticket); /// /// Asynchronously generates a JSON Web Token (JWT) for the specified user and returns the token result. /// /// The user for whom the JWT is being generated. /// A task that represents the asynchronous operation, containing the with the generated token details. + /// Task GenerateJwt(User user); /// /// Asynchronously retrieves all users from the data store. /// /// A task that represents the asynchronous operation. The task result contains a list of all entities. + /// Task> GetAll(); /// /// Asynchronously retrieves a user by their unique identifier, returning null when no user matches the provided id. /// /// The unique identifier of the user to look up. /// A task that resolves to the matching , or null if no user is found for the given id. + /// Task GetUserById(ObjectId id); /// /// Asynchronously retrieves a user by their unique username, returning null when no matching user is found. /// /// The username used to look up the user. /// A task that represents the asynchronous operation, containing the matching user if found; otherwise, null. + /// Task GetUserByUserName(string name); /// /// Asynchronously retrieves a user matching the specified name, returning null when no matching user is found. /// /// The name used to look up the user. /// A task that resolves to the matching , or null if no user with the given name exists. + /// Task GetUserByName(string name); /// /// Creates a user from the provided LDAP user entry. /// /// The LDAP user entry used to create the user. /// A task that represents the asynchronous create operation, containing the created or null. + /// Task CreateUser(User userEntryLdap); /// /// Creates a new user based on the provided user data, typically originating from an incoming request. @@ -103,6 +116,7 @@ public interface IUserService /// /// The user data to use for creating the new user. /// A task that represents the asynchronous operation. The result is the created , or if creation failed. + /// Task CreateNewUserByRequest(User user); /// @@ -110,6 +124,7 @@ public interface IUserService /// /// The data transfer object containing the information required to create the user and its authorities. /// A task that represents the asynchronous operation. The task result contains the created instance, or null if no user was created. + /// Task CreateNewUserWithAuthorities(CreateUserWithAuthDto createUserWithAuthDto); /// /// Updates an existing user along with the associated authorities, optionally updating the password. @@ -117,6 +132,7 @@ public interface IUserService /// The data transfer object containing the user information and authorities to update. /// A flag indicating whether the user's password should be updated as part of the operation. /// A task that represents the asynchronous operation, containing the updated or null if the user was not found. + /// Task UpdateUserWithAuthorities(UpdateUserWithAuthDto createUserWithAuthDto, bool updatePass); /// /// Updates a user's information based on the provided user data, with an option to include password updates. @@ -124,6 +140,7 @@ public interface IUserService /// The user entity containing the updated information to be persisted. /// A flag indicating whether the user's password should be updated during this operation. /// A task that returns the updated , or null if the user could not be found. + /// Task UpdateUsersByRequest(User user, bool updatePass); /// /// Updates the password for the user identified by the specified identifier, verifying the old password before applying the new one. @@ -132,41 +149,48 @@ public interface IUserService /// The user's current password, used to verify the request. /// The new password to set for the user. /// A task that represents the asynchronous operation. The task result is true if the password was updated successfully; otherwise, false. + /// Task UpdateUserPassword(ObjectId id, string oldPassword, string newPassword); /// /// Asynchronously deletes a user identified by the specified identifier. /// /// The unique identifier of the user to delete. /// A task that represents the asynchronous operation, containing a value indicating whether the user was successfully deleted. + /// Task DeleteUser(ObjectId id); /// /// Retrieves a paginated list of users based on the provided pagination filter configuration. /// /// The pagination filter that defines paging parameters such as page number and page size. /// A task that represents the asynchronous operation, containing the paginated response of entries. + /// Task> GetPaginatedUsers(PaginationFilter config); /// /// Asynchronously creates a new authority based on the provided authorization data. /// /// The authorization information used to create the new authority. /// A task that represents the asynchronous operation. The task result contains the created . + /// Task CreateNewAuthority(Authorization auth); /// /// Asynchronously deletes an authority identified by the specified identifier. /// /// The unique identifier of the authority to delete. /// A task that represents the asynchronous delete operation. The task result contains a boolean indicating whether the authority was successfully deleted. + /// Task DeleteAuthority(string id); /// /// Updates the authority information based on the provided authorization data. /// /// The authorization entity containing the authority details to be updated. /// A task that represents the asynchronous operation. The task result is true if the update was successful; otherwise, false. + /// Task UpdateAuthority(Authorization authorization); /// /// Authenticates the user using the provided access token and returns the resulting token information. /// /// The access token used to perform the login. /// A task that represents the asynchronous login operation, containing the token result. + /// Task LoginWithGivenAccessToken(string token); } \ No newline at end of file diff --git a/adas-core.Authentication/Models/LoginInfo.cs b/adas-core.Authentication/Models/LoginInfo.cs index d69be5be..f1f8c826 100644 --- a/adas-core.Authentication/Models/LoginInfo.cs +++ b/adas-core.Authentication/Models/LoginInfo.cs @@ -3,6 +3,7 @@ /// /// Represents a container for login-related information. /// +/// public class LoginInfo { public string Username { get; set; } = null!; diff --git a/adas-core.Authentication/Models/Token.cs b/adas-core.Authentication/Models/Token.cs index 7146f107..8b85dcc7 100644 --- a/adas-core.Authentication/Models/Token.cs +++ b/adas-core.Authentication/Models/Token.cs @@ -6,6 +6,7 @@ namespace adas_core.Authentication.Models; /// /// Represents the result of a token-related operation, encapsulating the outcome and any associated token data. /// +/// public class TokenResult { public string AccessToken { get; set; } = null!; @@ -18,6 +19,7 @@ public class TokenResult /// /// Represents a panel UI component responsible for displaying token-related results. /// +/// public class TokenResultPanel { public TokenResult TokenResult { get; set; } = null!; diff --git a/adas-core.Authentication/Models/UciResponse.cs b/adas-core.Authentication/Models/UciResponse.cs index ad41595b..40b111d3 100644 --- a/adas-core.Authentication/Models/UciResponse.cs +++ b/adas-core.Authentication/Models/UciResponse.cs @@ -4,6 +4,7 @@ /// Represents a generic response in the Universal Chess Interface (UCI) protocol, encapsulating a payload of type . /// /// The type of the response payload. +/// public class UciResponse { /// @@ -40,6 +41,7 @@ public class UciResponse /// /// The entity to include in the response payload. /// A containing the provided entity. + /// public static UciResponse FromSuccess(T entity) { return new UciResponse(entity); @@ -51,6 +53,7 @@ public class UciResponse /// /// The exception whose type name and message are used to populate the error response. /// A containing the cleaned exception type name and the exception message as the error details. + /// public static UciResponse FromError(Exception ex) { var error = ex.GetType().Name; @@ -65,6 +68,7 @@ public class UciResponse /// The error code or identifier describing the failure. /// An optional human-readable message providing additional context about the error. /// A with Success set to false, the specified , and the optional . + /// public static UciResponse FromError(string error, string? message = null) { return new UciResponse diff --git a/adas-core.Authentication/RegistrationExtensions/AuthRegistration.cs b/adas-core.Authentication/RegistrationExtensions/AuthRegistration.cs index 3e7d79e6..b9cf84d3 100644 --- a/adas-core.Authentication/RegistrationExtensions/AuthRegistration.cs +++ b/adas-core.Authentication/RegistrationExtensions/AuthRegistration.cs @@ -9,12 +9,14 @@ namespace adas_core.Authentication.RegistrationExtensions; /// /// This static class serves as a container for registration-related authentication operations. /// +/// public static class AuthRegistration { /// /// Registers authentication-related services in the dependency injection container, including a singleton and a lazy wrapper for deferred resolution. /// /// The service collection to which the authentication services are added. + /// public static void AddAuth(this IServiceCollection serviceCollection) { serviceCollection.AddSingleton(); diff --git a/adas-core.Authentication/UserService.cs b/adas-core.Authentication/UserService.cs index 64ae17ae..9f91c7da 100644 --- a/adas-core.Authentication/UserService.cs +++ b/adas-core.Authentication/UserService.cs @@ -31,6 +31,7 @@ namespace adas_core.Authentication; /// /// This class is the default service component responsible for handling user domain logic and delegating persistence or infrastructure concerns as required by the interface. /// +/// public class UserService : IUserService { private readonly ILocalAuditService _auditService; @@ -109,6 +110,7 @@ public class UserService : IUserService /// A containing the generated for the authenticated user. /// Thrown when no user matches the provided credentials, or when the user is not in the whitelist or valid groups. /// Thrown when the user account is disabled or currently locked. + /// public async Task Login(string username, string password) { var user = await GetUser(username, password); @@ -134,6 +136,7 @@ public class UserService : IUserService /// The type of the token being validated. /// When the method returns, contains the validated if validation succeeds. /// Thrown when the token is invalid, is not signed with the HmacSha256 algorithm, or any other validation error occurs. + /// public void ValidateToken(string token, string tokenType, out SecurityToken validatedToken) { try @@ -176,6 +179,8 @@ public class UserService : IUserService /// The containing the user identity claims, or to indicate no token was supplied. /// A that resolves to the matching with its password cleared and authorization loaded if required, or when the token is missing or no user matches the extracted username. /// + /// public async Task GetUserByToken(JwtSecurityToken? jwtToken) { User? user = null; @@ -204,6 +209,8 @@ public class UserService : IUserService /// Thrown when the CAS login method is not available, or when an unexpected error occurs during authentication. /// Thrown when the authenticated user is not in the users whitelist and does not belong to any valid group. /// Rethrown when a business-level error occurs during the login process. + /// public async Task GetUserByCasTicket(string serviceUrl, string ticket) { var service = _availableLoginServices.FirstOrDefault(s => s.Method == UserEnum.LoginMethod.Cas); @@ -250,6 +257,7 @@ public class UserService : IUserService /// /// The refresh token used to generate a new JWT. /// A TokenResult containing the new JWT, or an empty result if the user associated with the token is not found. + /// public async Task RefreshToken(string refreshToken) { ValidateToken(refreshToken, IUserService.TokenTypeRefresh, out var validatedToken); @@ -269,6 +277,7 @@ public class UserService : IUserService /// The password to authenticate against. /// The authenticated returned by the first successful login service. /// Thrown when no configured login service successfully authenticates the user. + /// public async Task GetUser(string username, string password) { //BusinessException? loginException = null; @@ -297,6 +306,7 @@ public class UserService : IUserService /// /// The unique identifier of the user to retrieve. /// A containing the user with its authorization populated, or null if the user cannot be found or an exception is thrown during retrieval. + /// public async Task GetUserById(ObjectId id) { try @@ -316,6 +326,7 @@ public class UserService : IUserService /// /// The username to look up. /// The matching with its Authorization property populated from the authority service, or null if no user is found. + /// public async Task GetUserByUserName(string name) { var u = await _userRepository.GetByUserName(name); @@ -330,6 +341,7 @@ public class UserService : IUserService /// /// The name of the user to look up. /// A instance with its Authorization populated when found; otherwise, null. + /// public async Task GetUserByName(string name) { try @@ -349,6 +361,7 @@ public class UserService : IUserService /// /// The user information sourced from LDAP to be created in the system. /// The created user retrieved by username, or null if the user cannot be found after insertion. + /// public async Task CreateUser(User userEntryLdap) { CheckIfUserNameExists(userEntryLdap.UserName); @@ -366,6 +379,7 @@ public class UserService : IUserService /// The created user retrieved by username after insertion. /// Thrown when a local user's password is not considered strong. /// Thrown when the user cannot be retrieved by username after insertion. + /// public async Task CreateNewUserByRequest(User user) { CheckIfEmailExists(user.Email); @@ -391,6 +405,7 @@ public class UserService : IUserService /// The data transfer object containing the user details and the list of authorizations to associate with the new user. /// The newly created user, or null if creation fails (in which case an exception is thrown instead). /// Thrown when the user cannot be created by the underlying request, indicating a missing resource. + /// public async Task CreateNewUserWithAuthorities(CreateUserWithAuthDto createUserWithAuthDto) { var user = createUserWithAuthDto.User; @@ -413,6 +428,7 @@ public class UserService : IUserService /// Indicates whether the user's password should be updated and re-hashed. /// The updated user returned by the repository, or null if the user could not be found or updated. /// Thrown when is true and the provided password does not meet the strong password policy. + /// public async Task UpdateUsersByRequest(User user, bool updatePass) { var oldUser = await _userRepository.GetByUserName(user.UserName); @@ -443,6 +459,8 @@ public class UserService : IUserService /// The element that has been updated and should be transmitted to the subscribers. /// The user name used to filter the subscribers that will receive the broadcast. /// The type of operation (e.g., create, update, delete) associated with the broadcast. + /// private async Task SendBroadcastUser(object elementUpdated, string userName, OperationType operation) { var subscribers = _subscribersService.GetSubscribers().Where(s => @@ -459,6 +477,7 @@ public class UserService : IUserService /// The updated element to send as the notification payload to non-admin subscribers. /// The username whose subscribers will receive the broadcast. /// The operation type that describes the nature of the update. + /// private async Task SendBroadcastPermissions(object elementUpdated, string userName, OperationType operation) { var subscribers = _subscribersService.GetSubscribers().Where(s => @@ -491,6 +510,7 @@ public class UserService : IUserService /// Flag indicating whether the user's password should be updated as part of the operation. /// The updated . /// Thrown when the underlying user update returns no result. + /// public async Task UpdateUserWithAuthorities(UpdateUserWithAuthDto updateUserWithAuthDto, bool updatePass) { var u = updateUserWithAuthDto.User; @@ -525,6 +545,7 @@ public class UserService : IUserService /// Thrown when is equal to . /// Thrown when no user exists for the supplied . /// Thrown when does not match the user's current password, or when does not satisfy the strength policy. + /// public async Task UpdateUserPassword(ObjectId id, string oldPassword, string newPassword) { if (oldPassword == newPassword) @@ -561,6 +582,7 @@ public class UserService : IUserService /// /// The identifier of the user to delete. /// A task that resolves to true when the user is successfully deleted; otherwise, false if an error is encountered. + /// public async Task DeleteUser(ObjectId id) { try @@ -582,6 +604,7 @@ public class UserService : IUserService /// /// The pagination filter containing the page number and page size used to skip, limit, and shape the result set. /// A task that represents the asynchronous operation. The task result contains a with the requested page of users and pagination details. + /// public async Task> GetPaginatedUsers(PaginationFilter filter) { var result = _userRepository.GetPaginatedUsers(filter); @@ -603,6 +626,7 @@ public class UserService : IUserService /// /// The user whose identity, email, IP address, and authorization claims will be embedded in the generated tokens. /// A containing the serialized access and refresh tokens, their respective expiration times, and the associated user. + /// public async Task GenerateJwt(User user) { var claims = new List @@ -650,6 +674,7 @@ public class UserService : IUserService /// A task that resolves to the list of objects returned by the first successful login service. /// Thrown when a non-business exception occurs while retrieving users from a service. /// Thrown when no login service matches the valid login methods or all attempts fail without a captured business exception. + /// public async Task> GetAll() { BusinessException? loginException = null; @@ -688,6 +713,7 @@ public class UserService : IUserService /// The access token to validate and use for user authentication. /// A containing the new access token, refresh token, their expiry times, and the authenticated user. /// Thrown when no user can be resolved from the provided token. + /// public async Task LoginWithGivenAccessToken(string token) { ValidateToken(token, IUserService.TokenTypeUser, out var validatedToken); @@ -742,6 +768,7 @@ public class UserService : IUserService /// The access token used to identify and authenticate the user. /// A containing the generated JWT for the authenticated user. /// Thrown when no user is found that matches the validated access token. + /// public async Task LoginWithAccessToken(string token) { ValidateToken(token, IUserService.TokenTypeUser, out var validatedToken); @@ -759,6 +786,7 @@ public class UserService : IUserService /// The authorization used to create the new user authority. /// The newly created instance. /// Thrown when the authority service fails to create the user authority (returns null). + /// public async Task CreateNewAuthority(Authorization auth) { var newUserAuthority = await _authorityService.CreateNewUserAuthority(auth) ?? @@ -773,6 +801,7 @@ public class UserService : IUserService /// A task that resolves to true when the authority is successfully deleted. /// Thrown when the provided is not a valid ObjectId format. /// Thrown when the underlying delete operation fails. + /// public async Task DeleteAuthority(string id) { if (!ObjectId.TryParse(id, out var userAuthorityIdParsed)) @@ -788,6 +817,7 @@ public class UserService : IUserService /// The authorization details used to update the user's authority. /// A task that resolves to true when the authority is successfully updated. /// Thrown when the authority service returns a null response, indicating the update failed. + /// public async Task UpdateAuthority(Authorization authorization) { _ = await _authorityService.EditUserAuthority(authorization) ?? @@ -801,6 +831,7 @@ public class UserService : IUserService /// /// The list of authorizations to convert into claims. /// A task that represents the asynchronous operation, containing the list of claims built from the supplied authorities. + /// public async Task> ClaimsFromAuthorities(List authorities) { var claims = new List(); @@ -828,6 +859,7 @@ public class UserService : IUserService /// /// The authorization source whose role and display identifier are used to build the claim value. /// The list of claims to which the new role claim is appended when not already present. + /// private static void AddClaim(Authorization auth, List claims) { var newClaim = new Claim(ClaimTypes.Role, @@ -844,6 +876,7 @@ public class UserService : IUserService /// The username to validate against existing users. /// Optional identifier of the user being updated; when provided, that user is excluded from the duplicate check. /// Thrown when another user with the same already exists. + /// private void CheckIfUserNameExists(string userName, ObjectId? userId = null) { var users = GetAll().Result; @@ -860,6 +893,7 @@ public class UserService : IUserService /// The email address to verify for uniqueness in the user collection. /// The optional ID of the current user; when set, it is excluded from the duplicate email check. /// Thrown when the email is already registered to a different user. + /// private void CheckIfEmailExists(string email, ObjectId? userId = null) { var users = GetAll().Result; diff --git a/adas-core.Domain/Enums/ActionsEnum.cs b/adas-core.Domain/Enums/ActionsEnum.cs index 7c9c1a85..336c4e67 100644 --- a/adas-core.Domain/Enums/ActionsEnum.cs +++ b/adas-core.Domain/Enums/ActionsEnum.cs @@ -3,6 +3,7 @@ /// /// Provides a static container for defining and accessing available action definitions or constants. /// +/// public static class ActionsEnum { public enum Actions diff --git a/adas-core.Domain/Enums/AlarmEnum.cs b/adas-core.Domain/Enums/AlarmEnum.cs index a1e884e5..32338989 100644 --- a/adas-core.Domain/Enums/AlarmEnum.cs +++ b/adas-core.Domain/Enums/AlarmEnum.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Enums; /// /// This class is declared as static and cannot be instantiated; all members are accessed via the type name. /// +/// public static class AlarmEnum { public enum AudioAlarmType diff --git a/adas-core.Domain/Enums/CacheEnum.cs b/adas-core.Domain/Enums/CacheEnum.cs index 9d006942..998e6f84 100644 --- a/adas-core.Domain/Enums/CacheEnum.cs +++ b/adas-core.Domain/Enums/CacheEnum.cs @@ -3,6 +3,7 @@ /// /// Provides static utility methods for caching and managing enumeration values. /// +/// public static class CacheEnum { diff --git a/adas-core.Domain/Enums/DisplayConfigEnums.cs b/adas-core.Domain/Enums/DisplayConfigEnums.cs index fdab348d..703a2b2e 100644 --- a/adas-core.Domain/Enums/DisplayConfigEnums.cs +++ b/adas-core.Domain/Enums/DisplayConfigEnums.cs @@ -3,6 +3,7 @@ /// /// Provides a static collection of display-related configuration enumerations. /// +/// public static class DisplayConfigEnums { public enum AxisPosition diff --git a/adas-core.Domain/Enums/FileEnum.cs b/adas-core.Domain/Enums/FileEnum.cs index 6ff1311c..7efd75f9 100644 --- a/adas-core.Domain/Enums/FileEnum.cs +++ b/adas-core.Domain/Enums/FileEnum.cs @@ -6,6 +6,7 @@ /// /// This class serves as a container for static members related to file enumeration functionality. /// +/// public static class FileEnum { public enum AssetTheme diff --git a/adas-core.Domain/Enums/GroupedObservationEnum.cs b/adas-core.Domain/Enums/GroupedObservationEnum.cs index c10cdae4..be8b6bf6 100644 --- a/adas-core.Domain/Enums/GroupedObservationEnum.cs +++ b/adas-core.Domain/Enums/GroupedObservationEnum.cs @@ -6,6 +6,8 @@ /// /// This type is intended to provide a structured way to classify or organize observation values into distinct groups. /// +/// public class GroupedObservationEnum { public enum Regularity diff --git a/adas-core.Domain/Enums/HttpEnum.cs b/adas-core.Domain/Enums/HttpEnum.cs index 861b6ef7..b8861bec 100644 --- a/adas-core.Domain/Enums/HttpEnum.cs +++ b/adas-core.Domain/Enums/HttpEnum.cs @@ -3,6 +3,7 @@ /// /// Provides a static container for HTTP-related enumerations and associated helper members. /// +/// public static class HttpEnum { /// diff --git a/adas-core.Domain/Enums/MedicineEnum.cs b/adas-core.Domain/Enums/MedicineEnum.cs index 9a6253b7..f5156fca 100644 --- a/adas-core.Domain/Enums/MedicineEnum.cs +++ b/adas-core.Domain/Enums/MedicineEnum.cs @@ -3,6 +3,7 @@ /// /// Provides a static container for medicine-related enumeration values or constants. /// +/// public static class MedicineEnum { public enum Group diff --git a/adas-core.Domain/Enums/ObservationEnum.cs b/adas-core.Domain/Enums/ObservationEnum.cs index d26ece44..4bbe3ed8 100644 --- a/adas-core.Domain/Enums/ObservationEnum.cs +++ b/adas-core.Domain/Enums/ObservationEnum.cs @@ -3,6 +3,7 @@ /// /// Provides a static container for observation-related enumeration members. /// +/// public static class ObservationEnum { /** diff --git a/adas-core.Domain/Enums/PatientEnum.cs b/adas-core.Domain/Enums/PatientEnum.cs index 6d5480a0..6b252280 100644 --- a/adas-core.Domain/Enums/PatientEnum.cs +++ b/adas-core.Domain/Enums/PatientEnum.cs @@ -3,6 +3,7 @@ /// /// Provides a static container for patient-related enumeration values or constants used throughout the application. /// +/// public static class PatientEnum { public enum Gender diff --git a/adas-core.Domain/Enums/PermissionEnum.cs b/adas-core.Domain/Enums/PermissionEnum.cs index 081097ba..6af29eeb 100644 --- a/adas-core.Domain/Enums/PermissionEnum.cs +++ b/adas-core.Domain/Enums/PermissionEnum.cs @@ -3,6 +3,7 @@ /// /// Represents a set of permission values used to define access rights or authorization levels within the system. /// +/// public class PermissionEnum { public enum PermissionTypesEnum diff --git a/adas-core.Domain/Enums/PumpEnum.cs b/adas-core.Domain/Enums/PumpEnum.cs index b2d67e63..637e362e 100644 --- a/adas-core.Domain/Enums/PumpEnum.cs +++ b/adas-core.Domain/Enums/PumpEnum.cs @@ -4,6 +4,7 @@ /// Provides static utility members related to the Pump enumeration. /// /// This class cannot be instantiated and serves as a container for helpers associated with the Pump enum. +/// public static class PumpEnum { public enum PumpMessageType diff --git a/adas-core.Domain/Enums/RelayEnum.cs b/adas-core.Domain/Enums/RelayEnum.cs index ea78ec4f..7ee61c8f 100644 --- a/adas-core.Domain/Enums/RelayEnum.cs +++ b/adas-core.Domain/Enums/RelayEnum.cs @@ -3,6 +3,7 @@ /// /// Provides static utility methods for working with enum types, serving as a relay or helper layer for enum-related operations. /// +/// public static class RelayEnum { public enum Mode diff --git a/adas-core.Domain/Enums/StatusEnum.cs b/adas-core.Domain/Enums/StatusEnum.cs index ae9f120d..625084a3 100644 --- a/adas-core.Domain/Enums/StatusEnum.cs +++ b/adas-core.Domain/Enums/StatusEnum.cs @@ -6,6 +6,7 @@ /// /// This class is declared as static and cannot be instantiated. It is intended to group status values in a centralized, type-safe manner. /// +/// public static class StatusEnum { public enum Discharge diff --git a/adas-core.Domain/Enums/SubscriptionType.cs b/adas-core.Domain/Enums/SubscriptionType.cs index eb5fad91..9eb99215 100644 --- a/adas-core.Domain/Enums/SubscriptionType.cs +++ b/adas-core.Domain/Enums/SubscriptionType.cs @@ -3,6 +3,7 @@ /// /// Provides a static container for subscription-related enumeration values. /// +/// public static class SubscriptionEnum { public enum Type diff --git a/adas-core.Domain/Enums/UserEnum.cs b/adas-core.Domain/Enums/UserEnum.cs index f134715d..3267aaa3 100644 --- a/adas-core.Domain/Enums/UserEnum.cs +++ b/adas-core.Domain/Enums/UserEnum.cs @@ -3,6 +3,7 @@ /// /// Provides a static container for user-related enumeration values. /// +/// public static class UserEnum { public enum LoginMethod diff --git a/adas-core.Domain/Exceptions/AdasException.cs b/adas-core.Domain/Exceptions/AdasException.cs index e9a30141..d5e41db5 100644 --- a/adas-core.Domain/Exceptions/AdasException.cs +++ b/adas-core.Domain/Exceptions/AdasException.cs @@ -3,4 +3,5 @@ namespace adas_core.Domain.Exceptions; /// /// Represents an exception that is thrown when an error occurs within the ADAS (Advanced Driver Assistance Systems) module, providing a prefixed message for easier identification. /// +/// public class AdasException(string message) : Exception($"ADAS Exception: {message}"); \ No newline at end of file diff --git a/adas-core.Domain/Exceptions/BusinessException.cs b/adas-core.Domain/Exceptions/BusinessException.cs index ad53c291..2a6da586 100644 --- a/adas-core.Domain/Exceptions/BusinessException.cs +++ b/adas-core.Domain/Exceptions/BusinessException.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Exceptions; /// /// Represents an exception that aggregates one or more errors related to business logic or domain rule violations. /// +/// public class BusinessException : AggregateException { /// diff --git a/adas-core.Domain/Exceptions/LoginServicesException.cs b/adas-core.Domain/Exceptions/LoginServicesException.cs index 2ddb0a6a..30a7ea9c 100644 --- a/adas-core.Domain/Exceptions/LoginServicesException.cs +++ b/adas-core.Domain/Exceptions/LoginServicesException.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Exceptions; /// This exception extends to signal business-level failures /// specific to authentication and login operations. /// +/// public class LoginServicesException : BusinessException { /// diff --git a/adas-core.Domain/Exceptions/UserNotFoundException.cs b/adas-core.Domain/Exceptions/UserNotFoundException.cs index efe49475..348d4f5b 100644 --- a/adas-core.Domain/Exceptions/UserNotFoundException.cs +++ b/adas-core.Domain/Exceptions/UserNotFoundException.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Exceptions; /// /// Inherits from to signal user lookup failures within the business domain. /// +/// public class UserNotFoundException : BusinessException { /// diff --git a/adas-core.Domain/IDefaultRepository.cs b/adas-core.Domain/IDefaultRepository.cs index df7410cd..7bc5f295 100644 --- a/adas-core.Domain/IDefaultRepository.cs +++ b/adas-core.Domain/IDefaultRepository.cs @@ -10,17 +10,20 @@ public interface IDefaultRepository where T : class /// Returns the for entity type , enabling querying and persistence operations against the corresponding table. /// /// A instance for the entity type . + /// DbSet GetSet(); /// /// Gets an representing the queryable source of items, allowing callers to compose additional query operations. /// /// An that can be used to build and execute queries against the underlying data source. + /// IQueryable Query(); /// /// Returns a queryable collection of items, optionally applying the specified pagination filter to control paging behavior. /// /// The pagination filter that controls paging of the returned items, or null to omit pagination. /// An that can be used to enumerate the items with the applied filter. + /// IQueryable Query(PaginationFilter? filter); /// /// Returns a paginated queryable sequence of items based on the specified page and page size. @@ -28,6 +31,7 @@ public interface IDefaultRepository where T : class /// The current page number; when null, pagination may be ignored or handled accordingly. /// The number of items per page; when null, a default page size may be used. /// An representing the requested page of items. + /// IQueryable Query(int? currentPage, int? pageSize = null); /// @@ -36,6 +40,7 @@ public interface IDefaultRepository where T : class /// The identifier of the entity to look up. /// Expressions that specify related entities to include in the returned result. /// The entity matching the supplied identifier, or null if no entity is found. + /// T? GetById(TS id, params Expression>[] includeExpressions); /// @@ -45,6 +50,7 @@ public interface IDefaultRepository where T : class /// The identifier of type used to locate the entity. /// A customizer that controls how the underlying query is constructed and executed. /// The matching entity of type , or null if no entity with the given is found. + /// T? GetById(TS id, QueryCustomizer queryCustomizer); /*[Obsolete("Use GetById( id) instead")] @@ -57,55 +63,65 @@ public interface IDefaultRepository where T : class /// /// The values that compose the primary key of the entity to retrieve. /// The matching entity of type , or null if no entity is found. + /// T? GetByIds(params object[] keyValues); /// /// Creates a new instance of type T based on the specified source object. /// /// The source object used to create the new instance. /// A new instance of type T created from the specified object. + /// T Create(T obj); /// /// Creates a list of objects based on the provided collection of input items. /// /// The list of input objects to be created. /// A list of created objects of type . + /// List Create(List objs); /// /// Deletes the specified object from the underlying data source and returns the result. /// /// The object of type to be deleted. /// The object of type representing the result of the delete operation. + /// T Delete(T obj); /// /// Deletes the specified collection of objects. /// /// The collection of objects to delete. /// A list of the deleted objects. + /// List Delete(ICollection objs); /// /// Deletes all records or entries managed by the associated repository or service. /// + /// void DeleteAll(); /// /// Updates the specified entity in the underlying store and returns the updated instance. /// /// The entity instance containing the updated values to persist. /// The updated entity of type as returned by the operation. + /// T Update(T obj); /// /// Gets the total number of items in the collection. /// /// The total count of items. + /// int Count(); /// /// Returns the number of items that match the specified status. /// /// The status value used to filter the items being counted. /// The total count of items matching the specified status. + /// int Count(string status); /// /// Retrieves all entities of type and returns them as a list. /// /// A containing all entities of type ; an empty list if none are found. + /// List FindAll(); } \ No newline at end of file diff --git a/adas-core.Domain/Models/ADMPanelRequest.cs b/adas-core.Domain/Models/ADMPanelRequest.cs index 78801360..8fabeb09 100644 --- a/adas-core.Domain/Models/ADMPanelRequest.cs +++ b/adas-core.Domain/Models/ADMPanelRequest.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models; /// /// Represents a request payload for the administrative panel operations. /// +/// public class AdmPanelRequest { public string? Type { get; set; } @@ -69,6 +70,7 @@ public class AdmPanelRequest /// If serialization fails, falls back to the base implementation. /// /// A JSON-serialized string of the object, or the result of base.ToString() if serialization throws an exception. + /// public override string? ToString() { try diff --git a/adas-core.Domain/Models/APIRequest.cs b/adas-core.Domain/Models/APIRequest.cs index 9b47d9e9..dbae3235 100644 --- a/adas-core.Domain/Models/APIRequest.cs +++ b/adas-core.Domain/Models/APIRequest.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Models; /// /// Represents an API request, encapsulating the data and configuration needed to invoke a remote or web service endpoint. /// +/// public class ApiRequest { // SIU @@ -112,6 +113,7 @@ public class ApiRequest /// If serialization fails, falls back to the result of . /// /// A JSON string representation of the object, or the base result if serialization throws an exception. + /// public override string? ToString() { try diff --git a/adas-core.Domain/Models/AppSettings/ApiSettings.cs b/adas-core.Domain/Models/AppSettings/ApiSettings.cs index b8e62bec..309c5ec0 100644 --- a/adas-core.Domain/Models/AppSettings/ApiSettings.cs +++ b/adas-core.Domain/Models/AppSettings/ApiSettings.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.AppSettings; /// /// Represents configuration settings for an API, such as base URL, authentication credentials, and timeout values. /// +/// public class ApiSettings { public const string Api = "ApiSettings"; @@ -214,6 +215,7 @@ public class ApiSettings /// /// Represents archived data related to a nurse, providing storage or transfer of historical nursing records. /// +/// public class ArchiveNurseData { public bool Active { get; set; } = false; @@ -226,6 +228,7 @@ public class ArchiveNurseData /// /// Represents the configuration settings used to control the archiving process for nurse-related data. /// +/// public class ArchiveNurseDataConfig { public bool Active { get; set; } = false; @@ -235,6 +238,7 @@ public class ArchiveNurseDataConfig /// /// Represents a mapping configuration for point of care data, defining relationships between source and target structures. /// +/// public class PointOfCareMapping { public string? Key { get; set; } @@ -245,6 +249,7 @@ public class PointOfCareMapping /// /// Represents configuration settings that govern how observations are captured, processed, or reported. /// +/// public class ConfigObservationSettings { public bool IgnoreUnknownObservation { get; set; } @@ -257,6 +262,7 @@ public class ConfigObservationSettings /// /// Represents a collection or registry of intervention codes used to identify or categorize specific interventions. /// +/// public class InterventionsCodes { private object? _finalValue; @@ -387,6 +393,7 @@ public class InterventionsCodes /// /// Represents a collection or container of values related to interventions. /// +/// public class InterventionsValues { private object? _finalValue; @@ -500,6 +507,7 @@ public class InterventionsValues /// /// Represents a collection or configuration for mapping interventions, providing the means to associate intervention data with corresponding target structures or actions. /// +/// public class MappingInterventions { public string? Type { get; set; } diff --git a/adas-core.Domain/Models/AppSettings/AuthSettings.cs b/adas-core.Domain/Models/AppSettings/AuthSettings.cs index ae6e8a19..54ba6ce8 100644 --- a/adas-core.Domain/Models/AppSettings/AuthSettings.cs +++ b/adas-core.Domain/Models/AppSettings/AuthSettings.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.AppSettings; /// /// Represents a set of configuration settings used to control authentication behavior. /// +/// public class AuthSettings { public JwtConfig? JwtConfig { get; set; } @@ -18,6 +19,7 @@ public class AuthSettings /// /// This class derives from and inherits its configuration properties, allowing it to serve as a more specific or customized JWT configuration type. /// +/// public class JwtConfig : JwtExtConfig { public string? Issuer { get; set; } @@ -32,6 +34,7 @@ public class JwtConfig : JwtExtConfig /// /// Represents a configuration class for JWT (JSON Web Token) extension settings. /// +/// public class JwtExtConfig { public string? Key { get; set; } @@ -45,6 +48,7 @@ public class JwtExtConfig /// /// Inherits from a generic list of strings, exposing standard collection semantics for the whitelisted user entries. /// +/// public class UsersWhiteListConfig : List { /// @@ -52,6 +56,7 @@ public class UsersWhiteListConfig : List /// /// The user whose username will be checked against the collection. /// true if a matching username is found; otherwise, false. + /// public bool IsValid(User user) { return this.Any(username => username.ToLowerInvariant().Equals(user.UserName.ToLowerInvariant())); @@ -74,6 +79,10 @@ public class UsersWhiteListConfig : List /// Represents a group that has been validated as meeting the required criteria. /// /// +/// +/// Represents a group that has been validated, typically used as a wrapper or marker type to distinguish validated data from unvalidated input. +/// +/// public class ValidGroupsConfig : List { /// @@ -81,6 +90,7 @@ public class ValidGroupsConfig : List /// /// The user instance to validate. /// if is not null; otherwise, . + /// public bool IsValid(User? user) { return user != null; diff --git a/adas-core.Domain/Models/AppSettings/AutoRecordingSettings.cs b/adas-core.Domain/Models/AppSettings/AutoRecordingSettings.cs index 5b1ebce9..7ef82350 100644 --- a/adas-core.Domain/Models/AppSettings/AutoRecordingSettings.cs +++ b/adas-core.Domain/Models/AppSettings/AutoRecordingSettings.cs @@ -3,6 +3,7 @@ /// /// Represents the configuration settings for automatic recording functionality. /// +/// public class AutoRecordingSettings { public AutoStart? AutoStart { get; set; } @@ -13,6 +14,7 @@ public class AutoRecordingSettings /// /// Represents functionality related to automatic startup of a process or service. /// +/// public class AutoStart { public int BlueCode { get; set; } @@ -23,6 +25,7 @@ public class AutoStart /// /// Represents an automatic stop mechanism that handles stopping operations or processes automatically. /// +/// public class AutoStop { public int BlueCode { get; set; } @@ -33,6 +36,7 @@ public class AutoStop /// /// Represents a condition or requirement that indicates an alert must be sent. /// +/// public class MustSendAlert { public bool BlueCode { get; set; } diff --git a/adas-core.Domain/Models/AppSettings/CacheSettings.cs b/adas-core.Domain/Models/AppSettings/CacheSettings.cs index 95587d98..bf499f6f 100644 --- a/adas-core.Domain/Models/AppSettings/CacheSettings.cs +++ b/adas-core.Domain/Models/AppSettings/CacheSettings.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.AppSettings; /// /// Represents configuration settings for a caching mechanism. /// +/// public class CacheSettings { @@ -46,6 +47,7 @@ public class CacheSettings /// Represents an in-memory implementation for managing application settings. /// Provides storage and retrieval of configuration values without persisting them to an external source. /// +/// public class InMemorySettings { public TtlSettings Ttl { get; set; } = new(); @@ -58,6 +60,7 @@ public class InMemorySettings /// /// Represents configuration settings related to Time-To-Live (TTL) behavior. /// +/// public class TtlSettings { public int? GlobalSeconds { get; set; } diff --git a/adas-core.Domain/Models/AppSettings/DatabaseSettings.cs b/adas-core.Domain/Models/AppSettings/DatabaseSettings.cs index bc8369e2..242181af 100644 --- a/adas-core.Domain/Models/AppSettings/DatabaseSettings.cs +++ b/adas-core.Domain/Models/AppSettings/DatabaseSettings.cs @@ -3,6 +3,7 @@ /// /// Represents a set of configuration settings used to establish and manage database connections. /// +/// public class DatabaseSettings { public const string Database = "DatabaseSettings"; diff --git a/adas-core.Domain/Models/AppSettings/ListSettings.cs b/adas-core.Domain/Models/AppSettings/ListSettings.cs index 675e32da..ae3b0ceb 100644 --- a/adas-core.Domain/Models/AppSettings/ListSettings.cs +++ b/adas-core.Domain/Models/AppSettings/ListSettings.cs @@ -3,6 +3,7 @@ /// /// Represents configuration or display settings for a list. /// +/// public class ListSettings { public ListSettingItem AltableOptionList { get; set; } = new() @@ -140,6 +141,7 @@ public class ListSettings /// /// Represents a single item within a list-based setting configuration. /// +/// public class ListSettingItem { public string? ManualObservationName { get; set; } diff --git a/adas-core.Domain/Models/AppSettings/PermissionSettings.cs b/adas-core.Domain/Models/AppSettings/PermissionSettings.cs index 225d81fa..b1766854 100644 --- a/adas-core.Domain/Models/AppSettings/PermissionSettings.cs +++ b/adas-core.Domain/Models/AppSettings/PermissionSettings.cs @@ -3,6 +3,7 @@ /// /// Represents the configuration settings related to permissions. /// +/// public class PermissionSettings { public SourcePermissions Admin { get; set; } = new( @@ -359,6 +360,7 @@ public class PanelPermissionTypes( /// /// This type captures granular action-level authorization flags, allowing the application to enforce and check individual user capabilities across supported operations. /// +/// public class UserActions(bool create, bool update, bool delete, bool read, bool execute) { public bool Create { get; set; } = create; diff --git a/adas-core.Domain/Models/AppSettings/RabbitMQSettings.cs b/adas-core.Domain/Models/AppSettings/RabbitMQSettings.cs index 94dd9db7..aca9302c 100644 --- a/adas-core.Domain/Models/AppSettings/RabbitMQSettings.cs +++ b/adas-core.Domain/Models/AppSettings/RabbitMQSettings.cs @@ -6,6 +6,7 @@ /// /// This class is intended to hold RabbitMQ-related configuration values, such as connection details and broker options, that can be bound from application configuration sources. /// +/// public class RabbitMqSettings { public string ConnectionString { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/AppSettings/RecordingSettings.cs b/adas-core.Domain/Models/AppSettings/RecordingSettings.cs index caf6c2d3..4b2976ad 100644 --- a/adas-core.Domain/Models/AppSettings/RecordingSettings.cs +++ b/adas-core.Domain/Models/AppSettings/RecordingSettings.cs @@ -3,6 +3,7 @@ /// /// Represents configuration settings used to control recording behavior. /// +/// public class RecordingSettings { public const string Recording = "RecordingSettings"; diff --git a/adas-core.Domain/Models/AppSettings/RedisSettings.cs b/adas-core.Domain/Models/AppSettings/RedisSettings.cs index 0fa40015..4173edea 100644 --- a/adas-core.Domain/Models/AppSettings/RedisSettings.cs +++ b/adas-core.Domain/Models/AppSettings/RedisSettings.cs @@ -10,6 +10,7 @@ namespace adas_core.Domain.Models.AppSettings /// - TTL global y por entidad /// - Generación de claves CacheKeys /// + /// public class RedisSettings { // Conexión y networking @@ -30,6 +31,7 @@ namespace adas_core.Domain.Models.AppSettings /// /// Represents a Redis server endpoint, typically used to encapsulate connection details such as host, port, and credentials required to connect to a Redis instance. /// + /// public class RedisEndpoint { public string Host { get; set; } = null!; @@ -42,6 +44,7 @@ namespace adas_core.Domain.Models.AppSettings /// /// Provides static cache key constants used throughout the application to ensure consistent key naming when storing and retrieving cached data. /// + /// public static class CacheKeys { // ----------------- Patients ----------------- @@ -50,6 +53,7 @@ namespace adas_core.Domain.Models.AppSettings /// /// The unique identifier of the patient to be included in the formatted string. /// A string in the format "patients:{patientId}" representing the patient resource key. + /// public static string Patient(string patientId) => $"patients:{patientId}"; @@ -59,6 +63,7 @@ namespace adas_core.Domain.Models.AppSettings /// /// The unique identifier of the config display to include in the key. /// A formatted key string in the form configDisplays:{id} suitable for lookup or caching. + /// public static string ConfigDisplay(string id) => $"configDisplays:{id}"; @@ -66,6 +71,7 @@ namespace adas_core.Domain.Models.AppSettings /// Returns the configuration key representing the "all displays" setting, typically used to request or identify the display configuration for all available displays. /// /// The string identifier "configDisplays:all" used to reference the all-displays configuration. + /// public static string ConfigDisplaysAll() => "configDisplays:all"; @@ -75,6 +81,7 @@ namespace adas_core.Domain.Models.AppSettings /// /// The observation identifier to include in the formatted result. /// A formatted string in the form "pumpObs:{obsId}". + /// public static string PumpObservation(string obsId) => $"pumpObs:{obsId}"; @@ -84,6 +91,7 @@ namespace adas_core.Domain.Models.AppSettings /// The unique identifier of the pump used in the composed key. /// The observation date whose year, month, and day are formatted into the key. /// A string in the form pumpObs:pump:{pumpId}:{yyyyMMdd} representing the daily pump observation key. + /// public static string PumpDaily(string pumpId, DateTime date) => $"pumpObs:pump:{pumpId}:{date:yyyyMMdd}"; @@ -93,6 +101,7 @@ namespace adas_core.Domain.Models.AppSettings /// /// The unique identifier of the appointment. /// A formatted string in the form "appointments:{apptId}". + /// public static string Appointment(string apptId) => $"appointments:{apptId}"; @@ -103,6 +112,7 @@ namespace adas_core.Domain.Models.AppSettings /// The unique identifier of the patient whose appointments are being addressed. /// The date for which the appointments are being requested. /// A formatted cache key string combining the patient identifier and the day in yyyyMMdd format. + /// public static string AppointmentsByPatientDay(string patientId, DateTime date) => $"appointments:patient:{patientId}:{date:yyyyMMdd}"; @@ -113,6 +123,7 @@ namespace adas_core.Domain.Models.AppSettings /// The identifier of the patient whose appointments are being queried. /// The date whose year and month determine the appointment period encoded in the key. /// A formatted string in the form appointments:patient:{patientId}:{yyyyMM} suitable for use as a cache key. + /// public static string AppointmentsByPatientMonth(string patientId, DateTime date) => $"appointments:patient:{patientId}:{date:yyyyMM}"; @@ -123,6 +134,7 @@ namespace adas_core.Domain.Models.AppSettings /// The unique identifier of the patient whose observations are being referenced. /// The optional field used to group the observations; may be null. /// A formatted string in the pattern "groupedObs:{groupedField}:patient:{patientId}". + /// public static string GroupedObservationsByPatient(string patientId, string? groupedField) => $"groupedObs:{groupedField}:patient:{patientId}"; @@ -133,6 +145,7 @@ namespace adas_core.Domain.Models.AppSettings /// The field name used to group the observations. /// The observation date, formatted as yyyyMMdd in the generated key. /// A cache key string in the format groupedObs:{groupedField}:patient:{patientId}:{yyyyMMdd}. + /// public static string GroupedObservationsByPatientDay(string patientId, string groupedField, DateTime date) => $"groupedObs:{groupedField}:patient:{patientId}:{date:yyyyMMdd}"; @@ -143,6 +156,7 @@ namespace adas_core.Domain.Models.AppSettings /// The observation field used as the grouping criterion. /// The date used to derive the month bucket (formatted as yyyyMM) for the cache key. /// A formatted cache key string in the form groupedObs:{groupedField}:patient:{patientId}:{yyyyMM}. + /// public static string GroupedObservationsByPatientMonth(string patientId, string groupedField, DateTime date) => $"groupedObs:{groupedField}:patient:{patientId}:{date:yyyyMM}"; @@ -153,6 +167,7 @@ namespace adas_core.Domain.Models.AppSettings /// The field used to group the observations. /// The maximum number of latest observations to include in the cache key. /// A formatted cache key string identifying the patient's latest grouped observations. + /// public static string GroupedObservationsLatest(string patientId, string groupedField, int take) => $"groupedObs:{groupedField}:patient:{patientId}:latest:{take}"; } diff --git a/adas-core.Domain/Models/BasePatientObservation.cs b/adas-core.Domain/Models/BasePatientObservation.cs index d3a23bb7..e56eabb4 100644 --- a/adas-core.Domain/Models/BasePatientObservation.cs +++ b/adas-core.Domain/Models/BasePatientObservation.cs @@ -11,6 +11,7 @@ namespace adas_core.Domain.Models; /// /// This type is intended to be subclassed by concrete converters that implement specific serialization and deserialization logic for patient observation types. /// +/// public class BasePatientObservation : JsonConverter { public ObjectId Id { get; set; } @@ -50,6 +51,7 @@ public class BasePatientObservation : JsonConverter /// Falls back to the base implementation if JSON serialization fails. /// /// A JSON-formatted string of the object, or the result of base.ToString() if serialization throws an exception; may be only if the underlying ToString() returns . + /// public string? ToJsonString() { try @@ -66,6 +68,7 @@ public class BasePatientObservation : JsonConverter /// Returns a string representation of the patient observation, including its identifier, patient identifier, timestamp, and conditionally included optional fields (such as system identifier, code, coding system, end time, name, and units) when they have values. Any child creation observations are also appended to the output. /// /// A formatted string that lists the patient observation properties prefixed with BasePatientObservation[ and suffixed with ]. + /// public override string ToString() { List items = @@ -90,6 +93,7 @@ public class BasePatientObservation : JsonConverter /// Converts the current object's properties into a list of formatted key-value strings, including core identifiers and timestamp, and conditionally appending optional fields only when they contain values. /// /// A list of strings where each entry is formatted as "key: value" representing the object's properties. + /// public List ToListString() { List items = @@ -111,6 +115,7 @@ public class BasePatientObservation : JsonConverter /// /// The type to evaluate for conversion support. /// true if is ; otherwise, false. + /// public override bool CanConvert(Type objectType) { return objectType == typeof(BasePatientObservation); @@ -122,6 +127,7 @@ public class BasePatientObservation : JsonConverter /// The to which the filtered JSON will be written. /// The object to serialize. If , nothing is written. /// The used during the conversion process. + /// public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (value == null) return; @@ -141,6 +147,8 @@ public class BasePatientObservation : JsonConverter /// The serializer instance performing the deserialization. /// An object instance built from the JSON data. /// Always thrown because the method has not been implemented. + /// public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { @@ -152,6 +160,7 @@ public class BasePatientObservation : JsonConverter /// Represents a parent data class that serves as a base container for shared data members and functionality. /// Provides a foundational structure intended to be inherited by more specific data classes. /// +/// public class ParentDataClass { public string? Code { get; set; } diff --git a/adas-core.Domain/Models/BasePatientObservationValue.cs b/adas-core.Domain/Models/BasePatientObservationValue.cs index cafcce14..498d3b31 100644 --- a/adas-core.Domain/Models/BasePatientObservationValue.cs +++ b/adas-core.Domain/Models/BasePatientObservationValue.cs @@ -3,6 +3,7 @@ /// /// Serves as an abstract base class for patient observation values, extending to provide common functionality for representing measured or recorded clinical data associated with a patient observation. /// +/// public abstract class BasePatientObservationValue : BasePatientObservation { public object Value { get; set; } = new(); diff --git a/adas-core.Domain/Models/BsonConverters/DictionaryBsonConverter.cs b/adas-core.Domain/Models/BsonConverters/DictionaryBsonConverter.cs index 4335cfb4..80cce926 100644 --- a/adas-core.Domain/Models/BsonConverters/DictionaryBsonConverter.cs +++ b/adas-core.Domain/Models/BsonConverters/DictionaryBsonConverter.cs @@ -17,6 +17,7 @@ namespace adas_core.Domain.Models.BsonConverters; /// Dictionary<string, object>, providing a focused implementation for /// BSON-based persistence and data interchange scenarios. /// +/// public class DictionaryBsonConverter : SerializerBase> { /// @@ -27,6 +28,7 @@ public class DictionaryBsonConverter : SerializerBase /// The BSON deserialization context providing the reader used to traverse the BSON payload. /// The BSON deserialization arguments carrying additional configuration for the deserialization process. /// A dictionary containing the deserialized key/value pairs extracted from the BSON document. + /// public override Dictionary Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) { @@ -136,6 +138,7 @@ public class DictionaryBsonConverter : SerializerBase /// The BSON serialization context that provides the writer used to emit the document. /// The BSON serialization arguments associated with the current operation. /// The dictionary whose entries are written as fields of the BSON document. + /// public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, Dictionary value) { @@ -163,6 +166,7 @@ public class DictionaryBsonConverter : SerializerBase /// true if the key-value pair was successfully serialized; otherwise, false. /// Thrown when a BSON array contains an element whose BSON type is not supported. /// Thrown when the default branch encounters a BSON value type that is not supported. + /// private static bool TrySerializeKeyValuePair(KeyValuePair item, IBsonWriter writer) { writer.WriteName(item.Key); diff --git a/adas-core.Domain/Models/BsonConverters/DictionaryConverter.cs b/adas-core.Domain/Models/BsonConverters/DictionaryConverter.cs index 73e3a87d..20a24a9b 100644 --- a/adas-core.Domain/Models/BsonConverters/DictionaryConverter.cs +++ b/adas-core.Domain/Models/BsonConverters/DictionaryConverter.cs @@ -10,6 +10,7 @@ namespace adas_core.Domain.Models.BsonConverters; /// /// Inherits from to provide custom conversion logic for dictionary-shaped data. /// +/// public class DictionaryConverter : JsonConverter { /// @@ -18,6 +19,7 @@ public class DictionaryConverter : JsonConverter /// /// The type to evaluate for converter compatibility. /// true if the type is of string and object; otherwise, false. + /// public override bool CanConvert(Type objectType) { return objectType == typeof(Dictionary); @@ -31,6 +33,7 @@ public class DictionaryConverter : JsonConverter /// The existing value of the object being read. /// The JSON serializer used to deserialize nested values. /// A dictionary containing the JSON properties mapped to their deserialized values. + /// public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { @@ -74,6 +77,7 @@ public class DictionaryConverter : JsonConverter /// The JSON writer that receives the serialized output. /// The dictionary to serialize; if null, nothing is written. /// The serializer used to convert each dictionary value into a JSON token. + /// public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (value == null) diff --git a/adas-core.Domain/Models/ChartValue.cs b/adas-core.Domain/Models/ChartValue.cs index 32eea332..5481aac5 100644 --- a/adas-core.Domain/Models/ChartValue.cs +++ b/adas-core.Domain/Models/ChartValue.cs @@ -4,6 +4,7 @@ /// Represents a value used in a chart, typically encapsulating a data point or measurement /// that can be plotted or rendered as part of a chart visualization. /// +/// public class ChartValue { public List Labels { get; set; } = []; diff --git a/adas-core.Domain/Models/ChatMessage.cs b/adas-core.Domain/Models/ChatMessage.cs index 69a98350..46c25d70 100644 --- a/adas-core.Domain/Models/ChatMessage.cs +++ b/adas-core.Domain/Models/ChatMessage.cs @@ -3,6 +3,7 @@ /// /// Represents a chat message, typically used to encapsulate the content and metadata exchanged in a chat conversation. /// +/// public class ChatMessage { public PatientLocation? LocationFrom { get; set; } diff --git a/adas-core.Domain/Models/Code.cs b/adas-core.Domain/Models/Code.cs index f8b2d9c7..4c146ae2 100644 --- a/adas-core.Domain/Models/Code.cs +++ b/adas-core.Domain/Models/Code.cs @@ -3,6 +3,7 @@ /// /// Represents a code entity, serving as a base type for code-related constructs. /// +/// public class Code { public string Identifier { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/CodeAction.cs b/adas-core.Domain/Models/CodeAction.cs index dd1bf499..cb19eb45 100644 --- a/adas-core.Domain/Models/CodeAction.cs +++ b/adas-core.Domain/Models/CodeAction.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models; /// /// Represents a code action that encapsulates an operation or transformation to be performed on code. /// +/// public class CodeAction { public ActionsEnum.ResourceAction Action { get; set; } @@ -16,6 +17,7 @@ public class CodeAction /// /// The list of code actions to apply. /// A with the applied changes, or null if no codes are produced. + /// public static List? Apply(List actions) { return Apply(null, actions); @@ -28,6 +30,7 @@ public class CodeAction /// The list of codes to modify. If null, an empty list is used as the starting point. /// The list of code actions to apply. If null, the source list is returned unchanged. /// The modified list of codes, or null if the list is empty after applying the actions. + /// public static List? Apply(List? source, List? actions) { source ??= []; diff --git a/adas-core.Domain/Models/CodeStatus.cs b/adas-core.Domain/Models/CodeStatus.cs index 1ba0d48a..2c772a26 100644 --- a/adas-core.Domain/Models/CodeStatus.cs +++ b/adas-core.Domain/Models/CodeStatus.cs @@ -3,6 +3,7 @@ /// /// Represents the status of a code-related operation or entity. /// +/// public class CodeStatus { public Code? Code { get; set; } diff --git a/adas-core.Domain/Models/DTO/AppointmentDto.cs b/adas-core.Domain/Models/DTO/AppointmentDto.cs index beb096f2..d1debbbd 100644 --- a/adas-core.Domain/Models/DTO/AppointmentDto.cs +++ b/adas-core.Domain/Models/DTO/AppointmentDto.cs @@ -3,6 +3,7 @@ /// /// Represents a data transfer object for transferring appointment information between application layers or services. /// +/// public class AppointmentDto { public string PatientNumber { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/DTO/AssetDto.cs b/adas-core.Domain/Models/DTO/AssetDto.cs index ee5a1c54..ece6812d 100644 --- a/adas-core.Domain/Models/DTO/AssetDto.cs +++ b/adas-core.Domain/Models/DTO/AssetDto.cs @@ -3,6 +3,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object for conveying asset information between application layers or services. /// +/// public class AssetDto { public string? Name { get; set; } diff --git a/adas-core.Domain/Models/DTO/ConfigObservationDto.cs b/adas-core.Domain/Models/DTO/ConfigObservationDto.cs index b3aedc52..0eb6103f 100644 --- a/adas-core.Domain/Models/DTO/ConfigObservationDto.cs +++ b/adas-core.Domain/Models/DTO/ConfigObservationDto.cs @@ -3,6 +3,7 @@ /// /// Represents a data transfer object used to convey configuration observation information between application layers. /// +/// public class ConfigObservationDto { public string Id { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/DTO/CreateUserWithAuthDto.cs b/adas-core.Domain/Models/DTO/CreateUserWithAuthDto.cs index 1af39faf..a53ad102 100644 --- a/adas-core.Domain/Models/DTO/CreateUserWithAuthDto.cs +++ b/adas-core.Domain/Models/DTO/CreateUserWithAuthDto.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object used to create a user along with authentication details. /// +/// public class CreateUserWithAuthDto { public User User { get; set; } = new(); diff --git a/adas-core.Domain/Models/DTO/DeviceDto.cs b/adas-core.Domain/Models/DTO/DeviceDto.cs index 26e376c7..fb0997af 100644 --- a/adas-core.Domain/Models/DTO/DeviceDto.cs +++ b/adas-core.Domain/Models/DTO/DeviceDto.cs @@ -7,6 +7,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object (DTO) used to encapsulate and transfer device-related information between application layers or services. /// +/// public class DeviceDto { public DeviceEvent? Event { get; set; } @@ -31,6 +32,7 @@ public class DeviceDto /// /// This class is intended to be used as a data carrier for device event notifications or processing. /// +/// public class DeviceEvent { public ClickType? ClickType { get; set; } diff --git a/adas-core.Domain/Models/DTO/DiagnosisDto.cs b/adas-core.Domain/Models/DTO/DiagnosisDto.cs index 846d3701..b33c54c5 100644 --- a/adas-core.Domain/Models/DTO/DiagnosisDto.cs +++ b/adas-core.Domain/Models/DTO/DiagnosisDto.cs @@ -3,6 +3,7 @@ /// /// Represents a data transfer object (DTO) for conveying diagnosis information between application layers or services. /// +/// public class DiagnosisDto { public string PatientNumber { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/DTO/Display/ColorConfigDto.cs b/adas-core.Domain/Models/DTO/Display/ColorConfigDto.cs index 2ac19125..11a266cd 100644 --- a/adas-core.Domain/Models/DTO/Display/ColorConfigDto.cs +++ b/adas-core.Domain/Models/DTO/Display/ColorConfigDto.cs @@ -3,6 +3,7 @@ namespace adas_core.Domain.Models.DTO.Display; /// /// Represents a data transfer object (DTO) that encapsulates color configuration settings for transferring color-related data between application layers or systems. /// +/// public class ColorConfigDto { public LevelColors? Level { get; set; } @@ -18,6 +19,7 @@ public class ColorConfigDto /// /// Represents configuration settings that define the visual appearance, such as colors, themes, or styling preferences. /// + /// public class AppearanceSettings { public string? TextColor { get; set; } @@ -36,6 +38,7 @@ public class ColorConfigDto /// /// This type is intended to encapsulate the visual color configuration associated with the numeric portion of a status box display. /// + /// public class StatusBoxNumberColors { public AppearanceSettings? Reserved { get; set; } @@ -50,6 +53,7 @@ public class ColorConfigDto /// /// Provides a centralized set of color values used throughout the therapy-related user interface or visual components. /// + /// public class TherapyColors { public AppearanceSettings? Default { get; set; } @@ -61,6 +65,7 @@ public class ColorConfigDto /// /// Provides a collection of color values intended for use in test scenarios. /// + /// public class TestColors { public AppearanceSettings? Default { get; set; } @@ -72,6 +77,7 @@ public class ColorConfigDto /// /// Represents a collection of color definitions used to visually represent procedures. /// + /// public class ProcedureColors { public AppearanceSettings? Default { get; set; } @@ -86,6 +92,7 @@ public class ColorConfigDto /// /// Used to centralize color definitions related to level display, allowing consistent theming across level-related UI elements. /// + /// public class LevelColors { public string? Level1 { get; set; } @@ -98,6 +105,7 @@ public class ColorConfigDto /// /// Represents a collection of predefined text color values or definitions for styling text output. /// + /// public class TextColors { public string? Normal { get; set; } @@ -110,6 +118,7 @@ public class ColorConfigDto /// /// Provides a set of predefined color values used for rendering arrows in charts or visualizations. /// + /// public class ArrowColors { public string? Normal { get; set; } @@ -121,6 +130,7 @@ public class ColorConfigDto /// /// Represents a collection or definition of colors used to visually style an indicator. /// + /// public class IndicatorColors { public string? Empty { get; set; } @@ -134,6 +144,7 @@ public class ColorConfigDto /// /// Represents a collection or definition of colors used for rendering graphs and chart elements. /// + /// public class GraphColors { public string? Normal { get; set; } diff --git a/adas-core.Domain/Models/DTO/Display/CreateDisplayConfigDto.cs b/adas-core.Domain/Models/DTO/Display/CreateDisplayConfigDto.cs index cc52bdcb..c398f99b 100644 --- a/adas-core.Domain/Models/DTO/Display/CreateDisplayConfigDto.cs +++ b/adas-core.Domain/Models/DTO/Display/CreateDisplayConfigDto.cs @@ -7,6 +7,7 @@ namespace adas_core.Domain.Models.DTO.Display; /// /// Represents a data transfer object used to create a new display configuration. /// +/// public class CreateDisplayConfigDto { public DisplayConfigEnums.DisplayType Type { get; set; } = @@ -20,6 +21,7 @@ public class CreateDisplayConfigDto /// /// Represents a data transfer object used to create a display configuration card. /// +/// public class CreateDisplayConfigCardDto { public CardConfig? CardConfig { get; set; } diff --git a/adas-core.Domain/Models/DTO/Display/DisplayConfigDto.cs b/adas-core.Domain/Models/DTO/Display/DisplayConfigDto.cs index fd048553..a2ad33f3 100644 --- a/adas-core.Domain/Models/DTO/Display/DisplayConfigDto.cs +++ b/adas-core.Domain/Models/DTO/Display/DisplayConfigDto.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.DTO.Display; /// /// Represents a data transfer object for display configuration settings. /// +/// public class DisplayConfigDto { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/DTO/Display/DisplayConfigLocationDto.cs b/adas-core.Domain/Models/DTO/Display/DisplayConfigLocationDto.cs index 5fbdc8e3..ec0b6b43 100644 --- a/adas-core.Domain/Models/DTO/Display/DisplayConfigLocationDto.cs +++ b/adas-core.Domain/Models/DTO/Display/DisplayConfigLocationDto.cs @@ -6,6 +6,7 @@ /// /// This DTO is used to transfer display configuration settings along with their associated location data between application layers. /// +/// public class DisplayConfigLocationDto { public string? DisplayName { get; set; } diff --git a/adas-core.Domain/Models/DTO/Display/DisplayConfigSummary.cs b/adas-core.Domain/Models/DTO/Display/DisplayConfigSummary.cs index bc6152c8..85322d00 100644 --- a/adas-core.Domain/Models/DTO/Display/DisplayConfigSummary.cs +++ b/adas-core.Domain/Models/DTO/Display/DisplayConfigSummary.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.DTO.Display; /// /// Represents a summary of display configuration settings, providing a consolidated view of display-related parameters. /// +/// public class DisplayConfigSummary { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/DTO/Display/DisplayMinimalDto.cs b/adas-core.Domain/Models/DTO/Display/DisplayMinimalDto.cs index 5e961c92..ebf6fc3a 100644 --- a/adas-core.Domain/Models/DTO/Display/DisplayMinimalDto.cs +++ b/adas-core.Domain/Models/DTO/Display/DisplayMinimalDto.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.DTO.Display; /// /// Represents a minimal data transfer object that encapsulates a subset of fields from a model for lightweight serialization or transfer. /// +/// public class DisplayMinimalDto(MongoModels.Display display) { public ObjectId Id { get; set; } = display.Id; diff --git a/adas-core.Domain/Models/DTO/Display/DisplayNurseDto.cs b/adas-core.Domain/Models/DTO/Display/DisplayNurseDto.cs index d79d2b26..5315f631 100644 --- a/adas-core.Domain/Models/DTO/Display/DisplayNurseDto.cs +++ b/adas-core.Domain/Models/DTO/Display/DisplayNurseDto.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.DTO.Display; /// /// Represents a data transfer object used for displaying nurse information, extending the base display configuration functionality provided by . /// +/// public class DisplayNurseDto : DisplayConfigDto { public List? HomeBanner { get; set; } diff --git a/adas-core.Domain/Models/DTO/Display/DisplayWithPermissionsDto.cs b/adas-core.Domain/Models/DTO/Display/DisplayWithPermissionsDto.cs index 71e3ca81..f975961c 100644 --- a/adas-core.Domain/Models/DTO/Display/DisplayWithPermissionsDto.cs +++ b/adas-core.Domain/Models/DTO/Display/DisplayWithPermissionsDto.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.DTO.Display; /// /// This DTO is intended for transferring presentation data together with the permissions required to view or interact with it. /// +/// public class DisplayWithPermissionsDto { public DisplayPermissionTypes? Permissions { get; set; } diff --git a/adas-core.Domain/Models/DTO/Display/MinimalDisplayListDto.cs b/adas-core.Domain/Models/DTO/Display/MinimalDisplayListDto.cs index 26832d37..1be3b4be 100644 --- a/adas-core.Domain/Models/DTO/Display/MinimalDisplayListDto.cs +++ b/adas-core.Domain/Models/DTO/Display/MinimalDisplayListDto.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.DTO.Display; /// /// Represents a data transfer object that provides a minimal representation of a display list for transfer between application layers. /// +/// public class MinimalDisplayListDto { public List DisplayNurse { get; set; } = []; diff --git a/adas-core.Domain/Models/DTO/Display/SmartDisplayDto.cs b/adas-core.Domain/Models/DTO/Display/SmartDisplayDto.cs index 6d02aa70..2be6a129 100644 --- a/adas-core.Domain/Models/DTO/Display/SmartDisplayDto.cs +++ b/adas-core.Domain/Models/DTO/Display/SmartDisplayDto.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.DTO.Display; /// /// Represents a data transfer object for a smart display configuration, extending the base display configuration with additional smart display properties. /// +/// public class SmartDisplayDto : DisplayConfigDto { public bool? HasCameras { get; set; } diff --git a/adas-core.Domain/Models/DTO/Display/UpdateDisplayConfigNameDto.cs b/adas-core.Domain/Models/DTO/Display/UpdateDisplayConfigNameDto.cs index 5ebf3647..1f1dd508 100644 --- a/adas-core.Domain/Models/DTO/Display/UpdateDisplayConfigNameDto.cs +++ b/adas-core.Domain/Models/DTO/Display/UpdateDisplayConfigNameDto.cs @@ -6,6 +6,7 @@ /// /// This DTO is intended to carry the necessary information to modify the name of an existing display configuration entity. /// +/// public class UpdateDisplayConfigNameDto { public string DisplayName { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/DTO/MasterListDto.cs b/adas-core.Domain/Models/DTO/MasterListDto.cs index 4b8919ff..6ffe1393 100644 --- a/adas-core.Domain/Models/DTO/MasterListDto.cs +++ b/adas-core.Domain/Models/DTO/MasterListDto.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object for a master list, used to transfer collection data between application layers. /// +/// public class MasterListDto { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/DTO/MasterListWithPaginatedOptionsDto.cs b/adas-core.Domain/Models/DTO/MasterListWithPaginatedOptionsDto.cs index aa454c19..fc153ee5 100644 --- a/adas-core.Domain/Models/DTO/MasterListWithPaginatedOptionsDto.cs +++ b/adas-core.Domain/Models/DTO/MasterListWithPaginatedOptionsDto.cs @@ -10,6 +10,7 @@ namespace adas_core.Domain.Models.DTO; /// /// This DTO packages a together with the configured pageSize and a list of entries for transport across application boundaries. /// +/// public class MasterListWithPaginatedOptionsDto(MasterList masterList, int pageSize, List units) { public ObjectId Id { get; set; } = masterList.Id; diff --git a/adas-core.Domain/Models/DTO/ObservationAlarmDto.cs b/adas-core.Domain/Models/DTO/ObservationAlarmDto.cs index 4648da8c..3eb9c18a 100644 --- a/adas-core.Domain/Models/DTO/ObservationAlarmDto.cs +++ b/adas-core.Domain/Models/DTO/ObservationAlarmDto.cs @@ -3,6 +3,7 @@ /// /// Represents a data transfer object for an observation alarm, used to encapsulate and transfer alarm-related information between application layers. /// +/// public class ObservationAlarmDto { public string? PatientNumber { get; set; } diff --git a/adas-core.Domain/Models/DTO/ObservationDto.cs b/adas-core.Domain/Models/DTO/ObservationDto.cs index 58f0ca74..8cf21938 100644 --- a/adas-core.Domain/Models/DTO/ObservationDto.cs +++ b/adas-core.Domain/Models/DTO/ObservationDto.cs @@ -3,6 +3,7 @@ /// /// Represents a data transfer object for an observation, used to transfer observation data between application layers or services. /// +/// public class ObservationDto { public string PatientNumber { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/DTO/PaginationPairDto.cs b/adas-core.Domain/Models/DTO/PaginationPairDto.cs index bf8601b1..2a463b56 100644 --- a/adas-core.Domain/Models/DTO/PaginationPairDto.cs +++ b/adas-core.Domain/Models/DTO/PaginationPairDto.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Typically used to convey paired pagination metadata, such as a page number together with a page size or total count, in request or response payloads. /// +/// public class PaginationPairDto { public PaginationFilter ListFilter { get; set; } = new(); diff --git a/adas-core.Domain/Models/DTO/PatientDto.cs b/adas-core.Domain/Models/DTO/PatientDto.cs index c2cba242..a17c182e 100644 --- a/adas-core.Domain/Models/DTO/PatientDto.cs +++ b/adas-core.Domain/Models/DTO/PatientDto.cs @@ -3,6 +3,7 @@ /// /// Represents a data transfer object used to encapsulate and transfer patient information between application layers or services. /// +/// public class PatientDto { public string PatientNumber { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/DTO/PocAndUnitDto.cs b/adas-core.Domain/Models/DTO/PocAndUnitDto.cs index 9dd0f19b..b3f67bc6 100644 --- a/adas-core.Domain/Models/DTO/PocAndUnitDto.cs +++ b/adas-core.Domain/Models/DTO/PocAndUnitDto.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object that encapsulates point of contact and unit information for transfer between application layers or systems. /// +/// public class PocAndUnitDto { public List PocList { get; set; } = []; @@ -13,6 +14,7 @@ public class PocAndUnitDto /// /// Represents a minimal data transfer object encapsulating point of consumption and unit information. /// +/// public class MinimalPocAndUnitDto { public string? PocName { get; set; } diff --git a/adas-core.Domain/Models/DTO/PointOfCareDto.cs b/adas-core.Domain/Models/DTO/PointOfCareDto.cs index 813833b9..2eb5836d 100644 --- a/adas-core.Domain/Models/DTO/PointOfCareDto.cs +++ b/adas-core.Domain/Models/DTO/PointOfCareDto.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object for point-of-care information, used to transfer point-of-care data between application layers or services. /// +/// public class PointOfCareDto { @@ -38,6 +39,7 @@ public class PointOfCareDto /// /// Represents a data transfer object (DTO) for point-of-care configuration settings, used to transfer configuration data between layers or systems. /// +/// public class PointOfCareConfigurationDto { public List BeaconList { get; set; } = []; diff --git a/adas-core.Domain/Models/DTO/PumpDto.cs b/adas-core.Domain/Models/DTO/PumpDto.cs index 6d687521..c33094f4 100644 --- a/adas-core.Domain/Models/DTO/PumpDto.cs +++ b/adas-core.Domain/Models/DTO/PumpDto.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object for conveying pump-related information between application layers. /// +/// public class PumpDto { public string PatientNumber { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/DTO/RecordingAlertDto.cs b/adas-core.Domain/Models/DTO/RecordingAlertDto.cs index d614284f..43afdbf8 100644 --- a/adas-core.Domain/Models/DTO/RecordingAlertDto.cs +++ b/adas-core.Domain/Models/DTO/RecordingAlertDto.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object used to convey information about a recording alert between application layers or services. /// +/// public class RecordingAlertDto { public string? PatientNumber { get; set; } diff --git a/adas-core.Domain/Models/DTO/TreatmentDto.cs b/adas-core.Domain/Models/DTO/TreatmentDto.cs index cc3f4114..1bff0afd 100644 --- a/adas-core.Domain/Models/DTO/TreatmentDto.cs +++ b/adas-core.Domain/Models/DTO/TreatmentDto.cs @@ -3,6 +3,7 @@ /// /// Represents a data transfer object for conveying treatment information between application layers. /// +/// public class TreatmentDto { public string PatientNumber { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/DTO/UnitInfoDto.cs b/adas-core.Domain/Models/DTO/UnitInfoDto.cs index 97b13b2c..eb27ec64 100644 --- a/adas-core.Domain/Models/DTO/UnitInfoDto.cs +++ b/adas-core.Domain/Models/DTO/UnitInfoDto.cs @@ -7,6 +7,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object that encapsulates information about a unit. /// +/// public class UnitInfoDto { /// diff --git a/adas-core.Domain/Models/DTO/UpdateListNameAndDescriptionDto.cs b/adas-core.Domain/Models/DTO/UpdateListNameAndDescriptionDto.cs index b458ee0d..a5e234dc 100644 --- a/adas-core.Domain/Models/DTO/UpdateListNameAndDescriptionDto.cs +++ b/adas-core.Domain/Models/DTO/UpdateListNameAndDescriptionDto.cs @@ -3,6 +3,7 @@ /// /// Represents a data transfer object used to update the name and description of a list. /// +/// public class UpdateListNameAndDescriptionDto { public string? Name { get; set; } diff --git a/adas-core.Domain/Models/DTO/UpdateMasterListDetailsDto.cs b/adas-core.Domain/Models/DTO/UpdateMasterListDetailsDto.cs index e4727201..3644d119 100644 --- a/adas-core.Domain/Models/DTO/UpdateMasterListDetailsDto.cs +++ b/adas-core.Domain/Models/DTO/UpdateMasterListDetailsDto.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object used to transfer updated master list details between application layers. /// +/// public class UpdateMasterListDetailsDto { public bool? CanAddElement { get; set; } diff --git a/adas-core.Domain/Models/DTO/UpdateObservationDto.cs b/adas-core.Domain/Models/DTO/UpdateObservationDto.cs index 202df1d7..bf6ce024 100644 --- a/adas-core.Domain/Models/DTO/UpdateObservationDto.cs +++ b/adas-core.Domain/Models/DTO/UpdateObservationDto.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object used to update an existing observation. /// +/// public class UpdateObservationDto { public ConfigObservation? OldConfigObservationItem { get; set; } diff --git a/adas-core.Domain/Models/DTO/UpdateOptionMasterListDto.cs b/adas-core.Domain/Models/DTO/UpdateOptionMasterListDto.cs index ee25a250..a818095a 100644 --- a/adas-core.Domain/Models/DTO/UpdateOptionMasterListDto.cs +++ b/adas-core.Domain/Models/DTO/UpdateOptionMasterListDto.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object used to update an option master list. /// +/// public class UpdateOptionMasterListDto { public OptionList? UpdatedOption { get; set; } diff --git a/adas-core.Domain/Models/DTO/UpdatePasswordDto.cs b/adas-core.Domain/Models/DTO/UpdatePasswordDto.cs index da9733e1..2966d6d3 100644 --- a/adas-core.Domain/Models/DTO/UpdatePasswordDto.cs +++ b/adas-core.Domain/Models/DTO/UpdatePasswordDto.cs @@ -3,6 +3,7 @@ /// /// Represents a data transfer object used to encapsulate the information required to update a user's password. /// +/// public class UpdatePasswordDto { public string OldPassword { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/DTO/UpdateUnitIdListDto.cs b/adas-core.Domain/Models/DTO/UpdateUnitIdListDto.cs index 5e55705b..26927497 100644 --- a/adas-core.Domain/Models/DTO/UpdateUnitIdListDto.cs +++ b/adas-core.Domain/Models/DTO/UpdateUnitIdListDto.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.DTO; /// /// Represents a data transfer object used to update a list of unit identifiers. /// +/// public class UpdateUnitIdListDto { public ObjectId UnitId { get; set; } @@ -16,6 +17,7 @@ public class UpdateUnitIdListDto /// Returns a string representation of the instance, including the formatted entries of its MasterListData collection. /// /// A string in the format UpdateUnitIdListDto[... containing the concatenated MasterListData values. + /// public override string ToString() { List items = []; @@ -30,6 +32,7 @@ public class UpdateUnitIdListDto /// /// Represents a data container for a master list, serving as a centralized collection of items used for reference or aggregation purposes. /// +/// public class MasterListData { public ObjectId? MasterListId { get; set; } @@ -40,6 +43,7 @@ public class MasterListData /// Handles null values for MasterListId and MasterListType by displaying them as "Null" and "null" respectively. /// /// A formatted string containing the identifier and type of the master list. + /// public override string ToString() { List items = diff --git a/adas-core.Domain/Models/DTO/UpdateUserWithAuthDto.cs b/adas-core.Domain/Models/DTO/UpdateUserWithAuthDto.cs index c2d3ee60..784880ac 100644 --- a/adas-core.Domain/Models/DTO/UpdateUserWithAuthDto.cs +++ b/adas-core.Domain/Models/DTO/UpdateUserWithAuthDto.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.DTO; /// /// This DTO is typically used to transfer user account and authentication information in update operations. /// +/// public class UpdateUserWithAuthDto { public User User { get; set; } = new(); diff --git a/adas-core.Domain/Models/Entity.cs b/adas-core.Domain/Models/Entity.cs index 2a2a3e92..9366326e 100644 --- a/adas-core.Domain/Models/Entity.cs +++ b/adas-core.Domain/Models/Entity.cs @@ -6,6 +6,7 @@ /// /// Serves as a foundational or domain-level type that can be extended or composed to model real-world concepts. /// +/// public class Entity { public string? EntityIdentifier { get; set; } diff --git a/adas-core.Domain/Models/Filter/FilterOptionListElement.cs b/adas-core.Domain/Models/Filter/FilterOptionListElement.cs index a3e683ed..933beb1e 100644 --- a/adas-core.Domain/Models/Filter/FilterOptionListElement.cs +++ b/adas-core.Domain/Models/Filter/FilterOptionListElement.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.Filter; /// /// Represents an individual element within a filter option list, encapsulating a selectable filter value and its associated metadata. /// +/// public class FilterOptionListElement { public string? OptionType { get; set; } diff --git a/adas-core.Domain/Models/Filter/FilteredRequest.cs b/adas-core.Domain/Models/Filter/FilteredRequest.cs index 67025e1e..a4ba3c70 100644 --- a/adas-core.Domain/Models/Filter/FilteredRequest.cs +++ b/adas-core.Domain/Models/Filter/FilteredRequest.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.Filter; /// /// This type serves as a container for request data that has been narrowed or constrained by a filtering process. /// +/// public class FilteredRequest { #region Common region diff --git a/adas-core.Domain/Models/Filter/PaginationFilter.cs b/adas-core.Domain/Models/Filter/PaginationFilter.cs index e9a95492..b7da8ded 100644 --- a/adas-core.Domain/Models/Filter/PaginationFilter.cs +++ b/adas-core.Domain/Models/Filter/PaginationFilter.cs @@ -32,6 +32,7 @@ public record PaginationFilter /// Determines whether the pagination state is considered empty by checking if both PageNumber and PageSize are less than or equal to zero. /// /// true if both PageNumber and PageSize are less than or equal to zero; otherwise, false. + /// public bool IsEmpty() { return PageNumber <= 0 && PageSize <= 0; @@ -41,6 +42,7 @@ public record PaginationFilter /// /// Provides static extension methods for working with pagination filter objects. /// +/// public static class PaginationFilterExtensions { /// @@ -49,6 +51,7 @@ public static class PaginationFilterExtensions /// The source to paginate. /// The pagination settings containing the page number and page size. If null or invalid, no pagination is applied. /// The paginated , or the original queryable when the filter is null or contains invalid values. + /// public static IQueryable ApplyPagination(this IQueryable queryable, PaginationFilter? filter) { var modifQueryable = queryable; diff --git a/adas-core.Domain/Models/GroupedObservation.cs b/adas-core.Domain/Models/GroupedObservation.cs index 2b46b8b6..2ccbed3b 100644 --- a/adas-core.Domain/Models/GroupedObservation.cs +++ b/adas-core.Domain/Models/GroupedObservation.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models; /// /// Represents an observation that belongs to or has been categorized within a logical group. /// +/// public class GroupedObservation { public ObjectId PatientId { get; set; } @@ -20,6 +21,7 @@ public class GroupedObservation /// Returns a string representation of the PatientObservation, including the patient's name and observations in a formatted output. /// /// A formatted string in the form "PatientObservation[name: ..., observations: ...]". + /// public override string ToString() { List items = @@ -33,6 +35,7 @@ public class GroupedObservation /// /// Represents a grouped collection of observations. /// + /// public class GroupedObservationObs { public string Name { get; set; } = string.Empty; @@ -71,6 +74,7 @@ public class GroupedObservation /// Returns a string representation of the GroupedObservationObs, including the name and any non-null statistical properties (first, last, min, max, average, sum, count, half-hour, min alert, max alert), along with the time, shift date, and optional shift. /// /// A formatted string in the form "GroupedObservationObs[name: ..., ...]" summarizing the object's relevant properties. + /// public override string ToString() { List items = [$"name: {Name}"]; @@ -96,6 +100,7 @@ public class GroupedObservation /// /// Represents an observed value within a grouped observation, pairing a value with an optional timestamp and status type. /// + /// public class GroupedObservationObsValue(object value, DateTime? time, StatusEnum.Type type = StatusEnum.Type.Ok) { public StatusEnum.Type Type { get; set; } = type; @@ -109,6 +114,7 @@ public class GroupedObservation /// Returns a formatted string representation of the object, including its value, time, and type/status fields. /// /// A string containing the value, time, and type of the object. + /// public override string ToString() { return $"value: {Value}, time: {Time}, status: {Type}"; diff --git a/adas-core.Domain/Models/GroupedObservations/Field.cs b/adas-core.Domain/Models/GroupedObservations/Field.cs index d371980d..db3aabe5 100644 --- a/adas-core.Domain/Models/GroupedObservations/Field.cs +++ b/adas-core.Domain/Models/GroupedObservations/Field.cs @@ -6,6 +6,7 @@ /// /// As a public class, it is accessible from any other code that can reference its containing namespace or assembly. /// +/// public class Field { public string? Name { get; set; } diff --git a/adas-core.Domain/Models/GroupedObservations/GroupedField.cs b/adas-core.Domain/Models/GroupedObservations/GroupedField.cs index fc39d8b1..13116b70 100644 --- a/adas-core.Domain/Models/GroupedObservations/GroupedField.cs +++ b/adas-core.Domain/Models/GroupedObservations/GroupedField.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.GroupedObservations; /// /// This type is intended to model fields that are organized together as part of a group, allowing related field metadata or behavior to be handled collectively. /// +/// public class GroupedField { /// @@ -76,6 +77,7 @@ public class GroupedField /// Retrieves the list of names stored in the current instance. /// /// A containing the names; returns the underlying field directly without copying or filtering. + /// public List GetNames() { return Names; @@ -87,6 +89,7 @@ public class GroupedField /// /// The object to compare with the current instance. /// true if the specified object is a with the same Group; otherwise, false. + /// public override bool Equals(object? obj) { return obj is GroupedField field && Group == field.Group; @@ -97,6 +100,7 @@ public class GroupedField /// This override ensures consistent hash-based behavior for equality comparisons and use in hash-based collections. /// /// An integer hash code derived from the object's key properties. + /// public override int GetHashCode() { return HashCode.Combine(Name, Group, Max, Regularity, Result); diff --git a/adas-core.Domain/Models/HistoricalLocations.cs b/adas-core.Domain/Models/HistoricalLocations.cs index 81d0abdb..ca8d03f6 100644 --- a/adas-core.Domain/Models/HistoricalLocations.cs +++ b/adas-core.Domain/Models/HistoricalLocations.cs @@ -6,6 +6,7 @@ /// /// Implements of to allow instances to be compared for value equality without relying on object identity. /// +/// public class HistoricalLocation : IEquatable { // Propiedades con get y set para que MongoDB pueda escribir en ellas @@ -16,6 +17,7 @@ public class HistoricalLocation : IEquatable /// /// Initializes a new instance of the class, which represents a historical record of a location. /// + /// public HistoricalLocation() { } // Tu constructor actual @@ -38,6 +40,7 @@ public class HistoricalLocation : IEquatable /// /// The other instance to compare with this one. /// true if both the admission time and patient location match; otherwise, false. + /// public bool Equals(HistoricalLocation? other) { if (other == null) return false; @@ -49,17 +52,20 @@ public class HistoricalLocation : IEquatable /// Determines whether this instance is considered empty by verifying that no admission time is set and that the patient location is either null or empty. /// /// when AdmTime has no value and PatientLocation is or empty; otherwise, . + /// public bool IsEmpty() => !AdmTime.HasValue && (PatientLocation == null || PatientLocation.IsEmpty()); /// /// Determines whether the instance is in a full state by verifying that an admission time has been set, a patient location is assigned, and the assigned location is not full or empty. /// /// true when has a value, is not null, and the location is not full or empty; otherwise, false. + /// public bool IsFull() => AdmTime.HasValue && PatientLocation != null && !PatientLocation.IsFullEmpty(); /// /// Returns a string representation of the HistoricalLocation, including the admission time and patient location. /// /// A formatted string with the values of AdmTime and PatientLocation. + /// public override string ToString() => $"HistoricalLocation[AdmTime: {AdmTime}, PatientLocation: {PatientLocation}]"; } \ No newline at end of file diff --git a/adas-core.Domain/Models/ManualRecording.cs b/adas-core.Domain/Models/ManualRecording.cs index 401a7085..2639648d 100644 --- a/adas-core.Domain/Models/ManualRecording.cs +++ b/adas-core.Domain/Models/ManualRecording.cs @@ -3,6 +3,7 @@ /// /// Represents a manual recording entity, typically used to capture or track recording operations initiated explicitly by a user or system. /// +/// public class ManualRecording { //[JsonProperty("patientId")] @@ -20,6 +21,7 @@ public class ManualRecording /// /// This class serves as a model or container for recording-related operations within the application. /// +/// public class MRecording { public DateTime? StartRecordingTime { get; set; } diff --git a/adas-core.Domain/Models/Masters/AccessControlList.cs b/adas-core.Domain/Models/Masters/AccessControlList.cs index 12d749c0..ce77f893 100644 --- a/adas-core.Domain/Models/Masters/AccessControlList.cs +++ b/adas-core.Domain/Models/Masters/AccessControlList.cs @@ -6,4 +6,5 @@ /// /// As a subclass of , it inherits the core list management capabilities while specializing them for access control scenarios. /// +/// public class AccessControlList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/AllergyList.cs b/adas-core.Domain/Models/Masters/AllergyList.cs index 8e2e7c5c..f27a087f 100644 --- a/adas-core.Domain/Models/Masters/AllergyList.cs +++ b/adas-core.Domain/Models/Masters/AllergyList.cs @@ -6,4 +6,5 @@ /// /// Provides a domain-specific list type dedicated to managing and organizing allergy records. /// +/// public class AllergyList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/AltableOptionList.cs b/adas-core.Domain/Models/Masters/AltableOptionList.cs index 473360d8..4b9d0185 100644 --- a/adas-core.Domain/Models/Masters/AltableOptionList.cs +++ b/adas-core.Domain/Models/Masters/AltableOptionList.cs @@ -3,4 +3,5 @@ /// /// Represents a list of alterable options, inheriting core list functionality from the base class. /// +/// public class AltableOptionList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/DestinationList.cs b/adas-core.Domain/Models/Masters/DestinationList.cs index 27f86c19..abd4b742 100644 --- a/adas-core.Domain/Models/Masters/DestinationList.cs +++ b/adas-core.Domain/Models/Masters/DestinationList.cs @@ -6,4 +6,5 @@ /// /// Serves as a concrete list type within the master list hierarchy, specifically tailored for destination-related collections. /// +/// public class DestinationList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/DiagnosisList.cs b/adas-core.Domain/Models/Masters/DiagnosisList.cs index 26731896..d770ed07 100644 --- a/adas-core.Domain/Models/Masters/DiagnosisList.cs +++ b/adas-core.Domain/Models/Masters/DiagnosisList.cs @@ -3,4 +3,5 @@ /// /// Represents a specialized list of diagnosis entries, extending the base functionality. /// +/// public class DiagnosisList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/DischargeStatusList.cs b/adas-core.Domain/Models/Masters/DischargeStatusList.cs index 3c8f22de..560db80b 100644 --- a/adas-core.Domain/Models/Masters/DischargeStatusList.cs +++ b/adas-core.Domain/Models/Masters/DischargeStatusList.cs @@ -3,4 +3,5 @@ /// /// Represents a typed master list of discharge statuses, deriving from the base class. /// +/// public class DischargeStatusList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/DoctorList.cs b/adas-core.Domain/Models/Masters/DoctorList.cs index d1ac809f..b70faca9 100644 --- a/adas-core.Domain/Models/Masters/DoctorList.cs +++ b/adas-core.Domain/Models/Masters/DoctorList.cs @@ -6,4 +6,5 @@ /// /// Serves as a specialized list type for doctor-related data, extending the shared behavior provided by . /// +/// public class DoctorList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/DoctorTypeList.cs b/adas-core.Domain/Models/Masters/DoctorTypeList.cs index 7b82e86e..8633c1b1 100644 --- a/adas-core.Domain/Models/Masters/DoctorTypeList.cs +++ b/adas-core.Domain/Models/Masters/DoctorTypeList.cs @@ -6,4 +6,5 @@ /// /// This class serves as a specialized collection that inherits the core list behavior from , tailored for managing doctor type entries. /// +/// public class DoctorTypeList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/GenericList.cs b/adas-core.Domain/Models/Masters/GenericList.cs index 1dba112d..2f1acd30 100644 --- a/adas-core.Domain/Models/Masters/GenericList.cs +++ b/adas-core.Domain/Models/Masters/GenericList.cs @@ -3,4 +3,5 @@ /// /// Represents a generic list type that derives from , extending the base master list functionality. /// +/// public class GenericList : MasterList; diff --git a/adas-core.Domain/Models/Masters/InsulationList.cs b/adas-core.Domain/Models/Masters/InsulationList.cs index 9d7702e6..e0c70266 100644 --- a/adas-core.Domain/Models/Masters/InsulationList.cs +++ b/adas-core.Domain/Models/Masters/InsulationList.cs @@ -4,4 +4,5 @@ /// Represents a specialized list that manages insulation-related entries within the system. /// Inherits from , providing a dedicated collection for organizing and handling insulation data. /// +/// public class InsulationList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/InternalDestinationList.cs b/adas-core.Domain/Models/Masters/InternalDestinationList.cs index 4127b378..0d169b66 100644 --- a/adas-core.Domain/Models/Masters/InternalDestinationList.cs +++ b/adas-core.Domain/Models/Masters/InternalDestinationList.cs @@ -6,4 +6,5 @@ /// /// This type specializes the behavior for internal destination handling within the containing system. /// +/// public class InternalDestinationList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/LanguageBarrierList.cs b/adas-core.Domain/Models/Masters/LanguageBarrierList.cs index 8f6c6305..bf5ea26e 100644 --- a/adas-core.Domain/Models/Masters/LanguageBarrierList.cs +++ b/adas-core.Domain/Models/Masters/LanguageBarrierList.cs @@ -6,4 +6,5 @@ /// /// Inherits from , extending its functionality for handling language barrier data. /// +/// public class LanguageBarrierList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/MasterList.cs b/adas-core.Domain/Models/Masters/MasterList.cs index 96fca9b8..a63a108b 100644 --- a/adas-core.Domain/Models/Masters/MasterList.cs +++ b/adas-core.Domain/Models/Masters/MasterList.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Models.Masters; /// /// This class provides a foundational structure for organizing and accessing a primary list of entries. /// +/// public class MasterList { public ObjectId Id { get; set; } @@ -99,6 +100,7 @@ public class MasterList /// /// This type is intended to encapsulate the metadata or structure associated with an option list, allowing consumers to access its detailed content in a structured manner. /// +/// public class OptionListDetails { public Element? OptionType { get; set; } @@ -114,6 +116,7 @@ public class OptionListDetails /// /// Represents a generic element within the system, serving as a foundational type that can be extended or composed to model domain-specific entities or structures. /// +/// public class Element { public string Title { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/Masters/MobilityOptionList.cs b/adas-core.Domain/Models/Masters/MobilityOptionList.cs index 8d6b979d..20690149 100644 --- a/adas-core.Domain/Models/Masters/MobilityOptionList.cs +++ b/adas-core.Domain/Models/Masters/MobilityOptionList.cs @@ -6,4 +6,5 @@ /// /// Inherits from , leveraging the base class's list management functionality specialized for mobility options. /// +/// public class MobilityOptionList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/OptionList.cs b/adas-core.Domain/Models/Masters/OptionList.cs index 3bc2c1d1..b061ec13 100644 --- a/adas-core.Domain/Models/Masters/OptionList.cs +++ b/adas-core.Domain/Models/Masters/OptionList.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.Masters; /// /// Represents a list that contains a collection of options. /// +/// public class OptionList { public ObjectId? Id { get; set; } @@ -27,6 +28,7 @@ public class OptionList /// The first to compare. /// The second to compare. /// true if all compared properties of both instances are equal; otherwise, false. + /// public bool AreEqual(OptionList a, OptionList b) { return a.OptionType == b.OptionType && @@ -48,6 +50,7 @@ public class OptionList /// The first to compare. /// The second to compare. /// true if both option lists match across OptionType, Name, IconDefault, IconCategory, IconColor, Color, BgColor, IsDefault, InitDate, and EndDate; otherwise, false. + /// public bool AreEqualExcludeDescription(OptionList a, OptionList b) { return a.OptionType == b.OptionType && @@ -66,6 +69,7 @@ public class OptionList /// /// Represents a locale, providing culture-specific or region-specific information such as language, country, or regional settings. /// +/// public class Locale { public LocaleItem? Es { get; set; } @@ -78,6 +82,7 @@ public class Locale /// /// Represents a single locale item, typically used to encapsulate locale-related data such as language or regional settings. /// +/// public class LocaleItem { public string? Name { get; set; } diff --git a/adas-core.Domain/Models/Masters/OriginList.cs b/adas-core.Domain/Models/Masters/OriginList.cs index c183fe24..bfff231c 100644 --- a/adas-core.Domain/Models/Masters/OriginList.cs +++ b/adas-core.Domain/Models/Masters/OriginList.cs @@ -6,4 +6,5 @@ /// /// This class specializes the base behavior for managing a collection of origin items. /// +/// public class OriginList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/PassiveSittingList.cs b/adas-core.Domain/Models/Masters/PassiveSittingList.cs index 0277e382..3566e6d3 100644 --- a/adas-core.Domain/Models/Masters/PassiveSittingList.cs +++ b/adas-core.Domain/Models/Masters/PassiveSittingList.cs @@ -3,4 +3,5 @@ namespace adas_core.Domain.Models.Masters; /// /// Represents a specialized master list containing passive sitting entries, inheriting from the base class. /// +/// public class PassiveSittingList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/PatientStatusList.cs b/adas-core.Domain/Models/Masters/PatientStatusList.cs index 8f1b814c..52411af1 100644 --- a/adas-core.Domain/Models/Masters/PatientStatusList.cs +++ b/adas-core.Domain/Models/Masters/PatientStatusList.cs @@ -4,4 +4,5 @@ /// Represents a master list of patient status entries, providing a centralized /// collection for managing and accessing patient status data. /// +/// public class PatientStatusList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/ProcedureList.cs b/adas-core.Domain/Models/Masters/ProcedureList.cs index 64121e7b..274b0e9e 100644 --- a/adas-core.Domain/Models/Masters/ProcedureList.cs +++ b/adas-core.Domain/Models/Masters/ProcedureList.cs @@ -4,4 +4,5 @@ /// Represents a list of procedures, inheriting from to provide procedure-specific list functionality. /// Serves as a specialized master list dedicated to managing procedure entries. /// +/// public class ProcedureList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/ServiceList.cs b/adas-core.Domain/Models/Masters/ServiceList.cs index 672f81db..97959776 100644 --- a/adas-core.Domain/Models/Masters/ServiceList.cs +++ b/adas-core.Domain/Models/Masters/ServiceList.cs @@ -3,4 +3,5 @@ /// /// Represents a specialized list that inherits from , intended to manage and organize service-related entries. /// +/// public class ServiceList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/TestList.cs b/adas-core.Domain/Models/Masters/TestList.cs index 45690a0d..0612166b 100644 --- a/adas-core.Domain/Models/Masters/TestList.cs +++ b/adas-core.Domain/Models/Masters/TestList.cs @@ -3,4 +3,5 @@ namespace adas_core.Domain.Models.Masters; /// /// Represents a test list that derives from the base class, providing specialized list behavior for testing scenarios. /// +/// public class TestList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/TherapeuticCeilingList.cs b/adas-core.Domain/Models/Masters/TherapeuticCeilingList.cs index 1cd1caed..c0286b79 100644 --- a/adas-core.Domain/Models/Masters/TherapeuticCeilingList.cs +++ b/adas-core.Domain/Models/Masters/TherapeuticCeilingList.cs @@ -6,4 +6,5 @@ /// /// Inherits from , leveraging the base list functionality to manage and organize therapeutic ceiling entries. /// +/// public class TherapeuticCeilingList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/TreatmentList.cs b/adas-core.Domain/Models/Masters/TreatmentList.cs index 7742954c..3ed35e00 100644 --- a/adas-core.Domain/Models/Masters/TreatmentList.cs +++ b/adas-core.Domain/Models/Masters/TreatmentList.cs @@ -6,4 +6,5 @@ /// /// Acts as a domain-specific collection type for organizing and managing treatments within the system. /// +/// public class TreatmentList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Masters/VisitOptionList.cs b/adas-core.Domain/Models/Masters/VisitOptionList.cs index 4c640db0..6057a8d8 100644 --- a/adas-core.Domain/Models/Masters/VisitOptionList.cs +++ b/adas-core.Domain/Models/Masters/VisitOptionList.cs @@ -3,4 +3,5 @@ /// /// Represents a list of visit options, inheriting from the base class. /// +/// public class VisitOptionList : MasterList; \ No newline at end of file diff --git a/adas-core.Domain/Models/Medicine.cs b/adas-core.Domain/Models/Medicine.cs index 9cc9aee9..74eac375 100644 --- a/adas-core.Domain/Models/Medicine.cs +++ b/adas-core.Domain/Models/Medicine.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models; /// /// Represents a medicine entity within the domain model. /// +/// public class Medicine { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/Admission.cs b/adas-core.Domain/Models/MongoModels/Admission.cs index 64d507e3..422146fd 100644 --- a/adas-core.Domain/Models/MongoModels/Admission.cs +++ b/adas-core.Domain/Models/MongoModels/Admission.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents an admission, typically encapsulating data and behavior related to the process of admitting an entity, such as a student or patient, into an institution or system. /// +/// public class Admission { public ObjectId Id { get; set; } @@ -36,6 +37,8 @@ public class Admission /// Returns a human-readable string representation of the Admission, conditionally including NHC, Person, Admission Date, location, Origin, Diagnosis, and any associated Allergies only when they are present. /// /// A formatted string in the form "Admission [...]" summarizing the Admission's key properties. + /// public override string ToString() { List items = []; diff --git a/adas-core.Domain/Models/MongoModels/AlarmConfig.cs b/adas-core.Domain/Models/MongoModels/AlarmConfig.cs index 41934d21..20141616 100644 --- a/adas-core.Domain/Models/MongoModels/AlarmConfig.cs +++ b/adas-core.Domain/Models/MongoModels/AlarmConfig.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents the configuration settings for an alarm. /// +/// public class AlarmConfig { public string? Name { get; set; } @@ -21,6 +22,7 @@ public class AlarmConfig /// /// Represents the configuration settings for audio processing or playback. /// +/// public class AudioConfig { public AlarmEnum.AudioAlarmType Type { get; set; } = AlarmEnum.AudioAlarmType.Off; diff --git a/adas-core.Domain/Models/MongoModels/AlarmItem.cs b/adas-core.Domain/Models/MongoModels/AlarmItem.cs index 40a5b414..61b4b1ba 100644 --- a/adas-core.Domain/Models/MongoModels/AlarmItem.cs +++ b/adas-core.Domain/Models/MongoModels/AlarmItem.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents an alarm item entity. /// +/// public class AlarmItem { public bool Enabled { get; set; } @@ -28,6 +29,7 @@ public class AlarmItem /// Returns a formatted string representation of the , including the Enabled, StartBefore, EndAfter, Severity, and BeaconColor values, and optionally appending the Color value when it is not null or empty. /// /// A string in the format "AlarmItem[item1, item2, ...]" containing the key properties of the alarm item. + /// public override string ToString() { List items = diff --git a/adas-core.Domain/Models/MongoModels/Authorizations.cs b/adas-core.Domain/Models/MongoModels/Authorizations.cs index 5f8c4094..8af3c623 100644 --- a/adas-core.Domain/Models/MongoModels/Authorizations.cs +++ b/adas-core.Domain/Models/MongoModels/Authorizations.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents an authorization mechanism that determines whether a principal is granted access to a protected resource or operation. /// +/// public class Authorization { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/Box.cs b/adas-core.Domain/Models/MongoModels/Box.cs index e87c245c..af2df829 100644 --- a/adas-core.Domain/Models/MongoModels/Box.cs +++ b/adas-core.Domain/Models/MongoModels/Box.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.MongoModels; /// Represents a patient box (clinical display unit) that aggregates patient data, /// observations, medications, and display configuration for a specific point of care. /// +/// public class Box { public Person? AttendingDoctor; diff --git a/adas-core.Domain/Models/MongoModels/Camera.cs b/adas-core.Domain/Models/MongoModels/Camera.cs index 4ee94c06..8464bdf3 100644 --- a/adas-core.Domain/Models/MongoModels/Camera.cs +++ b/adas-core.Domain/Models/MongoModels/Camera.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a camera, typically used to capture or render visual content in a scene or application. /// +/// public class Camera { public ObjectId Id { get; set; } @@ -27,6 +28,7 @@ public class Camera /// /// Represents a sequence of bytes that can be read from or written to. /// +/// public class Stream { public string? Rtsp { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/ConfigObservation.cs b/adas-core.Domain/Models/MongoModels/ConfigObservation.cs index 9470fa16..876af519 100644 --- a/adas-core.Domain/Models/MongoModels/ConfigObservation.cs +++ b/adas-core.Domain/Models/MongoModels/ConfigObservation.cs @@ -11,6 +11,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// This type is intended to capture configuration-related observation data within the application. /// +/// public class ConfigObservation { public Dictionary? Grouped; @@ -86,6 +87,7 @@ public class ConfigObservation /// human-readable serialization. /// /// A string containing the JSON-serialized representation of the object with indented formatting. + /// public override string ToString() { return JsonConvert.SerializeObject(this, Formatting.Indented); @@ -94,6 +96,7 @@ public class ConfigObservation /// /// Represents a range of colors, typically used to define a spectrum or gradient between a start and end color. /// + /// public class ColorRange { public ObservationEnum.ValueType? ValueType; @@ -121,6 +124,7 @@ public class ConfigObservation /// /// Represents a configuration class that holds settings for demonstration purposes. /// +/// public class DemoConfig { public int? MaxValue { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/ConfigPumps.cs b/adas-core.Domain/Models/MongoModels/ConfigPumps.cs index 53e89a56..0e37cd3f 100644 --- a/adas-core.Domain/Models/MongoModels/ConfigPumps.cs +++ b/adas-core.Domain/Models/MongoModels/ConfigPumps.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Used to manage and access configuration parameters specific to pump operations. /// +/// public class ConfigPumps { public string Id { get; set; } = string.Empty; @@ -20,6 +21,7 @@ public class ConfigPumps /// /// Represents a configuration item related to a pump, encapsulating its settings or state data. /// +/// public class ConfigPumpItem { public PumpEnum.AlarmType? AlarmType { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/ConfigUnits.cs b/adas-core.Domain/Models/MongoModels/ConfigUnits.cs index bf78e5a3..3d25fe6f 100644 --- a/adas-core.Domain/Models/MongoModels/ConfigUnits.cs +++ b/adas-core.Domain/Models/MongoModels/ConfigUnits.cs @@ -3,6 +3,7 @@ /// /// Represents a configuration container for unit definitions, providing centralized access to unit-related settings and metadata. /// +/// public class ConfigUnits { public string Id { get; set; } = string.Empty; @@ -13,6 +14,7 @@ public class ConfigUnits /// /// Represents a single configuration unit item, serving as a data model for storing and managing individual configuration entries. /// +/// public class ConfigUnitItem { public string? Code { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/Device.cs b/adas-core.Domain/Models/MongoModels/Device.cs index 650dbbe2..63fd78fc 100644 --- a/adas-core.Domain/Models/MongoModels/Device.cs +++ b/adas-core.Domain/Models/MongoModels/Device.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a device entity within the application. /// +/// public class Device { public ObjectId Id { get; set; } @@ -28,6 +29,7 @@ public class Device /// /// Represents the configuration settings for a device. /// +/// public class DeviceSettings { public DeviceAction? Action { get; set; } @@ -35,6 +37,7 @@ public class DeviceSettings /// /// Represents an action that can be performed on or by a device. /// +/// public class DeviceAction { public DeviceActionType Type { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/Discharge.cs b/adas-core.Domain/Models/MongoModels/Discharge.cs index ef07c1d9..2e73db50 100644 --- a/adas-core.Domain/Models/MongoModels/Discharge.cs +++ b/adas-core.Domain/Models/MongoModels/Discharge.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a discharge, typically referring to the release or emission of a substance, energy, or a patient leaving a medical facility. /// +/// public class Discharge { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/Display.cs b/adas-core.Domain/Models/MongoModels/Display.cs index 8b5398bd..1d2e0d50 100644 --- a/adas-core.Domain/Models/MongoModels/Display.cs +++ b/adas-core.Domain/Models/MongoModels/Display.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a display used to present or output information to the user. /// +/// public class Display { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/DisplayCardConfig.cs b/adas-core.Domain/Models/MongoModels/DisplayCardConfig.cs index 04865f6c..613c2deb 100644 --- a/adas-core.Domain/Models/MongoModels/DisplayCardConfig.cs +++ b/adas-core.Domain/Models/MongoModels/DisplayCardConfig.cs @@ -11,6 +11,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// This class is intended to be used as a data container or settings holder for card-related configurations. /// +/// public class CardConfig { public ObjectId Id { get; set; } @@ -23,6 +24,7 @@ public class CardConfig /// /// This type is intended to be used as a data container to define the visual or behavioral properties of a row card. /// +/// public class RowCardConfig { // Dynamic cells de nurse y Dynamic Obs de monitoring @@ -47,6 +49,7 @@ public class RowCardConfig /// /// Represents a single cell, typically used as an individual unit within a larger structured data model such as a grid, table, or matrix. /// +/// public class Cell { public ChartSettings? ChartSettings { get; set; } @@ -96,6 +99,7 @@ public class Cell /// /// Represents the configuration settings used to control the appearance and behavior of a chart. /// +/// public class ChartSettings { public LegendLayoutConfig? LegendLayoutConfig { get; set; } @@ -106,6 +110,7 @@ public class ChartSettings /// /// Represents configuration settings for a dialog, providing a centralized structure to manage dialog-related options and parameters. /// +/// public class DialogConfig { public bool? IsDraggable { get; set; } @@ -118,6 +123,7 @@ public class DialogConfig /// /// Serves as a container for medical configuration data, providing a centralized structure to manage and access medical settings within the application. /// +/// public class MedicalConfig { public bool HasFinalizeTime { get; set; } @@ -127,6 +133,7 @@ public class MedicalConfig /// /// Represents a list of icon values, providing a collection structure for managing and accessing icon-related data. /// +/// public class IconValueList { public double? MinValue { get; set; } @@ -139,6 +146,7 @@ public class IconValueList /// /// Represents the configuration settings for the home page or home component. /// +/// public class HomeConfig { public string? MinColumnSize { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/DisplayCardDetailConfig.cs b/adas-core.Domain/Models/MongoModels/DisplayCardDetailConfig.cs index 0939130c..028f9791 100644 --- a/adas-core.Domain/Models/MongoModels/DisplayCardDetailConfig.cs +++ b/adas-core.Domain/Models/MongoModels/DisplayCardDetailConfig.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents the configuration settings for card details. /// +/// public class CardDetailsConfig { public ObjectId Id { get; set; } @@ -19,6 +20,7 @@ public class CardDetailsConfig /// /// Represents configuration settings for row details, typically used to control the display and behavior of expandable detail rows. /// +/// public class RowDetailsConfig { // Dynamic cells de nurse y Dynamic Obs de monitoring @@ -33,6 +35,7 @@ public class RowDetailsConfig /// /// Represents a container for detailed information about an individual cell. /// +/// public class CellDetails { public List? TextRules { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/DisplayConfig.cs b/adas-core.Domain/Models/MongoModels/DisplayConfig.cs index 45394c90..d7f23554 100644 --- a/adas-core.Domain/Models/MongoModels/DisplayConfig.cs +++ b/adas-core.Domain/Models/MongoModels/DisplayConfig.cs @@ -11,6 +11,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// This class encapsulates the configuration data used to manage display-related properties and behavior. /// +/// public class DisplayConfig { public ObjectId Id { get; set; } @@ -62,6 +63,8 @@ public class DisplayConfig /// /// The default configuration to use as a fallback when the current configuration properties are null or empty. /// The current instance with merged configuration values. + /// public virtual DisplayConfig MergeConfig(DisplayConfig defaultConfig) { // CardConfig ??= defaultConfig.CardConfig; @@ -85,6 +88,7 @@ public class DisplayConfig /// /// Represents a standard display configuration, extending the base class to provide default display settings. /// +/// public class StandarDisplay : DisplayConfig { public SectionConfig? SectionConfig { get; set; } @@ -94,6 +98,7 @@ public class StandarDisplay : DisplayConfig /// /// The default display configuration to merge from. Only values from a instance are applied. /// The merged , or the current instance if the provided configuration is not a . + /// public override DisplayConfig MergeConfig(DisplayConfig defaultConfig) { if (defaultConfig is not StandarDisplay defaultStandarConfig) @@ -108,6 +113,7 @@ public class StandarDisplay : DisplayConfig /// /// Represents a display configuration specific to nurses, inheriting common display behavior from the base class. /// +/// public class DisplayNurse : DisplayConfig { /// @@ -115,6 +121,8 @@ public class DisplayNurse : DisplayConfig /// /// The default DisplayConfig to merge values from. Only DisplayNurse instances contribute fallback values for nurse-specific settings. /// A DisplayConfig containing the merged configuration. + /// public override DisplayConfig MergeConfig(DisplayConfig defaultConfig) { if (defaultConfig is not DisplayNurse defaultNurseConfig) return this; @@ -131,6 +139,7 @@ public class DisplayNurse : DisplayConfig /// /// Inherits from , extending its general display configuration behavior with pump-specific context. /// +/// public class PumpDisplay : DisplayConfig { /// @@ -138,6 +147,7 @@ public class PumpDisplay : DisplayConfig /// /// The display configuration to merge from. Only instances are processed; any other type results in the current instance being returned as-is. /// The merged result produced by chaining the base merge operation. + /// public override DisplayConfig MergeConfig(DisplayConfig config) { if (config is not PumpDisplay defaultConfig) return this; @@ -159,6 +169,7 @@ public class PumpDisplay : DisplayConfig /// /// Represents a smart display configuration that extends the base behavior. /// +/// public class SmartDisplay : DisplayConfig { /// @@ -166,6 +177,8 @@ public class SmartDisplay : DisplayConfig /// /// The default to merge; it is cast to to access smart display-specific properties. /// The merged produced by the base merge operation. + /// public override DisplayConfig MergeConfig(DisplayConfig defaultConfigToCast) { if (defaultConfigToCast is not SmartDisplay defaultConfig) return this; @@ -216,6 +229,7 @@ public class SmartDisplay : DisplayConfig /// The first value to compare. /// The second value to compare. /// true if both values are null, deeply equal as enumerables, equal via when their types match, or have matching string representations; otherwise, false. + /// private static bool AreEqual(object? value1, object? value2) { if (value1 == null && value2 == null) return true; @@ -251,6 +265,7 @@ public class SmartDisplay : DisplayConfig /// /// Represents a configuration class for defining header-related settings. /// +/// public class HeaderConfig { public HeaderItem? PartnerLogo { get; set; } @@ -280,6 +295,7 @@ public class HeaderConfig /// /// Represents a single item contained within a header. /// + /// public class HeaderItem { public string? LogoUrl { get; set; } @@ -290,6 +306,7 @@ public class HeaderConfig /// /// Represents a display section that provides a minimal rendering configuration. /// +/// public class MinimalDisplaySection { public string? Name { get; set; } @@ -299,6 +316,7 @@ public class MinimalDisplaySection /// /// Represents the configuration settings for a section. /// +/// public class SectionConfig { public int? Columns { get; set; } @@ -311,6 +329,7 @@ public class SectionConfig /// /// Represents a banner item, typically used to encapsulate data related to a banner display element such as a notification, advertisement, or promotional content. /// +/// public class BannerItem { public DisplayConfigEnums.BannerType? Type { get; set; } @@ -324,6 +343,7 @@ public class BannerItem /// /// This class is used to store and manage configuration data related to individual banner items within the application. /// +/// public class BannerItemConfig { public BannerItemTableConfig? BannerItemTableConfig { get; set; } @@ -334,6 +354,7 @@ public class BannerItemConfig /// /// Represents the configuration settings for a banner item table. /// +/// public class BannerItemTableConfig { public List? Config { get; set; } @@ -344,6 +365,7 @@ public class BannerItemTableConfig /// /// Represents the configuration settings for medical staff. /// +/// public class MedicalStaffConfig { public bool? HasTeams { get; set; } @@ -353,6 +375,7 @@ public class MedicalStaffConfig /// /// Represents an overview of form items, providing a consolidated view or summary of form-related data. /// +/// public class FormItemOverview { public bool Nhc { get; set; } @@ -383,6 +406,7 @@ public class FormItemOverview /// /// Represents the configuration settings for a table that displays header banner items. /// +/// public class HeaderBannerItemTableConfig { public DisplayConfigEnums.CellType? Type { get; set; } @@ -398,6 +422,7 @@ public class HeaderBannerItemTableConfig /// /// Represents a sensor, which is a device or component used to detect and measure physical phenomena such as temperature, pressure, or motion. /// +/// public class Sensor { public string? Name { get; set; } @@ -409,6 +434,7 @@ public class Sensor /// /// Represents a configuration that defines color-related settings or values. /// +/// public class ColorConfig { public LevelColors? Level { get; set; } @@ -461,6 +487,7 @@ public class ColorConfig /// /// Represents configuration settings that define the visual appearance of an application or user interface element. /// + /// public class AppearanceSettings { public string? TextColor { get; set; } @@ -502,6 +529,7 @@ public class ColorConfig /// /// Represents the set of colors used to display numbers within a status box. /// + /// public class StatusBoxNumberColors { public AppearanceSettings? Reserved { get; set; } @@ -543,6 +571,7 @@ public class ColorConfig /// /// Represents a collection of colors used for therapy-related visuals or themes. /// + /// public class TherapyColors { public AppearanceSettings? Default { get; set; } @@ -577,6 +606,7 @@ public class ColorConfig /// /// Represents a test class for color-related operations or values. /// + /// public class TestColors { public AppearanceSettings? Default { get; set; } @@ -612,6 +642,7 @@ public class ColorConfig /// /// Represents a set of colors used to define or customize the appearance of a procedure. /// + /// public class ProcedureColors { public AppearanceSettings? Default { get; set; } @@ -647,6 +678,7 @@ public class ColorConfig /// /// Represents a collection or definition of colors associated with different levels. /// + /// public class LevelColors { public string? Level1 { get; set; } @@ -685,6 +717,7 @@ public class ColorConfig /// /// Provides a collection of predefined color values used for styling or rendering text. /// + /// public class TextColors { public string? Normal { get; set; } @@ -723,6 +756,7 @@ public class ColorConfig /// /// Represents a collection or definition of colors used for rendering arrows. /// + /// public class ArrowColors { public string? Normal { get; set; } @@ -758,6 +792,7 @@ public class ColorConfig /// /// Represents a collection or definition of colors used for indicators. /// + /// public class IndicatorColors { public string? Empty { get; set; } @@ -799,6 +834,7 @@ public class ColorConfig /// /// Represents a collection or definition of colors used for rendering graphs. /// + /// public class GraphColors { public string? Normal { get; set; } @@ -835,6 +871,7 @@ public class ColorConfig /// /// This class encapsulates the configuration data required to define or manage form-related properties. /// +/// public class FormConfig { public FormItemOverview? Admission { get; set; } @@ -849,6 +886,7 @@ public class FormConfig /// /// Represents a label associated with an axis, typically used in charting or graphing scenarios to describe or identify the axis. /// +/// public class AxisLabel { public bool? Show { get; set; } @@ -868,6 +906,10 @@ public class AxisLabel /// Represents a line associated with an axis, typically used to render or define the visual structure of an axis in a chart or graph. /// /// +/// +/// Represents an axis line, typically used to model a line associated with a coordinate axis. +/// +/// public class AxisLineStyle { public string? Color { get; set; } @@ -882,6 +924,7 @@ public class AxisLine /// /// Represents a single tick mark on an axis, typically used in charting or graphing scenarios. /// +/// public class AxisTick { public bool? Show { get; set; } @@ -893,6 +936,7 @@ public class AxisTick /// /// Represents the configuration settings for a chart, defining its visual and behavioral properties. /// +/// public class ChartConfig { public ObjectId Id { get; set; } @@ -910,6 +954,7 @@ public class ChartConfig /// Serves as the base class for configuration types that define settings for a series. /// Provides a common foundation for derived series configuration implementations. /// +/// public class SeriesConfigBase { public string? Key { get; set; } @@ -954,6 +999,7 @@ public class SeriesConfigBase /// /// Represents a visual mapping that handles the rendering or display logic for map-related data. /// +/// public class VisualMap { public bool Show { get; set; } //Mostrar en la leyenda @@ -965,6 +1011,7 @@ public class VisualMap /// /// Represents a single piece, serving as a general-purpose entity within its containing system. /// +/// public class Piece { public double? Opacity { get; set; } //Valor de la opacidad @@ -1044,6 +1091,10 @@ public class Piece // /// Represents a single candlestick data point, typically used in financial charting to encapsulate price information for a discrete time interval. // /// // /// +// /// +// /// Represents a candle, likely encapsulating related data and behavior. +// /// +// /// // public class CandlestickSeriesConfig : SeriesConfigBase // { // public List? CandleKeyList { get; set; } @@ -1081,6 +1132,7 @@ public enum CandleValueType /// /// This class is intended to be inherited by specialized chart configuration types to ensure consistent configuration handling across the charting system. /// +/// public class ChartBaseConfig { public string? Title { get; set; } @@ -1101,6 +1153,7 @@ public class ChartBaseConfig /// /// Represents the configuration settings for an axis. /// +/// public class AxisConfig { public DisplayConfigEnums.AxisType Type { get; set; } @@ -1126,6 +1179,7 @@ public class AxisConfig /// /// This class serves as a base type for specific graph layout strategies and is intended to be used to control the visual or logical arrangement of graph components. /// +/// public class GraphLayout { public string? Layout { get; set; } @@ -1138,6 +1192,7 @@ public class GraphLayout /// /// Represents a layout configuration for arranging section boxes. /// +/// public class SectionBoxLayout { public DisplayConfigEnums.RowType Type { get; set; } @@ -1165,6 +1220,7 @@ public class SectionBoxLayout /// /// Represents a configuration class that defines conditions. /// +/// public class ConditionsConfig { public string? Condition { get; set; } @@ -1174,6 +1230,7 @@ public class ConditionsConfig /// /// Represents a layout manager that arranges child elements in a row-based box configuration. /// +/// public class RowBoxLayout { public double? GrowPriority { get; set; } @@ -1191,6 +1248,7 @@ public class RowBoxLayout /// /// Represents a box layout configuration for displaying observation rows. /// +/// public class ObservationRowBoxLayout { public List? TextRules { get; set; } @@ -1230,6 +1288,7 @@ public class ObservationRowBoxLayout /// /// Represents a layout that arranges cards with a rotating behavior, likely managing the visual positioning and orientation of card elements within a container. /// +/// public class CardRotatingLayout { // In MS @@ -1246,6 +1305,7 @@ public class CardRotatingLayout /// /// Represents a rule used to validate or process observation text. /// +/// public class ObservationTextRule { public ObservationEnum.ValueType ValueType { get; set; } @@ -1265,6 +1325,7 @@ public class ObservationTextRule /// /// Represents a configuration object that defines layout settings for a legend. /// +/// public class LegendLayoutConfig { public List? Rows { get; set; } @@ -1273,6 +1334,7 @@ public class LegendLayoutConfig /// /// Represents a single row within a legend layout, typically used to organize and arrange legend items in a structured, row-based configuration. /// +/// public class LegendLayoutRow { public decimal? GrowPriority { get; set; } @@ -1282,6 +1344,7 @@ public class LegendLayoutRow /// /// Represents a column within a legend layout, defining a vertical arrangement of legend entries or items. /// +/// public class LegendLayoutColumn { public string? Key { get; set; } @@ -1292,6 +1355,7 @@ public class LegendLayoutColumn /// /// Represents a label associated with a legend, typically used to describe or identify an entry in a chart, graph, or similar visual component. /// +/// public class LegendLabel { public string? Name { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/HistoricalConfigChanges.cs b/adas-core.Domain/Models/MongoModels/HistoricalConfigChanges.cs index 552683f0..7e03ab6d 100644 --- a/adas-core.Domain/Models/MongoModels/HistoricalConfigChanges.cs +++ b/adas-core.Domain/Models/MongoModels/HistoricalConfigChanges.cs @@ -13,6 +13,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// This converter extends to provide tailored JSON conversion behavior for historical config change data. /// +/// public class HistoricalConfigChanges : JsonConverter { public DateTime Time; @@ -34,6 +35,7 @@ public class HistoricalConfigChanges : JsonConverter /// The that receives the serialized JSON output. /// The object to serialize. If null, the method does nothing. /// The used during serialization. + /// public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (value != null) @@ -50,6 +52,7 @@ public class HistoricalConfigChanges : JsonConverter /// /// The object instance whose type defines the target property. /// The name of the property to which the converter attribute should be added. + /// private static void AddStringEnumConverterAttribute(object value, string propertyName) { var prop = value.GetType().GetProperty(propertyName); @@ -84,6 +87,7 @@ public class HistoricalConfigChanges : JsonConverter /// The used to deserialize nested objects. /// The deserialized object value. /// Always thrown because the method has not been implemented. + /// public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { @@ -96,6 +100,8 @@ public class HistoricalConfigChanges : JsonConverter /// The type to evaluate for convertibility. /// when the converter supports ; otherwise, . /// Thrown in all cases because the method body is not implemented. + /// public override bool CanConvert(Type objectType) { throw new NotImplementedException(); diff --git a/adas-core.Domain/Models/MongoModels/HistoricalIds.cs b/adas-core.Domain/Models/MongoModels/HistoricalIds.cs index b53f4ded..06be06ae 100644 --- a/adas-core.Domain/Models/MongoModels/HistoricalIds.cs +++ b/adas-core.Domain/Models/MongoModels/HistoricalIds.cs @@ -6,6 +6,7 @@ /// /// The type holds a timestamp together with a dictionary of patient IDs, providing a snapshot of the identification data at the given time. /// +/// public class HistoricalId(DateTime time, Dictionary patientIds) { // Propiedades @@ -19,6 +20,7 @@ public class HistoricalId(DateTime time, Dictionary patientIds) /// Determines whether the appointment is empty by checking if the has not been set (is the default ) and no patient identifiers have been associated. /// /// if both the time is uninitialized and the patient list is empty; otherwise, . + /// public bool IsEmpty() { return Time == default(DateTime) && PatientIds.Count == 0; @@ -29,6 +31,7 @@ public class HistoricalId(DateTime time, Dictionary patientIds) /// Determines whether the current entity is fully populated by verifying that a time has been explicitly assigned and at least one patient is associated. /// /// true if both the Time property is set to a non-default value and the PatientIds collection contains at least one entry; otherwise, false. + /// public bool IsFull() { return Time != default(DateTime) && PatientIds.Count > 0; @@ -39,6 +42,7 @@ public class HistoricalId(DateTime time, Dictionary patientIds) /// Returns a string representation of the HistoricalId, including the time and a comma-separated list of patient identifiers. /// /// A formatted string in the form "HistoricalId[Time: {Time}, PatientIds: {idsString}]" where idsString is the patient identifiers joined by commas. + /// public override string ToString() { var idsString = string.Join(", ", PatientIds); diff --git a/adas-core.Domain/Models/MongoModels/LightBeacon.cs b/adas-core.Domain/Models/MongoModels/LightBeacon.cs index 8046b75a..2dd259e4 100644 --- a/adas-core.Domain/Models/MongoModels/LightBeacon.cs +++ b/adas-core.Domain/Models/MongoModels/LightBeacon.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a light beacon, typically used to emit or signal light as a visual indicator or warning marker. /// +/// public class LightBeacon { public ObjectId Id { get; set; } @@ -17,6 +18,7 @@ public class LightBeacon /// /// Represents a container for configuration or option settings used by the application. /// +/// public class Options { public string? Url { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/Notice.cs b/adas-core.Domain/Models/MongoModels/Notice.cs index e659e04b..3a142898 100644 --- a/adas-core.Domain/Models/MongoModels/Notice.cs +++ b/adas-core.Domain/Models/MongoModels/Notice.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a notice, typically used to convey information, alerts, or messages within the application. /// +/// public class Notice { public ObjectId Id { get; set; } @@ -20,6 +21,7 @@ public class Notice /// Returns a string representation of the notice, including the date (only when set), display ID, type, and description. /// /// A formatted string prefixed with "Notice [" and containing the comma-separated notice details, omitting the date entry when NoticeDate equals . + /// public override string ToString() { List items = []; @@ -35,6 +37,7 @@ public class Notice /// /// Represents a data structure that contains information about a staff member. /// +/// public class StaffInfo { public required string Role { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/Patient.cs b/adas-core.Domain/Models/MongoModels/Patient.cs index f8387dd4..1d3558c0 100644 --- a/adas-core.Domain/Models/MongoModels/Patient.cs +++ b/adas-core.Domain/Models/MongoModels/Patient.cs @@ -7,6 +7,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a patient entity, typically used to encapsulate patient-related data and behavior within a healthcare or medical information system. /// +/// public class Patient { public ObjectId Id { get; set; } @@ -95,6 +96,7 @@ public class Patient /// for nullable types). /// /// A formatted string prefixed with "person[" and containing the included fields joined by commas. + /// public override string ToString() { List items = [$"id: {Id}"]; @@ -117,6 +119,7 @@ public class Patient /// Determines whether the current represents an inactive Virtual Point of Care by checking that it is not null and is not defined as a value of the enumeration. /// /// true if UnitString is not null and does not match any defined value; otherwise, false. + /// public bool IsInActivePoC() { return UnitString != null && !Enum.IsDefined(typeof(VirtualPointOfCare), UnitString); @@ -126,6 +129,7 @@ public class Patient /// Creates a copy of the current instance by performing a shallow copy. /// /// A new object that is a shallow copy of the current instance. + /// public Patient DeepCopy() { return (Patient)MemberwiseClone(); @@ -182,6 +186,7 @@ public class Patient /// /// Represents data related to a patient's income information. /// +/// public class PatientIncomeData { public DateTime? AdmTime { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/PatientCarePlan.cs b/adas-core.Domain/Models/MongoModels/PatientCarePlan.cs index 3d698f8f..8dee1d78 100644 --- a/adas-core.Domain/Models/MongoModels/PatientCarePlan.cs +++ b/adas-core.Domain/Models/MongoModels/PatientCarePlan.cs @@ -10,6 +10,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// This class serves as a structured model for organizing and tracking the various aspects of a patient's care strategy. /// +/// public class PatientCarePlan { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/PoCMapping.cs b/adas-core.Domain/Models/MongoModels/PoCMapping.cs index 4c0dd90a..1d0ca022 100644 --- a/adas-core.Domain/Models/MongoModels/PoCMapping.cs +++ b/adas-core.Domain/Models/MongoModels/PoCMapping.cs @@ -6,6 +6,7 @@ /// /// This class serves as a container or descriptor for mapping logic, commonly used to translate data between different representations or models. /// +/// public class PoCMapping { public string Id { get; set; } = string.Empty; @@ -17,6 +18,7 @@ public class PoCMapping /// /// Represents a single item used in a proof of concept (PoC) mapping, encapsulating the data or configuration required to define a mapping entry. /// +/// public class PoCMappingItem { public string OriginalPoC { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/MongoModels/PoCSettings.cs b/adas-core.Domain/Models/MongoModels/PoCSettings.cs index 54fa50f6..af276ae0 100644 --- a/adas-core.Domain/Models/MongoModels/PoCSettings.cs +++ b/adas-core.Domain/Models/MongoModels/PoCSettings.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// This class serves as a container for configuration values used during proof-of-concept development and testing phases. /// +/// public class PoCSettings { public ObjectId Id { get; set; } @@ -21,6 +22,7 @@ public class PoCSettings /// Returns a string representation of the object, always including the Id, and conditionally appending the PatientLocation and Relay Manual Status when those values are not null. /// /// A string containing the Id and, when available, the PatientLocation and Manual Relay Status information. + /// public override string ToString() { var result = "Id: " + Id; diff --git a/adas-core.Domain/Models/MongoModels/PointOfCare.cs b/adas-core.Domain/Models/MongoModels/PointOfCare.cs index 92ae5652..e3c0faa8 100644 --- a/adas-core.Domain/Models/MongoModels/PointOfCare.cs +++ b/adas-core.Domain/Models/MongoModels/PointOfCare.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// This class serves as a data model for capturing information related to a specific point where care is administered to patients. /// +/// public class PointOfCare { public ObjectId Id { get; set; } @@ -39,6 +40,7 @@ public class PointOfCare /// /// Represents the configuration settings for a point-of-care system, encapsulating the parameters and options required to manage its behavior. /// +/// public class PointOfCareConfiguration { public List? BeaconIdList { get; set; } = []; diff --git a/adas-core.Domain/Models/MongoModels/PumpElement.cs b/adas-core.Domain/Models/MongoModels/PumpElement.cs index d7dd9be7..bcc07295 100644 --- a/adas-core.Domain/Models/MongoModels/PumpElement.cs +++ b/adas-core.Domain/Models/MongoModels/PumpElement.cs @@ -3,6 +3,7 @@ /// /// Represents a pump element within the system, serving as a component for pumping-related functionality. /// +/// public class PumpElement { public string? Id { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/Relay.cs b/adas-core.Domain/Models/MongoModels/Relay.cs index 2243b1e4..750ee103 100644 --- a/adas-core.Domain/Models/MongoModels/Relay.cs +++ b/adas-core.Domain/Models/MongoModels/Relay.cs @@ -10,6 +10,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// This class serves as an intermediary mechanism, commonly used to decouple producers and consumers of information. /// +/// public class Relay { public ObjectId Id { get; set; } @@ -52,6 +53,7 @@ public class Relay /// /// The other instance to compare against the current one. /// true if all properties of both relays match; otherwise, false. + /// public bool Equals(Relay other) { return Driver == other.Driver && Ip == other.Ip && Port == other.Port && RelayNumber == other.RelayNumber && @@ -63,6 +65,7 @@ public class Relay /// Returns a JSON string representation of the current object, serializing all its public properties via JsonConvert. /// /// A JSON-formatted string that represents the current object. + /// public override string ToString() { return JsonConvert.SerializeObject(this); diff --git a/adas-core.Domain/Models/MongoModels/Section.cs b/adas-core.Domain/Models/MongoModels/Section.cs index 53660697..39f89d46 100644 --- a/adas-core.Domain/Models/MongoModels/Section.cs +++ b/adas-core.Domain/Models/MongoModels/Section.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a section, typically used to group or encapsulate a distinct portion of related content or functionality within a larger structure. /// +/// public class Section { // ReSharper disable once InconsistentNaming @@ -39,6 +40,7 @@ public class Section /// /// The instance to compare with the current one. /// true if both sections share the same ; otherwise, false. + /// public bool Equals(Section? other) { return other != null && @@ -49,6 +51,7 @@ public class Section /// Returns a string representation of the Section, including its identifier. /// /// A string formatted as "[Section id: {Id}]" containing the section's identifier. + /// public override string ToString() { return "[Section id: " + Id + "]"; @@ -57,6 +60,7 @@ public class Section /// /// Represents an individual item within a section, encapsulating the data and behavior associated with that entry. /// + /// public class SectionItem { public string? Group { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/ServiceConfig.cs b/adas-core.Domain/Models/MongoModels/ServiceConfig.cs index e0b642c4..096362c4 100644 --- a/adas-core.Domain/Models/MongoModels/ServiceConfig.cs +++ b/adas-core.Domain/Models/MongoModels/ServiceConfig.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents the configuration settings for a service. /// +/// public class ServiceConfig { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/ServiceConfigService.cs b/adas-core.Domain/Models/MongoModels/ServiceConfigService.cs index 710c18bb..3fb268ae 100644 --- a/adas-core.Domain/Models/MongoModels/ServiceConfigService.cs +++ b/adas-core.Domain/Models/MongoModels/ServiceConfigService.cs @@ -3,6 +3,7 @@ /// /// Provides functionality for managing service configuration settings. /// +/// public class ServiceConfigService { public string Screen { get; set; } = string.Empty; @@ -14,6 +15,7 @@ public class ServiceConfigService /// /// Represents a configuration section that defines settings for a service configuration service. /// +/// public class ServiceConfigServiceSection { public string BoxId { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/MongoModels/ServiceConfigTheme.cs b/adas-core.Domain/Models/MongoModels/ServiceConfigTheme.cs index 7dc6a2b2..f05fbbc2 100644 --- a/adas-core.Domain/Models/MongoModels/ServiceConfigTheme.cs +++ b/adas-core.Domain/Models/MongoModels/ServiceConfigTheme.cs @@ -3,6 +3,7 @@ /// /// Represents the configuration settings for the theme of a service. /// +/// public class ServiceConfigTheme { public string DefaultTheme { get; set; } = string.Empty; @@ -14,6 +15,7 @@ public class ServiceConfigTheme /// /// Represents the configuration settings for a service's theme timetable. /// +/// public class ServiceConfigThemeTimetable { public string Theme { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/MongoModels/Step.cs b/adas-core.Domain/Models/MongoModels/Step.cs index 85f0a9c8..35239fa8 100644 --- a/adas-core.Domain/Models/MongoModels/Step.cs +++ b/adas-core.Domain/Models/MongoModels/Step.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents an individual step, typically within a sequence or workflow. /// +/// public class Step { public int? RotationTime { get; set; } @@ -27,6 +28,7 @@ public class Step /// /// This class serves as a data container for font properties required by the UI rendering system. /// +/// public class UiFontData { public double? WidthStepBed { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/Unit.cs b/adas-core.Domain/Models/MongoModels/Unit.cs index b30fae5b..8a3ede11 100644 --- a/adas-core.Domain/Models/MongoModels/Unit.cs +++ b/adas-core.Domain/Models/MongoModels/Unit.cs @@ -7,6 +7,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a unit, typically used as a return type for operations that have no meaningful result value. /// +/// public class Unit { public ObjectId Id { get; set; } @@ -81,6 +82,7 @@ public class Unit /// /// Represents the configuration settings for a unit. /// +/// public class UnitConfiguration { public bool AutoAdt { get; set; } diff --git a/adas-core.Domain/Models/MongoModels/User.cs b/adas-core.Domain/Models/MongoModels/User.cs index 6691539b..29a354ae 100644 --- a/adas-core.Domain/Models/MongoModels/User.cs +++ b/adas-core.Domain/Models/MongoModels/User.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.MongoModels; /// /// Represents a user within the system, encapsulating user-related data and behavior. /// +/// public class User { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/Note.cs b/adas-core.Domain/Models/Note.cs index 9c1ec7d7..4c9a42fa 100644 --- a/adas-core.Domain/Models/Note.cs +++ b/adas-core.Domain/Models/Note.cs @@ -3,6 +3,7 @@ /// /// Represents a note entity used to store textual or descriptive information. /// +/// public class Note { public string? CommentType { get; set; } = string.Empty; @@ -15,6 +16,7 @@ public class Note /// Returns a string representation of the note, conditionally including the comment type, comment text, and entered time when their values are present. /// /// A formatted string in the form "note[...]" containing the available note properties, or "note[]" when no properties are set. + /// public override string ToString() { List items = []; diff --git a/adas-core.Domain/Models/ObservaitonRetentionResult.cs b/adas-core.Domain/Models/ObservaitonRetentionResult.cs index 173424eb..09d2c476 100644 --- a/adas-core.Domain/Models/ObservaitonRetentionResult.cs +++ b/adas-core.Domain/Models/ObservaitonRetentionResult.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models; /// /// Represents the result of an observation retention operation, encapsulating the outcome and relevant details of the retention process. /// +/// public class ObservatitonRetentionResult { /// diff --git a/adas-core.Domain/Models/ObservationData.cs b/adas-core.Domain/Models/ObservationData.cs index ae2530ae..3d114baa 100644 --- a/adas-core.Domain/Models/ObservationData.cs +++ b/adas-core.Domain/Models/ObservationData.cs @@ -3,6 +3,7 @@ /// /// Represents a data structure for storing observation information. /// +/// public class ObservationData { public string? CodingSystem { get; set; } diff --git a/adas-core.Domain/Models/Observations/BoolObservation.cs b/adas-core.Domain/Models/Observations/BoolObservation.cs index 99873f8d..b310dad1 100644 --- a/adas-core.Domain/Models/Observations/BoolObservation.cs +++ b/adas-core.Domain/Models/Observations/BoolObservation.cs @@ -3,6 +3,7 @@ /// /// Represents an observation that conveys a boolean value, extending the base type. /// +/// public class BoolObservation : Observation { public bool Value { get; set; } @@ -13,6 +14,7 @@ public class BoolObservation : Observation /// /// The list of patient observations from which the first entry is converted. /// A containing the boolean value of the first observation, or if the list contains no observations. + /// internal static BoolObservation? From(List obs) { if (obs.Count > 0) diff --git a/adas-core.Domain/Models/Observations/ChartObservation.cs b/adas-core.Domain/Models/Observations/ChartObservation.cs index b81053b5..3dcf1811 100644 --- a/adas-core.Domain/Models/Observations/ChartObservation.cs +++ b/adas-core.Domain/Models/Observations/ChartObservation.cs @@ -3,6 +3,7 @@ /// /// Represents an observation that is associated with a chart, providing chart-specific contextual data derived from the base type. /// +/// public class ChartObservation : Observation { public List Values { get; set; } = []; @@ -20,6 +21,7 @@ public class ChartObservation : Observation /// The list of patient observations to convert. /// A new instance. /// Thrown when is null. + /// internal static ChartObservation From(List obs) { return obs == null ? throw new ArgumentNullException(nameof(obs)) : new ChartObservation(); diff --git a/adas-core.Domain/Models/Observations/DoubleObservation.cs b/adas-core.Domain/Models/Observations/DoubleObservation.cs index 41d4f462..c6d88fdf 100644 --- a/adas-core.Domain/Models/Observations/DoubleObservation.cs +++ b/adas-core.Domain/Models/Observations/DoubleObservation.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.Observations; /// Represents an observation that captures a double-precision floating-point measurement or value. /// Inherits from the base type, providing a specialized observation variant for numeric data of type . /// +/// public class DoubleObservation : Observation { public double? Value { get; set; } @@ -16,6 +17,7 @@ public class DoubleObservation : Observation /// /// The list of patient observations to convert. At least one element is required to produce a result. /// A populated with the converted double values, or null if the list is empty. + /// public static DoubleObservation? From(List obs) { if (obs.Count > 0) diff --git a/adas-core.Domain/Models/Observations/FullObservation.cs b/adas-core.Domain/Models/Observations/FullObservation.cs index a327a351..35d4c4f8 100644 --- a/adas-core.Domain/Models/Observations/FullObservation.cs +++ b/adas-core.Domain/Models/Observations/FullObservation.cs @@ -3,6 +3,7 @@ /// /// Represents a complete observation as a specialized form of the base class. /// +/// public class FullObservation : Observation { public DateTime LastObservationDate; @@ -25,6 +26,7 @@ public class FullObservation : Observation /// /// The list of patient observations to convert; only the first two entries are used when present. /// A built from the first observation, or null if contains no items. + /// public static FullObservation? From(List obs) { if (obs.Count > 0) diff --git a/adas-core.Domain/Models/Observations/Medication.cs b/adas-core.Domain/Models/Observations/Medication.cs index cfd087e1..e0db3eb9 100644 --- a/adas-core.Domain/Models/Observations/Medication.cs +++ b/adas-core.Domain/Models/Observations/Medication.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Models.Observations; /// /// Serves as a specialized observation for capturing and modeling medication-specific data within the inheritance hierarchy. /// +/// public class Medication : Observation { /// @@ -65,6 +66,7 @@ public class Medication : Observation /// /// Represents a value or data entry associated with a drug, such as dosage, concentration, or other pharmaceutical-related information. /// +/// public class DrugValue { /// @@ -102,6 +104,7 @@ public class DrugValue /// Copies the values from the specified instance into the current instance, replacing the existing Id, Text, Units, Time, CodingSystem, and Result properties. /// /// The instance whose property values will be copied to the current instance. + /// public void Copy(DrugValue common) { Id = common.Id; @@ -119,6 +122,7 @@ public class DrugValue /// /// As an abstract class, it must be inherited by a derived class that supplies the concrete implementation for the double-based drug value behavior. /// +/// public abstract class DrugDoubleValue : DrugValue { /// @@ -141,6 +145,7 @@ public abstract class DrugDoubleValue : DrugValue /// /// Inherits from and is intended to be derived by concrete classes that encapsulate string-typed drug data associated with a . /// +/// public abstract class DrugStringValue(PumpElement pumpElement) : DrugValue(pumpElement) { public string? Value { get; set; } = pumpElement.Value?.ToString(); @@ -149,6 +154,7 @@ public abstract class DrugStringValue(PumpElement pumpElement) : DrugValue(pumpE /// /// Represents a double-precision drug value that describes the flow of a fluid for the specified . /// +/// public class FlowFluid(PumpElement pumpElement) : DrugDoubleValue(pumpElement); /// @@ -157,6 +163,7 @@ public class FlowFluid(PumpElement pumpElement) : DrugDoubleValue(pumpElement); /// /// Inherits from , sharing the pump element context with its base type. /// +/// public class VolumeFluidDeliveryTotal(PumpElement pumpElement) : DrugDoubleValue(pumpElement); /// @@ -165,11 +172,13 @@ public class VolumeFluidDeliveryTotal(PumpElement pumpElement) : DrugDoubleValue /// /// Inherits from and is constructed with a instance that is forwarded to the base constructor. /// +/// public class PumpDeliveryPressure(PumpElement pumpElement) : DrugDoubleValue(pumpElement); /// /// Represents the remaining volume of fluid to be infused (TBI) associated with a pump element, implemented as a drug-related double value. /// +/// public class VolumeFluidTbiRemain(PumpElement pumpElement) : DrugDoubleValue(pumpElement); /// @@ -178,12 +187,14 @@ public class VolumeFluidTbiRemain(PumpElement pumpElement) : DrugDoubleValue(pum /// /// Inherits from and is constructed with a to capture time-related fluid volume metrics. /// +/// public class VolumeFluidTimePdRemain(PumpElement pumpElement) : DrugDoubleValue(pumpElement); /// /// Represents the active sources of a pump element as a drug string value. /// Inherits from , encapsulating source information for pump operations. /// +/// public class PumpActiveSources(PumpElement pumpElement) : DrugStringValue(pumpElement) { public string? ValueId { get; set; } = pumpElement.ValueId; @@ -193,11 +204,13 @@ public class PumpActiveSources(PumpElement pumpElement) : DrugStringValue(pumpEl /// /// Represents a drug value associated with a pump element, inheriting from the DrugStringValue base class. /// +/// public class Drug(PumpElement pumpElement) : DrugStringValue(pumpElement); /// /// Represents a pump mode as a drug-related string value, inheriting string-based value semantics from . /// +/// public class PumpMode : DrugStringValue { /// @@ -214,6 +227,7 @@ public class PumpMode : DrugStringValue /// /// Represents the operational status of a pump as a drug-related string value. /// +/// public class PumpStatus : DrugStringValue { /// diff --git a/adas-core.Domain/Models/Observations/Observation.cs b/adas-core.Domain/Models/Observations/Observation.cs index dc5e8159..487997d0 100644 --- a/adas-core.Domain/Models/Observations/Observation.cs +++ b/adas-core.Domain/Models/Observations/Observation.cs @@ -3,6 +3,7 @@ /// /// Represents a single observation or recorded data point. /// +/// public class Observation { } \ No newline at end of file diff --git a/adas-core.Domain/Models/Observations/ObservationPaginatedResult.cs b/adas-core.Domain/Models/Observations/ObservationPaginatedResult.cs index a1515313..404f354e 100644 --- a/adas-core.Domain/Models/Observations/ObservationPaginatedResult.cs +++ b/adas-core.Domain/Models/Observations/ObservationPaginatedResult.cs @@ -3,6 +3,7 @@ /// /// Represents a paginated collection of observation results, typically used to return a subset of observations along with associated pagination metadata. /// +/// public class ObservationPaginatedResult { public int Count { get; set; } = 0; diff --git a/adas-core.Domain/Models/Observations/ObservationsRequest.cs b/adas-core.Domain/Models/Observations/ObservationsRequest.cs index e71d042a..c5a0dcdc 100644 --- a/adas-core.Domain/Models/Observations/ObservationsRequest.cs +++ b/adas-core.Domain/Models/Observations/ObservationsRequest.cs @@ -3,6 +3,7 @@ /// /// Represents a request for retrieving observations data, typically used to encapsulate query parameters or filtering criteria when interacting with an observations service or repository. /// +/// public class ObservationsRequest { public string? PatientNumber { get; set; } diff --git a/adas-core.Domain/Models/Observations/PredictMedicationObservation.cs b/adas-core.Domain/Models/Observations/PredictMedicationObservation.cs index 7502f41c..712e442a 100644 --- a/adas-core.Domain/Models/Observations/PredictMedicationObservation.cs +++ b/adas-core.Domain/Models/Observations/PredictMedicationObservation.cs @@ -3,6 +3,7 @@ /// /// Represents a prediction result or data model for medication observation. /// +/// public class PredictMedicationObservation { public string MedicineText { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/Observations/StringObservation.cs b/adas-core.Domain/Models/Observations/StringObservation.cs index 446fc453..934b9548 100644 --- a/adas-core.Domain/Models/Observations/StringObservation.cs +++ b/adas-core.Domain/Models/Observations/StringObservation.cs @@ -6,6 +6,7 @@ /// /// This class specializes the Observation concept for textual or string-based content, inheriting the core observation behavior from its parent class. /// +/// public class StringObservation : Observation { public string Value { get; set; } = string.Empty; @@ -16,6 +17,7 @@ public class StringObservation : Observation /// /// The list of instances to convert. /// A populated with the string value of the first observation, or null if the list contains no elements. + /// public static StringObservation? From(List obs) { if (obs.Count > 0) diff --git a/adas-core.Domain/Models/PatientAllergiesValue.cs b/adas-core.Domain/Models/PatientAllergiesValue.cs index e951a542..1018926a 100644 --- a/adas-core.Domain/Models/PatientAllergiesValue.cs +++ b/adas-core.Domain/Models/PatientAllergiesValue.cs @@ -3,6 +3,7 @@ /// /// Represents a value related to a patient's allergies. /// +/// public class PatientAllergiesValue { public string? Type { get; set; } @@ -16,6 +17,7 @@ public class PatientAllergiesValue /// Returns a formatted string representation of the object, including its Type, Value, and Notes properties. /// /// A string containing the Type, Value, and Notes properties of the object. + /// public override string ToString() { return $"Tipo: {Type}, Valor: {Value}, Notas: {Notes}"; diff --git a/adas-core.Domain/Models/PatientAppointment.cs b/adas-core.Domain/Models/PatientAppointment.cs index dece7a45..744a4344 100644 --- a/adas-core.Domain/Models/PatientAppointment.cs +++ b/adas-core.Domain/Models/PatientAppointment.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models; /// /// A JSON converter that handles the serialization and deserialization of objects to and from JSON format. /// +/// public class PatientAppointment : JsonConverter { public ObjectId Id { get; set; } @@ -59,6 +60,7 @@ public class PatientAppointment : JsonConverter /// /// The optional persisted whose resource groups provide the source data for the actions. May be null or have fewer resource groups than the current list. /// The list of instances with services, resources, locations, and personnel populated after applying the configured actions. + /// public List ApplyResourceGroups(PatientAppointment? apdb = null) { var i = 0; @@ -80,6 +82,7 @@ public class PatientAppointment : JsonConverter /// /// The type to check for converter support. /// true if is ; otherwise, false. + /// public override bool CanConvert(Type objectType) { return objectType == typeof(PatientAppointment); @@ -91,6 +94,8 @@ public class PatientAppointment : JsonConverter /// The JSON writer to which the serialized output is written. /// The object to serialize. A null value results in no output being written. /// The JSON serializer used to perform the conversion. + /// public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (value != null) @@ -111,6 +116,7 @@ public class PatientAppointment : JsonConverter /// The invoking the converter. /// An object representing the deserialized value. /// Always thrown, as the method has not been implemented. + /// public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { @@ -124,6 +130,7 @@ public class PatientAppointment : JsonConverter /// /// This class serves as a container or grouping mechanism for resources associated with managing patient appointment information. /// +/// public class PatientAppointmentResourceGroup { public List? Services { get; set; } @@ -147,6 +154,7 @@ public class PatientAppointmentResourceGroup /// /// Represents allergy information, serving as a model or container for allergy-related data. /// +/// public class Allergies { public Code? AllergenType { get; set; } diff --git a/adas-core.Domain/Models/PatientDiagnosis.cs b/adas-core.Domain/Models/PatientDiagnosis.cs index 0a52b6ce..d7d6d116 100644 --- a/adas-core.Domain/Models/PatientDiagnosis.cs +++ b/adas-core.Domain/Models/PatientDiagnosis.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models; /// /// Represents a diagnosis associated with a patient, encapsulating the relevant diagnostic information. /// +/// public class PatientDiagnosis { public ObjectId Id { get; set; } @@ -55,6 +56,7 @@ public class PatientDiagnosis /// /// A formatted string in the form PatientDiagnosis[field1: value1, field2: value2, ...] /// containing the diagnosis data; optional fields are omitted when null or empty. + /// public override string ToString() { List items = diff --git a/adas-core.Domain/Models/PatientDrainagesValue.cs b/adas-core.Domain/Models/PatientDrainagesValue.cs index 7dec4552..6ef8dadf 100644 --- a/adas-core.Domain/Models/PatientDrainagesValue.cs +++ b/adas-core.Domain/Models/PatientDrainagesValue.cs @@ -3,6 +3,7 @@ /// /// Represents a value associated with a patient's drainage information. /// +/// public class PatientDrainagesValue { public string? Type { get; set; } diff --git a/adas-core.Domain/Models/PatientICCA.cs b/adas-core.Domain/Models/PatientICCA.cs index 3691a418..675c7f1d 100644 --- a/adas-core.Domain/Models/PatientICCA.cs +++ b/adas-core.Domain/Models/PatientICCA.cs @@ -3,6 +3,7 @@ /// /// Represents a patient data model associated with the ICCA (IntelliSpace Critical Care and Anesthesia) system. /// +/// public class PatientIcca { public PatientLocation Location { get; set; } = new(string.Empty, string.Empty); @@ -17,6 +18,7 @@ public class PatientIcca /// Creates a deep copy of the current instance, duplicating the , , and so that modifications to the copy do not affect the original object. /// /// A new instance with independently copied reference-typed members. + /// public PatientIcca DeepCopy() { var other = (PatientIcca)MemberwiseClone(); diff --git a/adas-core.Domain/Models/PatientIntravenousLinesValue.cs b/adas-core.Domain/Models/PatientIntravenousLinesValue.cs index 347817e9..05f8a4c9 100644 --- a/adas-core.Domain/Models/PatientIntravenousLinesValue.cs +++ b/adas-core.Domain/Models/PatientIntravenousLinesValue.cs @@ -3,6 +3,8 @@ /// /// Represents a value type containing data related to a patient's intravenous lines. /// +/// public class PatientIntravenousLinesValue { public string? Type { get; set; } diff --git a/adas-core.Domain/Models/PatientLocation.cs b/adas-core.Domain/Models/PatientLocation.cs index 3821fd27..b1f887ab 100644 --- a/adas-core.Domain/Models/PatientLocation.cs +++ b/adas-core.Domain/Models/PatientLocation.cs @@ -4,6 +4,7 @@ /// Represents the location of a patient within a healthcare or clinical context. /// Implements to provide type-specific equality comparison between patient location instances. /// +/// public class PatientLocation : IEquatable { /// @@ -53,6 +54,7 @@ public class PatientLocation : IEquatable /// /// The to compare with the current instance. /// when all three properties (UnitName, Bed, and Room) match; otherwise, . Returns if is . + /// public bool Equals(PatientLocation? other) { return UnitName == other?.UnitName && Bed == other?.Bed && Room == other?.Room; @@ -62,6 +64,7 @@ public class PatientLocation : IEquatable /// Determines whether the current instance is considered empty by checking that both the and values are null or empty strings. /// /// if both UnitName and Bed are null or empty; otherwise, . + /// public bool IsEmpty() { return string.IsNullOrEmpty(UnitName) && string.IsNullOrEmpty(Bed); @@ -71,6 +74,7 @@ public class PatientLocation : IEquatable /// Determines whether the unit name, bed, and room fields are all null or empty, indicating the entity is fully empty. /// /// true if , , and are all null or empty; otherwise, false. + /// public bool IsFullEmpty() { return string.IsNullOrEmpty(UnitName) && string.IsNullOrEmpty(Bed) && string.IsNullOrEmpty(Room); @@ -80,6 +84,7 @@ public class PatientLocation : IEquatable /// Returns a human-readable string representation of the PatientLocation, including the unit name, room, and bed. /// /// A formatted string in the form "PatientLocation[Unit: {UnitName},room: {Room} ,bed: {Bed}]". + /// public override string ToString() { return "PatientLocation[Unit: " + UnitName + ",room: " + Room + " ,bed: " + Bed + "]"; diff --git a/adas-core.Domain/Models/PatientLocationAction.cs b/adas-core.Domain/Models/PatientLocationAction.cs index a79b78ac..f5537bd9 100644 --- a/adas-core.Domain/Models/PatientLocationAction.cs +++ b/adas-core.Domain/Models/PatientLocationAction.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Models; /// /// This type encapsulates an operation or behavior associated with managing or interacting with a patient's location information. /// +/// public class PatientLocationAction { public ActionsEnum.ResourceAction? Action { get; set; } @@ -21,6 +22,7 @@ public class PatientLocationAction /// /// The list of patient location actions to apply. May be null. /// The resulting produced by applying the actions, or null if no locations are produced. + /// public static List? Apply(List? actions) { return Apply(null, actions); @@ -32,6 +34,7 @@ public class PatientLocationAction /// The list of patient locations to mutate. If null, an empty list is used. /// The actions to apply to the source list. If null, no actions are applied; actions with a null Location are skipped. /// The resulting list of after applying the actions, or null if the list is empty. + /// public static List? Apply(List? source, List? actions) { source ??= []; diff --git a/adas-core.Domain/Models/PatientObservation.cs b/adas-core.Domain/Models/PatientObservation.cs index 5378ca60..a7c36aec 100644 --- a/adas-core.Domain/Models/PatientObservation.cs +++ b/adas-core.Domain/Models/PatientObservation.cs @@ -11,6 +11,7 @@ namespace adas_core.Domain.Models; /// /// This class serves as a concrete implementation of patient observation data, inheriting common observation value behavior from . /// +/// public class PatientObservation : BasePatientObservationValue { private string? _result; @@ -69,6 +70,10 @@ public class PatientObservation : BasePatientObservationValue /// Returns a string representation of the , including its value, optional min/max/warning thresholds, result, status, expiration, and persistence settings. Optional properties are only included in the output when they have non-null or, for strings, non-empty values. /// /// A formatted string in the form PatientObservation[property1: value1, ...] containing the populated properties of the observation. + /// + /// public override string ToString() { var items = ToListString(); @@ -90,6 +95,7 @@ public class PatientObservation : BasePatientObservationValue /// Creates a copy of the current instance by performing a shallow copy via MemberwiseClone and casting the cloned object back to . /// /// A instance that is a shallow copy of the current object. + /// public PatientObservation DeepCopy() { return (PatientObservation)MemberwiseClone(); diff --git a/adas-core.Domain/Models/PatientObservationAlarm.cs b/adas-core.Domain/Models/PatientObservationAlarm.cs index 3e8cf15f..4a5550c2 100644 --- a/adas-core.Domain/Models/PatientObservationAlarm.cs +++ b/adas-core.Domain/Models/PatientObservationAlarm.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models; /// /// Represents an alarm condition associated with a patient observation value, extending the base patient observation value type. /// +/// public class PatientObservationAlarm : BasePatientObservationValue { public InactivationState? InactivationState { get; set; } @@ -33,6 +34,7 @@ public class PatientObservationAlarm : BasePatientObservationValue /// /// Represents a state indicating that an entity or process is currently inactive. /// +/// public class InactivationState { public AlarmEnum.AudioVideoState? Audio { get; set; } @@ -43,6 +45,7 @@ public class InactivationState /// /// Represents a source entity, serving as a base or generic type for defining source-related data or behavior. /// +/// public class Source { public string? Code { get; set; } diff --git a/adas-core.Domain/Models/PatientRecordingAlert.cs b/adas-core.Domain/Models/PatientRecordingAlert.cs index 229eb702..728a23a3 100644 --- a/adas-core.Domain/Models/PatientRecordingAlert.cs +++ b/adas-core.Domain/Models/PatientRecordingAlert.cs @@ -6,6 +6,7 @@ /// /// Inherits common observation functionality from and specializes it to surface alert conditions associated with patient recordings. /// +/// public class PatientRecordingAlert : BasePatientObservation { public bool IsRecording { get; set; } @@ -14,6 +15,7 @@ public class PatientRecordingAlert : BasePatientObservation /// Returns a string representation of the PatientRecordingAlert, including the patient identifier, source name when available, recording status, and time. /// /// A formatted string representation of the alert's key properties. + /// public override string ToString() { var items = ToListString(); diff --git a/adas-core.Domain/Models/PatientTreatment.cs b/adas-core.Domain/Models/PatientTreatment.cs index 4dec7f71..9d471712 100644 --- a/adas-core.Domain/Models/PatientTreatment.cs +++ b/adas-core.Domain/Models/PatientTreatment.cs @@ -13,6 +13,7 @@ namespace adas_core.Domain.Models; /// /// This converter overrides the default JSON conversion behavior to control how objects are written to and read from JSON. /// +/// public class PatientTreatment : JsonConverter { //If bolopom plus to bolus opiates. @@ -86,6 +87,8 @@ public class PatientTreatment : JsonConverter /// Returns a string representation of the PatientTreatment instance, including its core identifiers, order details, timing fields, requested give codes, notes, and routes. Non-null or non-empty properties are appended to the output, and in case of an exception during formatting, an error message containing the exception detail is returned instead. /// /// A formatted string summarizing the PatientTreatment fields, or an error message if formatting fails. + /// public override string ToString() { try @@ -147,6 +150,8 @@ public class PatientTreatment : JsonConverter /// The to which the JSON representation of the value will be written. /// The object to serialize. If null, the method performs no action. /// The used to perform the serialization of nested objects. + /// public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (value != null) @@ -165,6 +170,7 @@ public class PatientTreatment : JsonConverter /// /// The object instance whose property should receive the attribute. /// The name of the property to which the attribute will be added. + /// private static void AddStringEnumConverterAttribute(object value, string propertyName) { var prop = value.GetType().GetProperty(propertyName); @@ -199,6 +205,8 @@ public class PatientTreatment : JsonConverter /// The invoking this converter. /// An object of the specified type deserialized from the JSON. /// Always thrown because the method has not been implemented. + /// public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { @@ -211,6 +219,10 @@ public class PatientTreatment : JsonConverter /// The type to check for conversion support. /// if the converter can convert the specified type; otherwise, . /// Always thrown because the method is not yet implemented. + /// + /// public override bool CanConvert(Type objectType) { throw new NotImplementedException(); diff --git a/adas-core.Domain/Models/Person.cs b/adas-core.Domain/Models/Person.cs index 69f66190..46847379 100644 --- a/adas-core.Domain/Models/Person.cs +++ b/adas-core.Domain/Models/Person.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Models; /// /// Implements to define a strongly typed Equals(T)"/> method for comparing objects. /// +/// public class Person : IEquatable { public string? LastName { get; set; } @@ -34,6 +35,7 @@ public class Person : IEquatable /// /// The to compare with the current instance. /// true if all compared personal attributes and identifiers match; otherwise, false. + /// public bool Equals(Person? other) { return other != null && @@ -50,6 +52,7 @@ public class Person : IEquatable /// /// The dictionary of patient identifiers to assign as the current identifiers and to record historically. /// The optional timestamp for the historical entry. If null, is used. + /// public void SetIds(Dictionary patientIds, DateTime? time = null) { Ids = patientIds; @@ -76,6 +79,7 @@ public class Person : IEquatable /// Determines whether the patient instance contains no meaningful data by checking that the last name, first name, second name, and birth date are unset, the gender is unknown, and the identifiers collection is null or empty. /// /// true if all relevant patient fields are null, empty, or set to their default unknown value; otherwise, false. + /// public bool IsEmpty() { return string.IsNullOrEmpty(LastName) && string.IsNullOrEmpty(FirstName) && string.IsNullOrEmpty(SecondName) && @@ -88,6 +92,7 @@ public class Person : IEquatable /// and the gender is set to . /// /// true if the patient's personal data fields are empty and gender is unknown; otherwise, false. + /// public bool IsEmptyDontCheckIds() { return string.IsNullOrEmpty(LastName) && string.IsNullOrEmpty(FirstName) && string.IsNullOrEmpty(SecondName) && @@ -104,6 +109,7 @@ public class Person : IEquatable /// /// The other whose identifiers are compared against this instance. /// true if both identifier collections are null or contain the same key-value pairs; otherwise, false. + /// private bool CheckIdsAreEqual(Person other) { if (Ids == null && other.Ids == null) return true; @@ -138,6 +144,7 @@ public class Person : IEquatable /// Returns a string representation of the Person, including the non-empty/non-null properties such as first name, last name, second name, birth date, language, gender, and identifiers. /// /// A formatted string in the form "Person[prop1: value1, prop2: value2, ...]" containing the person's populated fields. + /// public override string ToString() { List items = []; diff --git a/adas-core.Domain/Models/PersonResource.cs b/adas-core.Domain/Models/PersonResource.cs index 217c0f33..9c02003d 100644 --- a/adas-core.Domain/Models/PersonResource.cs +++ b/adas-core.Domain/Models/PersonResource.cs @@ -3,6 +3,7 @@ /// /// Represents a Person resource, typically used as a data transfer or API resource model for person-related information. /// +/// public class PersonResource { public Person? Person { get; set; } diff --git a/adas-core.Domain/Models/PersonResourceAction.cs b/adas-core.Domain/Models/PersonResourceAction.cs index cc664184..ccec8297 100644 --- a/adas-core.Domain/Models/PersonResourceAction.cs +++ b/adas-core.Domain/Models/PersonResourceAction.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Models; /// /// Typically used to model operations, commands, or permissions associated with a person entity within a resource-based system. /// +/// public class PersonResourceAction { public ActionsEnum.ResourceAction? Action { get; set; } @@ -22,6 +23,7 @@ public class PersonResourceAction /// /// The list of actions to be applied. /// A containing the result of applying the actions. + /// public static List? Apply(List actions) { return Apply(null, actions); @@ -34,6 +36,7 @@ public class PersonResourceAction /// The source list of person resources to mutate. If null, an empty list is used. /// The list of resource actions (add, delete, update) to apply to the source. If null, no actions are applied. /// The resulting list of person resources after applying the actions, or null if the resulting list is empty. + /// public static List? Apply(List? source, List? actions) { source ??= []; diff --git a/adas-core.Domain/Models/Providers/ProvidersSettings.cs b/adas-core.Domain/Models/Providers/ProvidersSettings.cs index a734a0c5..589cf115 100644 --- a/adas-core.Domain/Models/Providers/ProvidersSettings.cs +++ b/adas-core.Domain/Models/Providers/ProvidersSettings.cs @@ -3,6 +3,7 @@ /// /// Represents the configuration settings used to manage and configure providers within the application. /// +/// public class ProvidersSettings { public string Name { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/Providers/ResultModelPredictMedicationADAS.cs b/adas-core.Domain/Models/Providers/ResultModelPredictMedicationADAS.cs index b2c398f7..5abc5598 100644 --- a/adas-core.Domain/Models/Providers/ResultModelPredictMedicationADAS.cs +++ b/adas-core.Domain/Models/Providers/ResultModelPredictMedicationADAS.cs @@ -6,6 +6,7 @@ /// /// This class is intended to be inherited by concrete result model types that provide specific prediction logic for medication-related ADAS assessments. /// +/// public abstract class ResultModelPredictMedicationAdas { public string MedicineIdentifier { get; set; } = string.Empty; @@ -28,6 +29,7 @@ public abstract class ResultModelPredictMedicationAdas /// Returns a string representation combining the medicine text and its degree of similarity, separated by a pipe character. /// /// A formatted string containing the MedicineText and DegreeSimilarity values joined by a pipe (|) separator. + /// public override string ToString() { return $"{MedicineText} | {DegreeSimilarity}"; diff --git a/adas-core.Domain/Models/Providers/ResultModelPredictOfStayADAS.cs b/adas-core.Domain/Models/Providers/ResultModelPredictOfStayADAS.cs index 0c874a30..49467e85 100644 --- a/adas-core.Domain/Models/Providers/ResultModelPredictOfStayADAS.cs +++ b/adas-core.Domain/Models/Providers/ResultModelPredictOfStayADAS.cs @@ -6,6 +6,7 @@ /// /// This type serves as a data container for prediction outcomes produced by the ADAS stay prediction process. /// +/// public class ResultModelPredictOfStayAdas { public string Result { get; set; } = string.Empty; @@ -19,6 +20,7 @@ public class ResultModelPredictOfStayAdas /// /// As an abstract class, cannot be instantiated directly and must be extended by a concrete subclass. /// +/// public abstract class Payload { public double PercentageMin { get; set; } diff --git a/adas-core.Domain/Models/Pumps/CommonPumpTypes.cs b/adas-core.Domain/Models/Pumps/CommonPumpTypes.cs index 626a0ee4..afdbd0ba 100644 --- a/adas-core.Domain/Models/Pumps/CommonPumpTypes.cs +++ b/adas-core.Domain/Models/Pumps/CommonPumpTypes.cs @@ -4,6 +4,7 @@ /// Serves as an abstract base class for representing common pump types. /// Provides a shared foundation for derived classes that define specific pump categorizations. /// +/// public abstract class CommonPumpTypes { // Tipos auxiliares para valores con unidades (idénticos a PatientPumpObservation pero anidados aquí) @@ -11,6 +12,7 @@ public abstract class CommonPumpTypes /// /// Represents a value associated with a pump operation or measurement. /// + /// public class PumpValue { public double? Value { get; set; } @@ -19,12 +21,14 @@ public abstract class CommonPumpTypes /// Returns a string representation of the measurement, including its value and units. /// /// A formatted string containing the Value and Units of the measurement. + /// public override string ToString() => $"{{Value: {Value}, Units: {Units}}}"; } /// /// Represents a container for detailed information about a syringe. /// + /// public class SyringeDetails { public string? Type { get; set; } diff --git a/adas-core.Domain/Models/Pumps/PumpAlarmEvent.cs b/adas-core.Domain/Models/Pumps/PumpAlarmEvent.cs index 7c02038d..ae9141c5 100644 --- a/adas-core.Domain/Models/Pumps/PumpAlarmEvent.cs +++ b/adas-core.Domain/Models/Pumps/PumpAlarmEvent.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.Pumps; /// /// Represents an event related to a pump alarm, encapsulating data raised when an alarm condition is detected on a pump. /// +/// public class PumpAlarmEvent { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/Pumps/PumpAlarmState.cs b/adas-core.Domain/Models/Pumps/PumpAlarmState.cs index 50167566..f29bda10 100644 --- a/adas-core.Domain/Models/Pumps/PumpAlarmState.cs +++ b/adas-core.Domain/Models/Pumps/PumpAlarmState.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.Pumps /// Una fila por alarma activa (DeviceId + AlarmType o AlarmCodeMdc). /// Se actualiza vía PumpService: start/continue → upsert, end → delete. /// + /// public class PumpAlarmState { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/Pumps/PumpObservation.cs b/adas-core.Domain/Models/Pumps/PumpObservation.cs index 87ee5193..892ef71e 100644 --- a/adas-core.Domain/Models/Pumps/PumpObservation.cs +++ b/adas-core.Domain/Models/Pumps/PumpObservation.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.Pumps /// de observaciones (PCD-01/10), alarmas (PCD-04) y eventos. El servicio /// decidirá cómo dividir y persistir en las colecciones destino. /// + /// public class PumpObservation { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/Pumps/PumpState.cs b/adas-core.Domain/Models/Pumps/PumpState.cs index ce0b058e..ff78eb2a 100644 --- a/adas-core.Domain/Models/Pumps/PumpState.cs +++ b/adas-core.Domain/Models/Pumps/PumpState.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.Pumps /// Se sobrescribe con cada mensaje del HL7. /// Contiene siempre el último valor conocido de la bomba. /// + /// public class PumpState { public ObjectId Id { get; set; } diff --git a/adas-core.Domain/Models/Recording/AccessGrant.cs b/adas-core.Domain/Models/Recording/AccessGrant.cs index 0ef7dfa9..037997b6 100644 --- a/adas-core.Domain/Models/Recording/AccessGrant.cs +++ b/adas-core.Domain/Models/Recording/AccessGrant.cs @@ -3,6 +3,7 @@ /// /// Represents a grant of access, typically used to convey permissions or authorization rights within a system. /// +/// public class AccessGrant { private int _expiresIn; diff --git a/adas-core.Domain/Models/Recording/Patient.cs b/adas-core.Domain/Models/Recording/Patient.cs index e9d1674d..b29e4301 100644 --- a/adas-core.Domain/Models/Recording/Patient.cs +++ b/adas-core.Domain/Models/Recording/Patient.cs @@ -3,6 +3,7 @@ /// /// Represents a patient entity within the system, encapsulating patient-related data and behavior. /// +/// public class Patient { /// diff --git a/adas-core.Domain/Models/Recording/RecordingData.cs b/adas-core.Domain/Models/Recording/RecordingData.cs index 554ab1bf..d044df6d 100644 --- a/adas-core.Domain/Models/Recording/RecordingData.cs +++ b/adas-core.Domain/Models/Recording/RecordingData.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Models.Recording; /// /// Represents a data container for recording-related information. /// +/// public class RecordingData { public Patient? Patient { get; set; } @@ -25,6 +26,7 @@ public class RecordingData /// Generates a unique store identifier by combining the RoomId with the current timestamp formatted as yyyyMMdd-HHmmss, and assigns it to the Store property. /// /// A formatted store identifier string in the pattern "RoomId_yyyyMMdd-HHmmss". + /// public string GenerateStore() { return Store = $"{RoomId}_{DateTime.Now:yyyyMMdd-HHmmss}"; @@ -34,6 +36,7 @@ public class RecordingData /// Returns a compact JSON representation of the current object. If JSON serialization fails for any reason, falls back to the base implementation. /// /// A JSON string produced by with , or the result of the base when serialization throws. + /// public override string ToString() { try diff --git a/adas-core.Domain/Models/Responses/BeaconResponse.cs b/adas-core.Domain/Models/Responses/BeaconResponse.cs index 4d4f3183..1cc1c4f1 100644 --- a/adas-core.Domain/Models/Responses/BeaconResponse.cs +++ b/adas-core.Domain/Models/Responses/BeaconResponse.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Models.Responses; /// /// Implements to enable value-based equality comparison between instances. /// +/// public class BeaconResponse(string color, ObjectId poc, ObjectId unitId) : IEquatable { private string Color { get; } = color; @@ -20,6 +21,7 @@ public class BeaconResponse(string color, ObjectId poc, ObjectId unitId) : IEqua /// /// The to compare with the current instance. /// if both PointOfCareId and UnitId match; otherwise, . + /// public bool Equals(BeaconResponse? other) { return PointOfCareId == other?.PointOfCareId && UnitId == other.UnitId; @@ -29,6 +31,7 @@ public class BeaconResponse(string color, ObjectId poc, ObjectId unitId) : IEqua /// Returns a string representation of the BeaconResponse, including the point of care identifier, unit (bed) identifier, and color. /// /// A formatted string describing the beacon's point of care, unit, and color. + /// public override string ToString() { return "BeaconResponse[pointOfCare: " + PointOfCareId + ", bed: " + UnitId + ", color: " + Color + "]"; diff --git a/adas-core.Domain/Models/Responses/BoxObservationsResponse.cs b/adas-core.Domain/Models/Responses/BoxObservationsResponse.cs index 5bf35a2f..de6c4d32 100644 --- a/adas-core.Domain/Models/Responses/BoxObservationsResponse.cs +++ b/adas-core.Domain/Models/Responses/BoxObservationsResponse.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.Responses; /// /// Represents a response containing a collection of observations related to a box. /// +/// public class BoxObservationsResponse { public List Medication = []; diff --git a/adas-core.Domain/Models/Responses/DisplayConfigMinimalResponse.cs b/adas-core.Domain/Models/Responses/DisplayConfigMinimalResponse.cs index 2d4cb31e..2d872e29 100644 --- a/adas-core.Domain/Models/Responses/DisplayConfigMinimalResponse.cs +++ b/adas-core.Domain/Models/Responses/DisplayConfigMinimalResponse.cs @@ -10,6 +10,7 @@ namespace adas_core.Domain.Models.Responses; /// /// This class is typically used to convey a lightweight subset of display configuration information in API responses or inter-component communication. /// +/// public class DisplayConfigMinimalResponse { /// diff --git a/adas-core.Domain/Models/Responses/LoginResponse.cs b/adas-core.Domain/Models/Responses/LoginResponse.cs index 5e679bc1..2bfcb307 100644 --- a/adas-core.Domain/Models/Responses/LoginResponse.cs +++ b/adas-core.Domain/Models/Responses/LoginResponse.cs @@ -3,6 +3,7 @@ /// /// Represents the response data returned from a login operation. /// +/// public class LoginResponse { public string Token { get; set; } = ""; @@ -14,6 +15,7 @@ public class LoginResponse /// Returns true when the expiration date has passed, or when no expiration date has been set (i.e., ), treating unset expirations as expired. /// /// true if the item is expired or has no expiration date set; otherwise, false. + /// public bool IsExpired() { if (Expiration != DateTime.MinValue) diff --git a/adas-core.Domain/Models/Responses/PaginationResponse.cs b/adas-core.Domain/Models/Responses/PaginationResponse.cs index 537145c1..c62003ca 100644 --- a/adas-core.Domain/Models/Responses/PaginationResponse.cs +++ b/adas-core.Domain/Models/Responses/PaginationResponse.cs @@ -4,6 +4,7 @@ /// Represents a generic response wrapper for paginated data, typically used to return a subset of items along with associated pagination metadata. /// /// The type of the items contained in the paginated response. +/// public class PaginationResponse { /// diff --git a/adas-core.Domain/Models/Responses/Response.cs b/adas-core.Domain/Models/Responses/Response.cs index 81989a9d..cc181e7e 100644 --- a/adas-core.Domain/Models/Responses/Response.cs +++ b/adas-core.Domain/Models/Responses/Response.cs @@ -4,6 +4,7 @@ /// Represents a generic response wrapper that encapsulates a payload of type along with associated response metadata. /// /// The type of the payload contained within the response. +/// public class Response { /// diff --git a/adas-core.Domain/Models/SignalR/Message.cs b/adas-core.Domain/Models/SignalR/Message.cs index 3bc125ab..58360f33 100644 --- a/adas-core.Domain/Models/SignalR/Message.cs +++ b/adas-core.Domain/Models/SignalR/Message.cs @@ -7,6 +7,7 @@ namespace adas_core.Domain.Models.SignalR; /// /// Represents a message, typically used for communication or data transfer between components. /// +/// public class Message { public long IdMessage { get; set; } @@ -30,6 +31,7 @@ public class Message /// Returns a JSON representation of the current object, falling back to the default implementation if serialization fails. /// /// A JSON-formatted string describing the object, or the result of the base method if serialization throws an exception. + /// public override string? ToString() { try diff --git a/adas-core.Domain/Models/SignalR/MessageData.cs b/adas-core.Domain/Models/SignalR/MessageData.cs index 1e02ae03..908ee819 100644 --- a/adas-core.Domain/Models/SignalR/MessageData.cs +++ b/adas-core.Domain/Models/SignalR/MessageData.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Models.SignalR; /// /// Represents data associated with a message, providing a structure for storing and transporting message-related information. /// +/// public class MessageData { public bool IsDemo { get; set; } = false; diff --git a/adas-core.Domain/Models/SignalR/Recording.cs b/adas-core.Domain/Models/SignalR/Recording.cs index 3c3404df..51b415d2 100644 --- a/adas-core.Domain/Models/SignalR/Recording.cs +++ b/adas-core.Domain/Models/SignalR/Recording.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Models.SignalR; /// /// Represents a recording, encapsulating data and behavior associated with a captured event or media. /// +/// public class Recording { public string Id { get; set; } = null!; diff --git a/adas-core.Domain/Models/SystemAlerts/ApiClients.cs b/adas-core.Domain/Models/SystemAlerts/ApiClients.cs index 6949bd8d..347a7399 100644 --- a/adas-core.Domain/Models/SystemAlerts/ApiClients.cs +++ b/adas-core.Domain/Models/SystemAlerts/ApiClients.cs @@ -3,6 +3,7 @@ /// /// Represents a collection or container of API client instances, providing centralized access to various external service clients. /// +/// public class ApiClients { public string? Name { get; set; } diff --git a/adas-core.Domain/Models/SystemAlerts/Performance.cs b/adas-core.Domain/Models/SystemAlerts/Performance.cs index 8de931fd..2d400dfa 100644 --- a/adas-core.Domain/Models/SystemAlerts/Performance.cs +++ b/adas-core.Domain/Models/SystemAlerts/Performance.cs @@ -3,6 +3,7 @@ /// /// Represents a performance-related entity, such as a metric, measurement, or record used to track and evaluate performance data. /// +/// public class Performance { public string? Name { get; set; } diff --git a/adas-core.Domain/Models/SystemAlerts/Queue.cs b/adas-core.Domain/Models/SystemAlerts/Queue.cs index cb8aee6e..a49dc738 100644 --- a/adas-core.Domain/Models/SystemAlerts/Queue.cs +++ b/adas-core.Domain/Models/SystemAlerts/Queue.cs @@ -3,6 +3,7 @@ /// /// Represents a queue, a data structure that follows the First In, First Out (FIFO) principle for managing elements. /// +/// public class Queue { public string? Name { get; set; } diff --git a/adas-core.Domain/Models/Timing.cs b/adas-core.Domain/Models/Timing.cs index 323be73e..adf4e28c 100644 --- a/adas-core.Domain/Models/Timing.cs +++ b/adas-core.Domain/Models/Timing.cs @@ -4,6 +4,7 @@ /// Represents a utility or component related to timing operations. /// Provides functionality for measuring, tracking, or managing time-related behavior. /// +/// public class Timing { public DateTime? StartTime { get; set; } diff --git a/adas-core.Domain/Models/TreatmentRoute.cs b/adas-core.Domain/Models/TreatmentRoute.cs index 7175698e..139fb753 100644 --- a/adas-core.Domain/Models/TreatmentRoute.cs +++ b/adas-core.Domain/Models/TreatmentRoute.cs @@ -3,6 +3,7 @@ /// /// Represents a treatment route, defining the pathway or method by which a treatment is administered or delivered. /// +/// public class TreatmentRoute { public Code? Route { get; set; } @@ -11,6 +12,7 @@ public class TreatmentRoute /// Returns a string representation of the treatment route, including the route code when available. /// /// A formatted string identifying the treatment route, with the route code appended if Route is not null. + /// public override string ToString() { List items = []; diff --git a/adas-core.Domain/Models/UiConfig.cs b/adas-core.Domain/Models/UiConfig.cs index 25bfdf2b..fb5ebb41 100644 --- a/adas-core.Domain/Models/UiConfig.cs +++ b/adas-core.Domain/Models/UiConfig.cs @@ -3,6 +3,7 @@ /// /// Represents the configuration settings for the user interface. /// +/// public class UiConfig { public Dictionary? UiConfiguration; diff --git a/adas-core.Domain/Models/ValueConfig.cs b/adas-core.Domain/Models/ValueConfig.cs index 4a1cd98c..11a65b2b 100644 --- a/adas-core.Domain/Models/ValueConfig.cs +++ b/adas-core.Domain/Models/ValueConfig.cs @@ -3,6 +3,7 @@ /// /// Represents a value configuration entity used to encapsulate configurable data or settings. /// +/// public class ValueCondif { public string Obsid { get; set; } = string.Empty; diff --git a/adas-core.Domain/Models/WebMessageNotification.cs b/adas-core.Domain/Models/WebMessageNotification.cs index f4096ff1..b3cb6aa5 100644 --- a/adas-core.Domain/Models/WebMessageNotification.cs +++ b/adas-core.Domain/Models/WebMessageNotification.cs @@ -6,6 +6,7 @@ /// /// This type encapsulates the data required to send or describe a web message notification to a recipient. /// +/// public class WebMessageNotification { //{"notification": diff --git a/adas-core.Domain/Permissions.cs b/adas-core.Domain/Permissions.cs index 1abdfa53..6534e323 100644 --- a/adas-core.Domain/Permissions.cs +++ b/adas-core.Domain/Permissions.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain; /// /// Represents a set of permissions, providing functionality related to access control and authorization. /// +/// public class Permissions { public SourcePermissions Write { get; set; } = new() @@ -24,6 +25,7 @@ public class Permissions /// /// This class encapsulates permission-related information for a given source context. /// +/// public class SourcePermissions { public List Actions { get; set; } = []; diff --git a/adas-core.Domain/QueryCustomizer.cs b/adas-core.Domain/QueryCustomizer.cs index b808da71..1106037f 100644 --- a/adas-core.Domain/QueryCustomizer.cs +++ b/adas-core.Domain/QueryCustomizer.cs @@ -29,6 +29,7 @@ namespace adas_core.Domain; /// /// /// +/// public class QueryCustomizer where T : class { private readonly List>> _includeLinqExpressions = []; @@ -38,6 +39,7 @@ public class QueryCustomizer where T : class /// Creates and returns a new instance of the class. /// /// A new instance. + /// public static QueryCustomizer New() { return new QueryCustomizer(); @@ -48,6 +50,7 @@ public class QueryCustomizer where T : class /// /// A lambda expression selecting the related entity to include in the query results. /// The current instance to allow fluent chaining of additional includes or customizations. + /// public QueryCustomizer Include(Expression> includeExpression) { _includeLinqExpressions.Add(includeExpression); @@ -59,6 +62,7 @@ public class QueryCustomizer where T : class /// /// The expressions specifying the related entities to include in the query. /// The current instance to support fluent method chaining. + /// public QueryCustomizer Include(params Expression>[] includeExpressions) { _includeLinqExpressions.AddRange(includeExpressions); @@ -70,6 +74,7 @@ public class QueryCustomizer where T : class /// /// The include expression to be added to the collection of include expressions. /// The current instance with the include expression added. + /// public QueryCustomizer Include(string includeExpression) { _includeLinqStringExpressions.Add(includeExpression); @@ -81,6 +86,7 @@ public class QueryCustomizer where T : class /// /// The string expressions representing the related entities or paths to include in the query. /// The current instance to enable fluent method chaining. + /// public QueryCustomizer Include(params string[] includeExpressions) { _includeLinqStringExpressions.AddRange(includeExpressions); @@ -94,6 +100,7 @@ public class QueryCustomizer where T : class /// /// The source queryable to which the include expressions will be applied. /// An with all configured include expressions applied. + /// public IQueryable AddToQueryable(IQueryable queryable) { var resultQueryable = queryable; diff --git a/adas-core.Domain/Utils/AuthUtils.cs b/adas-core.Domain/Utils/AuthUtils.cs index 89ac6bea..cea0049b 100644 --- a/adas-core.Domain/Utils/AuthUtils.cs +++ b/adas-core.Domain/Utils/AuthUtils.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Utils; /// /// This class is sealed and cannot be inherited. /// +/// public sealed class AuthUtils { private LoginResponse _loginResponse = new(); @@ -55,6 +56,7 @@ public sealed class AuthUtils /// Retrieves the current in a thread-safe manner by acquiring a lock on the underlying field. /// /// The current instance. + /// public LoginResponse GetLoginResponse() { lock (_loginResponse) diff --git a/adas-core.Domain/Utils/BsonUtils.cs b/adas-core.Domain/Utils/BsonUtils.cs index 930b2ffd..2308afca 100644 --- a/adas-core.Domain/Utils/BsonUtils.cs +++ b/adas-core.Domain/Utils/BsonUtils.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Utils; /// /// Provides static utility methods for working with BSON (Binary JSON) data. /// +/// public static class BsonUtils { /// @@ -12,6 +13,7 @@ public static class BsonUtils /// /// The instance to convert to a CLR object. /// The underlying CLR value when is an Int32, Int64, Double, valid DateTime (in UTC), or String; otherwise . + /// public static object? ToObject(this BsonValue val) { if (val.IsInt32) return val.AsInt32; @@ -33,6 +35,7 @@ public static class BsonUtils /// The BSON document to search for the key. /// The key of the value to retrieve. /// The associated with , or null if the key does not exist. + /// public static BsonValue? Get(this BsonDocument doc, string key) { return doc.TryGetValue(key, out var value) ? value : null; diff --git a/adas-core.Domain/Utils/CacheUtils.cs b/adas-core.Domain/Utils/CacheUtils.cs index a15a1019..ed263aa8 100644 --- a/adas-core.Domain/Utils/CacheUtils.cs +++ b/adas-core.Domain/Utils/CacheUtils.cs @@ -14,6 +14,7 @@ namespace adas_core.Domain.Utils /// - Caída a GlobalSeconds del backend si no hay TTL específico /// - Si el TTL resultante es null o menor o igual a 0 sin expiración /// + /// public static class CacheKeyTtl { /// @@ -21,6 +22,7 @@ namespace adas_core.Domain.Utils /// /// The number of seconds to convert. /// A representing , or null when is null or less than or equal to zero. + /// private static TimeSpan? SecondsOrNull(int? seconds) => seconds is > 0 ? TimeSpan.FromSeconds(seconds.Value) @@ -32,6 +34,7 @@ namespace adas_core.Domain.Utils /// A function that selects the desired value from a instance. /// The cache settings whose in-memory TTL configuration is used as the source. /// The nullable integer value produced by applying to the in-memory . + /// private static int? FromInMemory(Func selector, CacheSettings s) => selector(s.InMemory.Ttl); @@ -42,6 +45,7 @@ namespace adas_core.Domain.Utils /// A function that derives a nullable integer from a instance, or null to short-circuit the operation. /// The cache settings whose Redis TTL configuration will be inspected, or null to use a default . /// The nullable integer produced by invoking the selector on the resolved , or null if the selector is null. + /// private static int? FromRedis(Func? selector, CacheSettings? s) => selector?.Invoke(s?.Redis.Ttl ?? new TtlSettings()); @@ -50,6 +54,7 @@ namespace adas_core.Domain.Utils /// /// The cache settings containing the in-memory TTL configuration, or null. /// A representing the global in-memory TTL converted from seconds, or null if is null or the global seconds value is not set. + /// private static TimeSpan? GlobalInMemory(CacheSettings? s) => SecondsOrNull(s?.InMemory.Ttl.GlobalSeconds); @@ -58,12 +63,19 @@ namespace adas_core.Domain.Utils /// /// The cache settings containing the Redis TTL configuration, or null. /// A representing the global Redis TTL, or null if the configuration is unavailable. + /// private static TimeSpan? GlobalRedis(CacheSettings? s) => SecondsOrNull(s?.Redis.Ttl.GlobalSeconds); /// /// Resuelve TTL para una entidad concreta, respetando el backend configurado para dicha entidad. /// + /// + /// + /// public static TimeSpan? ResolveForEntity(CacheSettings? settings, CacheEnum.EntityType entity) { // Selección del backend según la entidad @@ -115,6 +127,7 @@ namespace adas_core.Domain.Utils /// /// Dada una clave, clasifica la entidad y resuelve el TTL para esa clave. /// + /// public static TimeSpan? ResolveForKey(CacheSettings settings, string key) { var entity = CacheKeyClassifier.Classify(key); @@ -129,6 +142,7 @@ namespace adas_core.Domain.Utils /// - Prefijos normalizados para que el CacheDispatcher clasifique el backend. /// - Overloads "KeyWithTtl" para devolver (key, ttl) en una llamada. /// + /// public static class CacheKeys { #region ConfigObservations @@ -137,6 +151,7 @@ namespace adas_core.Domain.Utils /// Returns the configuration key string "configObservations:all", typically used to identify a setting or cache entry related to all configuration observations. /// /// The string "configObservations:all". + /// public static string ConfigObservationsAll() => "configObservations:all"; @@ -163,6 +178,7 @@ namespace adas_core.Domain.Utils /// /// The identifier of the display whose base key is being generated. /// A formatted key string combining the display section, the display identifier, and the "base" suffix. + /// public static string DisplayBase(ObjectId displayId) => $"configDisplays:display:{displayId}:base"; @@ -172,6 +188,7 @@ namespace adas_core.Domain.Utils /// Optional cache settings used to resolve the TTL for display entities. When null, a default TTL is applied. /// The identifier of the display used to compose the base cache key. /// A tuple containing the generated cache key and the resolved TTL for the display entity. + /// public static (string Key, TimeSpan? Ttl) DisplayBaseKeyWithTtl( CacheSettings? settings, ObjectId displayId) @@ -186,6 +203,7 @@ namespace adas_core.Domain.Utils /// /// The identifier of the display whose configuration key is being generated. /// A formatted string key in the form "configDisplays:display:{displayId}:config" representing the display's configuration entry. + /// public static string DisplayWithConfig(ObjectId displayId) => $"configDisplays:display:{displayId}:config"; @@ -195,6 +213,7 @@ namespace adas_core.Domain.Utils /// The cache settings used to resolve the TTL for the display entity; may be null. /// The identifier of the display entity for which the cache key is generated. /// A tuple containing the generated cache key and the resolved TTL, which may be null if no TTL is configured. + /// public static (string Key, TimeSpan? Ttl) DisplayWithConfigKeyWithTtl( CacheSettings? settings, ObjectId displayId) @@ -212,6 +231,7 @@ namespace adas_core.Domain.Utils /// /// The unique identifier of the Point of Care entity whose base reference key is being generated. /// A formatted string that combines the "pointOfCare" prefix, the provided , and the "base" suffix to uniquely identify the base resource of the Point of Care. + /// public static string PointOfCareBase(ObjectId pocId) => $"pointOfCare:{pocId}:base"; @@ -221,6 +241,7 @@ namespace adas_core.Domain.Utils /// The cache settings used by the TTL resolver. May be null, in which case the resolver falls back to its default behavior. /// The identifier of the Point of Care entity used to generate the cache key. /// A tuple containing the generated cache key and the resolved TTL, which may be null when no expiration is configured. + /// public static (string Key, TimeSpan? Ttl) PointOfCareBaseKeyWithTtl( CacheSettings? settings, ObjectId pocId) { @@ -234,6 +255,7 @@ namespace adas_core.Domain.Utils /// /// The identifier of the point of care used to compose the cache key. /// A formatted cache key string in the form pointOfCare:{pocId}:withInfo. + /// public static string PointOfCareWithInfoKeyWithTtl(ObjectId pocId) => $"pointOfCare:{pocId}:withInfo"; @@ -243,6 +265,7 @@ namespace adas_core.Domain.Utils /// Optional cache settings used to resolve the TTL for the point of care entity. May be null. /// The identifier of the point of care used to build the cache key. /// A tuple containing the generated cache key and the resolved TTL, which may be null when no TTL is configured. + /// public static (string Key, TimeSpan? Ttl) PointOfCareWithInfoKeyWithTtl( CacheSettings? settings, ObjectId pocId) { @@ -261,6 +284,7 @@ namespace adas_core.Domain.Utils /// The collection of field names to include in the key, normalized via Normalize. /// Optional maximum number of recent observations to consider; when null, defaults to 0. /// A formatted cache key string combining the patient id, normalized field names, and the last value. + /// public static string LatestObservations(ObjectId patientId, IEnumerable fieldNames, int? last = null) => $"patients:latestObs:{patientId}:{Normalize(fieldNames)}:{last ?? 0}"; @@ -273,6 +297,7 @@ namespace adas_core.Domain.Utils /// The collection of field names to include in the latest observations cache key. /// The optional number of most recent observations to consider when building the cache key. /// A tuple containing the generated cache key and the resolved TTL for the cache entry. + /// public static (string Key, TimeSpan? Ttl) LatestObservationsKeyWithTtl( CacheSettings? settings, ObjectId patientId, IEnumerable fieldNames, int? last = null) { @@ -290,6 +315,7 @@ namespace adas_core.Domain.Utils /// The unique identifier of the patient whose latest pump observations are being requested. /// The optional number of most recent pump observation entries to include; when null, zero is used as a fallback. /// A formatted cache key string of the form pumpObs:latest:{patientId}:{last}, with last resolved to 0 when null. + /// public static string LatestPumps(ObjectId patientId, int? last = null) => $"pumpObs:latest:{patientId}:{last ?? 0}"; @@ -300,6 +326,7 @@ namespace adas_core.Domain.Utils /// The identifier of the patient whose latest pump observations are being cached. /// The optional maximum number of latest pump entries to include in the cache key. /// A tuple containing the generated cache key and the resolved TTL, which may be if no TTL is configured. + /// public static (string Key, TimeSpan? Ttl) LatestPumpsKeyWithTtl( CacheSettings settings, ObjectId patientId, int? last = null) { @@ -316,6 +343,7 @@ namespace adas_core.Domain.Utils /// /// The unique identifier of the patient whose appointments are being keyed. /// A formatted cache key string combining the patient identifier and the current UTC date. + /// public static string PatientAppointmentsToday(ObjectId patientId) { var dateKey = DateTime.UtcNow.ToString("yyyyMMdd"); @@ -328,6 +356,7 @@ namespace adas_core.Domain.Utils /// Optional cache settings used to resolve the TTL for the appointments entity. /// The identifier of the patient whose appointments cache key is being generated. /// A tuple containing the generated cache key and the resolved TTL, which may be null when no TTL is configured. + /// public static (string Key, TimeSpan? Ttl) PatientAppointmentsTodayKeyWithTtl( CacheSettings? settings, ObjectId patientId) @@ -342,6 +371,7 @@ namespace adas_core.Domain.Utils /// /// The identifier of the Point of Contact whose appointments are being keyed. /// A formatted cache key string combining the PoC identifier and today's UTC date in yyyyMMdd format. + /// public static string PocAppointmentsToday(ObjectId pocId) { var dateKey = DateTime.UtcNow.ToString("yyyyMMdd"); @@ -354,6 +384,7 @@ namespace adas_core.Domain.Utils /// The cache settings used to resolve the TTL; may be null when no settings are supplied. /// The identifier of the Point of Care whose today's appointments cache key is being generated. /// A tuple containing the generated cache key and the resolved TTL as a nullable . + /// public static (string Key, TimeSpan? Ttl) PocAppointmentsTodayKeyWithTtl( CacheSettings? settings, ObjectId pocId) @@ -372,6 +403,7 @@ namespace adas_core.Domain.Utils /// The unique identifier of the patient whose grouped observations are being addressed. /// The name of the grouped field used to categorize the observations. /// A formatted string in the pattern groupedObs:{groupedFieldName}:patient:{patientId}. + /// public static string GroupedObs(ObjectId patientId, string groupedFieldName) => $"groupedObs:{groupedFieldName}:patient:{patientId}"; @@ -382,6 +414,7 @@ namespace adas_core.Domain.Utils /// The identifier of the patient whose grouped observations are being cached. /// The name of the grouped field used to compose the cache key. /// A tuple containing the generated cache key and the resolved TTL, which may be null when no expiry is configured. + /// public static (string Key, TimeSpan? Ttl) GroupedObsKeyWithTtl( CacheSettings? settings, ObjectId patientId, string groupedFieldName) { @@ -398,6 +431,7 @@ namespace adas_core.Domain.Utils /// /// The collection of strings to normalize. /// A pipe-delimited string of the cleaned and sorted values, or an empty string if no valid entries are supplied. + /// public static string Normalize(IEnumerable items) => string.Join("|", items .Where(s => !string.IsNullOrWhiteSpace(s)) @@ -411,6 +445,7 @@ namespace adas_core.Domain.Utils /// Clasificador de claves basado en prefijos. /// Permite al CacheDispatcher seleccionar el backend adecuado (Redis, InMemory, None). /// + /// public static class CacheKeyClassifier { /// @@ -421,6 +456,7 @@ namespace adas_core.Domain.Utils /// /// The cache key to classify. /// The that matches the key's prefix, or when no prefix is recognized. + /// public static CacheEnum.EntityType Classify(string key) { if (key.StartsWith("patients:", StringComparison.OrdinalIgnoreCase)) @@ -450,6 +486,7 @@ namespace adas_core.Domain.Utils /// /// Patrones para DeleteByPattern (Redis) u operaciones masivas por prefijo. /// + /// public static class CacheKeyPatterns { /// @@ -457,6 +494,7 @@ namespace adas_core.Domain.Utils /// /// The entity type for which a cache key pattern is being generated. /// A string representing the cache key pattern associated with the given entity type, or "*" if the entity type is not recognized. + /// public static string ForEntity(CacheEnum.EntityType type) => type switch { @@ -474,6 +512,7 @@ namespace adas_core.Domain.Utils /// /// The key prefix to match against. /// A formatted string combining and ":*" used as a wildcard pattern. + /// public static string ByPrefix(string prefix) => $"{prefix}:*"; @@ -483,6 +522,7 @@ namespace adas_core.Domain.Utils /// The category or context prefix prepended to the pattern. /// The patient identifier used to scope the wildcard pattern. /// A formatted pattern string in the form {prefix}:*:{patientId}*. + /// public static string ByPatient(string prefix, string patientId) => $"{prefix}:*:{patientId}*"; @@ -492,6 +532,7 @@ namespace adas_core.Domain.Utils /// The prefix segment to include at the beginning of the returned string. /// The date segment to include at the end of the returned string. /// A string formatted as {prefix}:*:{date}. + /// public static string ByDate(string prefix, string date) => $"{prefix}:*:{date}"; } @@ -501,6 +542,7 @@ namespace adas_core.Domain.Utils /// Utilidad para extraer información estructurada útil para trazas. /// No usada por la lógica de caché, pero sí por logs y diagnósticos. /// + /// public static class CacheKeyInspector { private static readonly Regex _patientRegex = @@ -518,6 +560,7 @@ namespace adas_core.Domain.Utils /// /// The input string from which to extract the patient identifier. /// The extracted patient identifier, or null if no match is found. + /// public static string? ExtractPatientId(string key) { var match = _patientRegex.Match(key); @@ -529,6 +572,7 @@ namespace adas_core.Domain.Utils /// /// The grouped observation key to parse. /// A tuple containing the extracted field name and patient identifier, or (null, null) if the key does not match the pattern. + /// public static (string? Field, string? PatientId) ExtractGroupedObservationInfo(string key) { var match = _groupedRegex.Match(key); @@ -543,6 +587,7 @@ namespace adas_core.Domain.Utils /// /// The input string expected to contain a location and a date in yyyyMMdd format. /// A tuple containing the extracted Location string and the parsed Date; either value may be null when extraction or parsing fails. + /// public static (string? Location, DateTime? Date) ExtractAppointmentInfo(string key) { var match = _appointmentDayRegex.Match(key); diff --git a/adas-core.Domain/Utils/CardConfigExtensions.cs b/adas-core.Domain/Utils/CardConfigExtensions.cs index c8e1478a..fe0fd7b5 100644 --- a/adas-core.Domain/Utils/CardConfigExtensions.cs +++ b/adas-core.Domain/Utils/CardConfigExtensions.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Utils; /// /// This class is a static container for extension methods that extend the capabilities of the type. /// +/// public static class CardConfigExtensions { // Método principal para extraer todos los nombres diff --git a/adas-core.Domain/Utils/CollectionsUtils.cs b/adas-core.Domain/Utils/CollectionsUtils.cs index 5b7dfb5e..22f8073b 100644 --- a/adas-core.Domain/Utils/CollectionsUtils.cs +++ b/adas-core.Domain/Utils/CollectionsUtils.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Utils; /// /// Provides static utility methods for working with collections. /// +/// public static class CollectionsUtils { /// @@ -12,6 +13,7 @@ public static class CollectionsUtils /// /// The list to evaluate. /// if the list is null or empty; otherwise, . + /// public static bool IsNullOrEmpty(this List? value) { return value == null || !value.Any(); @@ -22,6 +24,7 @@ public static class CollectionsUtils /// /// The list to evaluate. /// if the list is or empty; otherwise, . + /// public static bool IsEmptyOrNull(List? value) { return value == null || !value.Any(); @@ -32,6 +35,7 @@ public static class CollectionsUtils /// /// The list to evaluate. May be null. /// true if is not null and contains one or more elements; otherwise, false. + /// public static bool HasElements(List? value) { return value != null && value.Any(); @@ -42,6 +46,7 @@ public static class CollectionsUtils /// /// The list to evaluate. /// if the list is not null and contains at least one element; otherwise, . + /// public static bool IsNotEmpty(List value) { return !IsEmptyOrNull(value); @@ -52,6 +57,7 @@ public static class CollectionsUtils /// /// The list to evaluate; may be . /// The original if it is not null; otherwise, an empty . + /// public static List EmptyIfNull(List? value) { return value ?? []; @@ -62,6 +68,7 @@ public static class CollectionsUtils /// /// The list to evaluate. /// The original when it is not null and not empty; otherwise, null. + /// public static List? NullIfEmpty(List value) { return IsEmptyOrNull(value) ? null : value; @@ -73,6 +80,7 @@ public static class CollectionsUtils /// The source collection whose elements are copied into the new array. /// The element of the array to create. /// A new of the specified type containing the elements copied from the collection. + /// public static Array ToArray(ICollection collection, Type type) { var result = Array.CreateInstance(type, collection.Count); @@ -86,6 +94,7 @@ public static class CollectionsUtils /// The list to evaluate for a null or empty state. /// The fallback list returned when is null or empty. /// The original when it contains items; otherwise . + /// public static List IfEmptyOrNull(List list, List defaultList) { return IsEmptyOrNull(list) ? defaultList : list; diff --git a/adas-core.Domain/Utils/ComparableDictionary.cs b/adas-core.Domain/Utils/ComparableDictionary.cs index a69eb402..41a71678 100644 --- a/adas-core.Domain/Utils/ComparableDictionary.cs +++ b/adas-core.Domain/Utils/ComparableDictionary.cs @@ -10,12 +10,14 @@ namespace adas_core.Domain.Utils; /// /// Inherits from and enforces that both keys and values are non-nullable. /// +/// public class ComparableDictionary : Dictionary where TKey : notnull where TValue : notnull { /// /// Generates a hash code for the collection by concatenating the string representations of all key-value pairs, separated by underscores and double percent signs, and returning the hash code of the resulting string. /// /// An integer hash code derived from the concatenated key-value pairs of the collection. + /// public override int GetHashCode() { StringBuilder str = new(); diff --git a/adas-core.Domain/Utils/ComplexObjectValueTypeSerializer.cs b/adas-core.Domain/Utils/ComplexObjectValueTypeSerializer.cs index 1d24596e..a851cceb 100644 --- a/adas-core.Domain/Utils/ComplexObjectValueTypeSerializer.cs +++ b/adas-core.Domain/Utils/ComplexObjectValueTypeSerializer.cs @@ -17,12 +17,14 @@ namespace adas_core.Domain.Utils; /// /// Declared as a partial class, allowing its definition to be split across multiple files. /// +/// public partial class ComplexObjectValueTypeSerializer : SerializerBase { /// /// Provides a compiled regular expression for matching MongoDB ObjectId references, such as ObjectId("..."), that wrap a 24-character hexadecimal identifier. /// /// A that matches strings containing an ObjectId call with a 24-character hexadecimal value enclosed in delimiters. + /// [GeneratedRegex("ObjectId\\((.[a-f0-9]{24}.)\\)")] private static partial Regex ObjectIdRegex(); @@ -176,6 +178,7 @@ public partial class ComplexObjectValueTypeSerializer : SerializerBase /// The BSON serialization context that provides the writer used to emit the serialized output. /// Additional BSON serialization arguments passed through to the underlying serializers. /// The runtime value to serialize. A null value is written as a BSON null; all other values are dispatched based on their concrete type. + /// public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value) { switch (value) @@ -241,6 +244,7 @@ public partial class ComplexObjectValueTypeSerializer : SerializerBase /// /// The BSON array whose element type needs to be resolved. /// The resolved for the array elements, or null when no matching type can be determined. + /// private Type? GetElementTypeFromBsonArray(BsonArray bsonArray) { if (bsonArray.Count == 1 && bsonArray.Values.Any(c => c.IsBsonNull)) @@ -289,6 +293,7 @@ public partial class ComplexObjectValueTypeSerializer : SerializerBase /// Provides serialization for instances while ignoring null elements. /// /// The type of elements contained in the list being serialized. + /// public class NullIgnoringListSerializer : SerializerBase> { /// @@ -297,6 +302,7 @@ public partial class ComplexObjectValueTypeSerializer : SerializerBase /// The BSON deserialization context providing the reader used to read the BSON data. /// Additional arguments that influence the deserialization process. /// A containing the deserialized elements, or an empty list if the BSON value is null. + /// public override List Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) { var bsonType = context.Reader.GetCurrentBsonType(); @@ -324,6 +330,7 @@ public partial class ComplexObjectValueTypeSerializer : SerializerBase /// The BSON serialization context providing the writer used to emit the array and its elements. /// The BSON serialization arguments supplying additional options for the serialization process. /// The list of items to serialize as a BSON array. + /// public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, List value) { context.Writer.WriteStartArray(); diff --git a/adas-core.Domain/Utils/CryptoAdas.cs b/adas-core.Domain/Utils/CryptoAdas.cs index 988a4ba5..250426c7 100644 --- a/adas-core.Domain/Utils/CryptoAdas.cs +++ b/adas-core.Domain/Utils/CryptoAdas.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Utils; /// /// Provides a static container for cryptographic operations and utilities related to the Adas domain. /// +/// public static class CryptoAdas { private static readonly Regex PassRegex = new("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$"); @@ -19,6 +20,7 @@ public static class CryptoAdas /// /// The string to hash. Its ASCII byte representation is used as the input to the MD5 algorithm. /// The MD5 hash of formatted as an uppercase hexadecimal string. + /// public static string CreateMd5(string input) { using var md5 = MD5.Create(); @@ -39,6 +41,7 @@ public static class CryptoAdas /// The grouped field whose names, max, since, regularity, and results are included in the hash input. /// The identifier of the patient whose data is being hashed. /// An MD5 hash string representing the combined patient and grouped field data. + /// public static string CreateMd5GroupedObs(GroupedField gF, ObjectId patientId) { var names = CollectionsUtils.IfEmptyOrNull(gF.Names, [gF.Name ?? string.Empty]); @@ -56,6 +59,7 @@ public static class CryptoAdas /// /// The plain text string to be hashed. /// A BCrypt hashed representation of the input string. + /// public static string CreateBCrypt(string input) { return BCrypt.Net.BCrypt.HashPassword(input); @@ -67,6 +71,7 @@ public static class CryptoAdas /// The plain text password entered by the user during login. /// The stored BCrypt hash to compare the password against. /// true if the password matches the hash; otherwise, false. + /// public static bool VerifyPassword(string loginPass, string passwordHash) { return BCrypt.Net.BCrypt.Verify(loginPass, passwordHash); @@ -77,6 +82,7 @@ public static class CryptoAdas /// /// The password string to evaluate against the strong password requirements. /// true if the password matches the strong password pattern; otherwise, false. + /// public static bool IsStrongPassword(string password) { return PassRegex.IsMatch(password); diff --git a/adas-core.Domain/Utils/DetailConfigExtension.cs b/adas-core.Domain/Utils/DetailConfigExtension.cs index 1476368e..9e55f2d2 100644 --- a/adas-core.Domain/Utils/DetailConfigExtension.cs +++ b/adas-core.Domain/Utils/DetailConfigExtension.cs @@ -8,6 +8,8 @@ namespace adas_core.Domain.Utils; /// /// This is a static utility class that cannot be instantiated and is intended to extend the functionality of through extension method definitions. /// +/// public static class DetailConfigExtension { // Método principal para iniciar la extracción diff --git a/adas-core.Domain/Utils/DictionaryEx.cs b/adas-core.Domain/Utils/DictionaryEx.cs index e2cda82d..5862ef18 100644 --- a/adas-core.Domain/Utils/DictionaryEx.cs +++ b/adas-core.Domain/Utils/DictionaryEx.cs @@ -3,6 +3,7 @@ /// /// Provides static extension methods to augment the functionality of dictionary types. /// +/// public static class DictionaryEx { /// @@ -12,6 +13,7 @@ public static class DictionaryEx /// The key whose associated value should be returned. /// The value to return when the key is not present in the dictionary. Defaults to the default value of . /// The value associated with the key if found; otherwise, . + /// public static TV? GetValue(this IDictionary dict, TK key, TV? defaultValue = default) { return dict.TryGetValue(key, out var value) ? value : defaultValue; @@ -24,6 +26,7 @@ public static class DictionaryEx /// The separator placed between each formatted key-value pair in the resulting string. /// The separator placed between a key and its corresponding value within each pair. /// A single string containing all dictionary entries formatted and joined using the specified separators. + /// public static string ToListString(this IDictionary dict, string itemSeparator = ", ", string keySeparator = ": ") { @@ -38,6 +41,7 @@ public static class DictionaryEx /// The dictionary to search for the key. /// The key whose associated value should be retrieved. /// The value associated with the key, or null if the key was not found in the dictionary. + /// public static TValue? TryGetAndReturn(this IDictionary dictionary, TKey key) where TKey : notnull where TValue : class { diff --git a/adas-core.Domain/Utils/EnumUtils.cs b/adas-core.Domain/Utils/EnumUtils.cs index 55eae505..86e87a69 100644 --- a/adas-core.Domain/Utils/EnumUtils.cs +++ b/adas-core.Domain/Utils/EnumUtils.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Utils; /// /// Provides static utility methods for working with types. /// +/// public static class EnumUtils { /// @@ -14,6 +15,7 @@ public static class EnumUtils /// /// The enumeration value whose description should be obtained. /// The description text from the if present; otherwise, the string representation of the enum value. + /// public static string GetDescription(Enum value) { var enumMember = value.GetType().GetMember(value.ToString()).FirstOrDefault(); diff --git a/adas-core.Domain/Utils/EquatableDictionary.cs b/adas-core.Domain/Utils/EquatableDictionary.cs index 48da231a..a5c17ce4 100644 --- a/adas-core.Domain/Utils/EquatableDictionary.cs +++ b/adas-core.Domain/Utils/EquatableDictionary.cs @@ -19,6 +19,7 @@ public sealed class EquatableDictionary /// /// The dictionary to compare against this instance. /// true if both dictionaries contain the same keys with equal values; otherwise, false. + /// public bool Equals(ComparableDictionary? other) { if (other is null) return false; @@ -38,6 +39,7 @@ public sealed class EquatableDictionary /// /// The object to compare with the current instance. /// true if is a and is equal to the current instance; otherwise, false. + /// public override bool Equals(object? other) { return Equals(other as ComparableDictionary); @@ -48,6 +50,7 @@ public sealed class EquatableDictionary /// Each pair contributes a hash derived from its key and value, and the per-pair hashes are combined using XOR. /// /// An integer hash code that represents the contents of the collection. + /// public override int GetHashCode() { var hash = 0; diff --git a/adas-core.Domain/Utils/GlobalData.cs b/adas-core.Domain/Utils/GlobalData.cs index 2eb0f3dc..574cfed7 100644 --- a/adas-core.Domain/Utils/GlobalData.cs +++ b/adas-core.Domain/Utils/GlobalData.cs @@ -3,6 +3,7 @@ /// /// Provides static access to global application data and configuration values. /// +/// public static class GlobalData { public static Dictionary Data = new(); @@ -12,6 +13,7 @@ public static class GlobalData /// /// The key used to identify the data entry in the store. /// The value to associate with the specified key. + /// public static void AddData(string key, object value) { var exists = Data.ContainsKey(key); diff --git a/adas-core.Domain/Utils/Hl7Utils.cs b/adas-core.Domain/Utils/Hl7Utils.cs index 6386572d..78bb128c 100644 --- a/adas-core.Domain/Utils/Hl7Utils.cs +++ b/adas-core.Domain/Utils/Hl7Utils.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Utils; /// /// Provides static utility methods for working with HL7 (Health Level 7) data formats and messages. /// +/// public static class Hl7Utils { /// @@ -16,6 +17,7 @@ public static class Hl7Utils /// Logger para registrar advertencias /// Tipo de mensaje HL7 que se va a procesar su entrada /// true si se permite; false en caso contrario. + /// public static bool ManageAutoAdt(Unit? unitConfig, Unit? oldUnitConfig, ILogger logger, string type) { // Variables de estado: diff --git a/adas-core.Domain/Utils/Interfaces/IMappingUtils.cs b/adas-core.Domain/Utils/Interfaces/IMappingUtils.cs index d160e0af..d7b546fd 100644 --- a/adas-core.Domain/Utils/Interfaces/IMappingUtils.cs +++ b/adas-core.Domain/Utils/Interfaces/IMappingUtils.cs @@ -8,6 +8,7 @@ public interface IMappingUtils /// The code used to look up the entity. /// The category used to filter the search. /// A nullable tuple containing the type, name, and group of the found entity, or null if no match is found. + /// (string type, string name, string group)? SearchByCode(object code, string category); /// /// Retrieves the complexity value associated with the specified name, optionally applying a weight. @@ -15,6 +16,7 @@ public interface IMappingUtils /// The name used to look up the complexity value. /// An optional weight value to apply to the complexity calculation. /// The complexity value as an integer. + /// int GetComplexityValue(string name, double? peso = null); // void ConvertStringToDoubleInMapping(); diff --git a/adas-core.Domain/Utils/JsonExtensions.cs b/adas-core.Domain/Utils/JsonExtensions.cs index 64277be5..1c3bea1d 100644 --- a/adas-core.Domain/Utils/JsonExtensions.cs +++ b/adas-core.Domain/Utils/JsonExtensions.cs @@ -6,6 +6,7 @@ namespace adas_core.Domain.Utils; /// /// Provides extension methods for JSON-related operations. /// +/// public static class JsonExtensions { /// @@ -15,6 +16,7 @@ public static class JsonExtensions /// The path to the source JSON file to read from. /// The path to the destination BSON file to write to. /// The file mode used to open the output file. Defaults to . + /// public static void CopyToBson(string inputPath, string outputPath, FileMode fileMode = FileMode.CreateNew) { using var textReader = File.OpenText(inputPath); diff --git a/adas-core.Domain/Utils/JwtHelper.cs b/adas-core.Domain/Utils/JwtHelper.cs index acc8bbe4..c86f32cc 100644 --- a/adas-core.Domain/Utils/JwtHelper.cs +++ b/adas-core.Domain/Utils/JwtHelper.cs @@ -12,6 +12,7 @@ namespace adas_core.Domain.Utils; /// /// This class is intended to be inherited by concrete implementations that define specific JWT processing behaviors. /// +/// public abstract class JwtHelper { /// @@ -25,6 +26,7 @@ public abstract class JwtHelper /// The token lifetime in minutes, added to the current UTC time to compute the expiration date. /// Optional extra claims to merge into the token alongside the standard claims. If null, only the default claims are included. /// A signed with HMAC-SHA256 and configured with the supplied issuer, audience, expiration, and claims. + /// public static JwtSecurityToken GetJwtToken( string username, string secret, @@ -70,6 +72,7 @@ public abstract class JwtHelper /// Generates a cryptographically secure refresh token by producing 64 random bytes using and returning the value as a Base64-encoded string. /// /// A Base64-encoded string representation of a 64-byte cryptographically random sequence suitable for use as a refresh token. + /// public static string GenerateRefreshToken() { var randomNumber = new byte[64]; @@ -83,6 +86,7 @@ public abstract class JwtHelper /// /// /// + /// public static string? GetUsernameFromPrincipal(ClaimsPrincipal principal) { var nameClaim = principal.Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.NameIdentifier)); diff --git a/adas-core.Domain/Utils/Mapper.cs b/adas-core.Domain/Utils/Mapper.cs index 3432f0d4..83013761 100644 --- a/adas-core.Domain/Utils/Mapper.cs +++ b/adas-core.Domain/Utils/Mapper.cs @@ -43,6 +43,12 @@ public static class Mapper /// The target object that will receive the mapped property values. /// Thrown when or is null. /// Thrown when a source value is null but the corresponding destination property is a value type that is not . + /// + /// + /// public static void Map(ExpandoObject source, T destination) { // Might as well take care of null references early. diff --git a/adas-core.Domain/Utils/MappingUtils.cs b/adas-core.Domain/Utils/MappingUtils.cs index 6093ad44..e3d787de 100644 --- a/adas-core.Domain/Utils/MappingUtils.cs +++ b/adas-core.Domain/Utils/MappingUtils.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Utils; /// /// Provides a sealed implementation of mapping utilities, serving as the concrete type for the contract. /// +/// public sealed class MappingUtils : IMappingUtils { private readonly List? _cccData; @@ -139,6 +140,7 @@ public sealed class MappingUtils : IMappingUtils /// The name of the entry to look up in the CCC data. /// Optional weight used to select the matching range when multiple values are defined; when null, range-based lookup is skipped. /// The matched initial value (for single-entry entries) or the contributed value (for range-based entries); returns 0 if the name is not found or no data is available. + /// public int GetComplexityValue(string name, double? peso = null) { ConvertStringToDoubleInMapping(); @@ -167,6 +169,7 @@ public sealed class MappingUtils : IMappingUtils /// /// Converts string representations of numeric values in the _cccData mapping to using the invariant culture, ensuring the period (".") is recognized as the decimal separator. The method only runs when the data has not already been transformed (_isTransformedValue is false) and when _cccData is not null, iterating through each mapping's Codes and Value entries to parse and replace their InitialValue and FinalValue when they are strings. After processing, it marks the transformation as completed by setting _isTransformedValue to true. /// + /// private void ConvertStringToDoubleInMapping() { // esto es para garantizar que el punto (".") sea reconocido como separador decimal diff --git a/adas-core.Domain/Utils/MediaUtils.cs b/adas-core.Domain/Utils/MediaUtils.cs index 808426ed..b73fd535 100644 --- a/adas-core.Domain/Utils/MediaUtils.cs +++ b/adas-core.Domain/Utils/MediaUtils.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Utils; /// /// Provides static utility methods for handling media-related operations. /// +/// public static class MediaUtils { public static readonly Dictionary Mapping = new(StringComparer.InvariantCultureIgnoreCase) @@ -98,6 +99,7 @@ public static class MediaUtils /// /// The file path whose extension is used to resolve the MIME type. /// The corresponding MIME type string if the extension is found in the mapping; otherwise, the default application/octet-stream value. + /// public static string GetMimeType(string filePath) { var extension = Path.GetExtension(filePath).ToLowerInvariant(); @@ -110,6 +112,7 @@ public static class MediaUtils /// /// The path of the file to evaluate. /// true if the file extension matches one of the supported video extensions; otherwise, false. + /// public static bool IsVideoFile(string filePath) { // Extensiones de video soportadas @@ -124,6 +127,7 @@ public static class MediaUtils /// /// The file path of the video whose duration should be retrieved. /// The video duration in milliseconds, or null if an error occurs while reading the file. + /// public static long? GetVideoDuration(string videoPath) { try diff --git a/adas-core.Domain/Utils/NumberUtils.cs b/adas-core.Domain/Utils/NumberUtils.cs index ccda69c4..22054ab0 100644 --- a/adas-core.Domain/Utils/NumberUtils.cs +++ b/adas-core.Domain/Utils/NumberUtils.cs @@ -3,6 +3,7 @@ /// /// Provides a collection of static utility methods for performing common numeric operations. /// +/// public static class NumberUtils { /// @@ -10,6 +11,7 @@ public static class NumberUtils /// /// The object to evaluate. /// true if is one of the supported numeric types (sbyte, byte, short, ushort, int, uint, long, ulong, float, double, or decimal); otherwise, false. + /// public static bool IsNumber(this object value) { return value is sbyte @@ -30,6 +32,7 @@ public static class NumberUtils /// /// The object to convert to a . /// A that represents the converted value. + /// public static double ToDouble(this object value) { return Convert.ToDouble(value); diff --git a/adas-core.Domain/Utils/ObjectIdConverter.cs b/adas-core.Domain/Utils/ObjectIdConverter.cs index 4584e33f..7bb26529 100644 --- a/adas-core.Domain/Utils/ObjectIdConverter.cs +++ b/adas-core.Domain/Utils/ObjectIdConverter.cs @@ -9,6 +9,7 @@ namespace adas_core.Domain.Utils; /// /// Inherits from to customize JSON representation for the type it targets. /// +/// public class ObjectIdConverter : JsonConverter { /// @@ -17,6 +18,7 @@ public class ObjectIdConverter : JsonConverter /// The used to emit the JSON output. /// The value to serialize, expected to be an instance. /// The invoking this converter. + /// public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (value is ObjectId objectId) @@ -34,6 +36,7 @@ public class ObjectIdConverter : JsonConverter /// The existing value being populated, passed through from the deserializer. /// The JSON serializer invoking this converter. /// An instance when the value can be parsed or when the target type is non-nullable; null when the target type is nullable and no valid value is found. + /// public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { @@ -59,6 +62,10 @@ public class ObjectIdConverter : JsonConverter /// /// The type to evaluate for compatibility with the converter. /// if can be assigned from ; otherwise, . + /// + /// public override bool CanConvert(Type objectType) { return typeof(ObjectId).IsAssignableFrom(objectType); diff --git a/adas-core.Domain/Utils/ObjectUtils.cs b/adas-core.Domain/Utils/ObjectUtils.cs index e15f1d73..4df05a2a 100644 --- a/adas-core.Domain/Utils/ObjectUtils.cs +++ b/adas-core.Domain/Utils/ObjectUtils.cs @@ -5,6 +5,7 @@ namespace adas_core.Domain.Utils; /// /// Provides static utility methods for common object-related operations. /// +/// public static class ObjectUtils { /// @@ -13,6 +14,8 @@ public static class ObjectUtils /// /// The object to convert to a string. Can be null. /// A string containing the type name followed by the object's non-null property values and their names. + /// public static string ToStr(this object? obj) { if (obj == null) return "[OBJ NULL]"; diff --git a/adas-core.Domain/Utils/RelayHelper.cs b/adas-core.Domain/Utils/RelayHelper.cs index c611b3fb..824b3aca 100644 --- a/adas-core.Domain/Utils/RelayHelper.cs +++ b/adas-core.Domain/Utils/RelayHelper.cs @@ -8,6 +8,7 @@ namespace adas_core.Domain.Utils; /// /// Provides helper methods for relaying operations, data, or commands between components. /// +/// public class RelayHelper { /// @@ -69,6 +70,7 @@ public class RelayHelper /// Powers on the specified relay by constructing a request to the local relay control endpoint at https://localhost:7186, where the relay is identified by its in the path. /// /// The relay to power on. + /// public static void PowerOnRelay(Relay relay) { UriBuilder builder = new() @@ -87,6 +89,7 @@ public class RelayHelper /// using the relay's number as the path identifier, then forwarding the call to the underlying relay handler. /// /// The relay to power off, identified by its which is used to construct the request path. + /// public static void PowerOffRelay(Relay relay) { UriBuilder builder = new() @@ -140,6 +143,7 @@ public class RelayHelper /// /// The relay whose status is being queried. /// true if the relay is active; otherwise, false. + /// public static bool GetRelayStatus(Relay relay) { return false; diff --git a/adas-core.Domain/Utils/StringEx.cs b/adas-core.Domain/Utils/StringEx.cs index 1bc18f35..f1c447b7 100644 --- a/adas-core.Domain/Utils/StringEx.cs +++ b/adas-core.Domain/Utils/StringEx.cs @@ -3,6 +3,7 @@ /// /// Provides static extension methods for the type. /// +/// public static class StringEx { /// @@ -10,6 +11,7 @@ public static class StringEx /// /// The string to evaluate. /// true if is null or an empty string; otherwise, false. + /// public static bool IsEmpty(this string source) { return string.IsNullOrEmpty(source); @@ -20,6 +22,7 @@ public static class StringEx /// /// The string to evaluate. /// true if the string is null, empty, or contains only white space; otherwise, false. + /// public static bool IsEmptyOrWhiteSpace(this string source) { return string.IsNullOrWhiteSpace(source); @@ -31,6 +34,7 @@ public static class StringEx /// The string to search within. /// The delimiter whose first occurrence marks the start of the returned substring. /// The substring after the first occurrence of ; otherwise, the original . + /// public static string SubstringAfter(this string source, string value) { if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(value)) return source; @@ -48,6 +52,7 @@ public static class StringEx /// The string to extract the substring from. /// The delimiter whose first occurrence marks the end of the returned substring. /// The substring of before the first occurrence of , or the original when no match is found or when either input is null or empty. + /// public static string SubstringBefore(this string source, string value) { if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(value)) return source; diff --git a/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_0_UpdateDataPatien.cs b/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_0_UpdateDataPatien.cs index f1f6c0f3..fa5bbc8a 100644 --- a/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_0_UpdateDataPatien.cs +++ b/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_0_UpdateDataPatien.cs @@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Migrations.MongoMigrations; /// /// Inherits from the base class, indicating it is intended to be applied as part of an Entity Framework (or similar) migration pipeline to evolve the underlying data store. /// +/// public class U_0_1_0_UpdateDataPatien : Migration { /// diff --git a/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_1_UpdateDisplayConfigDriver.cs b/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_1_UpdateDisplayConfigDriver.cs index a010c36a..beeb038d 100644 --- a/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_1_UpdateDisplayConfigDriver.cs +++ b/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_1_UpdateDisplayConfigDriver.cs @@ -10,8 +10,13 @@ namespace adas_core.Infrastructure.Migrations.MongoMigrations; /// /// Inherits from to support schema or data changes associated with the 0.1.1 release. /// +/// public class U_0_1_1_UpdateDisplayConfigDriver : Migration { + /// + /// Initializes a new instance of the class by passing identifier 11 to the base constructor and assigning the Description property with a message indicating that the driver generates the Type field in all documents of the DisplayConfig collection to compensate for the new driver not exposing _t for polymorphism. + /// + /// public U_0_1_1_UpdateDisplayConfigDriver() : base(11) { Description = @@ -24,6 +29,7 @@ public class U_0_1_1_UpdateDisplayConfigDriver : Migration /// (defaulting to Unknown for any other value), removing the original _t field, and merging the /// results back into the same collection while discarding documents that do not already have a match. /// + /// public override void Update() { var collection = Database.GetCollection("config_displays"); diff --git a/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_2_UpdatePointOfCareConfig.cs b/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_2_UpdatePointOfCareConfig.cs index 50db2063..1bc2b8f9 100644 --- a/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_2_UpdatePointOfCareConfig.cs +++ b/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_2_UpdatePointOfCareConfig.cs @@ -10,6 +10,7 @@ namespace adas_core.Infrastructure.Migrations.MongoMigrations; /// /// The migration identifier prefix (U_0_1_2) indicates a specific ordering or version step within the migration sequence. /// +/// public class U_0_1_2_UpdatePointOfCareConfig : Migration { /// @@ -25,6 +26,8 @@ public class U_0_1_2_UpdatePointOfCareConfig : Migration /// /// Updates all point-of-care documents in the database by migrating their embedded configuration arrays (beacons, cameras, and relayList) to empty identifier list structures (beaconIdList, cameraIdList, and relayIdList), preserving the existing arrays' data not retained in this operation. /// + /// public override void Update() { var collection = Database.GetCollection("pointOfCares"); diff --git a/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_3_UpdateLanguageBarrier.cs b/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_3_UpdateLanguageBarrier.cs index 19fcbca1..03fb31d0 100644 --- a/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_3_UpdateLanguageBarrier.cs +++ b/adas-core.Infrastructure/Migrations/MongoMigrations/U_0_1_3_UpdateLanguageBarrier.cs @@ -7,6 +7,7 @@ namespace adas_core.Infrastructure.Migrations.MongoMigrations; /// /// Represents a database migration that updates the LanguageBarrier component to version 0.1.3. /// +/// public class U_0_1_3_UpdateLanguageBarrier : Migration { /// diff --git a/adas-core.Infrastructure/Repositories/AdmissionRepository.cs b/adas-core.Infrastructure/Repositories/AdmissionRepository.cs index 8ea41ad5..975a6cab 100644 --- a/adas-core.Infrastructure/Repositories/AdmissionRepository.cs +++ b/adas-core.Infrastructure/Repositories/AdmissionRepository.cs @@ -17,6 +17,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repositorio para gestionar las operaciones de la entidad Admission en MongoDB. Proporciona métodos para insertar, actualizar, eliminar y buscar admisiones, así como para manejar opciones de listas maestras relacionadas con las admisiones. /// Utiliza Serilog para el registro de errores y eventos importantes durante las operaciones de la base de datos. /// +/// public class AdmissionRepository : MongoRepository, IAdmissionRepository { @@ -41,6 +42,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// Esto permite que el repositorio se conecte a la colección correcta para realizar las operaciones de base de datos relacionadas con las admisiones. /// /// El nombre de la colección de admisiones en MongoDB. + /// public override string GetCollectionName() { return _apiSettings.Admissions; @@ -51,6 +53,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// La admisión a insertar en la base de datos. /// Una tarea que representa la operación asincrónica. + /// public override async Task InsertOneAsync(Admission admission) { try @@ -70,6 +73,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// El identificador único (ObjectId) de la admisión a eliminar. /// Una tarea que representa la operación asincrónica. + /// public async Task Delete(ObjectId id) { try @@ -89,6 +93,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// La admisión con los datos actualizados. /// Una tarea que representa la operación asincrónica. + /// public async Task Update(Admission admission) { try @@ -109,6 +114,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// El identificador único (ObjectId) de la admisión a actualizar. /// El nuevo identificador de la ubicación (PointOfCareId) de la admisión. /// Una tarea que representa la operación asincrónica. + /// public async Task UpdateLocation(ObjectId id, ObjectId newLocation) { var filterBuilder = Builders.Filter; @@ -126,6 +132,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// El identificador único (ObjectId) de la admisión a actualizar. /// La instancia de Person con los nuevos datos personales. /// Una tarea que representa la operación asincrónica. + /// public async Task UpdatePatient(ObjectId id, Person patient) { var filterBuilder = Builders.Filter; @@ -142,6 +149,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// Si ocurre una excepción durante el proceso, se registra un error con Serilog y se devuelve una lista vacía. /// /// Una lista de todas las admisiones almacenadas en la base de datos. + /// public async Task> FindAll() { try @@ -163,6 +171,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// El número de paciente (NHC) a buscar. /// El identificador de unidad (ObjectId) que debe ser distinto al de la admisión encontrada. /// Una tarea que representa la operación asincrónica y devuelve la admisión encontrada o null si no se encuentra ninguna. + /// public async Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId) { if (string.IsNullOrWhiteSpace(patientNumber)) return null; @@ -182,6 +191,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// El identificador único (ObjectId) de la admisión a buscar. /// Una tarea que representa la operación asincrónica y devuelve la admisión encontrada o null si no se encuentra ninguna. + /// public async Task FindById(ObjectId id) { try @@ -203,6 +213,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// El número de paciente (NHC) a buscar. /// Una tarea que representa la operación asincrónica y devuelve la admisión encontrada o null si no se encuentra ninguna. + /// public async Task FindByNhc(string nhc) { try @@ -225,6 +236,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// La ubicación del paciente (PatientLocation) a buscar. /// Una tarea que representa la operación asincrónica y devuelve una lista de admisiones que coinciden con la ubicación especificada. + /// public async Task> FindByLocation(PatientLocation location) { try @@ -249,6 +261,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// El nombre del origen de la admisión a buscar. /// Una tarea que representa la operación asincrónica y devuelve una lista de admisiones que coinciden con el origen especificado. + /// public async Task?> FindByOrigin(string origin) { try @@ -273,6 +286,8 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// La admisión a insertar. /// Una tarea que representa la operación asincrónica y devuelve la admisión insertada o null si ocurre un error. + /// public async Task InsertOneAsyncAndReturn(Admission origin) { try @@ -293,6 +308,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// El identificador de la unidad a buscar. /// Una tarea que representa la operación asincrónica y devuelve una lista de admisiones que coinciden con los criterios especificados. + /// public async Task> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId) { try @@ -314,6 +330,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// El identificador de la unidad a buscar. /// Una tarea que representa la operación asincrónica y devuelve el número de admisiones que coinciden con el unitId especificado. + /// public async Task CountByUnitId(ObjectId unitId) { try @@ -335,6 +352,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// El identificador del punto de atención a buscar. /// Una tarea que representa la operación asincrónica y devuelve una lista de admisiones que coinciden con el PointOfCareId especificado. + /// public async Task> FindByPointOfCareId(ObjectId pocId) { try @@ -356,6 +374,8 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// La lista de identificadores de unidad a buscar. /// Una tarea que representa la operación asincrónica y devuelve una lista de admisiones que coinciden con los unitIds especificados. + /// public async Task> FindByUnitIds(List unitIds) { var filterUnit = Builders.Filter.In("unitId", unitIds); @@ -369,6 +389,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// La opción de actualización de la lista maestra. /// El nombre del tipo de lista maestra. /// Una tarea que representa la operación asincrónica y devuelve una lista de admisiones actualizadas. + /// public async Task> UpdateMasterListOption(List unitIds, UpdateOptionMasterListDto opt, string typeName) { @@ -459,6 +480,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// La opción de actualización de la lista maestra. /// El nombre del tipo de lista maestra. /// Una tarea que representa la operación asincrónica y devuelve una lista de admisiones actualizadas. + /// public async Task> DeleteMasterListOption(List unitIds, OptionList opt, string typeName) { @@ -552,6 +574,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// El identificador de la unidad cuyas admisiones se eliminarán. /// Una tarea que representa la operación asincrónica y devuelve un valor booleano que indica si la eliminación fue exitosa. + /// public async Task DeleteAdmissionsByUnitId(ObjectId unitId) { try @@ -571,6 +594,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// Crea índices en la colección de admisiones para mejorar el rendimiento de las consultas. En este caso, se crea un índice único en el campo "nhc" (número de paciente) que solo se aplica a los documentos que tienen un valor para "nhc". /// /// Una tarea que representa la operación asincrónica. + /// public override async Task CreateIndexes() { var optionsUq = new CreateIndexOptions @@ -593,6 +617,7 @@ public class AdmissionRepository : MongoRepository, IAdmissionReposit /// /// El nombre del diagnóstico que se utilizará para buscar admisiones. /// Una tarea que representa la operación asincrónica y devuelve una colección de admisiones que coinciden con el diagnóstico especificado. + /// public async Task?> FindByDiagnosis(string diagnosis) { try diff --git a/adas-core.Infrastructure/Repositories/AlarmRepository.cs b/adas-core.Infrastructure/Repositories/AlarmRepository.cs index f600b8e8..a523d544 100644 --- a/adas-core.Infrastructure/Repositories/AlarmRepository.cs +++ b/adas-core.Infrastructure/Repositories/AlarmRepository.cs @@ -15,6 +15,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository for managing patient observation alarms in MongoDB. Provides methods to retrieve aggregated patient observations based on specified fields and expiration status. /// Implements the IAlarmRepository interface and extends the MongoRepository base class for common MongoDB operations. /// +/// public class AlarmRepository : MongoRepository, IAlarmRepository { /// @@ -35,6 +36,8 @@ public class AlarmRepository : MongoRepository, IAlarmR /// The MongoDB database instance. /// The logger instance for logging errors and information. /// Thrown when any of the input parameters are null. + /// public AlarmRepository(IOptions apiSettings, IMongoDatabase database, ILogger logger) : base(database) { @@ -51,6 +54,7 @@ public class AlarmRepository : MongoRepository, IAlarmR /// The unique identifier of the patient. /// A list of fields to filter the observations. If null, all observations for the patient are retrieved. /// A list of patient observation alarms matching the filter criteria. + /// public async Task> AggregatedPatientLastObservationsByField(ObjectId patientId, List? filterObservations = null) { @@ -118,6 +122,7 @@ public class AlarmRepository : MongoRepository, IAlarmR /// A list of fields to filter the observations. If null, all observations for the patient are retrieved. /// A list of configuration settings for the observations, including expiration times. /// A list of patient observation alarms matching the filter criteria and expiration settings. + /// public async Task> AggregatedPatientNotExpiredObservationsByField( ObjectId patientId, List? filterObservations, @@ -193,6 +198,7 @@ public class AlarmRepository : MongoRepository, IAlarmR /// If the collection name is not specified in the API settings, it defaults to "patients_alarms". /// /// The name of the MongoDB collection for patient observation alarms. + /// public override string GetCollectionName() { return _apiSettings.PatientsAlarms ?? "patients_alarms"; @@ -202,6 +208,7 @@ public class AlarmRepository : MongoRepository, IAlarmR /// Creates indexes for the patient observation alarms collection in MongoDB to optimize query performance. /// /// A task that represents the asynchronous operation of creating indexes. + /// public override async Task CreateIndexes() { try diff --git a/adas-core.Infrastructure/Repositories/AppointmentArchiveRepository.cs b/adas-core.Infrastructure/Repositories/AppointmentArchiveRepository.cs index dfd9a062..3df11301 100644 --- a/adas-core.Infrastructure/Repositories/AppointmentArchiveRepository.cs +++ b/adas-core.Infrastructure/Repositories/AppointmentArchiveRepository.cs @@ -10,6 +10,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repository for managing archived patient appointments in MongoDB. This repository provides methods to insert, delete, and manage archived appointments, ensuring efficient storage and retrieval of historical appointment data. /// +/// public class AppointmentArchiveRepository : MongoRepository, IAppointmentArchiveRepository { /// @@ -24,6 +25,8 @@ public class AppointmentArchiveRepository : MongoRepository, /// The API settings containing configuration for the archive collection. /// The MongoDB database instance. /// Thrown when any of the input parameters are null. + /// public AppointmentArchiveRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings)); @@ -37,6 +40,7 @@ public class AppointmentArchiveRepository : MongoRepository, /// /// The patient appointment to be inserted into the archive collection. /// A task representing the asynchronous operation. + /// public override async Task InsertOneAsync(PatientAppointment appointment) { await Collection.InsertOneAsync(appointment); @@ -47,6 +51,7 @@ public class AppointmentArchiveRepository : MongoRepository, /// /// The date before which all patient appointments should be deleted. /// A task representing the asynchronous operation. + /// public async Task DeleteBeforeDate(DateTime date) { var filter = Builders.Filter.Lt(pa => pa.CreateTime, date); @@ -59,6 +64,7 @@ public class AppointmentArchiveRepository : MongoRepository, /// /// The collection of patient appointments to be inserted into the archive. /// A task representing the asynchronous operation, with the result being the count of inserted documents. + /// public async Task InsertBatch(IEnumerable appointment) { var writes = new List>(); @@ -74,6 +80,7 @@ public class AppointmentArchiveRepository : MongoRepository, /// If the collection name is not specified in the settings, it defaults to "archive_patients_appointments". /// /// The name of the MongoDB collection for archived patient appointments. + /// public override string GetCollectionName() { return _apiSettings.ArchivePatientsAppointments ?? "archive_patients_appointments"; @@ -83,6 +90,7 @@ public class AppointmentArchiveRepository : MongoRepository, /// Creates indexes on the MongoDB collection for archived patient appointments to optimize query performance. This method defines the necessary indexes, such as an index on the "patientid" field, and ensures that they are created in the background without blocking other operations. /// /// A task representing the asynchronous operation. + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; diff --git a/adas-core.Infrastructure/Repositories/AppointmentRepository.cs b/adas-core.Infrastructure/Repositories/AppointmentRepository.cs index f572f58e..175e0db4 100644 --- a/adas-core.Infrastructure/Repositories/AppointmentRepository.cs +++ b/adas-core.Infrastructure/Repositories/AppointmentRepository.cs @@ -14,6 +14,7 @@ namespace adas_core.Infrastructure.Repositories; /// This class provides methods to perform CRUD operations and queries related to patient appointments, such as retrieving appointments by patient ID, finding appointments by point of care, and updating or deleting appointments. /// It utilizes the MongoDB driver for database interactions and is configured using application settings for collection names and other parameters. /// +/// public class AppointmentRepository : MongoRepository, IAppointmentRepository { /// @@ -27,6 +28,8 @@ public class AppointmentRepository : MongoRepository, IAppoi /// The API settings containing configuration for the repository. /// The MongoDB database instance. /// Thrown when any of the input parameters are null. + /// public AppointmentRepository( IOptions apiSettings, IMongoDatabase database) : base(database) @@ -41,6 +44,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// If the collection name is not specified in the settings, it defaults to "patients_appointments". /// /// The name of the MongoDB collection for patient appointments. + /// public override string GetCollectionName() { return _apiSettings.PatientsAppointments ?? "patients_appointments"; @@ -51,6 +55,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// /// The ID of the patient whose appointments are to be retrieved. /// A list of patient appointments for the specified patient ID. + /// public async Task> GetByPatient(ObjectId patientId) { var filter = Builders.Filter.Eq(ob => ob.PatientId, patientId); @@ -69,6 +74,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// /// The point of care details to filter appointments. /// A list of patient appointments that match the specified point of care. + /// public async Task> FindByPoC(PointOfCare poc) { var location = new PatientLocation() @@ -85,6 +91,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// /// The patient appointment to be inserted. /// A task representing the asynchronous operation. + /// public override async Task InsertOneAsync(PatientAppointment appointment) { appointment.CreateTime ??= DateTime.UtcNow; @@ -97,6 +104,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// /// The patient appointment to be updated. /// A task representing the asynchronous operation. + /// public async Task Update(PatientAppointment appointment) { await UpdateOneAsync(appointment.Id, appointment); @@ -107,6 +115,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// /// The ID of the patient appointment to be deleted. /// A task representing the asynchronous operation. + /// public new async Task DeleteAsync(ObjectId id) { var filter = Builders.Filter.Eq(t => t.Id, id); // Replace 'T' with your actual class name. @@ -118,6 +127,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// /// The ID of the patient whose appointments are to be retrieved. /// An asynchronous cursor to iterate through the patient appointments. + /// public Task> FindByPatientIdAsync(ObjectId patientId) { var filter = Builders.Filter.Eq(ob => ob.PatientId, patientId); @@ -129,6 +139,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// /// The ID of the patient whose appointments are to be deleted. /// A task representing the asynchronous operation. + /// public async Task DeleteByPatientId(ObjectId patientId) { var filter = Builders.Filter.Eq(po => po.PatientId, patientId); @@ -141,6 +152,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// The ID of the patient whose appointment is to be retrieved. /// The visit number of the appointment to be retrieved. /// The first matching patient appointment if found, or null if no match is found. + /// public async Task FindByPatientAndVisitNumber(ObjectId patientId, string visitNumber) { var builder = Builders.Filter; @@ -160,6 +172,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// The ID of the patient whose appointment is to be retrieved. /// The reason for the appointment to be retrieved. /// The first matching patient appointment if found, or null if no match is found. + /// public async Task FindByPatientAndReason(ObjectId patientId, string? appointmentReason) { var builder = Builders.Filter; @@ -178,6 +191,8 @@ public class AppointmentRepository : MongoRepository, IAppoi /// /// The location details to filter patient appointments by. /// A list of patient appointments that match the specified location. + /// public async Task> FindByLocation(PatientLocation location) { var builder = Builders.Filter; @@ -200,6 +215,10 @@ public class AppointmentRepository : MongoRepository, IAppoi /// The new ObjectId to replace the old patient ID. /// The old ObjectId of the patient whose appointments are to be updated. /// A task representing the asynchronous operation. + /// + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await UpdateManyObjectIdAsync(nameId, id, oldId); @@ -210,6 +229,7 @@ public class AppointmentRepository : MongoRepository, IAppoi /// The indexes are created in the background and are not unique. /// /// A task representing the asynchronous operation. + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; diff --git a/adas-core.Infrastructure/Repositories/ArchivePatientCarePlanRepository.cs b/adas-core.Infrastructure/Repositories/ArchivePatientCarePlanRepository.cs index c73b1916..bd1a8992 100644 --- a/adas-core.Infrastructure/Repositories/ArchivePatientCarePlanRepository.cs +++ b/adas-core.Infrastructure/Repositories/ArchivePatientCarePlanRepository.cs @@ -14,6 +14,7 @@ namespace adas_core.Infrastructure.Repositories; /// This class provides methods to perform CRUD operations and queries related to archived patient care plans, such as retrieving care plans by patient ID, inserting new care plans, and creating indexes. /// It utilizes the MongoDB driver for database interactions and is configured using application settings for collection names and other parameters. /// +/// public class ArchivePatientCarePlanRepository : MongoRepository, IArchivePatientCarePlanRepository { #region Properties @@ -37,6 +38,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// The API settings containing configuration for the repository. /// The MongoDB database instance. /// The logger for logging information, warnings, and errors. + /// public ArchivePatientCarePlanRepository( IOptions apiSettings, IMongoDatabase database, @@ -51,6 +53,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// This method ensures that the necessary indexes are created to optimize query performance, particularly for queries based on patient ID. The indexes are created in the background to avoid blocking operations on the database. /// /// + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; @@ -73,6 +76,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// /// The patient care plan to be inserted. /// A task representing the asynchronous operation. + /// public override async Task InsertOneAsync(PatientCarePlan patient) { try @@ -93,6 +97,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// /// The list of patient care plans to be inserted. /// A task representing the asynchronous operation. + /// public override async Task InsertManyAsync(List patient) { try @@ -116,6 +121,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// This method is used by the base repository class to determine which collection to interact with for CRUD operations. /// /// + /// public override string GetCollectionName() { return _apiSettings.ArchivePatientProcedure ?? "archive_patients_care_plan"; @@ -127,6 +133,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// /// The ID of the patient whose care plans are to be retrieved. /// A task representing the asynchronous operation, containing a list of objects. + /// public async Task?> FindByPatientId(ObjectId patientId) { var result = await Collection.FindAsync(Builders.Filter.Eq(p => p.PatientId, patientId)); @@ -138,6 +145,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// /// The ID of the patient whose care plans are to be retrieved, provided as a string. /// A task representing the asynchronous operation, containing a list of objects. + /// public async Task?> FindByPatientId(string patientId) { var isParsed = ObjectId.TryParse(patientId, out var patientIdParsed); @@ -151,6 +159,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// /// The number of the patient whose care plans are to be retrieved. /// A task representing the asynchronous operation, containing a list of objects. + /// public async Task?> FindByPatientNumber(string patientNumber) { var result = await Collection.FindAsync(Builders.Filter.Eq(p => p.PatientNumber, patientNumber)); @@ -161,6 +170,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// Finds all patient care plans in the MongoDB collection. This method retrieves all documents from the collection and returns them as a list of objects. /// /// A task representing the asynchronous operation, containing a list of objects. + /// public async Task> FindAll() { var result = await Collection.Find(Builders.Filter.Empty).ToListAsync(); @@ -176,6 +186,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository /// The ID of the patient whose care plans are to be retrieved, provided as a string. /// The number of the patient whose care plans are to be retrieved. /// A task representing the asynchronous operation, containing a list of objects. + /// public async Task?> FindByIds(ObjectId oldPatientId, string? oldPatientPatientId, string? oldPatientPatientNumber) { diff --git a/adas-core.Infrastructure/Repositories/AuthorityRepository.cs b/adas-core.Infrastructure/Repositories/AuthorityRepository.cs index 4cb20f2b..b1d2719d 100644 --- a/adas-core.Infrastructure/Repositories/AuthorityRepository.cs +++ b/adas-core.Infrastructure/Repositories/AuthorityRepository.cs @@ -15,6 +15,7 @@ namespace adas_core.Infrastructure.Repositories; /// The API settings containing configuration for the repository. /// The MongoDB database instance. /// The logger for logging information, warnings, and errors. +/// public class AuthorityRepository( IOptions apiSettings, IMongoDatabase database, @@ -29,6 +30,7 @@ public class AuthorityRepository( /// /// The name of the role to be assigned to the new authority. /// The ID of the user for whom the new authority is being created. + /// public void CreateNewAuthority(string roleName, ObjectId userId) { var newAuthorization = new Authorization @@ -48,6 +50,7 @@ public class AuthorityRepository( /// /// The ID of the user whose authorities are being retrieved. /// A list of authorities associated with the specified user ID. + /// public async Task> GetUserAuthorities(ObjectId userId) { var filter = Builders.Filter.Eq(p => p.UserId, userId); @@ -60,6 +63,7 @@ public class AuthorityRepository( /// Retrieves a list of all authorities in the system. This method queries the database for all authority records and returns them as a list. It also logs the retrieval of all authorities for debugging purposes. /// /// A list of all authorities in the system. + /// public async Task> GetAllAuthorities() { var result = await Collection.FindAsync(Builders.Filter.Empty); @@ -73,6 +77,7 @@ public class AuthorityRepository( /// /// The ID of the unit whose authorities are being retrieved. /// A list of authorities associated with the specified unit ID. + /// public async Task> GetByUnitId(ObjectId unitId) { var filter = Builders.Filter.Eq(a => a.UnitId, unitId.ToString()); @@ -90,6 +95,7 @@ public class AuthorityRepository( /// /// The ID of the user whose authorities are being deleted. /// A boolean value indicating whether the deletion was successful. + /// public async Task DeleteAllAuthoritiesByUser(ObjectId userId) { try @@ -113,6 +119,7 @@ public class AuthorityRepository( /// /// The ID of the unit whose authorities are being deleted. /// A boolean value indicating whether the deletion was successful. + /// public async Task DeleteAllAuthoritiesByUnit(ObjectId unitId) { try @@ -134,6 +141,7 @@ public class AuthorityRepository( /// /// The ID of the display whose authorities are being deleted. /// A boolean value indicating whether the deletion was successful. + /// public async Task DeleteAllAuthoritiesByDisplay(ObjectId displayId) { try @@ -153,6 +161,7 @@ public class AuthorityRepository( /// Retrieves the name of the collection used for storing authorities in the database. This method returns the collection name as specified in the API settings configuration. /// /// + /// public override string GetCollectionName() { return _apiSettings.Authorizations; @@ -164,6 +173,8 @@ public class AuthorityRepository( /// /// The unique identifier of the authority to be retrieved. /// The authority that matches the provided ID, or null if no matching authority is found. + /// public async Task GetById(ObjectId authId) { var filter = Builders.Filter.Eq(p => p.Id, authId); @@ -176,6 +187,7 @@ public class AuthorityRepository( /// This method is typically called during the initial setup of the application to ensure that essential data is present in the database. /// /// A task representing the asynchronous operation. + /// public sealed override async Task InsertInitialLoad() { var user = Db.GetCollection(apiSettings.Value.Users); diff --git a/adas-core.Infrastructure/Repositories/CameraRepository.cs b/adas-core.Infrastructure/Repositories/CameraRepository.cs index 81eb4980..d9ea0e1f 100644 --- a/adas-core.Infrastructure/Repositories/CameraRepository.cs +++ b/adas-core.Infrastructure/Repositories/CameraRepository.cs @@ -16,6 +16,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository for managing camera entities in the MongoDB database. This repository provides methods to create, retrieve, update, and search for cameras based on various criteria. /// It also includes error handling and logging for debugging purposes. /// +/// public class CameraRepository : MongoRepository, ICameraRepository { private readonly ApiSettings _apiSettings; @@ -26,6 +27,7 @@ public class CameraRepository : MongoRepository, ICameraRepository /// /// The MongoDB database instance. /// The API settings containing configuration for the repository. + /// public CameraRepository(IMongoDatabase database, IOptions apiSettings) : base(database) { _apiSettings = apiSettings.Value; @@ -35,6 +37,7 @@ public class CameraRepository : MongoRepository, ICameraRepository /// Gets the name of the MongoDB collection that this repository interacts with. In this case, it returns the collection name for cameras as specified in the API settings. /// /// The name of the MongoDB collection for cameras. + /// public override string GetCollectionName() { return _apiSettings.Cameras; @@ -46,6 +49,7 @@ public class CameraRepository : MongoRepository, ICameraRepository /// /// The unique identifier of the camera to retrieve. /// The Camera object if found; otherwise, null. + /// public async Task GetById(ObjectId cameraId) { try @@ -66,6 +70,7 @@ public class CameraRepository : MongoRepository, ICameraRepository /// /// The name of the camera to retrieve. /// The Camera object if found; otherwise, null. + /// public async Task GetByName(string name) { var filterBuilder = Builders.Filter; @@ -81,6 +86,7 @@ public class CameraRepository : MongoRepository, ICameraRepository /// /// The list of camera IDs to retrieve. /// A list of Camera objects that match the provided IDs. + /// public List GetCameraInList(List configurationRelayList) { var filterBuilder = Builders.Filter; @@ -98,6 +104,12 @@ public class CameraRepository : MongoRepository, ICameraRepository /// The pagination filter containing page number, page size, and any additional filtering criteria. /// A paginated list of Camera objects. /// Thrown when the provided filter is invalid or contains invalid data. + /// + /// + /// public IFindFluent GetPaginatedCameras(PaginationFilter filter) { var filterBuilder = Builders.Filter; @@ -133,6 +145,7 @@ public class CameraRepository : MongoRepository, ICameraRepository /// /// The Camera object to insert into the database. /// The inserted Camera object if successful; otherwise, null. + /// public async Task InsertOneCamera(Camera camera) { try @@ -155,6 +168,7 @@ public class CameraRepository : MongoRepository, ICameraRepository /// The unique identifier of the camera to update. /// The Camera object containing the updated information. /// The updated Camera object if successful; otherwise, null. + /// public async Task UpdateCameraAsync(ObjectId objectId, Camera camera) { var filter = Builders.Filter.Eq("_id", objectId); @@ -178,6 +192,7 @@ public class CameraRepository : MongoRepository, ICameraRepository /// The text string to search for in the camera names. /// A list of Camera objects whose names match the search criteria. /// Thrown when the search text is too long. + /// public async Task> GetSearchByNameCameras(string textToSearch) { if (string.IsNullOrWhiteSpace(textToSearch)) @@ -202,6 +217,7 @@ public class CameraRepository : MongoRepository, ICameraRepository /// A list of filter definitions to apply to the query. /// A sort definition to apply to the query results. /// An IFindFluent object for further query customization or execution. + /// private IFindFluent CreateFindFluent(List> filters, SortDefinition sort) { var combinedFilter = filters.Any() diff --git a/adas-core.Infrastructure/Repositories/ConfigObservationRepository.cs b/adas-core.Infrastructure/Repositories/ConfigObservationRepository.cs index 66b6b303..31e280c5 100644 --- a/adas-core.Infrastructure/Repositories/ConfigObservationRepository.cs +++ b/adas-core.Infrastructure/Repositories/ConfigObservationRepository.cs @@ -15,6 +15,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repositorio para manejar las operaciones CRUD de ConfigObservation en MongoDB. /// +/// public class ConfigObservationRepository : MongoRepository, IConfigObservationRepository { private readonly ApiSettings _apiSettings; @@ -26,6 +27,7 @@ public class ConfigObservationRepository : MongoRepository, I /// Configuración de la API. /// Instancia de la base de datos MongoDB. /// Fábrica de servicios de lista maestra. + /// public ConfigObservationRepository(IOptions apiSettings, IMongoDatabase database, IMasterListServiceFactory masterListServiceFactory) : base(database) { @@ -37,6 +39,7 @@ public class ConfigObservationRepository : MongoRepository, I /// Obtiene el nombre de la colección de MongoDB para ConfigObservation, utilizando la configuración proporcionada o un valor predeterminado. /// /// El nombre de la colección de MongoDB para ConfigObservation. + /// public override string GetCollectionName() { return _apiSettings.ConfigObservations ?? "config_observations"; @@ -47,6 +50,7 @@ public class ConfigObservationRepository : MongoRepository, I /// /// El ID del ConfigObservation a buscar. /// El ConfigObservation encontrado, o null si no se encuentra. + /// public async Task FindById(ObjectId id) { var result = await Collection.FindAsync(Builders.Filter.Eq(x => x.Id, id)); @@ -58,6 +62,8 @@ public class ConfigObservationRepository : MongoRepository, I /// /// El ConfigObservation con los datos actualizados. /// El ConfigObservation actualizado, o null si no se encuentra. + /// public async Task Update(ConfigObservation configObservation) { await UpdateOneAsync(configObservation.Id, configObservation); @@ -69,6 +75,7 @@ public class ConfigObservationRepository : MongoRepository, I /// /// /// + /// public async Task Delete(ObjectId id) { return await DeleteAsync(id); @@ -78,6 +85,7 @@ public class ConfigObservationRepository : MongoRepository, I /// Busca todos los IDs de ConfigObservation en la base de datos MongoDB. /// /// Una lista de todos los IDs de ConfigObservation. + /// public async Task> FindAllIds() { var allCollection = await Collection.FindAsync(_ => true); @@ -89,6 +97,7 @@ public class ConfigObservationRepository : MongoRepository, I /// Busca todos los ConfigObservation en la base de datos MongoDB. /// /// Una colección de todos los ConfigObservation. + /// public async Task> FindAll() { var result = await Collection.FindAsync(_ => true); @@ -100,6 +109,8 @@ public class ConfigObservationRepository : MongoRepository, I /// /// El ID del ConfigObservation para filtrar los nombres (opcional). /// Una lista de nombres de ConfigObservation. + /// public async Task> GetConfigNames(string id) { var allConfigs = await Collection.Find(_ => true).ToListAsync(); @@ -117,6 +128,8 @@ public class ConfigObservationRepository : MongoRepository, I /// Busca todos los nombres de ConfigObservation en la base de datos MongoDB, eliminando duplicados y espacios en blanco. /// /// + /// public async Task> GetConfigNames() { var allConfigs = await Collection.Find(_ => true).ToListAsync(); @@ -134,6 +147,7 @@ public class ConfigObservationRepository : MongoRepository, I /// Cuenta el número total de ConfigObservation en la base de datos MongoDB. /// /// El número total de ConfigObservation. + /// public async Task Count() { var filter = Builders.Filter.Empty; @@ -147,6 +161,7 @@ public class ConfigObservationRepository : MongoRepository, I /// El filtro de paginación y búsqueda. /// Una colección de ConfigObservation que cumple con los criterios de búsqueda y paginación. /// Se lanza cuando el texto de búsqueda es demasiado largo. + /// public async Task> GetPaginatedItems(PaginationFilter filter) { var builder = Builders.Filter; @@ -196,6 +211,7 @@ public class ConfigObservationRepository : MongoRepository, I /// El nombre del ConfigObservation a buscar. /// El ConfigObservation que coincide con el nombre proporcionado, o null si no se encuentra. /// Se lanza cuando el nombre es nulo, vacío o demasiado largo. + /// public async Task FindByName(string name) { if (string.IsNullOrWhiteSpace(name)) @@ -222,6 +238,8 @@ public class ConfigObservationRepository : MongoRepository, I /// El sistema de codificación del ConfigObservation a buscar. /// El código del ConfigObservation a buscar. /// El ConfigObservation que coincide con el sistema de codificación y código proporcionados, o null si no se encuentra. + /// public async Task GetByCodeSysAndCode(string? codingSystem, string? code) { var builder = Builders.Filter; @@ -245,6 +263,7 @@ public class ConfigObservationRepository : MongoRepository, I /// /// El ConfigObservation a insertar en la base de datos. /// El ConfigObservation insertado, incluyendo su ID generado. + /// public async Task InsertOneAsyncAndReturn(ConfigObservation configObservationItem) { await Collection.InsertOneAsync(configObservationItem); @@ -257,6 +276,8 @@ public class ConfigObservationRepository : MongoRepository, I /// /// El nombre del ConfigObservation a buscar. /// Una lista de ConfigObservation que coinciden con el nombre proporcionado. + /// public async Task> FindAllByName(string name) { var builder = Builders.Filter; @@ -279,6 +300,8 @@ public class ConfigObservationRepository : MongoRepository, I /// El nombre del ConfigObservation a buscar. /// El nombre original del ConfigObservation a buscar. /// El ConfigObservation que coincide con los parámetros proporcionados, o null si no se encuentra. + /// public async Task GetSingleConfigObservationItem(string? code, string? codingSystem, string? name, string? originalName) { @@ -301,6 +324,7 @@ public class ConfigObservationRepository : MongoRepository, I /// Si ya existen ConfigObservation en la base de datos, solo se insertan aquellos que faltan en comparación con la lista maestra. /// /// + /// public sealed override async Task InsertInitialLoad() { var stringNurseObs = _masterListServiceFactory.StringNurseObs(); diff --git a/adas-core.Infrastructure/Repositories/ConfigPumpsRepository.cs b/adas-core.Infrastructure/Repositories/ConfigPumpsRepository.cs index d0d50419..351b50bb 100644 --- a/adas-core.Infrastructure/Repositories/ConfigPumpsRepository.cs +++ b/adas-core.Infrastructure/Repositories/ConfigPumpsRepository.cs @@ -9,6 +9,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repository for managing ConfigPumps in MongoDB. Provides methods to retrieve, update, and delete pump configurations. /// +/// public class ConfigPumpsRepository : MongoRepository, IConfigPumpsRepository { private readonly ApiSettings _apiSettings; @@ -19,6 +20,7 @@ public class ConfigPumpsRepository : MongoRepository, IConfigPumpsR /// The API settings. /// The MongoDB database instance. /// Thrown when apiSettings is null. + /// public ConfigPumpsRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings)); @@ -30,6 +32,7 @@ public class ConfigPumpsRepository : MongoRepository, IConfigPumpsR /// Gets the name of the MongoDB collection for ConfigPumps. Uses the value from API settings or defaults to "config_pumps". /// /// The name of the MongoDB collection for ConfigPumps. + /// public override string GetCollectionName() { return _apiSettings.ConfigPumps ?? "config_pumps"; @@ -39,6 +42,8 @@ public class ConfigPumpsRepository : MongoRepository, IConfigPumpsR /// Retrieves all ConfigPumps documents from the MongoDB collection. Returns a list of ConfigPumps or null if no documents are found. /// /// A list of ConfigPumps or null if no documents are found. + /// public async Task?> GetAllConfigs() { var result = await Collection.FindAsync(Builders.Filter.Empty); @@ -51,6 +56,7 @@ public class ConfigPumpsRepository : MongoRepository, IConfigPumpsR /// /// The unique identifier of the ConfigPumps document. /// The ConfigPumps document if found, or null if not found. + /// public async Task FindById(string id) { var result = await Collection.FindAsync(Builders.Filter.Eq(x => x.Id, id)); @@ -65,6 +71,7 @@ public class ConfigPumpsRepository : MongoRepository, IConfigPumpsR /// /// The ConfigPumps object containing the updated data. /// The updated ConfigPumps document if found, or null if not found. + /// public async Task UpdateConfig(ConfigPumps config) { var filter = Builders.Filter.Eq("_id", config.Id); @@ -80,6 +87,7 @@ public class ConfigPumpsRepository : MongoRepository, IConfigPumpsR /// /// The ConfigPumps object to be deleted. /// True if the deletion was successful, false otherwise. + /// public async Task DeleteConfig(ConfigPumps config) { var filter = Builders.Filter.Eq("_id", config.Id); diff --git a/adas-core.Infrastructure/Repositories/ConfigUnitsRepository.cs b/adas-core.Infrastructure/Repositories/ConfigUnitsRepository.cs index cc2847b0..8b1c0cc5 100644 --- a/adas-core.Infrastructure/Repositories/ConfigUnitsRepository.cs +++ b/adas-core.Infrastructure/Repositories/ConfigUnitsRepository.cs @@ -9,6 +9,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repository for managing ConfigUnits in MongoDB. Provides methods to retrieve and manipulate ConfigUnits data. /// +/// public class ConfigUnitsRepository : MongoRepository, IConfigUnitsRepository { private readonly ApiSettings _apiSettings; @@ -19,6 +20,7 @@ public class ConfigUnitsRepository : MongoRepository, IConfigUnitsR /// The API settings. /// The MongoDB database. /// Thrown when apiSettings is null. + /// public ConfigUnitsRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings)); @@ -30,6 +32,7 @@ public class ConfigUnitsRepository : MongoRepository, IConfigUnitsR /// Gets the name of the MongoDB collection for ConfigUnits. This method retrieves the collection name from the API settings, or defaults to "config_units" if not specified. /// /// The name of the MongoDB collection for ConfigUnits. + /// public override string GetCollectionName() { return _apiSettings.ConfigUnits ?? "config_units"; @@ -40,6 +43,7 @@ public class ConfigUnitsRepository : MongoRepository, IConfigUnitsR /// /// The unique identifier of the ConfigUnits document. /// The ConfigUnits document if found; otherwise, null. + /// public async Task FindById(string id) { var resutl = await Collection.FindAsync(Builders.Filter.Eq(x => x.Id, id)); diff --git a/adas-core.Infrastructure/Repositories/DeviceRepository.cs b/adas-core.Infrastructure/Repositories/DeviceRepository.cs index 055e4f2d..ede747a7 100644 --- a/adas-core.Infrastructure/Repositories/DeviceRepository.cs +++ b/adas-core.Infrastructure/Repositories/DeviceRepository.cs @@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repository for managing Device entities in MongoDB. Provides methods for finding devices by various attributes and updating device statistics. /// +/// public class DeviceRepository : MongoRepository, IDeviceRepository { private readonly ApiSettings _apiSettings; @@ -20,6 +21,7 @@ public class DeviceRepository : MongoRepository, IDeviceRepository /// /// The API settings. /// The MongoDB database. + /// public DeviceRepository(ApiSettings apiSettings, IMongoDatabase database) : base(database) { _apiSettings = apiSettings; @@ -29,6 +31,7 @@ public class DeviceRepository : MongoRepository, IDeviceRepository /// Gets the name of the MongoDB collection for devices. The collection name is determined by the API settings, with a default value of "devices" if not specified. /// /// The name of the MongoDB collection for devices. + /// public override string GetCollectionName() { return _apiSettings.Devices ?? "devices"; @@ -40,6 +43,7 @@ public class DeviceRepository : MongoRepository, IDeviceRepository /// The MacAddr index is unique, while the others are non-unique and created in the background. /// /// A task representing the asynchronous operation. + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = true }; @@ -59,6 +63,7 @@ public class DeviceRepository : MongoRepository, IDeviceRepository /// /// The MAC address of the device to find. /// The device with the specified MAC address, or null if not found. + /// public async Task FindByMacAddr(string deviceDtoMacAddr) { return await Collection @@ -71,6 +76,7 @@ public class DeviceRepository : MongoRepository, IDeviceRepository /// /// The serial number of the device to find. /// The device with the specified serial number, or null if not found. + /// public async Task FindBySerialNumber(string deviceDtoSerialNumber) { return await Collection @@ -83,6 +89,7 @@ public class DeviceRepository : MongoRepository, IDeviceRepository /// /// The UUID of the device to find. /// The device with the specified UUID, or null if not found. + /// public async Task FindByUuid(string deviceDtoUuid) { return await Collection @@ -95,6 +102,7 @@ public class DeviceRepository : MongoRepository, IDeviceRepository /// /// The key of the device to find. /// The device with the specified key, or null if not found. + /// public async Task FindByKey(string deviceDtoKey) { return await Collection @@ -109,6 +117,7 @@ public class DeviceRepository : MongoRepository, IDeviceRepository /// The ID of the device to update. /// The existing DeviceDto object containing the updated statistics. /// A task representing the asynchronous operation. + /// public async Task UpdateDeviceStats(ObjectId id, DeviceDto deviceExist) { var update = Builders.Update diff --git a/adas-core.Infrastructure/Repositories/DiagnosisArchiveRepository.cs b/adas-core.Infrastructure/Repositories/DiagnosisArchiveRepository.cs index 450f02d3..4651015e 100644 --- a/adas-core.Infrastructure/Repositories/DiagnosisArchiveRepository.cs +++ b/adas-core.Infrastructure/Repositories/DiagnosisArchiveRepository.cs @@ -10,6 +10,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repository for managing archived patient diagnoses in MongoDB. This repository provides methods for inserting, deleting, and indexing patient diagnosis records in the archive collection. /// +/// public class DiagnosisArchiveRepository : MongoRepository, IDiagnosisArchiveRepository { private readonly ApiSettings _apiSettings; @@ -21,6 +22,7 @@ public class DiagnosisArchiveRepository : MongoRepository, IDi /// /// /// + /// public DiagnosisArchiveRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings)); @@ -33,6 +35,7 @@ public class DiagnosisArchiveRepository : MongoRepository, IDi /// /// The patient diagnosis record to insert. /// A task representing the asynchronous operation. + /// public override async Task InsertOneAsync(PatientDiagnosis patientDiagnosis) { await Collection.InsertOneAsync(patientDiagnosis); @@ -43,6 +46,7 @@ public class DiagnosisArchiveRepository : MongoRepository, IDi /// /// The date before which patient diagnosis records should be deleted. /// A task representing the asynchronous operation. + /// public async Task DeleteBeforeDate(DateTime date) { var filter = Builders.Filter.Lt(po => po.Time, date); @@ -55,6 +59,7 @@ public class DiagnosisArchiveRepository : MongoRepository, IDi /// /// The collection of patient diagnosis records to insert. /// The number of records successfully inserted. + /// public async Task InsertBatch(IEnumerable observations) { var writes = new List>(); @@ -71,6 +76,7 @@ public class DiagnosisArchiveRepository : MongoRepository, IDi /// If the API settings do not specify a collection name, a default name of "archive_patients_diagnosis" is used. /// /// The name of the MongoDB collection for archived patient diagnoses. + /// public override string GetCollectionName() { return _apiSettings.ArchivePatientsDiagnosis ?? "archive_patients_diagnosis"; @@ -80,6 +86,7 @@ public class DiagnosisArchiveRepository : MongoRepository, IDi /// Creates indexes on the MongoDB collection for archived patient diagnoses to optimize query performance. /// /// A task representing the asynchronous operation. + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; diff --git a/adas-core.Infrastructure/Repositories/DiagnosisRepository.cs b/adas-core.Infrastructure/Repositories/DiagnosisRepository.cs index 6ca05b69..8d4c5578 100644 --- a/adas-core.Infrastructure/Repositories/DiagnosisRepository.cs +++ b/adas-core.Infrastructure/Repositories/DiagnosisRepository.cs @@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repository for managing patient diagnoses in a MongoDB collection. Provides methods for CRUD operations and querying diagnoses by patient ID and code. /// +/// public class DiagnosisRepository : MongoRepository, IDiagnosisRepository { private readonly ApiSettings _apiSettings; @@ -21,6 +22,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// The API settings containing configuration for the repository. /// The MongoDB database instance. /// Thrown when the API settings are null. + /// public DiagnosisRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings)); @@ -31,6 +33,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// Gets the name of the MongoDB collection for storing patient diagnoses. The collection name is determined by the API settings, and defaults to "patients_diagnosis" if not specified. /// /// The name of the MongoDB collection for patient diagnoses. + /// public override string GetCollectionName() { return _apiSettings.PatientsDiagnosis ?? "patients_diagnosis"; @@ -41,6 +44,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// /// The ID of the patient whose diagnoses are to be retrieved. /// A list of patient diagnoses for the specified patient ID. + /// public async Task> GetByPatient(ObjectId patientId) { var filter = Builders.Filter.Eq(ob => ob.PatientId, patientId); @@ -55,6 +59,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// /// The ID of the patient diagnosis to delete. /// A task representing the asynchronous operation. + /// public new async Task DeleteAsync(ObjectId id) { var filter = Builders.Filter.Eq(t => t.Id, id); @@ -66,6 +71,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// /// The patient diagnosis to insert. /// A task representing the asynchronous operation. + /// public override async Task InsertOneAsync(PatientDiagnosis diagnosis) { await Collection.InsertOneAsync(diagnosis); @@ -76,6 +82,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// /// The ID of the patient whose diagnoses are to be deleted. /// + /// public async Task DeleteByPatientId(ObjectId patientId) { var filter = Builders.Filter.Eq(po => po.PatientId, patientId); @@ -91,6 +98,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// The code of the diagnosis. /// The coding system of the diagnosis. /// The matching patient diagnosis, or null if not found. + /// public async Task FindByPatientIdAndCode(ObjectId patientId, string? code, string? codingSystem) { var builder = Builders.Filter; @@ -111,6 +119,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// /// The ID of the patient whose diagnoses are to be retrieved. /// An asynchronous cursor of patient diagnoses. + /// public async Task> FindByPatientIdAsync(ObjectId patientId) { var filter = Builders.Filter.Eq(ob => ob.PatientId, patientId); @@ -126,6 +135,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// The new patient ID to be set. /// The old patient ID to be replaced. /// A task representing the asynchronous operation. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await UpdateManyObjectIdAsync(nameId, id, oldId); @@ -135,6 +145,7 @@ public class DiagnosisRepository : MongoRepository, IDiagnosis /// Creates indexes for the patient diagnosis collection. This method ensures that the necessary indexes are created on the MongoDB collection to optimize query performance. /// /// A task representing the asynchronous operation. + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; diff --git a/adas-core.Infrastructure/Repositories/DischargeRepository.cs b/adas-core.Infrastructure/Repositories/DischargeRepository.cs index 46c29bea..ef1fd655 100644 --- a/adas-core.Infrastructure/Repositories/DischargeRepository.cs +++ b/adas-core.Infrastructure/Repositories/DischargeRepository.cs @@ -17,6 +17,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repository for managing Discharge entities in MongoDB. Provides methods for CRUD operations and specific queries related to discharges. /// +/// public class DischargeRepository : MongoRepository, IDischargeRepository { private readonly ApiSettings _apiSettings; @@ -26,6 +27,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The API settings containing configuration for the repository. /// The MongoDB database instance. + /// public DischargeRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { _apiSettings = apiSettings.Value; @@ -35,6 +37,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// Gets the name of the MongoDB collection for discharges from the API settings. /// /// The name of the MongoDB collection for discharges. + /// public override string GetCollectionName() { return _apiSettings.Discharges; @@ -45,6 +48,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The discharge record to insert. /// A task representing the asynchronous operation. + /// public override async Task InsertOneAsync(Discharge discharge) { try @@ -63,6 +67,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The ID of the discharge record to delete. /// A task representing the asynchronous operation. + /// public async Task Delete(ObjectId id) { try @@ -83,6 +88,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// The discharge record to update. /// A task representing the asynchronous operation. /// + /// public async Task Update(Discharge discharge) { try @@ -102,6 +108,8 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// The ID of the discharge record to update. /// The new unit name to set. /// A task representing the asynchronous operation. + /// public async Task UpdateUnit(ObjectId id, string unit) { var filterBuilder = Builders.Filter; @@ -119,6 +127,8 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// The ID of the discharge record to update. /// The new patient information to set. /// A task representing the asynchronous operation. + /// public async Task UpdatePatient(ObjectId id, Patient patient) { var filterBuilder = Builders.Filter; @@ -134,6 +144,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// Finds and retrieves all discharge records from the MongoDB collection. If an error occurs during retrieval, an error is logged and an empty list is returned. /// /// A task representing the asynchronous operation, containing a list of all discharge records. + /// public async Task> FindAll() { try @@ -153,6 +164,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The ID of the discharge record to retrieve. /// A task representing the asynchronous operation, containing the discharge record if found, or null if not found or an error occurs. + /// public async Task FindById(ObjectId id) { try @@ -174,6 +186,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The unit name to search for. /// A task representing the asynchronous operation, containing a list of discharge records matching the specified unit name, or null if an error occurs. + /// public async Task?> FindByUnit(string unit) { try @@ -195,6 +208,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The ID of the unit to count discharge records for. /// A task representing the asynchronous operation, containing the count of discharge records matching the specified unit ID, or 0 if an error occurs. + /// public async Task CountByUnitId(ObjectId unitId) { try @@ -214,6 +228,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The destination to search for. /// A task representing the asynchronous operation, containing a list of discharge records matching the specified destination, or null if an error occurs. + /// public async Task?> FindByDestination(string destination) { try @@ -238,6 +253,10 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The IDs of the units to search for. /// A task representing the asynchronous operation, containing a list of discharge records matching the specified unit IDs, or null if an error occurs. + /// + /// public async Task?> GetDischargesByUnitIds(IEnumerable? unitIds) { var filterUnit = Builders.Filter.In("unitId", unitIds); @@ -249,6 +268,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The ID of the Point of Care to search for. /// A task representing the asynchronous operation, containing a list of discharge records matching the specified Point of Care ID, or null if an error occurs. + /// public async Task?> FindByPoCId(ObjectId pocId) { try @@ -271,6 +291,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The service to search for. /// A task representing the asynchronous operation, containing a list of discharge records matching the specified service, or null if an error occurs. + /// public async Task?> FindByService(string service) { try @@ -292,6 +313,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The patient location to search for. /// A task representing the asynchronous operation, containing the discharge record matching the specified patient location, or null if an error occurs. + /// public async Task GetDischargeByLocation(PatientLocation location) { try @@ -313,6 +335,8 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The ID of the Point of Care to search for. /// A task representing the asynchronous operation, containing the discharge record matching the specified Point of Care ID, or null if an error occurs. + /// public async Task GetDischargeByPointOfCareId(ObjectId id) { try @@ -337,6 +361,10 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// The update option specifying the changes to be applied to the master list. /// The name of the master list type to be updated. /// A task representing the asynchronous operation, containing the updated discharge records, or an empty list if an error occurs. + /// + /// public Task> UpdateMasterListOption(List unitIds, UpdateOptionMasterListDto opt, string typeName) { @@ -361,6 +389,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The ID of the unit for which to delete discharge records. /// A task representing the asynchronous operation, containing true if the deletion was successful, or false if an error occurred. + /// public async Task DeleteByUnitId(ObjectId unitId) { try @@ -383,6 +412,12 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// The update option specifying the changes to be applied to the master list. /// The name of the master list type to be updated. /// A task representing the asynchronous operation, containing the updated discharge records, or an empty list if an error occurs. + /// + /// + /// public Task> DeleteMasterListOption(List unitIds, OptionList opt, string typeName) { var isParsed = Enum.TryParse(typeName, out var parsedTypeName); @@ -406,6 +441,7 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// /// The ID of the patient for which to retrieve the discharge record. /// A task representing the asynchronous operation, containing the discharge record if found, or null if an error occurs or the record is not found. + /// public async Task GetByPatientId(ObjectId patientId) { try @@ -428,6 +464,8 @@ public class DischargeRepository : MongoRepository, IDischargeReposit /// If an error occurs during index creation, an error is logged. /// /// + /// public override async Task CreateIndexes() { var optionsUq = new CreateIndexOptions diff --git a/adas-core.Infrastructure/Repositories/DisplayCardConfigRepository.cs b/adas-core.Infrastructure/Repositories/DisplayCardConfigRepository.cs index 7b8ccc18..20a2c237 100644 --- a/adas-core.Infrastructure/Repositories/DisplayCardConfigRepository.cs +++ b/adas-core.Infrastructure/Repositories/DisplayCardConfigRepository.cs @@ -12,6 +12,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repository for managing display card configurations in MongoDB. Provides methods to perform CRUD operations on CardConfig documents. /// +/// public class DisplayCardConfigRepository : MongoRepository, IDisplayCardConfigRepository { private readonly ApiSettings _apiSettings; @@ -23,6 +24,7 @@ public class DisplayCardConfigRepository : MongoRepository, IDisplay /// The MongoDB database instance. /// The API settings containing configuration for the repository. /// The logger instance for logging repository operations. + /// public DisplayCardConfigRepository( IMongoDatabase database, ApiSettings apiSettings, @@ -37,6 +39,7 @@ public class DisplayCardConfigRepository : MongoRepository, IDisplay /// Gets the name of the MongoDB collection for CardConfig documents, as specified in the API settings. /// /// The name of the MongoDB collection for CardConfig documents. + /// public override string GetCollectionName() { return _apiSettings.DisplayCardConfig; @@ -46,6 +49,8 @@ public class DisplayCardConfigRepository : MongoRepository, IDisplay /// Retrieves all CardConfig documents from the MongoDB collection and returns them as a list. Logs any exceptions that occur during the retrieval process. /// /// A task representing the asynchronous operation, containing a list of all CardConfig documents. + /// public async Task> GetAll() { var result = await Collection.Find(Builders.Filter.Empty).ToListAsync(); @@ -57,6 +62,7 @@ public class DisplayCardConfigRepository : MongoRepository, IDisplay /// /// The unique identifier of the CardConfig document. /// A task representing the asynchronous operation, containing the CardConfig document if found, or null if not found or an error occurs. + /// public async Task GetById(ObjectId configId) { try @@ -76,6 +82,7 @@ public class DisplayCardConfigRepository : MongoRepository, IDisplay /// /// The CardConfig document to insert. /// A task representing the asynchronous operation, containing the inserted CardConfig document if successful, or null if an error occurs. + /// public async Task InsertOneAsyncAndReturn(CardConfig config) { try @@ -98,6 +105,7 @@ public class DisplayCardConfigRepository : MongoRepository, IDisplay /// /// The CardConfig document to update. /// A task representing the asynchronous operation, containing an UpdateResponse with the number of modified documents and the updated document. + /// public async Task> UpdateOne(CardConfig? config) { try @@ -124,6 +132,7 @@ public class DisplayCardConfigRepository : MongoRepository, IDisplay /// /// The unique identifier of the CardConfig document to delete. /// A task representing the asynchronous operation, containing the deleted CardConfig document if successful, or null if not found or an error occurs. + /// public async Task DeleteOne(ObjectId configId) { return await DeleteAsync(configId); @@ -136,6 +145,7 @@ public class DisplayCardConfigRepository : MongoRepository, IDisplay /// The unique identifier of the result. /// A task representing the asynchronous operation, containing the updated CardConfig document if successful, or null if not found or an error occurs. /// + /// public Task UpdateCardConfigId(ObjectId? displayConfigId, ObjectId? resultId) { throw new NotImplementedException(); diff --git a/adas-core.Infrastructure/Repositories/DisplayChartConfigRepository.cs b/adas-core.Infrastructure/Repositories/DisplayChartConfigRepository.cs index cbed924d..a05dea1a 100644 --- a/adas-core.Infrastructure/Repositories/DisplayChartConfigRepository.cs +++ b/adas-core.Infrastructure/Repositories/DisplayChartConfigRepository.cs @@ -12,6 +12,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Repository for managing ChartConfig in MongoDB. Provides methods to retrieve and manipulate ChartConfig data. /// +/// public class DisplayChartConfigRepository : MongoRepository, IDisplayChartConfigRepository { private readonly ApiSettings _apiSettings; @@ -24,6 +25,7 @@ public class DisplayChartConfigRepository : MongoRepository, IDispl /// The MongoDB database instance. /// The API settings instance. /// The logger instance. + /// public DisplayChartConfigRepository(IMongoDatabase database, ApiSettings apiSettings, ILogger logger) : base(database) { @@ -35,6 +37,7 @@ public class DisplayChartConfigRepository : MongoRepository, IDispl /// Gets the name of the MongoDB collection for ChartConfig. This method retrieves the collection name from the API settings. /// /// The name of the MongoDB collection for ChartConfig. + /// public override string GetCollectionName() { return _apiSettings.DisplayChartConfig; @@ -44,6 +47,7 @@ public class DisplayChartConfigRepository : MongoRepository, IDispl /// Retrieves all ChartConfig documents from the MongoDB collection. This method returns a list of ChartConfig objects representing all the configurations stored in the database. /// /// A list of ChartConfig objects representing all the configurations stored in the database. + /// public async Task> GetAll() { var result = await Collection.Find(Builders.Filter.Empty).ToListAsync(); @@ -55,6 +59,7 @@ public class DisplayChartConfigRepository : MongoRepository, IDispl /// /// The unique identifier of the ChartConfig document. /// The ChartConfig object if found, or null if no matching document is found. + /// public async Task GetById(ObjectId configId) { try @@ -75,6 +80,7 @@ public class DisplayChartConfigRepository : MongoRepository, IDispl /// /// The ChartConfig object to be inserted into the MongoDB collection. /// The inserted ChartConfig object if successful, or null if an error occurs. + /// public async Task InsertOneAsyncAndReturn(ChartConfig config) { try @@ -97,6 +103,7 @@ public class DisplayChartConfigRepository : MongoRepository, IDispl /// /// The ChartConfig object containing the updated data. /// An UpdateResponse object containing the number of changes made and the updated ChartConfig document. + /// public async Task> UpdateOne(ChartConfig? config) { try @@ -129,6 +136,8 @@ public class DisplayChartConfigRepository : MongoRepository, IDispl /// /// ChartConfig Id to be deleted /// + /// public async Task DeleteOne(ObjectId configId) { return await DeleteAsync(configId); diff --git a/adas-core.Infrastructure/Repositories/DisplayConfigRepository.cs b/adas-core.Infrastructure/Repositories/DisplayConfigRepository.cs index 346a6a22..74006abe 100644 --- a/adas-core.Infrastructure/Repositories/DisplayConfigRepository.cs +++ b/adas-core.Infrastructure/Repositories/DisplayConfigRepository.cs @@ -22,6 +22,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing DisplayConfig entities in MongoDB. /// Provides CRUD operations and specialized queries for display configurations. /// +/// public class DisplayConfigRepository : MongoRepository, IDisplayConfigRepository { private readonly ApiSettings _apiSettings; @@ -35,6 +36,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// API settings containing collection names configuration. /// Logger for repository operations. /// Repository for unit-related operations. + /// public DisplayConfigRepository( IMongoDatabase database, ApiSettings apiSettings, @@ -50,6 +52,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// Gets the name of the collection for display configurations. /// /// The collection name from API settings. + /// public override string GetCollectionName() { return _apiSettings.DisplaysConfig; @@ -59,6 +62,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// Retrieves all display configurations from the database. /// /// A list of all DisplayConfig entities. + /// public async Task> GetAll() { var result = await Collection.Find(Builders.Filter.Empty).ToListAsync(); @@ -71,6 +75,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The pagination and filtering parameters. /// A fluent queryable for DisplayConfigSummary results. /// Thrown when the text filter exceeds 100 characters. + /// public IFindFluent GetAllPaginated(PaginationFilter filter) { var filterBuilder = Builders.Filter; @@ -116,6 +121,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The display type to filter by. /// A list of DisplayConfig entities matching the specified type. + /// public async Task> GetByType(DisplayConfigEnums.DisplayType type) { var filter = Builders.Filter.Eq(p => p.Type, type); @@ -129,6 +135,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The ObjectId of the display configuration to retrieve. /// The DisplayConfig with related data, or null if not found. + /// public async Task GetById(ObjectId id) { try @@ -231,6 +238,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The display type to search for. /// The default DisplayConfig for the specified type, or null if not found. + /// public async Task GetDefault(DisplayConfigEnums.DisplayType type) { var filter = Builders.Filter.And( @@ -248,6 +256,8 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The DisplayConfig to insert. /// The inserted DisplayConfig, or null if insertion fails. /// + /// public async Task InsertOneAsyncAndReturn(DisplayConfig config) { try @@ -268,6 +278,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The ObjectId of the display configuration to update. /// The new SmartDisplay configuration to apply. /// The updated SmartDisplay configuration, or null if update fails. + /// public async Task UpdateSmartDisplay(ObjectId displayConfigId, SmartDisplay? newDisplayConfig) { try @@ -315,6 +326,8 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The new ColorConfig to apply. /// True if the update was successful; otherwise, false. /// Throws an exception if MongoDB update fails. + /// public async Task UpdateConfigColor(ObjectId objectIdConfigDisplay, ColorConfig colorConfig) { var filter = Builders.Filter.Eq("Id", objectIdConfigDisplay); @@ -362,6 +375,8 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The new HeaderConfig to apply. /// True if the update was successful; otherwise, false. /// Throws an exception if MongoDB update fails. + /// public async Task UpdateHeaderConfig(ObjectId objectIdConfigDisplay, HeaderConfig headerConfig) { var filter = Builders.Filter.Eq("Id", objectIdConfigDisplay); @@ -419,6 +434,8 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The list of banner items to set. /// True if the update was successful; otherwise, false. /// Throws an exception if MongoDB update fails. + /// public async Task UpdateSetHomeBanner(ObjectId objectIdConfigDisplay, List bannerItems) { var filter = Builders.Filter.Eq("Id", objectIdConfigDisplay); @@ -445,6 +462,8 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The base DisplayConfig with updated values. /// True if the update was successful; otherwise, false. /// Throws an exception if MongoDB update fails. + /// public async Task UpdateBaseConfig(ObjectId objectIdConfigDisplay, DisplayConfig baseConfig) { var filter = Builders.Filter.Eq("Id", objectIdConfigDisplay); @@ -475,6 +494,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The new DisplayNurseDto configuration to apply. /// List of observation names to mark as "last". /// The updated DisplayNurse configuration, or null if update fails. + /// public async Task UpdateDisplayNurse(ObjectId displayConfigId, DisplayNurseDto? newDisplayConfig, List nurseObs) { @@ -537,6 +557,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The ObjectId of the display configuration to update. /// The new hospital name. /// True if the update was successful; otherwise, false. + /// public async Task UpdateDisplayConfigHospitalName(ObjectId objectIdConfigDisplay, string name) { var filter = Builders.Filter.Eq(c => c.Id, objectIdConfigDisplay); @@ -563,6 +584,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The ObjectId of the display configuration to update. /// The new list of fields to set. /// True if the update was successful; otherwise, false. + /// public async Task UpdateFieldList(ObjectId objectIdConfigDisplay, List fields) { var filter = Builders.Filter.Eq(x => x.Id, objectIdConfigDisplay); @@ -578,6 +600,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The ObjectId of the unit. /// The type of display configuration to retrieve. /// The default DisplayConfig for the unit, or null if not found. + /// public async Task GetDefaultByUnitIdAndType(ObjectId unitId, DisplayConfigEnums.DisplayType displayType) { @@ -602,6 +625,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The ObjectId of the display configuration to delete. /// The deleted DisplayConfig, or null if not found. + /// public async Task DeleteDisplayConfig(ObjectId objectIdConfigDisplay) { return await DeleteAsync(objectIdConfigDisplay); @@ -611,6 +635,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// Retrieves all display configurations in compact format (minimal response). /// /// A list of DisplayConfigMinimalResponse containing Id, Hospital, and Type. + /// public Task> GetAllCompact() { var filter = Builders.Filter.Empty; @@ -629,6 +654,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The ObjectId of the card configuration. /// A list of ObjectIds for display configurations using the specified card config. + /// public async Task> GetAllByCardConfigId(ObjectId cardConfigId) { var filter = Builders.Filter.Eq(d => d.CardConfigId, cardConfigId); @@ -645,6 +671,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The ObjectId of the card configuration. /// A list of ObjectIds for display configurations using the specified card config in main or rotating layout. + /// public async Task> GetAllByCardConfigIdAndRotating(ObjectId cardConfigId) { var mainFilter = Builders.Filter.Eq(d => d.CardConfigId, cardConfigId); @@ -669,6 +696,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The ObjectId of the display configuration to update. /// The new card configuration ID to set. /// True if the update was successful; otherwise, false. + /// public async Task UpdateCardConfigId(ObjectId? displayConfigId, ObjectId? resultId) { var filter = Builders.Filter.Eq(x => x.Id, displayConfigId); @@ -684,6 +712,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The ObjectId of the display configuration to update. /// The new chart configuration ID to add. /// True if the update was successful; otherwise, false. + /// public async Task AddChartId(ObjectId? displayConfigId, ObjectId newChartIdToAdd) { var filter = Builders.Filter.Eq(x => x.Id, displayConfigId); @@ -700,6 +729,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The ObjectId of the chart configuration that was deleted. /// The MongoDB UpdateResult indicating the number of modified documents. /// Throws an exception if MongoDB operation fails. + /// public async Task UpdateDeletedChartConfig(ObjectId deletedId) { try @@ -723,6 +753,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The ObjectId of the chart configuration. /// Always throws NotImplementedException. /// This method is not implemented. + /// public Task GetChartConfig(ObjectId objectIdConfigChart) { throw new NotImplementedException(); @@ -734,6 +765,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The ObjectId of the display configuration to update. /// The new detail configuration ID to set. /// True if the update was successful; otherwise, false. + /// public async Task UpdateDetailConfigId(ObjectId? displayConfigId, ObjectId? resultId) { var filter = Builders.Filter.Eq(x => x.Id, displayConfigId); @@ -748,6 +780,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The ObjectId of the detail configuration. /// A list of ObjectIds for display configurations using the specified detail config. + /// public async Task> GetAllByCardDetailConfigId(ObjectId baseConfigId) { var filter = Builders.Filter.Eq(d => d.DetailConfigId, baseConfigId); @@ -768,6 +801,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// - SmartDisplay /// - StandarDisplay /// + /// public sealed override async Task InsertInitialLoad() { // 1. Obtener todos los valores y castear al tipo IEnumerable @@ -828,6 +862,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The DisplayNurseDto configuration to extract fields from. /// List of observation names to mark as "last" priority. /// A list of Field objects with extracted observation names. + /// private List ExtractObservationFields(DisplayNurseDto newDisplayConfig, List nurseObs) { var fieldSet = new HashSet(); @@ -859,6 +894,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// The JSON string to search for observation names. /// The regex pattern to match observation name arrays. /// The hash set to populate with field names. + /// private void FillHashSet(string newDisplayConfig, Regex regex, HashSet fieldSet) { var matches = regex.Matches(newDisplayConfig); @@ -877,6 +913,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The list of cells to extract from. /// The hash set to populate with field names. + /// private void ExtractFromCells(List? cells, HashSet fieldSet) { if (cells is null) @@ -900,6 +937,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The list of detail cells to extract from. /// The hash set to populate with field names. + /// private void ExtractFromDetailsCells(List? cells, HashSet fieldSet) { if (cells is null) @@ -924,6 +962,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// List of filter definitions to apply. /// Sort definition for the query results. /// A fluent queryable for DisplayConfigSummary. + /// private IFindFluent CreateFindFluentMinimal( List> filters, SortDefinition sort) @@ -948,6 +987,7 @@ public class DisplayConfigRepository : MongoRepository, IDisplayC /// /// The base DisplayConfig with values to update. /// A tuple containing list of update definitions and list of field names. + /// private (List> Updates, List Fields) GetBaseUpdateDefinition( DisplayConfig baseConfig) { diff --git a/adas-core.Infrastructure/Repositories/DisplayDetailConfigRepository.cs b/adas-core.Infrastructure/Repositories/DisplayDetailConfigRepository.cs index 201632f7..4c756d71 100644 --- a/adas-core.Infrastructure/Repositories/DisplayDetailConfigRepository.cs +++ b/adas-core.Infrastructure/Repositories/DisplayDetailConfigRepository.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing CardDetailsConfig entities in MongoDB. /// Provides CRUD operations for display detail configurations used in nurse and smart displays. /// +/// public class DisplayDetailConfigRepository : MongoRepository, IDisplayDetailConfigRepository { private readonly ApiSettings _apiSettings; @@ -24,6 +25,7 @@ public class DisplayDetailConfigRepository : MongoRepository, /// The MongoDB database instance. /// API settings containing collection names configuration. /// Logger for repository operations. + /// public DisplayDetailConfigRepository( IMongoDatabase database, ApiSettings apiSettings, @@ -38,6 +40,7 @@ public class DisplayDetailConfigRepository : MongoRepository, /// Gets the name of the collection for display detail configurations. /// /// The collection name from API settings. + /// public override string GetCollectionName() { return _apiSettings.DisplayDetailConfig; @@ -47,6 +50,7 @@ public class DisplayDetailConfigRepository : MongoRepository, /// Retrieves all display detail configurations from the database. /// /// A list of all CardDetailsConfig entities. + /// public async Task> GetAll() { var result = await Collection.Find(Builders.Filter.Empty).ToListAsync(); @@ -59,6 +63,8 @@ public class DisplayDetailConfigRepository : MongoRepository, /// The ObjectId of the detail configuration to retrieve. /// The CardDetailsConfig if found; otherwise, null. /// Throws an exception if MongoDB query fails; returns null instead. + /// public async Task GetById(ObjectId configId) { try @@ -78,6 +84,7 @@ public class DisplayDetailConfigRepository : MongoRepository, /// /// The CardDetailsConfig to insert. /// The inserted CardDetailsConfig, or null if insertion fails. + /// public async Task InsertOneAsyncAndReturn(CardDetailsConfig config) { try @@ -98,6 +105,8 @@ public class DisplayDetailConfigRepository : MongoRepository, /// The CardDetailsConfig with updated values. /// An UpdateResponse containing the modified count and the updated document. /// Throws an exception if MongoDB update fails; returns UpdateResponse with null document. + /// public async Task> UpdateOne(CardDetailsConfig? config) { try @@ -130,6 +139,7 @@ public class DisplayDetailConfigRepository : MongoRepository, /// /// The ObjectId of the configuration to delete. /// The deleted CardDetailsConfig if found; otherwise, null. + /// public async Task DeleteOne(ObjectId configId) { return await DeleteAsync(configId); @@ -142,6 +152,8 @@ public class DisplayDetailConfigRepository : MongoRepository, /// The new reference ID to set. /// Always throws NotImplementedException. /// This method is not implemented. + /// public Task UpdateCardConfigId(ObjectId? displayConfigId, ObjectId? resultId) { throw new NotImplementedException(); diff --git a/adas-core.Infrastructure/Repositories/DisplayRepository.cs b/adas-core.Infrastructure/Repositories/DisplayRepository.cs index 7ece2009..08e3e920 100644 --- a/adas-core.Infrastructure/Repositories/DisplayRepository.cs +++ b/adas-core.Infrastructure/Repositories/DisplayRepository.cs @@ -17,6 +17,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing Display entities in MongoDB. /// Provides CRUD operations and specialized queries for display devices. /// +/// public class DisplayRepository : MongoRepository, IDisplayRepository { #region Properties @@ -34,6 +35,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// API settings containing collection names configuration. /// The MongoDB database instance. /// Logger for repository operations. + /// public DisplayRepository( IOptions apiSettings, IMongoDatabase database, @@ -53,6 +55,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// Creates the necessary indexes for the Display collection. /// Creates indexes on displayConfigId and unitId fields for improved query performance. /// + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; @@ -74,6 +77,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// Gets the name of the collection for displays. /// /// The collection name from API settings. + /// public override string GetCollectionName() { return _apiSettings.Displays; @@ -83,6 +87,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// Retrieves all displays from the database. /// /// A list of all Display entities. + /// public async Task> GetAll() { var result = await Collection.Find(Builders.Filter.Empty).ToListAsync(); @@ -96,6 +101,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// The pagination and filtering parameters. /// A fluent queryable for Display results. /// Thrown when the text filter exceeds 100 characters. + /// public IFindFluent GetPaginatedDisplays(PaginationFilter filter) { var filterBuilder = Builders.Filter; @@ -148,6 +154,8 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// List of filter definitions to apply. /// Sort definition for the query results. /// A fluent queryable for Display results. + /// private IFindFluent CreateFindFluent(List> filters, SortDefinition sort) { @@ -162,6 +170,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// /// The PointOfCare to filter by. /// A list of Display entities associated with the point of care. + /// public async Task> GetByPointOfCare(PointOfCare pointOfCare) { var filter = Builders.Filter.AnyEq(x => x.PointOfCareIdList, pointOfCare.Id); @@ -174,6 +183,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// /// The name of the display to retrieve. /// The Display if found; otherwise, null. + /// public async Task GetByName(string name) { var result = await Collection.FindAsync(Builders.Filter.Eq(p => p.Name, name)); @@ -185,6 +195,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// /// The ObjectId of the display to retrieve. /// The Display if found; otherwise, null. + /// public async Task GetById(ObjectId id) { var result = await Collection.FindAsync(Builders.Filter.Eq(p => p.Id, id)); @@ -197,6 +208,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// /// The ObjectId of the display to retrieve. /// The Display with DisplayConfig populated if found; otherwise, null. + /// public async Task GetByIdWithConfigDisplay(ObjectId id) { var pipeline = new BsonDocument[] @@ -225,6 +237,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// /// The ObjectId of the unit. /// A list of Display entities associated with the unit. + /// public async Task> GetByUnitId(ObjectId id) { var filter = Builders.Filter.Eq(p => p.UnitId, id); @@ -238,6 +251,8 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// The ObjectId of the unit. /// The count of displays for the unit, or 0 if an error occurs. /// Logs errors and returns 0 on failure. + /// public async Task CountByUnitId(ObjectId unitId) { try @@ -256,6 +271,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// /// The ObjectId of the display configuration. /// A list of Display entities using the specified configuration. + /// public async Task> GetByConfigId(ObjectId id) { var result = await Collection.FindAsync(Builders.Filter.Eq(p => p.DisplayConfigId, id)); @@ -269,6 +285,8 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// The ObjectId of the card configuration. /// A list of Display entities using the specified card config, or empty list on error. /// Logs errors and returns empty list on failure. + /// public async Task> GetByCardConfigId(ObjectId configId) { try @@ -307,6 +325,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// /// The ObjectId of the display configuration to check. /// The count of displays using the configuration. + /// public async Task IsDisplayConfigInUse(ObjectId displayConfigId) { return await Collection.CountDocumentsAsync( @@ -324,6 +343,8 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// The new list of point of care ObjectIds. /// The updated Display if successful; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task UpdatePointOfCareList(ObjectId objectId, List listPocObId) { try @@ -349,6 +370,8 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// The new DisplayConfig to set. /// The updated Display if successful; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task UpdateConfig(ObjectId objectId, DisplayConfig config) { try @@ -374,6 +397,8 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// The new display configuration ObjectId to set. /// The updated Display if successful; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task UpdateConfigId(ObjectId objectId, ObjectId displayConfigId) { try @@ -399,6 +424,8 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// The ObjectId of the display configuration preset. /// The updated Display if successful; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay) { try @@ -424,6 +451,7 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// The new name for the display. /// The updated Display if successful. /// Throws an exception if MongoDB update fails. + /// public async Task UpdateName(Display display, string name) { try @@ -453,6 +481,8 @@ public class DisplayRepository : MongoRepository, IDisplayRepository /// The ObjectId of the unit whose displays should be deleted. /// True if deletion was successful; otherwise, false. /// Logs errors and returns false on failure. + /// public async Task DeleteManyByUnitId(ObjectId unitId) { try diff --git a/adas-core.Infrastructure/Repositories/HistoricalConfigChangesRepository.cs b/adas-core.Infrastructure/Repositories/HistoricalConfigChangesRepository.cs index c4c7b714..c4481c7f 100644 --- a/adas-core.Infrastructure/Repositories/HistoricalConfigChangesRepository.cs +++ b/adas-core.Infrastructure/Repositories/HistoricalConfigChangesRepository.cs @@ -14,6 +14,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing HistoricalConfigChanges entities in MongoDB. /// Provides CRUD operations and specialized queries for tracking configuration changes over time. /// +/// public class HistoricalConfigChangesRepository : MongoRepository, IHistoricalConfigChangesRepository { @@ -27,6 +28,7 @@ public class HistoricalConfigChangesRepository : MongoRepositoryThe MongoDB database instance. /// Logger for repository operations. /// Thrown when apiSettings is null. + /// public HistoricalConfigChangesRepository(IOptions apiSettings, IMongoDatabase database, ILogger logger) : base(database) { @@ -39,6 +41,7 @@ public class HistoricalConfigChangesRepository : MongoRepository /// The collection name from API settings, or default "historicalConfigChanges". + /// public override string GetCollectionName() { return _apiSettings.HistoricalConfigChanges ?? "historicalConfigChanges"; @@ -50,6 +53,8 @@ public class HistoricalConfigChangesRepository : MongoRepositoryThe HistoricalConfigChanges entity to insert. /// The inserted HistoricalConfigChanges with generated ID, or null if insertion fails. /// Logs errors and returns null on failure. + /// public override async Task InsertOneAsync(HistoricalConfigChanges historicalConfigChanges) { try @@ -69,6 +74,7 @@ public class HistoricalConfigChangesRepository : MongoRepository /// The ObjectId of the record to delete. /// The deleted HistoricalConfigChanges if found; otherwise, null. + /// public async Task Delete(ObjectId id) { return await DeleteAsync(id); @@ -78,6 +84,7 @@ public class HistoricalConfigChangesRepository : MongoRepository /// A collection of all HistoricalConfigChanges entities. + /// public async Task> FindAll() { var result = await Collection.FindAsync(_ => true); @@ -88,6 +95,7 @@ public class HistoricalConfigChangesRepository : MongoRepository /// A list of all ObjectIds in the collection. + /// public async Task> FindAllIds() { List listCollection = []; @@ -103,6 +111,7 @@ public class HistoricalConfigChangesRepository : MongoRepository /// The ObjectId of the record to retrieve. /// The HistoricalConfigChanges if found; otherwise, null. + /// public async Task FindById(ObjectId id) { var result = await Collection.FindAsync(Builders.Filter.Eq(x => x.Id, id)); @@ -114,6 +123,7 @@ public class HistoricalConfigChangesRepository : MongoRepository /// The HistoricalConfigChanges with updated values. /// The updated HistoricalConfigChanges if successful; otherwise, null. + /// public async Task Update(HistoricalConfigChanges historicalConfigChanges) { var filter = Builders.Filter.Eq("_id", historicalConfigChanges.Id); @@ -136,6 +146,7 @@ public class HistoricalConfigChangesRepository : MongoRepositoryThe type of configuration to filter by. /// The maximum number of records to retrieve. Default is 10. /// A collection of the most recent HistoricalConfigChanges for the specified type. + /// public async Task> FindLastHistoricalConfigChangesByType( DisplayConfigEnums.ConfigTypes cfgType, int num = 10) { @@ -159,6 +170,7 @@ public class HistoricalConfigChangesRepository : MongoRepositoryOptional configuration type to filter by. If null, all types are included. /// The maximum number of records to retrieve. Default is 10. /// A collection of the most recent HistoricalConfigChanges for the specified user. + /// public async Task> FindLastHistoricalConfigChangesByUser(string user, DisplayConfigEnums.ConfigTypes? cfgType = null, int num = 10) { @@ -181,6 +193,7 @@ public class HistoricalConfigChangesRepository : MongoRepository /// Throws an exception if index creation fails; logs error details before throwing. + /// public override async Task CreateIndexes() { try diff --git a/adas-core.Infrastructure/Repositories/LightBeaconRepository.cs b/adas-core.Infrastructure/Repositories/LightBeaconRepository.cs index 722917b3..65e0d821 100644 --- a/adas-core.Infrastructure/Repositories/LightBeaconRepository.cs +++ b/adas-core.Infrastructure/Repositories/LightBeaconRepository.cs @@ -15,6 +15,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing entities in MongoDB. /// Provides CRUD operations and query capabilities specific to light beacons. /// +/// public class LightBeaconRepository : MongoRepository, ILightBeaconRepository { private readonly ApiSettings _apiSettings; @@ -25,6 +26,7 @@ public class LightBeaconRepository : MongoRepository, ILightBeaconR /// /// The MongoDB database instance used to access the collection. /// The application API settings containing configuration values, including the collection name. + /// public LightBeaconRepository(IMongoDatabase database, IOptions apiSettings) : base(database) { _apiSettings = apiSettings.Value; @@ -34,6 +36,7 @@ public class LightBeaconRepository : MongoRepository, ILightBeaconR /// Gets the name of the MongoDB collection used to store light beacons. /// /// The collection name retrieved from the API settings. + /// public override string GetCollectionName() { return _apiSettings.LightBeacons; @@ -44,6 +47,7 @@ public class LightBeaconRepository : MongoRepository, ILightBeaconR /// /// A list of values representing the relay identifiers to filter by. /// A containing the matching light beacons. Returns an empty list if no matches are found. + /// public List GetLightBeaconInList(List configurationRelayList) { var filterBuilder = Builders.Filter; @@ -62,6 +66,7 @@ public class LightBeaconRepository : MongoRepository, ILightBeaconR /// A representing the asynchronous operation. /// The task result contains the if found; otherwise, . /// + /// public async Task GetById(ObjectId relayId) { try @@ -85,6 +90,7 @@ public class LightBeaconRepository : MongoRepository, ILightBeaconR /// A representing the asynchronous operation. /// The task result contains the if found; otherwise, . /// + /// public async Task GetByName(string? requestRelayName) { var filterBuilder = Builders.Filter; @@ -102,6 +108,8 @@ public class LightBeaconRepository : MongoRepository, ILightBeaconR /// A representing the asynchronous operation. /// The task result contains the inserted if successful; otherwise, if the operation fails. /// + /// public async Task InsertOneAsyncAndReturn(LightBeacon beacon) { try @@ -125,6 +133,7 @@ public class LightBeaconRepository : MongoRepository, ILightBeaconR /// An instance that can be used to further refine and execute the query. /// /// Thrown when the text filter exceeds 100 characters in length. + /// public IFindFluent GetPaginatedRelays(PaginationFilter filter) { var filterBuilder = Builders.Filter; @@ -163,6 +172,7 @@ public class LightBeaconRepository : MongoRepository, ILightBeaconR /// containing a list of matching objects. /// /// This method is not yet implemented. + /// public Task> GetSearchByName(string textToSearch) { throw new NotImplementedException(); @@ -175,6 +185,7 @@ public class LightBeaconRepository : MongoRepository, ILightBeaconR /// A list of to be combined into the query. /// The defining the sort order of the results. /// An instance representing the constructed query. + /// private IFindFluent CreateFindFluent(List> filters, SortDefinition sort) { var combinedFilter = filters.Any() diff --git a/adas-core.Infrastructure/Repositories/MasterListRepository.cs b/adas-core.Infrastructure/Repositories/MasterListRepository.cs index a16f76be..e771a55e 100644 --- a/adas-core.Infrastructure/Repositories/MasterListRepository.cs +++ b/adas-core.Infrastructure/Repositories/MasterListRepository.cs @@ -20,6 +20,7 @@ namespace adas_core.Infrastructure.Repositories; /// options lists, diagnoses, allergies, procedures, treatments, and other reference data. /// /// The type of MasterList entity to manage. +/// public class MasterListRepository : MongoRepository, IMasterListRepository where T : MasterList { private readonly ApiSettings _apiSettings; @@ -30,6 +31,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// API settings containing collection names configuration. /// The MongoDB database instance. /// Thrown when apiSettings is null. + /// public MasterListRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings)); @@ -41,6 +43,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// Maps different MasterList subtypes to their corresponding MongoDB collection names. /// /// The collection name for the current MasterList type. + /// public override string GetCollectionName() { return typeof(T) switch @@ -76,6 +79,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// /// The entity to insert. /// Throws and re-throws exceptions after logging. + /// public override async Task InsertOneAsync(T entity) { try @@ -94,6 +98,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// /// The ObjectId of the entity to delete. /// Throws and re-throws exceptions after logging. + /// public async Task Delete(ObjectId id) { try @@ -113,6 +118,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// /// The entity with updated values. /// Throws and re-throws exceptions after logging. + /// public async Task Update(T entity) { try @@ -133,6 +139,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The ObjectId of the master list. /// The OptionList with updated values. /// The updated OptionList if found; otherwise, null. + /// public async Task UpdateFullMasterListOption(ObjectId id, OptionList newOpt) { var filter = Builders.Filter.Where(o => o.Id == id && o.Options.Any(opt => opt.Id == newOpt.Id) @@ -166,6 +173,12 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The ObjectId of the entity to retrieve. /// The MasterList entity if found; otherwise, null. /// Logs errors and returns null on failure. + /// + /// + /// public async Task FindById(ObjectId id) { try @@ -197,6 +210,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The locale for translation. /// The OptionList with translated fields if found; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale) { try @@ -342,6 +356,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The ObjectId of the option to retrieve. /// The OptionList if found; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task FindOptionItemById(ObjectId masterId, ObjectId optionId) { try @@ -374,6 +390,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// Optional locale for translated option names. /// The MasterList entity with translated options if found; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task FindById(ObjectId id, LocaleEnum? locale) { try @@ -556,6 +574,14 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The name of the master list to retrieve. /// The MasterList entity if found; otherwise, null. /// Logs errors and returns null on failure. + /// + /// + /// + /// public async Task FindByName(string name) { try @@ -584,6 +610,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The ObjectId of the master list. /// Optional text to search within options. /// A list of matching OptionList items. + /// public async Task> GetMasterListByIdAndTextSearchContaining(ObjectId id, string? textSearch) { return await GetOptionsByTextSearch(textSearch, id); @@ -594,6 +621,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// /// The pagination and filtering parameters. /// A fluent queryable for MasterList results. + /// public IFindFluent GetPaginatedMasterList(PaginationFilter filter) { var filterBuilder = Builders.Filter; @@ -621,6 +649,10 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The pagination and filtering parameters. /// The ObjectId of the master list. /// A list of filtered OptionList items. + /// + /// public async Task> GetPaginatedOptions(PaginationFilter filter, ObjectId listId) { //TODO: LOCALE @@ -646,6 +678,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The option element to add. /// The newly created OptionList if successful; otherwise, null if duplicate exists. /// Logs errors and returns null on failure. + /// public async Task AddOptionToMasterList(ObjectId id, FilterOptionListElement opt) { var exist = await GetMasterListByIdAndSearchOptions(id, opt); @@ -689,6 +723,10 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// /// An enumerable of all MasterList entities. /// Logs errors and returns empty list on failure. + /// + /// public async Task> GetAll() { try @@ -708,6 +746,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// /// An enumerable of MasterListDto containing id, name, description, listType, and options count. /// Logs errors and returns empty list on failure. + /// public async Task> GetAllWithoutOptions() { try @@ -736,6 +776,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// /// The total count of entities. /// Logs errors and returns 0 on failure. + /// public async Task Count() { try @@ -758,6 +800,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The filter criteria including text, name, description, and optionType. /// A list of matching OptionList items ordered by name. /// Logs errors and returns empty list on failure. + /// public async Task> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement? filters) { try @@ -973,6 +1017,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The locale for translation updates. /// The updated OptionList if successful; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task UpdateMasterListOption(ObjectId id, OptionList newOpt, LocaleEnum locale) { // 1. Evitar duplicados @@ -1073,6 +1119,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The OptionList with updated values. /// The updated OptionList if successful; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task UpdateMasterListOption(ObjectId id, OptionList newOpt) { var master = await FindById(id); @@ -1108,6 +1156,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The ObjectId of the master list. /// The ObjectId of the option to delete. /// True if the option was deleted; otherwise, false. + /// public async Task DeleteMasterListOption(ObjectId id, ObjectId deleteOptId) { // Define el filtro para encontrar el documento por su _id @@ -1132,6 +1181,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The UpdateMasterListDetailsDto with updated values. /// The updated UpdateMasterListDetailsDto if successful; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task UpdateOptionDetailsToMasterList(ObjectId id, UpdateMasterListDetailsDto opt) { @@ -1167,6 +1218,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The new name. /// True if the update was successful; otherwise, false. /// Logs errors and returns false on failure. + /// public async Task UpdateMasterListName(ObjectId id, string name) { var filter = Builders.Filter.And( @@ -1193,6 +1246,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The new description. /// True if the update was successful; otherwise, false. /// Logs errors and returns false on failure. + /// public async Task UpdateMasterListDescription(ObjectId id, string description) { var filter = Builders.Filter.And( @@ -1219,6 +1274,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The OptionList to remove. /// True if the option was removed; otherwise, false. /// Logs errors and returns false on failure. + /// public async Task RemoveMasterListOption(ObjectId id, OptionList oldOpt) { var filter = Builders.Filter.Eq("_id", id); @@ -1250,6 +1307,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// Creates necessary indexes for the MasterList collection. /// Currently creates text indexes for DiagnosisList on options.name, options.description, and options._id. /// + /// public override async Task CreateIndexes() { if (typeof(T) == typeof(DiagnosisList)) @@ -1275,6 +1334,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// /// Optional text to search within options. /// A list of matching OptionList items. + /// public async Task> GetMasterListByTextSearch(string? textSearch) { return await GetOptionsByTextSearch(textSearch); @@ -1287,6 +1347,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// Optional master list ObjectId to filter results. /// A list of matching OptionList items ordered by name. /// Logs errors and returns empty list on failure. + /// private async Task> GetOptionsByTextSearch(string? textSearch, ObjectId? id = null) { try @@ -1364,6 +1426,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// List of filter definitions to apply. /// Sort definition for the query results. /// A fluent queryable for T results. + /// private IFindFluent CreateFindFluent(List> filters, SortDefinition sort) { var combinedFilter = filters.Any() @@ -1379,6 +1443,10 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The default locale to exclude from translations. /// The option name to use as default translation. /// A Locale object with translations for all other locales. + /// + /// private Locale GetNewItemLocale(LocaleEnum localeList, string opt) { var newLocale = new Locale(); @@ -1418,6 +1486,7 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// /// The input string to build the pattern from. /// A regex-compatible pattern string. + /// private static string BuildRegexPattern(string input) { var regexPattern = new StringBuilder(); @@ -1459,6 +1528,8 @@ public class MasterListRepository : MongoRepository, IMasterListRepository /// The locale for translation. /// A list of matching OptionList items ordered by name. /// Logs errors and returns empty list on failure. + /// private async Task> GetMasterListByIdAndTextSearch( ObjectId id, string newOptName, LocaleEnum locale) { diff --git a/adas-core.Infrastructure/Repositories/MedicineRepository.cs b/adas-core.Infrastructure/Repositories/MedicineRepository.cs index d96fc033..5ddb0146 100644 --- a/adas-core.Infrastructure/Repositories/MedicineRepository.cs +++ b/adas-core.Infrastructure/Repositories/MedicineRepository.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing entities in MongoDB. /// Provides CRUD operations, search, pagination, and aggregation capabilities specific to medicines. /// +/// public class MedicineRepository : MongoRepository, IMedicineRepository { private readonly ApiSettings _apiSettings; @@ -23,6 +24,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// The application API settings containing configuration values, including the collection name. Cannot be . /// The MongoDB database instance used to access the collection. /// Thrown when is . + /// public MedicineRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings)); @@ -36,6 +38,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// Falls back to the default "medicines" collection name when not configured in the API settings. /// /// The collection name retrieved from the API settings, or "medicines" if not configured. + /// public override string GetCollectionName() { return _apiSettings.Medicines ?? "medicines"; @@ -49,6 +52,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// A representing the asynchronous operation. /// The task result contains the first matching the criteria, or if no match is found. /// + /// public async Task GetMedicine(string code) { var result = await Collection.FindAsync(x => x.Codes.Contains(code) || x.Notes.Contains(code)); @@ -65,6 +69,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// A representing the asynchronous operation. /// The task result contains a list of matching objects. Returns an empty list if no matches are found. /// + /// public async Task> GetMedicineByCodeOrNote(List codeNotes) { var filter = Builders.Filter.AnyIn("Codes", codeNotes.ToArray()); @@ -81,6 +86,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// A representing the asynchronous operation. /// The task result contains the if found; otherwise, . /// + /// public async Task GetMedicineByName(string name) { var filter = Builders.Filter.Eq(p => p.Name, name); @@ -96,6 +102,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// A representing the asynchronous operation. /// The task result contains a list of all objects. Returns an empty list if the collection is empty. /// + /// public async Task> GetAll() { var result = await Collection.FindAsync(_ => true); @@ -111,6 +118,8 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// A representing the asynchronous operation. /// The task result contains the if found; otherwise, . /// + /// public async Task GetMedicineById(ObjectId medicineId) { var filter = Builders.Filter.Eq(p => p.Id, medicineId); @@ -127,6 +136,8 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// A representing the asynchronous operation. /// The task result contains the newly inserted retrieved by its name, or if the lookup fails. /// + /// public async Task PostMedicine(Medicine medicine) { await Collection.InsertOneAsync(medicine); @@ -143,6 +154,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// A representing the asynchronous operation. /// The task result contains the same instance that was passed in, after the update operation has been issued. /// + /// public async Task UpdateMedicine(Medicine medicine) { await UpdateOneAsync(medicine.Id, medicine); @@ -155,6 +167,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// /// The of the medicine to delete. /// A representing the asynchronous delete operation. + /// public async Task DeleteMedicineById(ObjectId medicineId) { var filter = Builders.Filter.Eq(po => po.Id, medicineId); @@ -172,6 +185,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// An instance that can be used to further refine and execute the query. /// When no filters are provided, all medicines are returned sorted by name. /// + /// public IFindFluent GetPaginatedMedicines(PaginationFilter filter) { // Crear variable con la clase que construye los filtros que necesitamos @@ -220,6 +234,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// An representing the aggregation pipeline that, when executed, /// yields documents containing the distinct values of the specified field. /// + /// public IAggregateFluent GetDistinctFieldDataQuery(string field) { return Collection.Aggregate() @@ -238,6 +253,7 @@ public class MedicineRepository : MongoRepository, IMedicineRepository /// containing a list of distinct group names as strings. /// /// This method is not yet implemented. + /// public Task> GetAllGroups() { throw new NotImplementedException(); diff --git a/adas-core.Infrastructure/Repositories/MongoRepository.cs b/adas-core.Infrastructure/Repositories/MongoRepository.cs index f50e2f88..b95825fa 100644 --- a/adas-core.Infrastructure/Repositories/MongoRepository.cs +++ b/adas-core.Infrastructure/Repositories/MongoRepository.cs @@ -15,6 +15,7 @@ namespace adas_core.Infrastructure.Repositories; /// to customize schema setup, seeding, and insertion behavior. /// /// The domain model type persisted in the MongoDB collection. +/// public abstract class MongoRepository : IMongoRepository { /// @@ -33,6 +34,7 @@ public abstract class MongoRepository : IMongoRepository /// Initializes a new instance of the class using the provided database. /// /// The MongoDB database instance used to access collections. Must not be . + /// protected MongoRepository(IMongoDatabase database) { Db = database; @@ -42,6 +44,7 @@ public abstract class MongoRepository : IMongoRepository /// When implemented in a derived class, returns the name of the MongoDB collection used to store documents of type . /// /// The MongoDB collection name as a string. + /// public abstract string GetCollectionName(); /// @@ -73,6 +76,7 @@ public abstract class MongoRepository : IMongoRepository /// /// The document of type to insert. /// A representing the asynchronous insert operation. + /// public virtual async Task InsertOneAsync(T obj) { try @@ -93,6 +97,7 @@ public abstract class MongoRepository : IMongoRepository /// The value of the document's _id field. /// The replacement document of type . /// A representing the asynchronous replace/upsert operation. + /// public async Task UpdateOneAsync(ObjectId id, T obj) { try @@ -117,6 +122,7 @@ public abstract class MongoRepository : IMongoRepository /// A representing the asynchronous operation. /// The task result contains the deleted document, or / default if no document matched or an error occurred. /// + /// public async Task DeleteAsync(ObjectId id) { try @@ -136,6 +142,7 @@ public abstract class MongoRepository : IMongoRepository /// derived classes should override this method to define their own indexes. /// /// A representing the asynchronous index creation operation. + /// public virtual Task CreateIndexes() { return Task.CompletedTask; @@ -146,6 +153,7 @@ public abstract class MongoRepository : IMongoRepository /// derived classes should override this method to provide custom seeding logic. /// /// A representing the asynchronous seeding operation. + /// public virtual Task InsertInitialLoad() { return Task.CompletedTask; @@ -157,6 +165,7 @@ public abstract class MongoRepository : IMongoRepository /// /// The list of documents of type to insert. /// A representing the asynchronous bulk insert operation. + /// public virtual async Task InsertManyAsync(List obj) { try @@ -178,6 +187,7 @@ public abstract class MongoRepository : IMongoRepository /// The new value to assign. /// The existing value to replace. /// A representing the asynchronous update operation. + /// protected async Task UpdateManyObjectIdAsync(string nameId, ObjectId id, ObjectId oldId) { try @@ -202,6 +212,7 @@ public abstract class MongoRepository : IMongoRepository /// A representing the asynchronous operation. /// The task result contains the deleted document, or / default if no document matched or an error occurred. /// + /// protected async Task DeleteAsync(string id) { try @@ -225,6 +236,7 @@ public abstract class MongoRepository : IMongoRepository /// if a collection with the given name exists; otherwise, . /// Returns when an exception is thrown while querying the database. /// + /// protected bool CollectionExists(string collectionName) { try diff --git a/adas-core.Infrastructure/Repositories/NoticeRepository.cs b/adas-core.Infrastructure/Repositories/NoticeRepository.cs index cd9cf4fc..f90ff450 100644 --- a/adas-core.Infrastructure/Repositories/NoticeRepository.cs +++ b/adas-core.Infrastructure/Repositories/NoticeRepository.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing Notice entities in MongoDB. /// Provides CRUD operations for notices/notifications that can be displayed on screens. /// +/// public class NoticeRepository : MongoRepository, INoticeRepository { private readonly ApiSettings _apiSettings; @@ -23,6 +24,7 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// API settings containing collection names configuration. /// The MongoDB database instance. /// Thrown when apiSettings is null. + /// public NoticeRepository(IOptions? apiSettings, IMongoDatabase database) : base(database) { if (apiSettings != null) @@ -35,6 +37,7 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// Gets the name of the collection for notices. /// /// The collection name from API settings. + /// public override string GetCollectionName() { return _apiSettings.Notices; @@ -46,6 +49,8 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// /// The Notice entity to insert. /// Logs warning and silently fails on insertion error. + /// public override async Task InsertOneAsync(Notice notice) { try @@ -64,6 +69,7 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// /// The ObjectId of the notice to delete. /// Throws and re-throws exceptions after logging. + /// public async Task Delete(ObjectId id) { try @@ -83,6 +89,7 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// /// The Notice entity with updated values. /// Throws and re-throws exceptions after logging. + /// public async Task Update(Notice notice) { try @@ -101,6 +108,8 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// /// An enumerable of all Notice entities. /// Logs errors and returns empty list on failure. + /// public async Task> FindAll() { try @@ -121,6 +130,8 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// The ObjectId of the notice to retrieve. /// The Notice if found; otherwise, null. /// Logs errors and returns null on failure. + /// public async Task FindById(ObjectId id) { try @@ -143,6 +154,8 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// The date to filter notices by. /// An enumerable of Notice entities matching the date, or null on error. /// Logs errors and returns null on failure. + /// public async Task?> FindByDate(DateTime date) { try @@ -165,6 +178,7 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// The notice type to filter by. /// An enumerable of Notice entities matching the type, or null on error. /// Logs errors and returns null on failure. + /// public async Task?> FindByType(string type) { try @@ -187,6 +201,7 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// The ObjectId of the display to filter by. /// An enumerable of Notice entities for the display, or null on error. /// Logs errors and returns null on failure. + /// public async Task?> FindByDisplayId(ObjectId displayId) { try @@ -207,6 +222,8 @@ public class NoticeRepository : MongoRepository, INoticeRepository /// Creates the necessary indexes for the Notice collection. /// Creates compound indexes on (noticeType, noticeDate) and (noticeDate) for improved query performance. /// + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; diff --git a/adas-core.Infrastructure/Repositories/ObservationArchiveRepository.cs b/adas-core.Infrastructure/Repositories/ObservationArchiveRepository.cs index 27bfba39..7a4516fe 100644 --- a/adas-core.Infrastructure/Repositories/ObservationArchiveRepository.cs +++ b/adas-core.Infrastructure/Repositories/ObservationArchiveRepository.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing PatientObservation archive entities in MongoDB. /// Provides operations for storing and retrieving historical patient observations. /// +/// public class ObservationArchiveRepository : MongoRepository, IObservationArchiveRepository { private readonly ApiSettings _apiSettings; @@ -23,6 +24,7 @@ public class ObservationArchiveRepository : MongoRepository, /// API settings containing collection names configuration. /// The MongoDB database instance. /// Thrown when apiSettings is null. + /// public ObservationArchiveRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings)); @@ -38,6 +40,8 @@ public class ObservationArchiveRepository : MongoRepository, /// The cutoff date to filter observations (inclusive). /// Optional list of observation names to filter by. If null, retrieves all distinct observations. /// A list of PatientObservation entities sorted by time descending. + /// public async Task> AggregatedPatientLastObservations(ObjectId patientId, int num, DateTime lastDate, List? filterObservations = null) { @@ -64,6 +68,7 @@ public class ObservationArchiveRepository : MongoRepository, /// Gets the name of the collection for archived patient observations. /// /// The collection name from API settings, or default "archive_patients_observations". + /// public override string GetCollectionName() { return _apiSettings.ArchivePatientsObservations ?? "archive_patients_observations"; @@ -76,6 +81,7 @@ public class ObservationArchiveRepository : MongoRepository, /// The PatientObservation entity to insert. /// Throws when duplicate key error persists after max retries. /// Throws when insertion fails for reasons other than duplicate key. + /// public new async Task InsertOneAsync(PatientObservation patientObservation) { const int maxRetries = 2; // Número máximo de reintentos @@ -117,6 +123,8 @@ public class ObservationArchiveRepository : MongoRepository, /// /// The cutoff date. Observations older than this date will be deleted. /// The number of deleted documents. + /// public async Task DeleteBeforeDate(DateTime date) { var filter = Builders.Filter.Lt(po => po.Time, date); @@ -128,6 +136,7 @@ public class ObservationArchiveRepository : MongoRepository, /// /// An enumerable of PatientObservation entities to insert. /// The count of successfully inserted documents. + /// public async Task InsertBatch(IEnumerable observations) { var writes = new List>(); @@ -143,6 +152,8 @@ public class ObservationArchiveRepository : MongoRepository, /// /// The ObjectId of the patient. /// A list of all PatientObservation entities for the patient. + /// public async Task> FindAllFromPatient(ObjectId patientId) { var filter = Builders.Filter.Eq(p => p.PatientId, patientId); @@ -158,6 +169,7 @@ public class ObservationArchiveRepository : MongoRepository, /// The ObjectId of the patient. /// Optional pre-filtered list of observation names. If null or empty, computes distinct values. /// A list of distinct observation name strings. + /// private async Task> AggregatePatientObservations(ObjectId patientId, List? filterObservations = null) { diff --git a/adas-core.Infrastructure/Repositories/ObservationRepository.cs b/adas-core.Infrastructure/Repositories/ObservationRepository.cs index c5990d1f..fef18ef2 100644 --- a/adas-core.Infrastructure/Repositories/ObservationRepository.cs +++ b/adas-core.Infrastructure/Repositories/ObservationRepository.cs @@ -21,6 +21,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing entities in MongoDB. /// Provides specialized query, aggregation, retention, and expiration operations for patient clinical observations. /// +/// public class ObservationRepository : MongoRepository, IObservationRepository { private readonly ApiSettings _apiSettings; @@ -34,6 +35,7 @@ public class ObservationRepository : MongoRepository, IObser /// The MongoDB database instance used to access the collection. /// The logger used to record diagnostic and error information. /// Thrown when is . + /// public ObservationRepository( IOptions? apiSettings, IMongoDatabase database, @@ -56,6 +58,7 @@ public class ObservationRepository : MongoRepository, IObser /// Falls back to the default "patients_observations" collection name when not configured in the API settings. /// /// The collection name retrieved from the API settings, or "patients_observations" if not configured. + /// public override string GetCollectionName() { return _apiSettings.PatientsObservations ?? "patients_observations"; @@ -70,6 +73,7 @@ public class ObservationRepository : MongoRepository, IObser /// The code identifying the observation type within the coding system. /// The maximum number of recent observations to return. Defaults to 2. /// An containing the matching observations ordered from newest to oldest. + /// public async Task> FindLastObservations(ObjectId patientId, string codingSystem, string code, int num = 2) { @@ -96,6 +100,7 @@ public class ObservationRepository : MongoRepository, IObser /// The coding system to filter observations by. /// The maximum number of recent observations to return. Defaults to 10. /// A containing the matching observations ordered from newest to oldest. + /// public async Task> FindLastObservationsByCodingSystem(ObjectId patientId, string codingSystem, int num = 10) { @@ -121,6 +126,7 @@ public class ObservationRepository : MongoRepository, IObser /// The maximum number of observations to return per observation name. /// Optional list of observation names to restrict the query to. When , all distinct names are discovered. /// A containing the aggregated latest observations across all matching names. + /// public async Task> AggregatedPatientLastObservations(ObjectId patientId, int num, List? filterObservations = null) { @@ -157,6 +163,7 @@ public class ObservationRepository : MongoRepository, IObser /// The inclusive upper bound (UTC) for the observation time field. /// Optional list of observation names to restrict the query to. When , all distinct names are discovered. /// A containing the matching observations. + /// public async Task> AggregatedPatientLastObservationsByLastDate(ObjectId patientId, int num, DateTime lastDate, List? filterObservations = null) { @@ -195,6 +202,7 @@ public class ObservationRepository : MongoRepository, IObser /// A containing the matching observations. /// Returns an empty list when an exception occurs while querying the database. /// + /// public async Task> AggregatedPatientLastObservationsByField(ObjectId patientId, List? filterObservations) { @@ -266,6 +274,7 @@ public class ObservationRepository : MongoRepository, IObser /// A with one document per time bucket. /// Returns an empty list when an exception occurs while executing the pipeline. /// + /// public async Task> AggregatedPatientGroupedObservations(ObjectId patientId, GroupedField groupedField) { @@ -550,6 +559,8 @@ public class ObservationRepository : MongoRepository, IObser /// A representing the asynchronous insert operation. /// Rethrown after the maximum number of retries has been reached when a duplicate-key error keeps occurring. /// Rethrown when an unexpected error occurs during the insert operation. + /// public new async Task InsertOneAsync(PatientObservation patientObservation) { const int maxRetries = 2; // Número máximo de reintentos @@ -586,6 +597,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// The of the patient whose observations should be removed. /// A representing the asynchronous delete operation. + /// public async Task DeleteByPatientId(ObjectId id) { var filter = Builders.Filter.Eq(po => po.PatientId, id); @@ -599,6 +611,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// An that can be enumerated to retrieve the patient's observations. /// + /// public async Task> FindByPatientIdAsync(ObjectId patientId) { var filter = Builders.Filter.Eq(ob => ob.PatientId, patientId); @@ -615,6 +628,7 @@ public class ObservationRepository : MongoRepository, IObser /// An containing the matching observations, /// retrieved with a server-side batch size of 100. /// + /// public async Task> FindByPatientIdAndCodingSystemAsync(ObjectId patientId, string codingSystem, string name) { @@ -636,6 +650,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// The of the observation to delete. /// A representing the asynchronous delete operation. + /// public new async Task DeleteAsync(ObjectId id) { var filter = Builders.Filter.Eq(obs => obs.Id, id); @@ -650,6 +665,7 @@ public class ObservationRepository : MongoRepository, IObser /// The observation name to filter by. /// The retention window expressed in days. Observations older than UtcNow - retentionPolicyValue days are removed. /// A containing the documents that were deleted. + /// public async Task> DeleteOlderDaysAsync(string name, int retentionPolicyValue) { var dateLimit = DateTime.UtcNow.AddDays(-1 * retentionPolicyValue); @@ -672,6 +688,7 @@ public class ObservationRepository : MongoRepository, IObser /// The observation name to filter by. /// The retention window expressed in seconds. Observations older than UtcNow - retentionPolicyValue seconds are removed. /// A containing the documents that were deleted. + /// public async Task> DeleteOlderSecondsAsync(string name, int retentionPolicyValue) { var dateLimit = DateTime.UtcNow.AddSeconds(-1 * retentionPolicyValue); @@ -694,6 +711,7 @@ public class ObservationRepository : MongoRepository, IObser /// The observation name to apply the retention policy to. /// The maximum number of observations to retain. The remainder are deleted. /// A containing the documents that were deleted. Returns an empty list when nothing had to be deleted. + /// public async Task> DeleteOlderNumberAsync(string name, int retentionPolicyValue) { var builder = Builders.Filter; @@ -724,6 +742,7 @@ public class ObservationRepository : MongoRepository, IObser /// The unique identifier of the patient. /// The external system identifier to look up. /// if a matching observation exists; otherwise, . + /// public async Task ExistBySystemId(ObjectId patientid, string systemId) { return await Collection.Find(Builders.Filter.And( @@ -745,6 +764,7 @@ public class ObservationRepository : MongoRepository, IObser /// A representing the asynchronous operation. /// The task result contains the most recent matching observation, or if no observation matches. /// + /// public async Task FindLastObservationBeforeDate(ObjectId patientId, string? name, DateTime date) { @@ -772,6 +792,7 @@ public class ObservationRepository : MongoRepository, IObser /// A representing the asynchronous operation. /// The task result contains a list of matching observations, which may be empty. /// + /// public async Task?> FindAnyWithSameDate(ObjectId patientId, string? name, DateTime date) { var builder = Builders.Filter; @@ -792,6 +813,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// A containing the matching observations, which may be empty. /// + /// public async Task> FindAnyBeforeDate(ObjectId patientId, DateTime date) { var filterBuilder = Builders.Filter; @@ -817,6 +839,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// A containing the most recent observation for each distinct value. /// + /// public async Task> FindLatestUniqueValuesByName(ObjectId patientId, string name, int? expires) { @@ -867,6 +890,8 @@ public class ObservationRepository : MongoRepository, IObser /// /// A containing one observation per unique (Location, Type) combination. /// + /// public async Task> AggregatedPatientActiveIntravenousLinesObservations(ObjectId patientId) { var results = new List(); @@ -899,6 +924,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// A mapping each patient's to the UTC timestamp of their latest observation. /// + /// public async Task> FindAllLastPatientObservationTime() { var group = new BsonDocument @@ -950,6 +976,8 @@ public class ObservationRepository : MongoRepository, IObser /// A representing the asynchronous operation. /// The task result contains the if found; otherwise, . /// + /// public async Task FindById(ObjectId id) { var filter = Builders.Filter.Eq(o => o.Id, id); @@ -967,6 +995,7 @@ public class ObservationRepository : MongoRepository, IObser /// A representing the asynchronous operation. /// The task result contains a list of observations, which may be empty. /// + /// public async Task?> FindByPatientId(ObjectId id) { var filter = Builders.Filter.Eq(o => o.PatientId, id); @@ -982,6 +1011,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// The whose identifies the document to update. /// A representing the asynchronous update operation. + /// public async Task Update(PatientObservation observation) { await UpdateOneAsync(observation.Id, observation); @@ -995,6 +1025,7 @@ public class ObservationRepository : MongoRepository, IObser /// The new value to assign. /// The existing value to replace. /// A representing the asynchronous update operation. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await UpdateManyObjectIdAsync(nameId, id, oldId); @@ -1005,6 +1036,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// The list of instances to mark as expired. The set of identifiers is used to build the update filter. /// A representing the asynchronous update operation. + /// public async Task UpdateExpiredObservations(List expiredObservations) { var filter = Builders.Filter @@ -1020,6 +1052,7 @@ public class ObservationRepository : MongoRepository, IObser /// The observations whose identifiers form the target set of the update. /// The describing the changes to apply to each matching document. /// A representing the asynchronous update operation. + /// public async Task UpdateMany(IEnumerable patientObservations, UpdateDefinition update) { @@ -1034,6 +1067,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// An containing all observations. /// + /// public async Task> FindAll() { var result = await Collection.FindAsync(_ => true); @@ -1051,6 +1085,7 @@ public class ObservationRepository : MongoRepository, IObser /// (in minutes). Observations whose time is older than DateTime.Now - expires minutes are marked as expired. /// /// A representing the asynchronous update operation. + /// public async Task ExpireExpiredObservations( List configObservationsToExpire) { @@ -1095,6 +1130,10 @@ public class ObservationRepository : MongoRepository, IObser /// /// An containing the matching non-expired observations. /// + /// + /// public async Task> FindNotExpired(List? filterObservations) { var filterBuilder = Builders.Filter; @@ -1129,6 +1168,10 @@ public class ObservationRepository : MongoRepository, IObser /// Thrown when is null, empty, or whitespace, /// or when its length exceeds 100 characters. /// + /// + /// public async Task> FindByName(string name, DateTime? fromDate = null) { if (string.IsNullOrWhiteSpace(name)) @@ -1167,6 +1210,8 @@ public class ObservationRepository : MongoRepository, IObser /// /// An instance that can be used to further refine and execute the query. /// + /// public IFindFluent GetPaginatedObservations(PaginationFilter filter) { // Crear variable con la clase que construye los filtros @@ -1214,6 +1259,10 @@ public class ObservationRepository : MongoRepository, IObser /// /// An containing the matching observations ordered from newest to oldest. /// + /// + /// public async Task> FindLastNotExpiredObservatonsByPatient(ObjectId patientId, string name, int? endAfter = null, int? num = null) { @@ -1254,6 +1303,7 @@ public class ObservationRepository : MongoRepository, IObser /// /// A representing the asynchronous index creation operation. /// Rethrown when an error occurs while creating the indexes. + /// public override async Task CreateIndexes() { try @@ -1296,6 +1346,7 @@ public class ObservationRepository : MongoRepository, IObser /// A containing the observation names to aggregate over. /// Returns an empty list if no observations exist for the patient. /// + /// private async Task> AggregatePatientObservations(ObjectId patientId, List? filterObservations = null) { diff --git a/adas-core.Infrastructure/Repositories/POCMappingRepository.cs b/adas-core.Infrastructure/Repositories/POCMappingRepository.cs index b884bfb4..8ca0f0ee 100644 --- a/adas-core.Infrastructure/Repositories/POCMappingRepository.cs +++ b/adas-core.Infrastructure/Repositories/POCMappingRepository.cs @@ -9,6 +9,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Provides a MongoDB-backed repository implementation for PoCMapping entities. /// +/// public class PoCMappingRepository : MongoRepository, IPoCMappingRepository { private readonly ApiSettings _apiSettings; @@ -30,6 +31,7 @@ public class PoCMappingRepository : MongoRepository, IPoCMappingRepo /// Retrieves the name of the mappings collection from the API settings configuration. /// /// The mappings collection name as configured in _apiSettings. + /// public override string GetCollectionName() { return _apiSettings.Mappings; @@ -40,6 +42,7 @@ public class PoCMappingRepository : MongoRepository, IPoCMappingRepo /// /// The unique identifier (Id) of the to look up. /// A Task TResult containing the matching PoCMapping, or null if no document with the specified key exists in the collection. + /// public async Task FindByKey(string key) { var filterBuilder = Builders.Filter; diff --git a/adas-core.Infrastructure/Repositories/PatientArchiveRepository.cs b/adas-core.Infrastructure/Repositories/PatientArchiveRepository.cs index f75b8b37..e250b2bd 100644 --- a/adas-core.Infrastructure/Repositories/PatientArchiveRepository.cs +++ b/adas-core.Infrastructure/Repositories/PatientArchiveRepository.cs @@ -14,6 +14,7 @@ namespace adas_core.Infrastructure.Repositories; /// Repository implementation for managing Patient archive entities in MongoDB. /// Provides CRUD operations for historical/archived patient data. /// +/// public class PatientArchiveRepository : MongoRepository, IPatientArchiveRepository { private readonly ApiSettings _apiSettings; @@ -24,6 +25,7 @@ public class PatientArchiveRepository : MongoRepository, IPatientArchiv /// API settings containing collection names configuration. /// The MongoDB database instance. /// Thrown when apiSettings is null. + /// public PatientArchiveRepository(IOptions apiSettings, IMongoDatabase database) : base(database) { if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings)); @@ -34,6 +36,7 @@ public class PatientArchiveRepository : MongoRepository, IPatientArchiv /// Gets the name of the collection for archived patients. /// /// The collection name from API settings, or default "archive_patient". + /// public override string GetCollectionName() { return _apiSettings.ArchivePatient ?? "archive_patient"; @@ -44,6 +47,7 @@ public class PatientArchiveRepository : MongoRepository, IPatientArchiv /// /// The patient number to search for. /// The Patient if found; otherwise, null. + /// public async Task FindByPatientNumber(string patientNumber) { if (string.IsNullOrWhiteSpace(patientNumber)) return null; @@ -60,6 +64,7 @@ public class PatientArchiveRepository : MongoRepository, IPatientArchiv /// Retrieves all archived patients from the collection. /// /// A list of all Patient entities in the archive. + /// public async Task> FindAll() { var filterBuilder = Builders.Filter; @@ -77,6 +82,8 @@ public class PatientArchiveRepository : MongoRepository, IPatientArchiv /// The patient number to search for. /// The unit ID (currently not used in query, kept for interface compatibility). /// The unique Patient if exactly one match is found; otherwise, null if multiple or none. + /// public async Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId) { if (string.IsNullOrWhiteSpace(patientNumber)) return null; @@ -96,6 +103,8 @@ public class PatientArchiveRepository : MongoRepository, IPatientArchiv /// /// The Patient entity to insert or merge. /// Logs warning and silently fails on error. + /// public override async Task InsertOneAsync(Patient obj) { try @@ -154,6 +163,7 @@ public class PatientArchiveRepository : MongoRepository, IPatientArchiv /// Creates the necessary indexes for the PatientArchive collection. /// Creates an index on patientNumber for improved query performance. /// + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; diff --git a/adas-core.Infrastructure/Repositories/PatientCarePlanRepository.cs b/adas-core.Infrastructure/Repositories/PatientCarePlanRepository.cs index 689e9943..265e1e84 100644 --- a/adas-core.Infrastructure/Repositories/PatientCarePlanRepository.cs +++ b/adas-core.Infrastructure/Repositories/PatientCarePlanRepository.cs @@ -12,6 +12,8 @@ namespace adas_core.Infrastructure.Repositories; /// providing concrete persistence operations defined by the contract. /// /// The type of the patient care plan entity managed by this repository. +/// public class PatientCarePlanRepository : MongoRepository, IPatientCarePlanRepository { #region Properties @@ -28,6 +30,7 @@ public class PatientCarePlanRepository : MongoRepository, IPati /// The string identifier of the patient whose object identifiers will be updated. /// The new to assign to the patient's records. /// The existing to be replaced. + /// public async Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId) { await UpdateManyObjectIdAsync(patientid, patientId, oldId); @@ -61,6 +64,7 @@ public class PatientCarePlanRepository : MongoRepository, IPati /// Returns the collection name for patient care plan data, using the configured setting if available or a default fallback otherwise. /// /// The patient care plan collection name from _apiSettings.PatientCarePlan, or "patients_care_plan" when the setting is null. + /// public override string GetCollectionName() { return _apiSettings.PatientCarePlan ?? "patients_care_plan"; @@ -72,6 +76,7 @@ public class PatientCarePlanRepository : MongoRepository, IPati /// /// The unique identifier of the patient whose care plans should be retrieved. /// A task that represents the asynchronous operation. The task result contains a list of objects associated with the specified patient, or an empty list if none are found. + /// public async Task> FindByPatientId(ObjectId patientId) { var result = await Collection.FindAsync(Builders.Filter.Eq(p => p.PatientId, patientId)); @@ -83,6 +88,7 @@ public class PatientCarePlanRepository : MongoRepository, IPati /// /// The unique identifier of the user whose patient care plans are being queried. /// A list of instances matching the specified user identifier; an empty list is returned if no plans are found. + /// public async Task> FindByUserId(ObjectId userId) { var result = await Collection.FindAsync(Builders.Filter.Eq(p => p.UserId, userId)); @@ -93,6 +99,7 @@ public class PatientCarePlanRepository : MongoRepository, IPati /// Retrieves all patient care plans from the data store without applying any filter. /// /// A task that represents the asynchronous operation, containing a list of all records. + /// public async Task> FindAll() { var result = await Collection.Find(Builders.Filter.Empty).ToListAsync(); diff --git a/adas-core.Infrastructure/Repositories/PatientRepository.cs b/adas-core.Infrastructure/Repositories/PatientRepository.cs index affe53dc..8bebeec0 100644 --- a/adas-core.Infrastructure/Repositories/PatientRepository.cs +++ b/adas-core.Infrastructure/Repositories/PatientRepository.cs @@ -18,6 +18,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Provides a MongoDB-backed repository implementation for managing patient data, exposing patient-specific data access operations defined by the IPatientRepository contract. /// +/// public class PatientRepository : MongoRepository, IPatientRepository { private readonly ApiSettings _apiSettings; @@ -47,6 +48,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// or falling back to the default "patients" if the setting is null. /// /// The configured patients collection name, or "patients" as a default when the setting is not set. + /// public override string GetCollectionName() { return _apiSettings.Patients ?? "patients"; @@ -58,6 +60,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The unique identifier of the patient to locate. /// A instance matching the provided id, or null if not found or on error. + /// public async Task FindById(ObjectId id) { try @@ -80,6 +83,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The point of care identifier used to locate the patient. /// A instance if a match is found; otherwise, null. + /// public async Task FindByPointOfCareId(ObjectId id) { try @@ -103,6 +107,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// The identifier of the unit to filter by. /// The identifier of the point of care to filter by. /// The first matching , or null if no patient is found or an error is encountered. + /// public async Task FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare) { try @@ -129,6 +134,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The location information used to locate the patient. Can be null. /// A matching the location criteria, or null if no match is found or the location is null. + /// public async Task FindByLocation(PatientLocation? location) { if (location == null) @@ -155,6 +161,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// Asynchronously inserts a new record, setting its creation date to the current UTC time. If the insertion fails but an existing patient with the same patient number is found at the same location, the exception is logged as a warning; otherwise, the error is logged and rethrown. /// /// The entity to insert into the data store. + /// public override async Task InsertOneAsync(Patient patient) { try @@ -183,6 +190,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// Updates an existing patient record, refreshing the update timestamp to the current UTC time before persisting the changes. /// /// The patient entity containing the updated information to be saved. + /// public async Task Update(Patient patient) { patient.UpdateDate = DateTime.UtcNow; @@ -193,6 +201,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// Deletes a patient from the collection that matches the specified identifier. /// /// The unique identifier of the patient to remove. + /// public async Task Delete(ObjectId id) { var filter = Builders.Filter.Eq(x => x.Id, id); @@ -204,6 +213,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The unique identifier of the patient whose location will be updated. /// The new location to assign to the patient. + /// public async Task UpdateLocation(ObjectId id, PatientLocation location) { var patient = await FindById(id); @@ -236,6 +246,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The unique identifier of the patient whose location will be updated. /// The new point of care (location) identifier to assign to the patient. + /// public async Task UpdateLocation(ObjectId id, ObjectId location) { var patient = await FindById(id); @@ -255,6 +266,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The unique identifier of the patient whose attending doctor is being updated. /// The new attending doctor to assign to the patient. + /// public async Task UpdateAttendingDoctor(ObjectId id, Person attendingDoctor) { var update = Builders.Update @@ -272,6 +284,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// The new patient number to apply when is true. /// The new information to store for the patient. /// Indicates whether the patient number should be updated as part of the operation; defaults to true. + /// public async Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true) { var filterBuilder = Builders.Filter; @@ -615,6 +628,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// The list of unit identifiers used to filter patients. /// The name of the type to validate against the MasterListType enumeration. /// A task that represents the asynchronous operation. The task result contains a list of Patient objects matching the specified unit identifiers, or an empty list if the type name is invalid. + /// public async Task> GetPatientsByUnitIds(List unitIds, string typeName) { var isParsed = Enum.TryParse(typeName, out _); @@ -630,6 +644,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The unit identifier used to filter patients. /// The number of patients matching the specified unit identifier, or 0 if an error occurs. + /// public async Task CountByUnitId(ObjectId unitId) { try @@ -818,6 +833,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// Retrieves all records from the data store. /// /// A task that represents the asynchronous operation, containing a list of all patients. + /// public async Task> FindAll() { return (await Collection.FindAsync(Builders.Filter.Empty)).ToList(); @@ -829,6 +845,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The unit or point of care used to filter the patients. /// A task containing a list of objects whose unit matches the specified point of care; an empty list is returned when no matches are found. + /// public async Task> FindByPointOfCare(string pointOfCare) { var filterBuilder = Builders.Filter; @@ -844,6 +861,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The identifier of the point of care used to filter the patient records. /// A task that represents the asynchronous operation, containing a list of patients matching the specified point of care. + /// public async Task> FindByPointOfCare(ObjectId pointOfCare) { var filterBuilder = Builders.Filter; @@ -932,6 +950,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The pagination and filtering criteria, including optional text, time range, unit, and point of care filters. /// A find fluent for the filtered and sorted patient query. + /// public IFindFluent GetPaginatedPatients(PaginationFilter filter) { var filterBuilder = Builders.Filter; @@ -981,6 +1000,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The cutoff date; patients with an UpdateDate strictly earlier than this value, or with no UpdateDate set, will be returned. /// A task that resolves to a list of instances matching the filter criteria. + /// public async Task> FindPatientsNotUpdatedSince(DateTime date) { var filter = Builders.Filter.Or( @@ -999,6 +1019,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// A task that resolves to a list of discharged records, /// or an empty list if the operation fails. + /// public async Task> FindDischargedPatients() { try @@ -1022,6 +1043,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The patient entity containing the updated values and the identifier of the record to modify. /// The updated after the modification is applied, or null if no matching document exists. + /// public async Task UpdateOne(Patient updatedPatient) { var filter = Builders.Filter.Eq("_id", updatedPatient.Id); @@ -1042,6 +1064,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// The unique identifier of the patient to update. /// The patient object containing the new values for the incoming data fields. /// The updated document after the modification, or null if no document was found. + /// public async Task UpdatePatientIncomingData(ObjectId patientId, Patient person) { var filter = Builders.Filter.Eq("_id", patientId); @@ -1064,6 +1087,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// The unique identifier of the patient whose data will be updated. /// The patient object containing the new demographic and clinical values to persist. /// The updated document, or null if no patient with the specified identifier was found. + /// public async Task UpdatePatientDemographicData(ObjectId patientId, Patient person) { var filter = Builders.Filter.Eq("_id", patientId); @@ -1084,6 +1108,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// Creates MongoDB indexes for the Patient collection, including a unique index on the patientNumber field and a non-unique index on the admTime field, using background index creation. /// + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; @@ -1111,6 +1136,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// The request containing the optional start and end time values used to build each range filter. /// The collection of filter definitions to which the constructed filters are added. /// The builder used to create the Gte and Lte filter definitions for each time range. + /// private static void AddTimeFilters(FilteredRequest requestFilter, List> filters, FilterDefinitionBuilder filterBuilder) { @@ -1164,6 +1190,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// /// The ObjectId of the point of care used to filter the patients. /// A task that represents the asynchronous operation, containing a list of patients matching the specified point of care. + /// public async Task> FindAllByPointOfCareId(ObjectId pointOfCare) { var filterBuilder = Builders.Filter; @@ -1181,6 +1208,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// The list of filter definitions to which the new filter will be appended. /// The pagination filter containing the request criteria used to build the default filter. /// The builder used to construct the MongoDB filter definitions for the entity. + /// private void AddDefaultFilters(List> filters, PaginationFilter filter, FilterDefinitionBuilder filterBuilder) { @@ -1206,6 +1234,7 @@ public class PatientRepository : MongoRepository, IPatientRepository /// The list of filter definitions to combine; when empty, an empty filter (match-all) is used. /// The sort definition to apply to the query results. /// An configured with the combined filter and sort. + /// private IFindFluent CreateFindFluent(List> filters, SortDefinition sort) { diff --git a/adas-core.Infrastructure/Repositories/PoCSettingsRepository.cs b/adas-core.Infrastructure/Repositories/PoCSettingsRepository.cs index 4abb8a51..dc507f7a 100644 --- a/adas-core.Infrastructure/Repositories/PoCSettingsRepository.cs +++ b/adas-core.Infrastructure/Repositories/PoCSettingsRepository.cs @@ -14,6 +14,8 @@ namespace adas_core.Infrastructure.Repositories; /// Represents a MongoDB-backed repository for entities, implementing the contract to provide data access operations. /// /// The type of the settings entity managed by the repository. +/// public class PoCSettingsRepository : MongoRepository, IPoCSettingsRepository { private readonly ApiSettings _apiSettings; @@ -36,6 +38,7 @@ public class PoCSettingsRepository : MongoRepository, IPoCSettingsR /// Retrieves the collection name used for Proof of Concept (PoC) settings, returning the value from the API settings or the default "poc_settings" when no value is configured. /// /// The configured PoC settings collection name, or "poc_settings" as a fallback when _apiSettings.PoCSettings is null. + /// public override string GetCollectionName() { return _apiSettings.PoCSettings ?? "poc_settings"; @@ -45,6 +48,7 @@ public class PoCSettingsRepository : MongoRepository, IPoCSettingsR /// Deletes the PoCSettings document matching the specified identifier from the collection. /// /// The unique identifier of the PoCSettings document to delete. + /// public async Task Delete(ObjectId id) { try @@ -64,6 +68,7 @@ public class PoCSettingsRepository : MongoRepository, IPoCSettingsR /// If an error occurs during the retrieval, the exception is logged and an empty list is returned as a fallback. /// /// A task that represents the asynchronous operation. The task result contains a list of all PoCSettings records, or an empty list if an error occurs. + /// public async Task> FindAll() { try @@ -84,6 +89,7 @@ public class PoCSettingsRepository : MongoRepository, IPoCSettingsR /// /// The used to locate the PoCSettings document. /// A task that represents the asynchronous operation. The task result contains the matching or null if not found. + /// public async Task FindById(ObjectId id) { try @@ -105,6 +111,7 @@ public class PoCSettingsRepository : MongoRepository, IPoCSettingsR /// /// The patient location provided as search criteria. Detailed attribute-based filtering by location fields is currently commented out. /// The first matching PoCSettings record, or null if no record is found. + /// public async Task FindByLocation(PatientLocation location) { try @@ -137,6 +144,7 @@ public class PoCSettingsRepository : MongoRepository, IPoCSettingsR /// Updates the existing PoC (Proof of Concept) settings asynchronously. If the update fails, the exception is logged and rethrown to the caller. /// /// The PoC settings entity to be updated, identified by its Id. + /// public async Task Update(PoCSettings pocSettings) { try @@ -153,6 +161,7 @@ public class PoCSettingsRepository : MongoRepository, IPoCSettingsR /// /// Creates the MongoDB indexes required for the collection, applying non-unique background indexing on the patientLocation field. /// + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; diff --git a/adas-core.Infrastructure/Repositories/PointOfCareRepository.cs b/adas-core.Infrastructure/Repositories/PointOfCareRepository.cs index 238ad7ad..45b396f2 100644 --- a/adas-core.Infrastructure/Repositories/PointOfCareRepository.cs +++ b/adas-core.Infrastructure/Repositories/PointOfCareRepository.cs @@ -16,6 +16,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Represents a MongoDB-backed repository for entities, providing the persistence operations defined by the interface. /// +/// public class PointOfCareRepository : MongoRepository, IPointOfCareRepository { private readonly ApiSettings _apiSettings; @@ -41,6 +42,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// Retrieves the collection name used for Locations operations from the API settings configuration. /// /// The configured Locations collection name retrieved from the API settings. + /// public override string GetCollectionName() { return _apiSettings.Locations; @@ -51,6 +53,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// If the base insert operation fails, the exception is written to the console and logged, then rethrown to preserve the original failure. /// /// The entity to insert. + /// public override async Task InsertOneAsync(PointOfCare pointOfCare) { try @@ -70,6 +73,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// Any exception encountered during the delete operation is logged and rethrown to the caller. /// /// The unique identifier of the entity to remove. + /// public async Task Delete(ObjectId id) { try @@ -90,6 +94,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The identifier of the unit whose related records should be removed. /// A task that resolves to true when the records are deleted, or false when an error occurs during the operation. + /// public async Task DeleteManyByUnitId(ObjectId unitId) { try @@ -110,6 +115,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// Updates an existing PointOfCare entity asynchronously in the data store. /// /// The PointOfCare entity to update, identified by its Id. + /// public async Task Update(PointOfCare pointOfCare) { try @@ -128,6 +134,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The ObjectId of the PointOfCare document to update. /// The Unit object whose Name and Id values will be set on the matching document. + /// public async Task UpdateUnitId(ObjectId id, Unit unit) { var filterBuilder = Builders.Filter; @@ -146,6 +153,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The unique identifier of the Point of Care whose relay configuration will be updated. /// The collection of relays whose identifiers will be stored as the new relay configuration. + /// public async Task UpdateRelayConfig(ObjectId pocId, List relayConfig) { var filterBuilder = Builders.Filter; @@ -161,6 +169,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The identifier of the point of care whose relay configuration will be updated. /// The new list of relay identifiers to assign to the point of care's configuration. + /// public async Task UpdateRelayConfig(ObjectId pocId, List relayConfig) { var filterBuilder = Builders.Filter; @@ -176,6 +185,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The unique identifier of the entity to update. /// The new configuration values to apply to the entity. + /// public async Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration) { var filterBuilder = Builders.Filter; @@ -193,6 +203,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The unique of the point of care to retrieve. /// A if a matching record is found; otherwise, null. + /// public async Task FindById(ObjectId id) { try @@ -215,6 +226,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// The point of care status used to filter the results. /// When true, filters out entries whose bed matches one of the known values; otherwise virtual entries are included. /// A task that resolves to an containing the matching entries, or an empty collection if the query fails. + /// public async Task> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare status, bool excludeVirtual = false) { @@ -292,6 +304,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The identifier of the unit whose points of care should be retrieved. /// A task that yields a collection of instances matching the given unit, or null if the search fails. + /// public async Task?> FindAllByUnitId(ObjectId unit) { try @@ -314,6 +327,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The room identifier used to filter the point-of-care records. /// A task that represents the asynchronous operation. The task result contains a collection of matching entries, or if the search fails. + /// public async Task?> FindByRoom(string room) { try @@ -336,6 +350,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The bed identifier used to filter the point of care records. /// A task containing an enumerable collection of matching records, or null if an error occurs. + /// public async Task?> FindByBed(string bed) { try @@ -359,6 +374,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// The MongoDB filter definition used to match the desired documents. /// An optional projection definition to limit or transform the fields returned in each document. When null, the full documents are returned. /// A task that represents the asynchronous operation, containing a list of documents that match the filter. + /// public async Task> FindByFilter(FilterDefinition filter, ProjectionDefinition? projection = null) { @@ -372,6 +388,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The identifier of the unit whose point-of-care entries should be counted. /// A that resolves to the number of matching point-of-care documents for the given unit. + /// public async Task CountByUnitId(ObjectId unitId) { try @@ -446,6 +463,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The unique identifier of the point of care whose configuration is being requested. /// A containing the matching with its configuration, or null if no record exists for the given identifier. + /// public async Task GetPoCConfiguration(ObjectId pocId) { var filter = Builders.Filter.Eq(p => p.Id, pocId); @@ -461,6 +479,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// Retrieves all records from the underlying data store using an empty filter. /// /// A containing a of items, or null when no results are returned. + /// public async Task?> GetAll() { var filter = Builders.Filter.Empty; @@ -472,6 +491,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The unique identifier of the point of care to retrieve. /// A task that represents the asynchronous operation, containing the matching with its resolved beacon, camera, and relay configuration, or null if not found. + /// public async Task FindByIdAllConfig(ObjectId id) { return await Collection.Aggregate() @@ -515,6 +535,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// contra el total de cámaras en uso, independientemente del volumen de datos. /// /// Un conjunto hash con los de las cámaras en uso. + /// public async Task> FindAllIdCamerasInUse() { var distinctIds = await Collection @@ -527,6 +548,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// Retrieves all distinct beacon identifiers currently referenced by any point-of-care configuration. /// /// A set containing the unique values of beacons in use across all point-of-care records. + /// public async Task> FindAllIdBeaconsInUse() { var distinctIds = await Collection @@ -541,6 +563,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The identifier of the unit used to filter the points of care. /// A task that returns a collection of PointOfCare with their associated device lists populated, or null if an error occurs during the query. + /// public async Task?> FindAllByUnitIdWithDevices(ObjectId unitId) { try @@ -592,6 +615,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// Retrieves the set of distinct relay identifiers currently referenced by any configuration in the collection. /// /// A of values containing all unique relay IDs found across the configuration.relayIdList field of every document. + /// public async Task> FindAllIdRelaysInUse() { var distinctIds = await Collection @@ -605,6 +629,8 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// Retrieves all point-of-care configurations, joining each configuration with its associated light beacons, cameras, and relays through MongoDB lookups and projecting the combined result into a flattened structure. /// /// A task that resolves to a list of objects enriched with the corresponding beacon, camera, and relay details, or null when no configurations are found. + /// public async Task?> GetAllConfigs() { var pipeline = Collection.Aggregate() @@ -655,6 +681,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// Uses an empty filter to return every record and returns a nullable list that may be null if no results are found. /// /// A task that represents the asynchronous operation, containing a list of objects with the projected fields, or null if no matching records exist. + /// public async Task?> GetAllLocationInfo() { var filter = Builders.Filter.Empty; @@ -675,6 +702,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The pagination and filtering criteria. If FilteredRequest is null, no additional filters are applied. /// An representing the resulting MongoDB query with the applied filters and sort. + /// public IFindFluent GetPaginatedPoCs(PaginationFilter filter) { var filterBuilder = Builders.Filter; @@ -742,6 +770,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// Creates MongoDB indexes for the collection on the unitId, room, and bed fields, using background creation and non-unique constraints, to optimize query performance. /// + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; @@ -760,6 +789,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// /// The unique identifier of the point-of-care record to update. /// The new status value to apply to the point-of-care record. + /// public async Task UpdateStatus(ObjectId id, StatusEnum.PointOfCare status) { var filterBuilder = Builders.Filter; @@ -777,6 +807,7 @@ public class PointOfCareRepository : MongoRepository, IPointOfCareR /// The list of filter definitions to be combined; an empty list results in no filtering. /// The sort definition applied to the resulting query. /// An representing the filtered and sorted query. + /// private IFindFluent CreateFindFluent(List> filters, SortDefinition sort) { diff --git a/adas-core.Infrastructure/Repositories/PumpAlarmEventRepository.cs b/adas-core.Infrastructure/Repositories/PumpAlarmEventRepository.cs index 93e273aa..71f46748 100644 --- a/adas-core.Infrastructure/Repositories/PumpAlarmEventRepository.cs +++ b/adas-core.Infrastructure/Repositories/PumpAlarmEventRepository.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Inherits the generic MongoDB persistence capabilities of , specializing them for the entity type. /// +/// public class PumpAlarmEventRepository : MongoRepository, IPumpAlarmEventRepository { private readonly ApiSettings _apiSettings; @@ -88,6 +89,15 @@ public class PumpAlarmEventRepository : MongoRepository, IPumpAl await Collection.InsertOneAsync(alarmEvent); } + /// + /// Asynchronously retrieves records for the specified device, optionally constrained by an inclusive time range and a maximum result count. + /// + /// The identifier of the device whose alarm events are queried. + /// Optional inclusive lower bound on the event time; when , no lower bound is applied. + /// Optional inclusive upper bound on the event time; when , no upper bound is applied. + /// Optional maximum number of events to return; when , all matching events are returned. + /// A task producing the matching records ordered by time in descending order. + /// public async Task> FindByDeviceIdAsync(string deviceId, DateTime? from = null, DateTime? to = null, int? limit = null) { @@ -111,6 +121,8 @@ public class PumpAlarmEventRepository : MongoRepository, IPumpAl /// The identifier of the device whose latest alarm event is being retrieved. /// A that yields the latest associated with , or null if no matching event is found. /// + /// public async Task FindLastByDeviceIdAsync(string deviceId) { return await Collection diff --git a/adas-core.Infrastructure/Repositories/PumpAlarmStateRepository.cs b/adas-core.Infrastructure/Repositories/PumpAlarmStateRepository.cs index 7bfb32f5..dcd414a7 100644 --- a/adas-core.Infrastructure/Repositories/PumpAlarmStateRepository.cs +++ b/adas-core.Infrastructure/Repositories/PumpAlarmStateRepository.cs @@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Represents a MongoDB-based repository for entities, providing concrete data access functionality defined by the contract. /// +/// public class PumpAlarmStateRepository : MongoRepository, IPumpAlarmStateRepository { private readonly ApiSettings _apiSettings; @@ -33,6 +34,7 @@ public class PumpAlarmStateRepository : MongoRepository, IPumpAl /// Gets the collection name for the pump alarm state, returning the value configured in the API settings or the default "pump_alarm_state" when the configuration is not set. /// /// The configured collection name, or the default "pump_alarm_state" if the API setting is null. + /// public override string GetCollectionName() { return _apiSettings.PumpAlarmState ?? "pump_alarm_state"; @@ -77,6 +79,7 @@ public class PumpAlarmStateRepository : MongoRepository, IPumpAl /// The optional alarm type used to further narrow the filter. When null, the alarm type is not applied. /// The optional alarm code (MDC) used to further narrow the filter. Ignored when null, empty, or whitespace. /// A instance if a matching record is found; otherwise, null. + /// public async Task FindActiveAsync(string deviceId, PumpEnum.AlarmType? alarmType, string? alarmCodeMdc = null) { var filter = Builders.Filter.Eq(x => x.DeviceId, deviceId); @@ -128,6 +131,7 @@ public class PumpAlarmStateRepository : MongoRepository, IPumpAl /// The identifier of the device whose alarm state records should be removed. Used as a mandatory filter criterion. /// The optional alarm type to further restrict which records are deleted. When , records of any alarm type for the device are removed. /// The optional alarm code MDC used to further narrow the deletion. Blank or whitespace values are ignored. + /// public async Task RemoveAsync(string? deviceId, PumpEnum.AlarmType? alarmType, string? alarmCodeMdc = null) { var filter = Builders.Filter.Eq(x => x.DeviceId, deviceId); @@ -145,6 +149,7 @@ public class PumpAlarmStateRepository : MongoRepository, IPumpAl /// Asynchronously deletes all records associated with the specified patient identifier by removing every document whose PatientId matches the supplied value. /// /// The unique identifier of the patient whose associated records should be removed. + /// public async Task DeleteByPatientId(ObjectId patientId) { await Collection.DeleteManyAsync(p => p.PatientId == patientId); @@ -155,6 +160,7 @@ public class PumpAlarmStateRepository : MongoRepository, IPumpAl /// /// The unique identifier of the device whose pump alarm states are being queried. /// A task that represents the asynchronous operation. The task result contains an with the pump alarm states matching the provided device identifier. + /// public async Task> FindAllActiveByDeviceAsync(string deviceId) { return await Collection.Find(x => x.DeviceId == deviceId).ToListAsync(); @@ -167,6 +173,7 @@ public class PumpAlarmStateRepository : MongoRepository, IPumpAl /// The new value to assign to the field. /// The existing value used to locate matching documents. /// The number of documents that were modified by the update operation. + /// public async Task UpdateManyObjectIdByFieldNameAsync(string fieldName, ObjectId newId, ObjectId oldId) { var filter = Builders.Filter.Eq(fieldName, oldId); diff --git a/adas-core.Infrastructure/Repositories/PumpArchiveRepository.cs b/adas-core.Infrastructure/Repositories/PumpArchiveRepository.cs index 4be44c12..52b63771 100644 --- a/adas-core.Infrastructure/Repositories/PumpArchiveRepository.cs +++ b/adas-core.Infrastructure/Repositories/PumpArchiveRepository.cs @@ -15,6 +15,7 @@ namespace adas_core.Infrastructure.Repositories /// Repositorio de archivo para observaciones de bombas. /// Colección: archive_pumpobservations (configurable por ApiSettings.ArchivePumpObservations). /// + /// public class PumpArchiveRepository : MongoRepository, IPumpArchiveRepository { private readonly ApiSettings _apiSettings; @@ -76,6 +77,7 @@ namespace adas_core.Infrastructure.Repositories /// Asynchronously inserts a into the underlying MongoDB collection. /// /// The pump observation to persist. + /// public async Task InsertAsync(PumpObservation obs) { await Collection.InsertOneAsync(obs); @@ -85,6 +87,7 @@ namespace adas_core.Infrastructure.Repositories /// Asynchronously inserts a batch of pump observations into the underlying data store. If the collection is empty, the method completes without performing any insertion. /// /// The pump observations to insert into the collection. + /// public async Task InsertManyAsync(IEnumerable observations) { var list = observations as IList ?? observations.ToList(); @@ -101,6 +104,7 @@ namespace adas_core.Infrastructure.Repositories /// Optional inclusive upper bound for the observation time. When provided, only observations on or before this time are returned. /// Optional maximum number of observations to return. When null, all matching observations are returned. /// A task that represents the asynchronous operation. The task result contains an of matching observations ordered from newest to oldest. + /// public async Task> FindByPatientIdAsync( ObjectId patientId, DateTime? from = null, DateTime? to = null, int? limit = null) { @@ -124,6 +128,7 @@ namespace adas_core.Infrastructure.Repositories /// Deletes all pump observations whose recording time is earlier than the specified cutoff date. /// /// The cutoff date; observations with a timestamp before this value are removed. + /// public async Task DeleteBeforeDate(DateTime addDays) { var filter = Builders.Filter.Lt(x => x.Time, addDays); diff --git a/adas-core.Infrastructure/Repositories/PumpObservationRepository.cs b/adas-core.Infrastructure/Repositories/PumpObservationRepository.cs index 94d016ff..21671d02 100644 --- a/adas-core.Infrastructure/Repositories/PumpObservationRepository.cs +++ b/adas-core.Infrastructure/Repositories/PumpObservationRepository.cs @@ -17,6 +17,8 @@ namespace adas_core.Infrastructure.Repositories /// As a specialized repository inheriting from , this class /// reuses the base MongoDB storage capabilities while exposing the pump observation-specific repository contract. /// + /// public class PumpObservationRepository : MongoRepository, IPumpObservationRepository { private readonly ApiSettings _apiSettings; @@ -38,6 +40,7 @@ namespace adas_core.Infrastructure.Repositories /// Retrieves the collection name used for pump observations, returning the configured value from API settings if available, or falling back to the default "pump_observations" name when no custom configuration is provided. /// /// The configured pump observations collection name from API settings, or the default "pump_observations" string if the setting is null. + /// public override string GetCollectionName() { return _apiSettings.PumpObservations ?? "pump_observations"; @@ -77,6 +80,7 @@ namespace adas_core.Infrastructure.Repositories /// Asynchronously inserts a pump observation into the underlying collection. /// /// The pump observation document to be persisted. + /// public async Task InsertAsync(PumpObservation obs) { await Collection.InsertOneAsync(obs); @@ -86,6 +90,7 @@ namespace adas_core.Infrastructure.Repositories /// Inserts a batch of pump observations into the underlying collection in a single operation. Returns immediately when the input is null or contains no elements, performing no insertion in those cases. /// /// The pump observations to insert. A null or empty collection results in a no-op. + /// public async Task InsertManyAsync(IEnumerable? observations) { if (observations == null) return; @@ -104,6 +109,7 @@ namespace adas_core.Infrastructure.Repositories /// Optional end timestamp; when provided, only observations with a time less than or equal to this value are returned. /// Optional maximum number of observations to return; when not provided, all matching observations are returned. /// A task that represents the asynchronous operation, containing the collection of matching records. + /// public async Task> FindByDeviceIdAsync( string deviceId, DateTime? from = null, @@ -136,6 +142,7 @@ namespace adas_core.Infrastructure.Repositories /// Optional inclusive upper bound for the observation time. When null, no upper time bound is applied. /// Optional maximum number of observations to return. When null, all matching observations are returned. /// A task that represents the asynchronous operation. The task result contains the matching pump observations sorted by time in descending order. + /// public async Task> FindByPatientAsync( ObjectId patientId, DateTime? from = null, @@ -205,6 +212,7 @@ namespace adas_core.Infrastructure.Repositories /// /// The unique identifier of the device whose latest pump observation should be retrieved. /// A task that resolves to the most recent for the device, or null if no observation is found. + /// public async Task FindLastByDeviceIdAsync(string deviceId) { return await Collection @@ -218,6 +226,7 @@ namespace adas_core.Infrastructure.Repositories /// /// The optional patient identifier used to filter the pump observations. /// A task that represents the asynchronous operation, containing a collection of pump observations matching the given patient identifier. + /// public async Task> FindByPatientId(ObjectId? patientId) { return await Collection.Find(x => x.PatientId == patientId).ToListAsync(); @@ -230,6 +239,7 @@ namespace adas_core.Infrastructure.Repositories /// The identifier of the patient whose observations are being retrieved. /// The maximum number of observations to consider before deduplication. Defaults to 100. /// A task that represents the asynchronous operation. The task result contains a list of distinct entries for the patient, ordered from most recent to oldest. + /// public async Task> AggregatedPatientLastObservations(ObjectId patientId, int num = 100) { var filterBuilder = Builders.Filter; @@ -252,6 +262,7 @@ namespace adas_core.Infrastructure.Repositories /// Deletes all records whose PatientId matches the specified patient identifier. /// /// The patient identifier whose associated records should be removed; may be null. + /// public async Task DeleteByPatientId(ObjectId? patientId) { await Collection.DeleteManyAsync(x => x.PatientId == patientId); @@ -264,6 +275,7 @@ namespace adas_core.Infrastructure.Repositories /// The age threshold in days. Observations with a Time older than DateTime.UtcNow - days are eligible for deletion. /// Optional name used to further restrict the deletion to observations with a matching Name value. If null or empty, the name filter is not applied. /// The number of documents that were deleted. + /// public async Task DeleteOlderThanDaysAsync(int days, string? name = null) { var limitDate = DateTime.UtcNow.AddDays(-days); @@ -281,6 +293,7 @@ namespace adas_core.Infrastructure.Repositories /// /// The maximum number of most recent records to keep per device. /// The total number of observations deleted across all devices. + /// public async Task DeleteKeepLastNAsync(int maxCount) { // Para cada DeviceId: @@ -320,6 +333,7 @@ namespace adas_core.Infrastructure.Repositories /// The current value used to match documents; if null, the filter matches documents where the field is null. /// The number of documents that were modified by the update operation. /// Thrown when is null, empty, or whitespace. + /// public async Task UpdateManyObjectIdByFieldAsync(string fieldName, ObjectId newId, ObjectId? oldId) { if (string.IsNullOrWhiteSpace(fieldName)) @@ -386,6 +400,7 @@ namespace adas_core.Infrastructure.Repositories /// The unique identifier of the patient whose observations are being queried. /// The name of the pump observation to filter by. If null, empty, or whitespace, an empty list is returned. /// A task representing the asynchronous operation, containing a list of the matching pump observations (at most two) sorted from newest to oldest. + /// public async Task> FindLastObservations(ObjectId patientId, string name) { if (string.IsNullOrWhiteSpace(name)) diff --git a/adas-core.Infrastructure/Repositories/PumpStateRepository.cs b/adas-core.Infrastructure/Repositories/PumpStateRepository.cs index b3967818..747dae8c 100644 --- a/adas-core.Infrastructure/Repositories/PumpStateRepository.cs +++ b/adas-core.Infrastructure/Repositories/PumpStateRepository.cs @@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories /// Provides a repository implementation for entities backed by a MongoDB data store. /// /// Inherits base functionality from and implements the contract. + /// public class PumpStateRepository : MongoRepository, IPumpStateRepository { private readonly ApiSettings _apiSettings; @@ -32,6 +33,7 @@ namespace adas_core.Infrastructure.Repositories /// Retrieves the collection name for pump states, returning the configured value from API settings or the default name "pump_states" when the setting is not provided. /// /// The configured pump states collection name, or the default value "pump_states" if the setting is null. + /// public override string GetCollectionName() { return _apiSettings.PumpStates ?? "pump_states"; @@ -71,6 +73,7 @@ namespace adas_core.Infrastructure.Repositories /// /// The unique identifier of the device whose pump state should be looked up. /// A instance if a matching record is found; otherwise, null. + /// public async Task FindByDeviceIdAsync(string deviceId) { return await Collection.Find(x => x.DeviceId == deviceId).FirstOrDefaultAsync(); @@ -80,6 +83,7 @@ namespace adas_core.Infrastructure.Repositories /// Inserts the specified or updates the existing one identified by its DeviceId. If a matching record is found, its identifier is reused; otherwise a new identifier is generated when the provided one is empty. /// /// The pump state to persist. Its Id is preserved or assigned based on whether a record with the same DeviceId already exists. + /// public async Task UpsertAsync(PumpState state) { var existing = await Collection @@ -102,6 +106,7 @@ namespace adas_core.Infrastructure.Repositories /// Asynchronously retrieves all records from the data store. /// /// A task that represents the asynchronous operation, containing an of all records; an empty collection is returned if no records exist. + /// public async Task> GetAllAsync() { return await Collection.Find(Builders.Filter.Empty).ToListAsync(); diff --git a/adas-core.Infrastructure/Repositories/RecordingAlertArchiveRepository.cs b/adas-core.Infrastructure/Repositories/RecordingAlertArchiveRepository.cs index 8e6cd970..c4c70f02 100644 --- a/adas-core.Infrastructure/Repositories/RecordingAlertArchiveRepository.cs +++ b/adas-core.Infrastructure/Repositories/RecordingAlertArchiveRepository.cs @@ -10,6 +10,8 @@ namespace adas_core.Infrastructure.Repositories; /// Represents a MongoDB repository responsible for managing archived patient recording alerts, exposing archive-specific data access operations through the recording alert archive repository contract. /// /// The type of the patient recording alert entity persisted in the archive. +/// public class RecordingAlertArchiveRepository : MongoRepository, IRecordingAlertArchiveRepository { private readonly ApiSettings _apiSettings; @@ -34,6 +36,7 @@ public class RecordingAlertArchiveRepository : MongoRepository /// The configured collection name from _apiSettings.ArchivePatientsRecordingalerts, or the default "archive_patients_recordingalerts" if the setting is null. + /// public override string GetCollectionName() { return _apiSettings.ArchivePatientsRecordingalerts ?? "archive_patients_recordingalerts"; @@ -43,6 +46,7 @@ public class RecordingAlertArchiveRepository : MongoRepository into the underlying collection. /// /// The patient recording alert document to persist. + /// public override async Task InsertOneAsync(PatientRecordingAlert patientRecordingAlert) { await Collection.InsertOneAsync(patientRecordingAlert); @@ -52,6 +56,7 @@ public class RecordingAlertArchiveRepository : MongoRepository records whose Time is earlier than the specified cutoff date. /// /// The cutoff date; records with a time strictly before this value will be removed. + /// public async Task DeleteBeforeDate(DateTime date) { var filter = Builders.Filter.Lt(po => po.Time, date); @@ -63,6 +68,7 @@ public class RecordingAlertArchiveRepository : MongoRepository /// The patient recording alerts to insert into the collection. /// The number of patient recording alerts that were inserted. + /// public async Task InsertBatch(IEnumerable patientRecordingAlerts) { var writes = new List>(); diff --git a/adas-core.Infrastructure/Repositories/RecordingAlertRepository.cs b/adas-core.Infrastructure/Repositories/RecordingAlertRepository.cs index 047ad6da..3d7ef46f 100644 --- a/adas-core.Infrastructure/Repositories/RecordingAlertRepository.cs +++ b/adas-core.Infrastructure/Repositories/RecordingAlertRepository.cs @@ -14,6 +14,8 @@ namespace adas_core.Infrastructure.Repositories; /// Provides a MongoDB-backed repository implementation for entities, exposing data access operations defined by the contract. /// /// The type of recording alert entity managed by the repository. +/// public class RecordingAlertRepository : MongoRepository, IRecordingAlertRepository { private readonly ApiSettings _apiSettings; @@ -37,6 +39,7 @@ public class RecordingAlertRepository : MongoRepository, /// Retrieves the collection name for patients recording alerts, returning the configured API setting value or a default fallback when the setting is not available. /// /// The collection name from _apiSettings.PatientsRecordingAlerts, or the default value "patients_recordingalerts" if the setting is null. + /// public override string GetCollectionName() { return _apiSettings.PatientsRecordingAlerts ?? "patients_recordingalerts"; @@ -49,6 +52,7 @@ public class RecordingAlertRepository : MongoRepository, /// The unique identifier of the patient whose observations are being retrieved. /// The maximum number of recent observations to return per grouped observation name. /// A task containing a list of objects representing the aggregated last observations for the patient. + /// public async Task> AggregatedPatientLastObservations(ObjectId patientId, int num) { var match = new BsonDocument @@ -132,6 +136,7 @@ public class RecordingAlertRepository : MongoRepository, /// Deletes a patient recording alert identified by the specified identifier from the underlying collection. /// /// The unique identifier of the patient recording alert to delete. + /// public new async Task DeleteAsync(ObjectId id) { var filter = Builders.Filter.Eq(obs => obs.Id, id); @@ -143,6 +148,7 @@ public class RecordingAlertRepository : MongoRepository, /// Inserts a new patient recording alert into the underlying collection asynchronously. /// /// The patient recording alert document to be inserted. + /// public override async Task InsertOneAsync(PatientRecordingAlert patientRecordingAlert) { await Collection.InsertOneAsync(patientRecordingAlert); @@ -153,6 +159,7 @@ public class RecordingAlertRepository : MongoRepository, /// /// The name of the patient recording alert used to match the document for deletion. /// The retention period in days; the cutoff time is calculated as UTC now minus this number of days. + /// public async Task DeleteOlderDaysAsync(string name, int retentionPolicyValue) { var filterBuilder = Builders.Filter; @@ -169,6 +176,7 @@ public class RecordingAlertRepository : MongoRepository, /// Deletes all patient recording alerts associated with the specified patient identifier. /// /// The unique identifier of the patient whose recording alerts will be removed. + /// public async Task DeleteByPatientId(ObjectId patientId) { var filter = Builders.Filter.Eq(po => po.PatientId, patientId); @@ -181,6 +189,7 @@ public class RecordingAlertRepository : MongoRepository, /// /// The name used to filter the alerts subject to the retention policy. /// The number of most recent records to retain; any additional older records will be deleted. + /// public async Task DeleteOlderNumberAsync(string name, int retentionPolicyValue) { var filterBuilder = Builders.Filter; @@ -211,6 +220,7 @@ public class RecordingAlertRepository : MongoRepository, /// /// The unique identifier of the patient whose recording alerts should be retrieved. /// A task representing the asynchronous operation, containing a cursor over the matching patient recording alerts. + /// public async Task> FindByPatientIdAsync(ObjectId patientId) { var filter = Builders.Filter.Eq(ob => ob.PatientId, patientId); @@ -225,6 +235,7 @@ public class RecordingAlertRepository : MongoRepository, /// The name of the observation used to filter the results. /// The maximum number of observations to return. Defaults to 2. /// A list of entries containing the latest matching observations for the patient. + /// public async Task> FindLastObservations(ObjectId patientId, string name, int num = 2) { var filterBuilder = Builders.Filter; @@ -256,6 +267,7 @@ public class RecordingAlertRepository : MongoRepository, /// The identifier of the field or collection used to target the records to update. /// The new value to assign to the matched records. /// The existing value to be replaced. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await UpdateManyObjectIdAsync(nameId, id, oldId); @@ -264,6 +276,7 @@ public class RecordingAlertRepository : MongoRepository, /// /// Creates MongoDB indexes for the PatientRecordingAlert collection, including a non-unique background index on the patientid field to optimize queries by patient. /// + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; diff --git a/adas-core.Infrastructure/Repositories/RelayRepository.cs b/adas-core.Infrastructure/Repositories/RelayRepository.cs index 9d2f65b4..c98ae640 100644 --- a/adas-core.Infrastructure/Repositories/RelayRepository.cs +++ b/adas-core.Infrastructure/Repositories/RelayRepository.cs @@ -17,6 +17,8 @@ namespace adas_core.Infrastructure.Repositories; /// /// The type of the entity managed by the repository. /// This class combines a concrete MongoDB repository implementation with a domain-specific interface, enabling standardized persistence operations for relay entities. +/// public class RelayRepository : MongoRepository, IRelayRepository { private readonly ApiSettings _apiSettings; @@ -38,6 +40,7 @@ public class RelayRepository : MongoRepository, IRelayRepository /// Retrieves the collection name for relays from the API settings configuration. /// /// The configured relays collection name as specified in the API settings. + /// public override string GetCollectionName() { return _apiSettings.Relays; @@ -48,6 +51,7 @@ public class RelayRepository : MongoRepository, IRelayRepository /// /// The unique identifier of the relay to look up. /// The matching , or null if no document matches the identifier or the query fails. + /// public async Task GetById(ObjectId relayId) { try @@ -69,6 +73,7 @@ public class RelayRepository : MongoRepository, IRelayRepository /// The collection of relay identifiers used to filter relays by their Id field. /// The relay type used as an equality filter on the Type field. /// A list of instances matching both the identifier and type filters; an empty list is returned when no relays match. + /// public List GetRelayByTypeInList(List configurationRelayList, RelayEnum.Type type) { var filterBuilder = Builders.Filter; @@ -86,6 +91,7 @@ public class RelayRepository : MongoRepository, IRelayRepository /// /// The collection of values used to match relays by their Id field. /// A containing the relays whose identifiers are found in ; an empty list is returned when no matching relays exist. + /// public List GetRelayInList(List configurationRelayList) { var filterBuilder = Builders.Filter; @@ -102,6 +108,7 @@ public class RelayRepository : MongoRepository, IRelayRepository /// /// The pagination criteria containing the optional text filter applied against the relay name. /// A fluent find query for entities, ordered by relay name in ascending order, ready for further pagination. + /// public IFindFluent GetPaginatedRelays(PaginationFilter filter) { var filterBuilder = Builders.Filter; @@ -132,6 +139,7 @@ public class RelayRepository : MongoRepository, IRelayRepository /// /// The relay entity to insert into the collection. /// The inserted relay retrieved by its identifier, or null if the insertion fails. + /// public async Task InsertOneRelayAsync(Relay request) { try @@ -154,6 +162,7 @@ public class RelayRepository : MongoRepository, IRelayRepository /// The unique identifier of the relay document to update in the collection. /// The relay instance containing the new values to apply to the existing document. /// A task that represents the asynchronous operation, containing the updated after the update, or null if no matching document was found. + /// public async Task UpdateRelayAsync(ObjectId objectId, Relay relay) { var filter = Builders.Filter.Eq("_id", objectId); @@ -176,6 +185,7 @@ public class RelayRepository : MongoRepository, IRelayRepository /// /// The name of the relay to look up. May be null, in which case the query matches relays with a null name. /// A containing the matching , or null if no relay with the specified name is found. + /// public async Task GetByName(string? requestRelayName) { var filterBuilder = Builders.Filter; @@ -191,6 +201,7 @@ public class RelayRepository : MongoRepository, IRelayRepository /// The list of filter definitions to combine; when empty, an empty filter is used to match all documents. /// The sort definition applied to the query results. /// An representing the filtered and sorted Relay query. + /// private IFindFluent CreateFindFluent(List> filters, SortDefinition sort) { var combinedFilter = filters.Any() diff --git a/adas-core.Infrastructure/Repositories/SectionRepository.cs b/adas-core.Infrastructure/Repositories/SectionRepository.cs index 8176a710..c710ffc2 100644 --- a/adas-core.Infrastructure/Repositories/SectionRepository.cs +++ b/adas-core.Infrastructure/Repositories/SectionRepository.cs @@ -14,6 +14,8 @@ namespace adas_core.Infrastructure.Repositories; /// implementing the contract defined by . /// /// The type of the section entity managed by this repository. +/// public class SectionRepository : MongoRepository
, ISectionRepository { private readonly ApiSettings _apiSettings; @@ -38,6 +40,7 @@ public class SectionRepository : MongoRepository
, ISectionRepository /// Gets the configuration sections collection name from the API settings, falling back to a default value when not configured. /// /// The configured collection name, or "config_sections" if _apiSettings.ConfigSections is null. + /// public override string GetCollectionName() { return _apiSettings.ConfigSections ?? "config_sections"; @@ -47,6 +50,7 @@ public class SectionRepository : MongoRepository
, ISectionRepository /// Retrieves all documents from the underlying collection by querying with an empty filter. /// /// A task that represents the asynchronous operation, containing a list of all documents found in the collection. + /// public async Task> GetAll() { var result = await Collection.FindAsync(Builders
.Filter.Empty); @@ -59,6 +63,7 @@ public class SectionRepository : MongoRepository
, ISectionRepository /// /// The section title used to look up the matching . /// The first matching , or null if no section with the given title is found. + /// public async Task FindBySection(string section) { var result = await Collection.FindAsync(Builders
.Filter.Eq(x => x.SectionTitle, section)); @@ -71,6 +76,7 @@ public class SectionRepository : MongoRepository
, ISectionRepository /// /// The point of care identifier used to filter the sections. /// The first matching , or null if no section is found. + /// public async Task FindByPointOfCare(string pointOfCare) { var result = await Collection.FindAsync(Builders
.Filter.Eq(x => x.PointOfCare, pointOfCare)); @@ -84,6 +90,7 @@ public class SectionRepository : MongoRepository
, ISectionRepository /// /// The unique identifier of the section to retrieve. /// A task containing the matching if found; otherwise, null. + /// public async Task FindById(string id) { var result = await Collection.FindAsync(Builders
.Filter.Eq(x => x.Id, id)); @@ -96,6 +103,7 @@ public class SectionRepository : MongoRepository
, ISectionRepository /// /// The identifier of the section to locate. /// A instance if a document with the given identifier exists; otherwise, null. + /// public async Task FindById(object id) { var result = await Collection.FindAsync(Builders
.Filter.Eq(x => x._id, id)); @@ -109,6 +117,8 @@ public class SectionRepository : MongoRepository
, ISectionRepository /// /// The patient location containing the unit name and bed used to locate the corresponding sections. /// A task that represents the asynchronous operation. The task result contains a list of sections matching the provided patient location; an empty list is returned when no matching sections are found. + /// public async Task> FindByLocation(PatientLocation location) { //can not filter to Collection the where condition, it throws System.InvalidOperationException: '{}.pointOfCare is not supported.' @@ -128,6 +138,7 @@ public class SectionRepository : MongoRepository
, ISectionRepository /// /// The section to insert into the collection. /// The inserted on success, or null if the operation fails. + /// public async Task InsertOneSection(Section section) { try @@ -151,6 +162,7 @@ public class SectionRepository : MongoRepository
, ISectionRepository /// /// The section containing the identifier of the record to update and the new field values to persist. /// The updated as it appears after the update, or if no matching record was found. + /// public async Task UpdateSection(Section section) { var filter = Builders
.Filter.Eq("Id", section.Id); diff --git a/adas-core.Infrastructure/Repositories/ServiceConfigRepository.cs b/adas-core.Infrastructure/Repositories/ServiceConfigRepository.cs index fc99a4a1..e71b415a 100644 --- a/adas-core.Infrastructure/Repositories/ServiceConfigRepository.cs +++ b/adas-core.Infrastructure/Repositories/ServiceConfigRepository.cs @@ -10,6 +10,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Represents a MongoDB repository for entities, implementing the contract to provide data access operations. /// +/// public class ServiceConfigRepository : MongoRepository, IServiceConfigRepository { private readonly ApiSettings _apiSettings; @@ -33,6 +34,7 @@ public class ServiceConfigRepository : MongoRepository, IServiceC /// Retrieves the service configuration collection name from API settings, falling back to the default "service_config" when no value is configured. /// /// The configured service collection name, or the default "service_config" when the API setting is null. + /// public override string GetCollectionName() { return _apiSettings.ServiceConfig ?? "service_config"; @@ -44,6 +46,7 @@ public class ServiceConfigRepository : MongoRepository, IServiceC /// /// The string identifier used to look up the service configuration. /// A task that represents the asynchronous operation, containing the matching or null if not found. + /// public async Task FindById(string id) { var result = await Collection.FindAsync(Builders.Filter.Eq(x => x.StrId, id)); @@ -56,6 +59,7 @@ public class ServiceConfigRepository : MongoRepository, IServiceC /// /// The of the to locate. /// A instance if a document with the given identifier is found; otherwise, . + /// public async Task FindById(ObjectId oid) { var result = await Collection.FindAsync(Builders.Filter.Eq(x => x.Id, oid)); diff --git a/adas-core.Infrastructure/Repositories/TreatmentArchiveRepository.cs b/adas-core.Infrastructure/Repositories/TreatmentArchiveRepository.cs index 65b93a3b..9bd33039 100644 --- a/adas-core.Infrastructure/Repositories/TreatmentArchiveRepository.cs +++ b/adas-core.Infrastructure/Repositories/TreatmentArchiveRepository.cs @@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories; /// Provides a MongoDB-backed repository for persisting and retrieving archived patient treatment records. /// Inherits from and implements the contract. /// +/// public class TreatmentArchiveRepository : MongoRepository, ITreatmentArchiveRepository { private readonly ApiSettings _apiSettings; @@ -34,6 +35,7 @@ public class TreatmentArchiveRepository : MongoRepository, ITr /// Asynchronously inserts a single document into the collection. /// /// The patient treatment entity to persist. + /// public override async Task InsertOneAsync(PatientTreatment patientTreatment) { await Collection.InsertOneAsync(patientTreatment); @@ -43,6 +45,7 @@ public class TreatmentArchiveRepository : MongoRepository, ITr /// Deletes all patient treatments whose order time is before the specified date. /// /// The cutoff date; treatments with an order time earlier than this are removed. + /// public async Task DeleteBeforeDate(DateTime date) { var filter = Builders.Filter.Lt(po => po.OrderTime, date); @@ -54,6 +57,7 @@ public class TreatmentArchiveRepository : MongoRepository, ITr /// /// The collection of patient treatment records to insert into the database. /// The total count of patient treatment records inserted by the bulk write operation. + /// public async Task InsertBatch(IEnumerable treatments) { var writes = new List>(); @@ -69,6 +73,7 @@ public class TreatmentArchiveRepository : MongoRepository, ITr /// /// The unique identifier of the patient whose treatment records are to be retrieved. /// A task that represents the asynchronous operation, containing a list of records matching the specified patient. + /// public async Task> FindAllFromPatient(ObjectId patientId) { var filter = Builders.Filter.Eq(t => t.PatientId, patientId); @@ -81,6 +86,7 @@ public class TreatmentArchiveRepository : MongoRepository, ITr /// Retrieves the collection name for archive patients treatments, falling back to the default "archive_patients_treatments" value when the API settings do not specify one. /// /// The configured collection name from the API settings, or the default "archive_patients_treatments" if the setting is null. + /// public override string GetCollectionName() { return _apiSettings.ArchivePatientsTreatments ?? "archive_patients_treatments"; diff --git a/adas-core.Infrastructure/Repositories/TreatmentRepository.cs b/adas-core.Infrastructure/Repositories/TreatmentRepository.cs index 3ff1e7f6..fbd80559 100644 --- a/adas-core.Infrastructure/Repositories/TreatmentRepository.cs +++ b/adas-core.Infrastructure/Repositories/TreatmentRepository.cs @@ -14,6 +14,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Represents a MongoDB-backed repository for entities, inheriting common data access functionality from and implementing the contract. /// +/// public class TreatmentRepository : MongoRepository, ITreatmentRepository { private readonly ApiSettings _apiSettings; @@ -37,6 +38,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// Retrieves the collection name for patients treatments, using the value configured in API settings or falling back to the default "patients_treatments" when the setting is not specified. /// /// The configured patients treatments collection name, or "patients_treatments" if no setting is defined. + /// public override string GetCollectionName() { return _apiSettings.PatientsTreatments ?? "patients_treatments"; @@ -47,6 +49,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// /// The unique identifier of the patient whose treatments are being queried. /// A collection of records matching the specified patient identifier. + /// public async Task> GetByPatientId(ObjectId patientId) { var filter = Builders.Filter.Eq(ob => ob.PatientId, patientId); @@ -59,6 +62,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// /// The unique identifier of the patient treatment to locate. /// An asynchronous cursor containing the patient treatment matching the provided identifier. + /// public async Task> GetById(ObjectId id) { var filter = Builders.Filter.Eq(ob => ob.Id, id); @@ -70,6 +74,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// Inserts a patient treatment record, defaulting the order time to the current UTC time when it is not already set. /// /// The patient treatment to insert. + /// public override async Task InsertOneAsync(PatientTreatment treatment) { treatment.OrderTime ??= DateTime.UtcNow; @@ -80,6 +85,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// Deletes a patient treatment record from the database by its unique identifier. /// /// The unique identifier of the patient treatment to remove. + /// public new async Task DeleteAsync(ObjectId id) { var filter = Builders.Filter.Eq(ob => ob.Id, id); @@ -92,6 +98,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// /// The unique ObjectId of the patient whose treatment records should be returned. /// An of containing the matching treatment records. + /// public async Task> FindByPatientIdAsync(ObjectId patientId) { var filter = Builders.Filter.Eq(ob => ob.PatientId, patientId); @@ -105,6 +112,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// /// The identifier of the patient whose treatment records should be removed. /// A task that resolves to true on successful deletion, or false if the operation failed due to an exception. + /// public async Task DeleteByPatientId(ObjectId patientId) { try @@ -126,6 +134,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// /// The patient treatment entity containing the updated information, identified by its Id. /// true if the update succeeds; otherwise, false if an exception occurs during the operation. + /// public async Task Update(PatientTreatment treatment) { try @@ -145,6 +154,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// /// The unique identifier of the patient whose bolus treatments are being queried. /// A task that represents the asynchronous operation, containing a list of documents matching the patient and having a non-empty RequestedGiveCodesStatus. + /// public async Task> FindBolusTreatments(ObjectId patientId) { var builder = Builders.Filter; @@ -166,6 +176,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// The identifier of the patient whose treatments will be searched. /// The entity identifier of the placer order used to match treatments. /// A task that represents the asynchronous operation. The task result contains the list of matching entries. + /// public async Task> GetActiveTreatmentsByPatientIdAndOrder(ObjectId patientId, string order) { var builder = Builders.Filter; @@ -193,6 +204,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// The name of the field or relationship whose object identifier should be updated. /// The new object identifier to replace the old one with. /// The existing object identifier that should be replaced. + /// public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId) { await UpdateManyObjectIdAsync(nameId, id, oldId); @@ -203,6 +215,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// /// The unique of the patient whose treatments are being queried. /// A task that represents the asynchronous operation, containing an with the matching treatment records. Returns an empty sequence if no treatments are found. + /// public async Task> FindByPatientId(ObjectId patientId) { var filter = Builders.Filter.Eq(ob => ob.PatientId, patientId); @@ -252,6 +265,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// /// Ensures the required MongoDB indexes exist for the collection, creating a non-unique background index on the patientid field to optimize query performance without blocking other database operations. /// + /// public override async Task CreateIndexes() { var options = new CreateIndexOptions { Background = true, Unique = false }; @@ -268,6 +282,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// /// The collection of filter definitions to which the active treatment criteria will be appended. /// The builder used to construct the individual filter conditions combined for the active treatment logic. + /// private static void AddActiveTreatmentFilters(List> filters, FilterDefinitionBuilder filterBuilder) { @@ -311,6 +326,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// The list of filter definitions to which the start and end time filters will be added. /// The pagination filter containing the optional start and end date values from the request. /// The filter definition builder used to construct the MongoDB filter expressions. + /// private void AddDefaultTimeFilters(List> filters, PaginationFilter filter, FilterDefinitionBuilder filterBuilder) { @@ -336,6 +352,7 @@ public class TreatmentRepository : MongoRepository, ITreatment /// The list of filter definitions to combine; if empty, an empty filter is used instead. /// The sort definition to apply to the query results. /// An representing the configured find query with the combined filter and sort applied. + /// private IFindFluent CreateFindFluent( List> filters, SortDefinition sort) { diff --git a/adas-core.Infrastructure/Repositories/UnitRepository.cs b/adas-core.Infrastructure/Repositories/UnitRepository.cs index d947351d..927c0f91 100644 --- a/adas-core.Infrastructure/Repositories/UnitRepository.cs +++ b/adas-core.Infrastructure/Repositories/UnitRepository.cs @@ -16,6 +16,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Represents a MongoDB-backed repository for entities, inheriting persistence functionality from and implementing the contract. /// +/// public class UnitRepository : MongoRepository, IUnitRepository { #region Properties @@ -51,6 +52,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// /// The to be inserted into the collection. /// The inserted as returned by the lookup by identifier, or null if an exception occurred during insertion. + /// public async Task InsertOneUnit(Unit unit) { try @@ -75,6 +77,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// Gets the collection name for units, returning the configured value from API settings or falling back to the default "units" when not specified. /// /// The collection name for units, or "units" if no custom value is configured in the API settings. + /// public override string GetCollectionName() { return _apiSettings.Units ?? "units"; @@ -94,6 +97,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// /// The identifier of the to locate. /// A instance if a match is found; otherwise, . + /// public async Task FindById(object id) { var result = await Collection.FindAsync(Builders.Filter.Eq(x => x.Id, id)); @@ -106,6 +110,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// The unique identifier of the unit to look up. /// A task that represents the asynchronous operation. The task result contains the matching , or null if no unit is found with the specified identifier. /// The method is not yet implemented. + /// public Task FindById(string id) { throw new NotImplementedException(); @@ -144,6 +149,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// /// The of the master list to search for across the unit's list reference fields. /// A task that yields an containing the matching units, or an empty list if no matches are found or an error occurs. + /// public async Task> FindByMasterListId(ObjectId id) { try @@ -196,6 +202,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// The of the master list used to match units. /// The type of master list, which determines the property name used in the filter. /// The total number of documents that match the filter. + /// public async Task CountUnitsByMasterListId(ObjectId id, MasterListType masterListType) { var propertyName = $"{masterListType}Id"; @@ -209,6 +216,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// /// The name of the unit to look up using an exact equality match. /// A containing the matching if found; otherwise, null. + /// public async Task FindByName(string unitName) { var result = await Collection.FindAsync(Builders.Filter.Eq(x => x.Name, unitName)); @@ -241,6 +249,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// Asynchronously retrieves all records from the underlying collection. /// /// A task that represents the asynchronous operation, containing a list of all documents found in the collection. + /// public async Task> GetAll() { var result = await Collection.FindAsync(Builders.Filter.Empty); @@ -254,6 +263,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// /// The pagination filter containing the optional text search criteria used to narrow the result set. /// An representing the sorted and filtered query of units; if no filter request is supplied, an unfiltered query sorted by title is returned. + /// public IFindFluent GetPaginatedUnits(PaginationFilter filter) { var filterBuilder = Builders.Filter; @@ -286,6 +296,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// The list of filter definitions to combine with a logical AND; if empty, no filtering is applied. /// The sort definition to apply to the query results. /// A fluent find interface for that can be further chained to project, limit, or execute the query. + /// private IFindFluent CreateFindFluent(List> filters, SortDefinition sort) { var combinedFilter = filters.Any() @@ -304,6 +315,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// /// The unit containing the identifier and the new field values to be persisted. /// The updated unit after the operation, or null if no document matched the filter. + /// public async Task UpdateUnit(Unit unit) { var filter = Builders.Filter.Eq("_id", unit.Id); @@ -343,6 +355,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// The new name to assign to the unit. /// The new title to assign to the unit. /// The updated after the modification, or null if no matching unit was found. + /// public async Task UpdateUnitInfo(ObjectId unitId, string name, string title) { var filter = Builders.Filter.Eq("_id", unitId); @@ -364,6 +377,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// /// The DTO containing the target UnitId and the collection of master list entries to update. /// The updated after the modifications, or null if no updates were performed. + /// public async Task UpdateUnitMasterList(UpdateUnitIdListDto updateUnitListDto) { var filter = Builders.Filter.Eq("_id", updateUnitListDto.UnitId); @@ -459,6 +473,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// The of the unit whose configuration will be updated. /// The new to apply to the unit. /// A task that resolves to true when the update modified a document; otherwise false (including when the operation throws and the error is logged). + /// public async Task UpdateConfiguration(ObjectId unitIdParsed, UnitConfiguration unitConfiguration) { var filter = Builders.Filter.Eq("_id", unitIdParsed); @@ -485,6 +500,7 @@ public class UnitRepository : MongoRepository, IUnitRepository /// /// The identifier of the unit to delete. /// The deleted if found and removed; otherwise, null when an error occurs. + /// public new async Task DeleteAsync(ObjectId id) { var filter = Builders.Filter.Eq(unit => unit.Id, id); diff --git a/adas-core.Infrastructure/Repositories/UserRepository.cs b/adas-core.Infrastructure/Repositories/UserRepository.cs index f69f21fe..87bd3fa1 100644 --- a/adas-core.Infrastructure/Repositories/UserRepository.cs +++ b/adas-core.Infrastructure/Repositories/UserRepository.cs @@ -16,6 +16,7 @@ namespace adas_core.Infrastructure.Repositories; /// /// Inherits core data access functionality from and implements the contract. /// +/// public class UserRepository : MongoRepository, IUserRepository { private readonly ApiSettings _apiSettings; @@ -37,6 +38,7 @@ public class UserRepository : MongoRepository, IUserRepository /// Retrieves the API collection name for users from the configured API settings. /// /// The configured name of the users collection. + /// public override string GetCollectionName() { return _apiSettings.Users; @@ -49,6 +51,7 @@ public class UserRepository : MongoRepository, IUserRepository /// The username to look up in the collection. /// The password that must match the stored value for the user to be returned. /// A instance when a matching record is found; otherwise, null. + /// public async Task GetUser(string username, string password) { var filter = Builders @@ -63,6 +66,7 @@ public class UserRepository : MongoRepository, IUserRepository /// /// The of the user to look up. /// A instance if a matching document exists; otherwise, null. + /// public async Task GetById(ObjectId id) { var filter = Builders @@ -77,6 +81,7 @@ public class UserRepository : MongoRepository, IUserRepository /// /// The username used to look up the user. /// A instance if a match is found; otherwise, null. + /// public async Task GetByUserName(string name) { var filter = Builders @@ -90,6 +95,7 @@ public class UserRepository : MongoRepository, IUserRepository /// /// The username used to match the user document in the collection. /// A that yields the matching with its authorizations and resolved role, or null if no user is found. + /// public async Task GetByUserAndAuthoritesName(string name) { var matchStage = new BsonDocument("$match", new BsonDocument("userName", name)); @@ -137,6 +143,7 @@ public class UserRepository : MongoRepository, IUserRepository /// /// The name of the user to look up. /// A instance if a match is found; otherwise, null. + /// public async Task GetByName(string name) { var filter = Builders @@ -152,6 +159,7 @@ public class UserRepository : MongoRepository, IUserRepository /// The user entity whose fields will be applied to the existing record, identified by . /// If true, the password field is included in the update; if false, the password is not modified. /// The updated retrieved after the update, or null if no matching user was found. + /// public async Task UpdateUser(User user, bool updatePass) { var filter = Builders @@ -176,6 +184,7 @@ public class UserRepository : MongoRepository, IUserRepository /// /// The pagination filter containing paging details and the optional filter payload (text, user status, and user type) used to build the MongoDB query. /// An of sorted ascending by user name and shaped by the assembled filter definitions. + /// public IFindFluent GetPaginatedUsers(PaginationFilter filteredRequest) { // Crear variable con la clase que construye los filtros que necesitamos @@ -215,6 +224,7 @@ public class UserRepository : MongoRepository, IUserRepository /// Retrieves the system user identified by the username "System", creating and inserting a new one with default credentials if no existing user is found. /// /// The existing system user if found; otherwise, the newly created and inserted system user. + /// public async Task GetOrCreateSystemUser() { var user = await GetByUserName("System"); @@ -236,6 +246,7 @@ public class UserRepository : MongoRepository, IUserRepository /// /// Inserts the initial load of data by ensuring that the system user exists, creating one if necessary. /// + /// public sealed override async Task InsertInitialLoad() { await GetOrCreateSystemUser(); @@ -249,6 +260,7 @@ public class UserRepository : MongoRepository, IUserRepository /// The list of filter definitions to be combined with logical AND. /// The sort definition to apply to the query results. /// A fluent find query for the collection with the combined filter and sort applied. + /// private IFindFluent CreateFindFluent(List> filters, SortDefinition sort) { var combinedFilter = filters.Any() @@ -264,6 +276,7 @@ public class UserRepository : MongoRepository, IUserRepository /// /// The user type to filter by. If null or not one of the handled values, no filter is added. /// A list of FilterDefinition objects matching the specified user type, or an empty list if no specific type was matched. + /// private List> GetUserTypeFilter(UserEnum.Type? type) { var filters = new List>(); @@ -287,6 +300,7 @@ public class UserRepository : MongoRepository, IUserRepository /// /// The user status used to select which filter combination is applied; a null or unhandled value yields an empty filter list. /// A list of filters that should be combined to query documents for the specified status. + /// private List> GetUserStatusFilter(StatusEnum.User? status) { var filters = new List>(); diff --git a/adas-core.Infrastructure/Services/PublisherService.cs b/adas-core.Infrastructure/Services/PublisherService.cs index 197aa765..61c542ea 100644 --- a/adas-core.Infrastructure/Services/PublisherService.cs +++ b/adas-core.Infrastructure/Services/PublisherService.cs @@ -12,6 +12,7 @@ namespace adas_core.Infrastructure.Services; /// /// Represents a service that implements the contract, providing the concrete implementation of the publishing operations defined by the interface. /// +/// public class PublisherService : IPublisherService { private readonly ILogger _logger; @@ -90,6 +91,7 @@ public class PublisherService : IPublisherService /// The message payload to send to the queue. /// The name of the target queue to which the message will be sent. /// true if the message was sent successfully; otherwise, false. + /// public async Task SendMessage(string msg, string queueName) { try @@ -121,6 +123,7 @@ public class PublisherService : IPublisherService /// The object to serialize and send to the queue. /// The name of the destination queue. /// A task that resolves to true if the message was sent successfully; otherwise, false. + /// public async Task SendMessage(object obj, string queueName) { var json = JsonConvert.SerializeObject(obj); @@ -133,6 +136,7 @@ public class PublisherService : IPublisherService /// The message object expected to be a Message<Error>. If it is not, the method returns false without sending anything. /// The name of the queue to which the error message body will be sent. The queue is created if it does not already exist. /// A that resolves to true when the error message is successfully sent, and false when the bus is null, the object is not a Message<Error>, or an exception is raised while sending. + /// public async Task SendMessageError(object obj, string queueName) { try diff --git a/adas-core.Infrastructure/Services/ReceiverService.cs b/adas-core.Infrastructure/Services/ReceiverService.cs index b6ee7d72..eeb24bd2 100644 --- a/adas-core.Infrastructure/Services/ReceiverService.cs +++ b/adas-core.Infrastructure/Services/ReceiverService.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Services; /// /// Provides functionality for receiving and processing incoming data, messages, or requests. /// +/// public class ReceiverService { private readonly ILogger _logger; @@ -83,6 +84,7 @@ public class ReceiverService /// /// Registers all application queues defined in settings, including queues for observations, treatments, patients, pumps, appointments, recordings, recording alerts, and alarm observations, by adding each one through the AddQueue call. /// + /// private void SetQueues() { AddQueue(_settings.ObservationsQueue); @@ -99,6 +101,7 @@ public class ReceiverService /// Adds a queue to the internal collection only when the supplied value is not null, empty, or whitespace; otherwise the call is ignored. /// /// The queue identifier to add to the collection. Null, empty, or whitespace values are silently skipped. + /// private void AddQueue(string? queue) { if (!string.IsNullOrWhiteSpace(queue)) @@ -108,6 +111,7 @@ public class ReceiverService /// /// Attempts to establish a connection to RabbitMQ by disposing any existing bus, configuring EasyNetQ with the configured connection string, and registering consumers for all configured queues. If the connection fails, the failure is logged and a timer is scheduled to retry the connection after a five-second delay, recursively invoking the method when the timer elapses. /// + /// private void TryToConnect() { try @@ -145,6 +149,7 @@ public class ReceiverService /// /// Disposes the underlying bus instance if it implements . /// + /// private void DisposeBus() { if (_bus is IDisposable disposable) @@ -194,6 +199,7 @@ public class ReceiverService /// /// The queue name to resolve to its corresponding API request service. /// The matching instance if the queue is recognized; otherwise, null. + /// private IApiRequestService? ResolveService(string queue) { return queue switch @@ -214,6 +220,7 @@ public class ReceiverService /// Asynchronously reprocesses messages from the specified error queue by deriving the target queue name from the routing key (with "Key" removed), resolving the associated service, and resubmitting the message. Operations are skipped when the bus is uninitialized, the derived queue name is empty, or no service is resolved. /// /// The name of the error queue from which to reprocess messages. + /// public async Task ProcessErrorQueue(string errorQueueName) { if (_bus == null) @@ -255,6 +262,7 @@ public class ReceiverService /// Sends EasyNetQ messages to a service implementing IApiRequestService /// Throws exception to trigger retry on failure /// + /// private void TryToParseAndSend(IMessage msg, IApiRequestService service) { try diff --git a/adas-core.Infrastructure/Services/RelayService.cs b/adas-core.Infrastructure/Services/RelayService.cs index 8ed59b23..aff29e8c 100644 --- a/adas-core.Infrastructure/Services/RelayService.cs +++ b/adas-core.Infrastructure/Services/RelayService.cs @@ -28,6 +28,7 @@ namespace adas_core.Infrastructure.Services; /// This class is the default implementation of , /// and can be substituted via dependency injection where the interface is required. /// +/// public class RelayService : IRelayService { private readonly List _devices = []; @@ -74,6 +75,7 @@ public class RelayService : IRelayService /// /// The relay to check, identified by its IP, port, and relay number used both as the cache key and as the target of the status request. /// A task that yields the resolved of the relay, or when the status cannot be determined. + /// public async Task CheckRelayStatus(Relay relay) { var cacheKey = Tuple.Create(relay.Ip, relay.Port, relay.RelayNumber); @@ -123,6 +125,7 @@ public class RelayService : IRelayService /// /// The unique identifier of the relay whose status should be checked. /// The current of the relay, or if no relay with the given ID exists. + /// public async Task CheckRelayStatus(ObjectId relayId) { var relay = await _relayRepository.GetById(relayId); @@ -134,6 +137,8 @@ public class RelayService : IRelayService /// Asynchronously powers off the specified relay. Uses a cache to avoid redundant operations when the relay is already off, falls back to an HTTP request when no local relay device is available, and updates the cache after a successful power off. /// /// The relay to power off, including its network address and relay number. + /// public async Task PowerOff(Relay relay) { var cacheKey = Tuple.Create(relay.Ip, relay.Port, relay.RelayNumber); @@ -179,6 +184,7 @@ public class RelayService : IRelayService /// Powers on the specified relay. If the relay is configured with a URL, sends a remote power-on request; otherwise, drives the relay device directly. Honors a caching layer to avoid redundant power-on commands when the relay is already reported as on. /// /// The relay to power on, including driver, IP, port, relay number, and cache settings. + /// public async Task PowerOn(Relay relay) { if (string.IsNullOrEmpty(relay.Driver) || string.IsNullOrEmpty(relay.Ip)) return; @@ -232,6 +238,7 @@ public class RelayService : IRelayService /// The manual relay status to apply. /// The identifier of the point of care device whose relay configuration should be updated. /// The relay type used to look up the target relay within the point of care's relay configuration. + /// public async Task SetManualRelay(RelayEnum.Status status, ObjectId pocId, RelayEnum.Type type) { try @@ -259,6 +266,7 @@ public class RelayService : IRelayService /// /// The unique identifier of the relay to look up. /// A task that resolves to the if found, or null if no relay matches the supplied identifier. + /// public Task GetById(ObjectId relay) { return _relayRepository.GetById(relay); @@ -268,6 +276,7 @@ public class RelayService : IRelayService /// /// The list of relay identifiers to look up. Can be null. /// A list of objects corresponding to the provided identifiers, or an empty list if the input is null. + /// public List GetRelayInList(List? relayList) { if(relayList == null) return new List(); @@ -280,6 +289,7 @@ public class RelayService : IRelayService /// The optional list of values identifying the configuration relays to filter; when null, the method short-circuits and returns an empty list. /// The relay type used to filter the matching relays within the supplied list. /// A containing the relays matching the specified , or an empty list if is null. + /// public List GetRelayByTypeInList(List? configurationRelayList, RelayEnum.Type type) { if(configurationRelayList == null) return new List(); @@ -338,6 +348,7 @@ public class RelayService : IRelayService /// The relay entity to insert, whose name is checked for duplicates prior to persistence. /// The inserted entity returned by the repository, or null if the repository yields no result. /// Thrown when a relay with the same name as already exists in the repository. + /// public async Task InsertRelay(Relay request) { var relayExist = await _relayRepository.GetByName(request.RelayName); @@ -351,6 +362,7 @@ public class RelayService : IRelayService /// The unique identifier of the relay to update. /// The relay object containing the updated information. /// A task representing the asynchronous operation, containing the updated , or null if no relay with the specified identifier was found. + /// public Task UpdateRelayById(ObjectId objectId, Relay relay) { return _relayRepository.UpdateRelayAsync(objectId, relay); @@ -417,6 +429,7 @@ public class RelayService : IRelayService /// The existing or newly created , or null if the relay is missing a valid IP or port. /// Thrown when no constructor matching and is found on the resolved driver type. /// Thrown when the resolved driver type cannot be instantiated into a . + /// private RelayDevice? GetRelayDevice(Relay relay) { if(relay.Ip.IsNullOrWhiteSpace() || relay.Port == 0) return null; @@ -449,6 +462,7 @@ public class RelayService : IRelayService /// /// The relay whose driver, IP, port, name, total count, username, and password are included in the request query string. /// The URI builder whose query is updated with the relay parameters and whose resulting URI is used as the request target. + /// private async Task PowerRelay(Relay relay, UriBuilder builder) { var query = HttpUtility.ParseQueryString(builder.Query); @@ -487,6 +501,7 @@ public class RelayService : IRelayService /// /// The concurrent dictionary containing relay status entries keyed by a tuple of device ID, port, and an additional integer value. /// A string containing one formatted line per dictionary entry describing the device ID, port, and status. + /// private static string DictionaryToString(ConcurrentDictionary, RelayEnum.Status> dictionary) { var builder = new StringBuilder(); @@ -504,6 +519,7 @@ public class RelayService : IRelayService /// /// The relay instance whose status should be queried; its IP, port, relay number, driver, credentials, and mode are used to build the request. /// The parsed returned by the remote relay service, or if the request fails. + /// private async Task GetRelayStatusByOr(Relay relay) { var cacheKey = Tuple.Create(relay.Ip, relay.Port, relay.RelayNumber); diff --git a/adas-core.Infrastructure/Services/SendAlertService.cs b/adas-core.Infrastructure/Services/SendAlertService.cs index 4ea5878c..39622351 100644 --- a/adas-core.Infrastructure/Services/SendAlertService.cs +++ b/adas-core.Infrastructure/Services/SendAlertService.cs @@ -45,6 +45,7 @@ public class SendAlertService( /// If the Rabbit connection string is not defined in the web config, an error is logged and an empty list is returned. /// /// A task that represents the asynchronous operation. The task result contains a list of objects, or an empty list if the Rabbit connection string is not configured. + /// public async Task> GetQueues() { if (_rabbitConnectionString != null) return await GetQueuesAsync(); @@ -59,6 +60,7 @@ public class SendAlertService( /// Logs and suppresses any errors encountered while collecting the data, returning the successfully gathered metrics. /// /// A list of entries containing the collected performance metrics; returns an empty list if all collection attempts fail. + /// public List GetPerformance() { logger.LogDebug("Starting check performance data from hospitals"); @@ -84,6 +86,7 @@ public class SendAlertService( /// Asynchronously retrieves a list of API clients by delegating to the underlying data retrieval method. /// /// A task representing the asynchronous operation, containing the list of instances retrieved. + /// public async Task> GetApiClients() { return await GetApiClientsAsync(); @@ -93,6 +96,7 @@ public class SendAlertService( /// Asynchronously retrieves statistics for the configured RabbitMQ error queues (recording, patients, treatments, observations, and pumps). Only queues with non-empty names are queried, duplicates are ignored, and any exception raised while connecting or fetching stats is logged and results in an empty list being returned. /// /// A task that represents the asynchronous operation. The task result contains a list of objects with the name, message count, and consumer count of each queried queue, or an empty list if an error occurs. + /// private async Task> GetQueuesAsync() { logger.LogDebug("Starting check rabbitMQ data from hospitals"); @@ -151,6 +155,7 @@ public class SendAlertService( /// Calculates usage from total processor time divided by processor count, and returns a default Performance instance if the underlying process query fails. /// /// A Performance object describing the CPU usage percentage, total capacity, and unit. If an error occurs, a default Performance instance is returned and the exception is logged. + /// public Performance GetConsumedCpu() { Performance performance = new(); @@ -180,6 +185,7 @@ public class SendAlertService( /// Retrieves the current RAM consumption in gigabytes, returning it as a Performance metric where the total and consumed values are reported as equal with a consumption percentage of 100. If an error occurs while retrieving the memory information, the exception is logged and an empty Performance object is returned. /// /// A Performance object representing the RAM usage in GB; returns an empty Performance object if the memory retrieval fails. + /// public Performance GetConsumedRam() { Performance performance = new(); @@ -211,6 +217,7 @@ public class SendAlertService( /// /// The drive whose storage consumption is to be measured. /// A instance containing the consumed storage, total storage, percentage consumed, and the unit (GB) for the drive. + /// public Performance GetConsumedStorage(DriveInfo drive) { Performance performance = new(); @@ -258,6 +265,7 @@ public class SendAlertService( /// A list of entries describing the consumed storage for each /// successfully processed drive; returns an empty list if no drives yield results or if an /// error occurs during enumeration. + /// private List GetConsumedStorages() { var list = new List(); @@ -292,6 +300,7 @@ public class SendAlertService( /// Returns an empty list if the underlying call returns null or fails; any exception is caught and logged without being rethrown. /// /// A task that resolves to the list of connected API clients, which may be empty if no clients were retrieved. + /// private async Task> GetApiClientsAsync() { logger.LogDebug("Starting check conected clients from hospitals"); @@ -317,6 +326,10 @@ public class SendAlertService( /// Asynchronously retrieves the list of connected WebSocket API clients, handling any errors by logging them and returning an empty instance as a fallback. /// /// A that resolves to an instance representing the connected WebSocket subscribers. + /// + /// private Task GetWebSocketClients() { ApiClients apiClients = new(); diff --git a/adas-core.Infrastructure/Utils/CacheHostBuilderExtension.cs b/adas-core.Infrastructure/Utils/CacheHostBuilderExtension.cs index 214b662f..b09c9b69 100644 --- a/adas-core.Infrastructure/Utils/CacheHostBuilderExtension.cs +++ b/adas-core.Infrastructure/Utils/CacheHostBuilderExtension.cs @@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Utils /// /// Provides extension methods for configuring or building cache host instances. /// + /// public static class CacheHostBuilderExtension { /// diff --git a/adas-core.Infrastructure/Utils/CustomPointOfCareConverter.cs b/adas-core.Infrastructure/Utils/CustomPointOfCareConverter.cs index dff4e5d8..5b30abd8 100644 --- a/adas-core.Infrastructure/Utils/CustomPointOfCareConverter.cs +++ b/adas-core.Infrastructure/Utils/CustomPointOfCareConverter.cs @@ -10,6 +10,7 @@ namespace adas_core.Infrastructure.Utils; /// /// This converter is designed to handle the serialization and deserialization logic specific to point of care entities, tailoring the behavior inherited from the base class. /// +/// public class CustomPointOfCareConverter : JsonConverter { /// @@ -17,6 +18,7 @@ public class CustomPointOfCareConverter : JsonConverter /// /// The type to evaluate for convertibility. /// true if equals ; otherwise, false. + /// public override bool CanConvert(Type objectType) { return objectType == typeof(PointOfCare); diff --git a/adas-core.Infrastructure/Utils/MongoDbHostBuilderExtension.cs b/adas-core.Infrastructure/Utils/MongoDbHostBuilderExtension.cs index 054e7276..33cf6ae3 100644 --- a/adas-core.Infrastructure/Utils/MongoDbHostBuilderExtension.cs +++ b/adas-core.Infrastructure/Utils/MongoDbHostBuilderExtension.cs @@ -14,6 +14,7 @@ namespace adas_core.Infrastructure.Utils; /// /// Provides extension methods for configuring MongoDB integration on a host builder. /// +/// public static class MongoDbHostBuilderExtension { /// @@ -21,6 +22,7 @@ public static class MongoDbHostBuilderExtension /// /// The host builder to extend with the MongoDB configuration. /// The same instance, allowing further fluent configuration. + /// public static IHostBuilder UseMongo(this IHostBuilder hostBuilder) { ConfigureMongoDbConventions(); @@ -34,6 +36,7 @@ public static class MongoDbHostBuilderExtension /// /// The host whose services are used to resolve the instance. /// The same instance, enabling fluent chaining. + /// public static IHost RunMongoMigrations(this IHost host) { using var scope = host.Services.CreateScope(); @@ -63,6 +66,7 @@ public static class MongoDbHostBuilderExtension /// The configured instance. /// Thrown when the connection string or database name is null or empty. /// Thrown when the specified database does not exist. + /// private static IMongoDatabase ConfigureMongoDbConnection(IOptions dbSettings) { var connectionString = dbSettings.Value.ConnectionString; @@ -106,6 +110,7 @@ public static class MongoDbHostBuilderExtension /// Registers global MongoDB serialization conventions, including ignoring extra elements in BSON documents /// and using camelCase for element names, applied to all types in the application. /// + /// public static void ConfigureMongoDbConventions() { var pack = new ConventionPack diff --git a/adas-core.Infrastructure/Utils/MongoMaps/AlarmMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/AlarmMapContributor.cs index 23153399..94952f70 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/AlarmMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/AlarmMapContributor.cs @@ -13,11 +13,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// Represents a contributor that provides entity mapping configuration for Alarm entities. /// /// Implements the interface to participate in the entity mapping process. +/// public class AlarmMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for alarm-related domain types (including alarm configuration, audio, alarm items, patient observation alarms, inactivation states, sources, recording alerts, and performance), configuring enum serialization as strings, null-ignore behavior for optional members, default values where applicable, and unmapping members that should not be persisted. Registration is performed only when a class map for the type is not already registered, ensuring idempotent behavior. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(AlarmConfig))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/AppointmentMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/AppointmentMapContributor.cs index 109bea49..d9024605 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/AppointmentMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/AppointmentMapContributor.cs @@ -10,11 +10,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Represents a contributor that provides entity mapping configuration for the type as part of the mapping framework. /// +/// public class AppointmentMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the , , and types, customizing the MongoDB serialization for their members. Registration is performed only if a class map for the type has not already been registered, making the call safe to invoke multiple times. Optional members are configured to be ignored when null, enum members are serialized as nullable string enums, and certain computed/action members are unmapped or assigned default collection values. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(PatientAppointment))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/AuthMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/AuthMapContributor.cs index 5943a469..3b28c849 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/AuthMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/AuthMapContributor.cs @@ -7,11 +7,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Represents an entity map contributor that provides authentication-related mapping logic. /// +/// public class AuthMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the and types when no class map has been registered yet, configuring field serialization rules such as ignoring null or empty values, mapping the identifier to the "_id" element name, and unmapping navigation properties not intended for persistence. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(User))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/BannerConfigMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/BannerConfigMapContributor.cs index 62e60e7f..2f6220cb 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/BannerConfigMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/BannerConfigMapContributor.cs @@ -13,11 +13,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Used as a contributor that participates in entity map configuration for banner-related data. /// +/// public class BannerConfigMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for banner-related configuration types, including , , , and . Each map is only registered when no existing registration is found, and applies custom serialization (enum values stored as strings), null-ignoring behavior for optional members, and default values where appropriate. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(BannerItem))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/BeaconMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/BeaconMapContributor.cs index e87c0d95..51375c93 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/BeaconMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/BeaconMapContributor.cs @@ -14,11 +14,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// Implements the interface to contribute /// beacon-specific mapping logic. /// +/// public class BeaconMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for , , and types to configure their MongoDB serialization. Each registration is skipped if a class map for the type has already been registered, applying default values, element name mappings, and ignore-if-null settings to the respective members. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(LightBeacon))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/BoxConfigMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/BoxConfigMapContributor.cs index 1212f444..76dbe144 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/BoxConfigMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/BoxConfigMapContributor.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Provides configuration mapping contributions for box entities, implementing the interface to participate in entity map setup. /// +/// public class BoxConfigMapContributor : IEntityMapContributor { /// diff --git a/adas-core.Infrastructure/Utils/MongoMaps/CameraContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/CameraContributor.cs index d938e219..f3e6422c 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/CameraContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/CameraContributor.cs @@ -11,11 +11,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Implements the interface to provide camera-specific mapping behavior within the entity mapping pipeline. /// +/// public class CameraContributor : IEntityMapContributor { /// /// Registers BSON class maps for the and types with MongoDB, applying custom mapping conventions such as element name overrides, default values, and ignore-if-null behavior. Registration is performed only once; the method guards against duplicate registration by checking before registering. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(Camera))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/CardMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/CardMapContributor.cs index 3dff32a0..e257700c 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/CardMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/CardMapContributor.cs @@ -10,11 +10,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Provides card-specific mapping contributions by implementing the contract within the entity mapping pipeline. /// +/// public class CardMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the layout and configuration types used by the display configuration domain, including , , , , and . Each map is only registered when no existing map is present, and the configuration establishes default values, enum-as-string serialization, and ignore-if-null behavior for nullable layout properties. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(SectionBoxLayout))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/CellMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/CellMapContributor.cs index 825d9b90..094caa75 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/CellMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/CellMapContributor.cs @@ -10,11 +10,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Represents a contributor that participates in populating a cell-based map by implementing the entity map contribution contract. /// +/// public class CellMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for , , , , and when they have not already been registered. Each registration configures default values, ignore-if-null behavior, and enum serialization for the corresponding type's members to control how instances are persisted in MongoDB. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(Cell))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/ColorConfigMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/ColorConfigMapContributor.cs index 2a4356a6..acc54f31 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/ColorConfigMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/ColorConfigMapContributor.cs @@ -12,11 +12,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// Used as a pluggable component within the entity mapping pipeline to apply /// color-related configuration to mapped entities. /// +/// public class ColorConfigMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the type and its nested configuration types, providing default color and appearance values for properties such as levels, text, arrows, indicators, graphs, status boxes, therapy, tests, and procedures. Each class map is registered only if it has not already been registered, ensuring idempotent initialization of the MongoDB serialization mappings used by the color configuration system. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(ColorConfig))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/ComunicationFlowMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/ComunicationFlowMapContributor.cs index e6c20772..27107b33 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/ComunicationFlowMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/ComunicationFlowMapContributor.cs @@ -10,11 +10,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Represents a map contributor that provides mapping configuration for communication flow entities by implementing the interface. /// +/// public class ComunicationFlowMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the application's MongoDB-serialized types, including , , , , , and , applying custom mapping rules such as unmapping the Operation member on and ignoring null values for ObsertationData on . Each type is only registered if a class map has not already been registered, preventing duplicate registration. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(Message))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/DeviceMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/DeviceMapContributor.cs index c6adc465..66502ccc 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/DeviceMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/DeviceMapContributor.cs @@ -12,6 +12,7 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// Represents a contributor that provides device-related mapping logic for entities. /// Implements the interface to participate in the entity mapping process. /// +/// public class DeviceMapContributor : IEntityMapContributor { /// @@ -20,6 +21,7 @@ public class DeviceMapContributor : IEntityMapContributor /// /// Each map is only registered if no class map is already registered for the type. The registration applies auto-mapping and customizes serialization for enum members (stored as strings), applies default values for required properties, and configures nullable members to be ignored when null. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(DeviceActionType))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/DisplayHomeConfigContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/DisplayHomeConfigContributor.cs index e7613a29..8e5ef2e8 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/DisplayHomeConfigContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/DisplayHomeConfigContributor.cs @@ -10,11 +10,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Represents a contributor that supplies entity map configuration related to display home functionality. /// +/// public class DisplayHomeConfigContributor : IEntityMapContributor { /// /// Registers BSON class maps for and types if they are not already registered, configuring MongoDB serialization with custom element names, default values, null-ignore behavior, and string-based enum serialization. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(CardConfig))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/DisplayMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/DisplayMapContributor.cs index 5f4eb8ef..5116380c 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/DisplayMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/DisplayMapContributor.cs @@ -14,12 +14,14 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Implements the interface to participate in the entity mapping pipeline for display scenarios. /// +/// public class DisplayMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for display-related types (Display, DisplayNurse, StandarDisplay, SmartDisplay, PumpDisplay, DisplayConfig, and GroupedField) used for MongoDB serialization. /// /// Configures polymorphic deserialization for DisplayConfig by declaring its known subtypes, sets custom element names for identifiers, applies default values for enum and collection members, omits null or unmapped properties, and uses string-based enum serialization where applicable. Each registration is guarded so it only occurs when the corresponding class map has not already been registered. + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(Display))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/FormMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/FormMapContributor.cs index 2daf0fb3..11a2935e 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/FormMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/FormMapContributor.cs @@ -8,11 +8,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// Represents a contributor responsible for providing form-related mapping logic for entities. /// Implements the interface to participate in the entity mapping process. /// +/// public class FormMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for and types used during MongoDB serialization, configuring default values and conditional serialization rules for their members. Each class map is only registered if it has not already been registered, preventing duplicate registrations. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(FormConfig))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/GraphMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/GraphMapContributor.cs index afc03a7d..a6bbd8bd 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/GraphMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/GraphMapContributor.cs @@ -13,11 +13,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Implements the contract to participate in entity map configuration within a graph structure. /// +/// public class GraphMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the application's chart, graph, and legend configuration types, configuring serialization behavior such as default values, null-ignoring, and enum string serialization. Each registration is guarded by an check so the method is idempotent and can be safely called multiple times. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(GraphLayout))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/HeaderMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/HeaderMapContributor.cs index 83a89fc8..9d058e51 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/HeaderMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/HeaderMapContributor.cs @@ -10,11 +10,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Implements the interface to contribute mapping behavior within the entity mapping pipeline. /// +/// public class HeaderMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the type and its nested type with the MongoDB BsonClassMap serializer, configuring default values and null-ignore behavior for their members. Registration is performed only if a class map for the corresponding type has not already been registered, preventing duplicate registrations. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(HeaderConfig))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/Interfaz/IEntityMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/Interfaz/IEntityMapContributor.cs index 3166dbc9..a5feeae8 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/Interfaz/IEntityMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/Interfaz/IEntityMapContributor.cs @@ -8,5 +8,6 @@ public interface IEntityMapContributor /// /// Registers the object-to-object mappings used by the application. /// + /// void RegisterMaps(); } \ No newline at end of file diff --git a/adas-core.Infrastructure/Utils/MongoMaps/MasterListMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/MasterListMapContributor.cs index ccd69ec1..54f6ba0d 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/MasterListMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/MasterListMapContributor.cs @@ -13,11 +13,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Use this contributor when defining or extending the mapping configuration associated with master list entities. /// +/// public class MasterListMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for domain types (such as , , , , and their derived option lists) to control their MongoDB serialization. Each registration is performed only when no class map already exists for the type, and applies domain-specific settings including default values, null-ignore rules, discriminator naming, and custom serializers for enums, locale fields, and identifiers. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(Element))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/NoticeControlMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/NoticeControlMapContributor.cs index 62ad2bed..2d9cef52 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/NoticeControlMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/NoticeControlMapContributor.cs @@ -10,11 +10,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Implements the interface to participate in the entity mapping process. /// +/// public class NoticeControlMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the , , and types if they have not already been registered, configuring element names, automatic mapping, and null-ignore behavior where applicable. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(Notice))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/ObsUnitMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/ObsUnitMapContributor.cs index ae2551f7..d7b9b4ac 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/ObsUnitMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/ObsUnitMapContributor.cs @@ -10,11 +10,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Used to register or supply mapping logic specific to observation unit entities within the entity mapping framework. /// +/// public class ObsUnitMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for and types if they have not already been registered, configuring how their members are serialized to MongoDB documents. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(ConfigUnits))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/ObservationMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/ObservationMapContributor.cs index 6c591396..bfd37816 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/ObservationMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/ObservationMapContributor.cs @@ -17,11 +17,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Implements the interface to participate in the entity mapping process. /// +/// public class ObservationMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the observation-related domain types used by the application. Each registration is guarded by an check so the method is safe to invoke multiple times, configuring element names, ignoring null members, unmapping non-persisted members, and supplying custom enum and complex-object serializers where required. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(BasePatientObservation))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/PatientMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/PatientMapContributor.cs index f64ba04c..25c35c41 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/PatientMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/PatientMapContributor.cs @@ -12,11 +12,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Represents a contributor that participates in the mapping configuration of the entity by implementing the interface. /// +/// public class PatientMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for the domain model types (Patient, Person, PatientLocation, and related entities) to configure their MongoDB serialization, including auto-mapping, null-value handling, enum string serialization, dictionary serialization, and ID member mapping. Skips registration for types that already have a registered class map. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(HistoricalLocation))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/PoCMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/PoCMapContributor.cs index 5145ac11..21c25ab5 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/PoCMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/PoCMapContributor.cs @@ -15,11 +15,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// This class serves as a demonstrative or experimental implementation of entity map contribution behavior, intended to validate the contract defined by . /// +/// public class PoCMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for PointOfCare-related types (PointOfCare, PointOfCareConfiguration, PoCMapping, PoCMappingItem, and PoCSettings) with the MongoDB driver, configuring serialization options such as element names, default values, null handling, and enum string serialization. Each registration is performed only if a class map for the type has not already been registered. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(PointOfCare))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/PumpMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/PumpMapContributor.cs index 9509962e..2f9d7f4b 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/PumpMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/PumpMapContributor.cs @@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Utils.MongoMaps /// /// Represents a contributor that provides mapping logic for pump-related entities within an entity mapping context. /// + /// public class PumpMapContributor : IEntityMapContributor { /// diff --git a/adas-core.Infrastructure/Utils/MongoMaps/RelayContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/RelayContributor.cs index 4ec48b5f..05665661 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/RelayContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/RelayContributor.cs @@ -11,11 +11,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// Provides an entity map contributor that relays or forwards mapping contributions from an underlying source. /// Implements the contract to participate in entity mapping workflows. /// +/// public class RelayContributor : IEntityMapContributor { /// /// Registers the BSON class map for the type, defining how its properties are serialized and stored in MongoDB. The registration is performed only when no class map is already registered for the type, and it configures default values, string-based enum serialization, and null-ignoring behavior for optional members. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(Relay))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/RowMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/RowMapContributor.cs index 129e88dd..356d9c21 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/RowMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/RowMapContributor.cs @@ -10,11 +10,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Provides row-level mapping contributions to the entity mapping process by implementing the IEntityMapContributor interface. /// +/// public class RowMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for , , and , configuring default values, enum string serialization, and null-ignoring behavior for nullable members. Each map is registered only if no class map has already been registered for the corresponding type. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(RowBoxLayout))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/SectionMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/SectionMapContributor.cs index cee63d07..2e9ac915 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/SectionMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/SectionMapContributor.cs @@ -11,11 +11,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Represents a contributor that participates in section-based entity mapping by implementing the interface. /// +/// public class SectionMapContributor : IEntityMapContributor { /// /// Registers the BSON class maps for the , , , and types, configuring their MongoDB serialization behavior such as required fields, default values, null-ignoring members, and custom serializers. Each class map is registered only if it has not already been registered, preventing duplicate registrations. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(Section))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/ServiceConfigMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/ServiceConfigMapContributor.cs index edd8e5aa..08601fb5 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/ServiceConfigMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/ServiceConfigMapContributor.cs @@ -7,11 +7,13 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Represents an entity map contributor that provides mapping configuration for service configuration entities. /// +/// public class ServiceConfigMapContributor : IEntityMapContributor { /// /// Registers BSON class maps for service configuration-related types, including , , , , and , configuring their serialization elements, default values, and null-ignoring behavior. Each registration is guarded by a check that ensures the map is only registered if it has not been registered previously. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(ServiceConfig))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/StandardMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/StandardMapContributor.cs index 4032dbb8..6dfb7d89 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/StandardMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/StandardMapContributor.cs @@ -7,6 +7,7 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Provides a standard implementation of the interface. /// +/// public class StandardMapContributor : IEntityMapContributor { /// @@ -15,6 +16,7 @@ public class StandardMapContributor : IEntityMapContributor /// , several nullable UI configuration members are configured to be ignored /// when null to avoid persisting default values. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(HistoricalConfigChanges))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/TreatmentMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/TreatmentMapContributor.cs index c7ee86ab..2e4b7e47 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/TreatmentMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/TreatmentMapContributor.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// /// This class is intended to be used as a mapping contributor within an entity mapping pipeline, providing configuration logic specific to treatment entities. +/// public class TreatmentMapContributor : IEntityMapContributor { /// @@ -23,6 +24,7 @@ public class TreatmentMapContributor : IEntityMapContributor /// define custom element names, default values, null-ignoring behavior, and specialized /// serializers for object identifiers and enum values. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(PatientTreatment))) diff --git a/adas-core.Infrastructure/Utils/MongoMaps/UnitMapContributor.cs b/adas-core.Infrastructure/Utils/MongoMaps/UnitMapContributor.cs index af5b19e9..288fc9fc 100644 --- a/adas-core.Infrastructure/Utils/MongoMaps/UnitMapContributor.cs +++ b/adas-core.Infrastructure/Utils/MongoMaps/UnitMapContributor.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Utils.MongoMaps; /// /// Implements to integrate unit-specific mapping logic into the entity mapping pipeline. /// +/// public class UnitMapContributor : IEntityMapContributor { /// @@ -20,6 +21,7 @@ public class UnitMapContributor : IEntityMapContributor /// Each registration is performed only if no class map has been previously registered for the target type, and configures /// field-level mappings, default values, ignored properties, and custom serializers as required by the domain model. /// + /// public void RegisterMaps() { if (!BsonClassMap.IsClassMapRegistered(typeof(Unit))) diff --git a/adas-core.Infrastructure/Utils/MongoUtils.cs b/adas-core.Infrastructure/Utils/MongoUtils.cs index 87371cd7..299ab0dc 100644 --- a/adas-core.Infrastructure/Utils/MongoUtils.cs +++ b/adas-core.Infrastructure/Utils/MongoUtils.cs @@ -7,6 +7,7 @@ namespace adas_core.Infrastructure.Utils; /// /// Provides utility methods for interacting with MongoDB. /// +/// public class MongoUtils { /// diff --git a/adas-core.Infrastructure/Utils/PatientObservationAlarmConverter.cs b/adas-core.Infrastructure/Utils/PatientObservationAlarmConverter.cs index 16a7db9f..b7c9c8bc 100644 --- a/adas-core.Infrastructure/Utils/PatientObservationAlarmConverter.cs +++ b/adas-core.Infrastructure/Utils/PatientObservationAlarmConverter.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Utils; /// /// Implements to provide BSON serialization and deserialization support for objects. /// +/// public class PatientObservationAlarmConverter : JsonConverter, IBsonSerializer { /// @@ -22,6 +23,7 @@ public class PatientObservationAlarmConverter : JsonConverterThe deserialization arguments that influence how the value is read and converted. /// The deserialized .NET object produced from the BSON input. /// Always thrown because the deserialization logic has not been implemented yet. + /// public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) { throw new NotImplementedException(); @@ -34,6 +36,7 @@ public class PatientObservationAlarmConverter : JsonConverterThe BSON serialization arguments containing additional information that influences the serialization behavior. /// The object to be serialized into BSON. /// Thrown because the method has not yet been implemented. + /// public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value) { throw new NotImplementedException(); @@ -50,6 +53,7 @@ public class PatientObservationAlarmConverter : JsonConverterIndicates whether contains a value to be used during deserialization. /// The used for nested object deserialization. /// A populated from the JSON, or null if the JSON token is . + /// public override PatientObservationAlarm? ReadJson(JsonReader reader, Type objectType, PatientObservationAlarm? existingValue, bool hasExistingValue, JsonSerializer serializer) @@ -77,6 +81,7 @@ public class PatientObservationAlarmConverter : JsonConverterThe to which the JSON output is written. /// The object to serialize; if , the method performs no action. /// The used to assist with the conversion. + /// public new void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (value != null) @@ -100,6 +105,7 @@ public class PatientObservationAlarmConverter : JsonConverter /// The object instance whose type is inspected to locate the target property. /// The name of the property to which the attribute will be added. + /// private static void AddStringEnumConverterAttribute(object value, string propertyName) { var prop = value.GetType().GetProperty(propertyName); @@ -132,6 +138,7 @@ public class PatientObservationAlarmConverter : JsonConverterThe PatientObservationAlarm value to serialize. /// The JsonSerializer used during the serialization process. /// The method has not been implemented. + /// public override void WriteJson(JsonWriter writer, PatientObservationAlarm? value, JsonSerializer serializer) { throw new NotImplementedException(); diff --git a/adas-core.Infrastructure/Utils/PatientObservationConverter.cs b/adas-core.Infrastructure/Utils/PatientObservationConverter.cs index 297a33fc..cc867547 100644 --- a/adas-core.Infrastructure/Utils/PatientObservationConverter.cs +++ b/adas-core.Infrastructure/Utils/PatientObservationConverter.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Utils; /// /// The optional constructor parameter specifies the target value type used during conversion. /// +/// public class PatientObservationConverter(Type? valueType) : JsonConverter, IBsonSerializer { /// @@ -22,6 +23,8 @@ public class PatientObservationConverter(Type? valueType) : JsonConverterThe deserialization arguments containing additional information for the operation. /// An object representing the deserialized value. /// Always thrown because the method is not yet implemented. + /// public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) { throw new NotImplementedException(); @@ -34,6 +37,7 @@ public class PatientObservationConverter(Type? valueType) : JsonConverterThe BSON serialization arguments containing additional information that may influence the serialization process. /// The object to be serialized into BSON. /// Thrown because the serialization logic has not been implemented. + /// public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value) { throw new NotImplementedException(); @@ -47,6 +51,7 @@ public class PatientObservationConverter(Type? valueType) : JsonConverterThe JSON writer that receives the serialized output. /// The patient observation to serialize. When null, the method performs no serialization. /// The JSON serializer used during the conversion process. + /// public override void WriteJson(JsonWriter writer, PatientObservation? value, JsonSerializer serializer) { if (value != null) @@ -66,6 +71,7 @@ public class PatientObservationConverter(Type? valueType) : JsonConverter /// The object instance whose property should be annotated. /// The name of the property to which the StringEnumConverter attribute should be added. + /// private static void AddStringEnumConverterAttribute(object value, string propertyName) { var prop = value.GetType().GetProperty(propertyName); @@ -101,6 +107,7 @@ public class PatientObservationConverter(Type? valueType) : JsonConverterThe used to read nested values. /// A instance produced from the JSON. /// Thrown because the method has not been implemented yet. + /// public override PatientObservation ReadJson(JsonReader reader, Type objectType, PatientObservation? existingValue, bool hasExistingValue, JsonSerializer serializer) { diff --git a/adas-core.Infrastructure/Utils/PatientPumpObservationConverter.cs b/adas-core.Infrastructure/Utils/PatientPumpObservationConverter.cs index 2654bbfd..3a9bc03e 100644 --- a/adas-core.Infrastructure/Utils/PatientPumpObservationConverter.cs +++ b/adas-core.Infrastructure/Utils/PatientPumpObservationConverter.cs @@ -12,6 +12,7 @@ namespace adas_core.Infrastructure.Utils; /// /// Provides JSON conversion for instances and supports BSON serialization through the interface. /// +/// public class PatientPumpObservationConverter : JsonConverter, IBsonSerializer { /// @@ -21,6 +22,7 @@ public class PatientPumpObservationConverter : JsonConverter, I /// The deserialization arguments containing additional settings for the operation. /// The deserialized object. /// Thrown when the method is invoked, as the deserialization logic has not been implemented. + /// public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) { throw new NotImplementedException(); @@ -34,6 +36,7 @@ public class PatientPumpObservationConverter : JsonConverter, I /// The BSON serialization arguments that influence the serialization behavior. /// The object to be serialized into BSON. /// Thrown because the method has not been implemented. + /// public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value) { throw new NotImplementedException(); @@ -52,6 +55,7 @@ public class PatientPumpObservationConverter : JsonConverter, I /// The used for deserialization. /// A instance reconstructed from the JSON data. /// Thrown because the method has not been implemented yet. + /// public override PumpObservation ReadJson(JsonReader reader, Type objectType, PumpObservation? existingValue, bool hasExistingValue, JsonSerializer serializer) @@ -65,6 +69,8 @@ public class PatientPumpObservationConverter : JsonConverter, I /// The JSON writer to which the serialized object is written. /// The object to serialize; if null, the method does nothing. /// The JSON serializer used as context for the conversion. + /// public new void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (value != null) @@ -89,6 +95,7 @@ public class PatientPumpObservationConverter : JsonConverter, I /// The to serialize, or if no value is available. /// The providing serialization context and options. /// Always thrown because the method has not been implemented. + /// public override void WriteJson(JsonWriter writer, PumpObservation? value, JsonSerializer serializer) { throw new NotImplementedException(); @@ -99,6 +106,7 @@ public class PatientPumpObservationConverter : JsonConverter, I /// /// The object instance whose property will be inspected for the attribute. /// The name of the property to which the converter attribute will be added. + /// private static void AddStringEnumConverterAttribute(object value, string propertyName) { var prop = value.GetType().GetProperty(propertyName); diff --git a/adas-core.Infrastructure/Utils/PersonConverter.cs b/adas-core.Infrastructure/Utils/PersonConverter.cs index 862669d6..9a15a704 100644 --- a/adas-core.Infrastructure/Utils/PersonConverter.cs +++ b/adas-core.Infrastructure/Utils/PersonConverter.cs @@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Utils; /// /// The primary constructor accepts a that represents the value type associated with this converter. /// +/// public class PersonConverter(Type valueType) : JsonConverter, IBsonSerializer { /// @@ -22,6 +23,7 @@ public class PersonConverter(Type valueType) : JsonConverter, IBsonSeria /// The BSON deserialization arguments. /// The deserialized object. /// Always thrown because the method is not yet implemented. + /// public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) { throw new NotImplementedException(); @@ -34,6 +36,7 @@ public class PersonConverter(Type valueType) : JsonConverter, IBsonSeria /// The BSON serialization arguments containing additional settings for the serialization. /// The object to be serialized to BSON. /// Always thrown because the method has not been implemented yet. + /// public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value) { throw new NotImplementedException(); @@ -47,6 +50,8 @@ public class PersonConverter(Type valueType) : JsonConverter, IBsonSeria /// The to which the JSON representation is written. /// The instance to serialize. If , the method returns without writing anything. /// The used during the conversion to a . + /// public override void WriteJson(JsonWriter writer, Person? value, JsonSerializer serializer) { if (value == null) return; @@ -64,6 +69,7 @@ public class PersonConverter(Type valueType) : JsonConverter, IBsonSeria /// /// The object instance whose property's attributes will be inspected and modified. /// The name of the property to which the converter attribute will be added. + /// private static void AddStringEnumConverterAttribute(object value, string propertyName) { var prop = value.GetType().GetProperty(propertyName); @@ -96,6 +102,7 @@ public class PersonConverter(Type valueType) : JsonConverter, IBsonSeria /// The calling the method. /// A instance deserialized from the JSON. /// Always thrown because the method has not been implemented. + /// public override Person ReadJson(JsonReader reader, Type objectType, Person? existingValue, bool hasExistingValue, JsonSerializer serializer) { diff --git a/adas-core.Infrastructure/Utils/RabbitConsumerErrorStrategy.cs b/adas-core.Infrastructure/Utils/RabbitConsumerErrorStrategy.cs index faab08bc..41b4d4a3 100644 --- a/adas-core.Infrastructure/Utils/RabbitConsumerErrorStrategy.cs +++ b/adas-core.Infrastructure/Utils/RabbitConsumerErrorStrategy.cs @@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Utils; /// /// Handles errors that occur during RabbitMQ message consumption and publishes them using the configured publisher service. /// +/// public class RabbitConsumerErrorHandler(IPublisherService publisherService) { private const int MaxRetries = 2; @@ -24,6 +25,7 @@ public class RabbitConsumerErrorHandler(IPublisherService publisherService) /// The deserialized message whose body is inspected or re-serialized for retry handling. /// Information about the message receipt, passed to the retry handler. /// The asynchronous delegate representing the next step in the processing pipeline. + /// public async Task HandleAsync( Message message, MessageReceivedInfo receivedInfo, @@ -127,6 +129,7 @@ public class RabbitConsumerErrorHandler(IPublisherService publisherService) /// /// The message properties whose headers are inspected for the "retries" entry. /// The number of retries parsed from the "retries" header, or 0 if the header is absent or not a byte array. + /// private int GetRetries(MessageProperties properties) { if (properties.Headers != null && @@ -148,6 +151,7 @@ public class RabbitConsumerErrorHandler(IPublisherService publisherService) /// The exception that was raised, whose message is included in the error payload. /// The headers to associate with the resulting error message. /// A containing the constructed error and the propagated message properties. + /// private static Message CreateErrorMessage( MessageReceivedInfo receivedInfo, MessageProperties originalProperties, diff --git a/adas-core.Infrastructure/Utils/RabbitIErrorMessageSerializer.cs b/adas-core.Infrastructure/Utils/RabbitIErrorMessageSerializer.cs index 978cec7c..de15ca33 100644 --- a/adas-core.Infrastructure/Utils/RabbitIErrorMessageSerializer.cs +++ b/adas-core.Infrastructure/Utils/RabbitIErrorMessageSerializer.cs @@ -10,6 +10,7 @@ namespace adas_core.Infrastructure.Utils; /// /// This class serves as the RabbitMQ-specific concrete realization of the contract. /// +/// public class RabbitIErrorMessageSerializer : IErrorMessageSerializer { /// @@ -18,6 +19,7 @@ public class RabbitIErrorMessageSerializer : IErrorMessageSerializer /// /// The JSON-encoded string to unescape and convert. /// A UTF-8 encoded byte array of the unescaped string, or null if the deserialized value is null. + /// public byte[]? Deserialize(string messageBody) { var unescapedJsonString = JsonConvert.DeserializeObject(messageBody); @@ -30,6 +32,7 @@ public class RabbitIErrorMessageSerializer : IErrorMessageSerializer /// /// The raw byte array representing the message body to be deserialized. /// The deserialized JSON string if successful; otherwise, the raw UTF-8 decoded string. Returns if the deserialized JSON value is null. + /// public string? Serialize(byte[] messageBody) { var stringifiedMsgBody = Encoding.UTF8.GetString(messageBody); diff --git a/adas-core.Infrastructure/Utils/TypesUtils.cs b/adas-core.Infrastructure/Utils/TypesUtils.cs index af971249..c9f608d4 100644 --- a/adas-core.Infrastructure/Utils/TypesUtils.cs +++ b/adas-core.Infrastructure/Utils/TypesUtils.cs @@ -5,6 +5,7 @@ namespace adas_core.Infrastructure.Utils; /// /// Provides static utility methods for working with types. /// +/// public static class TypesUtils { /// @@ -15,6 +16,7 @@ public static class TypesUtils /// The specific device identifier used when resolving the driver type. /// The of the driver that corresponds to the given device type. /// Thrown when the provided is not a recognized value. + /// public static Type GetDriver(string deviceType, string device) { return deviceType switch diff --git a/adas-core.LdapLogin/Configuration/LDAPModule.cs b/adas-core.LdapLogin/Configuration/LDAPModule.cs index f729fcdf..7f8951a7 100644 --- a/adas-core.LdapLogin/Configuration/LDAPModule.cs +++ b/adas-core.LdapLogin/Configuration/LDAPModule.cs @@ -7,6 +7,7 @@ namespace adas_core.LdapLogin.Configuration; /// /// Module for configuring LDAP services and dependencies. /// +/// public class LdapModule : IModule { /// @@ -14,6 +15,7 @@ public class LdapModule : IModule /// /// The service collection to which LDAP services will be added. /// The configuration from which LDAP settings will be read. + /// public static void Configure(IServiceCollection services, IConfiguration configuration) { var configSection = configuration.GetSection("Ldap"); diff --git a/adas-core.LdapLogin/Configuration/LdapConfig.cs b/adas-core.LdapLogin/Configuration/LdapConfig.cs index 4d0365a8..139de218 100644 --- a/adas-core.LdapLogin/Configuration/LdapConfig.cs +++ b/adas-core.LdapLogin/Configuration/LdapConfig.cs @@ -5,6 +5,7 @@ namespace adas_core.LdapLogin.Configuration; /// /// Configuration class for LDAP authentication settings, including server details, user properties, and authority mappings. /// +/// public class LdapConfig { /// @@ -86,6 +87,7 @@ public class LdapConfig /// /// Represents a user in the LDAP authentication context, including their name, username, role, allowed actions, and an optional display ID for user-friendly identification. /// +/// public class UserLdap { /// @@ -120,6 +122,7 @@ public class UserLdap /// /// Represents a mapping between an LDAP group and an application role, including the group name, corresponding role, allowed actions, and an optional display ID for user-friendly identification. /// +/// public class AuthorityMap { /// diff --git a/adas-core.LdapLogin/Configuration/LdapConfigValidator.cs b/adas-core.LdapLogin/Configuration/LdapConfigValidator.cs index c1ec2e98..b3da4b5a 100644 --- a/adas-core.LdapLogin/Configuration/LdapConfigValidator.cs +++ b/adas-core.LdapLogin/Configuration/LdapConfigValidator.cs @@ -5,6 +5,7 @@ namespace adas_core.LdapLogin.Configuration; /// /// Validator for LdapConfig. Ensures that all required properties are set and valid. /// +/// public class LdapConfigValidator : AbstractValidator { //public LdapConfigValidator() diff --git a/adas-core.LdapLogin/IModule.cs b/adas-core.LdapLogin/IModule.cs index 9a7446fb..6600f7c1 100644 --- a/adas-core.LdapLogin/IModule.cs +++ b/adas-core.LdapLogin/IModule.cs @@ -13,6 +13,8 @@ public interface IModule /// /// /// + /// static void Configure(IServiceCollection services, IConfiguration configuration) { } diff --git a/adas-core.LdapLogin/LdapLoginService.cs b/adas-core.LdapLogin/LdapLoginService.cs index a27cbef8..20505824 100644 --- a/adas-core.LdapLogin/LdapLoginService.cs +++ b/adas-core.LdapLogin/LdapLoginService.cs @@ -19,6 +19,7 @@ namespace adas_core.LdapLogin; /// The service also handles the creation of new users in the application if they do not already exist, based on the LDAP information. /// It uses configuration settings for connecting to the LDAP server and for mapping LDAP attributes to user properties and authorities. /// +/// public class LdapLoginService : ILoginService { /// @@ -50,6 +51,7 @@ public class LdapLoginService : ILoginService /// The user service for managing user information. /// The authority service for managing user authorities. /// The logger for logging LDAP login operations. + /// public LdapLoginService( IOptions ldapConfig, IValidator validator, @@ -82,6 +84,7 @@ public class LdapLoginService : ILoginService /// The authenticated user. /// Thrown when there is an error during the login process. /// Thrown when the user is not found in the LDAP directory. + /// public async Task Login(string username, string password) { // Check for LDAP config @@ -168,6 +171,7 @@ public class LdapLoginService : ILoginService /// The HTTP context of the request. /// A task representing the asynchronous operation. /// Thrown when the method is not implemented. + /// public Task Login(HttpContext context) { throw new LoginServicesException("Not implemented"); @@ -180,6 +184,8 @@ public class LdapLoginService : ILoginService /// The password of the user to authenticate. /// A task representing the asynchronous operation. /// Thrown when the method is not implemented. + /// public Task Authenticate(string username, string password) { throw new LoginServicesException("Not implemented"); @@ -191,6 +197,7 @@ public class LdapLoginService : ILoginService /// The ID of the user to retrieve. /// A task representing the asynchronous operation. /// Thrown when the method is not implemented. + /// public Task GetById(ObjectId id) { throw new LoginServicesException("Not implemented"); @@ -202,6 +209,7 @@ public class LdapLoginService : ILoginService /// The email of the user to retrieve. /// A task representing the asynchronous operation. /// Thrown when the method is not implemented. + /// public Task GetByEmail(string email) { throw new LoginServicesException("Not implemented"); @@ -213,6 +221,7 @@ public class LdapLoginService : ILoginService /// The username of the user to retrieve. /// A task representing the asynchronous operation. /// Thrown when the method is not implemented. + /// public Task GetByUsername(string username) { throw new LoginServicesException("Not implemented"); @@ -223,6 +232,7 @@ public class LdapLoginService : ILoginService /// /// A task representing the asynchronous operation. /// Thrown when the method is not implemented. + /// public Task> GetAllUsers() { throw new LoginServicesException("Not implemented"); @@ -235,6 +245,7 @@ public class LdapLoginService : ILoginService /// The user information obtained from the LDAP entry. /// The LDAP entry containing the user's information. /// The existing or newly created user with updated authorities. + /// private async Task GetOrCreateUser(User userEntryLdap, LdapEntry entry) { var userToReturn = (await _userService.Value.GetUserByUserName(userEntryLdap.UserName) ?? @@ -261,6 +272,7 @@ public class LdapLoginService : ILoginService /// The user whose authorities are being checked. /// The LDAP entry containing the user's information. /// A list of updated authorities for the user. + /// private async Task> CheckAuthorities(User user, LdapEntry entry) { try @@ -311,6 +323,7 @@ public class LdapLoginService : ILoginService /// The LDAP entry containing the user's information. /// The user whose authorities are being retrieved. /// A list of authorities for the user based on the whitelist. + /// private List GetAuthoritiesWhiteList(LdapEntry entry, User user) { try @@ -358,6 +371,10 @@ public class LdapLoginService : ILoginService /// /// The LDAP entry containing the user's information. /// The existing or newly created user with updated authorities. + /// + /// private User GetUser(LdapEntry ldapEntry) { var attributes = ldapEntry.GetAttributeSet(); @@ -405,6 +422,7 @@ public class LdapLoginService : ILoginService /// The LDAP entry containing the user's information. /// The user whose authorities are being retrieved. /// A list of authorities for the user based on the LDAP entry and the application's configuration. + /// private List GetAuthoritiesMap(LdapEntry ldapEntry, User user) { try diff --git a/adas-core.LdapLogin/RegistrationExtension/LdapRegistration.cs b/adas-core.LdapLogin/RegistrationExtension/LdapRegistration.cs index eec798a4..4f682b02 100644 --- a/adas-core.LdapLogin/RegistrationExtension/LdapRegistration.cs +++ b/adas-core.LdapLogin/RegistrationExtension/LdapRegistration.cs @@ -8,6 +8,7 @@ namespace adas_core.LdapLogin.RegistrationExtension; /// /// Extension class for registering LDAP authentication services and configurations in the service collection. /// +/// public static class LdapRegistration { /// @@ -15,6 +16,7 @@ public static class LdapRegistration /// /// The service collection to which LDAP services will be added. /// The configuration from which LDAP settings will be read. + /// public static void AddLdapAuth(this IServiceCollection serviceCollection, IConfigurationRoot configuration) { serviceCollection.AddSingleton, LdapConfigValidator>(); diff --git a/adas-core.LocalLogin/ILocalLoginRepository.cs b/adas-core.LocalLogin/ILocalLoginRepository.cs index 45f172ce..7dbecb03 100644 --- a/adas-core.LocalLogin/ILocalLoginRepository.cs +++ b/adas-core.LocalLogin/ILocalLoginRepository.cs @@ -15,6 +15,7 @@ public interface ILocalLoginRepository : IMongoRepository /// Retrieves a list of all users from the MongoDB database. This method is asynchronous and returns a Task that resolves to a List of User objects. /// /// A Task that resolves to a List of User objects. + /// Task> GetAll(); /// @@ -22,6 +23,7 @@ public interface ILocalLoginRepository : IMongoRepository /// /// The unique identifier of the user to retrieve. /// A Task that resolves to a User object if found, or null if no user with the specified ID exists. + /// Task GetById(ObjectId id); /// @@ -29,6 +31,7 @@ public interface ILocalLoginRepository : IMongoRepository /// /// The email address of the user to retrieve. /// A Task that resolves to a User object if found, or null if no user with the specified email exists. + /// Task GetByEmail(string email); //User UpdateUser(User user); @@ -41,6 +44,7 @@ public interface ILocalLoginRepository : IMongoRepository /// /// The username of the user to retrieve. /// A Task that resolves to a User object if found, or null if no user with the specified username exists. + /// Task GetByUsername(string username); /// @@ -50,6 +54,7 @@ public interface ILocalLoginRepository : IMongoRepository /// The unique identifier of the user to update. /// The updated User object. /// A Task that resolves to a boolean value indicating whether the update was successful (true) or not (false). + /// Task UpdateOneUserAsync(ObjectId id, User user); /// @@ -57,5 +62,6 @@ public interface ILocalLoginRepository : IMongoRepository /// /// The User object to insert into the database. /// A Task that resolves to a boolean value indicating whether the insertion was successful (true) or not (false). + /// Task InsertUserOneAsync(User user); } \ No newline at end of file diff --git a/adas-core.LocalLogin/LocalLoginRepository.cs b/adas-core.LocalLogin/LocalLoginRepository.cs index e35a4a2e..796ddb6c 100644 --- a/adas-core.LocalLogin/LocalLoginRepository.cs +++ b/adas-core.LocalLogin/LocalLoginRepository.cs @@ -12,6 +12,7 @@ namespace adas_core.LocalLogin; /// Repository for handling user data in the local login system. This repository provides methods for inserting, updating, and retrieving user information from a MongoDB collection. /// It also ensures that a system user is created during the initial load if it does not already exist. /// +/// public class LocalLoginRepository : MongoRepository, ILocalLoginRepository { /// @@ -26,6 +27,7 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// /// The API settings containing configuration for the MongoDB collection name and other related settings. /// The MongoDB database instance used for database operations. + /// public LocalLoginRepository( IOptions apiSettings, IMongoDatabase database @@ -39,6 +41,7 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// Gets the name of the MongoDB collection for user data. This method overrides the base method from MongoRepository and returns the collection name specified in the API settings. /// /// The name of the MongoDB collection for user data. + /// public override string GetCollectionName() { return _apiSettings.Users; @@ -49,6 +52,7 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// /// The user object to insert into the collection. /// True if the insertion is successful, false otherwise. + /// public async Task InsertUserOneAsync(User user) { try @@ -71,6 +75,7 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// The unique identifier of the user to update. /// The user object containing the updated information. /// True if the update is successful, false otherwise. + /// public async Task UpdateOneUserAsync(ObjectId id, User user) { try @@ -100,6 +105,7 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// /// The unique identifier of the user to retrieve. /// The user object if found, or null if no user is found with the given ID. + /// public async Task GetById(ObjectId id) { var filter = Builders.Filter.Eq(p => p.Id, id); @@ -112,6 +118,7 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// /// The email address of the user to retrieve. /// The user object if found, or null if no user is found with the given email address. + /// public async Task GetByEmail(string email) { var filter = Builders.Filter.Eq(p => p.Email, email); @@ -124,6 +131,7 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// /// The username of the user to retrieve. /// The user object if found, or null if no user is found with the given username. + /// public async Task GetByUsername(string username) { var filter = Builders.Filter.Eq(p => p.UserName, username); @@ -135,6 +143,7 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// Retrieves all users from the MongoDB collection. This method executes a query to find all documents in the collection and returns a list of user objects. /// /// A list of all user objects in the collection. + /// public async Task> GetAll() { var result = await Collection.FindAsync(Builders.Filter.Empty); @@ -147,6 +156,7 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// It calls the GetOrCreateSystemUser method to check for the existence of the system user and insert it if necessary. /// /// + /// public sealed override async Task InsertInitialLoad() { await GetOrCreateSystemUser(); @@ -157,6 +167,8 @@ public class LocalLoginRepository : MongoRepository, ILocalLoginRepository /// This method retrieves a user with the username "System" and, if no such user is found, it creates a new user with predefined credentials and inserts it into the collection. /// /// The system user object if found or created, or null if the operation fails. + /// private async Task GetOrCreateSystemUser() { var user = await GetByUsername("System"); diff --git a/adas-core.LocalLogin/LocalLoginServiceImpl.cs b/adas-core.LocalLogin/LocalLoginServiceImpl.cs index 9b010807..77fc2b27 100644 --- a/adas-core.LocalLogin/LocalLoginServiceImpl.cs +++ b/adas-core.LocalLogin/LocalLoginServiceImpl.cs @@ -15,6 +15,7 @@ namespace adas_core.LocalLogin; /// /// The repository used to access local user data. /// The service used to manage user authorities and permissions. +/// public class LocalLoginServiceImpl( ILocalLoginRepository localLoginRepository, IAuthorityService authorityService) @@ -38,6 +39,7 @@ public class LocalLoginServiceImpl( /// The password of the user to authenticate. /// The authenticated user object. /// Thrown when the username or password is invalid. + /// public async Task Login(string username, string password) { var userFound = await localLoginRepository.GetByUsername(username) ?? @@ -56,6 +58,7 @@ public class LocalLoginServiceImpl( /// The HTTP context used for authentication. /// A task representing the asynchronous operation. /// Thrown when this method is called, as it is not implemented for local login. + /// public Task Login(HttpContext context) { throw new LoginServicesException("Not implemented"); @@ -68,6 +71,7 @@ public class LocalLoginServiceImpl( /// The username of the user to authenticate. /// The password of the user to authenticate. /// The authenticated user object, or an empty User object if authentication fails. + /// public async Task Authenticate(string username, string password) { try @@ -90,6 +94,7 @@ public class LocalLoginServiceImpl( /// /// The unique identifier of the user to retrieve. /// The user object if found, or null if no user is found with the given ID. + /// public async Task GetById(ObjectId id) { return await localLoginRepository.GetById(id); @@ -100,6 +105,7 @@ public class LocalLoginServiceImpl( /// /// The email address of the user to retrieve. /// The user object if found, or null if no user is found with the given email. + /// public async Task GetByEmail(string email) { return await localLoginRepository.GetByEmail(email); @@ -110,6 +116,7 @@ public class LocalLoginServiceImpl( /// /// /// + /// public async Task GetByUsername(string username) { return await localLoginRepository.GetByUsername(username); @@ -119,6 +126,7 @@ public class LocalLoginServiceImpl( /// Retrieves a list of all users from the local repository. This method queries the repository for all user records and returns them as a list. If there are no users in the repository, it returns an empty list. /// /// A list of all user objects, or an empty list if no users are found. + /// public async Task> GetAllUsers() { return await localLoginRepository.GetAll(); diff --git a/adas-core.LocalLogin/RegistrationExtension/LocalLoginExtension.cs b/adas-core.LocalLogin/RegistrationExtension/LocalLoginExtension.cs index a92b6461..4b352068 100644 --- a/adas-core.LocalLogin/RegistrationExtension/LocalLoginExtension.cs +++ b/adas-core.LocalLogin/RegistrationExtension/LocalLoginExtension.cs @@ -9,12 +9,14 @@ namespace adas_core.LocalLogin.RegistrationExtension; /// /// Extension class for registering local login services and repositories in the dependency injection container. /// +/// public static class LocalLoginExtension { /// /// Registers the local login services and repositories in the dependency injection container. /// /// The service collection to which the services and repositories will be added. + /// public static void AddLocalLogin(this IServiceCollection serviceCollection) { serviceCollection.AddSingleton(); diff --git a/adas-core.Test/Customizations/H12O/UCIN/CalculatedObservationsTest.cs b/adas-core.Test/Customizations/H12O/UCIN/CalculatedObservationsTest.cs index e2c48dba..ff65fff8 100644 --- a/adas-core.Test/Customizations/H12O/UCIN/CalculatedObservationsTest.cs +++ b/adas-core.Test/Customizations/H12O/UCIN/CalculatedObservationsTest.cs @@ -34,6 +34,8 @@ public class CalculatedObservationsTest /// is produced for each test. /// /// + /// [SetUp] public void Setup() { @@ -610,6 +612,8 @@ public class CalculatedObservationsTest /// Verifies that when a previous for the same patient and location has already been removed, the intravenous calculation performed by produces a result of 0. /// /// + /// [Test] public async Task Calculate_Intravenous_Obs_Already_Exist_Removed_Should_Return_0() { @@ -837,6 +841,8 @@ public class CalculatedObservationsTest /// Verifies that mapping a new with a "Catéter línea media" type, when two prior intravenous lines exist (one "Catéter EPICUTÁNEO PERIFÉRICO" and one "Catéter Venoso PERIFÉRICO"), inserts an named "IntravenousLines" with a summed value of 5 for the given . /// /// + /// [Test] public async Task Calculate_Intravenous_sum_one_middle_line_and_two_Peripheral_should_return_5() { diff --git a/adas-core.Test/Customizations/HPAZ/CalculatedObservationsTest.cs b/adas-core.Test/Customizations/HPAZ/CalculatedObservationsTest.cs index 26f00186..81b821fd 100644 --- a/adas-core.Test/Customizations/HPAZ/CalculatedObservationsTest.cs +++ b/adas-core.Test/Customizations/HPAZ/CalculatedObservationsTest.cs @@ -26,6 +26,7 @@ public class CalculatedObservationsTest /// /// Initializes mocked dependencies and configures the dependency injection container required to instantiate the service under test. /// + /// [SetUp] public void Setup() { @@ -114,6 +115,7 @@ public class CalculatedObservationsTest /// /// Verifies that a PatientObservation with the ventilation mode "PRVC" is mapped to a calculated observation with the value "VCRP". /// + /// [Test] public async Task Calculate_Ventilation_Mode_PRVC_Returns_VCRP() { @@ -137,6 +139,7 @@ public class CalculatedObservationsTest /// Verifies that the calculated observations mapping translates the ventilation mode value "FLUJ.ALTO" (High Flow) into the respiratory support code "OAF". /// Ensures that a patient observation with the name "Resp_Mode" and value "FLUJ.ALTO" produces a non-null mapped result with the expected output value. /// + /// [Test] public async Task Calculate_Ventilation_Mode_FLUJ_ALTO_Returns_OAF() { @@ -159,6 +162,7 @@ public class CalculatedObservationsTest /// /// Verifies that when a patient observation's respiratory mode is neither "PRVC" nor "FLUJ_ALTO" (for example, "VNI PC"), the calculated observation is not mapped to "VCRP" or "OAF". /// + /// [Test] public async Task Calculate_Ventilation_Mode_Not_PRVC_Not_FLUJ_ALTO_Returns_Other() { @@ -188,6 +192,7 @@ public class CalculatedObservationsTest /// Verifies that the calculated observations mapping does not produce a Sattc_FiO2 observation /// when the Sattc value is 98, ensuring the calculation is suppressed for this specific input case. /// + /// [Test] public async Task CalculateSF_Sattc_98_Returns_Not_Sattc_FiO2() { @@ -239,6 +244,7 @@ public class CalculatedObservationsTest /// Verifies that when an FiO2 observation is processed, the Oxygenation Index is calculated and inserted /// using the related P_VAM and PaO2_Tidal observations retrieved for the same patient. /// + /// [Test] public async Task CalculateOxygenationIndex_FiO2_Returns_Oxygenation_Index() { @@ -297,6 +303,7 @@ public class CalculatedObservationsTest /// (computed as P_VAM × FiO2 × 100 / PaO2) that is inserted through the observation service for the same patient. /// /// A task that completes when the expected Oxygenation_Index observation has been inserted via the mocked observation service. + /// [Test] public async Task CalculateOxygenationIndex_P_VAM_Returns_Oxygenation_Index() { @@ -353,6 +360,7 @@ public class CalculatedObservationsTest /// /// Verifies that when a PaO2_Tidal observation is mapped, the calculated Oxygenation_Index is derived using the formula P_VAM * FiO2 * 100 / PaO2_Tidal and persisted as an ADAS-coded observation for the same patient. /// + /// [Test] public async Task CalculateOxygenationIndex_PaO2_Tidal_Returns_Oxygenation_Index() { @@ -411,6 +419,8 @@ public class CalculatedObservationsTest /// is missing from the patient's most recent observations, even when a PaO2_Tidal observation is provided. /// Ensures that the mapping logic does not insert a new Oxygenation_Index observation in this scenario. /// + /// [Test] public async Task CalculateOxygenationIndex_PaO2_Tidal_Not_Returns_Oxygenation_Index() { @@ -456,6 +466,7 @@ public class CalculatedObservationsTest /// Verifies that the Oxygenation_Index is not calculated or persisted when the PaO2_Tidal observation value is zero. /// Ensures that the mapping logic skips downstream calculation and InsertObservation is never invoked in this edge case. /// + /// [Test] public async Task CalculateOxygenationIndex_PaO2_Tidal_0_Not_Returns_Oxygenation_Index() { @@ -513,6 +524,7 @@ public class CalculatedObservationsTest /// by dividing the PaO2 value by the most recent FiO2 observation for the patient and inserting the result as a new /// PatientObservation with the ADAS coding system. /// + /// [Test] public async Task CalculatePF_PaO2_Returns_PaO2_FiO2() { @@ -566,6 +578,7 @@ public class CalculatedObservationsTest /// when an FiO2 observation is processed, by inserting a new patient observation with the /// expected ratio value and coding system. /// + /// [Test] public async Task CalculatePF_FiO2_Returns_PaO2_FiO2() { @@ -616,6 +629,7 @@ public class CalculatedObservationsTest /// Verifies that the PF ratio calculation does not produce a PaO2/FiO2 observation when the FiO2 value is zero. /// Ensures that no calculated observation is inserted for the patient under this condition. /// + /// [Test] public async Task CalculatePF_FiO2_0_Not_Returns_PaO2_FiO2() { @@ -661,6 +675,7 @@ public class CalculatedObservationsTest /// /// Verifies that when patient observations include a low SpO2 (Sattc) value of 50 and a low FC value of 50, the calculated observations processing triggers a BlueCode alarm by inserting the observation and sending the alarm. /// + /// [Test] public async Task SendAlarm_BlueCode_FC_SpO2_Alarm_True_Returns_SendAlarm_BlueCode() @@ -707,6 +722,7 @@ public class CalculatedObservationsTest /// Verifies that when a BlueCode alarm condition is triggered by FC and TAm observations, the calculated blue code list is generated, the observation is inserted, and the blue code alarm is sent with the expected severity and type. /// /// A task that completes when the blue code alarm verification has been executed. + /// [Test] public async Task SendAlarm_BlueCode_FC_TAm_Alarm_True_Returns_SendAlarm_BlueCode() @@ -769,6 +785,7 @@ public class CalculatedObservationsTest /// /// Verifies that a BlueCode alarm is not triggered when the heart rate (FC) is at 50 and the mean arterial pressure (TAm) values do not meet the BlueCode criteria. /// + /// [Test] public async Task SendAlarm_BlueCode_FC_TAm_Alarm_False() { @@ -833,6 +850,7 @@ public class CalculatedObservationsTest /// /// The object whose string representation will be converted to a double. /// The parsed value if the conversion succeeds; otherwise, . + /// private static double? TryparseDouble(object value) { return double.TryParse(value.ToString(), out var valueParsed) ? valueParsed : null; @@ -951,6 +969,7 @@ public class CalculatedObservationsTest /// /// Verifies that a representing a pump volumetric air occlusion alarm is correctly mapped by the calculated observations mapper, returning a non-null result with a matching name. /// + /// [Test] public async Task Map_PatientObservation_Alarm_Pump_Retur_obs() { diff --git a/adas-core.Test/Customizations/HRYC/CalculatedObservationsTest.cs b/adas-core.Test/Customizations/HRYC/CalculatedObservationsTest.cs index 4814d07b..72359922 100644 --- a/adas-core.Test/Customizations/HRYC/CalculatedObservationsTest.cs +++ b/adas-core.Test/Customizations/HRYC/CalculatedObservationsTest.cs @@ -1137,6 +1137,8 @@ public class CalculatedObservationsTest /// Verifies that . correctly computes the diuresis-to-weight ratio as 43.6 when the latest diuresis observation value is 3924 and the current weight observation value is 90, and persists a derived named "Diuresis_Weight" for the same . /// /// + /// [Test] public async Task CalculateDiuresis_Weight_D_3924_Receive_W_90_Return_43_6() { diff --git a/adas-core.Test/Customizations/HUVH/UCIA/CalculatedObservationsTest.cs b/adas-core.Test/Customizations/HUVH/UCIA/CalculatedObservationsTest.cs index 512e53f8..7601f245 100644 --- a/adas-core.Test/Customizations/HUVH/UCIA/CalculatedObservationsTest.cs +++ b/adas-core.Test/Customizations/HUVH/UCIA/CalculatedObservationsTest.cs @@ -20,6 +20,8 @@ namespace adas_core.Test.Customizations.HUVH.UCIA; /// Marked with TestFixture and assigned Order(2) to control its execution sequence relative to other fixtures. /// /// +/// [TestFixture] [Order(2)] public class CalculatedObservationsTest @@ -29,6 +31,7 @@ public class CalculatedObservationsTest /// configuring a service provider with these dependencies, and instantiating the /// class under test. /// + /// [SetUp] public void Setup() { @@ -84,6 +87,7 @@ public class CalculatedObservationsTest /// a RASS observation with a sufficiently low score, recent PSI and TS observations, and an active treatment /// (e.g., Propofol) with a minimum requested give amount that triggers the over-sedation condition. /// + /// [Test] public async Task CalculateOverSedation_Should_Insert_Observation_When_Conditions_Met() { @@ -108,6 +112,7 @@ public class CalculatedObservationsTest /// /// Verifies that no over-sedation observation is inserted when the patient's RASS score is not -4 or -5, ensuring the over-sedation calculation only applies for those specific values. /// + /// [Test] public async Task CalculateOverSedation_Should_Not_Insert_Observation_When_RASS_Is_Not_Negative4_Or_Negative5() { @@ -123,6 +128,7 @@ public class CalculatedObservationsTest /// /// Verifies that no observation is inserted when calculating over-sedation and the patient's PSI (Sedation Intensity Index) is 25 or higher, which indicates the threshold above which the over-sedation mapping should not produce an observation. /// + /// [Test] public async Task CalculateOverSedation_Should_Not_Insert_Observation_When_PSI_Is_25_Or_Higher() { @@ -144,6 +150,7 @@ public class CalculatedObservationsTest /// /// Verifies that the over-sedation calculation does not insert an observation when the patient's TS (Tidal Spontaneous) value is 5 or lower, even with a low RASS score and an elevated PSI value. /// + /// [Test] public async Task CalculateOverSedation_Should_Not_Insert_Observation_When_TS_Is_5_Or_Lower() { @@ -165,6 +172,7 @@ public class CalculatedObservationsTest /// /// Verifies that no observation is inserted when the patient has no active treatments that exceed the configured threshold during the over-sedation calculation. /// + /// [Test] public async Task CalculateOverSedation_Should_Not_Insert_Observation_When_No_Treatments_Exceed_Threshold() { @@ -190,6 +198,7 @@ public class CalculatedObservationsTest /// Verifies that an over-sedation observation is inserted when the calculation is triggered by a PSI observation /// and the patient's last RASS and TS observations, combined with active treatment data, meet the triggering criteria. /// + /// [Test] public async Task CalculateOverSedation_Should_Insert_Observation_When_Triggered_By_PSI_Observation() { @@ -215,6 +224,7 @@ public class CalculatedObservationsTest /// /// Verifies that the over-sedation calculation logic inserts a new observation when a triggering TS (Twitch Score) observation is received, given the presence of related RASS and PSI observations and an active treatment (e.g., Propofol) meeting the required minimum amount threshold. /// + /// [Test] public async Task CalculateOverSedation_Should_Insert_Observation_When_Triggered_By_TS_Observation() { @@ -246,6 +256,7 @@ public class CalculatedObservationsTest /// /// Verifies that when an Inspiratory Pressure (PI) observation is processed and no Compliancia (COMPL) observation is found for the patient, the ventilation mode is set to "VMNI". /// + /// [Test] public async Task CalculateVentilationMode_Should_Set_VMNI_When_PI_PS_Arrives_Without_COMPL() { @@ -266,6 +277,7 @@ public class CalculatedObservationsTest /// /// Verifies that when a "Compliancia" (COMPL) observation is mapped, the ventilation mode is calculated and set to "VMI". /// + /// [Test] public async Task CalculateVentilationMode_Should_Set_VMI_When_COMPL_Arrives() { @@ -282,6 +294,7 @@ public class CalculatedObservationsTest /// /// Verifies that when an Air Flow observation is processed and a CCC Ventilation Mode observation exists for the patient, the calculated ventilation mode is set to the value retrieved from the CCC source (e.g., "CNAF") and persisted via an insert call. /// + /// [Test] public async Task CalculateVentilationMode_Should_Set_CCC_Mode_When_AirFlow_Arrives_And_CCC_Has_Mode() { @@ -344,6 +357,7 @@ public class CalculatedObservationsTest /// /// Verifies that when a PI observation is processed and a COMPL observation already exists for the patient, no new calculated observation is inserted. /// + /// [Test] public async Task CalculateVentilationMode_Should_Not_Insert_When_PI_Arrives_And_COMPL_Already_Exists() { @@ -363,6 +377,7 @@ public class CalculatedObservationsTest /// Verifies that no calculated observation is inserted when a PS (Pressure Support) observation is processed /// and a COMPL observation already exists for the patient. /// + /// [Test] public async Task CalculateVentilationMode_Should_Not_Insert_When_PS_Arrives_And_COMPL_Already_Exists() { @@ -386,6 +401,7 @@ public class CalculatedObservationsTest /// /// Verifies that mapping a with Name "ECMO_Location" and Value "VV" returns a non-null result whose value is "VV". /// + /// [Test] public async Task CalculateEcmoLocation_Should_Return_VV_When_Value_Is_VV() { @@ -398,6 +414,7 @@ public class CalculatedObservationsTest /// /// Verifies that the ECMO location calculation returns "VA" when the input observation value is "VA". /// + /// [Test] public async Task CalculateEcmoLocation_Should_Return_VA_When_Value_Is_VA() { @@ -412,6 +429,7 @@ public class CalculatedObservationsTest /// (e.g., "ECCO2r", "VVDL", "VA+V", "VVDL+V", "VV+V", "VVA"). /// /// The ECMO location code assigned to the value under test. + /// [Test] [TestCase("ECCO2r")] [TestCase("VVDL")] @@ -430,6 +448,7 @@ public class CalculatedObservationsTest /// /// Verifies that the ECMO Location mapping does not alter the observation value when the provided value is not present in the recognized ECMO list, leaving the original value unchanged. /// + /// [Test] public async Task CalculateEcmoLocation_Should_Not_Change_Value_When_Not_In_Ecmo_List() { @@ -443,6 +462,7 @@ public class CalculatedObservationsTest /// /// Verifies that the mapping of a through the calculated observations mapper returns the original observation unchanged, ensuring the mapping is a no-op for patient observations. /// + /// [Test] public async Task CalculateEcmoLocation_Should_Return_Original_Observation_When_Not_PatientObservation() { @@ -460,6 +480,7 @@ public class CalculatedObservationsTest /// /// Verifies that an "Over_Analgesia" observation with value "True" is created when the patient has active analgesic treatments (Morfina, Remifentanilo) and the last ANI observation indicates a high value (80), suggesting over-analgesia. /// + /// [Test] public async Task CalculateOverAnalgesia_Should_Create_Observation_When_Conditions_Are_Met() { @@ -534,6 +555,7 @@ public class CalculatedObservationsTest /// /// Verifies that the mapping correctly calculates and inserts the driving pressure (Pmeset minus PEEP) when both source observations are available. /// + /// [Test] public async Task CalculateDrivingPressure_Should_Calculate_Correctly_When_Both_Observations_Are_Present() { @@ -594,6 +616,7 @@ public class CalculatedObservationsTest /// Verifies that the Rox Index is calculated correctly by dividing the SpO2/FiO2 ratio by the respiratory rate (FR) /// when both required observations are available, and that the result is persisted as a new "Rox_Index" observation. /// + /// [Test] public async Task CalculateRoxIndex_Should_Calculate_Correctly_When_Both_Observations_Are_Present() { @@ -654,6 +677,7 @@ public class CalculatedObservationsTest /// Verifies that the ROX index calculation is not performed when the respiratory rate (FR) is zero, /// preventing a division by zero error. /// + /// [Test] public async Task CalculateRoxIndex_Should_Not_Calculate_When_FR_Is_Zero_To_Avoid_Division_By_Zero() { @@ -682,6 +706,7 @@ public class CalculatedObservationsTest /// /// Verifies that the diuresis calculation produces the correct value when prior diuresis observations and a weight observation are available for the patient, resulting in a new "Calculated_Diuresis" observation being inserted. /// + /// [Test] public async Task CalculateDiuresis_Should_Calculate_Correctly_When_Observations_Are_Available() { @@ -723,6 +748,7 @@ public class CalculatedObservationsTest /// Verifies that diuresis is not calculated when no diuresis observations are found for the patient. /// Ensures the mapping logic skips persistence of a calculated diuresis observation when required prior observations are missing. /// + /// [Test] public async Task CalculateDiuresis_Should_Not_Calculate_If_Diuresis_Observations_Are_Missing() { @@ -747,6 +773,7 @@ public class CalculatedObservationsTest /// /// Verifies that the diuresis calculation is not performed when the patient has no weight observation available, ensuring no new observation is inserted. /// + /// [Test] public async Task CalculateDiuresis_Should_Not_Calculate_If_Weight_Is_Invalid() { @@ -778,6 +805,7 @@ public class CalculatedObservationsTest /// /// Verifies that the rehabilitation observation mapping sets the status to Alert when the recent rehabilitation values meet the alert condition. /// + /// [Test] public async Task CalculateRehabilitationAlarm_Should_Set_Alert_When_Condition_Is_Met() { @@ -809,6 +837,7 @@ public class CalculatedObservationsTest /// configured condition is not met, even when the most recent observation values are within an /// expected range and an out-of-range value is present among the evaluated history. /// + /// [Test] public async Task CalculateRehabilitationAlarm_Should_Not_Set_Alert_When_Condition_Is_Not_Met() { @@ -838,6 +867,7 @@ public class CalculatedObservationsTest /// /// Verifies that the Map method does not set an alert for a Rehabilitation observation when its value is greater than 2, returning the original observation unchanged. /// + /// [Test] public async Task CalculateRehabilitationAlarm_Should_Not_Set_Alert_When_Value_Is_Greater_Than_2() { @@ -856,6 +886,7 @@ public class CalculatedObservationsTest /// Verifies that the rehabilitation alarm calculation returns the same observation unchanged when the input observation is not a . /// This ensures that the mapping method does not perform any transformation for non-patient observations. /// + /// [Test] public async Task CalculateRehabilitationAlarm_Should_Return_Same_Observation_If_Not_PatientObservation() { diff --git a/adas-core.Test/Customizations/HUVH/UCIN/CalculatedObservationsTest.cs b/adas-core.Test/Customizations/HUVH/UCIN/CalculatedObservationsTest.cs index 246b2864..7c515a4e 100644 --- a/adas-core.Test/Customizations/HUVH/UCIN/CalculatedObservationsTest.cs +++ b/adas-core.Test/Customizations/HUVH/UCIN/CalculatedObservationsTest.cs @@ -1404,6 +1404,7 @@ public class CalculatedObservationsTest /// the Map method creates and inserts a multivalue observation (Respiratory_Device_Multivalue) /// containing the intervention description extracted from the observation value. /// + /// [Test] public async Task Map_WithInterventionCodeInObservationValue_CallsCalculateInterventionMultiValueObservation() { @@ -1437,6 +1438,7 @@ public class CalculatedObservationsTest /// Verifies that mapping an Intervention_Out observation updates an existing active multi-value observation /// (e.g., Respiratory_Device_Multivalue) for the patient by setting its end time, rather than inserting a new observation. /// + /// [Test] public async Task Map_WithInterventionOut_UpdatesExistingMultiValueObservation() { @@ -1483,6 +1485,10 @@ public class CalculatedObservationsTest /// Verifies that when a new "Intervention_In" observation is mapped via Map and the patient's prior "Respiratory_Device_Multivalue" observation is expired (so there is no existing active last observation), a new named "Respiratory_Device_Multivalue" is inserted containing the new intervention while the existing expired observation is left untouched. /// /// + /// + /// [Test] public async Task Map_WithNewInterventionNoExistingLastIntervention_NewMultiValueObservation() { @@ -1541,6 +1547,8 @@ public class CalculatedObservationsTest /// new record through . /// /// + /// [Test] public async Task Map_WithNewInterventionAddsToExistingMultiValueObservation() { @@ -1602,6 +1610,7 @@ public class CalculatedObservationsTest /// Verifies that mapping a surgery observation inserts a new Surgery_Multivalue observation /// when no existing multi-value observation is found, and does not trigger an update. /// + /// [Test] public async Task Map_WithSurgeryObservation_InsertsNewSurgeryMultiValueObservation() { @@ -1645,6 +1654,7 @@ public class CalculatedObservationsTest /// to be expired and replaced with a new multi-value observation that contains both the previously recorded /// surgery value and the newly mapped surgery value. /// + /// [Test] public async Task Map_WithSurgeryObservation_UpdatesExistingSurgeryMultiValueObservation() { @@ -1700,6 +1710,7 @@ public class CalculatedObservationsTest /// /// Verifies that mapping a Surgery observation updates the existing Surgery_Multivalue observation by expiring the duplicate entry and inserting a new observation with the duplicate value removed. /// + /// [Test] public async Task Map_WithSurgeryObservation_UpdatesExistingSurgeryMultiValueObservation_RemovesDuplicate() { @@ -1754,6 +1765,7 @@ public class CalculatedObservationsTest /// /// Verifies that does not insert or update any observation when a surgery observation is provided with a non-string Value. /// + /// [Test] public async Task Map_WithSurgeryObservation_HandlesNonStringValue() { @@ -1782,6 +1794,7 @@ public class CalculatedObservationsTest /// Verifies that the method, when invoked with a respiratory device multivalue observation /// and no prior observations, inserts a "Complexity" observation with a value of 1. /// + /// [Test] public async Task Map_WithRespiratoryDeviceMultiValueObservation_CallsCalculateComplexity_Return1() { @@ -1887,6 +1900,8 @@ public class CalculatedObservationsTest /// /// The instance passed implicitly to the /// test runner; not directly used as a method argument since this is a parameterless test method. + /// [Test] public async Task Map_WithTwoMedicationMultiValueObservation_CalculatesComplexity_Return4() { @@ -1928,6 +1943,7 @@ public class CalculatedObservationsTest /// /// Verifies that when a patient has a system multivalue observation, medication multivalue observations, and a newborn weight observation, the mapping process calculates a complexity value of 9 and inserts it as a new "Complexity" observation. /// + /// [Test] public async Task Map_WithSystemMedicationAndNewbornWeightMultiValueObservation_CalculatesComplexity_Return9() { @@ -2025,6 +2041,7 @@ public class CalculatedObservationsTest /// /// Verifies that the Map method correctly calculates a complexity value of 13 when the input observation represents surgery, medication, and newborn weight data, by aggregating the per-section contribution of each observation type. /// + /// [Test] public async Task Map_WithSurgeryMedicationMewbornWeightMultiValueObservation_CalculatesComplexity_Returns13() { @@ -2356,6 +2373,7 @@ public class CalculatedObservationsTest /// /// Verifies that mapping a patient treatment with no placer order returns the original treatment unchanged. /// + /// [Test] public async Task Map_TreatmentWithNoPlacerOrder_ReturnsOriginalTreatment() { @@ -2374,6 +2392,7 @@ public class CalculatedObservationsTest /// Verifies that mapping a treatment which has active older treatments sets the order control to XO /// (cancel as a result of a new order being accepted) and does not insert a new observation. /// + /// [Test] public async Task Map_TreatmentWithActiveOlderTreatments_SetsOrderControlToXO() { @@ -2399,6 +2418,7 @@ public class CalculatedObservationsTest /// /// Verifies that when mapping a patient treatment with no active older treatments, the resulting order control is set to and no patient observation is inserted. /// + /// [Test] public async Task Map_TreatmentWithNoActiveOlderTreatments_SetsOrderControlToNW() { @@ -2423,6 +2443,7 @@ public class CalculatedObservationsTest /// /// Verifies that when a patient treatment has an end time set, mapping it sets the order control to and does not insert a new observation. /// + /// [Test] public async Task Map_TreatmentWithEndTimeSet_SetsOrderControlToDC() { diff --git a/adas-core.Test/Models/FakeLogger.cs b/adas-core.Test/Models/FakeLogger.cs index 9259c207..0a5baf58 100644 --- a/adas-core.Test/Models/FakeLogger.cs +++ b/adas-core.Test/Models/FakeLogger.cs @@ -7,6 +7,7 @@ namespace adas_core.Test.Models; /// /// Represents a fake implementation of the ILogger interface, typically used as a test double to simulate logging behavior. /// +/// public class FakeLogger : ILogger { public List Messages { get; } = []; @@ -16,6 +17,7 @@ public class FakeLogger : ILogger /// /// The collection of enrichers intended to add contextual properties to log events. /// The current instance, without the supplied enrichers applied. + /// public ILogger ForContext(IEnumerable enrichers) { return this; @@ -28,6 +30,8 @@ public class FakeLogger : ILogger /// The value associated with the property. Can be null. /// Indicates whether complex objects should be destructured. Defaults to false. /// The current instance. + /// public ILogger ForContext(string propertyName, object? value, bool destructureObjects = false) { return this; @@ -38,6 +42,7 @@ public class FakeLogger : ILogger /// /// The source type used to enrich the logger context. /// The current instance. + /// public ILogger ForContext() { return this; @@ -48,6 +53,7 @@ public class FakeLogger : ILogger /// /// The source type used to enrich the logger context. /// The current instance. + /// public ILogger ForContext(Type source) { return this; @@ -57,6 +63,7 @@ public class FakeLogger : ILogger /// Appends the rendered message of the provided log event to the internal messages collection. /// /// The log event whose rendered message will be added to the collection. + /// public void Write(LogEvent logEvent) { Messages.Add(logEvent.RenderMessage()); @@ -68,6 +75,7 @@ public class FakeLogger : ILogger /// The severity level of the log event. /// The message template containing placeholders for the property values. /// An optional array of objects to format the message template. Can be . + /// public void Write(LogEventLevel level, string messageTemplate, params object?[]? propertyValues) { // Manejar la situación donde propertyValues es nulo, si es necesario @@ -84,6 +92,7 @@ public class FakeLogger : ILogger /// The log event level associated with the entry being written. /// The message template containing a format placeholder for the property value. /// The value to be inserted into the message template. + /// public void Write(LogEventLevel level, string messageTemplate, T propertyValue) { Messages.Add(string.Format(messageTemplate, propertyValue)); @@ -99,6 +108,7 @@ public class FakeLogger : ILogger /// An optional exception whose message is recorded when not null. /// The message template to log, used directly when is null. /// Optional values to substitute into via string.Format. + /// public void Write(LogEventLevel level, Exception? exception, string messageTemplate, params object?[]? propertyValues) { @@ -113,6 +123,7 @@ public class FakeLogger : ILogger /// /// The log event level to evaluate. /// true if logging is enabled for the given level; otherwise, false. + /// public bool IsEnabled(LogEventLevel level) { return true; @@ -125,6 +136,7 @@ public class FakeLogger : ILogger /// An optional exception whose message, when not null, is added to the Messages collection after the formatted message. /// The message template string used to format the log entry. /// The value to be substituted into the message template. + /// public void Write(LogEventLevel level, Exception? exception, string messageTemplate, T propertyValue) { Messages.Add(string.Format(messageTemplate, propertyValue)); diff --git a/adas-core.Test/Models/SignalR/SubscriberGroupedTest.cs b/adas-core.Test/Models/SignalR/SubscriberGroupedTest.cs index d5503044..69636d73 100644 --- a/adas-core.Test/Models/SignalR/SubscriberGroupedTest.cs +++ b/adas-core.Test/Models/SignalR/SubscriberGroupedTest.cs @@ -22,6 +22,7 @@ public class SubscriberGroupedTest /// instances configured for two distinct patients with shift- and /// hour-based regularities and last/last-filled result mappings. /// + /// [SetUp] public void Setup() { @@ -108,6 +109,7 @@ public class SubscriberGroupedTest /// Verifies that the method returns the list of grouped subscribers provided by the mocked service. /// Ensures the service correctly returns the expected collection of items without modification. /// + /// [Test] public void GetGroupeds_ReturnsExpectedResult() { @@ -129,6 +131,7 @@ public class SubscriberGroupedTest /// /// Verifies the behavior of the Compare extension method by asserting that it returns true when the gender and patient identifiers match the active context, and false when they do not, covering both the primary and secondary contexts. /// + /// [Test] public void Compare_ExtensionResult() { @@ -144,6 +147,7 @@ public class SubscriberGroupedTest /// /// Verifies that a new patient observation is considered relevant for its group when it is the first observation recorded within the current hour. /// + /// [Test] public void Observation_is_rrelevant_because_is_the_first_in_hour() { @@ -160,6 +164,7 @@ public class SubscriberGroupedTest /// /// Verifies that a new patient observation is considered relevant for a grouped observation when an observation already exists within the configured hour interval and the grouping uses the Max result. /// + /// [Test] public void Grouped_Observation_Already_Observations_In_Hour_Should_Be_Relevant_By_Max_Result() { @@ -212,6 +217,7 @@ public class SubscriberGroupedTest /// /// Verifies that a new observation is considered not relevant for a grouped observation when the grouping rule is set to "Max", the regularity is "Hour", an observation already exists within the same hour, and the new observation's value does not exceed the existing maximum value. /// + /// [Test] public void Grouped_Observation_Already_Observations_In_Hour_Should_Be_IRelevant_By_Max_Result() { diff --git a/adas-core.Test/Repositories/AdmissionRepositoryTest.cs b/adas-core.Test/Repositories/AdmissionRepositoryTest.cs index 519b5b1c..409117b2 100644 --- a/adas-core.Test/Repositories/AdmissionRepositoryTest.cs +++ b/adas-core.Test/Repositories/AdmissionRepositoryTest.cs @@ -25,6 +25,7 @@ public class AdmissionRepositoryTest /// Initializes the integration test environment by resetting the admissions collection /// and seeding it with valid admission records to be used across the test fixture. /// + /// [OneTimeSetUp] public async Task Init() { @@ -57,6 +58,7 @@ public class AdmissionRepositoryTest /// /// Verifies that successfully persists a valid admission so that it can subsequently be retrieved by its identifier. /// + /// [Test] public async Task InsertOneAsync_Success() { @@ -76,6 +78,7 @@ public class AdmissionRepositoryTest /// /// Verifies that the repository successfully deletes an admission record, ensuring that the deleted admission can no longer be retrieved by its identifier. /// + /// [Test] public async Task Delete_Success() { @@ -94,6 +97,7 @@ public class AdmissionRepositoryTest /// /// Verifies that updates are persisted successfully by inserting an admission, modifying one of its fields, and asserting that the updated value is retrieved. /// + /// [Test] public async Task Update_Success() { @@ -118,6 +122,7 @@ public class AdmissionRepositoryTest /// PointOfCareId of an existing admission to the specified new location identifier /// and that the change is persisted in the repository. /// + /// [Test] public async Task UpdateLocation_Success() { @@ -142,6 +147,7 @@ public class AdmissionRepositoryTest /// Verifies that the repository successfully updates the patient information of an existing admission, /// ensuring the updated admission can be retrieved and reflects the new patient's details. /// + /// [Test] public async Task UpdatePatient_Success() { @@ -170,6 +176,7 @@ public class AdmissionRepositoryTest /// /// Verifies that the repository's FindAll operation successfully retrieves all admissions, returning a non-empty collection of exactly three records. /// + /// [Test] public async Task FindAll_Success() { @@ -189,6 +196,7 @@ public class AdmissionRepositoryTest /// /// Verifies that the repository successfully retrieves an admission by its unique identifier after it has been inserted. /// + /// [Test] public async Task FindById_Success() { @@ -207,6 +215,7 @@ public class AdmissionRepositoryTest /// /// Verifies that the repository's FindById method returns null when queried with a non-existing identifier. /// + /// [Test] public async Task FindById_NotFound() { @@ -224,6 +233,7 @@ public class AdmissionRepositoryTest /// Verifies that successfully retrieves an admission record from the repository using its NHC identifier. /// Confirms that the returned record is not null and that the NHC of the retrieved admission matches the one used in the lookup. /// + /// [Test] public async Task FindByNhc_Success() { @@ -242,6 +252,7 @@ public class AdmissionRepositoryTest /// /// Verifies that .FindByNhc returns null when the provided NHC does not exist in the data source. /// + /// [Test] public async Task FindByNhc_NotFound() { @@ -319,6 +330,7 @@ public class AdmissionRepositoryTest /// /// Verifies that inserting a valid admission through the repository returns the same admission and persists it so it can be retrieved by its identifier. /// + /// [Test] public async Task InsertOneAsyncAndReturn_Success() { @@ -341,6 +353,7 @@ public class AdmissionRepositoryTest /// Tests that the repository's GetAdmissionByUnitIdWithOutPoC method returns only the admissions matching the specified unit identifier /// while excluding admissions that have an associated point-of-care identifier. /// + /// [Test] public async Task GetAdmissionByUnitIdWithOutPoC_Success() { @@ -370,6 +383,7 @@ public class AdmissionRepositoryTest /// /// Verifies that GetAdmissionByUnitIdWithOutPoC returns an empty result set (instead of null) when no admissions match the provided unit identifier. /// + /// [Test] public async Task GetAdmissionByUnitIdWithOutPoC_NoMatch() { @@ -387,6 +401,7 @@ public class AdmissionRepositoryTest /// /// Verifies that the repository's FindByPointOfCareId method successfully retrieves the admission matching the specified point of care identifier, returning a single result and excluding admissions associated with different point of care identifiers. /// + /// [Test] public async Task FindByPointOfCareId_Success() { @@ -410,6 +425,7 @@ public class AdmissionRepositoryTest /// /// Verifies that .FindByPointOfCareId returns a non-null empty collection when no point of care matches the provided identifier. /// + /// [Test] public async Task FindByPointOfCareId_NoMatch() { @@ -424,6 +440,7 @@ public class AdmissionRepositoryTest /// /// Verifies that .FindByDiagnosis successfully returns a non-null result when retrieving admissions matching the specified diagnosis value. /// + /// [Test] public async Task FindByDiagnosis_Success() { @@ -445,6 +462,7 @@ public class AdmissionRepositoryTest /// /// Verifies that .FindByDiagnosis returns an empty collection when no entity matches the provided diagnosis. /// + /// [Test] public async Task FindByDiagnosis_NoMatch() { diff --git a/adas-core.Test/Repositories/AlarmRepositoryTest.cs b/adas-core.Test/Repositories/AlarmRepositoryTest.cs index 296a005f..d20d97ec 100644 --- a/adas-core.Test/Repositories/AlarmRepositoryTest.cs +++ b/adas-core.Test/Repositories/AlarmRepositoryTest.cs @@ -27,6 +27,7 @@ public class AlarmRepositoryTest /// records by resetting the target /// collection and inserting the test data for use across the test fixture. /// + /// [OneTimeSetUp] public async Task Init() { @@ -87,6 +88,8 @@ public class AlarmRepositoryTest /// /// The collection of objects used to filter observations; contains a single non-existent field to ensure no matches are found. /// A task that completes after asserting the repository returns a non-null but empty result. + /// [Test] public async Task AggregatedPatientLastObservationsByField_Not_Found_Returns_Empty_List() { @@ -109,6 +112,7 @@ public class AlarmRepositoryTest /// /// Verifies that AggregatedPatientLastObservationsByField returns exactly one aggregated result when matching last observations are found for the specified patient and field filter. /// + /// [Test] public async Task AggregatedPatientLastObservationsByField_Found_Returns_1() { @@ -131,6 +135,7 @@ public class AlarmRepositoryTest /// /// Verifies that returns a non-null collection containing an entry for each matching field in the filter when observations are found for the given patient. /// + /// [Test] public async Task AggregatedPatientLastObservationsByField_Found_Returns_2() { @@ -159,6 +164,7 @@ public class AlarmRepositoryTest /// /// Verifies that the repository returns an empty list when querying aggregated patient last observations by field with a filter that specifies OnlyExpired as true, and the matching patient observation alarm is expired. /// + /// [Test] public async Task AggregatedPatientLastObservationsByField_AllExpired_Returns_Empty_List() { @@ -198,6 +204,7 @@ public class AlarmRepositoryTest /// /// Verifies that when multiple observations exist for the same field, the aggregation returns only the most recent observation based on the timestamp. /// + /// [Test] public async Task AggregatedPatientLastObservationsByField_MultipleObservations_Returns_Most_Recent() { @@ -254,6 +261,7 @@ public class AlarmRepositoryTest /// /// Verifies that returns all of a patient's last observations when no field filter is provided. /// + /// [Test] public async Task AggregatedPatientLastObservationsByField_FilterObservations_Null_Returns_All() { diff --git a/adas-core.Test/Repositories/AppointmentArchiveRepositoryTest.cs b/adas-core.Test/Repositories/AppointmentArchiveRepositoryTest.cs index 16ae7be4..e04141d5 100644 --- a/adas-core.Test/Repositories/AppointmentArchiveRepositoryTest.cs +++ b/adas-core.Test/Repositories/AppointmentArchiveRepositoryTest.cs @@ -28,6 +28,7 @@ public class AppointmentArchiveRepositoryTest /// /// A that completes when the collection has been recreated and both /// seed appointments have been inserted. + /// [OneTimeSetUp] public async Task Init() { @@ -95,6 +96,7 @@ public class AppointmentArchiveRepositoryTest /// with a timestamp earlier than the specified cutoff date (two hours before the current time), /// while retaining records dated at or after the cutoff for the given patient. /// + /// [Test] public async Task DeleteBeforeDate() { diff --git a/adas-core.Test/Repositories/AppointmentRepositoryTest.cs b/adas-core.Test/Repositories/AppointmentRepositoryTest.cs index c06b13b1..f0b6d3cf 100644 --- a/adas-core.Test/Repositories/AppointmentRepositoryTest.cs +++ b/adas-core.Test/Repositories/AppointmentRepositoryTest.cs @@ -22,6 +22,7 @@ public class AppointmentRepositoryTest /// /// Performs one-time setup for integration tests by resetting the patients_appointments collection and seeding it with two test patient appointments: one with minimal fields and another extended with visit number, appointment reason, and resource groups. /// + /// [OneTimeSetUp] public async Task Init() { @@ -85,6 +86,7 @@ public class AppointmentRepositoryTest /// /// Verifies that .GetByPatient returns a non-null, non-empty list when a valid patient identifier is provided. /// + /// [Test] public async Task GetByPatient_Find_Patient_Return_List() { @@ -97,6 +99,7 @@ public class AppointmentRepositoryTest /// /// Verifies that returns a non-null, empty list when no records are found for the specified patient identifier. /// + /// [Test] public async Task GetByPatient_not_Find_Patient_Return_Empty_List() { @@ -109,6 +112,7 @@ public class AppointmentRepositoryTest /// /// Verifies that the repository returns null when no patient is found matching the specified patient identifier and visit number. /// + /// [Test] public async Task FindByPatientAndVisitNumber_Not_Find_Patient_Return_Null() { @@ -121,6 +125,7 @@ public class AppointmentRepositoryTest /// Verifies that the repository's FindByPatientAndVisitNumber method successfully retrieves /// the corresponding appointment when a valid patient identifier and an existing visit number are supplied. /// + /// [Test] public async Task FindByPatientAndVisitNumber_Find_Patient_Return_Appointment() { @@ -133,6 +138,7 @@ public class AppointmentRepositoryTest /// /// Verifies that the repository returns null when searching for an appointment by patient ID and a reason that does not match any existing appointment. /// + /// [Test] public async Task FindByPatientAndReason_Not_Find_Patient_Return_Null() { @@ -144,6 +150,7 @@ public class AppointmentRepositoryTest /// /// Tests that FindByPatientAndReason returns a non-null appointment containing the expected AppointmentReason for the specified patient. /// + /// [Test] public async Task FindByPatientAndReason_Find_Patient_Return_Appointment() { @@ -156,6 +163,7 @@ public class AppointmentRepositoryTest /// /// Verifies that .FindByLocation returns an empty (non-null) collection when no patient is associated with the specified location. /// + /// [Test] public async Task FindByLocation_Not_Find_Patient_Return_Null() { @@ -170,6 +178,7 @@ public class AppointmentRepositoryTest /// /// Verifies that successfully retrieves the appointment associated with a patient located at the specified . /// + /// [Test] public async Task FindByLocation_Find_Patient_Return_Appointment() { diff --git a/adas-core.Test/Repositories/ConfigObservationRepositoryTest.cs b/adas-core.Test/Repositories/ConfigObservationRepositoryTest.cs index 495f1194..f5c87339 100644 --- a/adas-core.Test/Repositories/ConfigObservationRepositoryTest.cs +++ b/adas-core.Test/Repositories/ConfigObservationRepositoryTest.cs @@ -27,6 +27,7 @@ public class ConfigObservationRepositoryTest /// system references, original name mappings, and observations with min/max alert thresholds /// and forced alert behavior. /// + /// [OneTimeSetUp] public async Task Init() { @@ -123,6 +124,7 @@ public class ConfigObservationRepositoryTest /// /// Verifies that the repository's FindById method returns a non-null configuration result when queried with a valid id. /// + /// [Test] public async Task FindById_Find_Id_Return_Configs() { @@ -134,6 +136,7 @@ public class ConfigObservationRepositoryTest /// /// Verifies that the FindById repository method returns null when invoked with a newly generated, non-existing identifier. /// + /// [Test] public async Task FindById_Not_Find_Id_Return_Empty() { @@ -145,6 +148,7 @@ public class ConfigObservationRepositoryTest /// /// Verifies that an existing can be retrieved by its identifier and subsequently updated, ensuring the updated entity reflects the new values. /// + /// [Test] public async Task Update_Find_Id_Return_Update_Configs() { @@ -170,6 +174,7 @@ public class ConfigObservationRepositoryTest /// /// Verifies that the repository's Update operation creates a new record when the provided identifier does not exist in the data store, instead of failing. /// + /// [Test] public async Task Update_Not_Find_Id_Create_It() { @@ -192,6 +197,7 @@ public class ConfigObservationRepositoryTest /// Verifies that the base delete operation removes a from the repository. /// The test confirms the entity is absent before insertion, present after insertion, and absent again after deletion. /// + /// [Test] public async Task Delete_With_Base_DeleteAsync() { diff --git a/adas-core.Test/Repositories/ConfigPumpsRepositoryTest.cs b/adas-core.Test/Repositories/ConfigPumpsRepositoryTest.cs index 51a5e1b2..836428f2 100644 --- a/adas-core.Test/Repositories/ConfigPumpsRepositoryTest.cs +++ b/adas-core.Test/Repositories/ConfigPumpsRepositoryTest.cs @@ -21,6 +21,7 @@ public class ConfigPumpsRepositoryTest /// /// Initializes the integration test environment by recreating the config_pumps collection and inserting a single configuration pump containing two empty items for use by subsequent tests. /// + /// [OneTimeSetUp] public async Task Init() { @@ -56,6 +57,7 @@ public class ConfigPumpsRepositoryTest /// /// Verifies that returns a non-null result when searching by the identifier "PV1". /// + /// [Test] public async Task FindById_Find_id_Return_List() { @@ -67,6 +69,7 @@ public class ConfigPumpsRepositoryTest /// /// Verifies that the repository's FindById method returns null when no entity is found for the specified identifier. /// + /// [Test] public async Task FindAsync_not_Find_id_Return_Empty_List() { @@ -78,6 +81,7 @@ public class ConfigPumpsRepositoryTest /// /// Tests that inserting a new pump configuration with two items increases the total configuration count to two, that the inserted configuration can be retrieved by its identifier, and that the inserted configuration can be successfully deleted. /// + /// [Test] public async Task Insert_PumpConfig_returns2() { diff --git a/adas-core.Test/Repositories/ConfigUnitsRepositoryTest.cs b/adas-core.Test/Repositories/ConfigUnitsRepositoryTest.cs index 3c020f31..117ce153 100644 --- a/adas-core.Test/Repositories/ConfigUnitsRepositoryTest.cs +++ b/adas-core.Test/Repositories/ConfigUnitsRepositoryTest.cs @@ -19,6 +19,7 @@ public class ConfigUnitsRepositoryTest /// /// Performs one-time setup for integration tests by resetting the config_units collection and seeding it with a single document (Id "PV1") containing two empty entries, then initializes the used by the tests. /// + /// [OneTimeSetUp] public async Task Init() { @@ -54,6 +55,7 @@ public class ConfigUnitsRepositoryTest /// /// Verifies that the repository's FindById method returns a non-null result when searching by the identifier "PV1". /// + /// [Test] public async Task FindById_Find_id_Return_List() { @@ -65,6 +67,7 @@ public class ConfigUnitsRepositoryTest /// /// Verifies that returns null when invoked with an identifier ("PV2") that does not exist in the repository. /// + /// [Test] public async Task FindAsync_not_Find_id_Return_Empty_List() { diff --git a/adas-core.Test/Repositories/DiagnosisArchiveRepositoryTest.cs b/adas-core.Test/Repositories/DiagnosisArchiveRepositoryTest.cs index 3f01010a..bdc3197e 100644 --- a/adas-core.Test/Repositories/DiagnosisArchiveRepositoryTest.cs +++ b/adas-core.Test/Repositories/DiagnosisArchiveRepositoryTest.cs @@ -24,6 +24,7 @@ public class DiagnosisArchiveRepositoryTest /// archive collection in the integration database, and configuring the diagnosis archive /// repository used by the test suite. /// + /// [OneTimeSetUp] public async Task Init() { @@ -85,6 +86,7 @@ public class DiagnosisArchiveRepositoryTest /// for a given patient that were created before the specified cutoff date, while preserving records /// created on or after that date. /// + /// [Test] public async Task DeleteBeforeDate() { diff --git a/adas-core.Test/Repositories/DiagnosisRepositoryTest.cs b/adas-core.Test/Repositories/DiagnosisRepositoryTest.cs index f08fc640..138c2073 100644 --- a/adas-core.Test/Repositories/DiagnosisRepositoryTest.cs +++ b/adas-core.Test/Repositories/DiagnosisRepositoryTest.cs @@ -22,6 +22,7 @@ public class DiagnosisRepositoryTest /// /// One-time test setup that prepares the integration database for patient diagnosis tests by dropping and recreating the diagnoses collection, inserting three sample records (one with predefined test identifiers and two with auto-generated identifiers), and initializing the under test. /// + /// [OneTimeSetUp] public async Task Init() { @@ -81,6 +82,7 @@ public class DiagnosisRepositoryTest /// /// Verifies that the repository returns a non-null and non-empty collection when retrieving records for an existing patient. /// + /// [Test] public async Task GetByPatient_Find_Patient_Return_List() { @@ -93,6 +95,7 @@ public class DiagnosisRepositoryTest /// /// Verifies that returns an empty list when no records are found for the specified patient identifier. /// + /// [Test] public async Task GetByPatient_not_Find_Patient_Return_Empty_List() { @@ -106,6 +109,7 @@ public class DiagnosisRepositoryTest /// Verifies that successfully retrieves a diagnosis for an existing patient using the provided patient identifier, diagnosis code, and diagnosis system. /// /// A task that represents the asynchronous test execution. + /// [Test] public async Task FindByPatientIdAndCode_Find_Patient_Return_Diagnois() { @@ -118,6 +122,7 @@ public class DiagnosisRepositoryTest /// Verifies that returns null when no patient is found /// for the provided patient identifier, code, and diagnosis system. /// + /// [Test] public async Task FindByPatientIdAndCode_not_Find_Patient_Return_null() { @@ -129,6 +134,7 @@ public class DiagnosisRepositoryTest /// /// Verifies that returns a non-null, non-empty list when looking up an existing patient by their identifier. /// + /// [Test] public async Task FindByPatientIdAsync_Find_Patient_Return_List() { @@ -141,6 +147,7 @@ public class DiagnosisRepositoryTest /// /// Verifies that FindByPatientIdAsync returns a non-null empty list when no patient matches the provided patient ID. /// + /// [Test] public async Task FindByPatientIdAsync_not_Find_Patient_Return_Empty_List() { @@ -153,6 +160,7 @@ public class DiagnosisRepositoryTest /// /// Verifies that DeleteAsync removes a patient diagnosis record by its identifier: after insertion, the record is retrievable by patient id, and once deleted, the search by patient id returns no results. /// + /// [Test] public async Task DeleteAsync_Find_id() { @@ -181,6 +189,7 @@ public class DiagnosisRepositoryTest /// by inserting a diagnosis, confirming it can be found, deleting it by patient id, and then /// asserting that no diagnoses remain for that patient. /// + /// [Test] public async Task DeleteByPatientId_Find_patientId() { @@ -208,6 +217,7 @@ public class DiagnosisRepositoryTest /// Tests that UpdateManyObjectId correctly updates the PatientId field across all matching documents by replacing the original ObjectId with a new one. /// Verifies that after the update, the document can be retrieved using the new patient identifier. /// + /// [Test] public async Task UpdateManyObjectId_With_base_UpdateManyObjectIdAsync() { diff --git a/adas-core.Test/Repositories/DischargeRepositoryTest.cs b/adas-core.Test/Repositories/DischargeRepositoryTest.cs index bc1b5406..3b436929 100644 --- a/adas-core.Test/Repositories/DischargeRepositoryTest.cs +++ b/adas-core.Test/Repositories/DischargeRepositoryTest.cs @@ -23,6 +23,7 @@ public class DischargeRepositoryTest /// /// Performs one-time test setup for discharge integration tests by initializing API settings, dropping and recreating the "discharge" collection in the integration database, and instantiating the . /// + /// [OneTimeSetUp] public async Task Init() { @@ -43,6 +44,7 @@ public class DischargeRepositoryTest /// Verifies that InsertOneAsync successfully persists a discharge document and that the /// inserted record can be retrieved by its identifier. /// + /// [Test] public async Task InsertOneAsync_ShouldInsertDischarge() { @@ -59,6 +61,7 @@ public class DischargeRepositoryTest /// /// Verifies that the Delete repository operation removes a discharge so that subsequent lookups by its identifier return no result. /// + /// [Test] public async Task Delete_ShouldDeleteDischarge() { @@ -76,6 +79,7 @@ public class DischargeRepositoryTest /// /// Verifies that an existing discharge record is successfully updated in the repository with new field values. /// + /// [Test] public async Task Update_DischargeSuccessfullyUpdated() { @@ -142,6 +146,7 @@ public class DischargeRepositoryTest /// /// Verifies that the repository's FindAll method returns all discharge records previously inserted via InsertManyAsync, returning a non-null, non-empty collection whose count matches the number of inserted records. /// + /// [Test] public async Task FindAll_ReturnsAllDischarges() { @@ -167,6 +172,7 @@ public class DischargeRepositoryTest /// /// Verifies that the repository's FindById method returns the matching Discharge document when queried with an existing identifier. /// + /// [Test] public async Task FindById_ExistingId_ReturnsDischarge() { @@ -183,6 +189,7 @@ public class DischargeRepositoryTest /// /// Verifies that the discharge repository's FindById method returns null when queried with a non-existent . /// + /// [Test] public async Task FindById_NonExistentId_ReturnsNull() { @@ -214,6 +221,7 @@ public class DischargeRepositoryTest /// /// Verifies that the discharge repository's FindByDestination method returns the matching discharge records when queried with an existing destination. /// + /// [Test] public async Task FindByDestination_ExistingDestination_ReturnsDischarges() { @@ -236,6 +244,7 @@ public class DischargeRepositoryTest /// /// Verifies that FindByDestination returns an empty collection when the provided destination does not match any stored discharge records. /// + /// [Test] public async Task FindByDestination_NonExistentDestination_ReturnsEmptyList() { @@ -253,6 +262,7 @@ public class DischargeRepositoryTest /// Verifies that returns the matching discharge /// when a discharge is associated with the supplied point-of-care identifier. /// + /// [Test] public async Task FindByPoCId_ExistingPoCId_ReturnsDischarges() { @@ -275,6 +285,7 @@ public class DischargeRepositoryTest /// /// Verifies that the discharge repository's FindByPoCId method returns an empty list when queried with a non-existent PoCId. /// + /// [Test] public async Task FindByPoCId_NonExistentPoCId_ReturnsEmptyList() { @@ -291,6 +302,7 @@ public class DischargeRepositoryTest /// /// Verifies that returns the matching discharge record when a previously inserted discharge exists for the specified service name. /// + /// [Test] public async Task FindByService_ExistingService_ReturnsDischarges() { @@ -313,6 +325,7 @@ public class DischargeRepositoryTest /// /// Verifies that FindByService returns an empty list when queried with a service name that does not exist in the repository. /// + /// [Test] public async Task FindByService_NonExistentService_ReturnsEmptyList() { @@ -348,6 +361,7 @@ public class DischargeRepositoryTest /// Verifies that GetDischargeByLocation returns null when queried with a location /// that does not exist in the repository. /// + /// [Test] public async Task GetDischargeByLocation_NonExistentLocation_ReturnsNull() { @@ -364,6 +378,7 @@ public class DischargeRepositoryTest /// /// Verifies that GetDischargeByPointOfCareId returns the matching Discharge when queried with a point of care ID that already exists in the repository. /// + /// [Test] public async Task GetDischargeByPointOfCareId_ExistingId_ReturnsDischarge() { @@ -385,6 +400,7 @@ public class DischargeRepositoryTest /// /// Verifies that GetDischargeByPointOfCareId returns null when called with a non-existent point of care ID. /// + /// [Test] public async Task GetDischargeByPointOfCareId_NonExistentId_ReturnsNull() { @@ -402,6 +418,7 @@ public class DischargeRepositoryTest /// Verifies that GetByPatientId returns the matching record /// when a discharge exists for the specified patient identifier. /// + /// [Test] public async Task GetByPatientId_ExistingPatientId_ReturnsDischarge() { @@ -424,6 +441,7 @@ public class DischargeRepositoryTest /// Verifies that the repository method returns null /// when called with a patient ID that does not exist in the data store. /// + /// [Test] public async Task GetByPatientId_NonExistentPatientId_ReturnsNull() { diff --git a/adas-core.Test/Repositories/DisplayConfigTest.cs b/adas-core.Test/Repositories/DisplayConfigTest.cs index bf28c99e..f36c965d 100644 --- a/adas-core.Test/Repositories/DisplayConfigTest.cs +++ b/adas-core.Test/Repositories/DisplayConfigTest.cs @@ -23,6 +23,7 @@ public class DisplayConfigTest /// /// Performs one-time setup for integration tests by initializing the display configuration, card configuration, and detail configuration repositories with test data, including a valid display configuration, a card configuration, and a nurse card details configuration. /// + /// [OneTimeSetUp] public async Task SetUp() { @@ -59,6 +60,7 @@ public class DisplayConfigTest /// /// One-time teardown method that cleans up the integration test database by dropping the display configuration collections created during testing. /// + /// [OneTimeTearDown] public async Task Cleanup() { @@ -79,6 +81,7 @@ public class DisplayConfigTest /// /// Verifies that retrieving a display configuration by its identifier returns a non-null result with the associated card and detail configurations populated. /// + /// [Test] public async Task GetByIdShouldReturnAllConfigsAssociated() { diff --git a/adas-core.Test/Repositories/DisplayRepisitoryTest.cs b/adas-core.Test/Repositories/DisplayRepisitoryTest.cs index f923d812..ad0ab9a5 100644 --- a/adas-core.Test/Repositories/DisplayRepisitoryTest.cs +++ b/adas-core.Test/Repositories/DisplayRepisitoryTest.cs @@ -14,6 +14,7 @@ public class DisplayRepisitoryTest /// /// One-time setup method that resets the "displays" collection in the integration database by dropping and recreating it, ensuring a clean state before integration tests run. /// + /// [OneTimeSetUp] public async Task OneTimeSetUp() { diff --git a/adas-core.Test/Repositories/HistoricalConfigChangesRepositoryTest.cs b/adas-core.Test/Repositories/HistoricalConfigChangesRepositoryTest.cs index 12e2a883..ed9740a3 100644 --- a/adas-core.Test/Repositories/HistoricalConfigChangesRepositoryTest.cs +++ b/adas-core.Test/Repositories/HistoricalConfigChangesRepositoryTest.cs @@ -25,6 +25,7 @@ public class HistoricalConfigChangesRepositoryTest /// /// Performs one-time setup for the test fixture by initializing configuration options, a mocked logger, and the instance used across the tests. /// + /// [OneTimeSetUp] public void Init() { @@ -39,6 +40,7 @@ public class HistoricalConfigChangesRepositoryTest /// /// Resets the integration test environment by dropping and recreating the historicalConfigChanges collection and then reinitializing the test data. Used as a teardown step to ensure a clean state between tests. /// + /// [TearDown] public async Task Cleanup() { @@ -63,6 +65,8 @@ public class HistoricalConfigChangesRepositoryTest /// Seeds the repository with a series of historical configuration change records for an observation configuration /// (Hemoglobina), illustrating successive code updates from "54321" to "xxxxx" to "11111" to "99999" under the "adas" user. /// + /// private async Task InitializeData() { var id = ObjectId.GenerateNewId(); @@ -143,6 +147,7 @@ public class HistoricalConfigChangesRepositoryTest /// /// Verifies that the repository's FindAll method returns a non-null collection containing exactly three historical configuration change records after a cleanup operation. /// + /// [Test] public async Task Get_HistoricalConfigChanges_returns_count_3() { @@ -158,6 +163,7 @@ public class HistoricalConfigChangesRepositoryTest /// /// Verifies that the repository Update operation for a document returns a non-null result whose properties correspond to the updated record, after cleaning up existing data and retrieving an existing entry to be modified. /// + /// [Test] public async Task HistoricalConfigChanges_returns_diferent_document() { @@ -208,6 +214,7 @@ public class HistoricalConfigChangesRepositoryTest /// /// Verifies that .FindLastHistoricalConfigChangesByUser returns exactly three historical configuration changes for the user "adas" after cleanup. /// + /// [Test] public async Task FindLastHistoricalConfigChangesByUser_returns_3() { @@ -221,6 +228,7 @@ public class HistoricalConfigChangesRepositoryTest /// /// Verifies that deleting a historical config change entry reduces the total count of records from three to two in the repository. /// + /// [Test] public async Task Delete_HistoricalConfigChanges_returns_count_2() { diff --git a/adas-core.Test/Repositories/IntegrationDb.cs b/adas-core.Test/Repositories/IntegrationDb.cs index 1b89ab8a..c5bfd7a3 100644 --- a/adas-core.Test/Repositories/IntegrationDb.cs +++ b/adas-core.Test/Repositories/IntegrationDb.cs @@ -27,6 +27,7 @@ public class IntegrationDb /// /// Initializes the MongoDB integration test environment by starting a MongoDB runner, configuring MongoDB conventions and BSON class mappings, establishing a client from the runner's connection string, and obtaining the target database used by integration tests. /// + /// [OneTimeSetUp] public void InitIntegrationTests() { @@ -42,6 +43,7 @@ public class IntegrationDb /// If the server does not become available within the timeout, the runner is disposed and a is thrown. /// /// Thrown when the MongoDB server does not respond within the configured timeout period. + /// private static async Task StartMongoDbRunner() { Runner = MongoDbRunner.Start(); @@ -71,6 +73,7 @@ public class IntegrationDb /// Performs one-time teardown for integration tests by disposing the and resources. /// Safely handles cases where either resource has not been initialized by using null-conditional disposal. /// + /// [OneTimeTearDown] public void TeardownIntegrationTests() { diff --git a/adas-core.Test/Repositories/MasterListRepositoryTest.cs b/adas-core.Test/Repositories/MasterListRepositoryTest.cs index 9e3eeccd..a27df99c 100644 --- a/adas-core.Test/Repositories/MasterListRepositoryTest.cs +++ b/adas-core.Test/Repositories/MasterListRepositoryTest.cs @@ -17,6 +17,7 @@ public class MasterListRepositoryTest /// /// Performs one-time initialization for the test fixture by configuring with the expected master list property names, resetting the "MasterLists" collection in the integration database, and creating a instance for use across tests. /// + /// [OneTimeSetUp] public async Task Init() { @@ -70,6 +71,7 @@ public class MasterListRepositoryTest /// /// Performs one-time cleanup after integration test execution by dropping the MasterLists collection from the integration test database to ensure a clean state between test runs. /// + /// [OneTimeTearDown] public async Task Cleanup() { @@ -85,6 +87,7 @@ public class MasterListRepositoryTest /// Verifies that entities are correctly persisted in the repository via InsertOneAsync, /// by inserting an entity and confirming it can be retrieved by its identifier using the default locale. /// + /// [Test] public async Task InsertOneAsync_ShouldInsertEntity() { @@ -104,6 +107,7 @@ public class MasterListRepositoryTest /// /// Verifies that the repository's Delete operation successfully removes a MasterList entity, ensuring that a subsequent lookup by id returns no result. /// + /// [Test] public async Task Delete_ShouldDeleteEntity() { @@ -122,6 +126,7 @@ public class MasterListRepositoryTest /// /// Verifies that the repository's Update method successfully persists changes to an existing entity, allowing the modified record to be retrieved by its identifier with the updated values. /// + /// [Test] public async Task Update_ShouldUpdateEntity() { @@ -143,6 +148,7 @@ public class MasterListRepositoryTest /// Verifies that the repository's FindById method returns the matching entity when a master list with the specified identifier exists in the data store. /// /// A task representing the asynchronous test execution. + /// [Test] public async Task FindById_ShouldReturnEntity_WhenFound() { @@ -269,6 +275,7 @@ public class MasterListRepositoryTest /// /// Verifies that the repository's FindByName method returns the matching entity when an entity with the specified name exists in the data store. /// + /// [Test] public async Task FindByName_ShouldReturnEntity_WhenFound() { @@ -287,6 +294,7 @@ public class MasterListRepositoryTest /// /// Verifies that the repository's GetAll method returns all entities, ensuring the result contains at least two items. /// + /// [Test] public async Task GetAll_ShouldReturnAllEntities() { diff --git a/adas-core.Test/Repositories/MedicineRepositoryTest.cs b/adas-core.Test/Repositories/MedicineRepositoryTest.cs index 72984756..3b55f70f 100644 --- a/adas-core.Test/Repositories/MedicineRepositoryTest.cs +++ b/adas-core.Test/Repositories/MedicineRepositoryTest.cs @@ -22,6 +22,7 @@ public class MedicineRepositoryTest /// /// Performs one-time initialization for integration tests by seeding the medicines collection with a test record and verifying it can be retrieved by code or note. /// + /// [OneTimeSetUp] public async Task Init() { @@ -62,6 +63,7 @@ public class MedicineRepositoryTest /// /// Verifies that GetMedicineByCodeOrNote returns a non-null, empty list when invoked with an array containing an empty string. /// + /// [Test] public async Task Get_Medicines_Of_Treatments_Return_Empty_List() { @@ -103,6 +105,7 @@ public class MedicineRepositoryTest /// /// Tests that the repository returns a non-null medicine when a valid medicine code is found. /// + /// [Test] public async Task GetMedicine_Find_Code_Return_Medicine() { @@ -114,6 +117,7 @@ public class MedicineRepositoryTest /// /// Verifies that the repository's GetMedicine method returns null when the provided medicine code does not match any existing record. /// + /// [Test] public async Task GetMedicine_Not_Find_Code_Return_Empty() { @@ -126,6 +130,7 @@ public class MedicineRepositoryTest /// Verifies that the repository returns a non-null medicine when a medicine is found /// by the supplied note identifier ("note1"), confirming successful lookup by note. /// + /// [Test] public async Task GetMedicine_Find_Note_Return_Medicine() { @@ -137,6 +142,7 @@ public class MedicineRepositoryTest /// /// Verifies that UpdateMedicine returns the updated medicine and that the changes are persisted and retrievable via GetMedicineById, including the updated notes collection. /// + /// [Test] public async Task UpdateMedicine_Return_Medicine() { diff --git a/adas-core.Test/Repositories/MongodbMigrationTest.cs b/adas-core.Test/Repositories/MongodbMigrationTest.cs index e8a6de70..09f2f839 100644 --- a/adas-core.Test/Repositories/MongodbMigrationTest.cs +++ b/adas-core.Test/Repositories/MongodbMigrationTest.cs @@ -37,6 +37,7 @@ public class MongodbMigrationTest /// /// Performs one-time initialization for the test fixture by dropping and recreating the "patients" collection, instantiating the PatientRepository, and seeding it with three test Patient records (one of which has a discharge time set to the current time) to verify they are persisted. /// + /// [OneTimeSetUp] public async Task Init() { @@ -102,6 +103,7 @@ public class MongodbMigrationTest /// /// Performs one-time cleanup after integration tests by dropping the patients and __migrations collections from the integration database, ensuring a clean state for subsequent test runs. /// + /// [OneTimeTearDown] public void Teardown() { @@ -112,6 +114,7 @@ public class MongodbMigrationTest /// /// Verifies that the database is detected as outdated by creating a runner and asserting that IsDatabaseUpToDate returns false when using the primary read preference. /// + /// [Test] [Order(1)] public void IsDatabaseOutdated_ShouldReturnTrue() @@ -127,6 +130,7 @@ public class MongodbMigrationTest /// /// Verifies that after running the migration update to the latest version, the migration with ID 10 (version 0.1.0) is present among the applied migrations. /// + /// [Test] [Order(2)] public void AfterUpdateToLatest_MigrationShouldBeApplied() @@ -159,6 +163,7 @@ public class MongodbMigrationTest /// Creates and configures a for executing database migrations, using a locator that scans the assembly containing the patient data update migration. /// /// A configured bound to the integration database and the migrations collection. + /// private MigrationRunner CreateRunner() { var locator = new MigrationLocator(); @@ -174,6 +179,7 @@ public class MongodbMigrationTest /// Retrieves the identifiers of all applied migrations from the "__migrations" collection in the integration database. /// /// A list of migration identifiers extracted from the "_id" field of each migration document. + /// private List GetAppliedMigrationIds() { var collection = IntegrationDb.Database.GetCollection("__migrations"); diff --git a/adas-core.Test/Repositories/ObservationArchiveRepositoryTest.cs b/adas-core.Test/Repositories/ObservationArchiveRepositoryTest.cs index ca311d76..309955d1 100644 --- a/adas-core.Test/Repositories/ObservationArchiveRepositoryTest.cs +++ b/adas-core.Test/Repositories/ObservationArchiveRepositoryTest.cs @@ -77,6 +77,7 @@ public class ObservationArchiveRepositoryTest /// Verifies that the repository's DeleteBeforeDate method removes all patient observations /// dated before the specified cutoff, leaving only a single observation remaining in the collection. /// + /// [Test] public async Task DeleteBeforeDate() { diff --git a/adas-core.Test/Repositories/ObservationRepositoryTest.cs b/adas-core.Test/Repositories/ObservationRepositoryTest.cs index cc0732fe..b5e6023c 100644 --- a/adas-core.Test/Repositories/ObservationRepositoryTest.cs +++ b/adas-core.Test/Repositories/ObservationRepositoryTest.cs @@ -33,6 +33,7 @@ public class ObservationRepositoryTest /// and seeds it with six records covering different codes, coding systems, and timestamps /// (including observations without a SystemId). /// + /// [OneTimeSetUp] public async Task Init() { @@ -141,6 +142,7 @@ public class ObservationRepositoryTest /// /// Verifies that the repository's last observations lookup returns a non-null list containing the expected number of observations for the specified patient, system ("SNM"), and observation code ("code1"). /// + /// [Test] public async Task FindLastObservations_Return_List() { @@ -155,6 +157,7 @@ public class ObservationRepositoryTest /// Verifies that FindLastObservationsByCodingSystem returns a non-null list of the expected count /// of the most recent observations for the specified patient filtered by the "SNM" coding system. /// + /// [Test] public async Task FindLastObservationsByCodingSystem_Return_List() { @@ -168,6 +171,7 @@ public class ObservationRepositoryTest /// /// Verifies that the AggregatedPatientLastObservations method returns a non-null list containing the expected number of aggregated last observations for the specified patient. /// + /// [Test] public async Task AggregatedPatientLastObservations_Null_Filter_Return_List() { @@ -180,6 +184,7 @@ public class ObservationRepositoryTest /// /// Verifies that the AggregatedPatientLastObservations repository method returns a non-null filtered list with the expected number of entries when a name filter is provided. /// + /// [Test] public async Task AggregatedPatientLastObservations_Filter_Return_List() { @@ -194,6 +199,7 @@ public class ObservationRepositoryTest /// /// Verifies that AggregatedPatientLastObservations returns an empty list when the provided filter does not match any observations. /// + /// [Test] public async Task AggregatedPatientLastObservations_Filter_Not_Find_Return_Empty_List() { @@ -208,6 +214,7 @@ public class ObservationRepositoryTest /// /// Verifies that AggregatedPatientLastObservationsByLastDate returns a non-null list of aggregated patient last observations for a given patient and date, even when no filter is applied. /// + /// [Test] public async Task AggregatedPatientLastObservationsByLastDate_Null_Filter_Return_List() { @@ -220,6 +227,7 @@ public class ObservationRepositoryTest /// /// Verifies that _repository.AggregatedPatientLastObservationsByLastDate returns a non-null list containing the expected number of aggregated patient last observations when a filter is provided. /// + /// [Test] public async Task AggregatedPatientLastObservationsByLastDate_Filter_Return_List() { @@ -234,6 +242,7 @@ public class ObservationRepositoryTest /// /// Verifies that AggregatedPatientLastObservationsByLastDate returns an empty list when the provided filter does not match any patient observations. /// + /// [Test] public async Task AggregatedPatientLastObservationsByLastDate_Filter_Not_Find_Return_Empty_List() { @@ -249,6 +258,7 @@ public class ObservationRepositoryTest /// Verifies that AggregatedPatientLastObservationsByField returns a non-null list of aggregated patient last observations /// when the filter is null, confirming the expected fallback behavior and default result set. /// + /// [Test] public async Task AggregatedPatientLastObservationsByField_Null_Filter_Return_List() { @@ -261,6 +271,7 @@ public class ObservationRepositoryTest /// /// Tests that filtering aggregated patient last observations by a specific field returns a non-null list containing the expected number of results. /// + /// [Test] public async Task AggregatedPatientLastObservationsByField_Filter_Return_List() { @@ -276,6 +287,7 @@ public class ObservationRepositoryTest /// /// Verifies that _repository.AggregatedPatientLastObservationsByField returns an empty list when the filter field has OnlyExpired set to true, indicating no expired observations are available for the patient. /// + /// [Test] public async Task AggregatedPatientLastObservationsByField_Filter_OnlyExpired_Return_Empty_List() { @@ -294,6 +306,7 @@ public class ObservationRepositoryTest /// The test inserts a single observation, confirms it is persisted, deletes it by /// patient id, and asserts that no records remain for that patient. /// + /// [Test] public async Task DeleteByPatientId() { @@ -327,6 +340,7 @@ public class ObservationRepositoryTest /// /// Verifies that FindByPatientIdAsync returns a non-null cursor containing the expected number of records for the specified patient identifier. /// + /// [Test] public async Task FindByPatientIdAsync_Return_Cursor() { @@ -339,6 +353,7 @@ public class ObservationRepositoryTest /// /// Verifies that correctly removes a patient observation from the repository by inserting a record, confirming its presence, deleting it, and ensuring it is no longer retrievable. /// + /// [Test] public async Task DeleteAsync() { @@ -372,6 +387,7 @@ public class ObservationRepositoryTest /// /// Verifies that the repository's DeleteOlderDaysAsync method removes records older than the specified day threshold while keeping more recent ones, and that DeleteByPatientId subsequently clears the remaining records associated with the same patient. /// + /// [Test] public async Task DeleteOlderDaysAsync() { @@ -425,6 +441,7 @@ public class ObservationRepositoryTest /// /// Verifies that DeleteOlderSecondsAsync removes PatientObservation entries whose timestamp is older than the specified number of seconds, keeping more recent entries with the same name intact, and that DeleteByPatientId clears all remaining observations for the given patient. /// + /// [Test] public async Task DeleteOlderSecondsAsync() { @@ -479,6 +496,7 @@ public class ObservationRepositoryTest /// /// Verifies that the repository's DeleteOlderNumberAsync method retains only the most recent specified count of records sharing the same name, deleting the older entries, and that DeleteByPatientId subsequently removes all remaining records for the patient. /// + /// [Test] public async Task DeleteOlderNumberAsync() { @@ -546,6 +564,7 @@ public class ObservationRepositoryTest /// /// Verifies that _repository.ExistBySystemId returns a valid result when checking existence by the given patient and system identifiers. /// + /// [Test] public async Task ExistBySystemId_Return_List() { @@ -558,6 +577,7 @@ public class ObservationRepositoryTest /// /// Verifies that FindLastObservationBeforeDate returns a non-null observation whose timestamp is earlier than the specified date, confirming a matching record is retrieved successfully. /// + /// [Test] public async Task FindLastObservationBeforeDate_Return_Obs() { @@ -571,6 +591,7 @@ public class ObservationRepositoryTest /// Verifies that the repository's FindAnyWithSameDate method returns a non-null list containing exactly one observation /// when searching for observations associated with the specified patient, name, and date. /// + /// [Test] public async Task FindAnyWithSameDate_Return_List_Obs() { @@ -583,6 +604,7 @@ public class ObservationRepositoryTest /// /// Tests that the repository returns a non-null list of two observations for a patient, found before the specified date (yesterday). /// + /// [Test] public async Task FindAnyBeforeDate_Return_List_Obs() { @@ -595,6 +617,7 @@ public class ObservationRepositoryTest /// /// Verifies that AggregatedPatientActiveIntravenousLinesObservations returns a non-null, empty list of observations for the specified patient when no filter criteria are provided. /// + /// [Test] public async Task AggregatedPatientActiveIntravenousLinesObservations_Null_Filter_Return_List_Obs() { @@ -607,6 +630,7 @@ public class ObservationRepositoryTest /// /// Verifies that _repository.AggregatedPatientActiveIntravenousLinesObservations returns an empty list of observations when the filter value is not the Patient Intravenous Lines value. /// + /// [Test] public async Task AggregatedPatientActiveIntravenousLinesObservations_Filter_Not_PatientIntravenousLineasValue_Return_List_Obs() @@ -622,6 +646,7 @@ public class ObservationRepositoryTest /// when filtering by patient id and the observation value is a PatientIntravenousLinesValue instance. /// The test inserts a single matching observation, asserts that exactly one record is returned, and confirms successful cleanup by deletion. /// + /// [Test] public async Task AggregatedPatientActiveIntravenousLinesObservations_Filter_PatientIntravenousLineasValue_Return_List_Obs() @@ -663,6 +688,7 @@ public class ObservationRepositoryTest /// /// Verifies that the repository method FindAllLastPatientObservationTime returns a non-null collection containing at least one last patient observation time record. /// + /// [Test] public async Task FindAllLastPatientObservationTime_Return_List() { @@ -675,6 +701,7 @@ public class ObservationRepositoryTest /// /// Verifies that the repository's FindById method returns null when the requested entity does not exist in the data store. /// + /// [Test] public async Task FindById_Return_null() { @@ -686,6 +713,7 @@ public class ObservationRepositoryTest /// /// Verifies that the repository's FindById method returns a non-null entity whose identifier matches the requested Id. /// + /// [Test] public async Task FindById_Return_Obs() { @@ -699,6 +727,7 @@ public class ObservationRepositoryTest /// Verifies that the repository's UpdateExpiredObservations method correctly marks all non-expired observations belonging to a patient as expired. /// The test inserts five fresh observations, asserts that none are expired, invokes the update, and then asserts that all five have been flagged as expired before cleaning up the inserted data. /// + /// [Test] public async Task UpdateExpiredObservations() { @@ -753,6 +782,7 @@ public class ObservationRepositoryTest /// /// Verifies that the repository's FindAll method returns a non-null and non-empty collection of patient observations. /// + /// [Test] public async Task FindAll_Return_List_Obs() { @@ -766,6 +796,7 @@ public class ObservationRepositoryTest /// /// Verifies that the repository's FindNotExpired method returns a non-empty collection of patient observations for the provided observation names. /// + /// [Test] public async Task FindNotExpired_Return_List_Obs() { @@ -781,6 +812,7 @@ public class ObservationRepositoryTest /// configuration observations as expired so that a subsequent _repository.FindNotExpired /// call returns only the remaining non-expired observations, deduplicating the requested names. /// + /// [Test] public async Task ExpireExpiredObservations() { @@ -824,6 +856,7 @@ public class ObservationRepositoryTest /// /// Verifies that the repository's FindByName method returns a non-null, non-empty list of objects when searching by the name "name1". /// + /// [Test] public async Task FindByName_Return_List_Obs() { @@ -837,6 +870,7 @@ public class ObservationRepositoryTest /// /// Verifies that AggregatedPatientGroupedObservations returns a non-null, empty list when called with a default instance for the given patient. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Null_groupedField_Return_List_Emty() { @@ -855,6 +889,7 @@ public class ObservationRepositoryTest /// are aggregated for a patient using the First result selection strategy with a maximum of 8 groups. /// Verifies successful aggregation and ensures all inserted test observations are removed by patient id. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Hour_Firs_Return_List_9() { @@ -908,6 +943,7 @@ public class ObservationRepositoryTest /// Inserts 30 observations, asserts the aggregated result count is 8, and confirms cleanup by patient id removes all inserted records. /// /// A task that completes when the test finishes, including assertions and cleanup. + /// [Test] public async Task AggregatedPatientGroupedObservations_Hour_Firs_Since_Last_Return_List_8() { @@ -959,6 +995,7 @@ public class ObservationRepositoryTest /// /// Verifies that inserting five patient observations with hourly regularity and aggregating them using the first result returns a list of four or five grouped entries, and ensures the inserted observations are removed by patient id. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Firs_Return_List_5() { @@ -1010,6 +1047,7 @@ public class ObservationRepositoryTest /// /// Verifies that AggregatedPatientGroupedObservations returns a non-empty list when patient observations are grouped by a field with second-level regularity and the aggregation selects only the first result per group, and that the inserted observations are fully removed by the cleanup step. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_second_Firs_Return_List() { @@ -1060,6 +1098,7 @@ public class ObservationRepositoryTest /// /// Verifies that the aggregated grouped observations query, configured with minute regularity, the First result and a maximum of 8, returns a list of exactly 8 entries even when 30 underlying observations exist for the patient. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Minute_Firs_Return_List_8() { @@ -1113,6 +1152,7 @@ public class ObservationRepositoryTest /// Also confirms that observations inserted for the test patient are removed by the cleanup step. /// /// A task that completes when the aggregation result is validated and the test data is cleaned up. + /// [Test] public async Task AggregatedPatientGroupedObservations_Day_Firs_Return_List_8() { @@ -1163,6 +1203,7 @@ public class ObservationRepositoryTest /// /// Verifies that AggregatedPatientGroupedObservations returns a list of 9 entries containing the "first" marker when grouping 30 patient observations by a shift-regularity field with a max of 8 and Result.First selected, and that all inserted observations are removed by the cleanup call. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Shift_Firs_Return_List_9() { @@ -1216,6 +1257,8 @@ public class ObservationRepositoryTest /// Inserts two observations for each of the last 5 hours (at minutes 15 and 30), runs the aggregation for a new patient, and verifies the result count is 5 and that every entry contains the "last" marker. /// Cleanup is performed by deleting the inserted observations by patient id and asserting that the collection is empty afterwards. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_last_Return_List_5() { @@ -1293,6 +1336,7 @@ public class ObservationRepositoryTest /// into hourly groups and returns the sum of values for each hour when five hours of data are inserted. /// /// A task that represents the asynchronous test execution. + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_sum_Return_List_5() { @@ -1377,6 +1421,7 @@ public class ObservationRepositoryTest /// AggregatedPatientGroupedObservations returns a list of five entries, each containing the minimum value of 3. /// Also confirms that observations are cleaned up by patient id after the test executes. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Min_Return_List_5() { @@ -1455,6 +1500,7 @@ public class ObservationRepositoryTest /// maximum value for each group, producing one aggregated result per hour when inserting two observations /// (with different values) for each of five consecutive hours. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Max_Return_List_5() { @@ -1537,6 +1583,7 @@ public class ObservationRepositoryTest /// Inserts 10 observations across 5 different hours (two per hour with values 5 and 3), verifies the result count is 5, and asserts that each entry contains the "average" field with a value of 3 or 4. /// Cleans up by deleting all observations for the test patient after verification. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Average_Return_List_5() { @@ -1619,6 +1666,7 @@ public class ObservationRepositoryTest /// Inserts ten observations (two per hour for five consecutive hours) for a new patient, runs the aggregation, and asserts that the result contains five entries each reporting a count of 1 or 2. /// Also confirms that cleanup via DeleteByPatientId removes the inserted observations for the generated patient. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Count_Return_List_5() { @@ -1701,6 +1749,7 @@ public class ObservationRepositoryTest /// Inserts two sets of observations at different minute offsets across the last five hours, then asserts the aggregation result count matches the expected number of groups and the "all" subset is returned. /// Also validates cleanup by ensuring no observations remain for the test patient after deletion. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_HalfHour_Return_List_5() { @@ -1794,6 +1843,7 @@ public class ObservationRepositoryTest /// observation value (either 5 or 3 depending on insertion order) and that the inserted test data is /// cleaned up afterwards. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_LastFilled_Return_List_5() { @@ -1876,6 +1926,7 @@ public class ObservationRepositoryTest /// /// Tests that the repository's aggregated patient grouped observations, configured with hourly regularity and the LastAll result option, returns a list of 5 entries when 5 hours of data are inserted (with two observations per hour at minutes 15 and 31), and verifies that cleanup by patient ID removes all inserted records. /// + /// [Test] public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_LastAll_Return_List_5() { diff --git a/adas-core.Test/Repositories/PatientArchiveRepositoryTest.cs b/adas-core.Test/Repositories/PatientArchiveRepositoryTest.cs index 80c0ba55..ba319b3a 100644 --- a/adas-core.Test/Repositories/PatientArchiveRepositoryTest.cs +++ b/adas-core.Test/Repositories/PatientArchiveRepositoryTest.cs @@ -23,6 +23,7 @@ public class PatientArchiveRepositoryTest /// Performs one-time setup for integration tests by seeding the patient archive collection /// with three predefined records after resetting the collection. /// + /// [OneTimeSetUp] public async Task Init() { @@ -92,6 +93,7 @@ public class PatientArchiveRepositoryTest /// /// Verifies that the FindByPatientNumber repository method returns null when no record is found for the provided patient number. /// + /// [Test] public async Task FindByPatientNumber_Not_Find_Return_null() { @@ -105,6 +107,7 @@ public class PatientArchiveRepositoryTest /// matching the provided patient number, ensuring the returned patient is not null and has /// the expected PatientNumber. /// + /// [Test] public async Task FindByPatientNumber_Find_Return_Patient() { @@ -117,6 +120,7 @@ public class PatientArchiveRepositoryTest /// /// Verifies that the repository's FindAll method returns a non-null list containing the expected number of patient records. /// + /// [Test] public async Task FindAll_Return_List_Patients() { diff --git a/adas-core.Test/Repositories/PatientRepositoryTest.cs b/adas-core.Test/Repositories/PatientRepositoryTest.cs index 082d983b..1e6e5c2f 100644 --- a/adas-core.Test/Repositories/PatientRepositoryTest.cs +++ b/adas-core.Test/Repositories/PatientRepositoryTest.cs @@ -31,6 +31,7 @@ public class PatientRepositoryTest /// list records, then verifies that the initial bulk insert yields exactly five patient /// documents. /// + /// [OneTimeSetUp] public async Task Init() { @@ -239,6 +240,7 @@ public class PatientRepositoryTest /// /// Verifies that _repository.FindInActivePoC returns a non-null result containing exactly three inactive PoC entries. /// + /// [Test] public async Task FindInActivePoC() { @@ -251,6 +253,7 @@ public class PatientRepositoryTest /// Verifies that _repository.FindInInactivePoC() returns a non-null collection containing exactly two inactive PoC records. /// /// A Task representing the asynchronous test execution. + /// [Test] public async Task FindInInactivePoC() { @@ -262,6 +265,7 @@ public class PatientRepositoryTest /// /// Verifies that FindById returns the expected Patient when a valid patient identifier is provided, ensuring the result is not null and the PatientNumber matches the expected value. /// + /// [Test] public async Task FindById_Find_Return_Patient() { @@ -274,6 +278,7 @@ public class PatientRepositoryTest /// /// Verifies that the repository's FindByPatientNumber method returns null when invoked with an empty patient number, confirming the not-found scenario for blank input. /// + /// [Test] public async Task FindByPatientNumber_Not_Find_Return_Patient() { @@ -287,6 +292,7 @@ public class PatientRepositoryTest /// a patient when called with a valid patient number, returning a non-null result /// with a matching PatientNumber. /// + /// [Test] public async Task FindByPatientNumber_Find_Return_Patient() { @@ -299,6 +305,7 @@ public class PatientRepositoryTest /// /// Verifies that the repository's FindAll method returns a non-null list containing all expected patient records (five entries). /// + /// [Test] public async Task FindAll_Return_List_Patients() { @@ -314,6 +321,7 @@ public class PatientRepositoryTest /// the new value is not present prior to the update operation. Also validates that the updated record /// is persisted with the modified value and that the patient can be cleaned up via Delete. /// + /// [Test] public async Task Update_with_base_UpdateOneAsync() { @@ -367,6 +375,7 @@ public class PatientRepositoryTest /// Verifies that a patient can be successfully deleted from the repository by inserting a patient, /// confirming it exists, deleting it, and then confirming it is no longer retrievable. /// + /// [Test] public async Task Delete() { @@ -439,6 +448,7 @@ public class PatientRepositoryTest /// Tests that the attending doctor of a point of care entry can be successfully updated with a new doctor. /// Verifies that after the update, the entry retrieved by point of care reflects the new attending doctor's information. /// + /// [Test] public async Task UpdateAttendingDoctor() { @@ -629,6 +639,7 @@ public class PatientRepositoryTest /// /// Verifies that _repository.FindByPatientId returns null when no patient is found for the provided patient identifier. /// + /// [Test] public async Task FindByPatientId_Not_Find_Return_Patient() { @@ -649,6 +660,7 @@ public class PatientRepositoryTest /// /// Verifies that the repository returns a non-null and non-empty collection of patients when searching by the identifier of an existing point of care. /// + /// [Test] public async Task FindByPointOfCare_Find_Return_Patients() { @@ -662,6 +674,7 @@ public class PatientRepositoryTest /// /// Verifies that _repository.FindByPointOfCare returns a non-null empty collection when no patients match the provided point of care identifier. /// + /// [Test] public async Task FindByPointOfCare_Not_Find_Return_Patients() { @@ -674,6 +687,7 @@ public class PatientRepositoryTest /// /// Verifies that the repository returns a non-null and non-empty collection of discharged patients when calling FindDischargedPatients. /// + /// [Test] public async Task FindDischargedPatients_Find_Return_Patients() { diff --git a/adas-core.Test/Repositories/PoCMappingRepositoryTest.cs b/adas-core.Test/Repositories/PoCMappingRepositoryTest.cs index 4d985045..486ccd54 100644 --- a/adas-core.Test/Repositories/PoCMappingRepositoryTest.cs +++ b/adas-core.Test/Repositories/PoCMappingRepositoryTest.cs @@ -20,6 +20,7 @@ public class PoCMappingRepositoryTest /// /// Performs one-time setup for integration tests by seeding the "mappings" collection with a sample document, where a single point of care is mapped from an original value to a new one across eleven bed entries, and initializing the against the integration database. /// + /// [OneTimeSetUp] public async Task Init() { @@ -71,6 +72,7 @@ public class PoCMappingRepositoryTest /// /// Verifies that finding a mapping by the key "PV1" returns a non-null result containing point of care entries with at least one associated bed. /// + /// [Test] public async Task FindByKey_Find_Return_Mapping() { @@ -84,6 +86,7 @@ public class PoCMappingRepositoryTest /// /// Verifies that the repository's FindByKey method returns null when the provided key does not correspond to an existing entity, confirming the not-found behavior. /// + /// [Test] public async Task FindByKey_Not_Find_Return_Mapping() { diff --git a/adas-core.Test/Repositories/PoCSettingsRepositoryTest.cs b/adas-core.Test/Repositories/PoCSettingsRepositoryTest.cs index 78ab9277..55062fc8 100644 --- a/adas-core.Test/Repositories/PoCSettingsRepositoryTest.cs +++ b/adas-core.Test/Repositories/PoCSettingsRepositoryTest.cs @@ -21,6 +21,7 @@ public class PoCSettingsRepositoryTest /// /// One-time setup that prepares the integration test environment by resetting the PoC settings collection in the integration database, seeding it with test data, and instantiating the used by the test fixture. /// + /// [OneTimeSetUp] public async Task Init() { @@ -55,6 +56,7 @@ public class PoCSettingsRepositoryTest /// /// Verifies that calling the Delete method with an existing PoCSettings identifier removes the corresponding record from the repository, resulting in a null lookup via FindById. /// + /// [Test] public async Task Delete_WhenCalled_ShouldRemovePoCSettings() { @@ -78,6 +80,7 @@ public class PoCSettingsRepositoryTest /// /// Verifies that the repository's FindAll method returns a non-null and non-empty collection of PoC settings. /// + /// [Test] public async Task FindAll_WhenCalled_ShouldReturnAllPoCSettings() { @@ -92,6 +95,7 @@ public class PoCSettingsRepositoryTest /// /// Tests that FindById returns a non-null PoC settings object whose identifier matches the requested value. /// + /// [Test] public async Task FindById_WhenCalled_ShouldReturnPoCSettings() { @@ -106,6 +110,7 @@ public class PoCSettingsRepositoryTest /// /// Verifies that _repository.FindByLocation returns a PoC settings object matching the requested patient location. /// + /// [Test] public async Task FindByLocation_WhenCalled_ShouldReturnPoCSettings() { @@ -121,6 +126,7 @@ public class PoCSettingsRepositoryTest /// Verifies that the repository correctly updates an existing PoCSettings entity, specifically ensuring that the associated PatientLocation properties (such as Bed) are persisted after the update operation. /// /// A task that represents the asynchronous test execution. + /// [Test] public async Task Update_WhenCalled_ShouldUpdatePoCSettings() { diff --git a/adas-core.Test/Repositories/PointOfCareRepositoryTests.cs b/adas-core.Test/Repositories/PointOfCareRepositoryTests.cs index 916842fb..3ada4204 100644 --- a/adas-core.Test/Repositories/PointOfCareRepositoryTests.cs +++ b/adas-core.Test/Repositories/PointOfCareRepositoryTests.cs @@ -25,6 +25,7 @@ public class PointOfCareRepositoryTests /// Performs one-time setup for integration tests by initializing mock dependencies and resetting the /// "pointOfCares" MongoDB collection before instantiating the . /// + /// [OneTimeSetUp] public async Task Init() { @@ -47,6 +48,7 @@ public class PointOfCareRepositoryTests /// /// Verifies that InsertOneAsync successfully inserts a valid point of care into the repository and that the record can be retrieved by its identifier. /// + /// [Test] public async Task InsertOneAsync_ValidPointOfCare_InsertsSuccessfully() { @@ -65,6 +67,7 @@ public class PointOfCareRepositoryTests /// Verifies that the Delete method successfully removes a point of care from the repository when given a valid identifier. /// Inserts a point of care, deletes it by its identifier, and asserts that the entity can no longer be retrieved. /// + /// [Test] public async Task Delete_ValidId_DeletesSuccessfully() { @@ -81,6 +84,7 @@ public class PointOfCareRepositoryTests /// /// Verifies that entities can be updated successfully when valid data is provided, ensuring that modified properties such as Room and Bed are persisted and retrievable after the update operation. /// + /// [Test] public async Task Update_ValidPointOfCare_UpdatesSuccessfully() { @@ -108,6 +112,7 @@ public class PointOfCareRepositoryTests /// /// Verifies that the repository's FindById method returns the correct PointOfCare document when queried with an existing identifier, by inserting a document and asserting that the retrieved entity matches the expected one. /// + /// [Test] public async Task FindById_ExistingId_ReturnsPointOfCare() { @@ -131,6 +136,7 @@ public class PointOfCareRepositoryTests /// /// Verifies that FindByUnitAndStatus returns the matching PointOfCare documents when queried with an existing unit identifier and status. /// + /// [Test] public async Task FindByUnitAndStatus_ExistingUnitAndStatus_ReturnsMatchingPointOfCares() { @@ -156,6 +162,7 @@ public class PointOfCareRepositoryTests /// Inserts a valid PointOfCare into the repository and verifies the search by room returns a non-null collection /// containing the expected entity. Assertions are only executed when the inserted PointOfCare has a non-null Unit. /// + /// [Test] public async Task FindByRoom_ValidRoom_ReturnsMatchingPointOfCares() { @@ -180,6 +187,7 @@ public class PointOfCareRepositoryTests /// /// Verifies that the repository returns the matching PointOfCare when queried with a valid bed identifier. /// + /// [Test] public async Task FindByBed_ValidBed_ReturnsMatchingPointOfCares() { @@ -203,6 +211,7 @@ public class PointOfCareRepositoryTests /// /// Verifies that the GetAll repository method returns all stored PointOfCare entries, including a newly inserted one identified by its assigned Id. /// + /// [Test] public async Task GetAll_ReturnsAllPointOfCares() { diff --git a/adas-core.Test/Repositories/PumpAlarmEventRepositoryTest.cs b/adas-core.Test/Repositories/PumpAlarmEventRepositoryTest.cs index 71512b3b..387a86ca 100644 --- a/adas-core.Test/Repositories/PumpAlarmEventRepositoryTest.cs +++ b/adas-core.Test/Repositories/PumpAlarmEventRepositoryTest.cs @@ -36,6 +36,8 @@ public class PumpAlarmEventRepositoryTest /// alarm events covering both Device and DeviceB across attention and occlusion /// alarm types. Verifies that exactly three documents are present after seeding. /// + /// [OneTimeSetUp] public async Task Init() { @@ -96,6 +98,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that InsertAsync correctly persists a to the repository by inserting an event and confirming it can be retrieved by its identifier. /// + /// [Test] public async Task InsertAsync_Works() { @@ -120,6 +123,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that FindByDeviceIdAsync returns a non-empty collection of records for the specified device, ordered by time so that the most recent entry appears first. /// + /// [Test] public async Task FindByDeviceIdAsync_ReturnsOrdered() { @@ -137,6 +141,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that FindByDeviceIdAsync returns only pump alarm events whose timestamps fall within the specified date range. /// + /// [Test] public async Task FindByDeviceIdAsync_WithDateRange_Works() { @@ -156,6 +161,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that FindByDeviceIdAsync returns at most the specified number of results when a limit is provided. /// + /// [Test] public async Task FindByDeviceIdAsync_WithLimit_Works() { @@ -195,6 +201,7 @@ public class PumpAlarmEventRepositoryTest /// Verifies that DeleteByPatientId correctly removes all alarm events associated with a given patient. /// Inserts a sample PumpAlarmEvent for a specific patient, deletes it by patient ID, and asserts that no matching events remain in the collection. /// + /// [Test] public async Task DeleteByPatientId_Works() { @@ -224,6 +231,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that UpdateManyObjectIdByFiledNameAsync correctly updates documents matching the specified field name and old ObjectId value, replacing it with the new ObjectId, and that the changes are persisted and queryable. /// + /// [Test] public async Task UpdateManyObjectIdByFiledNameAsync_Works() { @@ -252,6 +260,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that FindByDeviceIdAsync returns an empty result when the queried date range falls outside of the available data window. /// + /// [Test] public async Task FindByDeviceIdAsync_ReturnsEmpty_WhenOutOfRange() { @@ -267,6 +276,7 @@ public class PumpAlarmEventRepositoryTest /// Verifies that FindByDeviceIdAsync correctly applies the requested limit and orders results so that the most recent alarm event for the given device is returned first. /// Seeds multiple events for the target device, requests a single record, and asserts that the returned entry matches the latest event retrieved by FindLastByDeviceIdAsync. /// + /// [Test] public async Task FindByDeviceIdAsync_RespectsLimitAndOrder() { @@ -292,6 +302,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that InsertAsync successfully persists a when its optional fields (PatientId and AlarmType) are null, and that the record can be retrieved afterwards. /// + /// [Test] public async Task InsertAsync_AllowsNullOptionalFields() { @@ -313,6 +324,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that DeleteByPatientId removes all alarm events associated with the given patient and can be invoked repeatedly without throwing once the records no longer exist. /// + /// [Test] public async Task DeleteByPatientId_DeletesMany_AndIsIdempotent() { @@ -342,6 +354,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that UpdateManyObjectIdByFiledNameAsync updates the PatientId field from an old to a new one across all matching documents, returning the modified count and persisting the new identifier in the collection. /// + /// [Test] public async Task UpdateManyObjectIdByFiledNameAsync_UpdatesMultiple() { @@ -373,6 +386,7 @@ public class PumpAlarmEventRepositoryTest /// ensuring events whose timestamp matches the upper bound exactly are returned and that all returned /// events fall within the supplied range. /// + /// [Test] public async Task FindByDeviceIdAsync_InclusiveRange_BoundsRespected() { @@ -403,6 +417,7 @@ public class PumpAlarmEventRepositoryTest /// /// Verifies that FindLastByDeviceIdAsync returns the most recent alarm event for a given device and tracks newly inserted events as the latest entry. /// + /// [Test] public async Task FindLastByDeviceIdAsync_TracksNewest() { @@ -428,6 +443,7 @@ public class PumpAlarmEventRepositoryTest /// and time range when multiple queries are issued against overlapping windows, ensuring each /// range returns only the event that falls within its boundaries. /// + /// [Test] public async Task FindByDeviceIdAsync_MultipleOverlappingRanges() { diff --git a/adas-core.Test/Repositories/PumpAlarmStateRepositoryTest.cs b/adas-core.Test/Repositories/PumpAlarmStateRepositoryTest.cs index 31d2d700..7275c3ba 100644 --- a/adas-core.Test/Repositories/PumpAlarmStateRepositoryTest.cs +++ b/adas-core.Test/Repositories/PumpAlarmStateRepositoryTest.cs @@ -34,6 +34,7 @@ public class PumpAlarmStateRepositoryTest /// One-time setup that prepares the integration test environment for . /// Configures the API settings, drops and recreates the "pump_alarm_state" collection, instantiates the repository with its indexes, and seeds three initial alarm state records across two devices, verifying the seeded count. /// + /// [OneTimeSetUp] public async Task Init() { @@ -96,6 +97,7 @@ public class PumpAlarmStateRepositoryTest /// /// Verifies that FindActiveAsync returns the correct active alarm matching the specified device identifier, alarm type, and alarm code. /// + /// [Test] public async Task FindActiveAsync_ReturnsCorrectAlarm() { @@ -113,6 +115,7 @@ public class PumpAlarmStateRepositoryTest /// /// Verifies that FindActiveAsync returns null when no active alarm matching the specified device, alarm type, and identifier exists. /// + /// [Test] public async Task FindActiveAsync_ReturnsNull_WhenNotFound() { @@ -128,6 +131,7 @@ public class PumpAlarmStateRepositoryTest /// when no existing alarm with the same device, type, and code is found, and that the inserted alarm /// can subsequently be retrieved via FindActiveAsync. /// + /// [Test] public async Task UpsertActiveAsync_InsertsNew() { @@ -179,6 +183,7 @@ public class PumpAlarmStateRepositoryTest /// /// Verifies that RemoveAsync correctly deletes an active alarm by device, alarm type, and alarm code, and that a subsequent lookup returns no result. /// + /// [Test] public async Task RemoveAsync_Works() { @@ -207,6 +212,7 @@ public class PumpAlarmStateRepositoryTest /// Verifies that the repository's DeleteByPatientId method successfully removes a previously upserted /// for the specified patient, ensuring no matching records remain in the collection. /// + /// [Test] public async Task DeleteByPatientId_Works() { @@ -236,6 +242,7 @@ public class PumpAlarmStateRepositoryTest /// /// Verifies that FindAllActiveByDeviceAsync returns only active pump alarm states that belong to the specified device. /// + /// [Test] public async Task FindAllActiveByDeviceAsync_ReturnsCorrect() { @@ -254,6 +261,7 @@ public class PumpAlarmStateRepositoryTest /// from the old ObjectId to a new ObjectId for matching documents, returning the expected count of /// updated records and making the document retrievable by the new ObjectId. /// + /// [Test] public async Task UpdateManyObjectIdByFieldNameAsync_Works() { @@ -312,6 +320,7 @@ public class PumpAlarmStateRepositoryTest /// /// Verifies that UpsertActiveAsync correctly inserts a PumpAlarmState record when the AlarmCodeMdc is null, and that the record can be retrieved via FindActiveAsync using a null alarm code. /// + /// [Test] public async Task UpsertActiveAsync_InsertsWhenAlarmCodeIsNull() { @@ -336,6 +345,7 @@ public class PumpAlarmStateRepositoryTest /// /// Verifies that RemoveAsync removes every active alarm matching the specified device identifier and alarm type, not just a single record. /// + /// [Test] public async Task RemoveAsync_RemovesAllMatching() { diff --git a/adas-core.Test/Repositories/PumpArchiveRepositoryTest.cs b/adas-core.Test/Repositories/PumpArchiveRepositoryTest.cs index 13b3c0b1..020916e4 100644 --- a/adas-core.Test/Repositories/PumpArchiveRepositoryTest.cs +++ b/adas-core.Test/Repositories/PumpArchiveRepositoryTest.cs @@ -192,6 +192,7 @@ public class PumpArchiveRepositoryTest /// /// Verifies that the DeleteBeforeDate repository method removes all records with a date earlier than the specified cutoff, retaining only records dated on or after that cutoff. /// + /// [Test] public async Task DeleteBeforeDate() { diff --git a/adas-core.Test/Repositories/PumpObservationRepositoryTest.cs b/adas-core.Test/Repositories/PumpObservationRepositoryTest.cs index b7541b7f..22e1eea3 100644 --- a/adas-core.Test/Repositories/PumpObservationRepositoryTest.cs +++ b/adas-core.Test/Repositories/PumpObservationRepositoryTest.cs @@ -219,6 +219,8 @@ public class PumpObservationRepositoryTest /// Verifies that the aggregated last observations retrieved for the test PatientId are distinct by name, ensuring the resulting collection is non-empty and contains at most two entries. /// /// + /// [Test] public async Task AggregatedPatientLastObservations_DistinctByName() { @@ -309,6 +311,8 @@ public class PumpObservationRepositoryTest /// Verifies that correctly deletes the older records while preserving the most recent entries, returning the expected count of deleted items. /// /// + /// [Test] public async Task DeleteKeepLastNAsync_Works() { diff --git a/adas-core.Test/Repositories/PumpStateRepositoryTest.cs b/adas-core.Test/Repositories/PumpStateRepositoryTest.cs index 6de21fb2..a520299b 100644 --- a/adas-core.Test/Repositories/PumpStateRepositoryTest.cs +++ b/adas-core.Test/Repositories/PumpStateRepositoryTest.cs @@ -35,6 +35,7 @@ public class PumpStateRepositoryTest /// "pump_states" MongoDB collection, building the repository indexes, and seeding two initial pump states (one /// actively infusing for a known patient/device and one not infusing) to verify the baseline document count. /// + /// [OneTimeSetUp] public async Task Init() { @@ -89,6 +90,7 @@ public class PumpStateRepositoryTest /// /// Verifies that FindByDeviceIdAsync retrieves the correct infusion state for a given device, returning a non-null result that matches the requested device identifier and reflects the expected infusion status. /// + /// [Test] public async Task FindByDeviceIdAsync_ReturnsCorrectState() { @@ -108,6 +110,7 @@ public class PumpStateRepositoryTest /// /// Verifies that UpsertAsync inserts a new record when no existing entry is found for the specified DeviceId, and that the persisted state retains the provided property values. /// + /// [Test] public async Task UpsertAsync_InsertsNewWhenNotExists() { @@ -131,6 +134,7 @@ public class PumpStateRepositoryTest /// the updated is persisted and retrievable with the modified IsInfusing, /// Status, and LastUpdated values. /// + /// [Test] public async Task UpsertAsync_UpdatesExistingState() { @@ -165,6 +169,7 @@ public class PumpStateRepositoryTest /// /// Verifies that GetAllAsync returns a non-null collection of pump states containing at least two entries, including those associated with the seeded devices A and B. /// + /// [Test] public async Task GetAllAsync_ReturnsAllStates() { @@ -190,6 +195,7 @@ public class PumpStateRepositoryTest /// /// Verifies that UpsertAsync updates an existing entity instead of inserting a duplicate, ensuring the total record count remains unchanged when upserting a for an already-known device identifier. /// + /// [Test] public async Task UpsertAsync_DoesNotCreateDuplicates() { diff --git a/adas-core.Test/Repositories/RecordingAlertArchiveRepositoryTest.cs b/adas-core.Test/Repositories/RecordingAlertArchiveRepositoryTest.cs index 27647c33..2f007eec 100644 --- a/adas-core.Test/Repositories/RecordingAlertArchiveRepositoryTest.cs +++ b/adas-core.Test/Repositories/RecordingAlertArchiveRepositoryTest.cs @@ -22,6 +22,7 @@ public class RecordingAlertArchiveRepositoryTest /// /// One-time test setup that prepares the archive collection for recording-alert integration tests by clearing it, creating a fresh instance of , and seeding it with two patient recording alerts (one matching the current patient with the current timestamp and one for a different patient dated ten days earlier), verifying that both records are persisted. /// + /// [OneTimeSetUp] public async Task Init() { @@ -69,6 +70,7 @@ public class RecordingAlertArchiveRepositoryTest /// Verifies that the repository's DeleteBeforeDate operation removes all documents dated before the specified cutoff date, leaving only documents on or after that date. /// Expects more than one document in the collection initially and exactly one remaining after deletion. /// + /// [Test] public async Task DeleteBeforeDate() { diff --git a/adas-core.Test/Repositories/RecordingAlertRepositoryTest.cs b/adas-core.Test/Repositories/RecordingAlertRepositoryTest.cs index 993d3775..cb381272 100644 --- a/adas-core.Test/Repositories/RecordingAlertRepositoryTest.cs +++ b/adas-core.Test/Repositories/RecordingAlertRepositoryTest.cs @@ -23,6 +23,7 @@ public class RecordingAlertRepositoryTest /// One-time test setup that initializes the recording alert repository with two sample patient recording alerts /// and ensures the underlying collection contains exactly two documents for integration test scenarios. /// + /// [OneTimeSetUp] public async Task Init() { @@ -69,6 +70,7 @@ public class RecordingAlertRepositoryTest /// /// Verifies that the repository's DeleteAsync method successfully removes a PatientRecordingAlert document, confirming the record exists prior to deletion and is no longer retrievable afterwards. /// + /// [Test] public async Task DeleteAsync() { @@ -97,6 +99,7 @@ public class RecordingAlertRepositoryTest /// /// Tests that the DeleteOlderDaysAsync repository method removes patient recording alerts that exceed the specified age threshold and match the given recording name, while preserving alerts within the threshold. /// + /// [Test] public async Task DeleteOlderDaysAsync() { @@ -142,6 +145,7 @@ public class RecordingAlertRepositoryTest /// Verifies that DeleteOlderNumberAsync removes older records with the specified name, keeping only the most recent ones according to the provided count. /// Inserts two entries sharing the same name but different timestamps, asserts both exist, performs the deletion, and confirms that only one record remains. /// + /// [Test] public async Task DeleteOlderNumberAsync() { @@ -180,6 +184,7 @@ public class RecordingAlertRepositoryTest /// /// Verifies that DeleteByPatientId removes a patient's recording alert from the repository, ensuring the alert cannot be retrieved after deletion. /// + /// [Test] public async Task DeleteByPatientId() { @@ -216,6 +221,7 @@ public class RecordingAlertRepositoryTest /// /// Verifies that the repository returns a non-null result when searching for records by patient identifier. /// + /// [Test] public async Task FindByPatientIdAsync() { @@ -229,6 +235,7 @@ public class RecordingAlertRepositoryTest /// for a given patient and recording name, filtering out older entries based on the /// specified count limit, and that the returned observation matches the expected time. /// + /// [Test] public async Task FindLastObservations() { @@ -278,6 +285,7 @@ public class RecordingAlertRepositoryTest /// /// Tests the repository's ability to update the patientid ObjectId field across records, verifying that after the update the original patient identifier no longer returns any alerts while the new patient identifier does, and that deletion by patient ID subsequently removes the record. /// + /// [Test] public async Task UpdateManyObjectId() { diff --git a/adas-core.Test/Repositories/ServiceConfigRepositoryTest.cs b/adas-core.Test/Repositories/ServiceConfigRepositoryTest.cs index a7d3815d..4ef4204a 100644 --- a/adas-core.Test/Repositories/ServiceConfigRepositoryTest.cs +++ b/adas-core.Test/Repositories/ServiceConfigRepositoryTest.cs @@ -21,6 +21,7 @@ public class ServiceConfigRepositoryTest /// /// Performs one-time initialization for integration tests by creating a entry in the test database and preparing the repository used by the test fixture. /// + /// [OneTimeSetUp] public async Task Init() { @@ -57,6 +58,7 @@ public class ServiceConfigRepositoryTest /// Verifies that .FindById returns a non-null entity when queried by its string identifier, /// and that the returned entity's StrId matches the supplied id. /// + /// [Test] public async Task FindById_Find_string() { @@ -70,6 +72,7 @@ public class ServiceConfigRepositoryTest /// Verifies that the repository's FindById method successfully retrieves an object by its identifier, /// returning a non-null result whose Id matches the requested identifier. /// + /// [Test] public async Task FindById_Find_ObjectId() { diff --git a/adas-core.Test/Repositories/TreatmentArchiveRepositoryTest.cs b/adas-core.Test/Repositories/TreatmentArchiveRepositoryTest.cs index 6c175659..598dfbf1 100644 --- a/adas-core.Test/Repositories/TreatmentArchiveRepositoryTest.cs +++ b/adas-core.Test/Repositories/TreatmentArchiveRepositoryTest.cs @@ -23,6 +23,7 @@ public class TreatmentArchiveRepositoryTest /// /// One-time setup method that prepares the integration test environment for the treatment archive repository by creating and inserting two sample patient treatments (one new and one discontinued) into a freshly created archive collection. /// + /// [OneTimeSetUp] public async Task Init() { @@ -82,6 +83,7 @@ public class TreatmentArchiveRepositoryTest /// Tests the repository method to ensure it correctly removes records older than the specified cutoff date, /// leaving only the most recent record. Verifies that when multiple patient records exist, deletion by date retains exactly one record. /// + /// [Test] public async Task DeleteBeforeDate() { @@ -101,6 +103,7 @@ public class TreatmentArchiveRepositoryTest /// /// Verifies that the repository successfully retrieves a non-empty collection of records associated with the specified patient. /// + /// [Test] public async Task FindAllFromPatient() { diff --git a/adas-core.Test/Repositories/TreatmentRepositoryTest.cs b/adas-core.Test/Repositories/TreatmentRepositoryTest.cs index 487fbd0a..6c16d862 100644 --- a/adas-core.Test/Repositories/TreatmentRepositoryTest.cs +++ b/adas-core.Test/Repositories/TreatmentRepositoryTest.cs @@ -24,6 +24,7 @@ public class TreatmentRepositoryTest /// /// One-time test setup that resets the treatments collection, instantiates the repository, and seeds two patient treatments (one with OrderControlType.Nw and one with OrderControlType.Dc) to verify insert behavior. /// + /// [OneTimeSetUp] public async Task Init() { @@ -89,6 +90,7 @@ public class TreatmentRepositoryTest /// /// Verifies that GetByPatientId returns an empty result collection rather than null when no patient treatments are found for the supplied patient identifier. /// + /// [Test] public async Task GetByPatientId_Not_Find_Return_Null() { @@ -103,6 +105,7 @@ public class TreatmentRepositoryTest /// Tests that the repository's GetByPatientId method returns the expected patient treatment records /// for the given patient, verifying that the result is not null and contains the expected number of entries. /// + /// [Test] public async Task GetByPatientId_Find_Return_Null() { @@ -117,6 +120,7 @@ public class TreatmentRepositoryTest /// Verifies that successfully removes a persisted patient treatment from the repository. /// The test inserts a treatment, confirms it exists, deletes it by id, and asserts it is no longer retrievable. /// + /// [Test] public async Task DeleteAsync() { @@ -151,6 +155,7 @@ public class TreatmentRepositoryTest /// /// Verifies that FindByPatientIdAsync returns a non-null list containing the expected number of treatments for the specified patient. /// + /// [Test] public async Task FindByPatientIdAsync_Find_Return_List_Traetments() { @@ -163,6 +168,7 @@ public class TreatmentRepositoryTest /// /// Verifies that removes the patient treatment associated with the given patient identifier, ensuring no records remain for that patient after deletion. /// + /// [Test] public async Task DeleteByPatientId() { @@ -197,6 +203,7 @@ public class TreatmentRepositoryTest /// /// Verifies that _repository.FindBolusTreatments returns a non-null collection containing exactly one bolus treatment for the specified patient. /// + /// [Test] public async Task FindBolusTreatments_Find_Return_Treatment() { @@ -209,6 +216,7 @@ public class TreatmentRepositoryTest /// /// Verifies that FindByPatientIdAsync returns a non-null list containing the expected number of treatments for the specified patient. /// + /// [Test] public async Task FindByPatientId_Find_Return_List_Traetments() { diff --git a/adas-core.Test/Repositories/UnitRepositoryTest.cs b/adas-core.Test/Repositories/UnitRepositoryTest.cs index 3e6fae81..33c90a80 100644 --- a/adas-core.Test/Repositories/UnitRepositoryTest.cs +++ b/adas-core.Test/Repositories/UnitRepositoryTest.cs @@ -22,6 +22,7 @@ public class UnitRepositoryTest /// /// One-time setup method that prepares the integration test environment by configuring API settings, creating a fresh "units" collection in the database, and seeding it with two sample records via the . /// + /// [OneTimeSetUp] public async Task Init() { @@ -65,6 +66,7 @@ public class UnitRepositoryTest /// /// Verifies that inserting a valid into the repository returns the unit and that the inserted unit can be successfully retrieved by its identifier, with key properties preserved. /// + /// [Test] public async Task InsertOneUnit_ValidUnit_ReturnsUnit() { @@ -132,6 +134,7 @@ public class UnitRepositoryTest /// /// Verifies that FindById retrieves the matching from the repository when a valid identifier is provided. /// + /// [Test] public async Task FindById_ValidId_ReturnsUnit() { @@ -157,6 +160,7 @@ public class UnitRepositoryTest /// /// Verifies that FindById returns null when queried with an ID that does not exist in the repository. /// + /// [Test] public async Task FindById_InvalidId_ReturnsNull() { @@ -214,6 +218,7 @@ public class UnitRepositoryTest /// Verifies that the repository's FindByName method returns the matching unit when called with a valid unit name. /// The test inserts a unit, retrieves it by name, and asserts that the returned entity is not null and has the expected name. /// + /// [Test] public async Task FindByName_ValidName_ReturnsUnit() { @@ -239,6 +244,7 @@ public class UnitRepositoryTest /// /// Verifies that the repository's FindByName method returns null when invoked with a name that does not match any existing entity. /// + /// [Test] public async Task FindByName_InvalidName_ReturnsNull() { @@ -353,6 +359,7 @@ public class UnitRepositoryTest /// Verifies that GetAll returns a non-null collection containing the units that have been inserted into the repository. /// /// Thrown when the units collection used to seed the repository is null. + /// [Test] public async Task GetAll_ReturnsAllUnits() { @@ -381,6 +388,7 @@ public class UnitRepositoryTest /// /// Verifies that UpdateUnit correctly updates an existing unit in the repository and returns the updated entity with the new title and the original identifier. /// + /// [Test] public async Task UpdateUnit_ValidUnit_ReturnsUpdatedUnit() { diff --git a/adas-core.Test/Repositories/UserRepositoryTest.cs b/adas-core.Test/Repositories/UserRepositoryTest.cs index bc704f8c..4f5005ff 100644 --- a/adas-core.Test/Repositories/UserRepositoryTest.cs +++ b/adas-core.Test/Repositories/UserRepositoryTest.cs @@ -18,6 +18,7 @@ public class UserRepositoryTest /// /// One-time integration test setup that prepares a clean "users" collection in the test database and seeds it with two predefined users, ensuring a deterministic state for downstream test cases. /// + /// [OneTimeSetUp] public async Task Init() { @@ -61,6 +62,7 @@ public class UserRepositoryTest /// /// Verifies that the 's GetUser method asynchronously returns a non-null user with the expected username and password credentials. /// + /// [Test] public async Task GetUser() { diff --git a/adas-core.Test/Services/AdmissionServiceTest.cs b/adas-core.Test/Services/AdmissionServiceTest.cs index 667cd4aa..be545cd8 100644 --- a/adas-core.Test/Services/AdmissionServiceTest.cs +++ b/adas-core.Test/Services/AdmissionServiceTest.cs @@ -18,6 +18,7 @@ namespace adas_core.Test.Services; /// /// Contains unit tests for verifying the behavior of the class. /// +/// public class AdmissionServiceTest { private Mock _admissionRepositoryMock; @@ -89,6 +90,7 @@ public class AdmissionServiceTest /// Verifies that the admission service successfully deletes a valid admission by ensuring the repository's /// Delete operation is invoked exactly once for the corresponding admission identifier. /// + /// [Test] public async Task DeleteAdmissionAsync_ValidAdmission_DeletesSuccessfully() { @@ -109,6 +111,7 @@ public class AdmissionServiceTest /// /// Verifies that DeleteAdmissionByIdAsync successfully deletes an admission when it exists in the repository, by ensuring the repository's Delete method is invoked exactly once for the given admission identifier. /// + /// [Test] public async Task DeleteAdmissionByIdAsync_AdmissionExists_DeletesSuccessfully() { @@ -131,6 +134,7 @@ public class AdmissionServiceTest /// associated patient location (unit, bed, and room) when the admission exists in the repository and the /// corresponding point of care is successfully resolved. /// + /// [Test] public async Task GetAdmissionByIdAsync_AdmissionExists_ReturnsAdmissionWithPatientLocation() { @@ -160,6 +164,7 @@ public class AdmissionServiceTest /// Verifies that GetAdmissionsAsync returns admissions enriched with their associated patient location details /// retrieved from the point of care service. /// + /// [Test] public async Task GetAdmissionsAsync_ReturnsAdmissionsWithPatientLocations() { @@ -233,6 +238,7 @@ public class AdmissionServiceTest /// invoking the repository's Update method and retrieving point-of-care information for both the new and the /// previous point of care associated with the admission. /// + /// [Test] public async Task UpdateAdmissionAsync_WhenAdmissionExists_UpdatesAdmission() { @@ -287,6 +293,7 @@ public class AdmissionServiceTest /// /// Verifies that admitting a patient with a valid admission—where the associated unit is found and the point of care matches—results in a new patient being inserted. /// + /// [Test] public async Task AdmitPatient_WithValidAdmission_CreatesPatientAndDeletesAdmission() { @@ -315,6 +322,7 @@ public class AdmissionServiceTest /// /// Verifies that GetAdmissionByLocation returns the expected list of admissions when a matching patient location is found, confirming the service correctly retrieves results from the repository. /// + /// [Test] public async Task GetAdmissionByLocation_LocationExists_ReturnsAdmissions() { @@ -345,6 +353,7 @@ public class AdmissionServiceTest /// /// Verifies that returns an empty result when the requested location does not exist, simulating the not-found scenario by having the repository throw an exception. /// + /// [Test] public async Task GetAdmissionByLocation_LocationNotFound_ReturnsNull() { @@ -371,6 +380,7 @@ public class AdmissionServiceTest /// GetAdmissionByPointOfCareId are enriched with patient location details (unit name, bed, and room) /// retrieved from the corresponding Point of Care entity. /// + /// [Test] public async Task GetAdmissionByPointOfCareId_POCExists_ReturnsAdmissionsWithLocation() { @@ -414,6 +424,7 @@ public class AdmissionServiceTest /// /// Verifies that returns an empty result when the underlying repository throws an exception while attempting to find an admission by point of care id. /// + /// [Test] public async Task GetAdmissionByPointOfCareId_POCNotFound_ReturnsNull() { @@ -434,6 +445,7 @@ public class AdmissionServiceTest /// Verifies that returns the expected list of admissions /// when a valid unit identifier is provided. /// + /// [Test] public async Task GetAdmissionByUnitIdWithOutPoC_UnitIdExists_ReturnsAdmissions() { @@ -462,6 +474,8 @@ public class AdmissionServiceTest /// throws an exception while looking up the given unit identifier. /// /// The identifier of the unit whose admission record is being requested. + /// [Test] public async Task GetAdmissionByUnitIdWithOutPoC_UnitIdNotFound_ReturnsNull() { @@ -580,6 +594,7 @@ public class AdmissionServiceTest /// /// Verifies that InsertAdmission throws a NotFoundException and performs no insert or update operations when a required associated resource is not found while processing a valid admission. /// + /// [Test] public async Task InsertAdmission_ValidAdmission_InsertsSuccessfullyWithUser() { diff --git a/adas-core.Test/Services/AlarmServiceTest.cs b/adas-core.Test/Services/AlarmServiceTest.cs index 1b8f9262..0002fe4e 100644 --- a/adas-core.Test/Services/AlarmServiceTest.cs +++ b/adas-core.Test/Services/AlarmServiceTest.cs @@ -17,6 +17,7 @@ namespace adas_core.Test.Services; /// /// Contains unit tests for verifying the behavior and functionality of the class. /// +/// public class AlarmServiceTest { private readonly Mock _alarmRepositoryMock; @@ -121,6 +122,7 @@ public class AlarmServiceTest /// /// Verifies that when an ORU_R40 type request is processed without any alarms, the patient is located but the observation is not persisted. /// + /// [Test] public async Task SaveRequest_Oru_R40_Type_Without_Alarms_Dont_Insert() { @@ -151,6 +153,7 @@ public class AlarmServiceTest /// /// Verifies that inserts the provided alarm observations into the alarm repository. /// + /// [Test] public async Task ProcessAlarmObservations_Should_Insert_Alarm_Observations() { @@ -183,6 +186,7 @@ public class AlarmServiceTest /// (coding system "ADAS_EVENT", description "EVT_LO and EVT_EXTR_LO"), the alarm service does not insert a new observation, /// as indicated by the verification that InsertObservation is never invoked. /// + /// [Test] public async Task CheckObservationAlarm_Alarm_EventPEEP_PEEP_bajo_create_Event() { @@ -211,6 +215,7 @@ public class AlarmServiceTest /// observation with the original value preserved (e.g., "PEEP High") while the alarm /// configuration handles the red beacon signaling. /// + /// [Test] public async Task CheckObservationAlarm_Should_Launch_Red_Alarm_And_Set_BeaconColor_Red() { diff --git a/adas-core.Test/Services/CacheDispatcherTest.cs b/adas-core.Test/Services/CacheDispatcherTest.cs index 1c99757c..d3839ab2 100644 --- a/adas-core.Test/Services/CacheDispatcherTest.cs +++ b/adas-core.Test/Services/CacheDispatcherTest.cs @@ -17,6 +17,7 @@ namespace adas_core.Test.Services; /// /// Provides a fake implementation of the interface, typically used as a test double or non-functional placeholder. /// +/// public class FakeLockProvider : ILockProvider { /// @@ -26,11 +27,13 @@ public class FakeLockProvider : ILockProvider /// The identifier of the resource to acquire. /// The maximum time to wait for the resource to become available. /// A that always completes with true, indicating the resource was acquired. + /// public Task AcquireAsync(string key, TimeSpan timeout) => Task.FromResult(true); /// /// Releases the resource associated with the specified key. This implementation completes immediately without performing any additional operation. /// /// The identifier of the resource to release. + /// public Task ReleaseAsync(string key) => Task.CompletedTask; } @@ -40,6 +43,7 @@ public class FakeLockProvider : ILockProvider /// /// Inherits all members from and is intended to be used in place of the real service when actual locking functionality is not required. /// +/// public class FakeLockManagerService : LockManagerService { /// @@ -60,6 +64,7 @@ public class FakeLockManagerService : LockManagerService /// /// This class combines the inheritance of with the contract of , allowing it to stand in for a real Redis-backed cache during unit tests or development. /// +/// public class FakeRedisService : RedisService, ICacheService { public bool WasCalled { get; private set; } @@ -86,6 +91,7 @@ public class FakeRedisService : RedisService, ICacheService /// An optional time-to-live duration for the cached entry. Not used in this implementation. /// A token to observe for cancellation requests. Not used in this implementation. /// A task that represents the asynchronous operation, containing the object produced by the factory. + /// Task ICacheService.GetOrSetObjectAsync( string key, Func> factory, @@ -107,6 +113,7 @@ public class FakeRedisService : RedisService, ICacheService /// An optional time-to-live duration for the cached entry. /// The token used to cancel the asynchronous operation. /// The value of type produced by the delegate. + /// Task ICacheService.GetOrSetObjectAsync( GroupedField groupedField, ObjectId patientId, @@ -126,6 +133,7 @@ public class FakeRedisService : RedisService, ICacheService /// /// This class combines inheritance from the concrete base class with the contract, allowing it to be used wherever an is required. /// +/// public class FakeCacheService : CacheService, ICacheService { public bool WasCalled { get; private set; } @@ -148,6 +156,15 @@ public class FakeCacheService : CacheService, ICacheService /// Token to cancel the operation; ignored by this implementation. /// The produced by invoking . /// + /// + /// Explicit implementation that always invokes and ignores and , effectively bypassing the cache and returning the value freshly produced for the supplied . + /// + /// The cache key identifying the requested entry. + /// The asynchronous delegate invoked to produce the value. + /// The optional cache lifetime. Not applied by this implementation. + /// The token used to cancel the operation. Not observed by this implementation. + /// A that completes with the value returned by . + /// Task ICacheService.GetOrSetObjectAsync( string key, Func> factory, @@ -170,6 +187,18 @@ public class FakeCacheService : CacheService, ICacheService /// A to cancel the operation. /// A that resolves to the value returned by . /// + /// + /// Test implementation of that bypasses caching + /// and directly invokes the supplied delegate, recording the call via the + /// WasCalled flag for verification purposes. + /// + /// The identifying the group context for the cached or computed object. + /// The of the patient whose data is being retrieved. + /// The delegate invoked to produce the result. + /// Optional time-to-live duration; ignored by this implementation. + /// Token to observe for cancellation; ignored by this implementation. + /// The produced by invoking . + /// Task ICacheService.GetOrSetObjectAsync( GroupedField groupedField, ObjectId patientId, @@ -189,6 +218,7 @@ public class FakeCacheService : CacheService, ICacheService /// /// This class inherits from and implements the interface, providing a non-functional cache suitable for unit tests or environments where caching should be bypassed. /// +/// public class FakeNoCacheService : NoCacheService, ICacheService { public bool WasCalled { get; private set; } @@ -234,6 +264,7 @@ public class CacheDispatcherTest /// /// Initializes the test environment by instantiating fake implementations of the Redis, in-memory, and no-op cache services, along with default , and constructs a under test using these dependencies. /// + /// [SetUp] public void SetUp() { @@ -358,6 +389,7 @@ public class CacheDispatcherTest /// /// Verifies that returns when the provided cache key does not start with any recognized prefix. /// + /// [Test] public void Classify_ReturnsUnknown_ForUnrecognizedPrefix() { diff --git a/adas-core.Test/Services/CacheServiceTest.cs b/adas-core.Test/Services/CacheServiceTest.cs index 3bcf6e50..c17d0d26 100644 --- a/adas-core.Test/Services/CacheServiceTest.cs +++ b/adas-core.Test/Services/CacheServiceTest.cs @@ -18,6 +18,7 @@ public class CacheServiceTest /// Initializes the test environment by creating a with a mock logger /// and an in-memory lock provider, and instantiating the under test with that lock manager. /// + /// [SetUp] public void SetUp() { @@ -55,6 +56,7 @@ public class CacheServiceTest /// /// Verifies that GetOrSetObjectAsync invokes the supplied factory on the first call, persists the produced value, and on subsequent calls returns the cached value without invoking the factory again. /// + /// [Test] public async Task GetOrSetObjectAsync_InvokesFactory_StoresResult_AndDoesNotInvokeAgainOnSecondCall() { @@ -89,6 +91,7 @@ public class CacheServiceTest /// /// Verifies that GetOrSetObjectAsync does not cache results, ensuring the factory delegate is re-invoked on subsequent calls for the same key when the previously produced value was . /// + /// [Test] public async Task GetOrSetObjectAsync_DoesNotCacheNullResult_AndInvokesFactoryOnSubsequentCalls() { @@ -118,6 +121,7 @@ public class CacheServiceTest /// the second thread does not invoke its factory if the first thread has already inserted the value, /// and both threads receive the value produced by the first thread's factory. /// + /// [Test] public async Task GetOrSetObjectAsync_SecondCheckInLock_PreventsFactoryExecution_WhenValueAlreadyInsertedByFirstThread() { @@ -161,6 +165,7 @@ public class CacheServiceTest /// /// Verifies that calling DeleteObjectAsync removes the stored value for the given key, and that the next call to GetOrSetObjectAsync invokes the factory delegate to produce a new value instead of returning a previously cached one. /// + /// [Test] public async Task DeleteObjectAsync_RemovesKey_AndFactoryIsInvokedOnNextCall() { @@ -188,6 +193,7 @@ public class CacheServiceTest /// /// Verifies that DeleteByPatternAsync removes only the cache entries whose keys match the supplied pattern while preserving unrelated keys that do not match. /// + /// [Test] public async Task DeleteByPatternAsync_RemovesMatchingKeys_AndKeepsNonMatchingKeys() { @@ -214,6 +220,7 @@ public class CacheServiceTest /// Verifies that CleanCache removes all entries from the cache, causing subsequent /// GetOrSetObjectAsync calls to invoke the provided factory delegate to repopulate the value. /// + /// [Test] public async Task CleanCache_RemovesAllKeys_AndFactoryIsInvokedAfterClean() { diff --git a/adas-core.Test/Services/CameraServiceTest.cs b/adas-core.Test/Services/CameraServiceTest.cs index dc893eaf..1f3d4206 100644 --- a/adas-core.Test/Services/CameraServiceTest.cs +++ b/adas-core.Test/Services/CameraServiceTest.cs @@ -18,6 +18,7 @@ internal class CameraServiceTest /// /// NUnit method executed before each test to initialize shared test state, such as camera configuration dictionaries, mocked camera and logger services, and a mocked subscribers service. Currently all initialization logic is commented out, so the method performs no setup actions. /// + /// [SetUp] public void Setup() { @@ -50,6 +51,8 @@ internal class CameraServiceTest /// /// Verifies that the MaskStream operation on the camera service returns a valid response when invoked with activation and coordinate parameters against the configured camera settings. Covers the scenario where the underlying grab response is null, ensuring the service still produces a non-null response with the expected status code and content. /// + /// public void MaskStream_Return_Ok() { //bool activate = true; diff --git a/adas-core.Test/Services/ConfigObservationServiceTest.cs b/adas-core.Test/Services/ConfigObservationServiceTest.cs index ebf78454..d560d288 100644 --- a/adas-core.Test/Services/ConfigObservationServiceTest.cs +++ b/adas-core.Test/Services/ConfigObservationServiceTest.cs @@ -83,6 +83,7 @@ public class ConfigObservationServiceTest /// Configures a default authenticated in the HTTP context and sets the cache mocks to bypass caching by executing the factory function directly, /// ensuring repository calls are invoked during tests. /// + /// [SetUp] public void Setup() { @@ -144,6 +145,8 @@ public class ConfigObservationServiceTest /// /// Verifies that querying a patient observation by CodingSystem only, without specifying a code or name, returns a null result. /// + /// [Test] public async Task Get_config_observation_item_by_codingSystem_only_return_null() { @@ -163,6 +166,7 @@ public class ConfigObservationServiceTest /// Verifies that Get returns the matching patient observation configuration for a given observation identified by its code and coding system. /// Asserts that the resolved item is not null and that the displayed name is mapped from the configured lookup to the expected localized value. /// + /// [Test] public async Task Get_config_observation_item_by_code_and_codingSystem() { @@ -186,6 +190,7 @@ public class ConfigObservationServiceTest /// matching the requested observation against the list returned by the repository and returning /// the item with the expected name. /// + /// [Test] public async Task Get_config_observation_item_by_name() { @@ -201,6 +206,7 @@ public class ConfigObservationServiceTest /// /// Verifies that the service returns null when a patient observation item is requested by a name that does not exist in the configuration list. /// + /// [Test] public async Task Get_config_observation_item_by_name_not_exist_returns_null() { @@ -216,6 +222,7 @@ public class ConfigObservationServiceTest /// /// Verifies that the service retrieves the correct configuration by matching both the observation code with its coding system and the parent data code with its coding system, returning the configuration named "ph". /// + /// [Test] public async Task Get_config_by_code_and_parent() { @@ -241,6 +248,7 @@ public class ConfigObservationServiceTest /// Verifies that the mapping service returns null when the observation name is unknown /// and the configuration is set to ignore unknown observations. /// + /// [Test] public async Task Map_unknown_ignore_true_returns_null() { @@ -257,6 +265,7 @@ public class ConfigObservationServiceTest /// the Map method returns the original observation as-is when no matching record is found /// in the repository, rather than discarding it as an unknown observation. /// + /// [Test] public async Task Map_unknown_ignore_false_returns_obs() { @@ -273,6 +282,7 @@ public class ConfigObservationServiceTest /// /// Verifies that mapping a patient observation with a value of 14 results in an "Ok" status, confirming the threshold mapping logic returns the expected outcome. /// + /// [Test] public async Task Map_threshold_Ok() { @@ -293,6 +303,7 @@ public class ConfigObservationServiceTest /// /// Tests that the Map method returns a Warning status when a patient observation value exceeds the configured threshold. /// + /// [Test] public async Task Map_threshold_Warning() { @@ -313,6 +324,7 @@ public class ConfigObservationServiceTest /// /// Verifies that mapping a with a SOFA score of 9 through the configured service results in a result with an status. /// + /// [Test] public async Task Map_threshold_Alert() { @@ -334,6 +346,7 @@ public class ConfigObservationServiceTest /// Verifies that mapping a parent returns an status /// when the repository successfully locates the configuration by identifier. /// + /// [Test] public async Task Map_parent_ok() { @@ -354,6 +367,7 @@ public class ConfigObservationServiceTest /// /// Verifies that UpdateConfig successfully updates an existing configuration and returns the updated with the new name. /// + /// [Test] public async Task UpdateConfig_ok() { @@ -376,6 +390,7 @@ public class ConfigObservationServiceTest /// /// Verifies that UpdateConfig throws a when the target ConfigObservation cannot be found by its identifier. /// + /// [Test] public async Task UpdateConfig_notfound() { @@ -392,6 +407,7 @@ public class ConfigObservationServiceTest /// /// Verifies that the CreateConfig service method successfully inserts the provided configuration and returns the expected result. /// + /// [Test] public async Task CreateConfig_ok() { @@ -405,6 +421,7 @@ public class ConfigObservationServiceTest /// /// Verifies that is thrown when attempting to create a configuration that already exists. /// + /// [Test] public void CreateConfig_duplicate_throws() { @@ -420,6 +437,7 @@ public class ConfigObservationServiceTest /// /// Verifies that RemoveConfigItem successfully removes a configuration item and returns the deleted entity when the repository finds and deletes it. /// + /// [Test] public async Task RemoveConfigItem_ok() { @@ -436,6 +454,7 @@ public class ConfigObservationServiceTest /// /// Verifies that RemoveConfigItem returns null when the underlying delete operation on the repository yields no result, simulating the case where the configuration item does not exist. /// + /// [Test] public async Task RemoveConfigItem_null() { diff --git a/adas-core.Test/Services/ConfigPumpsServiceTest.cs b/adas-core.Test/Services/ConfigPumpsServiceTest.cs index 1c2e936b..ddaf3f15 100644 --- a/adas-core.Test/Services/ConfigPumpsServiceTest.cs +++ b/adas-core.Test/Services/ConfigPumpsServiceTest.cs @@ -27,6 +27,7 @@ public class ConfigPumpsServiceTest /// /// Initializes the test environment by creating mock dependencies and instantiating the under test. /// + /// [SetUp] public void Setup() { @@ -72,6 +73,7 @@ public class ConfigPumpsServiceTest /// /// Verifies that the method returns the same instance unchanged when the ConfigPumpsRequired option is set to false, bypassing any pump configuration lookup or transformation. /// + /// [Test] public async Task Map_configPumpsRequired_false_Return_same_pump() { @@ -100,6 +102,7 @@ public class ConfigPumpsServiceTest /// Verifies that when pump configuration is required and the pump has no alarm type, /// the Map method returns the same pump instance unchanged. /// + /// [Test] public async Task Map_not_alarmType_Return_same_pump() { @@ -120,6 +123,7 @@ public class ConfigPumpsServiceTest /// /// Verifies that the method returns the original unchanged when the configuration pump item is empty, ensuring that no UiConfiguration is assigned in that case. /// + /// [Test] public async Task Map_Not_uiConfiguration_Return_same_pump() { @@ -156,6 +160,7 @@ public class ConfigPumpsServiceTest /// alarm type, ensuring the resulting UI configuration contains the expected label /// entries such as the "screenAlarmLabel" mapped to the alarm type. /// + /// [Test] public async Task Map_uiConfiguration_Return_pump_uiConfiguration() { diff --git a/adas-core.Test/Services/ConfigUnitsServiceTest.cs b/adas-core.Test/Services/ConfigUnitsServiceTest.cs index a33e03f3..81c6de7b 100644 --- a/adas-core.Test/Services/ConfigUnitsServiceTest.cs +++ b/adas-core.Test/Services/ConfigUnitsServiceTest.cs @@ -20,6 +20,7 @@ public class ConfigUnitsServiceTest /// /// Initializes the test dependencies and creates a new instance of with mocked repository, options, and logger for use in unit tests. /// + /// [SetUp] public void Setup() { @@ -58,6 +59,7 @@ public class ConfigUnitsServiceTest /// /// Verifies that when ConfigUnitsRequired is set to false, the method returns the same observation instance without applying any unit mapping or transformation. /// + /// [Test] public async Task Map_configUnitsRequired_false_Return_same_obs() { @@ -84,6 +86,7 @@ public class ConfigUnitsServiceTest /// /// Verifies that mapping a patient observation that does not contain units returns the same observation unchanged, confirming the mapping logic preserves the original data when no unit conversion is applicable. /// + /// [Test] public async Task Map_not_units_Return_same_obs() { @@ -105,6 +108,7 @@ public class ConfigUnitsServiceTest /// /// Verifies that the Map method returns the original observation unchanged with a null Units property when configuration units are required and no matching config unit is found for the observation's code. /// + /// [Test] public async Task Map_Not_Find_Config_Return_same_obs() { @@ -140,6 +144,7 @@ public class ConfigUnitsServiceTest /// Verifies that Map returns the configured unit value for a patient observation when /// ConfigUnitsRequired is enabled and a matching config unit is found in the repository. /// + /// [Test] public async Task Map_configUnits_Return_obs_ConfigUnit() { diff --git a/adas-core.Test/Services/DiagnosisServiceTest.cs b/adas-core.Test/Services/DiagnosisServiceTest.cs index a8dbc5dc..aa79f101 100644 --- a/adas-core.Test/Services/DiagnosisServiceTest.cs +++ b/adas-core.Test/Services/DiagnosisServiceTest.cs @@ -24,6 +24,7 @@ public class DiagnosisServiceTest /// /// Initializes the mocked dependencies (patient, diagnosis, unit, audit, subscribers and calculated observations services along with their repositories) and constructs the instance under test. /// + /// [SetUp] public void Setup() { @@ -148,6 +149,7 @@ public class DiagnosisServiceTest /// Verifies that SaveRequest does not insert a diagnosis when the patient referenced by the cannot be found. /// /// A task representing the asynchronous test execution. + /// [Test] public async Task SaveRequest_Not_FindPatient_Return_not_insert() { @@ -172,6 +174,12 @@ public class DiagnosisServiceTest /// /// The API request containing the patient and observation data being evaluated. /// Reserved parameter passed to SaveRequest as a null value. + /// + /// + /// [Test] public async Task SaveRequest_Not_Observations_Return_not_insert() { diff --git a/adas-core.Test/Services/DischargeServiceTest.cs b/adas-core.Test/Services/DischargeServiceTest.cs index ea57c02e..cf877cd3 100644 --- a/adas-core.Test/Services/DischargeServiceTest.cs +++ b/adas-core.Test/Services/DischargeServiceTest.cs @@ -16,6 +16,7 @@ namespace adas_core.Test.Services; /// /// Provides unit tests for the class, verifying the behavior and correctness of discharge-related operations. /// +/// public class DischargeServiceTest { private readonly Mock _auditServiceMock = new(); @@ -34,6 +35,7 @@ public class DischargeServiceTest /// /// Sets up the test environment by creating a mock authenticated user context and instantiating the with its required dependencies for use in unit tests. /// + /// [SetUp] public void Setup() { @@ -66,6 +68,8 @@ public class DischargeServiceTest /// when it exists in the repository. /// /// The discharge entity expected to be deleted; its identifier is used to invoke the repository delete operation. + /// [Test] public async Task DeleteDischargeAsync_WhenDischargeExists_DeletesDischarge() { @@ -100,6 +104,7 @@ public class DischargeServiceTest /// /// Verifies that throws a when the requested discharge is not found. /// + /// [Test] public void GetDischargeByIdAsync_WhenExceptionOccurs_ReturnsNullAndLogsError() { @@ -114,6 +119,7 @@ public class DischargeServiceTest /// Verifies that the discharge service returns the expected discharges retrieved from the repository when the underlying repository call completes successfully without exceptions. /// /// A representing the asynchronous test execution. + /// [Test] public async Task GetDischargesAsync_WhenNoException_ReturnsDischarges() { @@ -150,6 +156,7 @@ public class DischargeServiceTest /// Verifies that returns the inserted discharge /// when the underlying repository successfully completes the insertion and the entity can be retrieved by its identifier. /// + /// [Test] public async Task InsertDischarge_WhenInsertionSuccessful_ReturnsInsertedDischarge() { @@ -169,6 +176,7 @@ public class DischargeServiceTest /// /// Verifies that handles repository insertion failures by propagating the exception thrown by the underlying data store. /// + /// [Test] public void InsertDischarge_WhenInsertionFails_ReturnsNullAndLogsError() { @@ -186,6 +194,7 @@ public class DischargeServiceTest /// Verifies that returns the discharge /// retrieved from the repository when a discharge exists for the specified patient location. /// + /// [Test] public async Task GetDischargeByLocation_WhenDischargeExists_ReturnsDischarge() { @@ -204,6 +213,7 @@ public class DischargeServiceTest /// /// Verifies that returns null when the underlying discharge repository throws an exception while retrieving the discharge record for the specified patient location. /// + /// [Test] public async Task GetDischargeByLocation_WhenExceptionOccurs_ReturnsNullAndLogsError() { @@ -236,6 +246,7 @@ public class DischargeServiceTest /// /// Verifies that returns null when the underlying repository throws an exception while attempting to retrieve a discharge by its point-of-care identifier. /// + /// [Test] public async Task GetDischargeByPointOfCareId_WhenExceptionOccurs_ReturnsNullAndLogsError() { diff --git a/adas-core.Test/Services/DisplayServiceTest.cs b/adas-core.Test/Services/DisplayServiceTest.cs index b8d58c4d..476ca965 100644 --- a/adas-core.Test/Services/DisplayServiceTest.cs +++ b/adas-core.Test/Services/DisplayServiceTest.cs @@ -46,6 +46,7 @@ public class DisplayServiceTest /// Initializes mocked dependencies and configuration required to construct a instance for unit tests. /// Sets up the HTTP context with a test user claim, creates default cache settings, and wires all collaborators (repositories, services, logger, permissions) into the service under test. /// + /// [SetUp] public void SetUp() { @@ -93,6 +94,7 @@ public class DisplayServiceTest /// /// Verifies that inserts a display by resolving the default configuration for its type and persisting it through the repository's insert method. /// + /// [Test] public async Task InsertOne_ShouldInsertDisplay() { @@ -121,6 +123,7 @@ public class DisplayServiceTest /// /// Verifies that the returns the expected instance when a matching id is provided through the repository. /// + /// [Test] public async Task GetById_ShouldReturnDisplay() { @@ -140,6 +143,7 @@ public class DisplayServiceTest /// /// Verifies that _displayService.GetAllByUser returns an empty collection when the user name is null. /// + /// [Test] public async Task GetAllByUser_ShouldReturnEmpty_WhenUserNameNull() { @@ -238,6 +242,7 @@ public class DisplayServiceTest /// from the display repository, ensuring the service correctly resolves configurations and /// their linked displays for the given display type. /// + /// [Test] public async Task GetByType_ShouldReturnDisplays() { @@ -261,6 +266,7 @@ public class DisplayServiceTest /// Verifies that returns an empty collection when no display configurations are found for the specified display type. /// /// A task that completes when the assertion confirming the empty result has been executed. + /// [Test] public async Task GetByType_ShouldReturnEmpty_WhenNoConfigsFound() { @@ -280,6 +286,8 @@ public class DisplayServiceTest /// /// The point of care used to look up associated displays. /// A task representing the asynchronous test execution. + /// [Test] public async Task GetByPointOfCare_ShouldReturnDisplays() { @@ -301,6 +309,7 @@ public class DisplayServiceTest /// Verifies that returns the displays associated with the specified configuration ID retrieved from the repository. /// /// A task that completes when the assertion confirms the returned collection contains the expected number of displays. + /// [Test] public async Task GetByConfigId_ShouldReturnDisplays() { @@ -321,6 +330,7 @@ public class DisplayServiceTest /// /// Verifies that the method throws a when no display matching the specified name is found in the repository. /// + /// [Test] public void GetByName_ShouldThrow_WhenNotFound() { @@ -337,6 +347,7 @@ public class DisplayServiceTest /// /// Verifies that GetInfo returns a with its associated PointOfCare entries populated when invoked with the "with POC" flag enabled and a valid display identifier. /// + /// [Test] public async Task GetInfo_ShouldReturnDisplayWithPoc() { @@ -381,6 +392,7 @@ public class DisplayServiceTest /// /// Verifies that returns the displays associated with the specified unit identifier when the repository contains matching records. /// + /// [Test] public async Task GetByUnitId_ShouldReturnDisplays() { @@ -402,6 +414,7 @@ public class DisplayServiceTest /// Verifies that UpdatePointOfCareList throws a when the display with the specified identifier does not exist. /// /// Thrown when no display is found for the given id. + /// [Test] public void UpdatePointOfCareList_ShouldThrow_WhenDisplayNotFound() { @@ -422,6 +435,8 @@ public class DisplayServiceTest /// /// The unique identifier of the display whose configuration preset is being updated. /// The unique identifier of the configuration preset to associate with the display. + /// [Test] public void UpdateConfigPreset_ShouldThrow_WhenUpdateFails() { diff --git a/adas-core.Test/Services/GroupedObservationServiceTest.cs b/adas-core.Test/Services/GroupedObservationServiceTest.cs index 0f023fdf..e5119f97 100644 --- a/adas-core.Test/Services/GroupedObservationServiceTest.cs +++ b/adas-core.Test/Services/GroupedObservationServiceTest.cs @@ -24,6 +24,7 @@ public class GroupedObservationServiceTest /// (configuration observation service, observation repository, logger, and cache service) /// and instantiating the under test with default API and cache settings. /// + /// [SetUp] public void Setup() { @@ -46,6 +47,7 @@ public class GroupedObservationServiceTest /// verifying the distribution of observations across shifts for the current day, the previous day, and two days prior when the /// Result.Last aggregation is applied with a maximum count of 36. /// + /// [Test] public void Generate_Shift_Observations() { @@ -101,6 +103,7 @@ public class GroupedObservationServiceTest /// the current day, the previous day, and two days prior, ensuring that data is aggregated into the /// correct shift and day buckets. /// + /// [Test] public void Calculate_Shift_Observations() { @@ -248,6 +251,7 @@ public class GroupedObservationServiceTest /// so that the returned sequence contains a complete set of five consecutive hourly observations /// (covering the last five hours relative to the current time) for a group with hourly regularity and a maximum of five entries. /// + /// [Test] public async Task Calculate_Last_Filled_Observations_should_add_Minus_4_hour_to_complete_last_five_hours() { @@ -303,6 +307,7 @@ public class GroupedObservationServiceTest /// adding the -1 hour observation when it is not present in the provided list so that the returned /// collection always contains a complete five-hour window of last filled observations. /// + /// [Test] public async Task Calculate_Last_Filled_Observations_should_add_Minus_1_hour_to_complete_last_five_hours() { @@ -356,6 +361,7 @@ public class GroupedObservationServiceTest /// /// Verifies that the service correctly fills hourly observations from half-hour observation data, grouping timestamped values by hour and forwarding missing slots up to the configured maximum (5) per hour. /// + /// [Test] public void FillHoursObservations() { @@ -486,6 +492,7 @@ public class GroupedObservationServiceTest /// The result type that determines how the value is stored; aggregate types (HalfHour, Sum, Count, Min, Average, Max) are stored directly, while others are wrapped in a sub-document with time and stringified value. /// Optional BsonArray of additional entries; when provided, it is appended to the result under the "all" key. /// A BsonDocument containing the _id composite key, a time field, the result-type-specific payload, and optionally the "all" array. + /// private static BsonDocument GenerateBsonDocument(int? year, int? month, int? day, int? hour, int? minute, string name, object value, Result resultType, BsonArray? all) { diff --git a/adas-core.Test/Services/HistoricalConfigChangesServiceTest.cs b/adas-core.Test/Services/HistoricalConfigChangesServiceTest.cs index 0cbb4b83..2c643822 100644 --- a/adas-core.Test/Services/HistoricalConfigChangesServiceTest.cs +++ b/adas-core.Test/Services/HistoricalConfigChangesServiceTest.cs @@ -23,6 +23,7 @@ internal class HistoricalConfigChangesServiceTest /// /// Initializes the mock repository, mock logger, and the instance under test prior to each unit test execution. /// + /// [SetUp] public void Setup() { @@ -44,6 +45,8 @@ internal class HistoricalConfigChangesServiceTest /// /// The type of configuration whose last historical changes are being retrieved. /// A task that represents the asynchronous test execution. + /// [Test] public async Task FindLastConfigChanges_ReturnsLastConfigChange() { @@ -66,6 +69,7 @@ internal class HistoricalConfigChangesServiceTest /// /// Verifies that the service returns null when the underlying repository throws an exception while inserting a entity. /// + /// [Test] public async Task InsertOne_WhenExceptionOccurs_ReturnsNull() { @@ -84,6 +88,7 @@ internal class HistoricalConfigChangesServiceTest /// /// Verifies that the service's GetAll method returns all historical configuration changes retrieved from the repository. /// + /// [Test] public async Task GetAll_ReturnsAllConfigChanges() { @@ -105,6 +110,7 @@ internal class HistoricalConfigChangesServiceTest /// /// Verifies that the service's GetByType method returns the expected number of historical configuration changes for the specified configuration type. /// + /// [Test] public async Task GetByType_ReturnsCorrectAmountOfConfigs() { @@ -129,6 +135,7 @@ internal class HistoricalConfigChangesServiceTest /// Verifies that the service returns the expected number of historical configuration changes for a given user, /// confirming the repository result is correctly forwarded to the caller. /// + /// [Test] public async Task GetByUser_ReturnsCorrectConfigs() { @@ -151,6 +158,7 @@ internal class HistoricalConfigChangesServiceTest /// /// Verifies that the service returns null when an exception is thrown while updating a historical configuration change, ensuring graceful error handling. /// + /// [Test] public async Task UpdateHistoricalConfigChange_WhenExceptionOccurs_ReturnsNull() { diff --git a/adas-core.Test/Services/InMemoryLockProviderTest.cs b/adas-core.Test/Services/InMemoryLockProviderTest.cs index 67da4572..158fa21a 100644 --- a/adas-core.Test/Services/InMemoryLockProviderTest.cs +++ b/adas-core.Test/Services/InMemoryLockProviderTest.cs @@ -18,6 +18,7 @@ public class InMemoryLockProviderTest /// /// Initializes a fresh instance for the test fixture, ensuring each test starts with a clean, isolated provider state. /// + /// [SetUp] public void SetUp() { @@ -28,6 +29,7 @@ public class InMemoryLockProviderTest /// Retrieves the private _locks dictionary from the associated instance using reflection, exposing the underlying locks for inspection or manipulation in tests. /// /// The mapping lock keys to their instances held by the provider. + /// private ConcurrentDictionary GetLocks() { var field = typeof(InMemoryLockProvider) @@ -39,6 +41,7 @@ public class InMemoryLockProviderTest /// /// Verifies that AcquireAsync returns true and creates a corresponding entry in the locks dictionary when called with a valid key and time span. /// + /// [Test] public async Task AcquireAsync_ReturnsTrue_AndCreatesEntryInLocksDictionary() { @@ -55,6 +58,7 @@ public class InMemoryLockProviderTest /// /// Verifies that AcquireAsync returns false when the semaphore for the specified key is already occupied and the requested timeout expires before the lock can be acquired, and that the underlying semaphore is restored to a count of 1 after release. /// + /// [Test] public async Task AcquireAsync_ReturnsFalse_WhenSemaphoreOccupiedAndTimeoutExpires() { @@ -77,6 +81,7 @@ public class InMemoryLockProviderTest /// allowing a subsequent AcquireAsync for the same key to succeed and the semaphore's /// CurrentCount to transition back to its released value. /// + /// [Test] public async Task ReleaseAsync_MakesSemaphoreAvailableForNextAcquire() { @@ -100,6 +105,7 @@ public class InMemoryLockProviderTest /// /// Verifies that ReleaseAsync does not throw when invoked without a prior AcquireAsync for the given key, and remains safe to call multiple times after a single successful acquire. /// + /// [Test] public async Task ReleaseAsync_DoesNotThrow_WhenCalledWithoutPriorAcquire() { @@ -115,6 +121,7 @@ public class InMemoryLockProviderTest /// /// Verifies that AcquireAsync is thread-safe for a given key, ensuring that only one caller can hold the semaphore at a time even when multiple tasks compete concurrently for the same key, and that a single semaphore instance is created and reused per key. /// + /// [Test] public async Task AcquireAsync_IsThreadSafe_OnlyOneHolderAtATime_SingleSemaphorePerKey() { diff --git a/adas-core.Test/Services/LightBeaconServiceTest.cs b/adas-core.Test/Services/LightBeaconServiceTest.cs index 59551f22..210fd784 100644 --- a/adas-core.Test/Services/LightBeaconServiceTest.cs +++ b/adas-core.Test/Services/LightBeaconServiceTest.cs @@ -27,6 +27,7 @@ public class LightBeaconServiceTest /// and instantiating the under test with those mocks. /// This setup runs before each test to ensure a clean, isolated test environment. /// + /// [SetUp] public void Setup() { @@ -66,6 +67,7 @@ public class LightBeaconServiceTest /// /// Integration test that verifies the light beacon service returns for a given point of care when the patient has no associated beacon color. /// + /// [Ignore("Integration test")] [Test] public async Task GetBeaconColor() diff --git a/adas-core.Test/Services/MasterListServiceTest.cs b/adas-core.Test/Services/MasterListServiceTest.cs index eb70cf2e..afc9b091 100644 --- a/adas-core.Test/Services/MasterListServiceTest.cs +++ b/adas-core.Test/Services/MasterListServiceTest.cs @@ -25,6 +25,7 @@ public class MasterListServiceTest /// for use in unit tests. Configures the HTTP context with a test user principal, registers the master list repository /// in the service provider, and supplies default API settings. /// + /// [SetUp] public void Setup() { @@ -95,6 +96,7 @@ public class MasterListServiceTest /// /// Verifies that DeleteMasterListById invokes the repository's Delete method once with the provided identifier when the master list is found. /// + /// [Test] public async Task DeleteMasterListById_ShouldCallRepositoryDelete_WhenMasterListFound() { @@ -132,6 +134,7 @@ public class MasterListServiceTest /// /// Verifies that the service returns the master list when it is found by the specified id. /// + /// [Test] public async Task GetMasterListById_ShouldReturnMasterList_WhenFound() { @@ -151,6 +154,7 @@ public class MasterListServiceTest /// /// Verifies that GetMasterListByName returns the matching when a master list with the specified name is found in the repository. /// + /// [Test] public async Task GetMasterListByName_ShouldReturnMasterList_WhenFound() { @@ -170,6 +174,7 @@ public class MasterListServiceTest /// /// Verifies that the InsertMasterList service method returns the same instance that was inserted, ensuring the service correctly retrieves the inserted entity by its identifier after persistence. /// + /// [Test] public async Task InsertMasterList_ShouldReturnInsertedMasterList() { @@ -191,6 +196,7 @@ public class MasterListServiceTest /// Verifies that UpdateMasterList returns the updated master list when the repository successfully completes the update and finds the entity by id. /// /// A representing the asynchronous test execution. + /// [Test] public async Task UpdateMasterList_ShouldReturnUpdatedMasterList() { diff --git a/adas-core.Test/Services/MedicineServiceTest.cs b/adas-core.Test/Services/MedicineServiceTest.cs index b68a7918..683c2460 100644 --- a/adas-core.Test/Services/MedicineServiceTest.cs +++ b/adas-core.Test/Services/MedicineServiceTest.cs @@ -68,6 +68,8 @@ public class MedicineServiceTest /// /// Thrown when the local collection is null. /// + /// [Test] public async Task GetMedicinesOfTreatments_Null_Medicine_Return_0() { diff --git a/adas-core.Test/Services/NoCacheServiceTest.cs b/adas-core.Test/Services/NoCacheServiceTest.cs index e05c56c7..1fb2fc51 100644 --- a/adas-core.Test/Services/NoCacheServiceTest.cs +++ b/adas-core.Test/Services/NoCacheServiceTest.cs @@ -15,6 +15,7 @@ public class NoCacheServiceTest /// Initializes a fresh instance and assigns it to _noCacheService /// to provide a clean, dependency-free test fixture prior to executing each test. /// + /// [SetUp] public void SetUp() { @@ -87,6 +88,7 @@ public class NoCacheServiceTest /// /// Verifies that the no-cache service implementation never persists data to any backend when GetOrSetObjectAsync is invoked, and confirms that a subsequent DeleteObjectAsync on the same key does not throw. /// + /// [Test] public async Task GetOrSetObjectAsync_DoesNotStoreData_InAnyBackend() { @@ -114,6 +116,7 @@ public class NoCacheServiceTest /// /// Verifies that the no-cache service's DeleteByPatternAsync returns 0 and does not throw when invoked with arbitrary patterns, confirming the no-op delete behavior for any key pattern. /// + /// [Test] public async Task DeleteByPatternAsync_ReturnsZero_DoesNotThrow() { @@ -134,6 +137,7 @@ public class NoCacheServiceTest /// Verifies that calling CleanCache on the no-cache service is a safe no-op that does not throw, /// and that subsequent calls to GetValue consistently return null for any key. /// + /// [Test] public void CleanCache_IsNoOp_DoesNotThrow() { @@ -149,6 +153,7 @@ public class NoCacheServiceTest /// /// Verifies that calling SetValue on the no-cache service is a no-op and does not throw any exception. /// + /// [Test] public void SetValue_IsNoOp_DoesNotThrow() { @@ -163,6 +168,7 @@ public class NoCacheServiceTest /// Verifies that the no-cache service's GetValue method returns null for any key, /// confirming that the no-op implementation does not return or simulate cached values. /// + /// [Test] public void GetValue_IsNoOp_ReturnsNull() { diff --git a/adas-core.Test/Services/ObservationServiceTest.cs b/adas-core.Test/Services/ObservationServiceTest.cs index cfdb6590..a3480064 100644 --- a/adas-core.Test/Services/ObservationServiceTest.cs +++ b/adas-core.Test/Services/ObservationServiceTest.cs @@ -31,6 +31,7 @@ public class ObservationServiceTest /// and pre-configuring common lookup behavior for the default "UCI5C" unit (including FindByName /// and FindById) along with the ICalculatedObservationsService.Map passthrough. /// + /// [SetUp] public void Setup() { @@ -668,6 +669,7 @@ public class ObservationServiceTest /// /// Verifies that when an isolation observation is processed through SaveRequest, the configuration observation and units mapping services are invoked, and the resulting mapped observation is inserted into the observation repository with the expected value, patient identifier, name, time, message time, and coding system. /// + /// [Test] public async Task ProcessIsolationObservation_Return_IsolationObs() { @@ -755,6 +757,7 @@ public class ObservationServiceTest /// /// Verifies that processing a position observation through the observation service persists a new with the expected values (Value, PatientId, Name, Time, MessageTime, and CodingSystem) when a valid API request is provided. /// + /// [Test] public async Task ProcessPositionObservation_Return_PositionObs() { diff --git a/adas-core.Test/Services/PatientServiceTest.cs b/adas-core.Test/Services/PatientServiceTest.cs index b56d8616..2f2c696b 100644 --- a/adas-core.Test/Services/PatientServiceTest.cs +++ b/adas-core.Test/Services/PatientServiceTest.cs @@ -30,6 +30,7 @@ internal class PatientServiceTest /// dependencies and pre-configuring common lookup scenarios for units and points of care, including virtual /// point of care states (Pushed, Moved, Deleted, Cancelled, Recovered, Unknown) used across test cases. /// + /// [SetUp] public void Setup() { @@ -320,6 +321,7 @@ internal class PatientServiceTest /// /// Verifies that the patient service correctly retrieves a patient from the database by matching the patient number supplied in the API request, returning a patient populated with the expected unit, point of care, and patient number values. /// + /// [Test] public async Task Find_Patient_By_APIRequest_Get_Patient_By_PatientNumber() { @@ -371,6 +373,7 @@ internal class PatientServiceTest /// Verifies that creates a new patient record /// when the requested patient does not exist and the CreatePatientWithOru option is set to true. /// + /// [Test] public async Task Find_Patient_By_APIRequest_Not_Exists_CreatePatientWithORU_True_Created_Patient() { @@ -445,6 +448,7 @@ internal class PatientServiceTest /// while the target location is already occupied by another patient, and the CreatePatientWithOru /// option is enabled, the service creates a new patient in a temporal bed instead of reusing the occupied location. /// + /// [Test] public async Task Find_Patient_By_APIRequest_Not_Exists_And_Location_Ocuped_CreatePatientWithORU_True_Created_In_Temporal_Bed() @@ -530,6 +534,7 @@ internal class PatientServiceTest /// the is not created in the temporal bed because CreatePatientWithOru is set to false. /// Ensures that FindPatientByApiRequest returns null and that the repository's InsertOneAsync is never invoked. /// + /// [Test] public async Task Find_Patient_By_APIRequest_Not_Exists_CreatePatientWithORU_False_Not_Created_In_Temporal_Bed() { @@ -596,6 +601,7 @@ internal class PatientServiceTest /// /// Verifies that when a patient is found by API request and the patient already exists in a different location in the database, the patient's location is not changed by the lookup operation. /// + /// [Test] public async Task Find_Patient_By_APIRequest_Exists_In_Different_Location_NOT_Changes_Patient_Location() { @@ -648,6 +654,7 @@ internal class PatientServiceTest /// Verifies that an ADT_A01 request correctly inserts a new patient into the specified unit and bed location /// by ensuring the patient repository is updated with the matching unit, bed, and patient number. /// + /// [Test] public async Task ADT_A01_New_Patient_Empty_Bed_Insert_In_Location() { @@ -679,6 +686,7 @@ internal class PatientServiceTest /// Verifies that when an ADT_A01 request for a new patient is processed with an unknown location /// (i.e., the location mapping resolves to null), the patient is not inserted into the repository. /// + /// [Test] public async Task ADT_A01_New_Patient_Unknown_Location_Insert_Nothing() { @@ -708,6 +716,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A01 admission request is received for a new patient targeting a bed that is already in use by an existing patient, the existing patient is moved to the temporal (pushed) bed while the new patient is admitted to the original bed. /// + /// [Test] public async Task ADT_A01_New_Patient_Bed_In_Use_Moves_Existing_Patient_To_Temporal_Bed() { @@ -839,6 +848,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A01 (Admit) message is received for a patient whose bed is already in use and whose patient number matches an existing patient, the patient's demographic data is updated while preserving the bed assignment and existing identifiers. /// + /// [Test] public async Task ADT_A01_New_Patient_Bed_In_Use_With_Same_Patient_Number_Updates_Demographic_Data() { @@ -910,6 +920,10 @@ internal class PatientServiceTest /// /// Verifies that processing an ADT_A05 message for a new patient in a new bed (PatientLocation) results in the patient being updated with the correct unit, point of care, and patient number, and that the point-of-care mapping service is invoked to create the location. /// + /// + /// [Test] public async Task ADT_A05_New_Patient_New_Bed_Creates_Location() { @@ -944,6 +958,7 @@ internal class PatientServiceTest /// the existing patient in that bed is moved to a temporal PointOfCare, while the new patient /// is assigned to the original PointOfCare location. /// + /// [Test] public async Task ADT_A05_New_Patient_Bed_In_Use_Moves_Existing_Patient_To_Temporal_Bed() { @@ -1001,6 +1016,7 @@ internal class PatientServiceTest /// Verifies that when an ADT_A03 (End Visit) message is processed for a patient that does not exist, /// the patient repository's Update operation is never invoked, ensuring the system takes no action. /// + /// [Test] public async Task ADT_A03_END_VISIT_PATIENT_NOT_EXISTS_DO_NOTHING() { @@ -1032,6 +1048,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A03 (End Visit) request is processed for a patient that already exists in the database, the patient record is updated with the deleted Point of Care, the unit identifier is preserved, and the next admission check is triggered for the original Point of Care. /// + /// [Test] public async Task ADT_A03_END_VISIT_PATIENT_EXISTS() { @@ -1177,6 +1194,7 @@ internal class PatientServiceTest /// service to resolve the destination location, ensuring the save operation results in a single /// insert for the new patient. /// + /// [Test] public async Task ADT_A02_TRANSFER_PATIENT_FROM_NOT_EXISTS_BED_TO_BED_SHOULD_CREATE_PATIENT() { @@ -1223,6 +1241,7 @@ internal class PatientServiceTest /// /// Tests the ADT_A02 transfer scenario where a patient is transferred from their current bed to a bed that is already occupied by another patient, verifying that the existing patient is moved to a new location, the transferring patient occupies the destination bed, and related discharge and next-admission checks are invoked. /// + /// [Test] public async Task ADT_A02_TRANSFER_PATIENT_FROM_BED_TO_IN_USE_BED() { @@ -1298,6 +1317,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A02 transfer message is processed for a patient moving from a location with no existing patient to a bed that is already occupied, the previously assigned patient is moved to a temporal bed and the new patient is inserted into the vacated bed. /// + /// [Test] public async Task ADT_A02_TRANSFER_PATIENT_FROM_NOT_EXISTS_TO_NOT_EMPTY_BED_SHOULD_CHANGE_LAST_PATIENT_TO_TEMPORTAL_BED() @@ -1354,6 +1374,7 @@ internal class PatientServiceTest /// /// Verifies that processing an ADT_A02 transfer request for a patient whose patient number already exists in the destination bed updates the existing patient's demographic data instead of creating a new patient record. /// + /// [Test] public async Task ADT_A02_TRANSFER_PATIENT_FROM_NOT_EXISTS_BED_TO_NOT_EMPTY_BED_WITH_SAME_PATIENT_NUMBER_SHOULD_UPTADE_DEMOGRAPHIC_DATA() @@ -1411,6 +1432,7 @@ internal class PatientServiceTest /// /// Verifies that processing an ADT_A04 message for a new patient successfully creates and persists a patient record with the expected unit, point of care, and patient number. /// + /// [Test] public async Task ADT_A04_New_Patient_Creates_Patient() { @@ -1443,6 +1465,7 @@ internal class PatientServiceTest /// /// Verifies that when processing an ADT_A04 request for a new patient with a location whose POC mapping returns null, the patient is not persisted to the repository. /// + /// [Test] public async Task ADT_A04_New_Patient_Not_Location_Creates_Patient() { @@ -1473,6 +1496,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A08 request is received for a non-existent patient and the CreatePatientWithAdtA08 option is enabled, the correctly creates the patient by calling the patient repository's Update method with the expected UnitId, PointOfCareId, and PatientNumber values. /// + /// [Test] public async Task ADT_A08_No_exist_CreatePatientWithADT_A08_True_Patient_Creates_Patient() { @@ -1541,6 +1565,7 @@ internal class PatientServiceTest /// Verifies that when an ADT_A08 message is processed for a patient that does not exist and the /// CreatePatientWithAdtA08 option is disabled, the patient is not inserted into the repository. /// + /// [Test] public async Task ADT_A08_No_exist_Patient_Not_Creates_Patient() { @@ -1608,6 +1633,7 @@ internal class PatientServiceTest /// and patient creation on ADT_A08 is disabled, the patient is updated rather than created. /// /// A task that represents the asynchronous test execution. + /// [Test] public async Task ADT_A08_Exist_Patient_Update_Patient() { @@ -1681,6 +1707,7 @@ internal class PatientServiceTest /// /// Verifies that processing an ADT_A11 (cancel admit/visit notification) message for an existing patient updates the patient's location to the cancelled point of care, leaving unit, patient number, and identity fields unchanged. /// + /// [Test] public async Task ADT_A11_Exist_Patient_CANCELLED_Patient() { @@ -1757,6 +1784,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A11 (cancel admit/visit notification) request is processed for a non-existent patient, the patient repository's UpdateOneAsync method is never invoked, since there is no existing patient record to update. /// + /// [Test] public async Task ADT_A11_No_Exist_Patient_Not_CANCELLED_Patient() { @@ -1819,6 +1847,7 @@ internal class PatientServiceTest /// Verifies that processing an ADT_A12 transfer message for a non-existing patient to an empty bed /// results in the patient being created and assigned to the target bed via the point-of-care mapping. /// + /// [Test] public async Task ADT_A12_TRANSFER_PATIENT_NOT_EXISTS_TO_EMPTY_BED_SHOULD_CREATE_BED() { @@ -1852,6 +1881,7 @@ internal class PatientServiceTest /// creates the bed (represented by a new point of care) and persists the patient's transfer to that /// new location under the configured unit. /// + /// [Test] public async Task ADT_A12_TRANSFER_PATIENT_FROM_BED_TO_NOT_EXISTS_BED_SHOULD_CREATE_BED() { @@ -1893,6 +1923,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A12 transfer request is processed, the new patient occupying the target bed has their data updated while the displaced patient is relocated to a different point of care, and that the legacy Update method is not invoked. /// + /// [Test] public async Task ADT_A12_TRANSFER_PATIENT_FROM_BED_TO_IN_USE_BED() { @@ -1967,6 +1998,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A12 transfer is processed for a patient moving to a bed that is already occupied, the existing patient in that bed is moved to a temporary bed (different Point of Care), and the transferred patient is inserted into the target bed. /// + /// [Test] public async Task ADT_A12_TRANSFER_PATIENT_NOT_EXISTS_TO_NOT_EMPTY_BED_SHOULD_CHANGE_LAST_PATIENT_TO_TEMPORTAL_BED() @@ -2021,6 +2053,8 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A13 transfer request is processed for a patient moving to a bed that is already occupied, the previously assigned patient in that bed is moved to a temporal bed while the transferring patient is persisted in the requested location. /// + /// [Test] public async Task ADT_A13_TRANSFER_PATIENT_NOT_EXISTS_TO_NOT_EMPTY_BED_SHOULD_CHANGE_LAST_PATIENT_TO_TEMPORTAL_BED() @@ -2063,6 +2097,7 @@ internal class PatientServiceTest /// /// Verifies that processing an ADT_A13 transfer request for a patient assigned to a deleted point of care moves the patient to the recovered (temporal) bed location. /// + /// [Test] public async Task ADT_A13_TRANSFER_PATIENT_NOT_EXISTS_TO_EMPTY_BED_SHOULD_CHANGE_LAST_PATIENT_TO_TEMPORTAL_BED() { @@ -2112,6 +2147,7 @@ internal class PatientServiceTest /// Verifies that processing an ADT_A31 (Update Patient) HL7 request correctly updates the existing patient's demographic /// information (last name and birth date) while preserving the assigned unit and point of care identifiers. /// + /// [Test] public async Task ADT_A31_Upadate_Patient() { @@ -2159,6 +2195,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A31 update request is processed for a patient that does not exist, the patient is not updated. Ensures the repository's Update method is never invoked in the not-found scenario. /// + /// [Test] public async Task ADT_A31_Upadate_Patient_Not_Found_Not_Update() { @@ -2191,6 +2228,7 @@ internal class PatientServiceTest /// /// Verifies that when an ADT_A39 merge patient request is processed, the old patient record is deleted after the new patient is resolved through the point-of-care mapping and patient repository lookups. /// + /// [Test] public async Task ADT_A39_Merge_Patient() { @@ -2246,6 +2284,7 @@ internal class PatientServiceTest /// Verifies that when an ADT_A39 request is processed and the patient is not an old patient (i.e., not a merge case), /// the does not delete the existing patient from the repository. /// + /// [Test] public async Task ADT_A39_Not_OldPatient_Not_Merge_Patient() { @@ -2285,6 +2324,7 @@ internal class PatientServiceTest /// /// Verifies that processing an ADT_A39 (merge patient) request does not result in the deletion of the old patient record, even when the old patient is located by number. /// + /// [Test] public async Task ADT_A39_Not_Patient_Not_Merge_Patient() { @@ -2328,6 +2368,7 @@ internal class PatientServiceTest /// /// Verifies that the patient service correctly handles an ADT_A44 patient merge/update request by locating the existing patient via the old patient number and updating it in the repository with the new patient information. /// + /// [Test] public async Task ADT_A44_Upadate_Patient() { @@ -2369,6 +2410,7 @@ internal class PatientServiceTest /// /// Verifies that processing an ADT_A44 request for a patient that is not an old patient does not trigger a patient update. /// + /// [Test] public async Task ADT_A44_Not_OldPatient_Not__Upadate_Patient() { @@ -2402,6 +2444,7 @@ internal class PatientServiceTest /// through the patient service by calling SaveRequest with an ApiRequest of type "ICCA" containing four /// patients located in different points of care, and confirms each one is persisted exactly once via the repository. /// + /// [Test] public async Task ICCA_Process_No_Patient_BD_Insert_ICCA_Patients() { @@ -2470,6 +2513,7 @@ internal class PatientServiceTest /// /// Verifies that when an ICCA patient request is processed and a patient already exists in the database at the same point of care but with a different patient number, the existing patient is updated to the moved point of care and the new ICCA patient is inserted. /// + /// [Test] public async Task ICCA_Process_Patient_BD_Insert_ICCA_Patient_Pushed_Actual_Patient() { @@ -2527,6 +2571,7 @@ internal class PatientServiceTest /// and the ICCA patients collection is empty, the existing patient is updated with the UNKNOWN /// PointOfCareId and no new patient is inserted into the repository. /// + /// [Test] public async Task ICCA_Process_Patient_BD_No_Insert_ICCA_Patient_UNKNOWN_Actual_Patient() { diff --git a/adas-core.Test/Services/PointOfCareServiceTest.cs b/adas-core.Test/Services/PointOfCareServiceTest.cs index ff90d20e..947d17c5 100644 --- a/adas-core.Test/Services/PointOfCareServiceTest.cs +++ b/adas-core.Test/Services/PointOfCareServiceTest.cs @@ -29,6 +29,7 @@ public class PointOfCareServiceTests /// Configures repository, service, cache, admission, unit, and HTTP context mocks, including a simulated authenticated user /// and cache behavior that invokes the supplied factory directly to return the produced instance. /// + /// [SetUp] public void SetUp() { @@ -84,6 +85,7 @@ public class PointOfCareServiceTests /// when invoked with a valid whose associated admission is null, ensuring /// the underlying repository's delete operation is invoked. /// + /// [Test] public async Task Delete_ValidObjectId_DeletesPointOfCare() { @@ -105,6 +107,7 @@ public class PointOfCareServiceTests /// instance by delegating the operation to the underlying repository. /// /// A representing the asynchronous test execution. + /// [Test] public async Task Update_ValidPointOfCare_UpdatesPointOfCare() { @@ -122,6 +125,7 @@ public class PointOfCareServiceTests /// /// Verifies that returns the complete list of point of care records provided by the repository when invoked with no arguments. /// + /// [Test] public async Task GetAll_NoArguments_ReturnsListOfPointOfCare() { @@ -139,6 +143,7 @@ public class PointOfCareServiceTests /// /// Verifies that throws a when invoked with a valid id and configuration, ensuring the service surfaces conflict conditions during the update operation. /// + /// [Test] public void UpdateConfiguration_ValidIdAndConfiguration_InvokesRepositoryUpdateConfiguration() { @@ -157,6 +162,7 @@ public class PointOfCareServiceTests /// /// Verifies that FindById returns the expected when a valid identifier is provided. /// + /// [Test] public async Task FindById_ValidId_ReturnsPointOfCare() { @@ -196,6 +202,7 @@ public class PointOfCareServiceTests /// /// Verifies that returns the expected list of point-of-care records when invoked with a valid unit identifier and status. /// + /// [Test] public async Task FindByUnitAndStatus_ValidUnitIdAndStatus_ReturnsListOfPointOfCare() { @@ -300,6 +307,7 @@ public class PointOfCareServiceTests /// /// Tests that the service's FindByRoom method, when called with a valid room, returns the collection provided by the repository and invokes the repository's FindByRoom exactly once. /// + /// [Test] public async Task FindByRoom_ValidRoom_CallsRepositoryFindByRoom() { @@ -319,6 +327,7 @@ public class PointOfCareServiceTests /// /// Verifies that the method correctly delegates to the repository's FindByBed method when a valid bed identifier is provided, returning the expected collection of point of care records. /// + /// [Test] public async Task FindByBed_ValidBed_CallsRepositoryFindByBed() { diff --git a/adas-core.Test/Services/PublisherServiceTest.cs b/adas-core.Test/Services/PublisherServiceTest.cs index a6e46af2..eb7f4b3a 100644 --- a/adas-core.Test/Services/PublisherServiceTest.cs +++ b/adas-core.Test/Services/PublisherServiceTest.cs @@ -21,6 +21,7 @@ public class PublisherServiceTest /// /// Initializes the test environment for by configuring RabbitMQ settings, creating a mocked logger, and instantiating the service under test. /// + /// [SetUp] public void Setup() { @@ -50,6 +51,7 @@ public class PublisherServiceTest /// /// Verifies that the publisher service's SendMessage method returns a non-null result when sending a message to the observations queue. /// + /// [Test] public void SendMessage_Return_true() { @@ -63,6 +65,7 @@ public class PublisherServiceTest /// /// Verifies that SendMessageError returns a non-null result when publishing a new to the observations queue. /// + /// [Test] public void SendMessage_Error_Return_true() { diff --git a/adas-core.Test/Services/PumpServiceTest.cs b/adas-core.Test/Services/PumpServiceTest.cs index 90bd7fda..230df099 100644 --- a/adas-core.Test/Services/PumpServiceTest.cs +++ b/adas-core.Test/Services/PumpServiceTest.cs @@ -50,6 +50,7 @@ public class PumpServiceTest /// /// Initializes the unit test fixture by creating mock repositories, services, and a mocked with a test claims principal, then instantiates the under test using the configured API settings (5-second pump expiration, zero pump messages disabled). Pass-through mappings are configured for , , and so that supplied pump observations are returned unchanged. /// + /// [SetUp] public void Setup() { @@ -115,6 +116,7 @@ public class PumpServiceTest /// Verifies that processing does not insert any records /// when the request is saved without associated observations. /// + /// [Test] public async Task SaveRequest_Returns_When_No_Observations() { @@ -126,6 +128,7 @@ public class PumpServiceTest /// /// Verifies that SaveRequest does not insert a when the is an unrecognized value. /// + /// [Test] public async Task SaveRequest_UnknownType_DoesNotInsert() { @@ -143,6 +146,7 @@ public class PumpServiceTest /// Verifies that SaveRequest converts a single PumpObservation on an incoming /// ApiRequest into a list with one entry on the request after processing. /// + /// [Test] public async Task SaveRequest_Converts_SingleObservation_ToList() { @@ -164,6 +168,7 @@ public class PumpServiceTest /// /// Verifies that Service.SaveRequest sets the Expires property of the before persisting it via the repository. /// + /// [Test] public async Task SaveRequest_SetsExpires_BeforeInsert() { @@ -196,6 +201,7 @@ public class PumpServiceTest /// and does not create a , ensuring alarm-phase events are /// routed to the alarm event store rather than the observation store. /// + /// [Test] public async Task SaveRequest_ORU_R40_CreatesAlarmEvent() { @@ -221,6 +227,7 @@ public class PumpServiceTest /// Verifies that processing a pump observation with EventPhase.End removes the corresponding alarm state /// by calling RemoveAsync on the alarm state repository with the matching device, alarm type, and MDC code. /// + /// [Test] public async Task ProcessAlarm_End_RemovesAlarmState() { @@ -249,6 +256,7 @@ public class PumpServiceTest /// Verifies that SaveRequest creates and upserts a new /// for the device when no existing pump state is found in the repository. /// + /// [Test] public async Task SaveRequest_CreatesPumpState_IfNotExists() { @@ -273,6 +281,7 @@ public class PumpServiceTest /// Verifies that SaveRequest does not broadcast a message via the client when there are no active subscribers. /// /// A task that completes when the assertion has been executed. + /// [Test] public async Task SaveRequest_NoSubscribers_NoBroadcast() { @@ -372,6 +381,7 @@ public class PumpServiceTest /// DeleteOlderThanDaysAsync method with the configured retention value when the /// retention policy returned for the pump observation is DeleteOlderDays. /// + /// [Test] public async Task SaveRequest_Retention_DeleteOlderDays_CallsRepo() { @@ -399,6 +409,7 @@ public class PumpServiceTest /// Verifies that GetPaginatedPump returns the correct paginated results when filtering by patient identifier. /// Ensures the first page contains the most recent observation within the configured time tolerance. /// + /// [Test] public async Task GetPaginatedPump_ByPatient_Works() { @@ -434,6 +445,7 @@ public class PumpServiceTest /// Verifies that ArchiveByPatientId inserts the patient's pump observations into the archive /// repository and then deletes them, along with their related alarm events and alarm states. /// + /// [Test] public async Task ArchiveByPatientId_InsertsArchive_ThenDeletes() { @@ -459,6 +471,7 @@ public class PumpServiceTest /// Verifies that UpdateManyObjectId correctly updates the patient identifier across observations, alarms, and alarm state repositories. /// /// A task representing the asynchronous test execution. + /// [Test] public async Task UpdateManyObjectId_UpdatesObs_Alarms_States() { @@ -483,6 +496,7 @@ public class PumpServiceTest /// Verifies that FindLastPumpObservations returns pump observations ordered with the most recent first, /// returning only the specified number of latest entries when the repository provides multiple observations. /// + /// [Test] public async Task FindLastPumpObservations_ReturnsOrdered() { @@ -508,6 +522,7 @@ public class PumpServiceTest /// Verifies that InsertPumpObservation persists the observation and upserts the corresponding /// pump state when no existing state is found for the device and there are no active subscribers. /// + /// [Test] public async Task InsertPumpObservation_Inserts_AndBroadcasts() { diff --git a/adas-core.Test/Services/RecordingAlertServiceTest.cs b/adas-core.Test/Services/RecordingAlertServiceTest.cs index 4fdfa25e..3e887db3 100644 --- a/adas-core.Test/Services/RecordingAlertServiceTest.cs +++ b/adas-core.Test/Services/RecordingAlertServiceTest.cs @@ -21,6 +21,7 @@ public class RecordingAlertServiceTest /// /// Initializes the mocked dependencies and test infrastructure required by the unit tests, including service and repository mocks, a fake HTTP context with a "TestUser" claim, and the system-under-test instance. /// + /// [SetUp] public void Setup() { @@ -88,6 +89,7 @@ public class RecordingAlertServiceTest /// /// Verifies that does not persist a when the provided is neither a recording alert nor an ORU R01 message. /// + /// [Test] public async Task SaveRequest_Not_RecordingAlert_Not_ORU_R01_Return_not_insert() { @@ -101,6 +103,7 @@ public class RecordingAlertServiceTest /// /// Verifies that does not insert a when both the patient number and point of care are null in the , even when the message type is "ORU_R11". /// + /// [Test] public async Task SaveRequest_patientNumber_and_pointOfCare_null_Return_not_insert() { @@ -118,6 +121,7 @@ public class RecordingAlertServiceTest /// /// Verifies that the SaveRequest method does not insert a patient recording alert when the specified patient cannot be found. /// + /// [Test] public async Task SaveRequest_Not_Find_Patient_Return_not_insert() { @@ -146,6 +150,7 @@ public class RecordingAlertServiceTest /// /// Verifies that SaveRequest inserts a new into the repository when the configuration observation service returns no retention actions for the given recording alert. /// + /// [Test] public async Task SaveRequest_Alert_Return_insert() { diff --git a/adas-core.Test/Services/RecordingServiceTest.cs b/adas-core.Test/Services/RecordingServiceTest.cs index f7f2dd23..9b40dce5 100644 --- a/adas-core.Test/Services/RecordingServiceTest.cs +++ b/adas-core.Test/Services/RecordingServiceTest.cs @@ -31,6 +31,7 @@ public class RecordingServiceTest /// dependencies (logger, HTTP client factory, publisher, authentication, client message, subscribers, and patient services), /// and configuring the publisher mock to successfully send both regular messages and errors. /// + /// [SetUp] public void Setup() { @@ -108,6 +109,7 @@ public class RecordingServiceTest /// /// Verifies that returns an empty collection of when the HTTP response indicates an unauthorized (401) status, ensuring the service correctly handles failed authentication scenarios by yielding no recordings rather than throwing or returning null. /// + /// [Test] public async Task GetRecordings_Return_Empty() { @@ -138,6 +140,7 @@ public class RecordingServiceTest /// when the HTTP endpoint responds with a successful payload containing a recording and its associated patient. /// Asserts that the returned items match the source data for status, room identifier, and patient identity fields. /// + /// [Test] public async Task GetRecordings_Return_RecordingData() { @@ -187,6 +190,7 @@ public class RecordingServiceTest /// /// Tests that calling SaveRequest on the recording service throws a when supplied with an , using a mocked HTTP message handler that returns a successful response. /// + /// [Test] public Task SaveRequest() { diff --git a/adas-core.Test/Services/RedisLockProviderTest.cs b/adas-core.Test/Services/RedisLockProviderTest.cs index 61681d50..45704cf7 100644 --- a/adas-core.Test/Services/RedisLockProviderTest.cs +++ b/adas-core.Test/Services/RedisLockProviderTest.cs @@ -21,6 +21,7 @@ public class RedisLockProviderTest /// /// Initializes the test environment by creating a mock and instantiating a configured to use the mocked database. /// + /// [SetUp] public void SetUp() { @@ -32,6 +33,7 @@ public class RedisLockProviderTest /// /// Verifies that AcquireAsync returns true, stores the lock token under the lock: prefixed key, applies the configured TTL, and uses the When.NotExists flag when Redis accepts the NX SET operation. Also asserts that a subsequent ReleaseAsync invokes the Redis release script. /// + /// [Test] public async Task AcquireAsync_ReturnsTrue_AndStoresToken_WhenRedisAcceptsNxSet() { @@ -78,6 +80,7 @@ public class RedisLockProviderTest /// Asserts the call is retried the expected number of times and that the elapsed time confirms /// delays were actually applied between attempts. /// + /// [Test] public async Task AcquireAsync_RetriesWithDelays_UntilNxSucceeds() { @@ -112,6 +115,7 @@ public class RedisLockProviderTest /// /// Verifies that AcquireAsync returns false and performs multiple retry attempts when the underlying lock acquisition operation consistently fails within the specified timeout. /// + /// [Test] public async Task AcquireAsync_ReturnsFalse_AfterTimeoutWithMultipleRetries() { @@ -142,6 +146,7 @@ public class RedisLockProviderTest /// /// Verifies that releasing a lock invokes the Lua script evaluation with the correct lock key (prefixed with "lock:") and the token previously captured during lock acquisition. /// + /// [Test] public async Task ReleaseAsync_CallsScriptEvaluateWithCorrectKeyAndToken() { @@ -181,6 +186,7 @@ public class RedisLockProviderTest /// Verifies that ReleaseAsync is idempotent when invoked without a prior acquire operation, /// ensuring that no script evaluation is performed on the underlying database in this scenario. /// + /// [Test] public async Task ReleaseAsync_IsIdempotent_WhenCalledWithoutPriorAcquire() { diff --git a/adas-core.Test/Services/RedisServiceTest.cs b/adas-core.Test/Services/RedisServiceTest.cs index d3cb5c22..bb9b26c3 100644 --- a/adas-core.Test/Services/RedisServiceTest.cs +++ b/adas-core.Test/Services/RedisServiceTest.cs @@ -24,6 +24,7 @@ public class RedisServiceTest /// /// Initializes test dependencies before each test execution by creating a mock instance and instantiating the with a mocked logger and an in-memory lock provider. /// + /// [SetUp] public void SetUp() { @@ -40,6 +41,7 @@ public class RedisServiceTest /// Optional cache settings to apply; when null, a new default instance is used. /// Flag indicating whether the Redis service should be marked as available; defaults to true. /// A instance with the database and availability state initialized for testing. + /// private RedisService CreateSut(CacheSettings? settings = null, bool redisAvailable = true) { var sut = new RedisService( @@ -59,6 +61,7 @@ public class RedisServiceTest /// The instance whose field will be set. /// The name of the non-public instance field to assign. /// The value to assign to the field. Can be null. + /// private static void SetField(object target, string name, object? value) => typeof(RedisService) .GetField(name, BindingFlags.NonPublic | BindingFlags.Instance)! @@ -67,6 +70,7 @@ public class RedisServiceTest /// /// Configures the mock database to return a successful result (true) for any invocation of StringSetAsync, regardless of the supplied key, value, expiry, overwrite flag, condition, or command flags. /// + /// private void SetupStringSetAsync() => _mockDb .Setup(db => db.StringSetAsync( @@ -77,6 +81,7 @@ public class RedisServiceTest /// /// Configures the mock Redis database to handle KeyExpire calls by returning true for any combination of key, expiration, condition, and command flag arguments. /// + /// private void SetupKeyExpire() => _mockDb .Setup(db => db.KeyExpire( @@ -88,6 +93,7 @@ public class RedisServiceTest /// /// Verifies that GetOrSetObjectAsync invokes the supplied factory when Redis is unavailable, returning the factory's result without attempting any Redis read or write operations. /// + /// [Test] public async Task GetOrSetObjectAsync_ExecutesFactory_WhenRedisUnavailable() { @@ -111,6 +117,7 @@ public class RedisServiceTest /// when a value is present in the cache, without invoking the factory delegate and without /// attempting to write back to Redis. /// + /// [Test] public async Task GetOrSetObjectAsync_ReturnsCachedObject_WhenRedisHit() { @@ -138,6 +145,7 @@ public class RedisServiceTest /// Verifies that GetObjectAsync calls the underlying Redis KeyExpire command with the configured TTL /// when the updateExpiration flag is set to true, ensuring cache entries are refreshed upon a successful hit. /// + /// [Test] public async Task GetObjectAsync_CallsKeyExpire_WhenUpdateExpirationIsTrue() { @@ -167,6 +175,7 @@ public class RedisServiceTest /// Verifies that GetObjectAsync does not invoke the Redis key expiration command /// when the caller explicitly requests that the existing expiration be left unchanged. /// + /// [Test] public async Task GetObjectAsync_DoesNotCallKeyExpire_WhenUpdateExpirationIsFalse() { @@ -190,6 +199,7 @@ public class RedisServiceTest /// Ensures the factory delegate is executed, the deserialized value matches the factory output, and the /// object is written to cache with the expected expiration. /// + /// [Test] public async Task GetOrSetObjectAsync_InvokesFactoryAndPersists_WhenCacheMiss() { @@ -232,6 +242,7 @@ public class RedisServiceTest /// Verifies that when the cache lookup returns no value and the factory delegate produces null, /// the method returns null and does not persist any value to the underlying cache store. /// + /// [Test] public async Task GetOrSetObjectAsync_DoesNotPersist_WhenFactoryReturnsNull() { @@ -256,6 +267,7 @@ public class RedisServiceTest /// Verifies that GetObjectAsync successfully retrieves and deserializes the stored object while skipping the /// key-expiration refresh when updateExpiration is set to false, ensuring KeyExpire is never invoked. /// + /// [Test] public async Task GetObjectAsync_ReturnsObject_AndSkipsKeyExpire_WhenUpdateExpirationFalse() { @@ -280,6 +292,7 @@ public class RedisServiceTest /// Verifies that SetObjectAsync serializes the supplied object to JSON and persists it in Redis /// with the entity-specific TTL (600 seconds) configured for the "Patients" entity in . /// + /// [Test] public async Task SetObjectAsync_SerializesToJson_AndPersistsWithEntityTtl() { diff --git a/adas-core.Test/Services/RelayServiceTest.cs b/adas-core.Test/Services/RelayServiceTest.cs index 546b6fda..a766d620 100644 --- a/adas-core.Test/Services/RelayServiceTest.cs +++ b/adas-core.Test/Services/RelayServiceTest.cs @@ -23,6 +23,7 @@ public class RelayServiceTest /// /// Sets up the test environment by initializing mocks and dependencies required for unit testing the , including logger, HTTP client factory, HTTP message handler, relay settings, point-of-care service, and relay repository. /// + /// [SetUp] public void Setup() { @@ -62,6 +63,8 @@ public class RelayServiceTest /// /// Verifies that the relay service successfully powers off a relay by issuing an HTTP request through the configured HTTP client factory. /// + /// [Test] public async Task PowerOffAsync() { @@ -100,6 +103,7 @@ public class RelayServiceTest /// /// Verifies that correctly sends a power-on request to the configured relay device using the HTTP client. /// + /// [Test] public async Task PowerOnAsync() { @@ -138,6 +142,7 @@ public class RelayServiceTest /// /// Verifies that CheckRelayStatus returns when the mocked HTTP response indicates the relay is on. /// + /// [Test] public async Task CheckRelayStatus_Return_On() { @@ -226,6 +231,7 @@ public class RelayServiceTest /// driver response does not match a recognized on/off state (e.g., the raw payload "\\Off" is not /// mapped to a known status). /// + /// [Test] public async Task CheckRelayStatus_Return_Unknown() { diff --git a/adas-core.Test/Services/SchedulerServiceTest.cs b/adas-core.Test/Services/SchedulerServiceTest.cs index f431d106..d0b4f6be 100644 --- a/adas-core.Test/Services/SchedulerServiceTest.cs +++ b/adas-core.Test/Services/SchedulerServiceTest.cs @@ -348,6 +348,7 @@ public class SchedulerServiceTest /// Verifies that the is executed when its Quartz.NET trigger fires, /// ensuring the scheduled job invokes the patient discharge process for inactive patients at the configured interval. /// + /// [Test] public void CheckInactivePatientsJob_ShouldExecuteOnTrigger() { @@ -387,6 +388,7 @@ public class SchedulerServiceTest /// when triggered, and that the medicine service is invoked exactly once to retrieve medicines /// for the active treatments of the mocked patients. /// + /// [Test] public void CheckActiveTreatmentsJob_ShouldExecuteOnTrigger() { @@ -460,6 +462,7 @@ public class SchedulerServiceTest /// /// Verifies that the is executed at least once by the Quartz.NET scheduler when triggered with a recurring schedule. /// + /// [Test] public void CheckExpiredObservationsJob_ShouldExecuteOnTrigger() { @@ -493,6 +496,7 @@ public class SchedulerServiceTest /// /// Verifies that the is executed when triggered by the Quartz.NET scheduler, ensuring that the ExpireAlertsAndPowerOffAsync method on the observation service is invoked at least once. /// + /// [Test] public void CheckExpiredAlertsJob_ShouldExecuteOnTrigger() { @@ -527,6 +531,7 @@ public class SchedulerServiceTest /// InsertObservation with a whose Name is not "NEWS", ensuring /// that only NEWS observations are considered for persistence during scheduled execution. /// + /// [Test] public void GetProvidersObservationsJob_ShouldExecuteOnTrigger_Result_GetType_null() { @@ -577,6 +582,7 @@ public class SchedulerServiceTest /// /// Verifies that the is executed when triggered by the Quartz.NET scheduler, confirming that the associated InsertObservation call on the observation service is invoked at least once within the allowed execution window. /// + /// [Test] public void CheckCalculateNewsJob_ShouldExecuteOnTrigger() { @@ -610,6 +616,7 @@ public class SchedulerServiceTest /// /// Verifies that correctly inserts NEWS observations with the expected calculated values (1 and 4) for multiple patients in a single execution. /// + /// [Test] public async Task CalculateNewsJob_Insert_ObsFull_MultiplePatient_With_Correct_Value() { diff --git a/adas-core.Test/Services/SendAlertServiceTest.cs b/adas-core.Test/Services/SendAlertServiceTest.cs index 11be14cf..a808e0c9 100644 --- a/adas-core.Test/Services/SendAlertServiceTest.cs +++ b/adas-core.Test/Services/SendAlertServiceTest.cs @@ -19,6 +19,7 @@ public class SendAlertServiceTest /// RabbitMQ options, a mocked logger, an instance of the service under test, and the set /// of Windows platform identifiers used to validate platform-specific behavior. /// + /// [SetUp] public void Setup() { @@ -54,6 +55,7 @@ public class SendAlertServiceTest /// reading (non-null with a positive ValueTotal) when executed on a Windows platform. When the /// host operating system is not Windows, the test is skipped with an ignore notice. /// + /// [Ignore("Integration test to pull request")] [Test] public void GetConsumedCpu_Return_PerformanceCpu_data() @@ -78,6 +80,7 @@ public class SendAlertServiceTest /// for PercentageConsumed, ValueConsumed, and ValueTotal. The test only executes on /// Windows platforms and is ignored on other operating systems. /// + /// [Ignore("Integration test to pull request")] [Test] public void GetConsumedRAM_Return_PerformanceRAM_data() @@ -104,6 +107,7 @@ public class SendAlertServiceTest /// /// Integration test that verifies the GetConsumedStorage method returns valid Performance data with positive percentage and value metrics for all ready drives on Windows platforms. The test is ignored when executed on a non-Windows platform. /// + /// [Ignore("Integration test to pull request")] [Test] public void GetConsumedStorage_Return_PerformanceStorage_data() diff --git a/adas-core.Test/Services/SeviceConfigServiceTest.cs b/adas-core.Test/Services/SeviceConfigServiceTest.cs index 2a4aaeb5..7ac10476 100644 --- a/adas-core.Test/Services/SeviceConfigServiceTest.cs +++ b/adas-core.Test/Services/SeviceConfigServiceTest.cs @@ -17,6 +17,7 @@ public class ServiceConfigServiceTest /// /// Initializes the test environment by creating mock instances of the service configuration repository and logger, and instantiating the under test. /// + /// [SetUp] public void Setup() { @@ -41,6 +42,7 @@ public class ServiceConfigServiceTest /// Verifies that the service returns a instance /// when retrieving an existing configuration by its string identifier. /// + /// [Test] public async Task Get_Find_Id_Return_ServiceConfig() { @@ -59,6 +61,7 @@ public class ServiceConfigServiceTest /// /// Verifies that the Get method returns a when the specified id is not found by the repository's FindById, falling back to a lookup with any . /// + /// [Test] public async Task Get_Not_Find_Id_Return_ServiceConfig() { diff --git a/adas-core.Test/Services/TreatmentServiceTest.cs b/adas-core.Test/Services/TreatmentServiceTest.cs index 8f5cb4f4..675b043c 100644 --- a/adas-core.Test/Services/TreatmentServiceTest.cs +++ b/adas-core.Test/Services/TreatmentServiceTest.cs @@ -23,6 +23,7 @@ public class TreatmentServiceTest /// /// Initializes the mock dependencies and creates a instance for unit testing. /// + /// [SetUp] public void Setup() { @@ -183,6 +184,7 @@ public class TreatmentServiceTest /// Verifies that saving an without the Case option throws an , preventing the insert operation. /// /// Thrown by the service when the Case option is not provided in the request. + /// [Test] public void SaveRequest_Not_Case_option_Return_not_insert() { @@ -195,6 +197,7 @@ public class TreatmentServiceTest /// /// Verifies that _treatmentService.SaveRequest throws an when the is missing both the patient number and the point of care, preventing insertion of an incomplete request. /// + /// [Test] public void SaveRequest_patientNumber_and_pointOfCare_null_Return_not_insert() { @@ -211,6 +214,7 @@ public class TreatmentServiceTest /// /// Verifies that _treatmentService.SaveRequest does not insert a patient treatment record when the patient cannot be found in the archive. /// + /// [Test] public async Task SaveRequest_Not_Find_Patient_Return_not_insert() { @@ -239,6 +243,7 @@ public class TreatmentServiceTest /// /// Verifies that SaveRequest does not insert a new patient treatment into the treatment archive when an existing patient is found by patient number. /// + /// [Test] public async Task SaveRequest_Find_Patient_Return_insert() { @@ -278,6 +283,7 @@ public class TreatmentServiceTest /// /// Verifies that GetActiveTreatmentsByPatient retrieves the full set of active treatments for the specified patient, returning a non-empty collection that includes all expected treatment records identified by their placer order entity identifiers. /// + /// [Test] public async Task GetActiveTreatmentsByPatient() { diff --git a/adas-core.Test/Services/UnitServiceTest.cs b/adas-core.Test/Services/UnitServiceTest.cs index 94da3b39..acd8fe87 100644 --- a/adas-core.Test/Services/UnitServiceTest.cs +++ b/adas-core.Test/Services/UnitServiceTest.cs @@ -18,6 +18,7 @@ namespace adas_core.Test.Services; /// /// This class is intended to contain test methods that validate the behavior and correctness of the UnitService. /// +/// public class UnitServiceTest { private readonly Mock _auditServiceMock = new(); @@ -35,6 +36,7 @@ public class UnitServiceTest /// Initializes mocked dependencies and a configured instance for each test, /// including a mock with a test user claim. /// + /// [SetUp] public void SetUp() { @@ -72,6 +74,7 @@ public class UnitServiceTest /// /// Verifies that the unit service returns all units retrieved from the repository, including the correct count and content. /// + /// [Test] public async Task GetAll_ShouldReturnAllUnits() { @@ -91,6 +94,7 @@ public class UnitServiceTest /// /// Verifies that the Get method on the unit service returns the expected unit when a valid identifier is provided. /// + /// [Test] public async Task Get_ShouldReturnUnitById() { @@ -110,6 +114,7 @@ public class UnitServiceTest /// /// Verifies that the Get method retrieves a unit by name when the provided identifier is not a valid ObjectId, matching against either the unit's Title or Name. /// + /// [Test] public async Task Get_ShouldReturnUnitByName_WhenIdIsNotObjectId() { @@ -135,6 +140,7 @@ public class UnitServiceTest /// Verifies that _unitService" returns all units retrieved from the repository, /// ensuring the result is not null, contains the expected number of units, and matches the source data. /// + /// [Test] public async Task GetAllUnits_ShouldReturnAllUnits() { @@ -159,6 +165,7 @@ public class UnitServiceTest /// /// Verifies that _unitService.FindById" returns the matching when the repository locates it by id. /// + /// [Test] public async Task GetUnitById_ShouldReturnUnit_WhenFound() { @@ -179,6 +186,7 @@ public class UnitServiceTest /// /// Verifies that GetByName returns the matching unit when a unit with the specified name exists in the repository. /// + /// [Test] public async Task GetUnitByName_ShouldReturnUnit_WhenFound() { @@ -199,6 +207,7 @@ public class UnitServiceTest /// /// Verifies that FindByPatientId returns the associated unit when the patient is found in an active (in-use) point of care. /// + /// [Test] public async Task FindUnitByPatientId_ShouldReturnUnit_WhenPatientFoundInActivePoC() { @@ -229,6 +238,7 @@ public class UnitServiceTest /// /// Verifies that the unit service returns the matching units retrieved from the repository when a call is made to find units by the specified master list identifier and type. /// + /// [Test] public async Task FindUnitsByMasterListId_ShouldReturnUnits_WhenUnitsFound() { @@ -255,6 +265,7 @@ public class UnitServiceTest /// Verifies that the unit service returns the matching units when the repository contains units /// whose point of care matches the specified patient location. /// + /// [Test] public async Task FindByLocation_ShouldReturnUnits_WhenUnitsFound() { @@ -282,6 +293,7 @@ public class UnitServiceTest /// /// Verifies that FindByLocation returns an empty list when no units match the specified patient location. /// + /// [Test] public async Task FindByLocation_ShouldReturnEmptyList_WhenNoUnitsFound() { @@ -301,6 +313,7 @@ public class UnitServiceTest /// Verifies that the unit service returns the expected unit when a valid unit identifier is provided. /// /// A task that represents the asynchronous test execution. + /// [Test] public async Task FindById_ShouldReturnUnit_WhenValidIdProvided() { @@ -321,6 +334,7 @@ public class UnitServiceTest /// Verifies that the unit service's FindById method returns null when invoked with a null identifier, /// ensuring graceful handling of null input without throwing or returning a default entity. /// + /// [Test] public async Task FindById_ShouldReturnNull_WhenNullIdProvided() { @@ -336,6 +350,7 @@ public class UnitServiceTest /// /// Verifies that FindByName retrieves and returns the expected Unit when a valid unit name is provided. /// + /// [Test] public async Task FindByName_ShouldReturnUnit_WhenValidNameProvided() { @@ -356,6 +371,7 @@ public class UnitServiceTest /// /// Verifies that the unit service correctly delegates the insert operation to the repository and returns the inserted unit entity unchanged. /// + /// [Test] public async Task InsertOne_ShouldReturnInsertedUnit() { diff --git a/adas-core.Test/Utilities/CacheKeyClassifierTest.cs b/adas-core.Test/Utilities/CacheKeyClassifierTest.cs index 3cafcaf1..bb9463d5 100644 --- a/adas-core.Test/Utilities/CacheKeyClassifierTest.cs +++ b/adas-core.Test/Utilities/CacheKeyClassifierTest.cs @@ -13,6 +13,8 @@ namespace adas_core.Test.Utilities; /// Provides a that validates the behavior of . /// /// +/// [TestFixture] public class CacheKeyClassifierTest { @@ -20,6 +22,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns when the cache key starts with the "patients" prefix. /// + /// [Test] public void Classify_ReturnsPatients_ForKeyStartingWithPatients() { @@ -37,6 +40,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns when the cache key starts with the "patients:xyz:" prefix. /// + /// [Test] public void Classify_ReturnsPatients_ForKeyStartingWithPatientsXYZ() { @@ -59,6 +63,7 @@ public class CacheKeyClassifierTest /// Verifies that correctly returns /// for a cache key matching the "configDisplays:display:<id>:base" pattern. /// + /// [Test] public void Classify_ReturnsDisplays_ForKeyStartingWithConfigDisplaysBase() { @@ -77,6 +82,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns when the supplied cache key begins with the configDisplays: prefix. /// + /// [Test] public void Classify_ReturnsDisplays_ForKeyStartingWithConfigDisplaysConfig() { @@ -96,6 +102,7 @@ public class CacheKeyClassifierTest /// Verifies that returns /// when the provided cache key starts with the "pumpObs" prefix. /// + /// [Test] public void Classify_ReturnsPumpObservations_ForKeyStartingWithPumpObs() { @@ -115,6 +122,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns when the cache key starts with the "appointments:patient:" prefix. /// + /// [Test] public void Classify_ReturnsAppointments_ForKeyStartingWithAppointmentsPatient() { @@ -131,6 +139,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns when the provided cache key begins with the "appointments:PoC:" segment. /// + /// [Test] public void Classify_ReturnsAppointments_ForKeyStartingWithAppointmentsPoc() { @@ -149,6 +158,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns for cache keys that begin with the "groupedObs:" prefix, such as those following the "groupedObs:HR:patient:{id}" pattern. /// + /// [Test] public void Classify_ReturnsGroupedObservations_ForKeyStartingWithGroupedObs() { @@ -167,6 +177,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns when the supplied cache key starts with the configObservations: prefix. /// + /// [Test] public void Classify_ReturnsConfigObservations_ForKeyStartingWithConfigObservations() { @@ -185,6 +196,7 @@ public class CacheKeyClassifierTest /// /// Verifies that the cache key classifier returns when a key has a prefix that is not recognized. /// + /// [Test] public void Classify_ReturnsUnknown_ForUnrecognizedPrefixDiagnostics() { @@ -201,6 +213,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns when the supplied cache key uses an unrecognized prefix. /// + /// [Test] public void Classify_ReturnsUnknown_ForUnrecognizedPrefixRandom() { @@ -219,6 +232,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns when the cache key is provided in upper case. /// + /// [Test] public void Classify_ReturnsPatients_ForKeyInUpperCase() { @@ -235,6 +249,7 @@ public class CacheKeyClassifierTest /// /// Verifies that correctly returns the entity type when the supplied cache key contains a mixture of uppercase and lowercase characters, confirming that key classification is case-insensitive. /// + /// [Test] public void Classify_ReturnsAppointments_ForKeyInMixedCase() { @@ -253,6 +268,7 @@ public class CacheKeyClassifierTest /// /// Verifies that returns null when the global cache is disabled, regardless of the configured entity-specific cache mode and Redis TTL settings. /// + /// [Test] public void ResolveForEntity_ReturnsNull_WhenGlobalCacheDisabled() { @@ -278,6 +294,7 @@ public class CacheKeyClassifierTest /// Verifies that returns null for every supported entity type /// when caching is globally disabled via set to false. /// + /// [Test] public void ResolveForEntity_ReturnsNull_WhenGlobalDisabled_ForAllEntities() { @@ -310,6 +327,7 @@ public class CacheKeyClassifierTest /// Verifies that returns null when the /// entity mode is set to , regardless of the in-memory TTL configuration. /// + /// [Test] public void ResolveForEntity_ReturnsNull_WhenEntityModeIsNone() { @@ -338,6 +356,7 @@ public class CacheKeyClassifierTest /// (configured via PatientsSeconds) when the cache mode for the entity is set to /// , instead of falling back to the global TTL. /// + /// [Test] public void ResolveForEntity_UsesEntitySpecificTtl_WhenModeIsCache() { @@ -370,6 +389,7 @@ public class CacheKeyClassifierTest /// Verifies that returns the entity-specific Redis TTL (AppointmentsSeconds) /// when the cache mode for the entity is set to . /// + /// [Test] public void ResolveForEntity_UsesRedisTtl_WhenModeIsRedis() { @@ -401,6 +421,7 @@ public class CacheKeyClassifierTest /// Verifies that falls back to the globally configured TTL /// (in seconds) when no entity-specific TTL is defined for the requested entity type. /// + /// [Test] public void ResolveForEntity_UsesGlobalSeconds_WhenNoEntitySpecificTtl() { @@ -431,6 +452,7 @@ public class CacheKeyClassifierTest /// /// Verifies that CacheKeyTtl.ResolveForEntity returns null when the provided CacheSettings enable caching for the entity but no TTL values are configured (neither GlobalSeconds nor the entity-specific seconds). /// + /// [Test] public void ResolveForEntity_ReturnsNull_WhenNoTtlConfigured() { @@ -461,6 +483,7 @@ public class CacheKeyClassifierTest /// and the Appointments mode is set to . /// /// A method; assertions are used to validate the generated key and TTL values. + /// [Test] public void PatientAppointmentsTodayKeyWithTtl_GeneratesCorrectFormat() { @@ -491,6 +514,7 @@ public class CacheKeyClassifierTest /// Verifies that generates the expected cache key format /// ("appointments:PoC:{pocId}:{yyyyMMdd}") and returns the TTL value configured for point of care entries. /// + /// [Test] public void PocAppointmentsTodayKeyWithTtl_GeneratesCorrectFormat() { @@ -520,6 +544,7 @@ public class CacheKeyClassifierTest /// /// Verifies that generates a deterministic cache key by sorting the supplied field names alphabetically, regardless of their input order. /// + /// [Test] public void LatestObservationsKeyWithTtl_SortsFieldNamesAlphabetically() { @@ -544,6 +569,7 @@ public class CacheKeyClassifierTest /// /// Verifies that the cache key generated by excludes empty strings and null entries from the provided observation types, producing a clean delimiter-separated key for the remaining valid values. /// + /// [Test] public void LatestObservationsKeyWithTtl_ExcludesEmptyFields() { @@ -567,6 +593,7 @@ public class CacheKeyClassifierTest /// using the "configDisplays:display:{displayId}:base" format and returns the TTL value /// configured in the in-memory cache settings. /// + /// [Test] public void DisplayBaseKeyWithTtl_GeneratesCorrectFormat() { @@ -597,6 +624,7 @@ public class CacheKeyClassifierTest /// "configDisplays:display:{displayId}:config" format and that it differs from the base display key /// generated by . /// + /// [Test] public void DisplayWithConfigKeyWithTtl_GeneratesCorrectFormat() { @@ -619,6 +647,7 @@ public class CacheKeyClassifierTest /// Verifies that generates a cache key with the expected /// "pointOfCare:{pocId}:base" format and applies the configured point-of-care TTL in seconds from the in-memory settings. /// + /// [Test] public void PointOfCareBaseKeyWithTtl_GeneratesCorrectFormat() { @@ -649,6 +678,7 @@ public class CacheKeyClassifierTest /// "configObservations:all" consistently regardless of the supplied , /// including when TTL configuration and enabled state differ from defaults. /// + /// [Test] public void ConfigObservationsAllKeyWithTtl_GeneratesCorrectFormat() { @@ -684,6 +714,7 @@ public class CacheKeyClassifierTest /// /// The entity type under test for which a cache key pattern is requested. /// The cache key pattern that is expected to return for the given entity type. + /// [TestCase(CacheEnum.EntityType.Patients, "patients:*")] [TestCase(CacheEnum.EntityType.Displays, "displays:*")] [TestCase(CacheEnum.EntityType.PumpObservations, "pumpObs:*")] @@ -706,6 +737,7 @@ public class CacheKeyClassifierTest /// that embeds both the supplied prefix and patient identifier, producing the expected /// format of {prefix}:*:{patientId}*. /// + /// [Test] public void ByPatient_ReturnsPatternContainingPrefixAndPatientId() { @@ -724,6 +756,7 @@ public class CacheKeyClassifierTest /// patient-specific pattern built via CacheKeyPatterns.ByPatient, leaving entries /// belonging to other patients and unrelated entity types intact, and reports the count of deleted keys. /// + /// [Test] public async Task ByPatient_DeleteByPatternAsync_OnlyRemovesMatchingPatientKeys() { diff --git a/adas-core.Test/Utilities/TestUtilities.cs b/adas-core.Test/Utilities/TestUtilities.cs index a71bb86e..463683f2 100644 --- a/adas-core.Test/Utilities/TestUtilities.cs +++ b/adas-core.Test/Utilities/TestUtilities.cs @@ -10,12 +10,14 @@ namespace adas_core.Test.Utilities; /// /// Provides a collection of utility members to support testing operations and helper functionality. /// +/// public class TestUtilities { /// /// Creates and returns a fully populated, valid instance with predefined test values, typically used as a helper for unit testing or seeding sample data. /// /// A new object initialized with valid identifiers, room and bed information, an available status, a default configuration, and a referenced unit. + /// public static PointOfCare CreateValidPointOfCare() { return new PointOfCare @@ -36,6 +38,7 @@ public class TestUtilities /// Creates a valid instance populated with generated identifiers, current UTC timestamps, and default test values for use in test scenarios. /// /// A fully populated object with all required fields set to valid values. + /// public static Discharge CreateValidDischarge() { return new Discharge @@ -59,6 +62,7 @@ public class TestUtilities /// Creates and returns a new instance populated with valid test/default values, including a generated identifier, sample patient numbers, admission timestamp, and related option list entries for discharge status, altable, and origin. /// /// A fully initialized object suitable for use in testing or seeding scenarios. + /// public static Patient CreateValidPatient() { return new Patient @@ -105,6 +109,7 @@ public class TestUtilities /// Creates a new instance populated with predefined valid test values, typically used as a helper for unit tests or test data seeding. /// /// An with sample values, where InitDate is set to the current UTC time and EndDate is set to one day after the current UTC time. + /// public static OptionList CreateValidOptionList() { return new OptionList @@ -123,6 +128,7 @@ public class TestUtilities /// Creates a valid instance populated with default test data for use in test scenarios. /// /// A with predefined unit name, bed, and room values. + /// private static PatientLocation CreateValidPatientLocation() { return new PatientLocation @@ -137,6 +143,7 @@ public class TestUtilities /// Creates a new instance populated with valid default values, typically used for testing or seeding purposes. /// /// A new object with a generated unique identifier, default title and name, no last update timestamp, an empty list of point of care IDs, an OK status, and a configuration with auto ADT enabled. + /// public static Unit CreateValidUnit() { return new Unit @@ -158,6 +165,7 @@ public class TestUtilities /// Creates and returns a valid instance populated with sample test data, including generated unique identifiers, a test person, option lists for origin, diagnosis, insulation, language barrier, allergies, and a patient location. /// /// A new object fully initialized with valid test values. + /// public static Admission CreateValidAdmission() { return new Admission @@ -195,6 +203,7 @@ public class TestUtilities /// /// The optional identifier for the configuration. If null, a new is generated. /// A newly created populated with the default valid configuration. + /// public static CardConfig CreateValidCardConfig(ObjectId? id = null) { return new CardConfig @@ -220,6 +229,7 @@ public class TestUtilities /// /// The optional identifier to assign to the configuration. When null, a new is generated. /// A populated with the nurse display configuration. + /// public static CardDetailsConfig CreateValidCardDetailsNurseConfig(ObjectId? id = null) { return new CardDetailsConfig @@ -259,6 +269,7 @@ public class TestUtilities /// /// The optional identifier to assign to the configuration. When null, a new is generated. /// A configured with a predefined smart section layout. + /// public static CardDetailsConfig CreateValidCardDetailsSmartConfig(ObjectId? id = null) { return new CardDetailsConfig @@ -301,6 +312,7 @@ public class TestUtilities /// The optional card config identifier. A new is generated when null. /// The optional detail config identifier. A new is generated when null. /// A fully populated with default field and hospital values. + /// public static DisplayConfig CreateValidDisplayConfig(DisplayConfigEnums.DisplayType type, ObjectId? id, ObjectId? idCard, ObjectId? idDetail) { diff --git a/adas-core.module.LightBeacons/Devices/LightBeacon.cs b/adas-core.module.LightBeacons/Devices/LightBeacon.cs index faab067e..1c97d860 100644 --- a/adas-core.module.LightBeacons/Devices/LightBeacon.cs +++ b/adas-core.module.LightBeacons/Devices/LightBeacon.cs @@ -8,6 +8,7 @@ namespace adas_core.module.LightBeacons.Devices; /// The specific implementation of these methods will depend on the type of light beacon being used and the requirements of the application. /// /// A dictionary containing configuration options for the light beacon. This can include settings such as the beacon's IP address, port number, color configurations, and other relevant parameters. +/// public abstract class LightBeacon(EquatableDictionary options) { /// @@ -19,24 +20,28 @@ public abstract class LightBeacon(EquatableDictionary options) /// Turns the light beacon blue. This method should be implemented to control the beacon's hardware or software interface to change its color to blue. /// /// A task representing the asynchronous operation. + /// public abstract Task BlueCode(); /// /// Turns the light beacon red. This method should be implemented to control the beacon's hardware or software interface to change its color to red. /// /// A task representing the asynchronous operation. + /// public abstract Task RedCode(); /// /// Turns the light beacon yellow. This method should be implemented to control the beacon's hardware or software interface to change its color to yellow. /// /// A task representing the asynchronous operation. + /// public abstract Task YellowCode(); /// /// Turns off the light beacon. This method should be implemented to control the beacon's hardware or software interface to turn off the light, regardless of its current color. /// /// + /// public abstract Task PowerOffLed(); /// @@ -45,11 +50,13 @@ public abstract class LightBeacon(EquatableDictionary options) /// /// The patient observation used to determine the appropriate color alert. /// A task representing the asynchronous operation. + /// public abstract Task GenerateColorAlert(PatientObservation obs); /// /// Retrieves the current color of the light beacon. This method should be implemented to query the beacon's hardware or software interface to determine its current color state and return it as a value from the LightBeaconColor enumeration. /// /// A task representing the asynchronous operation, with a result of the current color of the light beacon. + /// public abstract Task GetBeaconColor(); } \ No newline at end of file diff --git a/adas-core.module.LightBeacons/Devices/LightBeaconAbstract.cs b/adas-core.module.LightBeacons/Devices/LightBeaconAbstract.cs index ef8e89fc..d41c7354 100644 --- a/adas-core.module.LightBeacons/Devices/LightBeaconAbstract.cs +++ b/adas-core.module.LightBeacons/Devices/LightBeaconAbstract.cs @@ -7,6 +7,7 @@ namespace adas_core.module.LightBeacons.Devices; /// /// The host address of the LightBeacon device. This is typically the IP address or hostname used to connect to the device for controlling its LED states. /// The password used for authenticating with the LightBeacon device. This is required to establish a connection and control the device's LED states securely. +/// public abstract class LightBeaconAbstract(string host, string password) { /// @@ -23,24 +24,28 @@ public abstract class LightBeaconAbstract(string host, string password) /// Abstract method to set the LightBeacon device to Code Blue state. This method should be implemented by each specific LightBeacon model to control the LED state accordingly. /// /// An object parameter that can be used to pass additional information or context needed for setting the LED state. + /// public abstract void CodeBlue(object entry); /// /// Abstract method to set the LightBeacon device to Code Red state. This method should be implemented by each specific LightBeacon model to control the LED state accordingly. /// /// An object parameter that can be used to pass additional information or context needed for setting the LED state. + /// public abstract void CodeRed(object entry); /// /// Abstract method to set the LightBeacon device to Code Yellow state. This method should be implemented by each specific LightBeacon model to control the LED state accordingly. /// /// An object parameter that can be used to pass additional information or context needed for setting the LED state. + /// public abstract void CodeYellow(object entry); /// /// Abstract method to power off the LED of the LightBeacon device. This method should be implemented by each specific LightBeacon model to control the LED state accordingly. /// /// An object parameter that can be used to pass additional information or context needed for setting the LED state. + /// public abstract void PowerOffLed(object entry); /// @@ -51,6 +56,7 @@ public abstract class LightBeaconAbstract(string host, string password) /// The host address of the LightBeacon device. /// The password for authenticating with the LightBeacon device. /// An instance of the specific LightBeacon device, or null if the driver class is not found or cannot be instantiated. + /// public static LightBeaconAbstract? GetBeaconDevice(string driver, string host, string password) { var modelType = Type.GetType($"adas_core.Drivers.LightBeacon.{driver}"); diff --git a/adas-core.module.LightBeacons/Devices/Turktbens2LightBeacon.cs b/adas-core.module.LightBeacons/Devices/Turktbens2LightBeacon.cs index 02cc2c30..56a48a3a 100644 --- a/adas-core.module.LightBeacons/Devices/Turktbens2LightBeacon.cs +++ b/adas-core.module.LightBeacons/Devices/Turktbens2LightBeacon.cs @@ -10,6 +10,7 @@ namespace adas_core.module.LightBeacons.Devices; /// This class represents a light beacon device that can be controlled via HTTP requests. It retrieves the current color of the beacon by parsing HTML pages and sends commands to change the beacon's color. /// The class includes error handling and retry logic for network operations, and it can be configured to emulate the beacon for testing purposes. /// +/// public class Turktbens2LightBeacon : LightBeacon { /// @@ -81,6 +82,7 @@ public class Turktbens2LightBeacon : LightBeacon /// /// A dictionary containing the configuration options for the beacon. /// Thrown when required options are missing or invalid. + /// public Turktbens2LightBeacon(EquatableDictionary options) : base(options) { _logger = Log.ForContext(); @@ -108,6 +110,10 @@ public class Turktbens2LightBeacon : LightBeacon /// returns OFF when some error appears or try to parse the bits to BalizaColors enum /// /// The current color of the beacon as a LightBeaconColor enum value. + /// + /// public override async Task GetBeaconColor() { if (_emulate) @@ -194,6 +200,7 @@ public class Turktbens2LightBeacon : LightBeacon /// If an error occurs, it logs the error message and rethrows the exception to be handled by the caller. /// /// A task representing the asynchronous operation. + /// public override async Task BlueCode() { try @@ -211,6 +218,7 @@ public class Turktbens2LightBeacon : LightBeacon /// The RedCode method sends a command to the beacon's web interface to change the beacon's color to red. /// /// A task representing the asynchronous operation. + /// public override async Task RedCode() { try @@ -228,6 +236,7 @@ public class Turktbens2LightBeacon : LightBeacon /// The YellowCode method sends a command to the beacon's web interface to change the beacon's color to yellow. /// /// A task representing the asynchronous operation. + /// public override async Task YellowCode() { try @@ -245,6 +254,10 @@ public class Turktbens2LightBeacon : LightBeacon /// The GreenCode method sends a command to the beacon's web interface to change the beacon's color to green. /// /// A task representing the asynchronous operation. + /// + /// public override async Task PowerOffLed() { try @@ -264,6 +277,7 @@ public class Turktbens2LightBeacon : LightBeacon /// The patient observation based on which the color alert should be generated. /// A task representing the asynchronous operation. /// + /// public override Task GenerateColorAlert(PatientObservation obs) { throw new NotImplementedException(); @@ -274,6 +288,7 @@ public class Turktbens2LightBeacon : LightBeacon /// /// The color code to be sent to the beacon. /// A task representing the asynchronous operation. + /// private async Task Send(ColorsCodes colorCodes) { var clr = ((int)colorCodes).ToString().PadLeft(3, '0'); @@ -306,6 +321,8 @@ public class Turktbens2LightBeacon : LightBeacon /// The body parameters to be sent in the HTTP POST request. /// A task representing the asynchronous operation. /// + /// protected async Task SendMessage(Dictionary body) { if (string.IsNullOrEmpty(_url)) throw new InvalidOperationException("URL is not set."); diff --git a/adas-core.module.LightBeacons/Services/LightBeaconService.cs b/adas-core.module.LightBeacons/Services/LightBeaconService.cs index 13cc20fc..7e42350f 100644 --- a/adas-core.module.LightBeacons/Services/LightBeaconService.cs +++ b/adas-core.module.LightBeacons/Services/LightBeaconService.cs @@ -24,6 +24,7 @@ namespace adas_core.module.LightBeacons.Services; /// It interacts with the point of care service to determine which beacons are associated with specific locations and maintains an in-memory cache of the current color state of each location's beacon. /// The service also handles CRUD operations for light beacon configurations stored in a MongoDB repository. /// +/// public class LightBeaconService : ILightBeaconService { private readonly IClientMessageService _clientMessageService; @@ -44,6 +45,7 @@ public class LightBeaconService : ILightBeaconService /// The subscribers service for managing subscribers. /// The point of care service for retrieving point of care information. /// The light beacon repository for managing light beacon data. + /// public LightBeaconService( IOptions apiSettings, ILogger logger, @@ -82,6 +84,10 @@ public class LightBeaconService : ILightBeaconService /// /// The ID of the point of care for which to power off the LED. /// A task representing the asynchronous operation. + /// + /// public async Task PowerOffLed(ObjectId pocId) { var poc = await _pointOfCareService.FindById(pocId); @@ -100,6 +106,7 @@ public class LightBeaconService : ILightBeaconService /// The light beacon configuration to insert. /// The inserted light beacon configuration, or null if the insertion failed. /// Thrown if a light beacon with the same name already exists. + /// public async Task InsertOne(LightBeacon beacon) { var beaconFound = await _lightBeaconRepository.GetByName(beacon.Name); @@ -113,6 +120,7 @@ public class LightBeaconService : ILightBeaconService /// /// The pagination filter to apply when retrieving the light beacons. /// A paginated response containing the light beacons that match the specified filter. + /// public async Task> GetPaginatedBeacons(PaginationFilter filter) { var usedRelayIds = await _pointOfCareService.FindAllIdBeaconsInUse(); @@ -158,6 +166,7 @@ public class LightBeaconService : ILightBeaconService /// /// The text to search for in the names of the light beacons. /// A list of light beacons whose names contain the specified search text. + /// public async Task> GetSearchByName(string textToSearch) { return await _lightBeaconRepository.GetSearchByName(textToSearch); @@ -169,6 +178,7 @@ public class LightBeaconService : ILightBeaconService /// /// The light beacon object with updated properties. /// The updated light beacon configuration, or null if the update failed. + /// public async Task UpdateOne(LightBeacon beacon) { await _lightBeaconRepository.UpdateOneAsync(beacon.Id, beacon); @@ -181,6 +191,7 @@ public class LightBeaconService : ILightBeaconService /// /// The point of care for which to power off the LED. /// A task representing the asynchronous operation. + /// public async Task PowerOffLed(PointOfCare poc) { if (_locationsWithColor.TryGetValue(poc.Id, out var lightBeaconColor) && @@ -209,6 +220,7 @@ public class LightBeaconService : ILightBeaconService /// Generates a color alert for a patient observation by determining the appropriate color based on the observation's status and configured colors for warnings and alerts. /// /// The patient observation for which to generate the color alert. + /// public void GenerateColorAlert(PatientObservation obs) { try @@ -294,6 +306,8 @@ public class LightBeaconService : ILightBeaconService /// The ID of the point of care for which to send the color command. /// The color to set on the light beacon. /// A task representing the asynchronous operation. + /// public async Task SendColor(ObjectId pocId, LightBeaconColor color) { var poc = await _pointOfCareService.FindById(pocId); @@ -308,6 +322,7 @@ public class LightBeaconService : ILightBeaconService /// The point of care for which to send the color command. /// The color to set on the light beacon. /// A task representing the asynchronous operation. + /// public async Task SendColor(PointOfCare poc, LightBeaconColor color) { try @@ -361,6 +376,7 @@ public class LightBeaconService : ILightBeaconService /// /// The ID of the point of care for which to retrieve the color state. /// A task representing the asynchronous operation, with the current color state of the light beacon. + /// public async Task GetColor(ObjectId pocId) { var poc = await _pointOfCareService.FindById(pocId); @@ -373,6 +389,7 @@ public class LightBeaconService : ILightBeaconService /// /// The point of care for which to retrieve the color state. /// A task representing the asynchronous operation, with the current color state of the light beacon. + /// public async Task GetColor(PointOfCare poc) { try @@ -403,6 +420,7 @@ public class LightBeaconService : ILightBeaconService /// The point of care for which to send the color command. /// The color to set on the light beacon. /// A task representing the asynchronous operation. + /// public async Task SendBeaconBroadcast(PointOfCare poc, LightBeaconColor color) { var subscribers = _subscribersService.GetSubscribers() @@ -420,6 +438,7 @@ public class LightBeaconService : ILightBeaconService /// The ID of the point of care for which to send the color command. /// The color to set on the light beacon. /// A task representing the asynchronous operation. + /// public async Task SendBeaconBroadcast(ObjectId pocId, LightBeaconColor color) { var poc = await _pointOfCareService.FindById(pocId); @@ -433,6 +452,7 @@ public class LightBeaconService : ILightBeaconService /// /// The body of the message to send. /// A task representing the asynchronous operation. + /// private async Task SendMessage(string body) { if (string.IsNullOrEmpty(Url)) @@ -465,6 +485,7 @@ public class LightBeaconService : ILightBeaconService /// /// The ID of the light beacon to retrieve. /// A task representing the asynchronous operation, with a result of the light beacon device instance if found; otherwise, null. + /// private async Task GetBeacon(ObjectId lightBeaconId) { var cfg = await _lightBeaconRepository.GetById(lightBeaconId); @@ -491,6 +512,7 @@ public class LightBeaconService : ILightBeaconService /// /// /// + /// public static string DictionaryToString(ConcurrentDictionary dictionary) { var builder = new StringBuilder(); diff --git a/adas-core.module.ProxyDevices/Devices/HttpDevice.cs b/adas-core.module.ProxyDevices/Devices/HttpDevice.cs index 9377a940..b06999c1 100644 --- a/adas-core.module.ProxyDevices/Devices/HttpDevice.cs +++ b/adas-core.module.ProxyDevices/Devices/HttpDevice.cs @@ -6,6 +6,7 @@ namespace adas_core.module.ProxyDevices.Devices; /// /// Device that can be used to get content via http with digest auth /// +/// public class HttpDevice : IProxyDevice { /// @@ -46,6 +47,7 @@ public class HttpDevice : IProxyDevice /// A dictionary containing the parameters required to initialize the device. /// Thrown when the device is already initialized. /// Thrown when a required parameter is missing or invalid. + /// public void Initialize(Dictionary deviceParameters) { if (_isInitialized) throw new InvalidOperationException("Device already initialized"); @@ -68,6 +70,7 @@ public class HttpDevice : IProxyDevice /// /// An HttpResponseMessage representing the response from the HTTP request. /// Thrown when the request times out. + /// public async Task Process() { try @@ -89,6 +92,7 @@ public class HttpDevice : IProxyDevice /// /// An HttpResponseMessage representing the response from the HTTP request. /// Thrown when the request times out. + /// public async Task Stream() { try @@ -110,6 +114,7 @@ public class HttpDevice : IProxyDevice /// /// An HttpClient instance configured with the appropriate credentials. /// Thrown when the device is not initialized. + /// private HttpClient GetHttpClient() { if (!_isInitialized) throw new InvalidOperationException("Device not initialized"); @@ -124,6 +129,7 @@ public class HttpDevice : IProxyDevice /// Returns a string representation of the HttpDevice instance, including its name, URI, username, password, and domain. This can be useful for logging or debugging purposes to quickly identify the configuration of the device. /// /// A string representation of the HttpDevice instance. + /// public override string ToString() { return $"[HttpDevice] ({_name} {_uri} {_username} {_password} {_domain})"; diff --git a/adas-core.module.ProxyDevices/Devices/IProxyDevice.cs b/adas-core.module.ProxyDevices/Devices/IProxyDevice.cs index f39f059f..9cf80ea2 100644 --- a/adas-core.module.ProxyDevices/Devices/IProxyDevice.cs +++ b/adas-core.module.ProxyDevices/Devices/IProxyDevice.cs @@ -11,17 +11,21 @@ public interface IProxyDevice /// The parameters can include any necessary configuration settings for the device, such as connection details, authentication information, or other relevant data. /// /// A dictionary containing the parameters required to initialize the device. + /// void Initialize(Dictionary deviceParameters); /// /// Processes the data received by the proxy device. This method should contain the logic for handling incoming data, performing any necessary transformations or computations, and preparing the data for further use. /// /// A task that represents the asynchronous operation. The task result contains the HttpResponseMessage returned by the device's Process method. + /// Task Process(); /// /// Streams data from the proxy device. This method should contain the logic for handling outgoing data, performing any necessary transformations or computations, and preparing the data for further use. /// /// A task that represents the asynchronous operation. The task result contains the HttpResponseMessage returned by the device's Stream method. + /// Task Stream(); } \ No newline at end of file diff --git a/adas-core.module.ProxyDevices/ProxyDeviceSettings.cs b/adas-core.module.ProxyDevices/ProxyDeviceSettings.cs index 03adc853..2e372e07 100644 --- a/adas-core.module.ProxyDevices/ProxyDeviceSettings.cs +++ b/adas-core.module.ProxyDevices/ProxyDeviceSettings.cs @@ -4,6 +4,8 @@ /// Represents the settings for proxy devices, which are used to define and manage virtual devices that can be used for testing, simulation, or other purposes within the ADAS (Advanced Driver Assistance Systems) core module. /// Each proxy device can have its own unique identifier, type, enabled status, and a set of parameters that can be customized as needed. /// +/// +/// public class ProxyDeviceSettings : List { } diff --git a/adas-core.module.ProxyDevices/Services/IProxyDeviceService.cs b/adas-core.module.ProxyDevices/Services/IProxyDeviceService.cs index 51e1ad7c..03cd2cac 100644 --- a/adas-core.module.ProxyDevices/Services/IProxyDeviceService.cs +++ b/adas-core.module.ProxyDevices/Services/IProxyDeviceService.cs @@ -10,6 +10,8 @@ public interface IProxyDeviceService /// /// The unique identifier of the proxy device to be processed. /// A task that represents the asynchronous operation. The task result contains the HttpResponseMessage returned by the device's Process method. + /// Task Process(string deviceId); /// @@ -17,5 +19,6 @@ public interface IProxyDeviceService /// /// The unique identifier of the proxy device to be streamed. /// A task that represents the asynchronous operation. The task result contains the HttpResponseMessage returned by the device's Stream method. + /// Task Stream(string deviceId); } \ No newline at end of file diff --git a/adas-core.module.ProxyDevices/Services/ProxyDeviceService.cs b/adas-core.module.ProxyDevices/Services/ProxyDeviceService.cs index c49334c1..5af102d0 100644 --- a/adas-core.module.ProxyDevices/Services/ProxyDeviceService.cs +++ b/adas-core.module.ProxyDevices/Services/ProxyDeviceService.cs @@ -10,6 +10,7 @@ namespace adas_core.module.ProxyDevices.Services; /// The service handles HTTP requests and returns appropriate responses based on the device's availability and functionality. /// /// The settings for the proxy devices, including their configuration and parameters. +/// public class ProxyDeviceService(IOptions settings) : IProxyDeviceService { /// @@ -23,6 +24,8 @@ public class ProxyDeviceService(IOptions settings) : IProxy /// /// The unique identifier of the proxy device to be processed. /// A task that represents the asynchronous operation. The task result contains the HttpResponseMessage returned by the device's Process method. + /// public async Task Process(string deviceId) { try @@ -45,6 +48,8 @@ public class ProxyDeviceService(IOptions settings) : IProxy /// /// The unique identifier of the proxy device to be streamed. /// A task that represents the asynchronous operation. The task result contains the HttpResponseMessage returned by the device's Stream method. + /// public async Task Stream(string deviceId) { try @@ -68,6 +73,10 @@ public class ProxyDeviceService(IOptions settings) : IProxy /// The unique identifier of the proxy device to be retrieved. /// The proxy device instance corresponding to the given deviceId. /// Thrown when the device is not found or not enabled. + /// + /// private IProxyDevice? GetDevice(string deviceId) { var device = settings.Value.FirstOrDefault(d => d.Id == deviceId); diff --git a/adas-core.module.Relays/Devices/FakeRelay.cs b/adas-core.module.Relays/Devices/FakeRelay.cs index 4e5825ba..a8d0fc1d 100644 --- a/adas-core.module.Relays/Devices/FakeRelay.cs +++ b/adas-core.module.Relays/Devices/FakeRelay.cs @@ -10,6 +10,7 @@ namespace adas_core.module.Relays.Devices; /// /// The Relay object representing the relay device. /// The RelaySettings object containing the configuration settings for the relay device. +/// internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice(relay, relaySettings) { /// @@ -17,6 +18,7 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// In a real implementation, this method would contain logic to check the actual status of the hardware device. /// /// True if the device is functioning properly, false otherwise. + /// public override bool CheckDevice() { return true; @@ -26,6 +28,7 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// Gets the status of the fake relay device. Since this is a simulated device, it always returns true, indicating that the device is on. /// /// True if the device is on, false otherwise. + /// public override bool GetStatusRelay() { return true; @@ -36,6 +39,7 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// In a real implementation, this method would contain logic to send a command to the hardware device to power off the specified outlet. /// /// The ID of the outlet to power off + /// public override void PowerOffRelay(int outletId) { } @@ -44,6 +48,7 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// Powers on the relay for the specified outlet ID. Since this is a simulated device, this method does not perform any actual operations. /// /// The ID of the outlet to power on. + /// public override void PowerOnRelay(int outletId) { } @@ -51,6 +56,7 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// /// Powers off all relays. Since this is a simulated device, this method does not perform any actual operations. /// + /// public override void PowerOffAll() { } @@ -58,6 +64,7 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// /// Powers on all relays. Since this is a simulated device, this method does not perform any actual operations. /// + /// public override void PowerOnAll() { } @@ -67,6 +74,7 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// /// The ID of the outlet to get the status for. /// The status of the specified outlet. + /// public override RelayEnum.Status GetStatusRelay(int outletId) { const string status = "00000000"; @@ -79,6 +87,7 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// Reboots the relay for the specified outlet ID. Since this is a simulated device, this method does not perform any actual operations. /// /// The ID of the outlet to reboot. + /// public override void RebootOutlet(int outletId) { } @@ -87,6 +96,8 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// Reboots all relays. Since this is a simulated device, this method does not perform any actual operations. /// However, it includes a delay based on the RebootDelay property of the Relay object to simulate the time taken for a reboot process. /// + /// public override void Reboot() { PowerOffAll(); @@ -98,6 +109,14 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// Asynchronously gets the status of the relay for the specified outlet ID. Since this is a simulated device, it returns a hardcoded status string "00000000", which indicates that all outlets are off. /// /// A task that represents the asynchronous operation. The task result contains the status of the specified outlet. + /// + /// + /// + /// public override Task GetStatusRelayAsync() { return Task.FromResult(true); @@ -107,6 +126,12 @@ internal class FakeRelay(Relay relay, RelaySettings relaySettings) : RelayDevice /// Asynchronously gets the status of the relay for the specified outlet ID. /// Since this is a simulated device, it returns a hardcoded status string "00000000", which indicates that all outlets are off. /// + /// + /// + /// public override void CheckStatus() { } diff --git a/adas-core.module.Relays/Devices/KMTronicRelay.cs b/adas-core.module.Relays/Devices/KMTronicRelay.cs index 12ae6a44..983590ba 100644 --- a/adas-core.module.Relays/Devices/KMTronicRelay.cs +++ b/adas-core.module.Relays/Devices/KMTronicRelay.cs @@ -12,6 +12,7 @@ namespace adas_core.module.Relays.Devices; /// /// The Relay object representing the relay device. /// The RelaySettings object containing the configuration settings for the relay device. +/// public class KmTronicRelay(Relay relay, RelaySettings relaySettings) : RelayDevice(relay, relaySettings) { @@ -30,6 +31,7 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// If the response indicates that the status is unknown, it returns false, indicating that the device is not reachable or not responding correctly. Otherwise, it returns true, indicating that the device is online and responsive. /// /// True if the device is online and responsive, false otherwise. + /// public override bool CheckDevice() { CheckStatus(); @@ -42,6 +44,7 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// If the response is null or empty, it indicates that the device is not reachable or not responding correctly, and it returns false. Otherwise, it returns true, indicating that the device is online and responsive. /// /// True if the device is online and responsive, false otherwise. + /// public override bool GetStatusRelay() { var status = Send("FF0000"); @@ -60,6 +63,7 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// /// The ID of the outlet to retrieve the status for. /// The status of the specified outlet. + /// public override RelayEnum.Status GetStatusRelay(int outletId) { var status = Send("FF0000"); @@ -102,6 +106,7 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// Powers off a specific outlet on the KMTronic relay device by sending a command to either open or close the relay, depending on the configured mode. /// /// The ID of the outlet to power off. + /// public override void PowerOffRelay(int outletId) { if (Relay.Mode == RelayEnum.Mode.OpenedOffClosedOn) OpenRelay(outletId); @@ -112,6 +117,10 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// Powers on a specific outlet on the KMTronic relay device by sending a command to either open or close the relay, depending on the configured mode. /// /// The ID of the outlet to power on. + /// + /// public void OpenRelay(int outletId) { //Activa el relé por lo que corta la corriente del dispositivo conectado @@ -122,6 +131,7 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// Powers on a specific outlet on the KMTronic relay device by sending a command to either open or close the relay, depending on the configured mode. /// /// The ID of the outlet to power on. + /// public override void PowerOnRelay(int outletId) { if (Relay.Mode == RelayEnum.Mode.OpenedOffClosedOn) CloseRelay(outletId); @@ -133,6 +143,8 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// This method is used to power on the outlet by allowing the current to flow through it. /// /// The ID of the outlet to close. + /// public void CloseRelay(int outletId) { //Desactiva el relé por lo que deja pasar la corriente del dispositivo conectado @@ -143,6 +155,8 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// /// Powers off all outlets on the KMTronic relay device by sending a command to either open or close all relays, depending on the configured mode. /// + /// public override void PowerOffAll() { //Activa el relé por lo que corta la corriente de todos los dispositivo conectados @@ -152,6 +166,8 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// /// Powers on all outlets on the KMTronic relay device by sending a command to either open or close all relays, depending on the configured mode. /// + /// public override void PowerOnAll() { //Desactiva el relé por lo que deja pasar la corriente a todos dispositivo conectados @@ -161,6 +177,7 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// /// Checks the status of the KMTronic relay device by calling the GetStatusRelay method and updating the DeviceStatus property accordingly. /// + /// public override void CheckStatus() { DeviceStatus = GetStatusRelay(); @@ -170,6 +187,7 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// Reboots a specific outlet on the KMTronic relay device by first powering it off, waiting for a specified delay, and then powering it back on. This method is used to reset the connected device by briefly cutting off its power supply. /// /// The ID of the outlet to reboot. + /// public override void RebootOutlet(int outletId) { //Reinicia el relé del dispositivo conectado @@ -179,6 +197,7 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// /// Reboots all outlets on the KMTronic relay device by first powering them off, waiting for a specified delay, and then powering them back on. This method is used to reset all connected devices by briefly cutting off their power supply. /// + /// public override void Reboot() { PowerOffAll(); @@ -191,6 +210,8 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// /// A task representing the asynchronous operation. /// + /// public override Task GetStatusRelayAsync() { throw new NotImplementedException(); @@ -199,6 +220,8 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// /// Asynchronously retrieves the status of a specific outlet on the KMTronic relay device. This method is not implemented in this class, and it throws a NotImplementedException when called. /// + /// protected virtual void Connect() { if (_udpClient == null) @@ -244,6 +267,10 @@ public class KmTronicRelay(Relay relay, RelaySettings relaySettings) /// /// The command to send to the KMTronic relay device. /// The response from the KMTronic relay device. + /// + /// protected virtual string Send(string datagrama) { if (_udpClient == null) Connect(); diff --git a/adas-core.module.Relays/Devices/KMTronicV2Relay.cs b/adas-core.module.Relays/Devices/KMTronicV2Relay.cs index 24b53d7d..86a6856a 100644 --- a/adas-core.module.Relays/Devices/KMTronicV2Relay.cs +++ b/adas-core.module.Relays/Devices/KMTronicV2Relay.cs @@ -11,6 +11,7 @@ namespace adas_core.module.Relays.Devices; /// /// Class representing a KMTronic V2 relay device. This class inherits from the RelayDevice class and provides specific implementations for checking the device status, getting the status of individual relays, and controlling the power state of the relays for a KMTronic V2 relay device. /// +/// public class KmTronicV2Relay : RelayDevice { /// @@ -18,6 +19,7 @@ public class KmTronicV2Relay : RelayDevice /// /// The Relay object representing the relay device. /// The RelaySettings object containing the configuration settings for the relay device. + /// public KmTronicV2Relay(Relay relay, RelaySettings relaySettings) : base(relay, relaySettings) { CheckDevice(); @@ -29,6 +31,7 @@ public class KmTronicV2Relay : RelayDevice /// The method returns true if the device is responsive and provides a valid status, and false otherwise. /// /// True if the device is responsive and provides a valid status, false otherwise. + /// public sealed override bool CheckDevice() { CheckStatus(); @@ -42,6 +45,7 @@ public class KmTronicV2Relay : RelayDevice /// /// The method sends an HTTP GET request to the "status.xml" endpoint of the KMTronic V2 relay device and parses the XML response to update the internal status of each relay. /// + /// public override void CheckStatus() { try @@ -91,6 +95,10 @@ public class KmTronicV2Relay : RelayDevice /// Gets the status of a specific relay outlet by sending a request to the KMTronic V2 relay device. The method returns the status of the specified relay outlet, which can be On, Off, or Unknown. /// /// True if the specified relay outlet is On, false otherwise. + /// + /// public override bool GetStatusRelay() { return GetStatusRelay(1) == RelayEnum.Status.On; @@ -100,6 +108,10 @@ public class KmTronicV2Relay : RelayDevice /// Gets the status of a specific relay outlet by sending a request to the KMTronic V2 relay device. The method returns the status of the specified relay outlet, which can be On, Off, or Unknown. /// /// True if the specified relay outlet is On, false otherwise. + /// + /// public override Task GetStatusRelayAsync() { var result = GetStatusRelay(); @@ -110,6 +122,8 @@ public class KmTronicV2Relay : RelayDevice /// Gets the status of a specific relay outlet by retrieving the status from the internal status dictionary. The method returns the status of the specified relay outlet, which can be On, Off, or Unknown. /// /// The ID of the relay outlet. + /// public override void PowerOnRelay(int outletId) { PowerRelay(outletId, RelayEnum.Status.On); @@ -119,6 +133,10 @@ public class KmTronicV2Relay : RelayDevice /// Gets the status of a specific relay outlet by retrieving the status from the internal status dictionary. The method returns the status of the specified relay outlet, which can be On, Off, or Unknown. /// /// The ID of the relay outlet. + /// + /// public override void PowerOffRelay(int outletId) { PowerRelay(outletId, RelayEnum.Status.Off); @@ -131,6 +149,7 @@ public class KmTronicV2Relay : RelayDevice /// The path of the relay device. /// The query parameters for the request. /// The constructed URI. + /// private Uri GetUri(string path, string? query = null) { var uriBuilder = new UriBuilder @@ -146,6 +165,7 @@ public class KmTronicV2Relay : RelayDevice /// The HTTP method for the request. /// The query parameters for the request. /// The constructed HttpRequestMessage. + /// private HttpRequestMessage GetRequest(string path, HttpMethod method, string? query = null) { var uri = GetUri(path, query); @@ -169,6 +189,10 @@ public class KmTronicV2Relay : RelayDevice /// The HTTP method for the request. /// The query parameters for the request. /// The HttpResponseMessage received from the relay device. + /// + /// private HttpResponseMessage SendRequest(string path, HttpMethod method, string? query = null) { using var client = new HttpClient(); @@ -194,6 +218,7 @@ public class KmTronicV2Relay : RelayDevice /// The ID of the relay outlet to control. /// The desired state for the relay outlet (On or Off). /// Whether to check the status of the device after sending the request. + /// private void PowerRelay(int outletId, RelayEnum.Status toState, bool checkStatus = true) { if (Relay.Mode == RelayEnum.Mode.OpenedOffClosedOn) @@ -227,6 +252,8 @@ public class KmTronicV2Relay : RelayDevice /// The method iterates through all relay outlets and sends requests to change their state to the desired state (On or Off). /// After sending the requests, it checks the status of the device to ensure that the state changes were successful. /// + /// public override void PowerOnAll() { PowerAll(RelayEnum.Status.On); @@ -235,6 +262,7 @@ public class KmTronicV2Relay : RelayDevice /// /// Controls the power state of all relay outlets by sending requests to the KMTronic V2 relay device. /// + /// public override void PowerOffAll() { PowerAll(RelayEnum.Status.Off); @@ -244,6 +272,7 @@ public class KmTronicV2Relay : RelayDevice /// Controls the power state of all relay outlets by sending requests to the KMTronic V2 relay device. /// /// The desired state for all relay outlets (On or Off). + /// private void PowerAll(RelayEnum.Status toState) { Enumerable.Range(1, Relay.Total).ToList().ForEach(outletId => { PowerRelay(outletId, toState, false); }); @@ -253,6 +282,7 @@ public class KmTronicV2Relay : RelayDevice /// /// Reboots the KMTronic V2 relay device by first powering off all relay outlets, then waiting for a specified delay (if configured), and finally powering on all relay outlets again. /// + /// public override void Reboot() { PowerOffAll(); @@ -264,6 +294,7 @@ public class KmTronicV2Relay : RelayDevice /// Reboots a specific relay outlet by first powering it off, then waiting for a specified delay (30 seconds in this case), and finally powering it on again. /// /// The ID of the relay outlet to reboot. + /// public override void RebootOutlet(int outletId) { PowerOffRelay(outletId); diff --git a/adas-core.module.Relays/Devices/RelayDevice.cs b/adas-core.module.Relays/Devices/RelayDevice.cs index 71f99b99..9cfd4cb6 100644 --- a/adas-core.module.Relays/Devices/RelayDevice.cs +++ b/adas-core.module.Relays/Devices/RelayDevice.cs @@ -12,6 +12,7 @@ namespace adas_core.module.Relays.Devices; /// The class also includes an event to notify when the status of a relay changes. /// The implementation of the methods is left to the derived classes, which will provide specific functionality based on the type of relay device being used. /// +/// public abstract class RelayDevice { /// @@ -42,6 +43,7 @@ public abstract class RelayDevice /// /// The Relay object representing the relay device. /// The RelaySettings object containing the configuration settings for the relay device. + /// protected RelayDevice(Relay relay, RelaySettings relaySettings) { Relay = relay; @@ -69,23 +71,32 @@ public abstract class RelayDevice /// Checks the status of the relay device. This method is abstract and must be implemented by derived classes to provide specific functionality for checking the status of the relay device. /// /// + /// + /// public abstract bool CheckDevice(); /// /// Checks the status of the relays. This method is abstract and must be implemented by derived classes to provide specific functionality for checking the status of the relays. /// + /// public abstract void CheckStatus(); /// /// Gets the status of the relay device. This method is abstract and must be implemented by derived classes to provide specific functionality for retrieving the status of the relay device. /// /// + /// public abstract bool GetStatusRelay(); /// /// Gets the status of the relays. This method is abstract and must be implemented by derived classes to provide specific functionality for retrieving the status of the relays. /// /// + /// public abstract Task GetStatusRelayAsync(); /// @@ -93,6 +104,7 @@ public abstract class RelayDevice /// /// The ID of the relay outlet. /// The status of the specified relay outlet. + /// public virtual RelayEnum.Status GetStatusRelay(int outletId) { lock (_relaysStatus) @@ -106,6 +118,7 @@ public abstract class RelayDevice /// /// The ID of the relay outlet. /// The new status of the relay outlet. + /// public virtual void SetStatusRelay(int outletId, RelayEnum.Status status) { lock (_relaysStatus) @@ -123,6 +136,8 @@ public abstract class RelayDevice /// /// The ID of the relay outlet. /// The duration in milliseconds for which the relay outlet should be powered off. + /// public virtual void PowerOnOffRelay(int outletId, int milliseconds) { Task.Run(() => @@ -137,6 +152,7 @@ public abstract class RelayDevice /// /// Refreshes the status of the relay device. This method is virtual and can be overridden by derived classes to provide specific functionality for refreshing the status of the relay device. /// + /// public virtual void Refresh() { } @@ -145,32 +161,38 @@ public abstract class RelayDevice /// Powers on a specific relay outlet. This method is abstract and must be implemented by derived classes to provide specific functionality for powering on a relay outlet with the specified outlet ID. /// /// The ID of the relay outlet to power on. + /// public abstract void PowerOnRelay(int outletId); /// /// Powers off a specific relay outlet. This method is abstract and must be implemented by derived classes to provide specific functionality for powering off a relay outlet with the specified outlet ID. /// /// The ID of the relay outlet to power off. + /// public abstract void PowerOffRelay(int outletId); /// /// Powers on all relay outlets. This method is abstract and must be implemented by derived classes to provide specific functionality for powering on all relay outlets. /// + /// public abstract void PowerOnAll(); /// /// Powers off all relay outlets. This method is abstract and must be implemented by derived classes to provide specific functionality for powering off all relay outlets. /// + /// public abstract void PowerOffAll(); /// /// Reboots a specific relay outlet. This method is abstract and must be implemented by derived classes to provide specific functionality for rebooting a relay outlet with the specified outlet ID. /// /// + /// public abstract void RebootOutlet(int outletId); /// /// Reboots all relay outlets. This method is abstract and must be implemented by derived classes to provide specific functionality for rebooting all relay outlets. /// + /// public abstract void Reboot(); } \ No newline at end of file diff --git a/adas-core.module.Relays/Models/PowerOutletsConfig.cs b/adas-core.module.Relays/Models/PowerOutletsConfig.cs index 65cd3199..51b8207b 100644 --- a/adas-core.module.Relays/Models/PowerOutletsConfig.cs +++ b/adas-core.module.Relays/Models/PowerOutletsConfig.cs @@ -7,6 +7,7 @@ namespace adas_core.module.Relays.Models; /// This class includes properties to enable or disable power off and reset functionalities, /// as well as details about the outlet such as its ID, name, type, and whether to show the power outlet in the user interface. /// +/// public class PowerOutletsConfig { /// @@ -57,6 +58,7 @@ public class PowerOutletsConfig /// String representation of the PowerOutletsConfig object, including its ID, name, outlet number, and type. /// /// A string representation of the PowerOutletsConfig object. + /// public override string ToString() { return "PowerOutletsConfig id" + Id + diff --git a/adas-core.module.Relays/Models/RelaySettings.cs b/adas-core.module.Relays/Models/RelaySettings.cs index b7eabe65..76b7740b 100644 --- a/adas-core.module.Relays/Models/RelaySettings.cs +++ b/adas-core.module.Relays/Models/RelaySettings.cs @@ -4,6 +4,7 @@ /// Represents the settings for a relay device, including caching behavior, refresh intervals, and data source URLs. /// These settings allow for flexible configuration of the relay's operation, enabling it to optimize performance and ensure up-to-date information based on the specified parameters. /// +/// public class RelaySettings { /// diff --git a/adas-core.module.Relays/Utils/HttpUtils.cs b/adas-core.module.Relays/Utils/HttpUtils.cs index 5bd13943..1455b5e4 100644 --- a/adas-core.module.Relays/Utils/HttpUtils.cs +++ b/adas-core.module.Relays/Utils/HttpUtils.cs @@ -6,6 +6,7 @@ namespace adas_core.module.Relays.Utils; /// /// Utility class for handling HTTP-related operations, such as adding basic authentication headers to HTTP requests. /// +/// public static class HttpUtils { /// @@ -15,6 +16,7 @@ public static class HttpUtils /// The password for basic authentication. /// The HttpRequestHeaders to which the authentication will be added. /// The HttpRequestHeaders with the added basic authentication. + /// public static HttpRequestHeaders AddBasicAuth(string username, string password, HttpRequestHeaders headers) { var auth = Encoding.ASCII.GetBytes($"{username}:{password}"); diff --git a/adas-core/Configurations/ServiceExtension.cs b/adas-core/Configurations/ServiceExtension.cs index d4e2a7c8..23e1576d 100644 --- a/adas-core/Configurations/ServiceExtension.cs +++ b/adas-core/Configurations/ServiceExtension.cs @@ -13,6 +13,7 @@ namespace adas_core.Configurations /// /// Provides static extension methods for service-related operations. /// + /// public static class ServiceExtension { /// @@ -21,6 +22,7 @@ namespace adas_core.Configurations /// corresponding configuration sections. /// /// The whose services and configuration are used to register the option bindings. + /// public static void CreateConfigEntitiesFromAppSettingsSections(this WebApplicationBuilder builder) { builder.Services.Configure(builder.Configuration.GetSection("DatabaseSettings")); @@ -41,6 +43,7 @@ namespace adas_core.Configurations /// /// The used to configure services and application settings. /// Thrown when is null. + /// public static void UseProxyDevices(this WebApplicationBuilder builder) { if (builder == null) @@ -56,6 +59,7 @@ namespace adas_core.Configurations /// /// The to which authentication and authorization services are added. /// Thrown when the JWT signing key is not configured in the application settings. + /// public static void ConfigureJwtAuthentication(this WebApplicationBuilder builder) { var auth = new AuthSettings(); diff --git a/adas-core/Controllers/AdmissionController.cs b/adas-core/Controllers/AdmissionController.cs index 9f2a8b9b..930bda7b 100644 --- a/adas-core/Controllers/AdmissionController.cs +++ b/adas-core/Controllers/AdmissionController.cs @@ -12,6 +12,7 @@ namespace adas_core.Controllers; /// /// Provides API endpoints for managing patient admission records in the ADAS system. /// +/// [Route("admissions")] [ApiController] public class AdmissionController : ControllerBase @@ -33,6 +34,8 @@ public class AdmissionController : ControllerBase /// , or is null. /// + /// public AdmissionController(ILogger logger, IAdmissionService admissionService, IPatientService patientService, IUnitService unitService) { @@ -48,6 +51,7 @@ public class AdmissionController : ControllerBase /// Retrieves all admissions records. /// /// An containing the collection of admissions with an HTTP 200 OK response. + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -65,6 +69,7 @@ public class AdmissionController : ControllerBase /// An containing the admission details when found. /// Thrown when the provided is not a valid ObjectId format. /// Thrown when no admission matching the provided is found. + /// [HttpGet("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -87,6 +92,7 @@ public class AdmissionController : ControllerBase /// The admission data to create, provided in the request body. /// An containing the newly created admission wrapped in an OK response. /// Thrown when is null or when its NHC field is null or empty. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -104,6 +110,7 @@ public class AdmissionController : ControllerBase /// The admission entity containing the updated information to persist. /// An indicating the outcome of the update operation. /// Thrown when the admission's NHC is null or empty. + /// [HttpPut] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -122,6 +129,7 @@ public class AdmissionController : ControllerBase /// An that returns OK when the admission is successfully deleted. /// Thrown when the provided cannot be parsed as a valid ObjectId. /// Thrown when no admission is found for the specified id. + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -143,6 +151,7 @@ public class AdmissionController : ControllerBase /// Thrown when is not a valid ObjectId format. /// Thrown when no admission exists for the given id, or when the admission's unit configuration cannot be found. /// Thrown when the unit's configuration has manual admit disabled, or when no patient record matches the admission's patient number. + /// [HttpPost("{id}/admission")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -177,6 +186,7 @@ public class AdmissionController : ControllerBase /// Thrown when the parameter is null. /// Thrown when no unit configuration is found for the specified unit identifier. /// Thrown when the target unit operates in automatic census mode, or when the patient cannot be retrieved after the admission is registered. + /// [HttpPost("admit/new-patient")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -209,6 +219,7 @@ public class AdmissionController : ControllerBase /// Thrown when the provided is not a valid identifier format. /// Thrown when no unit configuration is found for the patient's unit. /// Thrown when the unit's configuration has manual move disabled, indicating the census is in automatic mode. + /// [HttpPost("{id}/patient-to-admission")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -238,6 +249,7 @@ public class AdmissionController : ControllerBase /// The string representation of the patient's identifier from the route, expected to be a valid ObjectId. /// An that returns HTTP 200 (OK) when the patient is successfully returned to admissions. /// Thrown when the provided is not in a valid ObjectId format. + /// [HttpPost("{id}/temporal-bed")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -259,6 +271,7 @@ public class AdmissionController : ControllerBase /// The identifier of the unit used to scope the admission search; must be a valid ObjectId. /// An containing the matching admission records returned by the service. /// Thrown when is not a valid ObjectId format. + /// [HttpGet("{patientNumber}/{unitId}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/AlarmController.cs b/adas-core/Controllers/AlarmController.cs index cfa27002..33c6836b 100644 --- a/adas-core/Controllers/AlarmController.cs +++ b/adas-core/Controllers/AlarmController.cs @@ -14,6 +14,7 @@ namespace adas_core.Controllers; /// Controller responsible for handling HTTP requests related to alarm observations. /// Provides endpoints to retrieve, process, and manage alarm data. /// +/// [Route("alarm-observations")] [ApiController] public class AlarmController : ControllerBase @@ -27,6 +28,8 @@ public class AlarmController : ControllerBase /// The logger instance used to log diagnostic and operational information for the controller. /// The alarm service instance used to perform alarm-related operations. /// Thrown when or is null. + /// public AlarmController(ILogger logger, IAlarmService alarmService) { LogExecutionContext.TrySetTraceIdentifier(Guid.NewGuid().ToString(), true); @@ -43,6 +46,7 @@ public class AlarmController : ControllerBase /// /// The observation alarm data transfer object containing patient, location, alarm, and timing information. /// An containing the processed with HTTP 200 status. + /// [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] [HttpPost] [Route("")] diff --git a/adas-core/Controllers/ApplicationController.cs b/adas-core/Controllers/ApplicationController.cs index 5451a2bb..0eff1e9f 100644 --- a/adas-core/Controllers/ApplicationController.cs +++ b/adas-core/Controllers/ApplicationController.cs @@ -12,6 +12,7 @@ namespace adas_core.Controllers; /// /// Provides API endpoints for managing application-level operations such as subscribers, file uploads, asset management, and cache cleaning. /// +/// [Route("application")] [ApiController] public class ApplicationController : ControllerBase @@ -38,6 +39,8 @@ public class ApplicationController : ControllerBase /// Thrown when , , /// , or is . /// + /// public ApplicationController( IFileService fileService, ISubscribersService subscribersService, @@ -59,6 +62,7 @@ public class ApplicationController : ControllerBase /// Handles an anonymous HTTP GET request to retrieve the list of subscribers by delegating to the subscribers service and returning the result. /// /// An containing the subscribers data returned by _subscribersService.GetSubscribers(). + /// [HttpGet("subscribers")] [AllowAnonymous] public IActionResult GetSubscribersVersion() @@ -71,6 +75,7 @@ public class ApplicationController : ControllerBase /// The grouped result is obtained from the subscriber grouping service and returned with an HTTP 200 OK status. /// /// An containing the grouped subscribers returned by the subscriber grouping service wrapped in an HTTP 200 OK response. + /// [HttpGet("subscribers-group")] [AllowAnonymous] public IActionResult GetSubscribersGroup() @@ -83,6 +88,7 @@ public class ApplicationController : ControllerBase /// /// The list of patient locations to be dispatched to the boxes for update. /// An containing an HTTP 200 OK response when the update messages are successfully dispatched. + /// [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] [HttpPost] public IActionResult UpdateApplications([FromBody] List boxes) @@ -97,6 +103,7 @@ public class ApplicationController : ControllerBase /// /// The list of files submitted for upload. /// An indicating the result of the upload operation. + /// [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] [HttpPost("upload")] [RequestSizeLimit(300_000_000)] @@ -116,6 +123,7 @@ public class ApplicationController : ControllerBase /// The collection of files to upload to the resolved theme. /// An containing an HTTP 200 OK response when the files are successfully uploaded. /// Thrown when the provided cannot be parsed into a valid FileEnum.AssetTheme value. + /// [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] [HttpPost("upload/{theme}/{category}/asset")] [RequestSizeLimit(300_000_000)] @@ -135,6 +143,7 @@ public class ApplicationController : ControllerBase /// The theme name to parse into an value used to look up the associated asset files. /// An containing the list of asset files for the resolved theme. /// Thrown when the parameter cannot be parsed into a valid value. + /// [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] [HttpGet("{theme}/{category}/asset")] public ActionResult UGetAssetFile(string theme) @@ -149,6 +158,7 @@ public class ApplicationController : ControllerBase /// /// An containing an HTTP 200 OK response when the cache is successfully cleared. /// Thrown when the Redis service is not available. + /// [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] [HttpGet("cleaning")] public ActionResult CleanCache() diff --git a/adas-core/Controllers/AuditController.cs b/adas-core/Controllers/AuditController.cs index a9d2dfe7..07d08e3c 100644 --- a/adas-core/Controllers/AuditController.cs +++ b/adas-core/Controllers/AuditController.cs @@ -12,6 +12,7 @@ namespace adas_core.Controllers; /// consulta de registros de auditoría del sistema. Proporciona operaciones para recuperar, /// filtrar y exportar logs de auditoría a través de peticiones HTTP. /// +/// [Route("audits")] [ApiController] public class AuditController(IAuditService auditService) : ControllerBase // Hereda de ControllerBase @@ -34,6 +35,8 @@ public class AuditController(IAuditService auditService) : ControllerBase // Her /// Una respuesta de acción que puede ser una lista de registros de auditoria o un mensaje de error. /// Retorna Ok con los registros encontrados o BadRequest si hay un error en los parámetros. /// + /// [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] [HttpPost] diff --git a/adas-core/Controllers/BoxController.cs b/adas-core/Controllers/BoxController.cs index d0720a1c..beee4df8 100644 --- a/adas-core/Controllers/BoxController.cs +++ b/adas-core/Controllers/BoxController.cs @@ -12,6 +12,7 @@ namespace adas_core.Controllers; /// /// Provides API endpoints for managing box-related operations, including units, patients, and insulation lists. /// +/// [Route("Box")] [ApiController] public class BoxController : ControllerBase @@ -31,6 +32,8 @@ public class BoxController : ControllerBase /// The service used to manage point of care operations. /// The service used to manage user-related operations. /// Thrown when any of the provided service dependencies is null. + /// public BoxController(IUnitService unitService, IPatientService patientService, IMasterListService isulationListService, IPointOfCareService pointOfCareService, IUserService userService) { _unitService = unitService; @@ -48,6 +51,7 @@ public class BoxController : ControllerBase /// The action that determines which observation list to switch (e.g., "Isolation", "Mobility"). /// An indicating the result of the operation. /// Thrown when the current user identity name is not available in the HTTP context. + /// [HttpGet("{boxNumber}/{elementSwitjAction}/switch-data")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task SwitchData(string boxNumber, string elementSwitjAction) diff --git a/adas-core/Controllers/CameraController.cs b/adas-core/Controllers/CameraController.cs index bee9fe2f..e3b591ca 100644 --- a/adas-core/Controllers/CameraController.cs +++ b/adas-core/Controllers/CameraController.cs @@ -11,6 +11,8 @@ namespace adas_core.Controllers; /// /// Retrieves API endPoints for managing Camera Service /// +/// [ApiController] public class CameraController(ICameraService cameraService) : ControllerBase { @@ -22,6 +24,7 @@ public class CameraController(ICameraService cameraService) : ControllerBase /// Indicates whether the result should include PoCs (Points of Contact). /// An containing the paginated cameras returned by the service. /// Thrown when the parameter is null. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task GetPaginatedCamera([FromBody] PaginationFilter request, bool withPoCs) @@ -35,6 +38,7 @@ public class CameraController(ICameraService cameraService) : ControllerBase /// /// The text used to search for cameras by name. /// An containing the list of cameras that match the search criteria. + /// [HttpGet("{textToSearch}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task GetSearchByName(string textToSearch) @@ -48,6 +52,7 @@ public class CameraController(ICameraService cameraService) : ControllerBase /// /// The camera entity to be created, provided in the request body. /// An containing the newly inserted camera wrapped in an HTTP 200 OK response. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task CreateCamera([FromBody] Camera camera) @@ -63,6 +68,7 @@ public class CameraController(ICameraService cameraService) : ControllerBase /// The camera payload containing the updated information. /// An containing the updated camera when the operation succeeds. /// Thrown when the provided id is not a valid ObjectId. + /// [HttpPut("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task UpdateCamera(string id, [FromBody] Camera camera) @@ -77,6 +83,7 @@ public class CameraController(ICameraService cameraService) : ControllerBase /// The string representation of the camera's ObjectId to be deleted. /// An containing the result of the delete operation when the id is valid. /// Thrown when the provided cannot be parsed as a valid ObjectId. + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task DeleteCamera(string id) diff --git a/adas-core/Controllers/ConfigDisplayController.cs b/adas-core/Controllers/ConfigDisplayController.cs index 094e1f84..c9b52904 100644 --- a/adas-core/Controllers/ConfigDisplayController.cs +++ b/adas-core/Controllers/ConfigDisplayController.cs @@ -22,6 +22,8 @@ namespace adas_core.Controllers; /// A new instance of . /// /// Thrown when is . +/// [Route("config-displays")] [ApiController] public class ConfigDisplayController( @@ -35,6 +37,10 @@ public class ConfigDisplayController( /// /// List /// + /// + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -49,6 +55,12 @@ public class ConfigDisplayController( /// /// List /// + /// + /// + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -63,6 +75,10 @@ public class ConfigDisplayController( /// /// List /// + /// + /// [HttpGet("compact")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task ListCompact() @@ -76,6 +92,12 @@ public class ConfigDisplayController( /// /// List /// + /// + /// + /// [HttpGet("{type}/type")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -90,6 +112,8 @@ public class ConfigDisplayController( /// /// displayConfig /// + /// [HttpGet("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -106,6 +130,7 @@ public class ConfigDisplayController( /// /// The display configuration to insert, supplied in the request body. /// An containing the inserted display configuration wrapped in an HTTP 200 OK response. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -120,6 +145,7 @@ public class ConfigDisplayController( /// /// The display configuration payload received in the request body, which may optionally include a display config ID template. /// An containing the result of the insertion operation. + /// [HttpPost("compact")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -136,6 +162,7 @@ public class ConfigDisplayController( /// Handles a GET request to the "insertion-test" endpoint, performing a test insertion via the display configuration service. Requires the caller to have the role and the "Source.DisplayId" permission. /// /// An containing the result of the test insertion wrapped in an HTTP 200 OK response. + /// [HttpGet("insertion-test")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -151,6 +178,10 @@ public class ConfigDisplayController( /// /// display /// + /// + /// [HttpPut("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -171,6 +202,7 @@ public class ConfigDisplayController( /// The new color configuration to apply. /// An containing the update result on success, or a not-modified status when the update produces no changes. /// Thrown when is not a valid ObjectId format. + /// [HttpPut("{idConfig}/color-config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -191,6 +223,7 @@ public class ConfigDisplayController( /// The header configuration payload to be applied to the display configuration. /// An containing the update result on success, or a response indicating that the resource was not modified when no changes were made. /// Thrown when cannot be parsed as a valid ObjectId. + /// [HttpPut("{idConfig}/header-config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -213,6 +246,7 @@ public class ConfigDisplayController( /// Thrown when is not a valid ObjectId format. /// Thrown when no display configuration is found for the parsed id. /// Thrown when the found display configuration is not of type . + /// [HttpPut("{idConfig}/home-banner")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -233,6 +267,7 @@ public class ConfigDisplayController( /// /// The display configuration to apply as the base configuration. /// An containing the update result, or an "OkResouceNotModified" response when no changes were made. + /// [HttpPut("update/base-config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -248,6 +283,10 @@ public class ConfigDisplayController( /// /// The card configuration data to be updated. /// An containing the updated configuration or a not-modified response. + /// + /// [HttpPut("update/card-config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -263,6 +302,7 @@ public class ConfigDisplayController( /// /// The card details configuration to be updated. /// An containing the update result, or a not-modified message if the resource was not changed. + /// [HttpPut("update/detail-config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -278,6 +318,7 @@ public class ConfigDisplayController( /// /// The chart configuration to update. /// An containing the update result, or an OkResouceNotModified response when the configuration was not changed. + /// [HttpPut("update/chart-config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -295,6 +336,7 @@ public class ConfigDisplayController( /// The list of fields to be applied to the specified display configuration. /// An containing the result of the update operation. /// Thrown when the provided is not a valid ObjectId format. + /// [HttpPut("{idConfig}/field-list")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -315,6 +357,7 @@ public class ConfigDisplayController( /// The data transfer object containing the new display configuration name. /// An containing the update result, or a not-modified status when the name is unchanged. /// Thrown when the configuration ID is not a valid format or when the display name is empty. + /// [HttpPost("{idConfig}/name")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -335,6 +378,7 @@ public class ConfigDisplayController( /// /// The data transfer object containing the card configuration details to be created. /// An containing the result of the insert operation wrapped in an HTTP 200 OK response. + /// [HttpPost("card-config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -350,6 +394,7 @@ public class ConfigDisplayController( /// /// The data transfer object containing the details of the card display configuration to create. /// An containing the result of the insert operation wrapped in an HTTP 200 OK response. + /// [HttpPost("detail-config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -364,6 +409,7 @@ public class ConfigDisplayController( /// /// The data transfer object containing the chart configuration details to be created. /// An containing the result of the chart configuration insertion wrapped in an HTTP 200 OK response. + /// [HttpPost("chart-config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -378,6 +424,7 @@ public class ConfigDisplayController( /// This endpoint allows anonymous access and returns the complete list of card configurations. /// /// An containing the HTTP 200 OK response with all card configurations. + /// [HttpGet("get-all-card-config")] [AllowAnonymous] public async Task GetAllCardConfig() @@ -394,6 +441,7 @@ public class ConfigDisplayController( /// An containing the result of the deletion when successful. /// Thrown when is not a valid identifier format. /// Thrown when the display configuration could not be deleted. + /// [HttpDelete("{idConfig}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -414,6 +462,7 @@ public class ConfigDisplayController( /// An that returns HTTP 200 (OK) with the result of the deletion when the chart configuration is successfully removed. /// Thrown when is not a valid identifier format. /// Thrown when the chart configuration cannot be deleted due to a conflict. + /// [HttpDelete("chart-config/{idConfig}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -435,6 +484,7 @@ public class ConfigDisplayController( /// The chart configuration wrapped in an HTTP 200 OK response when found. /// Thrown when is not a valid ObjectId format. /// Thrown when no chart configuration matches the provided identifier. + /// [HttpGet("chart-config/{idConfig}")] [AllowAnonymous] public async Task GetChartConfig(string idConfig) @@ -454,6 +504,7 @@ public class ConfigDisplayController( /// The display configuration identifier used to look up its associated locations. /// The display configuration locations returned by the service. /// Thrown when is not a valid ObjectId format. + /// [HttpGet("{idConfig}/locations")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -474,6 +525,10 @@ public class ConfigDisplayController( /// //[AuthorizeRoles(RolesType.Some)] //[TypeFilter(type: typeof(AuthorizePermissionsAttribute), Arguments = new object[] { "DisplayId", AuthorizeUserByServiceType.CONFIGDISPLAY })] + /// + /// [HttpGet] [AllowAnonymous] [Route("{id}/getMedia/{filename}")] @@ -534,6 +589,8 @@ public class ConfigDisplayController( /// display config id /// File details list /// + /// [AllowAnonymous] [HttpGet("allMediaFiles/{id}")] public async Task GetAllMediaFiles(string id) diff --git a/adas-core/Controllers/ConfigObservationController.cs b/adas-core/Controllers/ConfigObservationController.cs index 93407bc4..85b5e9c0 100644 --- a/adas-core/Controllers/ConfigObservationController.cs +++ b/adas-core/Controllers/ConfigObservationController.cs @@ -44,6 +44,7 @@ public class ConfigObservationController : ControllerBase /// /// An containing the active configuration observations. /// Thrown when no configuration observations are returned by the service. + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -58,6 +59,10 @@ public class ConfigObservationController : ControllerBase /// GetByCodeSysAndCode compact configs /// /// + /// + /// [HttpGet("compact")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -73,6 +78,12 @@ public class ConfigObservationController : ControllerBase /// /// /// + /// + /// + /// [HttpGet("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -91,6 +102,8 @@ public class ConfigObservationController : ControllerBase /// Get a list of paginated items /// /// + /// [HttpPost("paginated-items")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -107,6 +120,7 @@ public class ConfigObservationController : ControllerBase /// /// /// + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -126,6 +140,8 @@ public class ConfigObservationController : ControllerBase /// /// /// + /// [HttpPost("item")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -145,6 +161,10 @@ public class ConfigObservationController : ControllerBase /// /// /// + /// + /// [HttpPut("{configId}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -166,6 +186,7 @@ public class ConfigObservationController : ControllerBase /// /// /// + /// [HttpGet("itemName/{itemName}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -180,6 +201,7 @@ public class ConfigObservationController : ControllerBase /// /// /// + /// [HttpGet("item/by-code-sys-and-code/{data}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -202,6 +224,7 @@ public class ConfigObservationController : ControllerBase /// The configuration observation item to delete, provided in the request body. /// An containing the result of the deletion operation. /// Thrown when the is null, indicating missing required parameters. + /// [HttpDelete("delete/item")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -219,6 +242,12 @@ public class ConfigObservationController : ControllerBase /// /// /// + /// + /// + /// [HttpGet("{itemName}/name")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -233,6 +262,7 @@ public class ConfigObservationController : ControllerBase /// Retrieves the list of configuration names available for observations, restricted to users with the required role and source-level display permission. /// /// An containing the configuration names returned by the observation service wrapped in an HTTP 200 OK response. + /// [HttpGet("get-name-obs")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -247,6 +277,7 @@ public class ConfigObservationController : ControllerBase /// /// The new configuration observation to log, or null to indicate the configuration was removed. /// The previous configuration observation to log, or null to indicate no prior configuration existed. + /// private async Task LogHistoricalConfigChanged(ConfigObservation? newConfigObservation, ConfigObservation? oldConfigObservation) { diff --git a/adas-core/Controllers/DeviceController.cs b/adas-core/Controllers/DeviceController.cs index 6a99bc86..bd5819d5 100644 --- a/adas-core/Controllers/DeviceController.cs +++ b/adas-core/Controllers/DeviceController.cs @@ -34,6 +34,7 @@ public class DeviceController : ControllerBase /// /// The device data transfer object containing the information of the device to be created. /// An IActionResult containing the created device on success, or a Conflict response if the creation fails. + /// [HttpPost("add")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task CreateDevice([FromBody] DeviceDto device) @@ -48,6 +49,7 @@ public class DeviceController : ControllerBase /// /// The string representation of the device's ObjectId to delete. /// An IActionResult indicating the outcome of the delete operation. + /// [HttpDelete("delete/{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task CreateDevice(string id) @@ -63,6 +65,10 @@ public class DeviceController : ControllerBase /// /// The device data transfer object containing the updated device information. /// An containing the updated device on success, or a when the update returns null. + /// + /// [HttpPut("edit")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task EditDevice([FromBody] DeviceDto device) @@ -78,6 +84,7 @@ public class DeviceController : ControllerBase /// /// The device payload received in the request body to be processed as an event. /// An that returns on successful processing, or with a message when the service cannot create the device. + /// [HttpPost("event")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task ReceiveEventDevice([FromBody] DeviceDto device) diff --git a/adas-core/Controllers/DiagnosisController.cs b/adas-core/Controllers/DiagnosisController.cs index f6ae09eb..380443c6 100644 --- a/adas-core/Controllers/DiagnosisController.cs +++ b/adas-core/Controllers/DiagnosisController.cs @@ -38,6 +38,7 @@ public class DiagnosisController : ControllerBase /// /// The diagnosis payload received in the request body, containing the patient number, location, observation data, observations, diagnosis text, message timestamp, and a flag indicating whether the caller wants to wait for the result. /// An that returns an HTTP 200 OK response when the request is accepted for processing. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/DischargeController.cs b/adas-core/Controllers/DischargeController.cs index 8a46162d..fc56472f 100644 --- a/adas-core/Controllers/DischargeController.cs +++ b/adas-core/Controllers/DischargeController.cs @@ -41,6 +41,7 @@ public class DischargeController : ControllerBase /// Retrieves all discharge records available in the system. /// /// An containing the collection of discharges with an HTTP 200 OK response. + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -57,6 +58,7 @@ public class DischargeController : ControllerBase /// The string identifier of the discharge to retrieve, expected to be a valid ObjectId. /// An containing the discharge data when found. /// Thrown when the provided cannot be parsed as a valid ObjectId. + /// [HttpGet("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -75,6 +77,7 @@ public class DischargeController : ControllerBase /// The discharge information, including the patient identifier, to be persisted. /// An that returns an OK response when the discharge is successfully recorded. /// Thrown when the parameter is null, indicating missing required parameters. + /// [HttpPost("patient")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -94,6 +97,7 @@ public class DischargeController : ControllerBase /// The discharge entity supplied in the request body, identified by its Id. /// An that yields an Ok response on successful update. /// Thrown when the supplied payload is null. + /// [HttpPut] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -114,6 +118,7 @@ public class DischargeController : ControllerBase /// The discharge entity to insert, provided in the request body. /// An containing the inserted discharge wrapped in an HTTP 200 OK response. /// Thrown when the parameter is null, indicating missing required parameters. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -132,6 +137,7 @@ public class DischargeController : ControllerBase /// An representing the result of the delete operation. /// Thrown when the provided is not a valid ObjectId format. /// Thrown when the patient's Altable option type is not Altable, preventing the deletion. + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/DisplayController.cs b/adas-core/Controllers/DisplayController.cs index b3df5591..2679c64f 100644 --- a/adas-core/Controllers/DisplayController.cs +++ b/adas-core/Controllers/DisplayController.cs @@ -31,6 +31,8 @@ public class DisplayController( /// /// List /// + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] //[PermissionAuthorize("Source", "DisplayId")] @@ -44,6 +46,7 @@ public class DisplayController( /// Retrieves a compact list of all displays, requiring the caller to be authenticated with the role and to have the "Source" / "DisplayId" permission. /// /// An containing the HTTP 200 response with the compact display list returned by the display service. + /// [HttpGet("compact")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -58,6 +61,7 @@ public class DisplayController( /// The pagination filter containing paging criteria sent in the request body. /// An containing the paginated displays wrapped in an HTTP 200 OK response. /// Thrown when the payload is null, indicating missing required parameters. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -75,6 +79,7 @@ public class DisplayController( /// /// List /// + /// [HttpGet("{type}/type")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -89,6 +94,10 @@ public class DisplayController( /// /// List /// + /// + /// [HttpGet("{type}/compact")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -103,6 +112,8 @@ public class DisplayController( /// /// List /// + /// [HttpPost("poc")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -117,6 +128,8 @@ public class DisplayController( /// /// display /// + /// [HttpGet("{name}/name")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -132,6 +145,12 @@ public class DisplayController( /// /// display /// + /// + /// + /// [HttpGet("{localeEnum}/{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -149,6 +168,7 @@ public class DisplayController( /// The string representation of the display's unique identifier. /// An containing the requested display entity. /// Thrown when the provided is not a valid ObjectId format. + /// [HttpGet("{id}/adm-panel")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -167,6 +187,14 @@ public class DisplayController( /// /// List /// + /// + /// + /// + /// [HttpGet("{id}/unitId")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -184,6 +212,12 @@ public class DisplayController( /// /// display /// + /// + /// + /// [HttpGet("{id}/info")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -205,6 +239,7 @@ public class DisplayController( /// The display type used to filter the configuration lookup. /// An containing the display configuration retrieved for the supplied identifier and type. /// Thrown when is not a valid ObjectId format. + /// [HttpGet("{id}/unitId/{type}/type")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -221,6 +256,7 @@ public class DisplayController( /// /// The collection of display identifiers used to look up the available points of contact. /// An containing the list of available points of contact matching the provided display identifiers. + /// [HttpPost("poc-available")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -237,6 +273,7 @@ public class DisplayController( /// The display identifier used to look up the associated POCs. /// An containing the POC list returned by the display service. /// Thrown when is not a valid ObjectId format. + /// [HttpGet("{displayId}/pocs")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -255,6 +292,10 @@ public class DisplayController( /// /// display /// + /// + /// [HttpPut("{id}/pocs-ids")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] // [PermissionAuthorize("Source", "DisplayId")] @@ -280,6 +321,14 @@ public class DisplayController( /// /// display /// + /// + /// + /// + /// [HttpPut("{idDisplay}/config-preset/{idConfig}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] // [PermissionAuthorize("Source", "DisplayId")] @@ -302,6 +351,14 @@ public class DisplayController( /// /// display /// + /// + /// + /// + /// [HttpPut("{id}/{name}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] // [PermissionAuthorize("Source", "DisplayId")] @@ -319,6 +376,8 @@ public class DisplayController( /// /// display /// + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] // [PermissionAuthorize("Source", "DisplayId")] @@ -335,6 +394,12 @@ public class DisplayController( /// /// display /// + /// + /// + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] // [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/GroupedObservationsController.cs b/adas-core/Controllers/GroupedObservationsController.cs index a3fba356..680c1005 100644 --- a/adas-core/Controllers/GroupedObservationsController.cs +++ b/adas-core/Controllers/GroupedObservationsController.cs @@ -43,6 +43,7 @@ public class GroupedObservationsController : ControllerBase /// The configuration that defines how observations should be grouped. /// An containing the generated grouped observation wrapped in an HTTP 200 OK response. /// Thrown when is null, empty, or not in a valid ObjectId format. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/LightBeaconController.cs b/adas-core/Controllers/LightBeaconController.cs index 1f9fcfcf..67066088 100644 --- a/adas-core/Controllers/LightBeaconController.cs +++ b/adas-core/Controllers/LightBeaconController.cs @@ -45,6 +45,7 @@ public class LightBeaconController : ControllerBase /// The pagination filter containing the paging parameters used to query the beacons. /// An containing the paginated list of beacons returned by the service. /// Thrown when the parameter is null, indicating missing parameters. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task GetPaginatedUnits([FromBody] PaginationFilter request) @@ -59,6 +60,8 @@ public class LightBeaconController : ControllerBase /// /// The light beacon data to create the camera from, supplied in the request body. /// An containing the created light beacon. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task CreateCamera([FromBody] LightBeacon beac) @@ -73,6 +76,7 @@ public class LightBeaconController : ControllerBase /// The light beacon payload containing the updated information, sourced from the request body. /// An containing the updated light beacon returned by the service. /// Thrown when the provided cannot be parsed as a valid ObjectId. + /// [HttpPut("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task UpdateCamera(string id, [FromBody] LightBeacon beacon) @@ -87,6 +91,8 @@ public class LightBeaconController : ControllerBase /// /// The text used to search for the light beacon by name. /// An containing the matching beacon, or a not-found response if no match exists. + /// [HttpGet("{textToSearch}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task GetSearchByName(string textToSearch) @@ -103,6 +109,7 @@ public class LightBeaconController : ControllerBase /// An indicating successful completion. /// Thrown when is not a valid format. /// Thrown when the patient cannot be found or has no associated point of care. + /// [HttpPost("on/{color}")] public async Task On([FromBody] string patientId, string color) { @@ -148,6 +155,7 @@ public class LightBeaconController : ControllerBase /// /// The string representation of the POC ObjectId whose light beacon LED should be powered off. /// Thrown when is not a valid ObjectId format. + /// [HttpPost("off")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public IActionResult Off([FromBody] string pocId) @@ -164,6 +172,7 @@ public class LightBeaconController : ControllerBase /// /// The light beacon data to be created, provided in the request body. /// An containing the inserted beacon on success, or a conflict response if the insertion fails. + /// [HttpPost("create")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task Create([FromBody] adas_core.Domain.Models.MongoModels.LightBeacon beacon) diff --git a/adas-core/Controllers/MasterListController.cs b/adas-core/Controllers/MasterListController.cs index 31e4c6aa..fa0ba559 100644 --- a/adas-core/Controllers/MasterListController.cs +++ b/adas-core/Controllers/MasterListController.cs @@ -31,6 +31,7 @@ public class MasterListController( /// Retrieves the master list settings for the authenticated user with the required permission. /// /// An containing the master list settings on success. + /// [HttpGet("list-settings")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public IActionResult GetMasterListSettings() @@ -44,6 +45,7 @@ public class MasterListController( /// The name of the master list type used to resolve the corresponding service. /// An containing the master list data when the specified type is valid. /// Thrown when does not correspond to a valid MasterListType value. + /// [HttpGet("{typeName}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -62,6 +64,7 @@ public class MasterListController( /// Retrieves all master list entries (without their associated options) for every value, aggregating the results from each type's dedicated service resolved through the service factory. /// /// An containing an HTTP 200 response with the combined collection of items gathered from all master list services. + /// [HttpGet("no-options")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -86,6 +89,7 @@ public class MasterListController( /// The pagination filter containing paging criteria applied to the master list query. /// An containing the paginated master list result wrapped in an HTTP 200 OK response. /// Thrown when cannot be parsed into a valid value. + /// [HttpPost("{typeName}/paginated-options")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -107,6 +111,7 @@ public class MasterListController( /// The name of the master list type to count, parsed into the enum. /// An containing the count of master list items. /// Thrown when the provided cannot be parsed into a valid . + /// [HttpGet("{typeName}/count")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -125,6 +130,7 @@ public class MasterListController( /// Requires the "AuthSome" role and the "DisplayId" permission on the "Source" resource. /// /// An containing a that maps each to its total record count, returned with HTTP 200 OK. + /// [HttpGet("count")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -148,6 +154,7 @@ public class MasterListController( /// An containing the requested master list entry. /// Thrown when cannot be parsed as a valid MasterListType. /// Thrown when is not in a valid ObjectId format. + /// [HttpGet("{typeName}/{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -174,6 +181,7 @@ public class MasterListController( /// An containing the paginated master list options returned by the resolved service. /// Thrown when does not correspond to a valid value. /// Thrown when is not a valid ObjectId format. + /// [HttpPost("{typeName}/{id}/master-list-paginated-options")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -197,6 +205,7 @@ public class MasterListController( /// The name of the master list type used to resolve the corresponding service through the service factory. /// An containing the paginated master list result with its options. /// Thrown when the provided cannot be parsed as a valid MasterListType. + /// [HttpPost("{typeName}/paginated-master-list-paginated-options")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -228,6 +237,7 @@ public class MasterListController( /// An containing the paginated options payload. /// Thrown when cannot be parsed as a valid value. /// Thrown when is not a valid format. + /// [HttpPost("{typeName}/{id}/paginated-options")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -261,6 +271,7 @@ public class MasterListController( /// An containing the master list options names returned by the resolved service. /// Thrown when cannot be parsed as a value. /// Thrown when is not a valid format. + /// [HttpGet("{typeName}/{id}/master-list-options-names")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -285,6 +296,7 @@ public class MasterListController( /// The name of the master list entry to look up. /// An containing the result of the master list lookup. /// Thrown when cannot be parsed into a valid . + /// [HttpGet("{typeName}/{name}/name")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -308,6 +320,7 @@ public class MasterListController( /// The name of the target used to resolve the related options service. /// The containing the related options for the requested category. /// Thrown when or cannot be parsed as a valid , or when is not a valid ObjectId. + /// [HttpGet("{typeName}/{listId}/related-options/{targetCategory}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -337,6 +350,12 @@ public class MasterListController( /// id de la lista /// /// + /// + /// + /// [HttpPost("{typeName}/{id}/options")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -370,6 +389,7 @@ public class MasterListController( /// An containing the filtered master list results returned by the resolved service. /// Thrown when cannot be parsed to a valid value. /// Thrown when is provided but is shorter than 3 characters. + /// [HttpGet("{typeName}/{textSearch}/text")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -399,6 +419,7 @@ public class MasterListController( /// The string identifier of the master list type, which is parsed into the enum to resolve the appropriate service. /// An containing the paginated master list result. /// Thrown when cannot be parsed into a valid value. + /// [HttpPost("{typeName}/paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -428,6 +449,7 @@ public class MasterListController( /// An containing the result of the insert operation. /// Thrown when is null. /// Thrown when cannot be parsed into a valid . + /// [HttpPost("{typeName}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -448,6 +470,7 @@ public class MasterListController( /// The master list payload containing the new values to persist. /// An containing the result of the update operation. /// Thrown when is ; when cannot be parsed into a ; or when is not a valid . + /// [HttpPut("{typeName}/{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -474,6 +497,7 @@ public class MasterListController( /// An containing the result of the add operation. /// Thrown when cannot be parsed into a valid MasterListType value. /// Thrown when is not a valid ObjectId format. + /// [HttpPost("{typeName}/{id}/item")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -505,6 +529,7 @@ public class MasterListController( /// The option payload containing the updated values. /// The updated master list result on success; otherwise, a 409 Conflict when the update fails. /// Thrown when is not a valid , when is not a valid , or when is not a valid ObjectId. + /// [HttpPut("{locale}/{typeName}/{id}/item")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -538,6 +563,7 @@ public class MasterListController( /// An that returns the updated result on success or a Conflict response when the update fails. /// Thrown when does not match a valid value. /// Thrown when is not a valid format. + /// [HttpPut("{typeName}/{id}/item")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -569,6 +595,7 @@ public class MasterListController( /// The payload containing the new details to apply to the master list entry. /// The updated master list result wrapped in an , or a conflict response when the update fails. /// Thrown when does not correspond to a valid master list type, or when is not a valid ObjectId. + /// [HttpPut("{typeName}/{id}/details")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -601,6 +628,7 @@ public class MasterListController( /// The payload containing the new name to apply to the master list. /// An with the result of the update, when the name is missing, or when the update fails. /// Thrown when does not correspond to a known master list type, or when is not a valid ObjectId. + /// [HttpPut("{typeName}/{id}/name")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -633,6 +661,7 @@ public class MasterListController( /// An that returns OK on success, BadRequest when the description is null, or Conflict when the update does not succeed. /// Thrown when does not correspond to a valid master list type. /// Thrown when is not in a valid identifier format. + /// [HttpPut("{typeName}/{id}/description")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -671,6 +700,7 @@ public class MasterListController( /// Thrown when does not match a known master list type. /// Thrown when or are not valid ObjectId values. /// Thrown when the deletion operation returns no result. + /// [HttpDelete("{typeName}/{id}/item/{itemId}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -703,6 +733,7 @@ public class MasterListController( /// An that returns Ok when the master list item is successfully deleted. /// Thrown when cannot be parsed as a value. /// Thrown when is not a valid ObjectId format. + /// [HttpDelete("{typeName}/{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/MedicinesController.cs b/adas-core/Controllers/MedicinesController.cs index 9da14aa1..538641bf 100644 --- a/adas-core/Controllers/MedicinesController.cs +++ b/adas-core/Controllers/MedicinesController.cs @@ -44,6 +44,7 @@ public class MedicinesController : ControllerBase /// Retrieves all active medicines, restricted to users with the required authorization role and source/display permissions. /// /// An containing the collection of active medicines returned by the medicine service wrapped in an HTTP 200 OK response. + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -61,6 +62,7 @@ public class MedicinesController : ControllerBase /// The identifier of the patient whose active medicines are being requested. /// An containing the active medicines for the patient wrapped in an HTTP 200 response. /// Thrown when is not a valid ObjectId format. + /// [HttpGet("{patientId}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -81,6 +83,7 @@ public class MedicinesController : ControllerBase /// The pagination filter containing paging criteria used to query the medicines. /// An containing the paginated medicines result on success. /// Thrown when the is null, indicating missing required parameters. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -97,6 +100,7 @@ public class MedicinesController : ControllerBase /// The medicine payload supplied in the request body to be created. /// An containing the newly inserted medicine wrapped in an HTTP 200 OK response. /// Thrown when the provided is null, indicating missing required parameters. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -115,6 +119,7 @@ public class MedicinesController : ControllerBase /// The medicine payload containing the updated information to apply. /// An containing the updated medicine returned in an Ok response. /// Thrown when the provided cannot be parsed as a valid ObjectId. + /// [HttpPut("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -132,6 +137,7 @@ public class MedicinesController : ControllerBase /// /// The unique identifier of the medicine to delete. /// An containing an HTTP 200 OK response upon successful deletion. + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -146,6 +152,7 @@ public class MedicinesController : ControllerBase /// Access is restricted to users with the required role and permission for the "Source" entity's "DisplayId" action. /// /// An containing the list of all medicine groups returned by the medicine service. + /// [HttpGet("groups")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -158,6 +165,7 @@ public class MedicinesController : ControllerBase /// Retrieves all available medicine types, requiring authentication with the appropriate role and permission. /// /// An containing the list of all medicine types if successful. + /// [HttpGet("types")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -170,6 +178,7 @@ public class MedicinesController : ControllerBase /// Retrieves the list of all medicine names. Requires the user to have the specified role permission and "DisplayId" permission for the "Source" resource. /// /// An containing the collection of medicine names returned by the service. + /// [HttpGet("names")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -182,6 +191,7 @@ public class MedicinesController : ControllerBase /// Retrieves the list of all medicine codes available in the system. /// /// An containing the collection of medicine codes with an HTTP 200 OK response. + /// [HttpGet("codes")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/NoticeController.cs b/adas-core/Controllers/NoticeController.cs index d7a9e667..ef741426 100644 --- a/adas-core/Controllers/NoticeController.cs +++ b/adas-core/Controllers/NoticeController.cs @@ -38,6 +38,7 @@ public class NoticeController : ControllerBase /// Retrieves all notices for the authorized source, requiring the "DisplayId" permission under the "Source" resource and the AuthSome role. /// /// An containing the list of notices returned by the notice service, wrapped in an HTTP 200 OK response. + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -52,6 +53,7 @@ public class NoticeController : ControllerBase /// /// The notice type used to filter and retrieve the relevant notices. /// An containing the notices that match the specified type. + /// [HttpGet("{type}/type")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -66,6 +68,7 @@ public class NoticeController : ControllerBase /// /// The identifier of the notice to retrieve. /// An containing the notice data returned by the notice service. + /// [HttpGet("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -84,6 +87,7 @@ public class NoticeController : ControllerBase /// The display identifier supplied via the request header, which must be a valid ObjectId. /// An containing the result produced by the notice service insert operation. /// Thrown when the header value is not a valid ObjectId format. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -103,6 +107,7 @@ public class NoticeController : ControllerBase /// The notice payload containing the updated information. /// An that produces a 200 OK response when the update succeeds. /// Thrown when is not in a valid object identifier format. + /// [HttpPut("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -121,6 +126,7 @@ public class NoticeController : ControllerBase /// The string representation of the notice's ObjectId to be deleted. /// An indicating the result of the delete operation. /// Thrown when the provided is not a valid ObjectId format. + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/ObservationsController.cs b/adas-core/Controllers/ObservationsController.cs index 1621fc5f..7b9c7f4d 100644 --- a/adas-core/Controllers/ObservationsController.cs +++ b/adas-core/Controllers/ObservationsController.cs @@ -46,6 +46,7 @@ public class ObservationController : ControllerBase /// /// The observation data transfer object containing the patient number, location, observation data, observations, message time, and wait result used to build the API request. /// An representing an HTTP 204 No Content response after the request is handled. + /// [HttpPost] [Route("")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] @@ -75,6 +76,7 @@ public class ObservationController : ControllerBase /// /// The observation data received in the request body, including patient, location, and measurement details. /// An representing a 204 No Content response after the request is queued for saving. + /// [HttpPost] [Route("NurseObservations")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] @@ -107,6 +109,7 @@ public class ObservationController : ControllerBase /// WaitResult is true, the request is saved synchronously; otherwise it is /// saved asynchronously. /// An representing an HTTP 200 OK response. + /// [HttpPost] [Route("apiRequest")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] @@ -124,6 +127,7 @@ public class ObservationController : ControllerBase /// Expires all observations by invoking the observation service's expiration process. /// /// An representing the HTTP 200 OK response indicating a successful expiration operation. + /// [HttpPost("expired")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -140,6 +144,7 @@ public class ObservationController : ControllerBase /// The pagination filter containing the paging criteria sent in the request body. /// An containing the paginated observations returned by the observation service. /// Thrown when the is null. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -157,6 +162,7 @@ public class ObservationController : ControllerBase /// An containing the observations found between the specified dates for the resolved patient. /// Thrown when the request does not include a patient number. /// Thrown when no patient matching the supplied patient number exists in either the active or archived records. + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -186,6 +192,7 @@ public class ObservationController : ControllerBase /// The unique identifier of the patient for whom the observation is being recorded. /// The NEWS score value to associate with the observation. /// Thrown when the is not a valid ObjectId format or when the is not a valid integer. + /// [HttpPost("{patientId}/force-news/{value}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/PatientAppointmentController.cs b/adas-core/Controllers/PatientAppointmentController.cs index 3c5491e7..877bcd0c 100644 --- a/adas-core/Controllers/PatientAppointmentController.cs +++ b/adas-core/Controllers/PatientAppointmentController.cs @@ -40,6 +40,7 @@ public class PatientAppointmentController : ControllerBase /// /// The appointment data received in the request body, containing patient number, location, appointments, message time, and wait result. /// An that returns an HTTP 200 OK response when the request is successfully saved. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] public IActionResult ProcessRequest([FromBody] AppointmentDto appointmentDto) diff --git a/adas-core/Controllers/PatientController.cs b/adas-core/Controllers/PatientController.cs index b8c842fc..3e871d47 100644 --- a/adas-core/Controllers/PatientController.cs +++ b/adas-core/Controllers/PatientController.cs @@ -41,6 +41,7 @@ public class PatientController : ControllerBase /// The service responsible for user management and authentication. /// The service responsible for unit-related operations. + /// public PatientController( IPatientService patientService, IObservationService observationService, @@ -61,6 +62,7 @@ public class PatientController : ControllerBase /// and a granted "DisplayId" permission on the "Source" resource. /// /// An containing the full collection of patients retrieved from the patient service. + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -74,6 +76,7 @@ public class PatientController : ControllerBase /// /// The unique patient number used to look up the patient. /// An containing the patient information returned by the service. + /// [HttpGet("find-by-patientnumber/{patientNumber}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task GetByPatientNumber(string patientNumber) @@ -88,6 +91,7 @@ public class PatientController : ControllerBase /// The patient's identifier expected to be a valid ObjectId string. /// An containing the last observation payload on success. /// Thrown when is not a valid ObjectId format. + /// [HttpGet("{patientId}/last-observation")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -104,6 +108,7 @@ public class PatientController : ControllerBase /// Access is restricted to authorized users with the required role and source display permission. /// /// An containing the collection of active patients returned by the service. + /// [HttpGet("active-poc")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -120,6 +125,7 @@ public class PatientController : ControllerBase /// The pagination filter containing criteria for querying patients. /// An containing the paginated patients when successful. /// Thrown when the is null. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -134,6 +140,7 @@ public class PatientController : ControllerBase /// Retrieves a basic list of all persons associated with registered patients, requiring the AuthSome role and the Source.DisplayId permission. /// /// An containing an HTTP 200 response with the collection of person records derived from all patients. + /// [HttpGet("basic")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -150,6 +157,7 @@ public class PatientController : ControllerBase /// /// The patient data transfer object containing the patient number, location, patient details, message time, and wait result used to build the request. /// An containing the patient record retrieved after the request is saved. + /// [HttpPost("request")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -178,6 +186,7 @@ public class PatientController : ControllerBase /// /// The API request payload received from the request body to be saved. /// An that returns HTTP 200 (OK) when the request is successfully persisted. + /// [HttpPost("api-request")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -194,6 +203,7 @@ public class PatientController : ControllerBase /// The patient's identifier expected to be a valid ObjectId string. /// An containing the patient data when found. /// Thrown when is not a valid ObjectId format. + /// [HttpGet("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -215,6 +225,7 @@ public class PatientController : ControllerBase /// Thrown when is not a valid ObjectId format. /// Thrown when no unit configuration is found for the patient's unit. /// Thrown when the unit operates in automatic census mode, disallowing manual discharge. + /// [HttpPost("{id}/exit")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -246,6 +257,7 @@ public class PatientController : ControllerBase /// An containing the updated patient data when the operation succeeds. /// Thrown when the current user identity name is not available in the HTTP context. /// Thrown when the provided cannot be parsed as a valid identifier. + /// [HttpPost("{id}/archived-procedure")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -275,6 +287,7 @@ public class PatientController : ControllerBase /// An containing the updated patient record on success. /// Thrown when the current user has no identity name associated with the request. /// Thrown when the provided patient id is not a valid ObjectId format. + /// [HttpPost("{id}/archived-test")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -304,6 +317,7 @@ public class PatientController : ControllerBase /// The updated patient data after the treatment has been archived. /// Thrown when the current user's identity name is not available in the HTTP context. /// Thrown when the provided patient ID is not in a valid ObjectId format. + /// [HttpPost("{id}/archived-treatment")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -335,6 +349,7 @@ public class PatientController : ControllerBase /// The updated patient data sent in the request body. /// An containing the updated patient on success. /// Thrown when the is not a valid ObjectId format. + /// [HttpPut("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -356,6 +371,7 @@ public class PatientController : ControllerBase /// Thrown when no unit configuration is found for the patient's current unit. /// Thrown when the patient's unit is operating in automatic census mode, disallowing manual moves. /// Thrown when the move operation fails to complete successfully. + /// [HttpGet("{patientId}/{oldPoc}/new-location/{newPoc}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -393,6 +409,7 @@ public class PatientController : ControllerBase /// Thrown when the supplied is not a valid ObjectId format. /// Thrown when no unit configuration is found for the patient's unit. /// Thrown when the patient's unit is not configured for manual editing. + /// [HttpPut("{id}/{patientNumber}/data")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -426,6 +443,7 @@ public class PatientController : ControllerBase /// An representing an HTTP 200 OK response when the update succeeds. /// Thrown when the current user identity name is not available in the HTTP context. /// Thrown when the provided is not a valid ObjectId format. + /// [HttpPut("{id}/incoming-data")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -465,6 +483,7 @@ public class PatientController : ControllerBase /// An that returns an HTTP 200 OK response when the update succeeds. /// Thrown when the current HTTP user identity name is not available. /// Thrown when the provided cannot be parsed as a valid ObjectId. + /// [HttpPut("{id}/demographic-data")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -492,6 +511,7 @@ public class PatientController : ControllerBase /// Thrown when the current user has no identity name available. /// Thrown when is not a valid ObjectId format. /// Thrown when does not correspond to a valid value. + /// [HttpPost("{id}/master-list/{typeName}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -521,6 +541,7 @@ public class PatientController : ControllerBase /// The administration panel request payload containing the patient details, including the patient number to be used for the new record. /// An containing the newly created patient on success, or a Conflict result if a patient with the same number already exists. /// Thrown when does not contain a valid patient number. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -540,6 +561,8 @@ public class PatientController : ControllerBase /// The admin panel request payload containing the patient information to update, supplied in the request body. /// An containing the result of the updated patient data wrapped in an . /// Thrown when no patient matching the request can be found. + /// [HttpPut] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -555,6 +578,7 @@ public class PatientController : ControllerBase /// /// The patient payload containing the identifier of the patient to update and the new AdmTime value to apply. /// An containing the updated patient with the new admission date when the operation succeeds. + /// [HttpPut("entry-date")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -572,6 +596,7 @@ public class PatientController : ControllerBase /// /// The admin panel request containing the data needed to update the patient location. /// An containing the result of the patient location update operation. + /// [HttpPut("location")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -589,6 +614,7 @@ public class PatientController : ControllerBase /// An containing the updated patient on success. /// Thrown when the current user's identity name is not available in the HTTP context. /// Thrown when the provided is not a valid ObjectId format. + /// [HttpPut("{id}/altable")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -611,6 +637,7 @@ public class PatientController : ControllerBase /// An containing the archived patient wrapped in an Ok response. /// Thrown when the provided cannot be parsed as a valid ObjectId. /// Thrown when no patient is found matching the specified id. + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/PointOfCareController.cs b/adas-core/Controllers/PointOfCareController.cs index 82369198..850ca5b6 100644 --- a/adas-core/Controllers/PointOfCareController.cs +++ b/adas-core/Controllers/PointOfCareController.cs @@ -27,6 +27,10 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// /// List /// + /// + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -41,6 +45,10 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// /// List /// + /// + /// [HttpGet("get-all-virtual")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public IActionResult VirtualPocList() @@ -56,6 +64,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// The pagination filter containing the paging criteria to apply to the PoCs query. /// An containing the paginated PoCs returned by the service. /// Thrown when the is null. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -72,6 +81,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// /// The point of care entity supplied in the request body to be created. /// An containing the result of the insertion wrapped in an HTTP 200 OK response. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -89,6 +99,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// The string representation of the new status to apply. /// An indicating the result of the status update operation. /// Thrown when is not a valid ObjectId or cannot be parsed as a value. + /// [HttpPut("{id}/{status}/status")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -107,6 +118,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// The unit identifier expected to be a valid ObjectId. /// An HTTP 200 response containing the list of Points of Care for the unit, or null if no results are found. /// Thrown when the provided is not a valid ObjectId format. + /// [HttpGet("{id}/unit-id")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -127,6 +139,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// The string representation of the status filter, parsed into the enumeration. /// An containing the Point of Care records that match the provided unit and status. /// Thrown when is not a valid ObjectId or cannot be parsed into a value. + /// [HttpGet("{unitId}/unit-id/{status}/status")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -145,6 +158,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// /// The Point of Care object containing the updated information, provided in the request body. /// An containing the result of the update operation. + /// [HttpPut] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -162,6 +176,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// The new configuration payload to apply to the Point of Care. /// An containing an HTTP 200 OK response when the configuration is successfully updated. /// Thrown when cannot be parsed as a valid ObjectId. + /// [HttpPut("{id}/config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -178,6 +193,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// /// The Point of Care object containing the updated relay configuration details. /// An indicating the result of the operation; returns on successful update. + /// [HttpPut("relay")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -195,6 +211,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// The identifier of the PoC whose unit configuration should be updated, expected to be a valid ObjectId. /// An that produces an HTTP 200 (OK) response when the update succeeds. /// Thrown when the supplied cannot be parsed as a valid ObjectId. + /// [HttpPut("{id}/unit")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -212,6 +229,7 @@ public class PointOfCareController(IPointOfCareService pointOfCareService) /// The string representation of the PoC's ObjectId to be deleted. /// An representing an HTTP 200 OK response when the deletion succeeds. /// Thrown when is not a valid ObjectId format. + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/ProxyDeviceController.cs b/adas-core/Controllers/ProxyDeviceController.cs index 8c752d1d..e2c2dc79 100644 --- a/adas-core/Controllers/ProxyDeviceController.cs +++ b/adas-core/Controllers/ProxyDeviceController.cs @@ -26,6 +26,7 @@ public class ProxyDeviceController(IProxyDeviceService proxyDeviceService) : Con /// /// The unique identifier of the device whose stream should be retrieved. /// A containing the proxied device stream, or a reflecting the upstream HTTP status when the proxy call fails. + /// [HttpGet("{deviceId}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task GetStreamById(string deviceId) @@ -44,6 +45,7 @@ public class ProxyDeviceController(IProxyDeviceService proxyDeviceService) : Con /// /// The unique identifier of the device whose content is being requested. /// An containing the proxied content stream for the specified device. + /// [HttpGet("{deviceId}/content")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task GetContentById(string deviceId) @@ -61,6 +63,7 @@ public class ProxyDeviceController(IProxyDeviceService proxyDeviceService) : Con /// Forwards the upstream status code when the proxy call is not successful, defaults the response content type to multipart/x-mixed-replace when none is provided, and returns 404 (or the original status code) if the upstream request fails. /// /// The identifier of the device whose MJPEG stream should be retrieved and forwarded to the caller. + /// [HttpGet("{deviceId}/mjpeg-stream")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task GetAsMpegStreamById(string deviceId) diff --git a/adas-core/Controllers/PumpsController.cs b/adas-core/Controllers/PumpsController.cs index 25de599c..c733c5da 100644 --- a/adas-core/Controllers/PumpsController.cs +++ b/adas-core/Controllers/PumpsController.cs @@ -44,6 +44,7 @@ public class PumpController : ControllerBase /// /// The pump data transfer object received in the request body, containing the patient number, location, pump observations, message time, and wait result flag. /// An representing an HTTP 200 OK response. + /// [HttpPost("request")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -72,6 +73,7 @@ public class PumpController : ControllerBase /// Requires the caller to have the "AuthSome" role and "DisplayId" permission on the "Source" resource. /// /// An containing the result of _pumpService.GetAllPumpConfig(). + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -85,6 +87,7 @@ public class PumpController : ControllerBase /// /// The unique identifier of the pump configuration to retrieve. /// An HTTP 200 response containing the pump configuration that matches the specified identifier. + /// [HttpGet("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -100,6 +103,7 @@ public class PumpController : ControllerBase /// The pump configuration data to update, provided in the request body. /// An containing the updated pump configuration wrapped in an Ok response. /// Thrown when the parameter is null. + /// [HttpPut] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -120,6 +124,7 @@ public class PumpController : ControllerBase /// The pump configuration data supplied in the request body to be inserted. /// An containing the outcome of the pump configuration insertion. /// Thrown when is null, indicating that required parameters are missing. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -136,6 +141,7 @@ public class PumpController : ControllerBase /// /// The identifier of the pump configuration to delete. /// An containing the result of the deletion operation. + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -154,6 +160,7 @@ public class PumpController : ControllerBase /// The pagination filter that defines the paging parameters for the pump query. /// An containing the paginated pump result. /// Thrown when the parameter is null. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -170,6 +177,7 @@ public class PumpController : ControllerBase /// /// The new pump configuration to be logged, or if not applicable. /// The previous pump configuration to be logged, or if not applicable. + /// private async Task LogHistoricalConfigChanged(ConfigPumps? newConfigO, ConfigPumps? oldConfig) { var user = HttpContext.User.Identity?.Name ?? HttpContext.Connection.RemoteIpAddress?.ToString(); diff --git a/adas-core/Controllers/RabbitController.cs b/adas-core/Controllers/RabbitController.cs index 62a319ce..c3126cfd 100644 --- a/adas-core/Controllers/RabbitController.cs +++ b/adas-core/Controllers/RabbitController.cs @@ -20,6 +20,7 @@ public class RabbitController(ReceiverService receiverService) : ControllerBase /// /// The name of the error queue to be consumed. /// An containing a 200 OK response when the queue consumption is initiated. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] [Route("start-consume/{queueName}")] @@ -36,6 +37,7 @@ public class RabbitController(ReceiverService receiverService) : ControllerBase /// /// The name of the error queue to process and stop consuming. /// An containing an HTTP 200 OK response once the error queue has been processed. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] [Route("stop-consume/{queueName}")] diff --git a/adas-core/Controllers/RecordingAlertController.cs b/adas-core/Controllers/RecordingAlertController.cs index 47a6ca75..0abf26f7 100644 --- a/adas-core/Controllers/RecordingAlertController.cs +++ b/adas-core/Controllers/RecordingAlertController.cs @@ -24,6 +24,7 @@ public class RecordingAlertController : ControllerBase /// Initializes a new instance of the class with the specified recording alert service. /// /// The service that handles the recording alert operations. + /// public RecordingAlertController(IRecordingAlertService recordingAlertService) { LogExecutionContext.TrySetTraceIdentifier(Guid.NewGuid().ToString(), true); @@ -36,6 +37,7 @@ public class RecordingAlertController : ControllerBase /// Processes an incoming recording alert request by mapping the incoming DTO to an internal API request and persisting it either synchronously or asynchronously based on whether the caller requires a result. /// /// The recording alert payload containing the patient number, location, recording alerts, recording data, message time, and a flag indicating whether the operation should wait for completion. + /// [HttpPost] [Route("")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] diff --git a/adas-core/Controllers/RelayController.cs b/adas-core/Controllers/RelayController.cs index 698d6e4d..22f0786c 100644 --- a/adas-core/Controllers/RelayController.cs +++ b/adas-core/Controllers/RelayController.cs @@ -21,6 +21,8 @@ namespace adas_core.Controllers; /// Marked with to enable API-specific conventions and with set to Relay to define the controller's route template. Inherits from . /// /// +/// [ApiController] [Route("Relay")] public class RelayController : ControllerBase @@ -57,6 +59,7 @@ public class RelayController : ControllerBase /// Retrieves the status of point-of-care sections by querying the relay status for each configured box and its associated relays. Returns a 404 Not Found when no configurations are available, or a list containing the unit, bed, and status for each relay when configurations exist. /// /// An that is either a 404 Not Found when no configurations are found, or an HTTP 200 OK response containing a collection of objects with the unit name, bed, and relay status. + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [Route("status")] @@ -84,6 +87,7 @@ public class RelayController : ControllerBase /// /// The request payload containing the identifiers of the unit, point of care, and bed to power on. /// An representing the result of the power-on operation. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [Route("powerOn")] @@ -100,6 +104,7 @@ public class RelayController : ControllerBase /// /// The power action request containing the unit identifier, point of care identifier, and bed information. /// An representing the result of the power off operation. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [Route("powerOff")] @@ -119,6 +124,7 @@ public class RelayController : ControllerBase /// The bed identifier associated with the point of care. /// The asynchronous operation to invoke against each relay found in the configuration. /// An that returns Ok when the action runs on the relays, Conflict if cannot be parsed as an , or NotFound if the box or its relay configuration is missing. + /// private async Task PowerAction(string unitId, string pointOfCareId, string bed, Func action) { if (!ObjectId.TryParse(pointOfCareId, out var poc)) return Conflict("Cannot parse to OBjectId"); @@ -150,6 +156,7 @@ public class RelayController : ControllerBase /// The username used for relay authentication. /// The password used for relay authentication. /// An containing the relay status result returned by the relay service. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] [Route("{id}/status")] @@ -190,6 +197,7 @@ public class RelayController : ControllerBase /// The username used to authenticate with the relay device. /// The optional password used to authenticate with the relay device. /// An containing HTTP 200 with a success value on success, or HTTP 500 if the relay service fails. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [Route("{id}/power/on")] @@ -238,6 +246,7 @@ public class RelayController : ControllerBase /// The username used for relay authentication. /// The optional password used for relay authentication. /// An indicating the outcome: Ok with a false value on success, or an Internal Server Error status if the power off operation fails. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [Route("{id}/power/off")] @@ -279,6 +288,7 @@ public class RelayController : ControllerBase /// The identifier of the point of connection, which must be a valid ObjectId string. /// The relay type as a string, which is parsed into . /// An indicating the outcome: for invalid input, for internal server errors, or with false on success. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [Route("manual/{status}")] @@ -308,6 +318,8 @@ public class RelayController : ControllerBase /// Flag indicating whether to include related point of contact data in the response. /// An containing the paginated relays. /// Thrown when the is null. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task GetPaginatedUnits([FromBody] PaginationFilter request, bool withPoCs) @@ -323,6 +335,7 @@ public class RelayController : ControllerBase /// The relay data to create, supplied in the request body. /// An containing the created relay. /// Thrown when the is null. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task CreateRelay([FromBody] Relay? request) @@ -338,6 +351,7 @@ public class RelayController : ControllerBase /// The identifier of the relay to update, expected to be a valid ObjectId. /// An containing the updated relay when the operation succeeds. /// Thrown when the provided cannot be parsed as a valid ObjectId. + /// [HttpPut("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] public async Task UpdateRelay([FromBody] Relay relay, string id) @@ -352,6 +366,7 @@ public class RelayController : ControllerBase /// /// Represents a request to perform a power-related action, encapsulating the data required to execute the operation. /// +/// public class PowerActionRequest { public string UnitId { get; set; } = null!; diff --git a/adas-core/Controllers/SendAlertController.cs b/adas-core/Controllers/SendAlertController.cs index 96baee83..5f190503 100644 --- a/adas-core/Controllers/SendAlertController.cs +++ b/adas-core/Controllers/SendAlertController.cs @@ -39,6 +39,7 @@ public class SendAlertController : ControllerBase /// Retrieves the list of error queues from the alert service. /// /// An containing the error queues returned by the service. + /// [HttpGet("rabbit")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] public async Task GetErrorQueues() @@ -52,6 +53,7 @@ public class SendAlertController : ControllerBase /// Requires the AuthAdmin role; the performance data is fetched from the send alert service and returned in an HTTP 200 OK response. /// /// An containing the performance data returned by the service. + /// [HttpGet("performance")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] public IActionResult GetPerformance() @@ -64,6 +66,7 @@ public class SendAlertController : ControllerBase /// Retrieves the list of configured API clients. Restricted to users with the AuthAdmin role. /// /// An containing the collection of API clients returned by the send alert service. + /// [HttpGet("api-clients")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] public async Task GetApiClients() @@ -77,6 +80,7 @@ public class SendAlertController : ControllerBase /// /// The push subscription payload received from the client, containing the endpoint and cryptographic keys required for delivering web push notifications. /// An containing an HTTP 200 OK response with a confirmation message indicating the subscription was accepted. + /// [HttpPost("web-subscribe")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] public IActionResult WebSubscribe([FromBody] PushSubscription sub) @@ -90,6 +94,7 @@ public class SendAlertController : ControllerBase /// /// The push subscription to remove, identified by its endpoint. /// An containing a success message when the subscription is removed, or a failure message when no matching subscription is found. + /// [HttpPost("web-unsubscribe")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] public IActionResult WebUnSubscribe([FromBody] PushSubscription sub) @@ -110,6 +115,7 @@ public class SendAlertController : ControllerBase /// The endpoint identifier of the push subscription that will receive the notification. /// The payload to send, serialized to JSON before transmission. /// An that returns NotFound if the subscription is not found, or Ok when the notification is sent successfully. + /// [HttpPost("broadcast/{sub}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] public IActionResult Broadcast(string sub, [FromBody] object message) diff --git a/adas-core/Controllers/ServiceConfigController.cs b/adas-core/Controllers/ServiceConfigController.cs index 85bc0028..26a3a2e3 100644 --- a/adas-core/Controllers/ServiceConfigController.cs +++ b/adas-core/Controllers/ServiceConfigController.cs @@ -36,6 +36,7 @@ public class ServiceConfigController : ControllerBase /// /// The unique identifier of the service configuration to retrieve. /// An containing the requested service configuration. + /// [HttpGet("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)] public async Task Find(string id) diff --git a/adas-core/Controllers/TreatmentsController.cs b/adas-core/Controllers/TreatmentsController.cs index 14a1311a..0161693e 100644 --- a/adas-core/Controllers/TreatmentsController.cs +++ b/adas-core/Controllers/TreatmentsController.cs @@ -47,6 +47,7 @@ public class TreatmentsController : ControllerBase /// The treatment payload received in the request body, providing patient number, location, message time, wait result, and the optional treatment to forward. /// An that yields 200 OK once the request has been successfully saved. /// Thrown when no patient is found for the PatientNumber provided in . + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -100,6 +101,7 @@ public class TreatmentsController : ControllerBase /// The patient's identifier used to look up their treatments. /// An containing the first 50 treatments for the patient, sorted by order time. /// Thrown when is not a valid identifier format. + /// [HttpGet("{patientid}/patient-id")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -118,6 +120,7 @@ public class TreatmentsController : ControllerBase /// /// The payload containing the treatment data to update. /// An containing the updated treatment in an HTTP 200 OK response. + /// [HttpPut] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -135,6 +138,7 @@ public class TreatmentsController : ControllerBase /// The string representation of the patient's ObjectId used to identify the treatment to delete. /// An indicating the result of the delete operation. /// Thrown when the provided is not a valid ObjectId format. + /// [HttpDelete("{patientid}/patient-id")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -152,6 +156,7 @@ public class TreatmentsController : ControllerBase /// The unique identifier of the treatment to delete. /// An representing the result of the deletion operation. /// Thrown when is not a valid ObjectId format. + /// [HttpDelete("{treatmentId}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -170,6 +175,7 @@ public class TreatmentsController : ControllerBase /// The pagination filter containing paging parameters used to query the treatments. /// An containing the paginated treatments returned by the service. /// Thrown when the is null. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/UnitController.cs b/adas-core/Controllers/UnitController.cs index 543e958f..08c55139 100644 --- a/adas-core/Controllers/UnitController.cs +++ b/adas-core/Controllers/UnitController.cs @@ -34,6 +34,12 @@ public class UnitController( /// /// List /// + /// + /// + /// [HttpGet("{withPoCs}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -47,6 +53,7 @@ public class UnitController( /// Retrieves a compact list of units, typically used for lightweight UI scenarios such as dropdowns or lookups. /// /// An containing the compact collection of units on success. + /// [HttpGet("compact")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -63,6 +70,7 @@ public class UnitController( /// The string identifier of the unit to retrieve; must be a parseable identifier or a bad request is raised. /// An containing the compact unit payload when the id is valid. /// Thrown when cannot be parsed as a valid identifier. + /// [HttpGet("compact/{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -81,6 +89,7 @@ public class UnitController( /// A flag indicating whether the response should include the related PoCs for each unit. /// An containing the paginated units wrapped in an HTTP 200 OK response. /// Thrown when the parameter is null, indicating missing required parameters. + /// [HttpPost("paginated/{withPoCs}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -98,6 +107,8 @@ public class UnitController( /// /// /// + /// [HttpGet("{id}/{listFilled}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -116,6 +127,8 @@ public class UnitController( /// /// /// + /// [HttpGet("status/{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -134,6 +147,8 @@ public class UnitController( /// /// /// + /// [HttpGet("{unitName}/config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -148,6 +163,7 @@ public class UnitController( /// /// /// + /// [HttpGet("{patientId}/patient-id")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -166,6 +182,7 @@ public class UnitController( /// /// /// + /// [HttpGet("{id}/point-of-cares")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -185,6 +202,8 @@ public class UnitController( /// /// /// + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -201,6 +220,8 @@ public class UnitController( /// /// /// + /// [HttpDelete("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -223,6 +244,8 @@ public class UnitController( /// /// /// + /// [HttpPut("{id}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -242,6 +265,7 @@ public class UnitController( /// /// /// + /// [HttpPut("master-list-id")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -264,6 +288,7 @@ public class UnitController( /// The new configuration values supplied in the request body. /// An containing the updated unit configuration when the operation succeeds. /// Thrown when cannot be parsed as a valid id format. + /// [HttpPut("{unitId}/config")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -281,6 +306,7 @@ public class UnitController( /// /// /// + /// [HttpPut("{id}/info")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -302,6 +328,7 @@ public class UnitController( /// An containing the unit dependency DTO on success. /// Thrown when is not a valid format or when the dependency DTO result cannot be retrieved. /// Thrown when no unit exists with the specified identifier. + /// [HttpGet("{id}/dependency")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/Controllers/UserController.cs b/adas-core/Controllers/UserController.cs index 4e806097..276231f9 100644 --- a/adas-core/Controllers/UserController.cs +++ b/adas-core/Controllers/UserController.cs @@ -34,6 +34,7 @@ public class UserController( /// /// The login payload containing the username and password to authenticate. /// An containing a successful response with the authenticated . + /// [AllowAnonymous] [HttpPost("login")] public async Task Login([FromBody] LoginInfo loginInfo) @@ -49,6 +50,7 @@ public class UserController( /// /// An containing the generated JWT token and user authorization details wrapped in a . /// Thrown when no user is found in HttpContext.Items["User"], indicating the user is not registered. + /// [AllowAnonymous] [HttpGet("token")] public async Task LoginWithBearer() @@ -66,6 +68,7 @@ public class UserController( /// /// The access token supplied via the query string used to perform the login. /// An containing a successful response with the access token information and its expiry time. + /// [AllowAnonymous] [HttpGet("login")] public async Task LoginWithAccessToken([FromQuery] string token) @@ -83,6 +86,7 @@ public class UserController( /// /// The refresh token obtained from a previous authentication request, supplied in the request body. /// An containing a with the refreshed token details on success. + /// [AllowAnonymous] [HttpPost("refresh-token")] public async Task RefreshToken([FromBody] string refreshToken) @@ -98,6 +102,7 @@ public class UserController( /// The CAS ticket to validate against the user service. /// A 200 OK response with a JWT token if the user is found; otherwise, a 404 Not Found response. /// Thrown when an error occurs during user lookup or JWT generation, indicating the user is not authorized. + /// [AllowAnonymous] [HttpGet("login-cas")] public async Task LoginWithCas([FromQuery] string service, [FromQuery] string ticket) @@ -126,6 +131,7 @@ public class UserController( /// /// An containing a successful response with the authenticated . /// Thrown when the user retrieved from the HTTP context items is null, indicating the user is not registered. + /// [HttpGet("me")] public IActionResult Me() { @@ -138,6 +144,7 @@ public class UserController( /// Retrieves all users from the system. /// /// An containing a with the list of objects retrieved via the user service. + /// [HttpGet] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -152,6 +159,7 @@ public class UserController( /// Retrieves all available authorities. Requires the AuthSome role and permission to display Source entities. /// /// An containing a successful response with the list of objects. + /// [HttpGet("authorities")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -168,6 +176,7 @@ public class UserController( /// The pagination filter applied to the user query, supplied in the request body. /// An containing the paginated users produced by the user service. /// Thrown when is null. + /// [HttpPost("paginated")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -185,6 +194,7 @@ public class UserController( /// /// The login credentials (username and password) used to authenticate the user. /// A successful response containing the authentication token, the user's authorities, and the resolved panel permissions. + /// [AllowAnonymous] [HttpPost("login/adm-panel")] public async Task LoginPanel([FromBody] LoginInfo loginInfo) @@ -205,6 +215,7 @@ public class UserController( /// /// An containing a successful of with the generated token, the user's authorization, and the permissions applicable to the panel. /// Thrown when no user is found in HttpContext.Items["User"], indicating an unauthorized user that is not registered. + /// [AllowAnonymous] [HttpGet("token/adm-panel")] public async Task LoginWithBearerPanel() @@ -226,6 +237,7 @@ public class UserController( /// /// The access token used to authenticate the user for the administrative panel. /// An containing a successful response with the token result and the associated panel permissions. + /// [AllowAnonymous] [HttpGet("login/adm-panel")] public async Task LoginWithAccessTokenPanel([FromQuery] string token) @@ -244,6 +256,7 @@ public class UserController( /// /// The refresh token string provided in the request body used to obtain a new access token. /// An containing a with the refreshed token result and the associated permissions for the panel. + /// [HttpPost("refresh-token/adm-panel")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -263,6 +276,7 @@ public class UserController( /// /// The user data submitted in the request used to create the new user. /// An containing the newly created user in an HTTP 200 OK response. + /// [HttpPost] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -277,6 +291,7 @@ public class UserController( /// /// The DTO containing the new user's information and the authorities to assign. /// An containing the created user returned via an HTTP 200 OK response. + /// [HttpPost("authorities")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -294,6 +309,7 @@ public class UserController( /// An indicating a successful operation via when the user is removed. /// Thrown when is not a valid identifier format. /// Thrown when the user could not be deleted. + /// [HttpDelete("{userId}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -319,6 +335,7 @@ public class UserController( /// Indicates whether the password should be updated as part of the operation. /// An representing a successful update (200 OK). /// Thrown when userService.UpdateUsersByRequest returns null, indicating the update could not be completed. + /// [HttpPut("{updatePass}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -336,6 +353,7 @@ public class UserController( /// The data transfer object containing the updated user information and authority assignments. /// Flag indicating whether the user's password should be updated. /// An representing an HTTP 200 OK response on successful update. + /// [HttpPut("{updatePass}/authorities")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -351,6 +369,7 @@ public class UserController( /// /// The authorization data used to create the new authority. /// An containing the newly created authority. + /// [HttpPost("authority")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -366,6 +385,7 @@ public class UserController( /// /// The identifier of the authority to delete. /// An containing an HTTP 200 OK response upon successful deletion. + /// [HttpDelete("authority/{authorityId}")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -380,6 +400,7 @@ public class UserController( /// /// The list of authority identifiers to be deleted. /// An indicating the result of the operation; returns upon successful completion. + /// [HttpPut("authorities")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -396,6 +417,7 @@ public class UserController( /// The data transfer object containing the current and new password values. /// An containing the result of the password update operation. /// Thrown when the provided is not a valid identifier format. + /// [HttpPost("{id}/password")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -414,6 +436,7 @@ public class UserController( /// /// The authorization details to be applied to the user. /// An containing an when the authority update succeeds. + /// [HttpPut("authority")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] @@ -430,6 +453,7 @@ public class UserController( /// The string representation of the user's identifier whose authorities are being requested. /// An HTTP 200 response containing a with the list of objects for the user. /// Thrown when the provided is not a valid ObjectId format. + /// [HttpGet("{userId}/authority")] [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)] [PermissionAuthorize("Source", "DisplayId")] diff --git a/adas-core/ErrorMiddleware/ErrorHandlerMiddleware.cs b/adas-core/ErrorMiddleware/ErrorHandlerMiddleware.cs index bb788984..ab568ffc 100644 --- a/adas-core/ErrorMiddleware/ErrorHandlerMiddleware.cs +++ b/adas-core/ErrorMiddleware/ErrorHandlerMiddleware.cs @@ -11,6 +11,7 @@ namespace adas_core.ErrorMiddleware; /// This middleware is typically registered in the application's request pipeline to intercept and handle exceptions /// thrown by subsequent middleware components, while leveraging the injected logger to record error information. /// +/// public class ErrorHandlerMiddleware(RequestDelegate next, ILogger logger) { /// @@ -18,6 +19,7 @@ public class ErrorHandlerMiddleware(RequestDelegate next, ILogger /// The current HTTP request context used to invoke the next middleware, read the trace identifier, and write the error response. + /// public async Task InvokeAsync(HttpContext context) { try diff --git a/adas-core/Logging/LogExecutionContext.cs b/adas-core/Logging/LogExecutionContext.cs index 0d9178b1..508465f8 100644 --- a/adas-core/Logging/LogExecutionContext.cs +++ b/adas-core/Logging/LogExecutionContext.cs @@ -8,6 +8,7 @@ namespace adas_core.Logging; /// /// This class serves as a centralized holder for execution-scoped data that can be referenced by logging components throughout the application lifecycle. /// +/// public static class LogExecutionContext { private static readonly AsyncLocal AsyncLocalTraceIdentifier = new(); @@ -18,6 +19,7 @@ public static class LogExecutionContext /// /// Trace identifier. /// If existing trace ID should be replaced (set to true ONLY if you receive and handle traced entities in a constant context)! + /// public static bool TrySetTraceIdentifier(string traceIdentifier, bool force = false) { return TrySetValue(nameof(TraceIdentifier), traceIdentifier, AsyncLocalTraceIdentifier, string.IsNullOrEmpty, @@ -33,6 +35,7 @@ public static class LogExecutionContext /// Predicate that returns true for values that must not be accepted, applied to both the new and current value. /// When true, bypasses the existing-value check and always overwrites the ambient value. /// true if the new value was applied to ; otherwise false, including when the candidate is invalid, the ambient already holds a different non-null valid value, or no change was needed. + /// private static bool TrySetValue( string contextPropertyName, string newValue, diff --git a/adas-core/Logging/LogProvider.cs b/adas-core/Logging/LogProvider.cs index 148f4ec6..a318f3bf 100644 --- a/adas-core/Logging/LogProvider.cs +++ b/adas-core/Logging/LogProvider.cs @@ -9,6 +9,7 @@ namespace adas_core.Logging; /// As a static class, it cannot be instantiated or inherited and is intended to expose /// logging operations as shared members. /// +/// public static class LogProvider { private static ILoggerFactory? _loggerFactory; @@ -17,6 +18,7 @@ public static class LogProvider /// Sets the current log provider based on logger factory. /// /// The logger factory. + /// public static void SetLogProvider(ILoggerFactory loggerFactory) { _loggerFactory = loggerFactory; @@ -27,6 +29,7 @@ public static class LogProvider /// /// The category name for the logger to create. /// An instance for the specified category, or a when no logger factory is available. + /// public static ILogger CreateLogger(string category) { if (_loggerFactory != null) return _loggerFactory.CreateLogger(category); @@ -38,6 +41,7 @@ public static class LogProvider /// Creates an instance using the configured logger factory, or returns a instance when no factory has been set. /// /// An produced by the underlying if available; otherwise, a shared instance used as a no-op fallback. + /// public static ILogger CreateLogger() { if (_loggerFactory != null) return _loggerFactory.CreateLogger(); @@ -49,6 +53,7 @@ public static class LogProvider /// /// Provides static utility members for caching values within the assembly. /// + /// internal static class Cached { internal static readonly System.Lazy Default = diff --git a/adas-core/WebSocket/Hubs/UciHub.cs b/adas-core/WebSocket/Hubs/UciHub.cs index 287b35c5..c68ec3f4 100644 --- a/adas-core/WebSocket/Hubs/UciHub.cs +++ b/adas-core/WebSocket/Hubs/UciHub.cs @@ -30,6 +30,7 @@ public class UciHub( /// that shares the same connection id to avoid duplicates on reconnection, and then invoking the base connection handler. /// Any exception encountered during processing is logged and surfaced as a failed task. /// + /// public override async Task OnConnectedAsync() { try @@ -62,6 +63,7 @@ public class UciHub( /// when an exception is provided, while normal disconnections are logged at debug level. /// /// The exception that caused the disconnection, or null when the disconnection was not caused by an error. + /// public override async Task OnDisconnectedAsync(Exception? exception) { if (exception != null) @@ -105,6 +107,7 @@ public class UciHub( /// any exception thrown during processing is caught and logged without rethrowing. /// /// The raw JSON payload received from the client representing the subscription request. + /// [HubMethodName("subscribe")] public async Task OnSubscribe(string subMessage) { @@ -142,6 +145,7 @@ public class UciHub( /// Unsubscribes the current SignalR client by removing its connection from the subscribers service. /// Logs and swallows any error encountered during connection removal. /// + /// [HubMethodName("unsubscribe")] public void UnSubscribe() { @@ -161,6 +165,7 @@ public class UciHub( /// Deserializes the payload into a instance and delegates processing to the client message service, logging and ignoring malformed payloads or unexpected errors. /// /// The raw JSON payload of the chat message sent by the client. + /// [HubMethodName("chatMessage")] public async Task OnChatMessage(string message) { diff --git a/adas-core/WebSocket/WebSocketMessageService.cs b/adas-core/WebSocket/WebSocketMessageService.cs index 8a5b75ca..701d9fe3 100644 --- a/adas-core/WebSocket/WebSocketMessageService.cs +++ b/adas-core/WebSocket/WebSocketMessageService.cs @@ -81,6 +81,7 @@ public class WebSocketMessageService( /// /// The unique identifier of the WebSocket subscriber that originated the request. /// A that completes when the demo request has been processed and all patient data has been dispatched. + /// private async Task ProcessDemoRequest(Message msg, string connectionId) { var sub = subscribersService.GetById(connectionId); @@ -151,6 +152,7 @@ public class WebSocketMessageService( /// /// The message to process, whose data and user name are used to identify the subscriber. /// The connection identifier of the admin subscriber that will receive the message display. + /// private void ProcessAdminSubscriber(Message msg, string connectionId) { if (msg.Data?.UserName == null) return; @@ -172,6 +174,7 @@ public class WebSocketMessageService( /// The unique identifier of the WebSocket subscriber that originated the request. /// A that completes once the synchronous portion of the processing has finished; /// several sub-tasks (display list, recordings, relay states, beacons) are dispatched fire-and-forget. + /// private async Task ProcessDisplaySubscriber(Message msg, string connectionId) { var id = msg.Data?.DisplayId; @@ -409,6 +412,7 @@ public class WebSocketMessageService( /// The subscription type that determines whether additional box-specific data should be dispatched. /// The display whose configuration and points of care will be processed; only valid when its configuration is a StandarDisplay with a non-null section configuration. /// The identifier of the client connection that will receive the emitted messages. + /// private async Task ProcessStandard(SubscriptionEnum.Type suscriptionType, Display display, string connectionId) { var standarDisplayCast = display.DisplayConfig as StandarDisplay; @@ -460,6 +464,7 @@ public class WebSocketMessageService( /// The identifier of the display configuration to query. /// The optional user name used to filter the display section results. /// The identifier of the connection to which the display list will be sent. + /// private async Task ProcessDisplayList( DisplayConfigEnums.DisplayType displayType, ObjectId displayId, @@ -477,6 +482,7 @@ public class WebSocketMessageService( /// The list of PointOfCare objects to process. /// The ID of the connection for which to send the data. /// The message object. + /// private async Task ProcessPocList(List displayPointOfCares, string connectionId, Message msg) { //TODO revisar si es necesario que se envíen los pocs aquí si no está en modo demo ¿redundante? @@ -499,6 +505,7 @@ public class WebSocketMessageService( /// The identifier of the unit whose master lists should be processed and pushed to the client. /// The identifier of the client connection that will receive the unit information and master list updates. /// The optional locale used to localize the retrieved unit data and master lists. + /// private async void ProcessMasterList(ObjectId id, string connectionId, LocaleEnum? dataLocale) { try @@ -545,6 +552,7 @@ public class WebSocketMessageService( /// /// The display identifier used to look up the notice; if it cannot be parsed as an ObjectId, the method returns without further action. /// The identifier of the connection to which each retrieved notice is dispatched as a new-notice operation. + /// private async void ProcessNotice(string displayId, string connectionId) { try @@ -578,6 +586,7 @@ public class WebSocketMessageService( /// The list of point-of-care location identifiers to process for discharge data. /// The identifier of the client connection used to send the new discharge notification. /// The locale used to retrieve the discharge data. + /// private async void ProcessDischarge(List dataLocations, string connectionId, LocaleEnum dataLocale) { try @@ -612,6 +621,7 @@ public class WebSocketMessageService( /// The optional display unit identifier; when provided, admissions assigned to that unit without a point of care are also broadcast. /// The identifier of the client connection to which the admission updates are sent. /// The locale used to filter admissions retrieved for the given data locations. + /// private async void ProcessAdmission(List dataLocations, ObjectId? displayUnitId, string connectionId, LocaleEnum dataLocale) { @@ -645,6 +655,7 @@ public class WebSocketMessageService( /// /// The message to process, containing the operation type and payload. /// The identifier of the connection that originated the message. + /// public async Task ProcessMessage(Message msg, string connectionId) { try @@ -696,6 +707,7 @@ public class WebSocketMessageService( /// The message containing the location, optional time zone, and grouped fields to process. /// The identifier of the client connection used to send the generated observations. /// A task that represents the asynchronous processing of the grouped observations. + /// private async Task ProcessGroupedObservations(Message msg, string connectionId) { if (msg.Data is { GroupedFields: not null } && msg.Data.GroupedFields.Any()) @@ -744,6 +756,7 @@ public class WebSocketMessageService( /// /// The incoming message containing the current recordings to be broadcast. /// The identifier of the subscriber's connection used to look up the subscriber and target the alert. + /// private async Task ProcessRecordingMessage(Message msg, string connectionId) { //var subscribers = Subscribers.Instance.GetSubscribers(); @@ -764,6 +777,7 @@ public class WebSocketMessageService( /// /// The message payload carrying the patient reference, either as a PatientId or a location. /// The identifier of the connection to which the resolved patient data should be sent. + /// private async Task ProcessPatientData(Message msg, string connectionId) { Patient? patient = new(); @@ -790,6 +804,7 @@ public class WebSocketMessageService( /// /// The incoming message envelope whose Data contains the source location, destination location, section, timestamp, and chat text. /// The connection identifier used to deliver the chat message via SendAsync. + /// private async Task ProcessChatMessage(Message msg, string connectionId) { var fromLocation = msg.Data?.Location; @@ -823,6 +838,7 @@ public class WebSocketMessageService( /// Sends an update message to all subscribers associated with the given patient locations. If the location has no bed specified, subscribers are matched by section; otherwise, subscribers are matched by both box (bed) and section. /// /// The list of patient locations used to determine which subscribers should receive the update message. + /// public void SendUpdateMessageToBoxes(List patientLocations) { var subscribers = new List(); @@ -855,6 +871,7 @@ public class WebSocketMessageService( /// The identifier of the client connection that will receive the data. /// Optional collection of configuration observations used when sending the latest alarms. /// Cancellation token to cancel the asynchronous operations. + /// private async Task SendPatientData( Patient patient, Message msg, @@ -896,6 +913,7 @@ public class WebSocketMessageService( /// The message payload that provides the fields to query and indicates whether a demo data source should be used. /// The identifier of the target client connection that will receive the observations. /// The cancellation token used to cancel the observation retrieval operation. + /// private async Task SendLatestObservationsAsync( Patient patient, MessageData data, @@ -933,6 +951,7 @@ public class WebSocketMessageService( /// The originating message data used for logging context when an error occurs. /// The identifier of the subscriber that will receive the appointment notifications. /// The cancellation token used to cancel the appointment retrieval operation. + /// private async Task SendPatientAppointmentsAsync( Patient patient, MessageData msgData, @@ -962,6 +981,7 @@ public class WebSocketMessageService( /// The message data containing the alarm fields to evaluate and the demo mode flag. /// Optional configuration observations used to select the alarm lookup strategy. /// The identifier of the target client connection to which the alarm observations are sent. + /// private async Task SendLatestAlarmsAsync( Patient patient, MessageData data, @@ -1011,6 +1031,8 @@ public class WebSocketMessageService( /// Message metadata containing the timestamp used to scope the lookup of recent observations. /// The identifier of the connection to which the mapped pump observations are dispatched. /// Token used to cancel the asynchronous operation. + /// private async Task SendLatestPumpsAsync( Patient patient, MessageData data, @@ -1047,6 +1069,7 @@ public class WebSocketMessageService( /// The patient whose treatments should be retrieved and transmitted. /// The message data associated with the current operation. /// The identifier of the connection used to dispatch the treatment messages. + /// private async Task SendTreatmentsAsync( Patient patient, MessageData data, @@ -1077,6 +1100,7 @@ public class WebSocketMessageService( /// The patient whose diagnosis records should be retrieved and sent. /// The message data associated with the current operation, used for logging purposes. /// The identifier of the connection used to send the diagnosis messages. + /// private async Task SendDiagnosisAsync( Patient patient, MessageData data, @@ -1109,6 +1133,7 @@ public class WebSocketMessageService( /// The message data containing the grouped fields, demo flag, and optional timezone used to drive the generation path. /// The identifier of the connection used to dispatch the grouped observations. /// The cancellation token used to cancel the grouped observation generation. + /// private async Task SendGroupedObsAsync( Patient patient, MessageData data, @@ -1148,6 +1173,7 @@ public class WebSocketMessageService( /// /// The point of care whose beacon color and identifiers will be transmitted. /// The identifier of the target client connection that will receive the beacon payload. + /// private async Task SendBeaconsData( PointOfCare poc, string connectionId) @@ -1166,6 +1192,7 @@ public class WebSocketMessageService( /// /// The incoming message whose operation determines the subscription type and whose data provides the section and bed/box information. /// The unique identifier of the WebSocket connection used to look up or register the subscriber. + /// private void AddMessagetoSubcriber(Message msg, string connectionId) { SubscriptionEnum.WsType? subType = null; @@ -1233,6 +1260,7 @@ public class WebSocketMessageService( /// The incoming message whose display data (locations, location ids, display id, locale, and user name) is applied to the subscriber. /// The unique identifier of the WebSocket connection used to look up an existing subscriber. /// The optional WebSocket subscription type to assign to the subscriber. + /// private void AddMessageDisplayToSubcriber(Message msg, string connectionId, SubscriptionEnum.WsType? subType) { var subscriber = subscribersService.GetSubscribers().FirstOrDefault(s => s.Id == connectionId); @@ -1278,6 +1306,7 @@ public class WebSocketMessageService( /// The identifier of the SignalR client connection that should receive the message. /// The optional operation type associated with the message, included in the payload as its string representation when present. /// The message object to serialize and send. May be null. + /// public async Task SendAsync(string subscriberId, OperationType? type, object? msg) { try @@ -1305,6 +1334,7 @@ public class WebSocketMessageService( /// /// The operation type that identifies the kind of message being broadcast. /// The message payload to serialize and send. Can be null. + /// public async Task SendToAllAsync(OperationType type, object? msg) { var settings = new JsonSerializerSettings @@ -1326,6 +1356,7 @@ public class WebSocketMessageService( /// /// The error description to include in the message body sent to the client. /// The SignalR connection identifier of the target client that should receive the error message. + /// private async Task SendErrorMessage(string errorMessage, string connectionId) { var msg = JsonConvert.SerializeObject(new Dictionary