=== 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:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -14,6 +14,7 @@ namespace adas_core.Infrastructure.Repositories;
/// This class provides methods to perform CRUD operations and queries related to archived patient care plans, such as retrieving care plans by patient ID, inserting new care plans, and creating indexes.
/// It utilizes the MongoDB driver for database interactions and is configured using application settings for collection names and other parameters.
/// </summary>
/// <!-- aidoc:v1 sig=20f996a -->
public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>, IArchivePatientCarePlanRepository
{
#region Properties
@@ -37,6 +38,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// <param name="apiSettings">The API settings containing configuration for the repository.</param>
/// <param name="database">The MongoDB database instance.</param>
/// <param name="logger">The logger for logging information, warnings, and errors.</param>
/// <!-- aidoc:v1 sig=ac3a86d body=8a9d2fd -->
public ArchivePatientCarePlanRepository(
IOptions<ApiSettings> apiSettings,
IMongoDatabase database,
@@ -51,6 +53,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// This method ensures that the necessary indexes are created to optimize query performance, particularly for queries based on patient ID. The indexes are created in the background to avoid blocking operations on the database.
/// </summary>
/// <returns></returns>
/// <!-- aidoc:v1 sig=4955da2 body=747164e -->
public override async Task CreateIndexes()
{
var options = new CreateIndexOptions<PatientCarePlan> { Background = true, Unique = false };
@@ -73,6 +76,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// </summary>
/// <param name="patient">The patient care plan to be inserted.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=06563e4 body=65f486e -->
public override async Task InsertOneAsync(PatientCarePlan patient)
{
try
@@ -93,6 +97,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// </summary>
/// <param name="patient">The list of patient care plans to be inserted.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=67f7f21 body=d6d5f8a -->
public override async Task InsertManyAsync(List<PatientCarePlan> patient)
{
try
@@ -116,6 +121,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// This method is used by the base repository class to determine which collection to interact with for CRUD operations.
/// </summary>
/// <returns></returns>
/// <!-- aidoc:v1 sig=94e22ff body=a3f1bbe -->
public override string GetCollectionName()
{
return _apiSettings.ArchivePatientProcedure ?? "archive_patients_care_plan";
@@ -127,6 +133,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// </summary>
/// <param name="patientId">The ID of the patient whose care plans are to be retrieved.</param>
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects.</returns>
/// <!-- aidoc:v1 sig=33d98b1 body=fae3443 -->
public async Task<List<PatientCarePlan>?> FindByPatientId(ObjectId patientId)
{
var result = await Collection.FindAsync(Builders<PatientCarePlan>.Filter.Eq(p => p.PatientId, patientId));
@@ -138,6 +145,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// </summary>
/// <param name="patientId">The ID of the patient whose care plans are to be retrieved, provided as a string.</param>
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects.</returns>
/// <!-- aidoc:v1 sig=9198094 body=7897dce -->
public async Task<List<PatientCarePlan>?> FindByPatientId(string patientId)
{
var isParsed = ObjectId.TryParse(patientId, out var patientIdParsed);
@@ -151,6 +159,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// </summary>
/// <param name="patientNumber">The number of the patient whose care plans are to be retrieved.</param>
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects.</returns>
/// <!-- aidoc:v1 sig=3c65a30 body=41e7132 -->
public async Task<List<PatientCarePlan>?> FindByPatientNumber(string patientNumber)
{
var result = await Collection.FindAsync(Builders<PatientCarePlan>.Filter.Eq(p => p.PatientNumber, patientNumber));
@@ -161,6 +170,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// Finds all patient care plans in the MongoDB collection. This method retrieves all documents from the collection and returns them as a list of <see cref="PatientCarePlan"/> objects.
/// </summary>
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects.</returns>
/// <!-- aidoc:v1 sig=6a558a7 body=faea989 -->
public async Task<List<PatientCarePlan>> FindAll()
{
var result = await Collection.Find(Builders<PatientCarePlan>.Filter.Empty).ToListAsync();
@@ -176,6 +186,7 @@ public class ArchivePatientCarePlanRepository : MongoRepository<PatientCarePlan>
/// <param name="oldPatientPatientId">The ID of the patient whose care plans are to be retrieved, provided as a string.</param>
/// <param name="oldPatientPatientNumber">The number of the patient whose care plans are to be retrieved.</param>
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects.</returns>
/// <!-- aidoc:v1 sig=1d58fb5 body=6e9839e -->
public async Task<List<PatientCarePlan>?> FindByIds(ObjectId oldPatientId, string? oldPatientPatientId,
string? oldPatientPatientNumber)
{