Interface IPumpObservationRepository
- Namespace
- adas_core.Application.Repositories.Interfaces
- Assembly
- adas-core.Application.dll
public interface IPumpObservationRepository
- Extension Methods
Methods
AggregatedPatientLastObservations(ObjectId, int)
Retrieves the most recent aggregated pump observations for a specified patient, ordered from newest to oldest.
Task<List<PumpObservation>> AggregatedPatientLastObservations(ObjectId patientId, int num = 100)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are being queried.
numintThe maximum number of observations to return. Defaults to 100.
Returns
- Task<List<PumpObservation>>
A task that represents the asynchronous operation, containing a list of the patient's most recent PumpObservation entries.
DeleteByPatientId(ObjectId?)
Deletes all records associated with the specified patient identifier. If the patient identifier is null, no deletion is performed.
Task DeleteByPatientId(ObjectId? patientId)
Parameters
patientIdObjectId?The optional patient identifier whose related records should be removed.
Returns
DeleteKeepLastNAsync(int)
Asynchronously deletes items, retaining only the most recent maxCount entries, and returns the number of items that were removed.
Task<long> DeleteKeepLastNAsync(int maxCount)
Parameters
maxCountintThe maximum number of most recent items to keep after the deletion.
Returns
- Task<long>
A task representing the asynchronous operation, containing the count of items that were deleted.
DeleteOlderThanDaysAsync(int, string?)
Asynchronously deletes records older than the specified number of days, optionally filtered by name, and returns the number of items removed.
Task<long> DeleteOlderThanDaysAsync(int days, string? name = null)
Parameters
daysintThe age threshold in days; only records older than this value will be deleted.
namestringAn optional name used to filter which records are targeted for deletion. If null, deletion applies to all records regardless of name.
Returns
- Task<long>
A Task<TResult> that represents the asynchronous operation, containing the total count of deleted records.
FindAllLastPatientObservationTimeAsync()
Asynchronously retrieves the most recent observation time for all patients, returning a mapping of patient identifiers to their last observation timestamps.
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTimeAsync()
Returns
- Task<Dictionary<ObjectId, DateTime>>
A task that represents the asynchronous operation. The task result contains a dictionary where each key is a patient MongoDB.Bson.ObjectId and the associated value is the DateTime of that patient's last observation.
FindByDeviceIdAsync(string, DateTime?, DateTime?, int?)
Asynchronously retrieves pump observations associated with the specified device identifier, optionally filtered by a time range and limited in count.
Task<IEnumerable<PumpObservation>> FindByDeviceIdAsync(string deviceId, DateTime? from = null, DateTime? to = null, int? limit = null)
Parameters
deviceIdstringThe unique identifier of the device whose pump observations are being queried.
fromDateTime?Optional inclusive lower bound for the observation timestamp; when null, no lower bound is applied.
toDateTime?Optional inclusive upper bound for the observation timestamp; when null, no upper bound is applied.
limitint?Optional maximum number of observations to return; when null, all matching observations are returned.
Returns
- Task<IEnumerable<PumpObservation>>
A task that represents the asynchronous operation, yielding an enumerable collection of PumpObservation instances matching the criteria.
FindByPatientId(ObjectId?)
Asynchronously retrieves the pump observations associated with the specified patient identifier.
Task<IEnumerable<PumpObservation>> FindByPatientId(ObjectId? patientId)
Parameters
patientIdObjectId?The identifier of the patient whose pump observations are being queried. May be null.
Returns
- Task<IEnumerable<PumpObservation>>
A task that represents the asynchronous operation. The task result contains the collection of PumpObservation items found for the patient, or an empty collection if no observations are found.
FindLastByDeviceIdAsync(string)
Asynchronously retrieves the most recent PumpObservation associated with the specified device identifier.
Task<PumpObservation?> FindLastByDeviceIdAsync(string deviceId)
Parameters
deviceIdstringThe unique identifier of the device whose last observation is being queried.
Returns
- Task<PumpObservation>
A task that represents the asynchronous operation. The task result contains the last PumpObservation for the device, or
nullif no observation exists for the given device.
InsertAsync(PumpObservation)
Asynchronously inserts a pump observation into the underlying data store.
Task InsertAsync(PumpObservation obs)
Parameters
obsPumpObservationThe pump observation entity to persist.
Returns
InsertManyAsync(IEnumerable<PumpObservation>)
Asynchronously inserts a collection of pump observations into the underlying data store.
Task InsertManyAsync(IEnumerable<PumpObservation> observations)
Parameters
observationsIEnumerable<PumpObservation>The collection of PumpObservation records to be persisted.
Returns
UpdateManyObjectIdByFieldAsync(string, ObjectId, ObjectId?)
Asynchronously updates the ObjectId value of the specified field for multiple records, replacing the existing value (optionally matched by oldId) with newId.
Task<long> UpdateManyObjectIdByFieldAsync(string fieldName, ObjectId newId, ObjectId? oldId)
Parameters
fieldNamestringThe name of the field whose ObjectId value will be updated.
newIdObjectIdThe new ObjectId value to assign to the field.
oldIdObjectId?The optional current ObjectId value used as a filter; when null, the update is applied without filtering by the previous value.
Returns
- Task<long>
A Task<TResult> that represents the asynchronous operation, containing the number of records updated.