using adas_core.Application.Services.Interfaces; using adas_core.Domain.Enums; using adas_core.Domain.Models; using adas_core.Domain.Models.Pumps; using Microsoft.Extensions.DependencyInjection; using MongoDB.Bson; 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 = new(serviceProvider.GetRequiredService); /// /// Asynchronously calculates the active bolus for the specified patient. /// /// 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(); } /// /// Asynchronously maps the provided PumpObservation, returning the input instance as the mapping result. /// /// The PumpObservation to be mapped. /// A task containing the mapped PumpObservation. /// public async Task Map(PumpObservation pumpObservation) { return await Task.FromResult(pumpObservation); } /// /// Asynchronously calculates a medicine observation for the specified patient based on their active medicines. /// /// 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(); } /// /// Asynchronously resolves time inconsistencies between the supplied observation and the most recent previous observation, returning a corrected observation or null when no correction is required. /// /// 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(); } /// /// Asynchronously retrieves the active treatment records associated with the specified patient. /// /// 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(); } /// /// Returns the provided patient observation wrapped in a completed task without modification. /// /// 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)!; } /// /// Maps a patient treatment to its target representation asynchronously, returning the provided treatment instance unchanged. /// /// The patient treatment to map. /// A task containing the mapped patient treatment. /// public Task Map(PatientTreatment treatment) { return Task.FromResult(treatment); } /// /// Maps a instance to a completed task containing the same instance. /// /// 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); } /// /// Returns the provided as-is, ignoring the parameter. /// /// 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); } /// /// Sends an alarm notification based on the specified patient observation, name, and optional alarm code. /// /// 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; } /// /// Returns the provided patient observation list unchanged as a pre-mapping step, typically used as a hook before further mapping or insertion operations. /// /// 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); } }