Interface IObservationRepository
- Namespace
- adas_core.Application.Repositories.Interfaces
- Assembly
- adas-core.Application.dll
public interface IObservationRepository : IMongoRepository<PatientObservation>
- Inherited Members
- Extension Methods
Methods
AggregatedPatientActiveIntravenousLinesObservations(ObjectId)
Retrieves the aggregated active intravenous lines observations for the specified patient.
Task<List<PatientObservation?>> AggregatedPatientActiveIntravenousLinesObservations(ObjectId patientId)
Parameters
patientIdObjectIdThe unique identifier of the patient whose active intravenous lines observations are being retrieved.
Returns
- Task<List<PatientObservation>>
A task that represents the asynchronous operation, containing a list of PatientObservation entries representing the patient's active intravenous lines observations, where each entry may be null.
AggregatedPatientGroupedObservations(ObjectId, GroupedField)
Asynchronously aggregates a patient's observations grouped by the specified field.
Task<List<BsonDocument>> AggregatedPatientGroupedObservations(ObjectId patientId, GroupedField groupedField)
Parameters
patientIdObjectIdThe identifier of the patient whose observations will be aggregated.
groupedFieldGroupedFieldThe field used to group the patient's observations during aggregation.
Returns
- Task<List<BsonDocument>>
A task that represents the asynchronous operation, containing a list of BSON documents with the aggregated results.
AggregatedPatientLastObservations(ObjectId, int, List<string>?)
Asynchronously retrieves the most recent aggregated observations for a specified patient, returning up to the requested number of entries. Optionally filters the results to include only observations whose identifiers match the provided list.
Task<List<PatientObservation>> AggregatedPatientLastObservations(ObjectId patientId, int num, List<string>? filterObservations = null)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are being queried.
numintThe maximum number of most recent observations to return.
filterObservationsList<string>An optional list of observation identifiers used to restrict the returned results; if null, no filter is applied.
Returns
- Task<List<PatientObservation>>
A task representing the asynchronous operation, containing a list of the patient's most recent PatientObservation records.
AggregatedPatientLastObservationsByField(ObjectId, List<Field>?)
Retrieves the most recent patient observations, aggregated by field, for the specified patient.
Task<List<PatientObservation>> AggregatedPatientLastObservationsByField(ObjectId patientId, List<Field>? filterObservations = null)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are being retrieved.
filterObservationsList<Field>An optional list of fields to filter the observations by; if null, observations for all fields are returned.
Returns
- Task<List<PatientObservation>>
A task that represents the asynchronous operation. The task result contains a list of the latest patient observations grouped by field.
AggregatedPatientLastObservationsByLastDate(ObjectId, int, DateTime, List<string>?)
Retrieves the most recent aggregated patient observations for the specified patient up to the given last date, optionally filtered by a set of observation names.
Task<List<PatientObservation>> AggregatedPatientLastObservationsByLastDate(ObjectId patientId, int num, DateTime lastDate, List<string>? filterObservations = null)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are being retrieved.
numintThe maximum number of observations to return.
lastDateDateTimeThe cutoff date; only observations on or before this date are considered.
filterObservationsList<string>An optional list of observation names to restrict the results to. If null, no observation-name filter is applied.
Returns
- Task<List<PatientObservation>>
A task that represents the asynchronous operation, containing the list of aggregated PatientObservation entries that match the criteria.
DeleteAsync(ObjectId)
Asynchronously deletes the entity identified by the specified identifier.
Task DeleteAsync(ObjectId id)
Parameters
idObjectIdThe unique identifier of the entity to delete.
Returns
- Task
A task that represents the asynchronous delete operation.
DeleteByPatientId(ObjectId)
Deletes records associated with the specified patient identifier.
Task DeleteByPatientId(ObjectId id)
Parameters
idObjectIdThe ObjectId of the patient whose related records should be removed.
Returns
DeleteOlderDaysAsync(string, int)
Asynchronously deletes patient observations older than the specified retention period and returns the records that were removed.
Task<List<PatientObservation>> DeleteOlderDaysAsync(string name, int retentionPolicyValue)
Parameters
namestringThe identifier used to locate the relevant patient observations to be evaluated for deletion.
retentionPolicyValueintThe retention period in days; observations older than this value will be deleted.
Returns
- Task<List<PatientObservation>>
A task that represents the asynchronous operation, containing a list of the deleted PatientObservation records.
DeleteOlderNumberAsync(string, int)
Asynchronously deletes patient observations based on the specified name and retention policy value.
Task<List<PatientObservation>> DeleteOlderNumberAsync(string name, int retentionPolicyValue)
Parameters
namestringThe name used to identify or filter the patient observations to be deleted.
retentionPolicyValueintThe retention policy threshold value that determines which older observations should be removed.
Returns
- Task<List<PatientObservation>>
A task representing the asynchronous operation, containing the list of patient observations that were deleted.
DeleteOlderSecondsAsync(string, int)
Asynchronously deletes patient observations older than the specified number of seconds and returns the affected records.
Task<List<PatientObservation>> DeleteOlderSecondsAsync(string name, int value)
Parameters
namestringThe name used to identify the patient observations to filter for deletion.
valueintThe age threshold in seconds; observations older than this value will be deleted.
Returns
- Task<List<PatientObservation>>
A task that represents the asynchronous operation, containing the list of deleted patient observations.
ExistBySystemId(ObjectId, string)
Asynchronously checks whether a record exists for the specified patient identified by the given system identifier.
Task<bool> ExistBySystemId(ObjectId patientid, string systemId)
Parameters
patientidObjectIdThe unique identifier of the patient whose record is being checked.
systemIdstringThe system identifier used to look up the patient's record.
Returns
- Task<bool>
A task that represents the asynchronous operation. The task result is
trueif a matching record exists; otherwise,false.
ExpireExpiredObservations(List<ConfigObservation>)
Asynchronously processes and expires the specified configuration observations that have met their expiration criteria.
Task ExpireExpiredObservations(List<ConfigObservation> configObservationsToExpire)
Parameters
configObservationsToExpireList<ConfigObservation>The list of configuration observations to expire.
Returns
FindAll()
Retrieves all patient observation records.
Task<IEnumerable<PatientObservation>> FindAll()
Returns
- Task<IEnumerable<PatientObservation>>
A task representing the asynchronous operation, containing a collection of PatientObservation entries.
FindAllLastPatientObservationTime()
Asynchronously retrieves the most recent observation timestamp for every patient, returning a mapping of patient identifiers to their last observation times.
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime()
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 date and time of that patient's last observation.
FindAnyBeforeDate(ObjectId, DateTime)
Asynchronously retrieves all patient observations recorded for the specified patient before the given date.
Task<List<PatientObservation>> FindAnyBeforeDate(ObjectId patientId, DateTime date)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are being queried.
dateDateTimeThe cutoff date; only observations recorded prior to this date are returned.
Returns
- Task<List<PatientObservation>>
A task that represents the asynchronous operation, containing a list of patient observations found before the specified date.
FindAnyWithSameDate(ObjectId, string?, DateTime)
Finds any existing patient observations for the specified patient that share the same date, optionally filtered by observation name.
Task<List<PatientObservation>?> FindAnyWithSameDate(ObjectId patientId, string? name, DateTime date)
Parameters
patientIdObjectIdThe identifier of the patient whose observations are being searched.
namestringThe optional name of the observation to match; if null, observations of any name are considered.
dateDateTimeThe date used to match observations recorded on the same day.
Returns
- Task<List<PatientObservation>>
A task that returns a list of matching PatientObservation instances, or
nullif no matching observations are found.
FindById(ObjectId)
Asynchronously retrieves a patient observation by its unique identifier, returning null when no matching record is found.
Task<PatientObservation?> FindById(ObjectId id)
Parameters
idObjectIdThe unique identifier of the patient observation to locate.
Returns
- Task<PatientObservation>
A Task<TResult> that resolves to the matching PatientObservation, or
nullif no observation exists for the given identifier.
FindByName(string, DateTime?)
Asynchronously retrieves patient observations matching the specified name, optionally filtered by the provided date.
Task<IEnumerable<PatientObservation>> FindByName(string name, DateTime? date)
Parameters
namestringThe name used to look up the patient observations.
dateDateTime?The optional date used to filter the observations; when null, results are not restricted by date.
Returns
- Task<IEnumerable<PatientObservation>>
A task that represents the asynchronous operation, containing a collection of PatientObservation entries that match the criteria.
FindByPatientId(ObjectId)
Asynchronously retrieves a list of patient observations associated with the specified patient identifier. Returns null when no observations are found for the patient.
Task<List<PatientObservation>?> FindByPatientId(ObjectId id)
Parameters
idObjectIdThe unique identifier of the patient whose observations are being retrieved.
Returns
- Task<List<PatientObservation>>
A task containing a list of PatientObservation objects for the specified patient, or null if no observations are found.
FindByPatientIdAndCodingSystemAsync(ObjectId, string, string)
Asynchronously retrieves the PatientObservation records associated with the specified patient that belong to a given coding system, optionally filtered by name.
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAndCodingSystemAsync(ObjectId patientId, string codingSystem, string name)
Parameters
patientIdObjectIdThe identifier of the patient whose observations are being queried.
codingSystemstringThe coding system used to classify the observations (e.g., LOINC, SNOMED).
namestringThe name of the observation to filter within the coding system.
Returns
- Task<IAsyncCursor<PatientObservation>>
A Task<TResult> that yields an MongoDB.Driver.IAsyncCursor<TDocument> streaming the matching PatientObservation documents.
FindByPatientIdAsync(ObjectId)
Asynchronously retrieves the collection of patient observations associated with the specified patient identifier.
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAsync(ObjectId patientId)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are to be retrieved.
Returns
- Task<IAsyncCursor<PatientObservation>>
A task that represents the asynchronous operation, containing an MongoDB.Driver.IAsyncCursor<TDocument> of PatientObservation instances to iterate through the matching records.
FindLastNotExpiredObservatonsByPatient(ObjectId, string, int?, int?)
Asynchronously retrieves the most recent non-expired patient observations matching the specified name, supporting optional pagination.
Task<IEnumerable<PatientObservation>> FindLastNotExpiredObservatonsByPatient(ObjectId patientId, string name, int? endAfter = null, int? num = null)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are being queried.
namestringThe name of the observation to filter by.
endAfterint?Optional pagination cursor indicating the number of results to skip.
numint?Optional maximum number of observations to return.
Returns
- Task<IEnumerable<PatientObservation>>
A task that represents the asynchronous operation, containing a collection of matching PatientObservation objects.
FindLastObservationBeforeDate(ObjectId, string?, DateTime)
Retrieves the most recent PatientObservation for the specified patient recorded before the given date, optionally filtered by observation name.
Task<PatientObservation?> FindLastObservationBeforeDate(ObjectId patientId, string? name, DateTime date)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observation is being queried.
namestringThe optional name of the observation to filter by. If
null, observations of any name are considered.dateDateTimeThe cutoff date; only observations recorded strictly before this date are eligible.
Returns
- Task<PatientObservation>
A task that resolves to the matching PatientObservation if found, or
nullif no observation exists before the specified date.
FindLastObservations(ObjectId, string, string, int)
Retrieves the most recent patient observations that match the specified coding system and code, returning up to the requested number of results.
Task<IEnumerable<PatientObservation>> FindLastObservations(ObjectId patientId, string codingSystem, string code, int num = 2)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are being queried.
codingSystemstringThe coding system used to classify the observations (for example, LOINC, SNOMED).
codestringThe specific code within the coding system identifying the type of observation to retrieve.
numintThe maximum number of most recent observations to return. Defaults to 2.
Returns
- Task<IEnumerable<PatientObservation>>
A task that yields a collection of the matching PatientObservation records, ordered from most recent to oldest, containing at most
numentries.
FindLastObservationsByCodingSystem(ObjectId, string, int)
Retrieves the most recent patient observations filtered by the specified coding system.
Task<List<PatientObservation>> FindLastObservationsByCodingSystem(ObjectId patientId, string codingSystem, int num = 10)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are being queried.
codingSystemstringThe coding system used to filter the observations.
numintThe maximum number of recent observations to return. Defaults to 10.
Returns
- Task<List<PatientObservation>>
A task that represents the asynchronous operation, containing a list of the patient's most recent observations matching the coding system.
FindLatestUniqueValuesByName(ObjectId, string, int?)
Retrieves the most recent unique patient observations matching the specified name for the given patient, returning a list of PatientObservation entries.
Task<List<PatientObservation>> FindLatestUniqueValuesByName(ObjectId patientId, string name, int? expires)
Parameters
patientIdObjectIdThe unique identifier of the patient whose observations are being queried.
namestringThe name used to match the relevant patient observations.
expiresint?An optional expiration value in seconds used to control the time window for the lookup; if
null, no expiration is applied.
Returns
- Task<List<PatientObservation>>
A task that resolves to a list of the latest unique PatientObservation records matching the specified name for the patient. The list is empty if no matching observations are found.
FindNotExpired(List<string?>?)
Asynchronously retrieves patient observations that have not expired, optionally filtered by the specified observation identifiers.
Task<IEnumerable<PatientObservation>> FindNotExpired(List<string?>? filterObservations)
Parameters
filterObservationsList<string>An optional list of observation identifiers used to narrow the result set. May be null or contain null entries.
Returns
- Task<IEnumerable<PatientObservation>>
A task that resolves to a collection of non-expired PatientObservation instances matching the filter criteria.
GetPaginatedObservations(PaginationFilter)
Retrieves a paginated, fluent-queryable collection of patient observations based on the provided pagination filter.
IFindFluent<PatientObservation, PatientObservation> GetPaginatedObservations(PaginationFilter filter)
Parameters
filterPaginationFilterThe pagination filter that defines the page size, page number, and sorting criteria applied to the observations.
Returns
- IFindFluent<PatientObservation, PatientObservation>
An MongoDB.Driver.IFindFluent<TDocument, TProjection> for PatientObservation that allows further refinement and execution of the paginated query.
InsertOneAsync(PatientObservation)
Asynchronously inserts a single PatientObservation record into the underlying data store.
Task InsertOneAsync(PatientObservation patientObservation)
Parameters
patientObservationPatientObservationThe patient observation entity to persist.
Returns
Update(PatientObservation)
Updates an existing patient observation with the provided data.
Task Update(PatientObservation observation)
Parameters
observationPatientObservationThe patient observation containing the updated information to be persisted.
Returns
UpdateExpiredObservations(List<PatientObservation>)
Asynchronously updates the state of patient observations that have expired, applying the appropriate expiration handling to each item in the provided list.
Task UpdateExpiredObservations(List<PatientObservation> expiredObservations)
Parameters
expiredObservationsList<PatientObservation>The list of patient observations that have expired and require their state to be updated.
Returns
UpdateMany(IEnumerable<PatientObservation>, UpdateDefinition<PatientObservation>)
Updates multiple PatientObservation documents that match the provided update definition.
Task UpdateMany(IEnumerable<PatientObservation> patientObservations, UpdateDefinition<PatientObservation> update)
Parameters
patientObservationsIEnumerable<PatientObservation>The collection of patient observations to update.
updateUpdateDefinition<PatientObservation>The update definition describing the modifications to apply to each patient observation.
Returns
UpdateManyObjectId(string, ObjectId, ObjectId)
Updates many records by replacing the specified old ObjectId with the new ObjectId identified by the given name.
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)
Parameters
nameIdstringThe name identifier used to locate the target collection or field to update.
idObjectIdThe new ObjectId to assign to the matching records.
oldIdObjectIdThe existing ObjectId that identifies the records to be updated.