=== 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
@@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories;
/// <summary>
/// Repository for managing patient diagnoses in a MongoDB collection. Provides methods for CRUD operations and querying diagnoses by patient ID and code.
/// </summary>
/// <!-- aidoc:v1 sig=4f19305 -->
public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosisRepository
{
private readonly ApiSettings _apiSettings;
@@ -21,6 +22,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// <param name="apiSettings">The API settings containing configuration for the repository.</param>
/// <param name="database">The MongoDB database instance.</param>
/// <exception cref="ArgumentNullException">Thrown when the API settings are null.</exception>
/// <!-- aidoc:v1 sig=e5a1bd3 body=d2b18a3 -->
public DiagnosisRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database) : base(database)
{
if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings));
@@ -31,6 +33,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// Gets the name of the MongoDB collection for storing patient diagnoses. The collection name is determined by the API settings, and defaults to "patients_diagnosis" if not specified.
/// </summary>
/// <returns>The name of the MongoDB collection for patient diagnoses.</returns>
/// <!-- aidoc:v1 sig=94e22ff body=feb8aa0 -->
public override string GetCollectionName()
{
return _apiSettings.PatientsDiagnosis ?? "patients_diagnosis";
@@ -41,6 +44,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// </summary>
/// <param name="patientId">The ID of the patient whose diagnoses are to be retrieved.</param>
/// <returns>A list of patient diagnoses for the specified patient ID.</returns>
/// <!-- aidoc:v1 sig=29ab524 body=2b1e434 -->
public async Task<List<PatientDiagnosis>> GetByPatient(ObjectId patientId)
{
var filter = Builders<PatientDiagnosis>.Filter.Eq(ob => ob.PatientId, patientId);
@@ -55,6 +59,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// </summary>
/// <param name="id">The ID of the patient diagnosis to delete.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=78c6c5d body=494b016 -->
public new async Task DeleteAsync(ObjectId id)
{
var filter = Builders<PatientDiagnosis>.Filter.Eq(t => t.Id, id);
@@ -66,6 +71,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// </summary>
/// <param name="diagnosis">The patient diagnosis to insert.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=d69e886 body=fba3aaf -->
public override async Task InsertOneAsync(PatientDiagnosis diagnosis)
{
await Collection.InsertOneAsync(diagnosis);
@@ -76,6 +82,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// </summary>
/// <param name="patientId">The ID of the patient whose diagnoses are to be deleted.</param>
/// <returns></returns>
/// <!-- aidoc:v1 sig=4776e51 body=1287abe -->
public async Task DeleteByPatientId(ObjectId patientId)
{
var filter = Builders<PatientDiagnosis>.Filter.Eq(po => po.PatientId, patientId);
@@ -91,6 +98,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// <param name="code">The code of the diagnosis.</param>
/// <param name="codingSystem">The coding system of the diagnosis.</param>
/// <returns>The matching patient diagnosis, or null if not found.</returns>
/// <!-- aidoc:v1 sig=9870e04 body=960248f -->
public async Task<PatientDiagnosis?> FindByPatientIdAndCode(ObjectId patientId, string? code, string? codingSystem)
{
var builder = Builders<PatientDiagnosis>.Filter;
@@ -111,6 +119,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// </summary>
/// <param name="patientId">The ID of the patient whose diagnoses are to be retrieved.</param>
/// <returns>An asynchronous cursor of patient diagnoses.</returns>
/// <!-- aidoc:v1 sig=98dc0d1 body=8f5c296 -->
public async Task<IAsyncCursor<PatientDiagnosis>> FindByPatientIdAsync(ObjectId patientId)
{
var filter = Builders<PatientDiagnosis>.Filter.Eq(ob => ob.PatientId, patientId);
@@ -126,6 +135,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// <param name="id">The new patient ID to be set.</param>
/// <param name="oldId">The old patient ID to be replaced.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=72ce1ca body=b9b81e9 -->
public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)
{
await UpdateManyObjectIdAsync(nameId, id, oldId);
@@ -135,6 +145,7 @@ public class DiagnosisRepository : MongoRepository<PatientDiagnosis>, IDiagnosis
/// Creates indexes for the patient diagnosis collection. This method ensures that the necessary indexes are created on the MongoDB collection to optimize query performance.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=4955da2 body=5225318 -->
public override async Task CreateIndexes()
{
var options = new CreateIndexOptions { Background = true, Unique = false };