# Interface IObservationArchiveRepository

Namespace
  adas_core.Application.Repositories.Interfaces

Assembly
  adas-core.Application.dll

    public interface IObservationArchiveRepository : IMongoRepository<PatientObservation>

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

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

## Methods

### AggregatedPatientLastObservations(ObjectId, int, DateTime, List<string>)

Retrieves the most recent aggregated patient observations for the specified patient, limited by a count and an upper date bound, and optionally filtered by observation names.

    Task<List<PatientObservation>> AggregatedPatientLastObservations(ObjectId patientId, int num, DateTime lastDate, List<string> filterObservations)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose observations are being queried.

`num` int

  The maximum number of recent observations to return.

`lastDate` DateTime

  The cutoff date; only observations on or before this date are considered.

`filterObservations` List<string>

  An optional list of observation names to restrict the results to; pass an empty or null list to include all observations.

#### Returns

Task<List<PatientObservation>>

  A task that resolves to a list of PatientObservation entries representing the aggregated last observations matching the criteria.

### DeleteBeforeDate(DateTime)

Deletes the records that have a date earlier than the specified cutoff date.

    Task DeleteBeforeDate(DateTime date)

#### Parameters

`date` DateTime

  The cutoff date; records dated before this value will be removed.

#### Returns

Task

### FindAllFromPatient(ObjectId)

Retrieves all patient observations associated with the specified patient.

    Task<List<PatientObservation>> FindAllFromPatient(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The identifier of the patient whose observations are being retrieved.

#### Returns

Task<List<PatientObservation>>

  A task that represents the asynchronous operation, containing a list of PatientObservation records for the patient.

### InsertBatch(IEnumerable<PatientObservation>)

Asynchronously inserts a batch of patient observation records into the underlying data store.

    Task<long> InsertBatch(IEnumerable<PatientObservation> observations)

#### Parameters

`observations` IEnumerable<PatientObservation>

  The collection of PatientObservation entities to be inserted.

#### Returns

Task<long>

  A Task<TResult> that represents the asynchronous insert operation, returning a long value (such as the number of affected rows or a generated identifier) produced by the batch insertion.

### InsertOneAsync(PatientObservation)

Asynchronously inserts a single PatientObservation into the data store.

    Task InsertOneAsync(PatientObservation patientObservation)

#### Parameters

`patientObservation` PatientObservation

  The patient observation to insert.

#### Returns

Task