Table of Contents

Class TreatmentArchiveRepository

Namespace
adas_core.Infrastructure.Repositories
Assembly
adas-core.Infrastructure.dll

Provides a MongoDB-backed repository for persisting and retrieving archived patient treatment records. Inherits from MongoRepository<T> and implements the ITreatmentArchiveRepository contract.

public class TreatmentArchiveRepository : MongoRepository<PatientTreatment>, IMongoRepository<PatientTreatment>, ITreatmentArchiveRepository
Inheritance
TreatmentArchiveRepository
Implements
Inherited Members
Extension Methods

Constructors

TreatmentArchiveRepository(IOptions<ApiSettings>, IMongoDatabase)

public TreatmentArchiveRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database)

Parameters

apiSettings IOptions<ApiSettings>
database IMongoDatabase

Methods

DeleteBeforeDate(DateTime)

Deletes all patient treatments whose order time is before the specified date.

public Task DeleteBeforeDate(DateTime date)

Parameters

date DateTime

The cutoff date; treatments with an order time earlier than this are removed.

Returns

Task

FindAllFromPatient(ObjectId)

Retrieves all patient treatment records associated with the specified patient identifier from the collection.

public Task<List<PatientTreatment>> FindAllFromPatient(ObjectId patientId)

Parameters

patientId ObjectId

The unique identifier of the patient whose treatment records are to be retrieved.

Returns

Task<List<PatientTreatment>>

A task that represents the asynchronous operation, containing a list of PatientTreatment records matching the specified patient.

GetCollectionName()

Retrieves the collection name for archive patients treatments, falling back to the default "archive_patients_treatments" value when the API settings do not specify one.

public override string GetCollectionName()

Returns

string

The configured collection name from the API settings, or the default "archive_patients_treatments" if the setting is null.

InsertBatch(IEnumerable<PatientTreatment>)

Inserts a batch of PatientTreatment records into the underlying collection using a bulk write operation and returns the number of documents that were successfully inserted.

public Task<long> InsertBatch(IEnumerable<PatientTreatment> treatments)

Parameters

treatments IEnumerable<PatientTreatment>

The collection of patient treatment records to insert into the database.

Returns

Task<long>

The total count of patient treatment records inserted by the bulk write operation.

InsertOneAsync(PatientTreatment)

Asynchronously inserts a single PatientTreatment document into the collection.

public override Task InsertOneAsync(PatientTreatment patientTreatment)

Parameters

patientTreatment PatientTreatment

The patient treatment entity to persist.

Returns

Task