using adas_core.Application.Subscriptions; using adas_core.Domain.Models; using adas_core.Domain.Models.GroupedObservations; using MongoDB.Bson; namespace adas_core.Application.Services.Interfaces; public interface IGroupedObservationService { /// /// Generates a grouped observation for the specified identifier and grouped field, applying the provided time zone for time-based calculations. /// /// The unique identifier of the source entity used to produce the grouped observation. /// The field definition that determines how the observation is grouped. /// The identifier of the time zone to apply when interpreting time values. Defaults to "Romance Standard Time". /// 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); /// /// Generates a for the specified patient based on the provided patient observation, /// grouped field configuration, and any previously recorded grouped observations, applying the supplied time zone for /// date and time handling. /// /// The identifier of the patient whose observation is being grouped. /// The grouped field definition that drives how the observation is categorized and aggregated. /// The list of the most recent grouped observation entries used as context when building the new grouped observation. /// 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"); /// /// Retrieves the most recent observations for a specified patient, optionally filtered by observation types. /// /// The unique identifier of the patient whose observations are being retrieved. /// 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); /// /// Asynchronously creates a new empty observation for the next available slot in the grouped web service subscription. /// /// 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); /* * List CalculateShiftObservations(List shiftGroupObservations, GroupedField groupedField); List GenerateShiftObservations(List result, GroupedField groupedField); */ }