# Interface IRecordingAlertRepository

Namespace
  adas_core.Application.Repositories.Interfaces

Assembly
  adas-core.Application.dll

    public interface IRecordingAlertRepository : IMongoRepository<PatientRecordingAlert>

Inherited Members
  IMongoRepository<PatientRecordingAlert>.Collection
  IMongoRepository<PatientRecordingAlert>.GetCollectionName()
  IMongoRepository<PatientRecordingAlert>.DeleteAsync(ObjectId)
  IMongoRepository<PatientRecordingAlert>.UpdateOneAsync(ObjectId, PatientRecordingAlert)

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Methods

### AggregatedPatientLastObservations(ObjectId, int)

Retrieves an aggregated list of the most recent patient recording alerts for the specified patient.

    Task<List<PatientRecordingAlert>> AggregatedPatientLastObservations(ObjectId patientId, int num)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose recent alerts are being retrieved.

`num` int

  The maximum number of recent observations to return.

#### Returns

Task<List<PatientRecordingAlert>>

  A task that represents the asynchronous operation, containing a list of PatientRecordingAlert entries for the patient's last observations.

### DeleteByPatientId(ObjectId)

Asynchronously deletes records associated with the specified patient identifier.

    Task DeleteByPatientId(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique MongoDB.Bson.ObjectId of the patient whose related records should be removed.

#### Returns

Task

### DeleteOlderDaysAsync(string, int)

Asynchronously deletes records older than the specified number of days, identified by the given name.

    Task DeleteOlderDaysAsync(string name, int value)

#### Parameters

`name` string

  The identifier or key used to locate the records to be evaluated for deletion.

`value` int

  The age threshold, in days, used to determine which records are considered older and eligible for deletion.

#### Returns

Task

### DeleteOlderNumberAsync(string, int)

Asynchronously deletes a number record matching the specified name and value.

    Task DeleteOlderNumberAsync(string name, int value)

#### Parameters

`name` string

  The name associated with the number to delete.

`value` int

  The numeric value of the record to delete.

#### Returns

Task

  A task that represents the asynchronous delete operation.

### FindByPatientIdAsync(ObjectId)

Asynchronously retrieves all patient recording alerts associated with the specified patient identifier.

    Task<IAsyncCursor<PatientRecordingAlert>> FindByPatientIdAsync(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose recording alerts are being queried.

#### Returns

Task<IAsyncCursor<PatientRecordingAlert>>

  A task that represents the asynchronous operation, containing an asynchronous cursor over the matching PatientRecordingAlert documents.

### FindLastObservations(ObjectId, string, int)

Retrieves the most recent observations of a specified type for a given patient.

    Task<List<PatientRecordingAlert>> FindLastObservations(ObjectId patientId, string name, int num = 2)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose observations are queried.

`name` string

  The name of the observation to filter by.

`num` int

  The maximum number of recent observations to return. Defaults to 2.

#### Returns

Task<List<PatientRecordingAlert>>

  A task that represents the asynchronous operation. The task result contains a list of PatientRecordingAlert entries representing the matching observations.

### InsertOneAsync(PatientRecordingAlert)

Asynchronously inserts a single PatientRecordingAlert into the underlying data store.

    Task InsertOneAsync(PatientRecordingAlert patientRecordingAlert)

#### Parameters

`patientRecordingAlert` PatientRecordingAlert

  The patient recording alert to be inserted.

#### Returns

Task

### UpdateManyObjectId(string, ObjectId, ObjectId)

Updates many records by replacing the specified `oldId` with the new `id` within the collection identified by `nameId`.

    Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)

#### Parameters

`nameId` string

  The name or identifier of the collection in which the update is performed.

`id` ObjectId

  The new ObjectId to assign to the matching records.

`oldId` ObjectId

  The existing ObjectId used to locate the records to be updated.

#### Returns

Task