=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===
This commit is contained in:
@@ -10,6 +10,7 @@ namespace adas_core.Infrastructure.Repositories;
|
||||
/// <summary>
|
||||
/// Repository for managing archived patient diagnoses in MongoDB. This repository provides methods for inserting, deleting, and indexing patient diagnosis records in the archive collection.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=577bbca -->
|
||||
public class DiagnosisArchiveRepository : MongoRepository<PatientDiagnosis>, IDiagnosisArchiveRepository
|
||||
{
|
||||
private readonly ApiSettings _apiSettings;
|
||||
@@ -21,6 +22,7 @@ public class DiagnosisArchiveRepository : MongoRepository<PatientDiagnosis>, IDi
|
||||
/// <param name="apiSettings"></param>
|
||||
/// <param name="database"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <!-- aidoc:v1 sig=7317890 body=d2b18a3 -->
|
||||
public DiagnosisArchiveRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database) : base(database)
|
||||
{
|
||||
if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings));
|
||||
@@ -33,6 +35,7 @@ public class DiagnosisArchiveRepository : MongoRepository<PatientDiagnosis>, IDi
|
||||
/// </summary>
|
||||
/// <param name="patientDiagnosis">The patient diagnosis record to insert.</param>
|
||||
/// <returns>A task representing the asynchronous operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=078dbb7 body=e8b7555 -->
|
||||
public override async Task InsertOneAsync(PatientDiagnosis patientDiagnosis)
|
||||
{
|
||||
await Collection.InsertOneAsync(patientDiagnosis);
|
||||
@@ -43,6 +46,7 @@ public class DiagnosisArchiveRepository : MongoRepository<PatientDiagnosis>, IDi
|
||||
/// </summary>
|
||||
/// <param name="date">The date before which patient diagnosis records should be deleted.</param>
|
||||
/// <returns>A task representing the asynchronous operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=63daa66 body=6aa88ab -->
|
||||
public async Task DeleteBeforeDate(DateTime date)
|
||||
{
|
||||
var filter = Builders<PatientDiagnosis>.Filter.Lt(po => po.Time, date);
|
||||
@@ -55,6 +59,7 @@ public class DiagnosisArchiveRepository : MongoRepository<PatientDiagnosis>, IDi
|
||||
/// </summary>
|
||||
/// <param name="observations">The collection of patient diagnosis records to insert.</param>
|
||||
/// <returns>The number of records successfully inserted.</returns>
|
||||
/// <!-- aidoc:v1 sig=133455f body=c530ab0 -->
|
||||
public async Task<long> InsertBatch(IEnumerable<PatientDiagnosis> observations)
|
||||
{
|
||||
var writes = new List<WriteModel<PatientDiagnosis>>();
|
||||
@@ -71,6 +76,7 @@ public class DiagnosisArchiveRepository : MongoRepository<PatientDiagnosis>, IDi
|
||||
/// If the API settings do not specify a collection name, a default name of "archive_patients_diagnosis" is used.
|
||||
/// </summary>
|
||||
/// <returns>The name of the MongoDB collection for archived patient diagnoses.</returns>
|
||||
/// <!-- aidoc:v1 sig=94e22ff body=4f8e6ac -->
|
||||
public override string GetCollectionName()
|
||||
{
|
||||
return _apiSettings.ArchivePatientsDiagnosis ?? "archive_patients_diagnosis";
|
||||
@@ -80,6 +86,7 @@ public class DiagnosisArchiveRepository : MongoRepository<PatientDiagnosis>, IDi
|
||||
/// Creates indexes on the MongoDB collection for archived patient diagnoses to optimize query performance.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=4955da2 body=f61edcf -->
|
||||
public override async Task CreateIndexes()
|
||||
{
|
||||
var options = new CreateIndexOptions<PatientDiagnosis> { Background = true, Unique = false };
|
||||
|
||||
Reference in New Issue
Block a user