=== 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:
@@ -14,6 +14,7 @@ namespace adas_core.Application.Customizations.BD;
|
||||
/// <remarks>
|
||||
/// This type is instantiated with a primary constructor that accepts an <see cref="IServiceProvider"/> to resolve its dependencies.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=c3598e8 -->
|
||||
public class CalculatedObservations(IServiceProvider serviceProvider) : ICalculatedObservations
|
||||
{
|
||||
private readonly ILogger<CalculatedObservations> _logger =
|
||||
@@ -29,6 +30,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="obs">The patient observation to map.</param>
|
||||
/// <param name="onlyByName">Indicates whether the mapping should match observations by name only.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> containing the provided observation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_returns
|
||||
/// "The method returns Task<T?> (nullable), but the documentation references Task{T} (non-nullable Task<T>)." -->
|
||||
public Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation
|
||||
{
|
||||
return Task.FromResult(obs)!;
|
||||
@@ -39,6 +42,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment instance to map.</param>
|
||||
/// <returns>A completed <see cref="Task{PatientTreatment}"/> containing the provided treatment.</returns>
|
||||
/// <!-- aidoc:v1 sig=adce250 body=cf46cd2 -->
|
||||
public Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
return Task.FromResult(treatment);
|
||||
@@ -49,6 +53,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The <see cref="PatientDiagnosis"/> instance to map.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the provided <see cref="PatientDiagnosis"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=ad326e6 -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
return Task.FromResult(diagnosis);
|
||||
@@ -59,6 +64,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The pump observation to be mapped.</param>
|
||||
/// <returns>The mapped pump observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=50be4c1 body=9b6ad6e -->
|
||||
public async Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
if (pumpObservation.Code == "IHE PCD-04")
|
||||
@@ -71,6 +77,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of active medicines associated with the patient.</param>
|
||||
/// <param name="patientId">The unique identifier of the patient for whom the observations are calculated.</param>
|
||||
/// <!-- aidoc:v1 sig=b7a50a4 body=6805ef5 -->
|
||||
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -81,6 +88,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active bolus is being calculated.</param>
|
||||
/// <returns>A task that represents the asynchronous calculation of the active bolus.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary and returns description state that the method 'calculates' the active bolus, but the body only returns Task.CompletedTask and performs no calculation." -->
|
||||
public Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -92,6 +101,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="id">The unique <see cref="ObjectId"/> identifier of the patient whose active treatments are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an <see cref="IEnumerable{PatientTreatment}"/> of nullable <see cref="PatientTreatment"/> entries for the patient's active treatments.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown to indicate that the method is not yet implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=db74f82 body=bfa6f2f -->
|
||||
public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -103,6 +113,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="newObservation">The new patient observation to be reconciled against the last stored observation.</param>
|
||||
/// <returns>A task that yields the time-corrected <see cref="PatientObservation"/>, or <c>null</c> when no correction is required or no prior observation exists.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown because the method has not been implemented yet.</exception>
|
||||
/// <!-- aidoc:v1 sig=cb71754 body=bfa6f2f -->
|
||||
public Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -114,6 +125,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be pre-mapped before insertion.</param>
|
||||
/// <returns>A task containing the provided list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=5a37e9b body=0791af0 -->
|
||||
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
return Task.FromResult(listToInsert);
|
||||
@@ -126,6 +138,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="alarmToInsert">The source alarm to be inserted/mapped into the observation.</param>
|
||||
/// <returns>A <see cref="Task{PatientObservation}"/> that represents the asynchronous mapping operation, returning the resulting patient observation.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown because the method has not been implemented yet.</exception>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=bfa6f2f -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -139,6 +152,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="code">The optional alarm code that categorizes the alarm; may be null.</param>
|
||||
/// <returns>A task that represents the asynchronous alarm sending operation.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown because the method is not yet implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=90426a4 body=bfa6f2f -->
|
||||
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -152,6 +166,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The pump observation containing the alarm state, type, timestamps, and identifiers used to build the alarm patient observation.</param>
|
||||
/// <returns>A completed <see cref="Task"/> representing the insert operation, which never faults since exceptions are caught internally.</returns>
|
||||
/// <!-- aidoc:v1 sig=8716f6b body=6590257 -->
|
||||
private Task CreatePumpAlarmObservation(PumpObservation pumpObservation)
|
||||
{
|
||||
PatientObservation patientObservationAlarm = new()
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace adas_core.Application.Customizations.CHUO;
|
||||
/// <remarks>
|
||||
/// Instances are constructed with an <see cref="IServiceProvider"/> used to resolve dependencies required by the implementation.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=c3598e8 -->
|
||||
public class CalculatedObservations(IServiceProvider serviceProvider) : ICalculatedObservations
|
||||
{
|
||||
private readonly ILogger<CalculatedObservations> _logger =
|
||||
@@ -23,6 +24,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// Asynchronously calculates the active bolus for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient for whom the active bolus is being calculated.</param>
|
||||
/// <!-- aidoc:v1 sig=7d38721 body=6805ef5 -->
|
||||
public Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -33,6 +35,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The pump observation to map.</param>
|
||||
/// <returns>A <see cref="Task{PumpObservation}"/> containing the provided pump observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=50be4c1 body=e481734 -->
|
||||
public async Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
return await Task.FromResult(pumpObservation);
|
||||
@@ -43,6 +46,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of medicines currently active for the patient.</param>
|
||||
/// <param name="patientId">The identifier of the patient for whom the observation is calculated.</param>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=stale_summary
|
||||
/// "Method body returns Task.CompletedTask and does not actually perform any medicine observation calculation; the summary describes intended/pending behavior." -->
|
||||
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -55,6 +60,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="newObservation">The new patient observation to compare and reconcile against the last stored observation.</param>
|
||||
/// <returns>A task that yields the corrected <see cref="PatientObservation"/>, or <c>null</c> when no time inconsistency is found.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown because the method has not been implemented yet.</exception>
|
||||
/// <!-- aidoc:v1 sig=cb71754 body=bfa6f2f -->
|
||||
public Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -66,6 +72,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of nullable <see cref="PatientTreatment"/> objects representing the patient's active treatments.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown to indicate that the method has not yet been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=db74f82 body=bfa6f2f -->
|
||||
public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -77,6 +84,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="obs">The patient observation to map.</param>
|
||||
/// <param name="onlyByName">Indicates whether mapping should be performed by name only.</param>
|
||||
/// <returns>A task containing the provided observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=21d06c4 body=8f6255b -->
|
||||
public Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation
|
||||
{
|
||||
_logger.LogTrace("Mapping {name} observation {obs}", obs.Name, obs);
|
||||
@@ -91,6 +99,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="treatment">The patient treatment to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting <see cref="PatientTreatment"/>.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown when the method is invoked, as the mapping has not been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=adce250 body=bfa6f2f -->
|
||||
public Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -102,6 +111,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="diagnosis">The patient diagnosis to be mapped.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the mapped <see cref="PatientDiagnosis"/>.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown because the mapping logic has not yet been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=bfa6f2f -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -113,6 +123,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be pre-mapped prior to insertion.</param>
|
||||
/// <returns>A completed task containing the provided list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=5a37e9b body=0791af0 -->
|
||||
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
return Task.FromResult(listToInsert);
|
||||
@@ -124,6 +135,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="obs">The existing patient observation to be returned.</param>
|
||||
/// <param name="alarmToInsert">The alarm to be associated with the observation (currently not applied).</param>
|
||||
/// <returns>A completed <see cref="Task{PatientObservation}"/> containing the original observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=ea790e4 -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
return Task.FromResult(obs);
|
||||
@@ -135,6 +147,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="obs">The patient observation that triggers the alarm.</param>
|
||||
/// <param name="name">The name of the alarm to send.</param>
|
||||
/// <param name="code">The optional alarm code providing additional classification for the alarm.</param>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=missing_returns
|
||||
/// "Method returns Task but no <returns> tag is present to describe the asynchronous result." -->
|
||||
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace adas_core.Application.Customizations.H12O.UCIN;
|
||||
/// raw observations and active <see cref="PatientTreatment"/> entries, using the catalogue of
|
||||
/// codes, groups, and types configured in <see cref="ApiSettings"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1b16cfc -->
|
||||
public class CalculatedObservations : ICalculatedObservations
|
||||
{
|
||||
private readonly List<string> _complexityObservations =
|
||||
@@ -87,6 +88,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// ONi, ventilation modes, ECMO, and notes indicating medication) from <see cref="ApiSettings"/>.
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider">The application's service provider used to resolve the required dependencies and configuration.</param>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=stale_summary
|
||||
/// "The summary lists the configured catalogues loaded from ApiSettings but omits SurgeryText, which is also loaded in the constructor." -->
|
||||
public CalculatedObservations(IServiceProvider serviceProvider)
|
||||
{
|
||||
_observationService = serviceProvider.GetRequiredService<Lazy<IObservationService>>(); //observationService;
|
||||
@@ -159,6 +162,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// A <see cref="Task{T}"/> that resolves to the (possibly transformed) observation, or
|
||||
/// <see langword="null"/> when the input observation has no name.
|
||||
/// </returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "The documentation states the method resolves to null 'when the input observation has no name', but the early-exit branch returns the original `obs`, not null." -->
|
||||
public async Task<T?> Map<T>(T obs, bool onlyByName) where T : BasePatientObservation
|
||||
{
|
||||
// Early exit: if the observation has no name, there's nothing to map
|
||||
@@ -244,6 +249,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="treatment">The <see cref="PatientTreatment"/> to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation. The task result contains the processed <see cref="PatientTreatment"/>.</returns>
|
||||
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="treatment"/> parameter is <c>null</c>.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=extra_exception
|
||||
/// "ArgumentNullException is documented but the method body never throws it; no null check exists for the treatment parameter, so a null argument would result in a NullReferenceException, not ArgumentNullException." -->
|
||||
public async Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
if (treatment.SingleDose)
|
||||
@@ -316,6 +323,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The pump observation to map.</param>
|
||||
/// <returns>A task containing the same <see cref="PumpObservation"/> instance that was passed in.</returns>
|
||||
/// <!-- aidoc:v1 sig=50be4c1 body=e481734 -->
|
||||
public async Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
return await Task.FromResult(pumpObservation);
|
||||
@@ -330,6 +338,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="activeMedicines">The list of active <see cref="Medicine"/> instances currently associated with the patient.</param>
|
||||
/// <param name="patientId">The unique identifier of the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=299c0fe body=f6867d8 -->
|
||||
public async Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
await CalculateMedicineObservation(activeMedicines, [], new PatientTreatment { PatientId = patientId });
|
||||
@@ -342,6 +351,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=2aadb2d body=f1796c6 -->
|
||||
public async Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
// SIN RXA
|
||||
@@ -395,6 +405,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient.</param>
|
||||
/// <returns>A collection of active <see cref="PatientTreatment"/> objects for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=1c9e799 body=2a62eb7 -->
|
||||
public async Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
var activeTreatments = await _treatmentService.Value.GetActiveTreatmentsByPatient(id);
|
||||
@@ -409,6 +420,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The <see cref="PatientDiagnosis"/> to map.</param>
|
||||
/// <returns>A task containing the same <see cref="PatientDiagnosis"/> instance that was passed in.</returns>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=ad326e6 -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
return Task.FromResult(diagnosis);
|
||||
@@ -425,6 +437,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// A task that represents the asynchronous operation. The task result contains the fixed
|
||||
/// <see cref="PatientObservation"/> if the input had a valid name; otherwise, <see langword="null"/>.
|
||||
/// </returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "The summary states the trigger is when the new observation arrives with the 'same (down-to-the-second) timestamp', but the code's DateTime.Compare >= 0 condition also triggers the shift when the new observation's truncated time is strictly earlier than the last observation's." -->
|
||||
public async Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
if (string.IsNullOrEmpty(newObservation.Name))
|
||||
@@ -460,6 +474,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be pre-mapped.</param>
|
||||
/// <returns>A task containing the original list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=5a37e9b body=0791af0 -->
|
||||
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
return Task.FromResult(listToInsert);
|
||||
@@ -473,6 +488,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation that triggered the alarm.</param>
|
||||
/// <param name="alarmToInsert">The alarm metadata to be inserted alongside the observation.</param>
|
||||
/// <returns>A task containing the same <see cref="PatientObservation"/> instance that was passed in.</returns>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=ea790e4 -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
return Task.FromResult(obs);
|
||||
@@ -487,6 +503,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="code">The optional alarm code from <see cref="AlarmEnum.Name"/>.</param>
|
||||
/// <returns>Never returns a result.</returns>
|
||||
/// <exception cref="NotImplementedException">Always thrown because alarm dispatch is not implemented in the UCIN customization.</exception>
|
||||
/// <!-- aidoc:v1 sig=90426a4 body=bfa6f2f -->
|
||||
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -501,6 +518,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <exception cref="InvalidCastException">Thrown when <paramref name="obs"/> cannot be cast to <see cref="PatientObservation"/>.</exception>
|
||||
/// <exception cref="Exception">Rethrown after the underlying exception is written to the console for diagnostics.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "Summary states 'Errors are logged' but the code uses Console.WriteLine for exception output, not the _logger. The companion <exception> tag correctly describes console output, so the summary is mildly inconsistent with the actual behavior." -->
|
||||
public async Task CheckSurgeryExpired(BasePatientObservation obs)
|
||||
{
|
||||
try
|
||||
@@ -536,6 +555,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation expected to be a <see cref="PatientObservation"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the (possibly time-shifted) base patient observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=02a8359 body=9a6b741 -->
|
||||
public async Task<BasePatientObservation> CheckObsExistsAndIncrementTime(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -559,6 +579,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation expected to be a <see cref="PatientObservation"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the (possibly time-shifted) base patient observation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary claims the method is for 'temperature observations', but the code contains no temperature-specific logic — it works for any observation type passed in, using whatever Name is on the observation." -->
|
||||
public async Task<BasePatientObservation> CheckObsWithSameTimeExistsAndIncrementTime(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -579,6 +601,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The observation that triggered the calculation (one of <c>AirPressure_Mean</c>, <c>FiO2</c>, or <c>PaO2</c>).</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=3429ff2 body=103e384 -->
|
||||
public async Task CalculateOxygenationIndex(BasePatientObservation obs)
|
||||
{
|
||||
var toSearchList = new List<string>();
|
||||
@@ -655,6 +678,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The single-dose treatment whose end time is to be calculated.</param>
|
||||
/// <returns>The same <see cref="PatientTreatment"/> instance with its <c>EndTime</c> updated.</returns>
|
||||
/// <!-- aidoc:v1 sig=271263e body=4ddb3f4 -->
|
||||
private static PatientTreatment CalculateSingleDoseEndDate(PatientTreatment treatment)
|
||||
{
|
||||
/* Deprecated calc finish treatment date on shift end. Now every treatment single dose is last 8 Hours
|
||||
@@ -690,6 +714,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The treatment whose medicines should be checked.</param>
|
||||
/// <returns>A task that represents the asynchronous check operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=26b9617 body=0b5d20b -->
|
||||
public async Task CheckTreatmentMedicines(PatientTreatment treatment)
|
||||
{
|
||||
//sI TIENE UNA NOTA CON NPT SON DE TIPO NUTRICIÓN PARENTERAL Y SUMAN 1
|
||||
@@ -784,6 +809,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The treatment to inspect for NPT indicators, or <see langword="null"/>.</param>
|
||||
/// <returns>A task that resolves to a <see cref="Medicine"/> instance describing the parenteral nutrition, or an unnamed, untyped instance when no NPT notes are present.</returns>
|
||||
/// <!-- aidoc:v1 sig=d078407 body=3e76d41 -->
|
||||
private static Task<Medicine> CalculateParentalNutritionMedicine(PatientTreatment? treatment)
|
||||
{
|
||||
List<string> medicineType = [];
|
||||
@@ -818,6 +844,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="medicines">The medicines to add or remove depending on <c>OrderControl</c>.</param>
|
||||
/// <param name="treatment">The treatment that triggered the recalculation.</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=0ed4852 body=363a6db -->
|
||||
public async Task CalculateMedicineObservation(List<Medicine> activeMedicines, List<Medicine> medicines,
|
||||
PatientTreatment treatment)
|
||||
{
|
||||
@@ -876,6 +903,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="activeMedicines">The list of active medicines used to derive the risk level.</param>
|
||||
/// <param name="treatment">The treatment that triggered the recalculation.</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=b13c549 body=24f69f5 -->
|
||||
private async Task CalculateErMedication(List<Medicine> activeMedicines, PatientTreatment treatment)
|
||||
{
|
||||
//var activeTreatments = treatmentService.Value.GetActiveTreatmentsByPatient(treatment.patientid);
|
||||
@@ -908,6 +936,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of active medicines to evaluate.</param>
|
||||
/// <returns>A task that resolves to the integer risk level (0–5).</returns>
|
||||
/// <!-- aidoc:v1 sig=3c6a3b1 body=606ffd9 -->
|
||||
private static Task<int> CalculateErMedicineLevels(List<Medicine> activeMedicines)
|
||||
{
|
||||
var ironVitaminDCodes = new List<string> { "374424002", "175041000140104" };
|
||||
@@ -964,6 +993,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The respiratory-mode observation expected to be a <see cref="PatientObservation"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=a32f888 body=5994877 -->
|
||||
public async Task CalculateVentilationMode(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -998,6 +1028,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation (expected to be a <see cref="PatientObservation"/>).</param>
|
||||
/// <returns>A task that resolves to the same base patient observation that was passed in.</returns>
|
||||
/// <!-- aidoc:v1 sig=dbb815a body=5ae4249 -->
|
||||
public async Task<BasePatientObservation> CalculateAsistResp(BasePatientObservation obs)
|
||||
{
|
||||
//Comprobar si hay un resp_type más nuevo y si no lo hay ignorar
|
||||
@@ -1057,6 +1088,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The treatment whose ECMO state is being applied.</param>
|
||||
/// <returns>A task that represents the asynchronous recalculation operation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Documentation states 'In every case the change is followed by a complexity recalculation via CalculateComplexity', but the default case returns early without calling CalculateComplexity." -->
|
||||
private async Task CalculateComplexityOnEcmo(PatientTreatment treatment)
|
||||
{
|
||||
var ecmoObs = new PatientObservation
|
||||
@@ -1102,6 +1135,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The base patient observation that triggered the recalculation.</param>
|
||||
/// <param name="ignoreObs">When <see langword="true"/>, the supplied <paramref name="obs"/> is not added to the calculation inputs (useful for synthetic observations like ECMO).</param>
|
||||
/// <returns>A task that resolves to the same base patient observation that was passed in.</returns>
|
||||
/// <!-- aidoc:v1 sig=b7809c7 body=cf3438b -->
|
||||
public async Task<BasePatientObservation> CalculateComplexity(BasePatientObservation obs, bool ignoreObs = false)
|
||||
{
|
||||
try
|
||||
@@ -1278,6 +1312,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// early because the incoming observation is a duplicate insert (in which case the caller should
|
||||
/// not overwrite the stored observation).
|
||||
/// </returns>
|
||||
/// <!-- aidoc:v1 sig=09f61b3 body=4d3947c -->
|
||||
public async Task<BasePatientObservation?> CalculateIntravenousLineObservation(BasePatientObservation obs)
|
||||
{
|
||||
try
|
||||
@@ -1413,6 +1448,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation whose value represents the patient's weight.</param>
|
||||
/// <returns>A task that resolves to the integer complexity contribution (0–7).</returns>
|
||||
/// <!-- aidoc:v1 sig=a79c349 body=4c9b390 -->
|
||||
private async Task<int> CalculateWeight(BasePatientObservation obs)
|
||||
{
|
||||
var complexityValueOfWeight = 0;
|
||||
@@ -1445,6 +1481,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation expected to be a <see cref="PatientObservation"/> with a numeric value.</param>
|
||||
/// <returns>A task that resolves to the (possibly converted) base patient observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=18ad5f6 body=5d01118 -->
|
||||
public Task<BasePatientObservation> ParseWeight(BasePatientObservation obs)
|
||||
{
|
||||
if (obs is not PatientObservation pobs || !double.TryParse(pobs.Value.ToString(), out var dValue))
|
||||
@@ -1471,6 +1508,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// derived from whichever type is supplied.
|
||||
/// </param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=9488dd5 body=f704b41 -->
|
||||
public async Task CalculateMonitor(object monitorObservation)
|
||||
{
|
||||
var monitorValue = 0;
|
||||
@@ -1545,6 +1583,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The treatment that triggered the recalculation.</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=a3bb931 body=d219f09 -->
|
||||
private async Task CalculateSurgery(PatientTreatment treatment)
|
||||
{
|
||||
var surgeryScore = 0;
|
||||
@@ -1596,6 +1635,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="patientId">The unique identifier of the patient.</param>
|
||||
/// <param name="newTreatment">The optional new treatment to be included in the active-bolus set.</param>
|
||||
/// <returns>A task that resolves to the list of treatments currently counted as active boluses.</returns>
|
||||
/// <!-- aidoc:v1 sig=401adb8 body=c80c23f -->
|
||||
private async Task<List<PatientTreatment>> GetActiveBolus(ObjectId patientId, PatientTreatment? newTreatment)
|
||||
{
|
||||
var treatmentsProcessed = new List<PatientTreatment>();
|
||||
@@ -1660,6 +1700,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The treatment that triggered the recalculation and should be included in the active-bolus set.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=493996c body=3ef85e3 -->
|
||||
private async Task CalculateBolus(PatientTreatment treatment)
|
||||
{
|
||||
var activeBolus = await GetActiveBolus(treatment.PatientId, treatment);
|
||||
@@ -1686,6 +1727,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the alert evaluation (<c>TAm</c>, <c>Age_Gestational</c>, or <c>Age_Gestational_Fixed</c>).</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=857f5e0 body=0bf2cd4 -->
|
||||
public async Task CalculateTAmAlert(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -1749,6 +1791,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation (<c>Temp_Patient</c> or <c>Temp_Incubator</c>).</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=f3ac5ae body=4120ebf -->
|
||||
public async Task CalculateTempGradient(BasePatientObservation obs)
|
||||
{
|
||||
List<PatientObservation> tempRetrievedesFromBd;
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace adas_core.Application.Customizations.HGM;
|
||||
/// <summary>
|
||||
/// Represents a collection of calculated observations, providing a concrete implementation of the <see cref="ICalculatedObservations"/> contract.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1b16cfc -->
|
||||
public class CalculatedObservations : ICalculatedObservations
|
||||
{
|
||||
private readonly List<string> _highFrequencyVentilation = [];
|
||||
@@ -51,6 +52,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation to be mapped.</param>
|
||||
/// <param name="onlyByName">Flag indicating whether the mapping should be restricted to name-based criteria.</param>
|
||||
/// <returns>The mapped patient observation, or the original observation if no applicable mapping is found.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=stale_summary
|
||||
/// "The onlyByName parameter is documented as a 'Flag indicating whether the mapping should be restricted to name-based criteria,' but the parameter is never used in the method body. The switch statement processes cases based on name regardless of this flag." -->
|
||||
public async Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation
|
||||
{
|
||||
if (string.IsNullOrEmpty(obs.Name)) return obs;
|
||||
@@ -72,6 +75,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="treatment">The <see cref="PatientTreatment"/> instance to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting <see cref="PatientTreatment"/>.</returns>
|
||||
/// <exception cref="System.NotImplementedException">Thrown to indicate that the method has not yet been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=adce250 body=bfa6f2f -->
|
||||
public Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -83,6 +87,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="diagnosis">The patient diagnosis to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the mapped <see cref="PatientDiagnosis"/>.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown when the method is invoked, as the mapping logic has not been implemented yet.</exception>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=bfa6f2f -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -93,6 +98,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The pump observation to map.</param>
|
||||
/// <returns>A completed task containing the provided <see cref="PumpObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=50be4c1 body=e481734 -->
|
||||
public async Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
return await Task.FromResult(pumpObservation);
|
||||
@@ -104,6 +110,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient for whom the active bolus is calculated.</param>
|
||||
/// <exception cref="NotImplementedException">The method is not yet implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=7d38721 body=bfa6f2f -->
|
||||
public Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -115,6 +122,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="activeMedicines">The list of active medicines currently associated with the patient.</param>
|
||||
/// <param name="patientId">The unique identifier of the patient for whom the observation is being calculated.</param>
|
||||
/// <exception cref="NotImplementedException">The method is not yet implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=b7a50a4 body=bfa6f2f -->
|
||||
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -126,6 +134,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="newObservation">The new patient observation to reconcile against the last recorded observation.</param>
|
||||
/// <returns>A task that returns the corrected <see cref="PatientObservation"/>, or <c>null</c> when no last observation is available to compare against.</returns>
|
||||
/// <exception cref="System.NotImplementedException">The method is not yet implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=cb71754 body=bfa6f2f -->
|
||||
public Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -137,6 +146,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="id">The identifier of the patient whose active treatments are being requested.</param>
|
||||
/// <returns>A task that yields a collection of active <see cref="PatientTreatment"/> entries for the patient.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown because the method has not been implemented yet.</exception>
|
||||
/// <!-- aidoc:v1 sig=db74f82 body=bfa6f2f -->
|
||||
public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -147,6 +157,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be pre-mapped.</param>
|
||||
/// <returns>A completed task containing the provided list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=5a37e9b body=0791af0 -->
|
||||
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
return Task.FromResult(listToInsert);
|
||||
@@ -158,6 +169,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation to return as the mapped result.</param>
|
||||
/// <param name="alarmToInsert">The patient observation alarm to be considered during mapping.</param>
|
||||
/// <returns>A <see cref="Task{PatientObservation}"/> containing the provided <paramref name="obs"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=ea790e4 -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
return Task.FromResult(obs);
|
||||
@@ -171,6 +183,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="code">The optional alarm code identifying the alarm type.</param>
|
||||
/// <returns>A task that represents the asynchronous alarm sending operation.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown when the method is invoked, as it is not yet implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=90426a4 body=bfa6f2f -->
|
||||
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -180,6 +193,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// Calculates and persists the ventilation mode (<c>Resp_Type</c>) for a patient observation by mapping the observed value against known high-frequency, invasive, and non-invasive ventilation vocabularies, defaulting to <c>None</c> when the value is empty or unrecognized.
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation whose value is used to derive the respiration type; it is cast to <see cref="PatientObservation"/> to access the value.</param>
|
||||
/// <!-- aidoc:v1 sig=dd5b490 body=f8d6b73 -->
|
||||
private async Task CalculateVentilationMode(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace adas_core.Application.Customizations.HPAZ;
|
||||
/// <remarks>
|
||||
/// This class implements the <see cref="ICalculatedObservations"/> contract, exposing the behavior defined by that interface while relying on constructor-injected services for its operations.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=c3598e8 -->
|
||||
public class CalculatedObservations(IServiceProvider serviceProvider) : ICalculatedObservations
|
||||
{
|
||||
private readonly Lazy<IAlarmService> _alarmService = serviceProvider.GetRequiredService<Lazy<IAlarmService>>();
|
||||
@@ -42,6 +43,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// Asynchronously calculates the active bolus for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active bolus is to be calculated.</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the method 'calculates the active bolus', but the body only returns Task.CompletedTask without performing any calculation." -->
|
||||
public Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -52,6 +55,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of medicines currently active for the patient.</param>
|
||||
/// <param name="patientId">The unique identifier of the patient whose medicine observations are being calculated.</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the method calculates medicine observations based on active medicines, but the body only returns Task.CompletedTask and performs no calculation." -->
|
||||
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -63,6 +68,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of active <see cref="PatientTreatment"/> records for the patient, or an empty collection if none exist.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the method 'Retrieves the active treatments associated with the specified patient identifier,' but the implementation unconditionally returns an empty collection without performing any retrieval or checking the id parameter." -->
|
||||
public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
return Task.FromResult<IEnumerable<PatientTreatment?>>(new List<PatientTreatment?>());
|
||||
@@ -75,6 +82,10 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="source">Observation</param>
|
||||
/// <param name="onlyByName">True if the observation needs to generate an alert</param>
|
||||
/// <returns>Mapped observation</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=mentions_removed_behavior
|
||||
/// "Summary states 'inserts it if needed', but the method body contains no insertion logic — it only maps/processes the observation and returns it." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_param_role
|
||||
/// "onlyByName is documented as 'True if the observation needs to generate an alert', but the in-code comment states 'No generamos alertas si viene onlyByName' (alerts are NOT generated when onlyByName is true), and the parameter is never actually used in the method body." -->
|
||||
public async Task<T?> Map<T>(T source, bool onlyByName) where T : BasePatientObservation
|
||||
{
|
||||
_logger.LogDebug("Mapping {obsName} mode observation {obs}", source.Name, source);
|
||||
@@ -113,6 +124,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The source <see cref="PumpObservation"/> to map.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation. The task result contains the mapped <see cref="PumpObservation"/>.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the method maps to a 'new PumpObservation instance', but the code returns the same pumpObservation instance unchanged." -->
|
||||
public async Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
try
|
||||
@@ -212,6 +225,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="treatment">The <see cref="PatientTreatment"/> to be mapped.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the mapped <see cref="PatientTreatment"/>.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown in all cases because the method has not yet been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=adce250 body=bfa6f2f -->
|
||||
public Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -223,6 +237,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="diagnosis">The <see cref="PatientDiagnosis"/> to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the mapped <see cref="PatientDiagnosis"/>.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown to indicate that the mapping logic has not been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=bfa6f2f -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -234,6 +249,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="newObservation">The new patient observation to validate and potentially adjust for time consistency.</param>
|
||||
/// <returns>The patient observation with its time corrected if a time inconsistency was detected, otherwise the original observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=2b42b30 body=3a31920 -->
|
||||
public async Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
if (string.IsNullOrEmpty(newObservation.Name))
|
||||
@@ -267,6 +283,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="listToMap">The list of patient observations to process for mapping and blue code calculation.</param>
|
||||
/// <returns>The original list of patient observations passed to the method.</returns>
|
||||
/// <!-- aidoc:v1 sig=655d2ec body=afe534e -->
|
||||
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToMap)
|
||||
{
|
||||
var mappedObsList = listToMap
|
||||
@@ -290,6 +307,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="obs">The target <see cref="PatientObservation"/> instance that will be updated with values from the alarm.</param>
|
||||
/// <param name="alarmToInsert">The source <see cref="PatientObservationAlarm"/> whose values are applied to <paramref name="obs"/>.</param>
|
||||
/// <returns>A completed <see cref="Task{PatientObservation}"/> containing the updated <paramref name="obs"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=9a22777 -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(alarmToInsert.EventId))
|
||||
@@ -310,6 +328,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="name">The name of the alarm to be sent.</param>
|
||||
/// <param name="code">The optional alarm code identifying the type of alarm.</param>
|
||||
/// <exception cref="System.NotImplementedException">Thrown because the method is not yet implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=9d68c3e body=bfa6f2f -->
|
||||
Task ICalculatedObservations.SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -323,6 +342,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="name">The name of the alarm.</param>
|
||||
/// <param name="code">The optional alarm code identifier.</param>
|
||||
/// <param name="type">The type of alarm to send.</param>
|
||||
/// <!-- aidoc:v1 sig=cd9926e body=38786f6 -->
|
||||
private async Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code, AlarmEnum.Type type)
|
||||
{
|
||||
await _alarmService.Value.SendAlarm(obs, name, code, AlarmEnum.Severity.None, type);
|
||||
@@ -334,6 +354,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="obs">Observation</param>
|
||||
/// <returns>True if it needs to be ignored</returns>
|
||||
/// <!-- aidoc:v1 sig=9343b34 body=bfb9ed9 -->
|
||||
private bool CheckIfObservationIsOlderAndShouldBeIgnored(PatientObservation obs)
|
||||
{
|
||||
if (obs.Time.ToUniversalTime().AddMinutes(_apiSettings.IgnoreCalcObservationsOlderInMinutesThan) <
|
||||
@@ -354,6 +375,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="pobs">The patient observation whose alarm configuration should be resolved; its <c>Name</c> and <c>PatientId</c> are used to locate the configuration.</param>
|
||||
/// <returns>The same <see cref="PatientObservation"/> instance with its <c>Alarm</c> property populated from the matching configuration, or <c>null</c> when no configuration is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4d79a28 body=efca777 -->
|
||||
private async Task<PatientObservation> CheckAlarmConfig(PatientObservation pobs)
|
||||
{
|
||||
var configObs = await _configObservationService.Get(new PatientObservation
|
||||
@@ -373,6 +395,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="name">The alarm code used to identify the type of alarm; it is set as the <c>Code</c> and used to compose the <c>Name</c>.</param>
|
||||
/// <param name="pobs">The source patient observation whose value, patient identifier, time, and alarm flag are copied into the new alarm observation.</param>
|
||||
/// <returns>A new <see cref="PatientObservation"/> configured as an ADAS alarm observation based on the provided source.</returns>
|
||||
/// <!-- aidoc:v1 sig=235b1d9 body=27fc0a4 -->
|
||||
private static PatientObservation CreateAlarmObservation(string name, PatientObservation pobs)
|
||||
{
|
||||
return new PatientObservation
|
||||
@@ -391,6 +414,10 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// Checks if a blue code observation Lists needs to be generated and inserts it.
|
||||
/// </summary>
|
||||
/// <param name="obsList"></param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The method does not 'generate' or 'insert' a blue code observation list; it evaluates clinical conditions (FC, SpO2, TAm) and calls SendBlueCode to trigger a notification. The summary misrepresents both the action and the outcome." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=missing_param
|
||||
/// "The <param name='obsList'> tag has no description." -->
|
||||
public async Task CalculateBlueCodeList(List<PatientObservation?>? obsList)
|
||||
{
|
||||
//Las 3 observaciones vienen siempre juntas en el mismo mensaje
|
||||
@@ -461,6 +488,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// Sends a Blue Code alarm for the given patient observation. If the observation is null, the method returns without taking any action; otherwise it creates the corresponding alarm observation, validates it against the alarm configuration, persists it, and dispatches the alarm as an automatically triggered Blue alarm.
|
||||
/// </summary>
|
||||
/// <param name="pobs">The patient observation that triggers the Blue Code alarm; when null, the method short-circuits without processing.</param>
|
||||
/// <!-- aidoc:v1 sig=5b6ce3f body=c8aa765 -->
|
||||
private async Task SendBlueCode(PatientObservation? pobs)
|
||||
{
|
||||
if (pobs == null)
|
||||
@@ -486,6 +514,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation value whose ventilation mode will be calculated and normalized.</param>
|
||||
/// <returns>The patient observation with the normalized ventilation mode value.</returns>
|
||||
/// <!-- aidoc:v1 sig=0a38ecd body=8d45d84 -->
|
||||
private BasePatientObservationValue CalculateVentilationMode(BasePatientObservationValue obs)
|
||||
{
|
||||
var value = obs is PatientObservationAlarm oAlarm ? oAlarm.Value
|
||||
@@ -508,6 +537,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation to evaluate; non-<see cref="PatientObservation"/> instances are returned unchanged.</param>
|
||||
/// <returns>The original observation, with its <c>Time</c> adjusted by one second when a matching observation is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a546fa4 body=b8e5fa3 -->
|
||||
private async Task<BasePatientObservationValue> CheckObsWithSameTimeExistsAndIncrementTime(
|
||||
BasePatientObservationValue obs)
|
||||
{
|
||||
@@ -529,6 +559,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="obs">The newly received patient observation that triggered the calculation; its Name must be either "FiO2" or "Sattc".</param>
|
||||
/// <param name="name">The name of the observation, used to determine whether <paramref name="obs"/> is the FiO2 or the Sattc value.</param>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "The summary states the calculation is 'logged and skipped' when the insertion conditions are not met, but only the FiO2 == 0 case triggers a log message; other skip conditions (expired observations, unparseable values, null complementary observation, sat > 97) silently skip without logging." -->
|
||||
private async Task CalculateSf(BasePatientObservationValue obs, string name)
|
||||
{
|
||||
try
|
||||
@@ -590,6 +622,8 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// calculation if they are not
|
||||
/// in database then does nothing.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "The parameters 'obs' (BasePatientObservationValue containing the triggering observation) and 'name' (the name of the observation being processed, used to switch on which value was provided) are not documented." -->
|
||||
public async Task CalculateOxygenationIndex(BasePatientObservationValue obs, string name)
|
||||
{
|
||||
var toSearchList = new List<string>();
|
||||
@@ -665,6 +699,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="obs">The current patient observation that initiated the calculation; provides the patient identifier and timestamp used for the resulting observation.</param>
|
||||
/// <param name="name">The name of the observation in <paramref name="obs"/>, expected to be either <c>FiO2</c> or <c>PaO2_Tidal</c>, which determines how the counterpart value is resolved.</param>
|
||||
/// <!-- aidoc:v1 sig=1b41d79 body=5e03ddd -->
|
||||
private async Task CalculatePf(BasePatientObservationValue obs, string name)
|
||||
{
|
||||
try
|
||||
@@ -729,6 +764,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="name">The alarm identifier used to build the observation <c>Code</c> and <c>Name</c>.</param>
|
||||
/// <param name="pumpObservation">The pump data source providing rack/auxiliary info, drug name, time, and optional patient id.</param>
|
||||
/// <returns>A <see cref="Task{PatientObservation}"/> that yields the resulting observation, or <c>null</c> when the alarm configuration check rejects it.</returns>
|
||||
/// <!-- aidoc:v1 sig=adcd93c body=8ef1fe1 -->
|
||||
private async Task<PatientObservation?> CreatePumpAlarmObservation(string name,
|
||||
PumpObservation pumpObservation)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace adas_core.Application.Customizations.HRYC;
|
||||
/// Resp_Type, and Hour_Balance) from incoming raw observations and active configurations loaded from
|
||||
/// <see cref="ApiSettings"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1b16cfc -->
|
||||
public class CalculatedObservations : ICalculatedObservations
|
||||
{
|
||||
private readonly IOptions<ApiSettings> _apiSettings;
|
||||
@@ -42,6 +43,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// from <see cref="ApiSettings"/>.
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider">The application's service provider used to resolve the required dependencies and configuration.</param>
|
||||
/// <!-- aidoc:v1 sig=409f903 body=cf624d7 -->
|
||||
public CalculatedObservations(IServiceProvider serviceProvider)
|
||||
{
|
||||
_observationService = serviceProvider.GetRequiredService<Lazy<IObservationService>>(); //observationService;
|
||||
@@ -86,6 +88,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// A <see cref="Task{T}"/> that resolves to the (possibly transformed) observation,
|
||||
/// or <see langword="null"/> when the input observation has no name.
|
||||
/// </returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "Documentation claims the method returns null 'when the input observation has no name', but the method always returns the (possibly transformed) obs parameter; the code never returns null, so the null branch described in <returns> does not exist." -->
|
||||
public async Task<T?> Map<T>(T obs, bool onlyByName) where T : BasePatientObservation
|
||||
{
|
||||
_logger.LogTrace("Mapping {name} observation {obs}", obs.Name, obs);
|
||||
@@ -148,6 +152,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="treatment">The treatment to map.</param>
|
||||
/// <returns>Never returns a result.</returns>
|
||||
/// <exception cref="NotImplementedException">Always thrown because treatment mapping is not implemented in the HRYC customization.</exception>
|
||||
/// <!-- aidoc:v1 sig=adce250 body=bfa6f2f -->
|
||||
public Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -161,6 +166,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The pump observation to map.</param>
|
||||
/// <returns>A task containing the same <see cref="PumpObservation"/> instance that was passed in.</returns>
|
||||
/// <!-- aidoc:v1 sig=50be4c1 body=e481734 -->
|
||||
public async Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
return await Task.FromResult(pumpObservation);
|
||||
@@ -174,6 +180,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="activeMedicines">The list of active medicines (ignored).</param>
|
||||
/// <param name="patientId">The unique identifier of the patient (ignored).</param>
|
||||
/// <returns>A completed task.</returns>
|
||||
/// <!-- aidoc:v1 sig=b7a50a4 body=6805ef5 -->
|
||||
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -185,6 +192,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient (ignored).</param>
|
||||
/// <returns>A completed task.</returns>
|
||||
/// <!-- aidoc:v1 sig=7d38721 body=6805ef5 -->
|
||||
public Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -196,6 +204,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient (ignored).</param>
|
||||
/// <returns>A completed task containing an empty <see cref="IEnumerable{PatientTreatment}"/>.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_returns
|
||||
/// "The cref references IEnumerable{PatientTreatment}, but the actual return type is IEnumerable{PatientTreatment?} (element type is nullable)." -->
|
||||
public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
return Task.FromResult(new List<PatientTreatment?>().AsEnumerable());
|
||||
@@ -207,6 +217,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The <see cref="PatientDiagnosis"/> to map.</param>
|
||||
/// <returns>A task containing the same <see cref="PatientDiagnosis"/> instance that was passed in.</returns>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=ad326e6 -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
return Task.FromResult(diagnosis);
|
||||
@@ -224,6 +235,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// A task that resolves to the (possibly time-shifted) <see cref="PatientObservation"/>.
|
||||
/// Returns the input unchanged when its <c>Name</c> is null or empty, logging the error.
|
||||
/// </returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
|
||||
/// "Summary states the time is shifted 'when it arrives with the same (down-to-the-second) timestamp' as the latest observation, but the code actually shifts whenever the last observation's second-truncated time is greater than OR equal to the new observation's (DateTime.Compare >= 0), i.e., it also corrects cases where the new observation arrives earlier than the latest one." -->
|
||||
public async Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
if (string.IsNullOrEmpty(newObservation.Name))
|
||||
@@ -262,6 +275,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// A task that resolves to the resulting list of observations (with <c>Vent_Rate</c> removed
|
||||
/// when it was inserted synchronously, or the original list otherwise).
|
||||
/// </returns>
|
||||
/// <!-- aidoc:v1 sig=e508c09 body=d3232c6 -->
|
||||
public async Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
var ventRate = listToInsert.FirstOrDefault(obs => obs.Name == "MDC_VENT_RESP_RATE");
|
||||
@@ -312,6 +326,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation that triggered the alarm.</param>
|
||||
/// <param name="alarmToInsert">The alarm metadata to be inserted alongside the observation.</param>
|
||||
/// <returns>A task containing the same <see cref="PatientObservation"/> instance that was passed in.</returns>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=ea790e4 -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
return Task.FromResult(obs);
|
||||
@@ -327,6 +342,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="code">The optional alarm code from <see cref="AlarmEnum.Name"/>.</param>
|
||||
/// <returns>Never returns a result.</returns>
|
||||
/// <exception cref="NotImplementedException">Always thrown because this overload is not used in the HRYC customization.</exception>
|
||||
/// <!-- aidoc:v1 sig=90426a4 body=bfa6f2f -->
|
||||
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -339,6 +355,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation, expected to be a <see cref="PatientObservation"/> whose <c>Name</c> is <c>NEWS</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous alarm evaluation.</returns>
|
||||
/// <!-- aidoc:v1 sig=a2f90ec body=b1f8d11 -->
|
||||
private async Task CalculateNews(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -382,6 +399,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The base patient observation that triggered the alarm (used to derive <c>PatientId</c> and <c>Time</c>).</param>
|
||||
/// <param name="name">The <see cref="AlarmEnum.Name"/> describing the alarm kind (for example, <c>NewsOff</c>, <c>NewsWarning</c>, <c>NewsAlert</c>).</param>
|
||||
/// <returns>A task that represents the asynchronous alarm dispatch.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Summary states 'The alarm observation is always persisted', but the method returns early without calling InsertObservation when configObs is null (and also when an exception is thrown), so persistence is not guaranteed." -->
|
||||
private async Task SendAlarm(BasePatientObservation obs, AlarmEnum.Name name)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -444,6 +463,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="color">The beacon colour to apply.</param>
|
||||
/// <param name="patient">The patient whose associated beacon should be updated.</param>
|
||||
/// <!-- aidoc:v1 sig=aced090 body=6297307 -->
|
||||
private void SendBeaconCode(AlarmEnum.BeaconColor color, Patient patient)
|
||||
{
|
||||
if (!patient.PointOfCareId.HasValue)
|
||||
@@ -478,6 +498,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation (<c>SpO2</c>, <c>FiO2</c>, or <c>FR</c>).</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=stale_summary
|
||||
/// "Documentation states observations must be 'within the last 10 minutes', but the code checks `o.Time.CompareTo(DateTime.UtcNow.AddMinutes(10)) <= 0` (10 minutes in the future), which is a much more permissive check that allows any past observation and does not enforce a 10-minute-ago cutoff." -->
|
||||
private async Task CalculateIrox(BasePatientObservation obs)
|
||||
{
|
||||
try
|
||||
@@ -560,6 +582,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation (<c>FR</c> or <c>Vent_Rate</c>).</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=0c7e3f7 body=e68f279 -->
|
||||
private async Task CalculateRespRate(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -627,6 +650,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation expected to be a <see cref="PatientObservation"/> with <c>Name</c> <c>Hydric_Balance</c>.</param>
|
||||
/// <returns>A task that resolves to the (possibly time-shifted) base patient observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=443610d body=4a73250 -->
|
||||
private async Task<BasePatientObservation> CalculateHydricBalance(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -650,6 +674,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation expected to be a <see cref="PatientObservation"/> with <c>Name</c> <c>Hour_Balance</c>.</param>
|
||||
/// <returns>A task that resolves to the (possibly time-shifted) base patient observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=23cf188 body=8e46c30 -->
|
||||
private async Task<BasePatientObservation> CalculateHourBalance(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -677,6 +702,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation, expected to be a <see cref="PatientObservation"/> with <c>Name</c> <c>Hydric_Balance</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=721b70b body=271caec -->
|
||||
private async Task CalculateHydricBalanceCalculated(BasePatientObservation obs)
|
||||
{
|
||||
//Hydric_Balance_Calculated
|
||||
@@ -753,6 +779,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation, expected to be a <see cref="PatientObservation"/> with <c>Name</c> <c>Resp_Mode</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=stale_summary
|
||||
/// "Summary references identifier 'InvasiveVentilation' (in <c> tags) but the actual field is '_codesForInvasiveVentilation'." -->
|
||||
private async Task CalculateVentilationMode(BasePatientObservation obs)
|
||||
{
|
||||
_logger.LogDebug("CalculateVentilationMode {obs}", obs);
|
||||
@@ -800,6 +828,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation, expected to be a <see cref="PatientObservation"/> with <c>Name</c> <c>Weight_Current</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=cb420e5 body=6df7b22 -->
|
||||
private async Task CalculateWeight_DiffObservation(BasePatientObservation obs)
|
||||
{
|
||||
var toSearchList = new List<string>();
|
||||
@@ -839,6 +868,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation (<c>Diuresis</c> or <c>Weight_Current</c>).</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=c96d1b4 body=0dfe456 -->
|
||||
private async Task CalculateDiureis_WeightObservation(BasePatientObservation obs)
|
||||
{
|
||||
var toSearchList = new List<string>();
|
||||
@@ -891,6 +921,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation, expected to be a <see cref="PatientObservation"/> with <c>Name</c> <c>AllergiesObs</c> and a collection-valued <c>Value</c> of <see cref="PatientAllergiesValue"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=16bb26b body=661f911 -->
|
||||
private async Task CalculateAllergiesObservation(BasePatientObservation obs)
|
||||
{
|
||||
try
|
||||
@@ -967,6 +998,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation, expected to be a <see cref="PatientObservation"/> with <c>Name</c> <c>DrainagesObs</c> and a <see cref="PatientDrainagesValue"/>-typed <c>Value</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=2e0f71d body=98b8c9e -->
|
||||
private async Task CalculateDrainagesObservation(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = (PatientObservation)obs;
|
||||
@@ -1013,6 +1045,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation (<c>PEEP</c> or <c>Pleateu_Pressure</c>).</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=fe22b05 body=bc944b3 -->
|
||||
private async Task CalculateDelta_PressureObservation(BasePatientObservation obs)
|
||||
{
|
||||
var toSearchList = new List<string>();
|
||||
@@ -1071,6 +1104,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation, expected to be a <see cref="PatientObservation"/> with <c>Name</c> <c>Daily_Balance</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=e959764 body=2322c22 -->
|
||||
private async Task CalculateDaily_BalanceObservation(BasePatientObservation obs)
|
||||
{
|
||||
if (obs.Time.ToLocalTime().Hour == 8)
|
||||
@@ -1098,6 +1132,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <see langword="true"/> when the observation has an <c>Expires</c> value and the current time
|
||||
/// is past the expiration instant; otherwise, <see langword="false"/>.
|
||||
/// </returns>
|
||||
/// <!-- aidoc:v1 sig=c7c5c82 body=4c62b98 -->
|
||||
private static bool CheckExpired(PatientObservation obs)
|
||||
{
|
||||
if (obs.Expires == null) return false;
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace adas_core.Application.Customizations.HUVH.UCIA;
|
||||
/// Represents a concrete implementation of the <see cref="ICalculatedObservations"/> interface,
|
||||
/// providing functionality to manage a collection of calculated observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1b16cfc -->
|
||||
public class CalculatedObservations : ICalculatedObservations
|
||||
{
|
||||
private const string CodingSystem = "ADAS";
|
||||
@@ -67,6 +68,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose active bolus should be calculated.</param>
|
||||
/// <exception cref="NotImplementedException">Thrown when the method is invoked, as the calculation logic has not yet been implemented.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=stale_summary
|
||||
/// "The summary states that the method 'calculates the active bolus', but the body only throws NotImplementedException and performs no calculation; the <exception> tag mitigates this by noting the logic is not yet implemented." -->
|
||||
public Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -79,6 +82,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation to map; may be replaced with the result of the matched asynchronous calculation when applicable.</param>
|
||||
/// <param name="onlyByName">Indicates whether the mapping should be performed using only the observation's name.</param>
|
||||
/// <returns>The processed patient observation, potentially updated by the applicable calculation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=mentions_removed_behavior
|
||||
/// "The <param name=\"onlyByName\"> describes behavior ('Indicates whether the mapping should be performed using only the observation's name'), but the parameter is never referenced anywhere in the method body; the dispatching always relies solely on the observation's name regardless of this flag." -->
|
||||
public async Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation
|
||||
{
|
||||
if (obs.Name is "PSI" or "RASS" or "TS") _ = CalculateOverSedation(obs);
|
||||
@@ -106,6 +111,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment to map and update.</param>
|
||||
/// <returns>The patient treatment with its order control set according to the evaluated business rules.</returns>
|
||||
/// <!-- aidoc:v1 sig=442a6e8 body=e1bed22 -->
|
||||
public async Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
var order = treatment.PlacerOrder?.EntityIdentifier; //aquí almacenamos el número de orden
|
||||
@@ -130,6 +136,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The pump observation to map.</param>
|
||||
/// <returns>A completed task containing the provided <see cref="PumpObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=50be4c1 body=e481734 -->
|
||||
public async Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
return await Task.FromResult(pumpObservation);
|
||||
@@ -141,6 +148,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of currently active medicines assigned to the patient.</param>
|
||||
/// <param name="patientId">The unique identifier of the patient whose medication categories will be checked.</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary claims the method 'calculates medicine observations', but the implementation only invokes CheckMedicationCategories and returns Task.CompletedTask; no observation calculation is performed." -->
|
||||
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
//Esto viene del schedulerService para chequear los medicamentos activos
|
||||
@@ -154,6 +163,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments should be retrieved.</param>
|
||||
/// <returns>A collection of <see cref="PatientTreatment"/> objects representing the patient's active treatments.</returns>
|
||||
/// <!-- aidoc:v1 sig=1c9e799 body=2a62eb7 -->
|
||||
public async Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
var activeTreatments = await _treatmentService.Value.GetActiveTreatmentsByPatient(id);
|
||||
@@ -167,6 +177,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="diagnosis">The <see cref="PatientDiagnosis"/> to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting <see cref="PatientDiagnosis"/>.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown when the method is invoked, as the mapping logic has not yet been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=bfa6f2f -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -179,6 +190,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="newObservation">The new patient observation whose timestamp should be adjusted to avoid time inconsistencies with prior observations.</param>
|
||||
/// <returns>The patient observation, with its <c>Time</c> adjusted when a time collision is detected, or the original observation when its name is null or empty.</returns>
|
||||
/// <!-- aidoc:v1 sig=2b42b30 body=04118be -->
|
||||
public async Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
if (string.IsNullOrEmpty(newObservation.Name))
|
||||
@@ -211,6 +223,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to pre-map before insertion.</param>
|
||||
/// <returns>A completed task containing the provided list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=5a37e9b body=0791af0 -->
|
||||
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
return Task.FromResult(listToInsert);
|
||||
@@ -222,6 +235,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation to be returned as the mapping result.</param>
|
||||
/// <param name="alarmToInsert">The patient observation alarm intended to be associated with the observation.</param>
|
||||
/// <returns>A task containing the patient observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=ea790e4 -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
return Task.FromResult(obs);
|
||||
@@ -235,6 +249,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="code">The optional alarm code categorizing the alarm, or null if no code is specified.</param>
|
||||
/// <returns>A task that represents the asynchronous alarm sending operation.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown to indicate that the method has not yet been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=90426a4 body=bfa6f2f -->
|
||||
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -246,6 +261,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation to evaluate for the rehabilitation alarm condition.</param>
|
||||
/// <returns>The observation with its status set to Alert when the six previous rehabilitation observations also fall within the 0-2 range; otherwise the observation is returned as-is.</returns>
|
||||
/// <!-- aidoc:v1 sig=4d51d03 body=02faf98 -->
|
||||
private async Task<BasePatientObservation> CalculateRehabilitationAlarm(BasePatientObservation obs)
|
||||
{
|
||||
//En rojo si el grado es de 0 a 2 incluidos, por más de 7 días
|
||||
@@ -270,6 +286,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The incoming base patient observation; only <see cref="PatientObservation"/> instances whose
|
||||
/// <c>Name</c> is "Diuresis" or "Weight" are processed, otherwise the method returns without changes.</param>
|
||||
/// <!-- aidoc:v1 sig=a9e1f01 body=35f930e -->
|
||||
private async Task CalculateDiuresis(BasePatientObservation obs)
|
||||
{
|
||||
// Calculado como el sumatorio de la Diuresis de las últimas 6h
|
||||
@@ -350,6 +367,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// Calculates the ROX Index by dividing the SpO2/FiO2 ratio by the respiratory rate (FR) and persists the result as a new <c>Rox_Index</c> observation. The method supports both directions of the calculation: when the incoming observation is the SpO2/FiO2 ratio, it retrieves the latest FR, and vice versa. It silently returns if the observation is not a <c>PatientObservation</c>, if the observation name is not recognized, if the required paired observation cannot be found, if its value cannot be parsed, or if the FR value is zero (to avoid division by zero).
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggers the ROX index calculation. Only observations named <c>SpO2_FiO2_Ratio</c> or <c>FR</c> are processed; any other type or name is ignored.</param>
|
||||
/// <!-- aidoc:v1 sig=b303a48 body=1e098ad -->
|
||||
private async Task CalculateRoxIndex(BasePatientObservation obs)
|
||||
{
|
||||
// Cálculo dividiendo el ratio SpO2/FiO2 entre la FR
|
||||
@@ -402,6 +420,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// Calculates the driving pressure for a patient as the difference between Pmeset and PEEP when a new Pmeset or PEEP observation is provided. Looks up the complementary observation to obtain the missing value, then creates and persists a "Driving_Pressure" observation. Returns early if the input is not a PatientObservation, the observation name is neither Pmeset nor PEEP, the complementary observation cannot be found, or its value cannot be parsed as an integer.
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation; expected to represent a Pmeset or PEEP measurement.</param>
|
||||
/// <!-- aidoc:v1 sig=b3a7d66 body=19b29eb -->
|
||||
private async Task CalculateDrivingPressure(BasePatientObservation obs)
|
||||
{
|
||||
//Diferencia entre la Pmeset y la PEEP
|
||||
@@ -458,6 +477,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The observation that triggered the evaluation; its value must be numeric and it is ignored if <paramref name="patientId"/> is provided (e.g., when invoked from a treatment context).</param>
|
||||
/// <param name="patientId">The patient identifier when the evaluation is triggered by a treatment event; when null, it is derived from <paramref name="obs"/>.</param>
|
||||
/// <!-- aidoc:v1 sig=28b0d06 body=65c1f9b -->
|
||||
private async Task CalculateOverAnalgesia(BasePatientObservation? obs, ObjectId? patientId = null)
|
||||
{
|
||||
// Mandar observación 'SOBREANALGESIA'
|
||||
@@ -537,6 +557,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation to evaluate and potentially transform.</param>
|
||||
/// <returns>A task that yields the observation, with its value normalized to "ECMO" when the original value is one of the recognized ECMO variants.</returns>
|
||||
/// <!-- aidoc:v1 sig=5673ebb body=65604a9 -->
|
||||
private Task<BasePatientObservation> CalculateEcmoLocation(BasePatientObservation obs)
|
||||
{
|
||||
//Las opciones pueden ser VV, VA o ECMO.
|
||||
@@ -564,6 +585,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// anything.
|
||||
/// </summary>
|
||||
/// <param name="obs">The incoming patient observation whose name drives the ventilation mode calculation.</param>
|
||||
/// <!-- aidoc:v1 sig=dd5b490 body=76605b5 -->
|
||||
private async Task CalculateVentilationMode(BasePatientObservation obs)
|
||||
{
|
||||
//- Si llega valor de PI pero NO COMPL, el tipo de ventilación es VMNI
|
||||
@@ -619,6 +641,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The triggering patient observation used to evaluate the sedation state. When provided, its name and value drive the initial validation; when null, the method relies on the <paramref name="patientId"/> parameter (typically from a treatment update).</param>
|
||||
/// <param name="patientId">Optional identifier of the patient to evaluate. If null, it is derived from <paramref name="obs"/>; otherwise, the method performs a full evaluation using the patient's recent observations.</param>
|
||||
/// <!-- aidoc:v1 sig=0a9014e body=8a7e50f -->
|
||||
private async Task CalculateOverSedation(BasePatientObservation? obs, ObjectId? patientId = null)
|
||||
{
|
||||
//Mandar observación 'SOBRESEDACIÓN'
|
||||
@@ -700,6 +723,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment to evaluate; may be null.</param>
|
||||
/// <returns><c>true</c> if the treatment has a start time and was started more than 24 hours ago; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=ee619c2 body=c94e0d4 -->
|
||||
private static bool ExceedsAnalgesiaThreshold(PatientTreatment? treatment)
|
||||
{
|
||||
// Perfusiones de morfina, remifentanilo o fentanilo sostenidas > 24 h
|
||||
@@ -713,6 +737,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment to evaluate, or <c>null</c>.</param>
|
||||
/// <returns><c>true</c> if the treatment is not <c>null</c> and any requested medication exceeds its defined sedation threshold; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=5aa55d0 body=d2a9955 -->
|
||||
private static bool ExceedsSedationThreshold(PatientTreatment? treatment)
|
||||
{
|
||||
return (treatment != null &&
|
||||
@@ -729,6 +754,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment whose patient is used to look up the list of active treatments to evaluate.</param>
|
||||
/// <returns>A task that returns the list of active patient treatments that were not discontinued.</returns>
|
||||
/// <!-- aidoc:v1 sig=4f3a796 body=a702644 -->
|
||||
private async Task<List<PatientTreatment>> CheckExpiredPatientTreatments(PatientTreatment treatment)
|
||||
{
|
||||
//si el tratamiento ha expirado actualizamos el OrderControl a DC y devolvemos las que siguen activas
|
||||
@@ -757,6 +783,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// further validation.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment whose requested medicines will be checked against the patient's active medicines.</param>
|
||||
/// <!-- aidoc:v1 sig=e762e81 body=63b9252 -->
|
||||
private async Task CheckTreatmentMedicines(PatientTreatment treatment)
|
||||
{
|
||||
var newMedicines = (await Task.WhenAll(treatment.RequestedGiveCodes
|
||||
@@ -785,6 +812,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose medication categories are being evaluated and linked to the created observations.</param>
|
||||
/// <param name="uniqueMedicines">The distinct list of medicines to be checked against the predefined category reference lists.</param>
|
||||
/// <!-- aidoc:v1 sig=ef6fae4 body=be6580c -->
|
||||
private void CheckMedicationCategories(ObjectId patientId, List<Medicine> uniqueMedicines)
|
||||
{
|
||||
var medicationCategories = new Dictionary<string, List<string>?>
|
||||
@@ -821,6 +849,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="medications">The collection of medications whose names will be stored as the observation values.</param>
|
||||
/// <param name="patientId">The identifier of the patient the observation belongs to.</param>
|
||||
/// <param name="obsName">The name used to group and look up the previous observation for the same concept.</param>
|
||||
/// <!-- aidoc:v1 sig=c1a952c body=987bc59 -->
|
||||
private async Task CreateMedicationMultivalueObservation(IEnumerable<Medicine?> medications, ObjectId patientId,
|
||||
string obsName)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace adas_core.Application.Customizations.HUVH.UCIN;
|
||||
/// Represents a concrete implementation of the <see cref="ICalculatedObservations"/> interface,
|
||||
/// providing a collection of calculated observation data.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1b16cfc -->
|
||||
public class CalculatedObservations : ICalculatedObservations
|
||||
{
|
||||
private const string Spo2PreObservationName = "SpO2";
|
||||
@@ -61,6 +62,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient for whom the active bolus is calculated.</param>
|
||||
/// <exception cref="NotImplementedException">Thrown because the method has not been implemented yet.</exception>
|
||||
/// <!-- aidoc:v1 sig=7d38721 body=bfa6f2f -->
|
||||
public Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -73,6 +75,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation to be mapped, which may be transformed depending on its name.</param>
|
||||
/// <param name="onlyByName">Indicates whether the mapping should be performed using only the observation name.</param>
|
||||
/// <returns>The mapped patient observation, potentially enriched with computed values, wrapped in a task.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_param_role
|
||||
/// "The 'onlyByName' parameter is documented as controlling whether 'the mapping should be performed using only the observation name,' but the parameter is never referenced in the method body, so passing a value for it has no effect on the mapping behavior." -->
|
||||
public async Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation
|
||||
{
|
||||
if (obs.Name is "Intervention_In" or "Intervention_Out") await CalculateInterventionMultiValueObservation(obs);
|
||||
@@ -105,6 +109,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment to map, including its placer order, end time, and medicines.</param>
|
||||
/// <returns>The mapped <see cref="PatientTreatment"/> with its order control type and medicines updated.</returns>
|
||||
/// <!-- aidoc:v1 sig=442a6e8 body=e1bed22 -->
|
||||
public async Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
var order = treatment.PlacerOrder?.EntityIdentifier; //aquí almacenamos el número de orden
|
||||
@@ -129,6 +134,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The pump observation to map.</param>
|
||||
/// <returns>A completed <see cref="Task{TResult}"/> containing the provided <see cref="PumpObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=50be4c1 body=e481734 -->
|
||||
public async Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
return await Task.FromResult(pumpObservation);
|
||||
@@ -140,6 +146,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of active medicines from which distinct medication names are extracted to build the observation value.</param>
|
||||
/// <param name="patientId">The identifier of the patient for whom the medication observation is calculated and stored.</param>
|
||||
/// <!-- aidoc:v1 sig=299c0fe body=8145436 -->
|
||||
public async Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
var medicineObs = new PatientObservation
|
||||
@@ -171,6 +178,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="id">The unique <see cref="ObjectId"/> of the patient whose active treatments should be fetched.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an <see cref="IEnumerable{T}"/> of nullable <see cref="PatientTreatment"/> instances for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=1c9e799 body=2a62eb7 -->
|
||||
public async Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
var activeTreatments = await _treatmentService.Value.GetActiveTreatmentsByPatient(id);
|
||||
@@ -184,6 +192,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="diagnosis">The source <see cref="PatientDiagnosis"/> instance to be mapped.</param>
|
||||
/// <returns>A <see cref="Task{PatientDiagnosis}"/> that represents the asynchronous mapping operation, containing the mapped <see cref="PatientDiagnosis"/>.</returns>
|
||||
/// <exception cref="T:System.NotImplementedException">Thrown when the method is invoked, as the mapping logic has not yet been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=bfa6f2f -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -195,6 +204,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="newObservation">The new patient observation whose time may be adjusted to follow the most recent observation for the same patient and measurement.</param>
|
||||
/// <returns>The patient observation with a corrected time if a time conflict was detected, or the original observation if no adjustment was needed or the name was invalid.</returns>
|
||||
/// <!-- aidoc:v1 sig=2b42b30 body=04118be -->
|
||||
public async Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
if (string.IsNullOrEmpty(newObservation.Name))
|
||||
@@ -227,6 +237,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to pre-map.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the provided list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=5a37e9b body=0791af0 -->
|
||||
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
return Task.FromResult(listToInsert);
|
||||
@@ -238,6 +249,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation that the alarm is to be associated with.</param>
|
||||
/// <param name="alarmToInsert">The alarm intended to be inserted into the observation.</param>
|
||||
/// <returns>A task containing the patient observation, returned as-is.</returns>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=ea790e4 -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
return Task.FromResult(obs);
|
||||
@@ -250,6 +262,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="name">The name associated with the alarm.</param>
|
||||
/// <param name="code">The optional alarm code categorizing the type of alarm to be sent.</param>
|
||||
/// <exception cref="NotImplementedException">Thrown because the method has not been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=90426a4 body=bfa6f2f -->
|
||||
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -261,6 +274,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// Returns without creating a record when the observation is not a <see cref="PatientObservation"/> or when its name does not match any of the supported scales.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source patient observation used to derive the pain scale; only instances of <see cref="PatientObservation"/> with a supported name (ALPS, NPASS_Sedation, NPASS_Analgesia) are processed.</param>
|
||||
/// <!-- aidoc:v1 sig=f89cebc body=f5dfb0c -->
|
||||
private async Task CalculatePainScale(BasePatientObservation obs)
|
||||
{
|
||||
if (obs is not PatientObservation pobs) return;
|
||||
@@ -314,6 +328,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation to process.</param>
|
||||
/// <returns>The original <see cref="BasePatientObservation"/> if it is not a <see cref="PatientObservation"/>; otherwise, the <see cref="PatientObservation"/> with its value set to the locally formatted observation time.</returns>
|
||||
/// <!-- aidoc:v1 sig=479318b body=e536a62 -->
|
||||
private static BasePatientObservation CalculateLastDefecationValue(BasePatientObservation obs)
|
||||
{
|
||||
if (obs is not PatientObservation pobs) return obs;
|
||||
@@ -332,6 +347,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// Calculates and persists a multi-value observation by appending the current value to the existing list of values for the corresponding "Multivalue" observation. Expirates the previous multi-value observation before inserting the new one.
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation used to derive the multi-value observation; it must be a <see cref="PatientObservation"/> with a non-empty name and a string value.</param>
|
||||
/// <!-- aidoc:v1 sig=d821a40 body=264c069 -->
|
||||
private async Task CalculateMultiValueObservation(BasePatientObservation obs)
|
||||
{
|
||||
//El valor de la observación es un array de strings
|
||||
@@ -388,6 +404,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// Calculates and persists a multi-value observation that aggregates the active intervention groups (e.g., devices, routes) for a patient based on incoming "<c>_In</c>" and "<c>_Out</c>" observations. Handles the insertion of new groups (with special duplicate prevention for respiratory devices) and the removal of groups when a corresponding "Out" event is received, expiring the previous multi-value observation and inserting a new one when the resulting set is not empty.
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation that triggered the calculation; expected to be a <see cref="PatientObservation"/> with a non-empty name and a string value representing the intervention group.</param>
|
||||
/// <!-- aidoc:v1 sig=25ac55d body=191bd88 -->
|
||||
private async Task CalculateInterventionMultiValueObservation(BasePatientObservation obs)
|
||||
{
|
||||
if (obs is not PatientObservation pobs || string.IsNullOrEmpty(obs.Name) ||
|
||||
@@ -478,6 +495,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="valueObs">Observation text from which the leading token is taken as the candidate intervention code.</param>
|
||||
/// <param name="r">When the method returns true, contains the resolved intervention's type, name, and group; otherwise null.</param>
|
||||
/// <returns><c>true</c> if a matching intervention was found; <c>false</c> if the code is not numeric or the lookup yields no result.</returns>
|
||||
/// <!-- aidoc:v1 sig=d3884cf body=1ea9ac7 -->
|
||||
private bool GetInterventionValue(string valueObs, out (string type, string Name, string Group)? r)
|
||||
{
|
||||
var code = valueObs.Split(" ")[0]; //
|
||||
@@ -506,6 +524,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// Calcula la complejidad del paciente en función de las observaciones registradas.
|
||||
/// </summary>
|
||||
/// <param name="obs">Observación del paciente que se va a evaluar para recalcular su complejidad.</param>
|
||||
/// <!-- aidoc:v1 sig=4545d3a body=a6e9e71 -->
|
||||
private async Task CalculateComplexity(BasePatientObservation obs)
|
||||
{
|
||||
var pobs = obs as PatientObservation;
|
||||
@@ -575,6 +594,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="observationName">The name of the multivalue observation to look up and calculate complexity for.</param>
|
||||
/// <param name="observation">An optional pre-loaded observation that overrides the database lookup when supplied.</param>
|
||||
/// <returns>The aggregated complexity value for the observation, or 0 if no observation or values are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=cdba6ba body=3c7e7fd -->
|
||||
private async Task<int> CalculateMultivalueObservationComplexityValue(ObjectId patientId, string observationName,
|
||||
PatientObservation? observation = null)
|
||||
{
|
||||
@@ -602,6 +622,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// <param name="patientId">The identifier of the patient whose newborn weight complexity is being calculated.</param>
|
||||
/// <param name="pobs">An optional patient observation to use instead of the latest stored one; if provided with "kg" units, its value is converted.</param>
|
||||
/// <returns>The calculated newborn weight complexity value, or 0 when no valid value is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=85b6f46 body=c89d98c -->
|
||||
private async Task<int> CalculateWeightNewBornValue(ObjectId patientId, PatientObservation? pobs = null)
|
||||
{
|
||||
var result =
|
||||
@@ -644,6 +665,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation containing the weight value to parse and convert.</param>
|
||||
/// <returns>The patient observation with the value converted to grams, or the original observation if the value could not be parsed.</returns>
|
||||
/// <!-- aidoc:v1 sig=2d84953 body=d947a19 -->
|
||||
private PatientObservation ParseWeight(PatientObservation obs)
|
||||
{
|
||||
if (!double.TryParse(obs.Value.ToString(), out var dValue))
|
||||
@@ -664,6 +686,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="obs">The incoming patient observation (either a pre or post SpO2 measurement) used to drive the calculation and identify the counterpart observation.</param>
|
||||
/// <returns>A task that represents the asynchronous insert of the derived observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=7f9be58 body=e3f6858 -->
|
||||
private async Task CalculateSaturation_DiffObservation(BasePatientObservation obs)
|
||||
{
|
||||
var toSearchList = new List<string>();
|
||||
@@ -726,6 +749,8 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment being evaluated, used to locate the existing record by its placer order entity identifier and to persist the updated state.</param>
|
||||
/// <returns>A task that yields the list of active patient treatments for the patient that are not the same placer order as the supplied treatment.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
|
||||
/// "Summary claims to 'check for expired patient treatments' but the code calls GetActiveTreatmentsByPatient (active, not expired) and sets DC when t.EndTime > DateTime.UtcNow (future, not past), making the word 'expired' contradictory to the documented condition 'end time is in the future'." -->
|
||||
private async Task<List<PatientTreatment>> CheckExpiredPatientTreatments(PatientTreatment treatment)
|
||||
{
|
||||
//si el tratamiento ha expirado actualizamos el OrderControl a DC y devolvemos las que siguen activas
|
||||
@@ -763,6 +788,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// medicines remain after filtering.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment whose requested give codes are inspected for medicines, nutrition items, and vasoactive drugs.</param>
|
||||
/// <!-- aidoc:v1 sig=e762e81 body=6f65d8e -->
|
||||
private async Task CheckTreatmentMedicines(PatientTreatment treatment)
|
||||
{
|
||||
var newMedicines = new List<Medicine>();
|
||||
@@ -825,6 +851,7 @@ public class CalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="value">The feeding type value to record; if it contains "parenteral" (case-insensitive), the observation is stored as a parenteral entry.</param>
|
||||
/// <param name="patientId">The identifier of the patient to whom the observation belongs.</param>
|
||||
/// <!-- aidoc:v1 sig=7b17fa3 body=af49d06 -->
|
||||
private async Task CreateNutritionObservation(string value, ObjectId patientId)
|
||||
{
|
||||
var nutritionObs = new PatientObservation
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace adas_core.Application.Customizations.NursePlan;
|
||||
/// <summary>
|
||||
/// Provides calculated observations by leveraging services obtained from the injected service provider.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c3598e8 -->
|
||||
public class CalculatedObservations(IServiceProvider serviceProvider) : ICalculatedObservations
|
||||
{
|
||||
private readonly Lazy<IObservationService> _observationService =
|
||||
@@ -20,6 +21,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active bolus is to be calculated.</param>
|
||||
/// <exception cref="System.NotImplementedException">Thrown when the method is invoked, as the calculation logic has not yet been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=7d38721 body=bfa6f2f -->
|
||||
public Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -30,6 +32,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The PumpObservation to be mapped.</param>
|
||||
/// <returns>A task containing the mapped PumpObservation.</returns>
|
||||
/// <!-- aidoc:v1 sig=50be4c1 body=e481734 -->
|
||||
public async Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
return await Task.FromResult(pumpObservation);
|
||||
@@ -42,6 +45,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="activeMedicines">The collection of medicines currently active for the patient.</param>
|
||||
/// <param name="patientId">The identifier of the patient whose medicine observation is being calculated.</param>
|
||||
/// <exception cref="NotImplementedException">The method is not yet implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=b7a50a4 body=bfa6f2f -->
|
||||
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -53,6 +57,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="newObservation">The new patient observation whose timestamps may need to be reconciled with the last recorded observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the fixed <see cref="PatientObservation"/>, or <c>null</c> when no time inconsistency is detected.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown because the method has not been implemented yet.</exception>
|
||||
/// <!-- aidoc:v1 sig=cb71754 body=bfa6f2f -->
|
||||
public Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -64,6 +69,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments are being queried.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a collection of active PatientTreatment entries, which may include null values, for the specified patient.</returns>
|
||||
/// <exception cref="NotImplementedException">The method has not yet been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=db74f82 body=bfa6f2f -->
|
||||
public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -75,6 +81,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="obs">The patient observation to return.</param>
|
||||
/// <param name="onlyByName">Reserved flag that is not used in the current implementation.</param>
|
||||
/// <returns>A completed task containing the provided observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=21d06c4 body=9f66f26 -->
|
||||
public Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation
|
||||
{
|
||||
return Task.FromResult(obs)!;
|
||||
@@ -85,6 +92,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment to map.</param>
|
||||
/// <returns>A task containing the mapped patient treatment.</returns>
|
||||
/// <!-- aidoc:v1 sig=adce250 body=cf46cd2 -->
|
||||
public Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
return Task.FromResult(treatment);
|
||||
@@ -95,6 +103,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis to be returned as a completed task result.</param>
|
||||
/// <returns>A completed <see cref="Task{PatientDiagnosis}"/> containing the provided diagnosis.</returns>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=ad326e6 -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
return Task.FromResult(diagnosis);
|
||||
@@ -107,6 +116,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="obs">The patient observation to return.</param>
|
||||
/// <param name="alarmToInsert">The patient observation alarm; not used in the current implementation.</param>
|
||||
/// <returns>A completed task containing the original <paramref name="obs"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=ea790e4 -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
return Task.FromResult(obs);
|
||||
@@ -118,6 +128,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// <param name="obs">The patient observation that triggers the alarm.</param>
|
||||
/// <param name="name">The name associated with the alarm.</param>
|
||||
/// <param name="code">The optional alarm code identifying the alarm type.</param>
|
||||
/// <!-- aidoc:v1 sig=90426a4 body=6805ef5 -->
|
||||
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -128,6 +139,7 @@ public class CalculatedObservations(IServiceProvider serviceProvider) : ICalcula
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be pre-mapped.</param>
|
||||
/// <returns>A completed <see cref="Task{TResult}"/> containing the original list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=5a37e9b body=0791af0 -->
|
||||
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
return Task.FromResult(listToInsert);
|
||||
|
||||
@@ -4,4 +4,5 @@
|
||||
/// Represents errors that occur during API request processing, wrapping a descriptive message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
/// <!-- aidoc:v1 sig=fff099b -->
|
||||
public class ApiRequestException(string message) : Exception($"Api request exception: {message}");
|
||||
@@ -6,12 +6,14 @@ namespace adas_core.Application.Exceptions;
|
||||
/// Represents an exception that is thrown when a bad or invalid request is received.
|
||||
/// It serves as a specialized error type derived from the base <see cref="Exception"/> class for signaling client-side request failures.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=aec5b9f -->
|
||||
public class BadRequestException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BadRequestException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message defined in <see cref="HttpEnum.ErrorMessage"/> that describes the reason for the exception.</param>
|
||||
/// <!-- aidoc:v1 sig=2324fae body=4448e1d -->
|
||||
public BadRequestException(HttpEnum.ErrorMessage message) : base(((int)message).ToString())
|
||||
{
|
||||
}
|
||||
@@ -20,6 +22,7 @@ public class BadRequestException : Exception
|
||||
/// Initializes a new instance of the <see cref="BadRequestException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message that describes the reason for the exception.</param>
|
||||
/// <!-- aidoc:v1 sig=3d6c688 body=4448e1d -->
|
||||
public BadRequestException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -5,12 +5,14 @@ namespace adas_core.Application.Exceptions;
|
||||
/// <summary>
|
||||
/// Represents an exception that is thrown when a conflict is encountered, such as a resource state mismatch or a duplicate entry.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5cdb505 -->
|
||||
public class ConflictException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ConflictException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message that describes the conflict.</param>
|
||||
/// <!-- aidoc:v1 sig=d19960d body=4448e1d -->
|
||||
public ConflictException(HttpEnum.ErrorMessage message) : base(((int)message).ToString())
|
||||
{
|
||||
}
|
||||
@@ -19,6 +21,7 @@ public class ConflictException : Exception
|
||||
/// Initializes a new instance of the <see cref="ConflictException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
/// <!-- aidoc:v1 sig=6025bd5 body=4448e1d -->
|
||||
public ConflictException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ namespace adas_core.Application.Exceptions;
|
||||
/// <remarks>
|
||||
/// This exception extends the base <see cref="Exception"/> class to provide a domain-specific error type for argument validation failures.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=434a4a5 -->
|
||||
public class CustomArgumentException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomArgumentException"/> class with the specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message from the <see cref="HttpEnum.ErrorMessage"/> enumeration.</param>
|
||||
/// <!-- aidoc:v1 sig=9c6bb9a body=4448e1d -->
|
||||
public CustomArgumentException(HttpEnum.ErrorMessage message) : base(((int)message).ToString())
|
||||
{
|
||||
}
|
||||
@@ -22,6 +24,7 @@ public class CustomArgumentException : Exception
|
||||
/// Initializes a new instance of the <see cref="CustomArgumentException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message that describes the reason for the exception.</param>
|
||||
/// <!-- aidoc:v1 sig=cee336d body=4448e1d -->
|
||||
public CustomArgumentException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ namespace adas_core.Application.Exceptions;
|
||||
/// <remarks>
|
||||
/// This exception is intended to signal that a requested action violates access rules or restrictions, allowing callers to handle forbidden scenarios distinctly from other error conditions.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=2024892 -->
|
||||
public class ForbbidenException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ForbbidenException"/> class with a specified error message from the <see cref="HttpEnum.ErrorMessage"/> enumeration.
|
||||
/// </summary>
|
||||
/// <param name="message">The <see cref="HttpEnum.ErrorMessage"/> enumeration value whose integer representation is used as the exception message.</param>
|
||||
/// <!-- aidoc:v1 sig=75787d6 body=4448e1d -->
|
||||
public ForbbidenException(HttpEnum.ErrorMessage message) : base(((int)message).ToString())
|
||||
{
|
||||
}
|
||||
@@ -22,6 +24,7 @@ public class ForbbidenException : Exception
|
||||
/// Initializes a new instance of the <see cref="ForbbidenException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
/// <!-- aidoc:v1 sig=545f359 body=4448e1d -->
|
||||
public ForbbidenException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -5,12 +5,15 @@ namespace adas_core.Application.Exceptions;
|
||||
/// <summary>
|
||||
/// Represents the exception that is thrown when data is encountered in a format that is not valid or expected.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e46b8ff -->
|
||||
public class InvalidFormatException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InvalidFormatException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message that describes the reason for the exception.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_param_role
|
||||
/// "The parameter is of type HttpEnum.ErrorMessage (an enum), not an error message string. It is documented as 'The error message that describes the reason for the exception', which mischaracterizes its role." -->
|
||||
public InvalidFormatException(HttpEnum.ErrorMessage message) : base(((int)message).ToString())
|
||||
{
|
||||
}
|
||||
@@ -19,6 +22,7 @@ public class InvalidFormatException : Exception
|
||||
/// Initializes a new instance of the <see cref="InvalidFormatException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message that describes the reason for the exception.</param>
|
||||
/// <!-- aidoc:v1 sig=8a27f52 body=4448e1d -->
|
||||
public InvalidFormatException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ namespace adas_core.Application.Exceptions;
|
||||
/// <summary>
|
||||
/// Represents an exception that is thrown when a requested resource or item cannot be found.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f498fe7 -->
|
||||
public class NotFoundException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NotFoundException"/> class.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b8adfe9 body=4448e1d -->
|
||||
public NotFoundException()
|
||||
{
|
||||
}
|
||||
@@ -18,6 +20,7 @@ public class NotFoundException : Exception
|
||||
/// Initializes a new instance of the <see cref="NotFoundException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
/// <!-- aidoc:v1 sig=0fdd1b4 body=4448e1d -->
|
||||
public NotFoundException(HttpEnum.ErrorMessage message) : base(((int)message).ToString())
|
||||
{
|
||||
}
|
||||
@@ -26,6 +29,7 @@ public class NotFoundException : Exception
|
||||
/// Initializes a new instance of the <see cref="NotFoundException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
/// <!-- aidoc:v1 sig=63e1946 body=4448e1d -->
|
||||
public NotFoundException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -4,4 +4,5 @@
|
||||
/// Represents an exception that is thrown when a token-related error occurs.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
/// <!-- aidoc:v1 sig=d6b0f80 -->
|
||||
public class TokenException(string message) : Exception(message);
|
||||
@@ -5,12 +5,14 @@ namespace adas_core.Application.Exceptions;
|
||||
/// <summary>
|
||||
/// Exception thrown when a user lacks authorization to perform an operation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c33e8e4 -->
|
||||
public class UnauthorizedException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnauthorizedException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message associated with the exception.</param>
|
||||
/// <!-- aidoc:v1 sig=0488051 body=4448e1d -->
|
||||
public UnauthorizedException(HttpEnum.ErrorMessage message) : base(((int)message).ToString())
|
||||
{
|
||||
}
|
||||
@@ -19,6 +21,7 @@ public class UnauthorizedException : Exception
|
||||
/// Initializes a new instance of the <see cref="UnauthorizedException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
/// <!-- aidoc:v1 sig=f0581f2 body=4448e1d -->
|
||||
public UnauthorizedException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ namespace adas_core.Application.Exceptions;
|
||||
/// <remarks>
|
||||
/// This exception is typically used to signal that a request or entity was understood but could not be processed, similar to the semantics of an HTTP 422 (Unprocessable Entity) response.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=70bdc1a -->
|
||||
public class UnprocessableEntityException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnprocessableEntityException"/> class with a specified error message enum.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message enum containing the error code.</param>
|
||||
/// <!-- aidoc:v1 sig=c2da948 body=4448e1d -->
|
||||
public UnprocessableEntityException(HttpEnum.ErrorMessage message) : base(((int)message).ToString())
|
||||
{
|
||||
}
|
||||
@@ -22,6 +24,7 @@ public class UnprocessableEntityException : Exception
|
||||
/// Initializes a new instance of the <see cref="UnprocessableEntityException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
/// <!-- aidoc:v1 sig=cc0f943 body=4448e1d -->
|
||||
public UnprocessableEntityException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class AdasProvider(IOptions<ProvidersSettings> providerSettings, IHttpCli
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient for whom observations are being calculated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, returning a list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=ab999e4 body=ac14195 -->
|
||||
public override async Task<List<PatientObservation>> GetObservations(Patient patient)
|
||||
{
|
||||
var calculatedObservations = new List<PatientObservation>();
|
||||
@@ -88,6 +89,7 @@ public class AdasProvider(IOptions<ProvidersSettings> providerSettings, IHttpCli
|
||||
/// </summary>
|
||||
/// <param name="medicationPredict">The list of ADAS medication prediction results to be serialized. Only the first five entries are included.</param>
|
||||
/// <returns>A string containing the selected medication prediction entries joined by the "^" delimiter.</returns>
|
||||
/// <!-- aidoc:v1 sig=4474eb5 body=ea7295b -->
|
||||
private static string ParseAdasMedicationsToMedicationObservation(
|
||||
List<ResultModelPredictMedicationAdas> medicationPredict)
|
||||
{
|
||||
@@ -100,6 +102,7 @@ public class AdasProvider(IOptions<ProvidersSettings> providerSettings, IHttpCli
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique identifier of the patient whose ADAS stay prediction is being requested.</param>
|
||||
/// <returns>A task containing the deserialized <see cref="ResultModelPredictOfStayAdas"/> result on success, or null if the patient number is null, the response is unsuccessful, or the call throws.</returns>
|
||||
/// <!-- aidoc:v1 sig=7c8fb5e body=5aa481c -->
|
||||
private async Task<ResultModelPredictOfStayAdas?> GetPredictOfStay(string? patientNumber)
|
||||
{
|
||||
if (patientNumber == null)
|
||||
@@ -140,6 +143,7 @@ public class AdasProvider(IOptions<ProvidersSettings> providerSettings, IHttpCli
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique identifier of the patient whose ADAS medication predictions are being retrieved.</param>
|
||||
/// <returns>A task containing a list of <see cref="ResultModelPredictMedicationAdas"/> with the predicted medication data, or null if the request fails or the patient number is null.</returns>
|
||||
/// <!-- aidoc:v1 sig=1381cb8 body=f17df11 -->
|
||||
private async Task<List<ResultModelPredictMedicationAdas>?> GetPredictMedications(string? patientNumber)
|
||||
{
|
||||
if (patientNumber == null)
|
||||
@@ -176,6 +180,7 @@ public class AdasProvider(IOptions<ProvidersSettings> providerSettings, IHttpCli
|
||||
/// Creates a new <see cref="HttpClient"/> instance and configures it with the configured base address URL.
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="HttpClient"/> with its <see cref="HttpClient.BaseAddress"/> set to the configured <c>Url</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=12d10b8 body=3c7c671 -->
|
||||
private HttpClient GetClient()
|
||||
{
|
||||
var client = HttpClientFactory.CreateClient();
|
||||
|
||||
@@ -21,5 +21,6 @@ public abstract class BaseProvider(
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose observations are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservation"/> entries for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=a880577 -->
|
||||
public abstract Task<List<PatientObservation>> GetObservations(Patient patient);
|
||||
}
|
||||
@@ -12,12 +12,14 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// Deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=0112d17 -->
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified admission record asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity containing the updated information.</param>
|
||||
/// <!-- aidoc:v1 sig=1180a0b -->
|
||||
Task Update(Admission admission);
|
||||
|
||||
/// <summary>
|
||||
@@ -25,6 +27,7 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity whose location is to be updated.</param>
|
||||
/// <param name="newLocation">The identifier of the new location to assign to the entity.</param>
|
||||
/// <!-- aidoc:v1 sig=a4e527f -->
|
||||
Task UpdateLocation(ObjectId id, ObjectId newLocation);
|
||||
|
||||
/// <summary>
|
||||
@@ -32,12 +35,14 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient to update.</param>
|
||||
/// <param name="patient">The patient object containing the updated information to apply.</param>
|
||||
/// <!-- aidoc:v1 sig=afe7c06 -->
|
||||
Task UpdatePatient(ObjectId id, Person patient);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all admission records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{Admission}"/> with all available admissions.</returns>
|
||||
/// <!-- aidoc:v1 sig=7eecf14 -->
|
||||
Task<IEnumerable<Admission>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
@@ -45,6 +50,7 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the <see cref="Admission"/> to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Admission"/>, or <c>null</c> if no admission exists with the specified identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=1fe8488 -->
|
||||
Task<Admission?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -52,6 +58,7 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// </summary>
|
||||
/// <param name="nhc">The NHC (clinical history number) used to look up the admission.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Admission"/>, or <c>null</c> if no admission is found for the given NHC.</returns>
|
||||
/// <!-- aidoc:v1 sig=c8b26b9 -->
|
||||
Task<Admission?> FindByNhc(string nhc);
|
||||
|
||||
//Task<IEnumerable<Admission>?> FindByUnit(string unit);
|
||||
@@ -61,6 +68,7 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter and find the relevant admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of admissions matching the given location.</returns>
|
||||
/// <!-- aidoc:v1 sig=c1ce2c3 -->
|
||||
Task<List<Admission>> FindByLocation(PatientLocation location);
|
||||
|
||||
/// <summary>
|
||||
@@ -68,12 +76,14 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// </summary>
|
||||
/// <param name="origin">The origin value used to filter the admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of matching admissions, or <c>null</c> if no admissions are found for the given origin.</returns>
|
||||
/// <!-- aidoc:v1 sig=ed6ddde -->
|
||||
Task<IEnumerable<Admission>?> FindByOrigin(string origin);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="Admission"/> record into the data store and returns the resulting entity.
|
||||
/// </summary>
|
||||
/// <param name="origin">The <see cref="Admission"/> entity to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="Admission"/>, or <c>null</c> if no result is returned.</returns>
|
||||
/// <!-- aidoc:v1 sig=2b0177a -->
|
||||
Task<Admission?> InsertOneAsyncAndReturn(Admission origin);
|
||||
/// <summary>
|
||||
/// Searches for an admission matching the specified patient number and unit, returning a distinct result.
|
||||
@@ -81,30 +91,35 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// <param name="patientNumber">The patient's identifier used to locate the admission.</param>
|
||||
/// <param name="unitId">The unique identifier of the unit to filter the search.</param>
|
||||
/// <returns>A <see cref="Admission"/> if a matching record is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=fb125ed -->
|
||||
Task<Admission?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of admissions associated with the specified unit, excluding Point of Care (PoC) entries.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose admissions are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Admission"/> records linked to the given unit, with PoC entries excluded.</returns>
|
||||
/// <!-- aidoc:v1 sig=609220d -->
|
||||
Task<List<Admission>> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves a list of admissions associated with the specified point of care identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The unique identifier of the point of care used to filter the admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of admissions matching the specified point of care identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=3e416fe -->
|
||||
Task<List<Admission>> FindByPointOfCareId(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of admissions associated with the specified unit identifiers.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The list of unit identifiers used to look up the corresponding admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of admissions matching the provided unit identifiers.</returns>
|
||||
/// <!-- aidoc:v1 sig=050b604 -->
|
||||
Task<List<Admission>> FindByUnitIds(List<ObjectId> unitIds);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit used to filter the records.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the count of matching records.</returns>
|
||||
/// <!-- aidoc:v1 sig=e0dfc62 -->
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
@@ -114,6 +129,7 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// <param name="opt">The data transfer object containing the new master list option values to apply.</param>
|
||||
/// <param name="typeName">The name of the option type to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of admissions affected by the update.</returns>
|
||||
/// <!-- aidoc:v1 sig=fc94c14 -->
|
||||
Task<IEnumerable<Admission>> UpdateMasterListOption(List<ObjectId> unitIds, UpdateOptionMasterListDto opt,
|
||||
string typeName);
|
||||
|
||||
@@ -124,11 +140,13 @@ public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
/// <param name="opt">The option to be removed from the master list.</param>
|
||||
/// <param name="typeName">The name of the type associated with the master list option.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of <see cref="Admission"/> records affected by the deletion.</returns>
|
||||
/// <!-- aidoc:v1 sig=248078c -->
|
||||
Task<IEnumerable<Admission>> DeleteMasterListOption(List<ObjectId> unitIds, OptionList opt, string typeName);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes admissions associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose admissions will be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a value indicating the result of the deletion.</returns>
|
||||
/// <!-- aidoc:v1 sig=cb6488e -->
|
||||
Task<bool> DeleteAdmissionsByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public interface IAlarmRepository : IMongoRepository<PatientObservationAlarm>
|
||||
/// <param name="patientId">The unique identifier of the patient whose last observations should be aggregated.</param>
|
||||
/// <param name="filterObservations">An optional list of fields used to restrict which observation types are included in the aggregation; when null, all available observations are considered.</param>
|
||||
/// <returns>A task that resolves to the list of aggregated <see cref="PatientObservationAlarm"/> entries representing the patient's latest observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=b862090 -->
|
||||
Task<List<PatientObservationAlarm>> AggregatedPatientLastObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations = null);
|
||||
|
||||
@@ -23,6 +24,7 @@ public interface IAlarmRepository : IMongoRepository<PatientObservationAlarm>
|
||||
/// <param name="filterObservations">An optional list of fields used to restrict which observations are considered. If null, no field-based filtering is applied.</param>
|
||||
/// <param name="configAlarm">The list of configuration observation definitions used to build and aggregate the resulting alarms.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of aggregated <see cref="PatientObservationAlarm"/> entries for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=e1ec5ad -->
|
||||
Task<List<PatientObservationAlarm>> AggregatedPatientNotExpiredObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations, List<ConfigObservation> configAlarm);
|
||||
}
|
||||
@@ -8,16 +8,19 @@ public interface IAppointmentArchiveRepository
|
||||
/// Asynchronously inserts a single patient appointment into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientAppointment">The patient appointment entity to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=1116668 -->
|
||||
Task InsertOneAsync(PatientAppointment patientAppointment);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records that have a date earlier than the specified cutoff date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; records dated before this value will be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=350661d -->
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Inserts a batch of patient appointments asynchronously, typically as part of a bulk import or synchronization process.
|
||||
/// </summary>
|
||||
/// <param name="appointment">The collection of patient appointments to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing a long value that represents the result of the batch insertion.</returns>
|
||||
/// <!-- aidoc:v1 sig=5df04bf -->
|
||||
Task<long> InsertBatch(IEnumerable<PatientAppointment> appointment);
|
||||
}
|
||||
@@ -12,17 +12,20 @@ public interface IAppointmentRepository : IMongoRepository<PatientAppointment>
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointments are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> objects for the specified patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=44280ba -->
|
||||
Task<List<PatientAppointment>> GetByPatient(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single patient appointment record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="appointment">The patient appointment entity to be inserted.</param>
|
||||
/// <!-- aidoc:v1 sig=43c09a3 -->
|
||||
new Task InsertOneAsync(PatientAppointment appointment);
|
||||
/// <summary>
|
||||
/// Updates an existing patient appointment asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="appointment">The patient appointment containing the updated information.</param>
|
||||
/// <!-- aidoc:v1 sig=75991de -->
|
||||
Task Update(PatientAppointment appointment);
|
||||
/// <summary>
|
||||
/// Updates the <see cref="ObjectId"/> field identified by <paramref name="nameId"/> across many records, replacing the existing value <paramref name="oldId"/> with the new value <paramref name="id"/>.
|
||||
@@ -30,22 +33,26 @@ public interface IAppointmentRepository : IMongoRepository<PatientAppointment>
|
||||
/// <param name="nameId">The name of the field that contains the <see cref="ObjectId"/> to update.</param>
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to assign to matching records.</param>
|
||||
/// <param name="oldId">The current <see cref="ObjectId"/> value to be replaced.</param>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The ObjectId of the entity to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=9f8dfa3 -->
|
||||
new Task DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a cursor of <see cref="PatientAppointment"/> records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique <see cref="ObjectId"/> of the patient whose appointments are being queried.</param>
|
||||
/// <returns>A <see cref="Task{IAsyncCursor{PatientAppointment}}"/> that yields the matching patient appointments; the cursor may be empty if no appointments are found for the given patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=2d5cd9f -->
|
||||
Task<IAsyncCursor<PatientAppointment>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique ObjectId of the patient whose related records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=1e79565 -->
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="PatientAppointment"/> matching the specified patient identifier and visit number.
|
||||
@@ -53,6 +60,7 @@ public interface IAppointmentRepository : IMongoRepository<PatientAppointment>
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointment should be located.</param>
|
||||
/// <param name="visitNumber">The visit number used to identify the specific appointment for the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="PatientAppointment"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=60947c5 -->
|
||||
Task<PatientAppointment?> FindByPatientAndVisitNumber(ObjectId patientId, string visitNumber);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient appointment matching the specified patient identifier and appointment reason.
|
||||
@@ -61,17 +69,20 @@ public interface IAppointmentRepository : IMongoRepository<PatientAppointment>
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointment should be located.</param>
|
||||
/// <param name="appointmentReason">The appointment reason used to filter the lookup, or <c>null</c> to match any reason.</param>
|
||||
/// <returns>A <see cref="Task{PatientAppointment}"/> that resolves to the matching <see cref="PatientAppointment"/>, or <c>null</c> if none exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=e3683e7 -->
|
||||
Task<PatientAppointment?> FindByPatientAndReason(ObjectId patientId, string? appointmentReason);
|
||||
/// <summary>
|
||||
/// Retrieves a list of patient appointments associated with the specified location.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter and retrieve matching appointments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> entries for the given location.</returns>
|
||||
/// <!-- aidoc:v1 sig=8d1c435 -->
|
||||
Task<List<PatientAppointment>> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of patient appointments associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care used to filter the patient appointments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of patient appointments for the given point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=2cf49d9 -->
|
||||
Task<List<PatientAppointment>> FindByPoC(PointOfCare poc);
|
||||
}
|
||||
@@ -10,23 +10,27 @@ public interface IArchivePatientCarePlanRepository : IMongoRepository<PatientCar
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose care plans should be retrieved.</param>
|
||||
/// <returns>A task that returns a list of <see cref="PatientCarePlan"/> objects for the given patient, or <c>null</c> when no care plans are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=5c4d553 -->
|
||||
Task<List<PatientCarePlan>?> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of patient care plans associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose care plans are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="PatientCarePlan"/> for the given patient, or <c>null</c> if no care plans are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6cb79cd -->
|
||||
Task<List<PatientCarePlan>?> FindByPatientId(string patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of care plans associated with the specified patient number, returning <c>null</c> when no matching care plans are found.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The patient number used to look up the associated care plans.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> entries for the patient, or <c>null</c> if none exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=e73ac89 -->
|
||||
Task<List<PatientCarePlan>?> FindByPatientNumber(string patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient care plans from the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="PatientCarePlan"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=83af170 -->
|
||||
Task<List<PatientCarePlan>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
@@ -36,6 +40,7 @@ public interface IArchivePatientCarePlanRepository : IMongoRepository<PatientCar
|
||||
/// <param name="oldPatientPatientId">An optional legacy patient ID string used as an additional lookup criterion.</param>
|
||||
/// <param name="oldPatientPatientNumber">An optional legacy patient number string used as an additional lookup criterion.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing a nullable list of <see cref="PatientCarePlan"/> records, or <c>null</c> if no matching care plans are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=d0b7192 -->
|
||||
Task<List<PatientCarePlan>?> FindByIds(ObjectId oldPatientId, string? oldPatientPatientId,
|
||||
string? oldPatientPatientNumber);
|
||||
|
||||
@@ -43,5 +48,6 @@ public interface IArchivePatientCarePlanRepository : IMongoRepository<PatientCar
|
||||
/// Asynchronously inserts a collection of patient care plans into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientCarePla">The list of <see cref="PatientCarePlan"/> records to be inserted.</param>
|
||||
/// <!-- aidoc:v1 sig=fea7cc8 -->
|
||||
Task InsertManyAsync(List<PatientCarePlan> patientCarePla);
|
||||
}
|
||||
@@ -10,46 +10,54 @@ public interface IAuthorityRepository : IMongoRepository<Authorization>
|
||||
/// </summary>
|
||||
/// <param name="authId">The unique identifier of the authorization to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Authorization"/> that matches the specified identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=65df479 -->
|
||||
public Task<Authorization> GetById(ObjectId authId);
|
||||
/// <summary>
|
||||
/// Creates a new authority assignment for the specified user with the given role name.
|
||||
/// </summary>
|
||||
/// <param name="roleName">The name of the role to assign as the new authority.</param>
|
||||
/// <param name="userId">The identifier of the user to whom the authority will be assigned.</param>
|
||||
/// <!-- aidoc:v1 sig=45c3591 -->
|
||||
void CreateNewAuthority(string roleName, ObjectId userId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of authorizations (authorities/permissions) associated with the specified user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The unique identifier of the user whose authorities are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the list of <see cref="Authorization"/> entries assigned to the user.</returns>
|
||||
/// <!-- aidoc:v1 sig=1476a1a -->
|
||||
public Task<List<Authorization>> GetUserAuthorities(ObjectId userId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available authorizations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="Authorization"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=dd351e0 -->
|
||||
public Task<List<Authorization>> GetAllAuthorities();
|
||||
/// <summary>
|
||||
/// Asynchronously deletes all authorities associated with the specified user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The unique identifier of the user whose authorities will be removed.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if authorities were deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=f6a59e6 -->
|
||||
public Task<bool> DeleteAllAuthoritiesByUser(ObjectId userId);
|
||||
/// <summary>
|
||||
/// Deletes all authorities associated with the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose authorities should be removed.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the authorities were successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=1f7fa45 -->
|
||||
Task<bool> DeleteAllAuthoritiesByUnit(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Deletes all authorities associated with the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayId">The identifier of the display whose related authorities should be removed.</param>
|
||||
/// <returns>A task that resolves to a boolean indicating the outcome of the deletion operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=f1cb547 -->
|
||||
Task<bool> DeleteAllAuthoritiesByDisplay(ObjectId displayId);
|
||||
/// <summary>
|
||||
/// Retrieves a list of authorizations associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose authorizations are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Authorization"/> objects matching the provided unit identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=82be9e3 -->
|
||||
Task<List<Authorization>> GetByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -12,30 +12,35 @@ public interface ICameraRepository : IMongoRepository<Camera>
|
||||
/// </summary>
|
||||
/// <param name="cameraId">The unique identifier of the camera to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Camera"/>, or <c>null</c> if no camera is found with the specified identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=fbf139f -->
|
||||
Task<Camera?> GetById(ObjectId cameraId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a camera by its name, returning <c>null</c> if no matching camera is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the camera to look up.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the matching <see cref="Camera"/>, or <c>null</c> if no camera with the specified name exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=6a4834c -->
|
||||
Task<Camera?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves the list of <see cref="Camera"/> objects associated with the specified configuration relays.
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The list of <see cref="ObjectId"/> values identifying the configuration relays whose cameras should be returned.</param>
|
||||
/// <returns>A <see cref="List{Camera}"/> containing the cameras linked to the provided configuration relays; returns an empty list when no matching cameras are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4523ee6 -->
|
||||
List<Camera> GetCameraInList(List<ObjectId> configurationRelayList);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent queryable collection of cameras based on the supplied pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing the page number and page size used to page the camera results.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Camera, Camera}"/> representing the paged query of cameras.</returns>
|
||||
/// <!-- aidoc:v1 sig=f9540cc -->
|
||||
IFindFluent<Camera, Camera> GetPaginatedCameras(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Inserts a new camera record into the data store and returns the persisted entity, or <c>null</c> if the camera could not be inserted.
|
||||
/// </summary>
|
||||
/// <param name="camera">The <see cref="Camera"/> instance containing the data to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the inserted <see cref="Camera"/>, or <c>null</c> when the insertion is not performed.</returns>
|
||||
/// <!-- aidoc:v1 sig=1baa756 -->
|
||||
Task<Camera?> InsertOneCamera(Camera camera);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing camera identified by the specified object identifier.
|
||||
@@ -43,11 +48,13 @@ public interface ICameraRepository : IMongoRepository<Camera>
|
||||
/// <param name="objectId">The unique identifier of the camera to update.</param>
|
||||
/// <param name="camera">The camera object containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The task result contains the updated <see cref="Camera"/>, or <c>null</c> if no camera with the specified identifier was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=85a936b -->
|
||||
Task<Camera?> UpdateCameraAsync(ObjectId objectId, Camera camera);
|
||||
/// <summary>
|
||||
/// Asynchronously searches for cameras whose name matches the specified text.
|
||||
/// </summary>
|
||||
/// <param name="textToSearch">The text used to filter cameras by name.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Camera"/> objects matching the search criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=b1c98a2 -->
|
||||
Task<List<Camera>> GetSearchByNameCameras(string textToSearch);
|
||||
}
|
||||
@@ -11,6 +11,7 @@ public interface IConfigObservationRepository : IMongoRepository<ConfigObservati
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation to locate.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ConfigObservation"/> if found, or <c>null</c> if no observation matches the specified identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=1d4cd90 -->
|
||||
Task<ConfigObservation?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -19,6 +20,7 @@ public interface IConfigObservationRepository : IMongoRepository<ConfigObservati
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The configuration observation containing the updated values to persist.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="ConfigObservation"/>, or <c>null</c> if the observation does not exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=58909e3 -->
|
||||
Task<ConfigObservation?> Update(ConfigObservation configObservation);
|
||||
|
||||
/// <summary>
|
||||
@@ -26,18 +28,21 @@ public interface IConfigObservationRepository : IMongoRepository<ConfigObservati
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains the deleted configuration observation, or <c>null</c> if no observation with the specified identifier was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=ae833b9 -->
|
||||
Task<ConfigObservation?> Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available identifiers, returning them as a list of <see cref="ObjectId"/> values.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing a list of all <see cref="ObjectId"/> instances found.</returns>
|
||||
/// <!-- aidoc:v1 sig=2b29fbf -->
|
||||
Task<List<ObjectId>> FindAllIds();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all configuration observations available in the system.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="ConfigObservation"/> instances.</returns>
|
||||
/// <!-- aidoc:v1 sig=4aacd78 -->
|
||||
Task<ICollection<ConfigObservation>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
@@ -45,28 +50,33 @@ public interface IConfigObservationRepository : IMongoRepository<ConfigObservati
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier used to look up the configuration names.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of configuration names.</returns>
|
||||
/// <!-- aidoc:v1 sig=e20bf71 -->
|
||||
Task<List<string>> GetConfigNames(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of available configuration names.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of configuration names.</returns>
|
||||
/// <!-- aidoc:v1 sig=45b7793 -->
|
||||
Task<List<string>> GetConfigNames();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the total count of items.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total count as a <see cref="long"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=25063b3 -->
|
||||
Task<long> Count();
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of configuration observations based on the specified filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and any additional criteria used to retrieve the observations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="ConfigObservation"/> items that match the pagination criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=6003918 -->
|
||||
Task<ICollection<ConfigObservation>> GetPaginatedItems(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves a configuration observation that matches the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the configuration observation to find.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching ConfigObservation if found; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=8fdec03 -->
|
||||
Task<ConfigObservation?> FindByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="ConfigObservation"/> matching the specified coding system and code.
|
||||
@@ -74,18 +84,21 @@ public interface IConfigObservationRepository : IMongoRepository<ConfigObservati
|
||||
/// <param name="codingSystem">The coding system identifier used to look up the configuration observation.</param>
|
||||
/// <param name="code">The code value within the specified coding system used to look up the configuration observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigObservation"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=8d72db9 -->
|
||||
Task<ConfigObservation?> GetByCodeSysAndCode(string? codingSystem, string? code);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts the specified configuration observation item and returns the persisted entity.
|
||||
/// </summary>
|
||||
/// <param name="configObservationItem">The configuration observation to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="ConfigObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=6699d0c -->
|
||||
Task<ConfigObservation> InsertOneAsyncAndReturn(ConfigObservation configObservationItem);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all <see cref="ConfigObservation"/> records matching the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the configuration observations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="ConfigObservation"/> objects matching the given name, or an empty list if none are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4081b04 -->
|
||||
Task<List<ConfigObservation>> FindAllByName(string name);
|
||||
|
||||
/// <summary>
|
||||
@@ -96,6 +109,7 @@ public interface IConfigObservationRepository : IMongoRepository<ConfigObservati
|
||||
/// <param name="name">The name used to look up the configuration observation item, or <see langword="null"/> if not specified.</param>
|
||||
/// <param name="originalName">The original name used to look up the configuration observation item, or <see langword="null"/> if not specified.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigObservation"/> item, or <see langword="null"/> if no item matches the specified criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=2c7c75f -->
|
||||
Task<ConfigObservation?> GetSingleConfigObservationItem(string? code, string? codingSystem, string? name,
|
||||
string? originalName);
|
||||
}
|
||||
@@ -10,11 +10,13 @@ public interface IConfigPumpsRepository : IMongoRepository<ConfigPumps>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration to look up.</param>
|
||||
/// <returns>A task that yields the matching ConfigPumps instance, or null if no configuration is found for the specified id.</returns>
|
||||
/// <!-- aidoc:v1 sig=394bbbd -->
|
||||
Task<ConfigPumps?> FindById(string id);
|
||||
/// <summary>
|
||||
/// Retrieves all pump configurations asynchronously.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ConfigPumps"/> if found, or <c>null</c> if no configurations are available.</returns>
|
||||
/// <!-- aidoc:v1 sig=d87df07 -->
|
||||
Task<List<ConfigPumps>?> GetAllConfigs();
|
||||
|
||||
/// <summary>
|
||||
@@ -22,11 +24,13 @@ public interface IConfigPumpsRepository : IMongoRepository<ConfigPumps>
|
||||
/// </summary>
|
||||
/// <param name="config">The pumps configuration to be persisted.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="ConfigPumps"/> instance, or <see langword="null"/> if the configuration could not be found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4bd2a84 -->
|
||||
Task<ConfigPumps?> UpdateConfig(ConfigPumps config);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the specified pump configuration.
|
||||
/// </summary>
|
||||
/// <param name="config">The pump configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the configuration was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=2400a34 -->
|
||||
Task<bool> DeleteConfig(ConfigPumps config);
|
||||
}
|
||||
@@ -10,5 +10,6 @@ public interface IConfigUnitsRepository : IMongoRepository<ConfigUnits>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration unit to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="ConfigUnits"/> or <c>null</c> if no entity is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6cffb54 -->
|
||||
Task<ConfigUnits?> FindById(string id);
|
||||
}
|
||||
@@ -11,24 +11,28 @@ public interface IDeviceRepository : IMongoRepository<Device>
|
||||
/// </summary>
|
||||
/// <param name="deviceDtoMacAddr">The MAC address used to look up the device.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="Device"/> or null when no device is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=c887f30 -->
|
||||
Task<Device?> FindByMacAddr(string deviceDtoMacAddr);
|
||||
/// <summary>
|
||||
/// Finds and returns the device matching the specified serial number, or <c>null</c> if no matching device is found.
|
||||
/// </summary>
|
||||
/// <param name="deviceDtoSerialNumber">The serial number used to look up the device.</param>
|
||||
/// <returns>A <see cref="Device"/> instance if a match is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=2bc0894 -->
|
||||
Task<Device?> FindBySerialNumber(string deviceDtoSerialNumber);
|
||||
/// <summary>
|
||||
/// Asynchronously finds a device by its unique identifier (UUID) and returns the matching device, or null if no device is found.
|
||||
/// </summary>
|
||||
/// <param name="deviceDtoUuid">The UUID string used to look up the device.</param>
|
||||
/// <returns>A <see cref="Task{Device}"/> that resolves to the matching <see cref="Device"/>, or null when no device matches the provided UUID.</returns>
|
||||
/// <!-- aidoc:v1 sig=d0a473e -->
|
||||
Task<Device?> FindByUuid(string deviceDtoUuid);
|
||||
/// <summary>
|
||||
/// Retrieves a device by its unique key identifier.
|
||||
/// </summary>
|
||||
/// <param name="deviceDtoKey">The key identifier of the device to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Device"/> if a matching device is found, or <c>null</c> if no device corresponds to the specified key.</returns>
|
||||
/// <!-- aidoc:v1 sig=f846571 -->
|
||||
Task<Device?> FindByKey(string deviceDtoKey);
|
||||
/// <summary>
|
||||
/// Updates the statistics of an existing device identified by the specified identifier.
|
||||
@@ -36,5 +40,6 @@ public interface IDeviceRepository : IMongoRepository<Device>
|
||||
/// <param name="id">The unique identifier of the device whose statistics will be updated.</param>
|
||||
/// <param name="deviceExist">The device data transfer object representing the existing device to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=d3d9745 -->
|
||||
Task UpdateDeviceStats(ObjectId id,DeviceDto deviceExist);
|
||||
}
|
||||
@@ -9,16 +9,19 @@ public interface IDiagnosisArchiveRepository
|
||||
/// </summary>
|
||||
/// <param name="patientDiagnosis">The patient diagnosis entity to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=2e5fbfe -->
|
||||
Task InsertOneAsync(PatientDiagnosis patientDiagnosis);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes items that occurred before the specified cutoff date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; items dated prior to this value will be deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=350661d -->
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Inserts a batch of patient diagnosis records into the data store.
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The collection of <see cref="PatientDiagnosis"/> entities to insert.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> representing the asynchronous operation, containing the result of the batch insertion.</returns>
|
||||
/// <!-- aidoc:v1 sig=ad12097 -->
|
||||
Task<long> InsertBatch(IEnumerable<PatientDiagnosis> diagnosis);
|
||||
}
|
||||
@@ -11,17 +11,20 @@ public interface IDiagnosisRepository : IMongoRepository<PatientDiagnosis>
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose diagnoses are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientDiagnosis"/> objects for the specified patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=5d93ade -->
|
||||
Task<List<PatientDiagnosis>> GetByPatient(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single patient diagnosis record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis entity to insert.</param>
|
||||
/// <!-- aidoc:v1 sig=f01c3df -->
|
||||
new Task InsertOneAsync(PatientDiagnosis diagnosis);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=9f8dfa3 -->
|
||||
new Task DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Updates many records by replacing the existing <see cref="ObjectId"/> identified by <paramref name="oldId"/> with the new <see cref="ObjectId"/> <paramref name="id"/>, scoped to the specified <paramref name="nameId"/>.
|
||||
@@ -29,17 +32,20 @@ public interface IDiagnosisRepository : IMongoRepository<PatientDiagnosis>
|
||||
/// <param name="nameId">The identifier of the field or collection on which the update is performed.</param>
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to assign.</param>
|
||||
/// <param name="oldId">The existing <see cref="ObjectId"/> value to be replaced.</param>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Asynchronously finds all patient diagnoses associated with the specified patient identifier, returning a cursor to iterate over the matching documents.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose diagnoses should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an IAsyncCursor of PatientDiagnosis that yields the matching documents.</returns>
|
||||
/// <!-- aidoc:v1 sig=61b15db -->
|
||||
Task<IAsyncCursor<PatientDiagnosis>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique <see cref="ObjectId"/> of the patient whose related records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=1e79565 -->
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="PatientDiagnosis"/> associated with the specified patient, diagnosis code, and coding system.
|
||||
@@ -49,5 +55,6 @@ public interface IDiagnosisRepository : IMongoRepository<PatientDiagnosis>
|
||||
/// <param name="diagnosisCode">The diagnosis code to match. May be null.</param>
|
||||
/// <param name="codingSystem">The coding system of the diagnosis code (for example, ICD-10 or SNOMED). May be null.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="PatientDiagnosis"/>, or null if no diagnosis matches the given criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=56ca4f7 -->
|
||||
Task<PatientDiagnosis?> FindByPatientIdAndCode(ObjectId patientId, string? diagnosisCode, string? codingSystem);
|
||||
}
|
||||
@@ -12,12 +12,14 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// Deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=0112d17 -->
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing discharge record.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge entity containing the updated information to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=2ea41b6 -->
|
||||
Task Update(Discharge discharge);
|
||||
|
||||
/// <summary>
|
||||
@@ -25,6 +27,7 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the object whose unit will be updated.</param>
|
||||
/// <param name="unit">The new unit value to assign to the object.</param>
|
||||
/// <!-- aidoc:v1 sig=e209b77 -->
|
||||
Task UpdateUnit(ObjectId id, string unit);
|
||||
|
||||
/// <summary>
|
||||
@@ -32,12 +35,14 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient to update.</param>
|
||||
/// <param name="patient">The patient object containing the updated information to be applied to the existing record.</param>
|
||||
/// <!-- aidoc:v1 sig=7d687d6 -->
|
||||
Task UpdatePatient(ObjectId id, Patient patient);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all discharge records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of all <see cref="Discharge"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=f3aa8a3 -->
|
||||
Task<IEnumerable<Discharge>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
@@ -45,6 +50,7 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the discharge record to find.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Discharge"/> if a matching record is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=cbc5b2e -->
|
||||
Task<Discharge?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -52,6 +58,7 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit identifier used to filter the discharge records.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is an <see cref="IEnumerable{T}"/> of <see cref="Discharge"/> containing the matching records, or <see langword="null"/> when no records are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=43b920c -->
|
||||
Task<IEnumerable<Discharge>?> FindByUnit(string unit);
|
||||
|
||||
/// <summary>
|
||||
@@ -59,6 +66,7 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// </summary>
|
||||
/// <param name="unitId">The ObjectId of the unit whose associated records will be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the count of records for the specified unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=e0dfc62 -->
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
@@ -66,6 +74,7 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// </summary>
|
||||
/// <param name="destination">The destination identifier used to look up matching discharge records.</param>
|
||||
/// <returns>A task that yields an <see cref="IEnumerable{Discharge}"/> of matching discharge records, or <c>null</c> if no records are found for the given destination.</returns>
|
||||
/// <!-- aidoc:v1 sig=9eb7a6c -->
|
||||
Task<IEnumerable<Discharge>?> FindByDestination(string destination);
|
||||
|
||||
/// <summary>
|
||||
@@ -74,12 +83,14 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// </summary>
|
||||
/// <param name="service">The service identifier used to look up matching discharge records.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is an <see cref="IEnumerable{T}"/> of <see cref="Discharge"/> entries for the specified service, or <c>null</c> if none are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=24de989 -->
|
||||
Task<IEnumerable<Discharge>?> FindByService(string service);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of <see cref="Discharge"/> records associated with the specified unit identifiers.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The collection of unit identifiers used to look up the matching discharges. May be <c>null</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="Discharge"/> objects, or <c>null</c> when no matching discharges are available.</returns>
|
||||
/// <!-- aidoc:v1 sig=29c7c15 -->
|
||||
Task<IEnumerable<Discharge>?> GetDischargesByUnitIds(IEnumerable<ObjectId>? unitIds);
|
||||
|
||||
|
||||
@@ -88,12 +99,14 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to look up the associated discharge record.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Discharge"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=8da289b -->
|
||||
Task<Discharge?> GetDischargeByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge record associated with the specified patient identifier, or <see langword="null"/> if no discharge exists for that patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose discharge record is being requested.</param>
|
||||
/// <returns>A <see cref="Task{Discharge}"/> that resolves to the matching <see cref="Discharge"/>, or <see langword="null"/> when no record is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=201be7c -->
|
||||
Task<Discharge?> GetByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
@@ -101,12 +114,14 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// </summary>
|
||||
/// <param name="pocId">The point-of-care identifier used to look up the associated discharges.</param>
|
||||
/// <returns>A task that returns an <see cref="IEnumerable{T}"/> of <see cref="Discharge"/> records, or <see langword="null"/> if no discharges are found for the given point-of-care identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=dd4639c -->
|
||||
Task<IEnumerable<Discharge>?> FindByPoCId(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge associated with the specified point of care identifier.
|
||||
/// </summary>
|
||||
/// <param name="poc">The identifier of the point of care used to look up the discharge.</param>
|
||||
/// <returns>A task that returns the matching <see cref="Discharge"/> if one is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=5c6cb4c -->
|
||||
Task<Discharge?> GetDischargeByPointOfCareId(ObjectId poc);
|
||||
|
||||
/// <summary>
|
||||
@@ -116,6 +131,7 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// <param name="opt">The update option master list data transfer object containing the new option details.</param>
|
||||
/// <param name="typeName">The name of the type to which the master list option applies.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of updated Discharge records.</returns>
|
||||
/// <!-- aidoc:v1 sig=03334e1 -->
|
||||
Task<IEnumerable<Discharge>> UpdateMasterListOption(List<ObjectId> unitIds, UpdateOptionMasterListDto opt,
|
||||
string typeName);
|
||||
|
||||
@@ -126,11 +142,13 @@ public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
/// <param name="opt">The master list option to delete.</param>
|
||||
/// <param name="typeName">The type name associated with the option.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of <see cref="Discharge"/> objects resulting from the deletion.</returns>
|
||||
/// <!-- aidoc:v1 sig=5d8584d -->
|
||||
Task<IEnumerable<Discharge>> DeleteMasterListOption(List<ObjectId> unitIds, OptionList opt, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes the entity associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose associated record should be removed.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is <c>true</c> if a record was deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=7032be4 -->
|
||||
Task<bool> DeleteByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -10,29 +10,34 @@ public interface IDisplayCardConfigRepository : IMongoRepository<CardConfig>
|
||||
/// Asynchronously retrieves all available card configurations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="CardConfig"/> items.</returns>
|
||||
/// <!-- aidoc:v1 sig=7c46da8 -->
|
||||
Task<List<CardConfig>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a card configuration by its unique identifier, returning <c>null</c> when no matching configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the card configuration to look up.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="CardConfig"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=10fd753 -->
|
||||
Task<CardConfig?> GetById(ObjectId configId);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="CardConfig"/> into the data store and returns the persisted record, which may include database-generated values.
|
||||
/// </summary>
|
||||
/// <param name="config">The <see cref="CardConfig"/> instance to insert.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the inserted <see cref="CardConfig"/>, or <c>null</c> if the record could not be persisted.</returns>
|
||||
/// <!-- aidoc:v1 sig=ba19ca3 -->
|
||||
Task<CardConfig?> InsertOneAsyncAndReturn(CardConfig config);
|
||||
/// <summary>
|
||||
/// Updates a single <see cref="CardConfig"/> record based on the provided configuration.
|
||||
/// </summary>
|
||||
/// <param name="config">The <see cref="CardConfig"/> to update. May be <c>null</c> to indicate no update payload was provided.</param>
|
||||
/// <returns>A task that resolves to an <see cref="UpdateResponse{T}"/> containing the updated <see cref="CardConfig"/>, or <c>null</c> if no matching record was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=1c7016f -->
|
||||
Task<UpdateResponse<CardConfig?>> UpdateOne(CardConfig? config);
|
||||
/// <summary>
|
||||
/// Deletes a single card configuration identified by the specified identifier, returning the removed configuration when found.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the card configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains the deleted <see cref="CardConfig"/>, or <c>null</c> if no configuration with the specified identifier exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=06062fe -->
|
||||
Task<CardConfig?> DeleteOne(ObjectId configId);
|
||||
}
|
||||
@@ -10,29 +10,34 @@ public interface IDisplayChartConfigRepository : IMongoRepository<ChartConfig>
|
||||
/// Asynchronously retrieves all chart configurations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ChartConfig"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=69d54d6 -->
|
||||
Task<List<ChartConfig>> GetAll();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="ChartConfig"/> by its unique identifier, returning null if no matching configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="configId">The identifier of the chart configuration to look up.</param>
|
||||
/// <returns>A task that yields the matching <see cref="ChartConfig"/>, or null when no configuration exists for the specified id.</returns>
|
||||
/// <!-- aidoc:v1 sig=0f66137 -->
|
||||
Task<ChartConfig?> GetById(ObjectId configId);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new chart configuration into the data store and returns the persisted entity, which may be null if no record is produced.
|
||||
/// </summary>
|
||||
/// <param name="config">The chart configuration to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="ChartConfig"/> or null when the operation yields no result.</returns>
|
||||
/// <!-- aidoc:v1 sig=ff330b7 -->
|
||||
Task<ChartConfig?> InsertOneAsyncAndReturn(ChartConfig config);
|
||||
/// <summary>
|
||||
/// Updates a single chart configuration and returns the operation result wrapped in an update response.
|
||||
/// </summary>
|
||||
/// <param name="config">The chart configuration to update. May be null.</param>
|
||||
/// <returns>A task containing the update response with the updated chart configuration, which may be null.</returns>
|
||||
/// <!-- aidoc:v1 sig=5d67082 -->
|
||||
Task<UpdateResponse<ChartConfig?>> UpdateOne(ChartConfig? config);
|
||||
/// <summary>
|
||||
/// Deletes a single chart configuration identified by its unique identifier. Returns the deleted configuration, or <see langword="null"/> if no matching configuration was found.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the chart configuration to delete.</param>
|
||||
/// <returns>A task that resolves to the deleted <see cref="ChartConfig"/>, or <see langword="null"/> if no configuration with the specified id exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=7690568 -->
|
||||
Task<ChartConfig?> DeleteOne(ObjectId configId);
|
||||
}
|
||||
@@ -15,18 +15,21 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// Asynchronously retrieves all display configurations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="DisplayConfig"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=0650c45 -->
|
||||
Task<List<DisplayConfig>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a paginated set of <see cref="DisplayConfig"/> entities projected as <see cref="DisplayConfigSummary"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter applied to the query.</param>
|
||||
/// <returns>An <see cref="IFindFluent{TDocument, TProjection}"/> that produces the paginated <see cref="DisplayConfigSummary"/> results.</returns>
|
||||
/// <!-- aidoc:v1 sig=5cd5916 -->
|
||||
IFindFluent<DisplayConfig, DisplayConfigSummary> GetAllPaginated(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of display configurations that match the specified display type.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to filter the returned display configurations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="DisplayConfig"/> entries matching the specified type.</returns>
|
||||
/// <!-- aidoc:v1 sig=2f20b32 -->
|
||||
Task<List<DisplayConfig>> GetByType(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="DisplayConfig"/> entity by its unique identifier asynchronously.
|
||||
@@ -34,6 +37,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="DisplayConfig"/> if found, or <c>null</c> if no matching record exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=938724e -->
|
||||
Task<DisplayConfig?> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the default <see cref="DisplayConfig"/> for the specified display type.
|
||||
@@ -41,12 +45,14 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to look up the default configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the default <see cref="DisplayConfig"/> for the given type, or <c>null</c> if no default exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=691190f -->
|
||||
Task<DisplayConfig?> GetDefault(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="DisplayConfig"/> and returns the persisted entity, typically populated with any server-generated values.
|
||||
/// </summary>
|
||||
/// <param name="config">The <see cref="DisplayConfig"/> to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the inserted <see cref="DisplayConfig"/>, or <see langword="null"/> when no result is returned.</returns>
|
||||
/// <!-- aidoc:v1 sig=93c23df -->
|
||||
Task<DisplayConfig?> InsertOneAsyncAndReturn(DisplayConfig config);
|
||||
/// <summary>
|
||||
/// Updates the smart display configuration identified by the specified ID with the provided new configuration.
|
||||
@@ -54,6 +60,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="displayConfigId">The unique identifier of the smart display configuration to update.</param>
|
||||
/// <param name="newDisplayConfig">The new smart display configuration to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the updated smart display configuration, or null if no configuration with the given ID was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=5c60d9b -->
|
||||
Task<SmartDisplay?> UpdateSmartDisplay(ObjectId displayConfigId, SmartDisplay? newDisplayConfig);
|
||||
|
||||
/// <summary>
|
||||
@@ -63,6 +70,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="newDisplayConfig">The new display nurse configuration data, or null if not provided.</param>
|
||||
/// <param name="nurseObs">The list of nurse observations to associate with the configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="DisplayNurse"/> or null if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=317dda3 -->
|
||||
Task<DisplayNurse?> UpdateDisplayNurse(ObjectId displayConfigId, DisplayNurseDto? newDisplayConfig,
|
||||
List<string> nurseObs);
|
||||
|
||||
@@ -73,6 +81,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="unitId">The identifier of the unit whose default display configuration is being requested.</param>
|
||||
/// <param name="displayType">The display type used to filter the configuration lookup.</param>
|
||||
/// <returns>A task containing the matching <see cref="DisplayConfig"/>, or <c>null</c> if no default configuration is found for the given unit and display type.</returns>
|
||||
/// <!-- aidoc:v1 sig=c1f0b10 -->
|
||||
Task<DisplayConfig?> GetDefaultByUnitIdAndType(ObjectId unitId, DisplayConfigEnums.DisplayType displayType);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the color configuration for the specified config display entry.
|
||||
@@ -80,6 +89,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="objectIdConfigDisplay">The unique identifier of the config display whose color configuration will be updated.</param>
|
||||
/// <param name="colorConfig">The new color configuration to apply to the config display.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the color configuration was successfully updated; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=603eb76 -->
|
||||
Task<bool> UpdateConfigColor(ObjectId objectIdConfigDisplay, ColorConfig colorConfig);
|
||||
/// <summary>
|
||||
/// Updates the home banner configuration identified by the specified config display ObjectId with the provided list of banner items.
|
||||
@@ -87,6 +97,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="objectIdConfigDisplay">The ObjectId of the config display whose home banner set will be updated.</param>
|
||||
/// <param name="bannerItems">The collection of banner items to apply to the home banner set.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the home banner set was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=a96cf5b -->
|
||||
Task<bool> UpdateSetHomeBanner(ObjectId objectIdConfigDisplay, List<BannerItem> bannerItems);
|
||||
/// <summary>
|
||||
/// Updates the base display configuration identified by the specified object identifier with the provided configuration data.
|
||||
@@ -94,6 +105,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="objectIdConfigDisplay">The object identifier of the configuration display entry to update.</param>
|
||||
/// <param name="baseConfig">The new base display configuration values to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is <c>true</c> if the update succeeded; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=93fc07a -->
|
||||
Task<bool> UpdateBaseConfig(ObjectId objectIdConfigDisplay, DisplayConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Updates an existing header configuration associated with the specified configuration display identifier.
|
||||
@@ -101,6 +113,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="objectIdConfigDisplay">The unique identifier of the configuration display whose header configuration is being updated.</param>
|
||||
/// <param name="headerConfig">The new header configuration values to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the header configuration was successfully updated; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=979f311 -->
|
||||
Task<bool> UpdateHeaderConfig(ObjectId objectIdConfigDisplay, HeaderConfig headerConfig);
|
||||
/// <summary>
|
||||
/// Updates the hospital name associated with the specified display configuration.
|
||||
@@ -108,6 +121,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the display configuration to update.</param>
|
||||
/// <param name="name">The new hospital name to apply to the display configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the update succeeded; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=519223f -->
|
||||
Task<bool> UpdateDisplayConfigHospitalName(ObjectId objectIdConfigDisplay, string name);
|
||||
/// <summary>
|
||||
/// Updates the field list associated with the specified configuration display.
|
||||
@@ -115,29 +129,34 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the configuration display whose field list is being updated.</param>
|
||||
/// <param name="fields">The list of fields to apply to the configuration display.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the field list was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=62079e1 -->
|
||||
Task<bool> UpdateFieldList(ObjectId objectIdConfigDisplay, List<Field> fields);
|
||||
/// <summary>
|
||||
/// Deletes a display configuration identified by the specified object ID.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The object ID of the display configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains the deleted display configuration, or null if no configuration was found with the specified ID.</returns>
|
||||
/// <!-- aidoc:v1 sig=f04bba3 -->
|
||||
Task<DisplayConfig?> DeleteDisplayConfig(ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Retrieves all display configurations in a compact, minimal representation.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a list of <see cref="DisplayConfigMinimalResponse"/> objects representing the display configurations.</returns>
|
||||
/// <!-- aidoc:v1 sig=784f030 -->
|
||||
Task<List<DisplayConfigMinimalResponse>> GetAllCompact();
|
||||
/// <summary>
|
||||
/// Retrieves all object identifiers associated with the specified card configuration identifier.
|
||||
/// </summary>
|
||||
/// <param name="cardConfigId">The identifier of the card configuration whose related objects should be returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ObjectId"/> values linked to the given card configuration.</returns>
|
||||
/// <!-- aidoc:v1 sig=4ca5d28 -->
|
||||
Task<List<ObjectId>> GetAllByCardConfigId(ObjectId cardConfigId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of ObjectIds associated with the specified card configuration that are marked as rotating.
|
||||
/// </summary>
|
||||
/// <param name="cardConfigId">The ObjectId of the card configuration used to filter the results.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of ObjectIds that match the given card configuration and rotating criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=59e1336 -->
|
||||
Task<List<ObjectId>> GetAllByCardConfigIdAndRotating(ObjectId cardConfigId);
|
||||
/// <summary>
|
||||
/// Updates the card configuration identifier for the specified display configuration and result.
|
||||
@@ -145,6 +164,7 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="displayConfigId">The identifier of the display configuration whose card configuration will be updated.</param>
|
||||
/// <param name="resultId">The identifier of the result associated with the card configuration update.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the update succeeded; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=5aceeda -->
|
||||
Task<bool> UpdateCardConfigId(ObjectId? displayConfigId, ObjectId? resultId);
|
||||
/// <summary>
|
||||
/// Adds a chart identifier to the specified display configuration asynchronously.
|
||||
@@ -152,18 +172,21 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="displayConfigId">The identifier of the display configuration to which the chart ID will be added, or <c>null</c> when no specific configuration is targeted.</param>
|
||||
/// <param name="newChartIdToAdd">The chart identifier to add.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the chart identifier was successfully added; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=e08471c -->
|
||||
Task<bool> AddChartId(ObjectId? displayConfigId, ObjectId newChartIdToAdd);
|
||||
/// <summary>
|
||||
/// Updates the configuration of a chart that was previously deleted, using the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="deletedId">The identifier of the deleted chart configuration to update.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the result of the update.</returns>
|
||||
/// <!-- aidoc:v1 sig=dd3d4a9 -->
|
||||
Task<UpdateResult> UpdateDeletedChartConfig(ObjectId deletedId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the chart configuration associated with the specified chart object identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigChart">The unique object identifier of the chart configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="ChartConfig"/> associated with the specified identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=4913157 -->
|
||||
Task<ChartConfig> GetChartConfig(ObjectId objectIdConfigChart);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the detail configuration identifier, associating it with the specified result identifier.
|
||||
@@ -171,11 +194,13 @@ public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
/// <param name="displayConfigId">The nullable identifier of the display configuration to update.</param>
|
||||
/// <param name="resultId">The nullable identifier of the result to associate with the configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean indicating whether the update was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=461a960 -->
|
||||
Task<bool> UpdateDetailConfigId(ObjectId? displayConfigId, ObjectId? resultId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of identifiers associated with the specified card detail base configuration.
|
||||
/// </summary>
|
||||
/// <param name="baseConfigId">The identifier of the card detail base configuration to filter by.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ObjectId"/> values matching the provided base configuration identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=370fbe0 -->
|
||||
Task<List<ObjectId>> GetAllByCardDetailConfigId(ObjectId baseConfigId);
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public interface IDisplayDetailConfigRepository : IMongoRepository<CardDetailsCo
|
||||
/// Asynchronously retrieves all card details configurations from the data source.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="CardDetailsConfig"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=b4de920 -->
|
||||
Task<List<CardDetailsConfig>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="CardDetailsConfig"/> by its unique identifier.
|
||||
@@ -17,23 +18,27 @@ public interface IDisplayDetailConfigRepository : IMongoRepository<CardDetailsCo
|
||||
/// </summary>
|
||||
/// <param name="configId">The identifier of the card details configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="CardDetailsConfig"/> or <see langword="null"/> if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a624128 -->
|
||||
Task<CardDetailsConfig?> GetById(ObjectId configId);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new card details configuration and returns the inserted entity.
|
||||
/// </summary>
|
||||
/// <param name="config">The card details configuration to insert.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the inserted <see cref="CardDetailsConfig"/>, or <c>null</c> if no entity was returned.</returns>
|
||||
/// <!-- aidoc:v1 sig=6ff78fc -->
|
||||
Task<CardDetailsConfig?> InsertOneAsyncAndReturn(CardDetailsConfig config);
|
||||
/// <summary>
|
||||
/// Updates a single card details configuration record asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="config">The card details configuration to update. May be <see langword="null"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the update response with the updated <see cref="CardDetailsConfig"/> or <see langword="null"/> when no configuration is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=00357b8 -->
|
||||
Task<UpdateResponse<CardDetailsConfig?>> UpdateOne(CardDetailsConfig? config);
|
||||
/// <summary>
|
||||
/// Deletes a single <see cref="CardDetailsConfig"/> identified by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the <see cref="CardDetailsConfig"/> to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the deleted <see cref="CardDetailsConfig"/>, or <c>null</c> if no matching configuration was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=e53d89f -->
|
||||
Task<CardDetailsConfig?> DeleteOne(ObjectId configId);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// Retrieves every display stored in the collection.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains all displays, or an empty list if none exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=d9b5d50 -->
|
||||
Task<List<Display>> GetAll();
|
||||
|
||||
|
||||
@@ -22,6 +23,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The <see cref="PointOfCare"/> to filter by.</param>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=04ec30c -->
|
||||
Task<List<Display>> GetByPointOfCare(PointOfCare pointOfCare);
|
||||
|
||||
// Task<List<Display>> GetByUser();
|
||||
@@ -31,6 +33,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="name">The display name to look up.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the <see cref="Display"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=02f4c9c -->
|
||||
Task<Display?> GetByName(string name);
|
||||
|
||||
/// <summary>
|
||||
@@ -38,6 +41,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the display to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the <see cref="Display"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=3467c35 -->
|
||||
Task<Display?> GetById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -45,6 +49,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the display to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the <see cref="Display"/> with its config populated if found; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=ae957ab -->
|
||||
Task<Display?> GetByIdWithConfigDisplay(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -52,6 +57,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the unit.</param>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=a786839 -->
|
||||
Task<List<Display>> GetByUnitId(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -59,6 +65,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the display configuration to filter by.</param>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=da68f5b -->
|
||||
Task<List<Display>> GetByConfigId(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -67,6 +74,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// <param name="objectId">The <see cref="ObjectId"/> of the display to update.</param>
|
||||
/// <param name="listPocObId">The new list of <see cref="ObjectId"/> values representing the point-of-cares to associate with the display.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/> if the update succeeded; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=48f0e68 -->
|
||||
Task<Display?> UpdatePointOfCareList(ObjectId objectId, List<ObjectId> listPocObId);
|
||||
|
||||
/// <summary>
|
||||
@@ -75,6 +83,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// <param name="oldDisplayId">The <see cref="ObjectId"/> of the display whose configuration should be replaced.</param>
|
||||
/// <param name="newDisplayConfigCast">The new <see cref="DisplayConfig"/> instance to assign to the display.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/> if the update succeeded; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=a68edd4 -->
|
||||
Task<Display?> UpdateConfig(ObjectId oldDisplayId, DisplayConfig newDisplayConfigCast);
|
||||
|
||||
/// <summary>
|
||||
@@ -83,6 +92,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// <param name="objectIdDisplay">The <see cref="ObjectId"/> of the display to update.</param>
|
||||
/// <param name="objectIdConfigDisplay">The <see cref="ObjectId"/> of the display-config preset to associate.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/> if the update succeeded; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=6061a62 -->
|
||||
Task<Display?> UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay);
|
||||
|
||||
/// <summary>
|
||||
@@ -91,6 +101,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// <param name="display">The <see cref="Display"/> instance to update. Its <see cref="ObjectId"/> is used to identify the document.</param>
|
||||
/// <param name="name">The new display name.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=43f880c -->
|
||||
Task<Display> UpdateName(Display display, string name);
|
||||
|
||||
/// <summary>
|
||||
@@ -98,6 +109,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="filter">The <see cref="PaginationFilter"/> containing pagination and filter criteria.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Display, Display}"/> instance that can be used to further refine and execute the query.</returns>
|
||||
/// <!-- aidoc:v1 sig=35cf2af -->
|
||||
IFindFluent<Display, Display> GetPaginatedDisplays(PaginationFilter filter);
|
||||
|
||||
/// <summary>
|
||||
@@ -105,6 +117,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The <see cref="ObjectId"/> of the display configuration to check for usage.</param>
|
||||
/// <returns>A <see cref="Task{Int64}"/> representing the asynchronous operation. The task result contains the number of displays referencing the configuration.</returns>
|
||||
/// <!-- aidoc:v1 sig=ddb0904 -->
|
||||
Task<long> IsDisplayConfigInUse(ObjectId displayConfigId);
|
||||
|
||||
/// <summary>
|
||||
@@ -113,6 +126,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// <param name="objectId">The <see cref="ObjectId"/> of the display to update.</param>
|
||||
/// <param name="displayConfigId">The new <see cref="ObjectId"/> of the display configuration to associate with the display.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/> if the update succeeded; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=53467c7 -->
|
||||
Task<Display?> UpdateConfigId(ObjectId objectId, ObjectId displayConfigId);
|
||||
|
||||
/// <summary>
|
||||
@@ -120,6 +134,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="unitId">The <see cref="ObjectId"/> of the unit.</param>
|
||||
/// <returns>A <see cref="Task{Int64}"/> representing the asynchronous operation. The task result contains the number of displays for the unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=e0dfc62 -->
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
@@ -127,6 +142,7 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="unitId">The <see cref="ObjectId"/> of the unit whose displays should be removed.</param>
|
||||
/// <returns>A <see cref="Task{Boolean}"/> representing the asynchronous operation. The task result is <see langword="true"/> when at least one display was deleted; otherwise, <see langword="false"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=903a910 -->
|
||||
Task<bool> DeleteManyByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
@@ -134,5 +150,6 @@ public interface IDisplayRepository : IMongoRepository<Display>
|
||||
/// </summary>
|
||||
/// <param name="configId">The <see cref="ObjectId"/> of the card configuration to filter by.</param>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=7885fbb -->
|
||||
Task<List<Display>> GetByCardConfigId(ObjectId configId);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public interface IHistoricalConfigChangesRepository : IMongoRepository<Historica
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the historical configuration changes record to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="HistoricalConfigChanges"/> record, or null if no record with the specified identifier exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=32618a1 -->
|
||||
Task<HistoricalConfigChanges?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -19,6 +20,7 @@ public interface IHistoricalConfigChangesRepository : IMongoRepository<Historica
|
||||
/// </summary>
|
||||
/// <param name="historicalConfigChange">The historical config change entity containing the values to persist.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The result is the updated historical config change, or <c>null</c> if the record was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=febe8cf -->
|
||||
Task<HistoricalConfigChanges?> Update(HistoricalConfigChanges historicalConfigChange);
|
||||
|
||||
/// <summary>
|
||||
@@ -27,24 +29,28 @@ public interface IHistoricalConfigChangesRepository : IMongoRepository<Historica
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the historical configuration change to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation, containing the deleted <see cref="HistoricalConfigChanges"/> record, or <c>null</c> if no matching record exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=08b33f1 -->
|
||||
Task<HistoricalConfigChanges?> Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of all object identifiers.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of ObjectId values.</returns>
|
||||
/// <!-- aidoc:v1 sig=2b29fbf -->
|
||||
Task<List<ObjectId>> FindAllIds();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all historical configuration changes.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="HistoricalConfigChanges"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=0d065db -->
|
||||
Task<ICollection<HistoricalConfigChanges>> FindAll();
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="HistoricalConfigChanges"/> record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="patientObservation">The historical config change entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="HistoricalConfigChanges"/> entity, or <c>null</c> if the insertion did not produce a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=caa51e2 -->
|
||||
new Task<HistoricalConfigChanges?> InsertOneAsync(HistoricalConfigChanges patientObservation);
|
||||
|
||||
/// <summary>
|
||||
@@ -53,6 +59,7 @@ public interface IHistoricalConfigChangesRepository : IMongoRepository<Historica
|
||||
/// <param name="cfgType">The configuration type used to filter the historical changes.</param>
|
||||
/// <param name="num">The maximum number of recent changes to return. Defaults to 10.</param>
|
||||
/// <returns>A task that returns a collection of historical configuration changes matching the specified type, ordered from most recent.</returns>
|
||||
/// <!-- aidoc:v1 sig=36bb7c3 -->
|
||||
Task<ICollection<HistoricalConfigChanges>> FindLastHistoricalConfigChangesByType(
|
||||
DisplayConfigEnums.ConfigTypes cfgType, int num = 10);
|
||||
|
||||
@@ -63,6 +70,7 @@ public interface IHistoricalConfigChangesRepository : IMongoRepository<Historica
|
||||
/// <param name="cfgType">Optional. The configuration type to filter the results by. If null, changes across all configuration types are returned.</param>
|
||||
/// <param name="num">The maximum number of historical changes to return. Defaults to 10.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a collection of historical configuration changes for the user.</returns>
|
||||
/// <!-- aidoc:v1 sig=e9b2c45 -->
|
||||
Task<ICollection<HistoricalConfigChanges>> FindLastHistoricalConfigChangesByUser(string user,
|
||||
DisplayConfigEnums.ConfigTypes? cfgType = null, int num = 10);
|
||||
}
|
||||
@@ -12,35 +12,41 @@ public interface ILightBeaconRepository : IMongoRepository<LightBeacon>
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The collection of configuration relay <see cref="ObjectId"/> values used to look up the corresponding light beacons.</param>
|
||||
/// <returns>A <see cref="List{LightBeacon}"/> containing the light beacons matching the provided configuration relay identifiers; returns an empty list if no matches are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=74d25d3 -->
|
||||
List<LightBeacon> GetLightBeaconInList(List<ObjectId> configurationRelayList);
|
||||
/// <summary>
|
||||
/// Retrieves a light beacon by its associated relay identifier.
|
||||
/// </summary>
|
||||
/// <param name="relayId">The unique identifier of the relay used to look up the corresponding light beacon.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="LightBeacon"/>, or <c>null</c> if no beacon is found for the specified relay.</returns>
|
||||
/// <!-- aidoc:v1 sig=53103f5 -->
|
||||
Task<LightBeacon?> GetById(ObjectId relayId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="LightBeacon"/> by its name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the light beacon to look up.</param>
|
||||
/// <returns>A task that returns the matching <see cref="LightBeacon"/>, or <c>null</c> if no beacon with the specified name is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=8fe6fa2 -->
|
||||
Task<LightBeacon?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new LightBeacon and returns the persisted entity, or null if the insertion did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="beacon">The LightBeacon entity to insert.</param>
|
||||
/// <returns>A task containing the inserted LightBeacon, or null when no entity was returned by the underlying operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=a792e57 -->
|
||||
Task<LightBeacon?> InsertOneAsyncAndReturn(LightBeacon beacon);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, queryable collection of light beacons (relays) based on the supplied pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that controls paging parameters applied to the relay list.</param>
|
||||
/// <returns>An <see cref="IFindFluent{LightBeacon, LightBeacon}"/> exposing the paginated relay result set for further querying or enumeration.</returns>
|
||||
/// <!-- aidoc:v1 sig=c985c38 -->
|
||||
IFindFluent<LightBeacon, LightBeacon> GetPaginatedRelays(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of <see cref="LightBeacon"/> objects whose name matches the specified search text.
|
||||
/// </summary>
|
||||
/// <param name="textToSearch">The text used to search for matching <see cref="LightBeacon"/> entries by name.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="LightBeacon"/> objects that match the search criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=2c88e45 -->
|
||||
Task<List<LightBeacon>> GetSearchByName(string textToSearch);
|
||||
}
|
||||
@@ -12,11 +12,13 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// Deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the entity to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=0112d17 -->
|
||||
Task Delete(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the specified collection of items.
|
||||
/// </summary>
|
||||
/// <param name="list">The collection of items to update.</param>
|
||||
/// <!-- aidoc:v1 sig=85228bb -->
|
||||
Task Update(T list);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an entity identified by the specified <paramref name="id"/>, optionally resolving localized content using the given <paramref name="locale"/>. Returns <c>null</c> when no matching entity is found.
|
||||
@@ -24,6 +26,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The unique identifier of the entity to look up.</param>
|
||||
/// <param name="locale">The optional locale used to resolve localized fields of the retrieved entity.</param>
|
||||
/// <returns>A task that yields the matching entity, or <c>null</c> if the entity is not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=96a4e49 -->
|
||||
Task<T?> FindById(ObjectId id, LocaleEnum? locale);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an entity of type <typeparamref name="T"/> by its unique identifier.
|
||||
@@ -31,6 +34,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to locate.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the entity of type <typeparamref name="T"/> if found, or <c>null</c> otherwise.</returns>
|
||||
/// <!-- aidoc:v1 sig=b0b0918 -->
|
||||
Task<T?> FindById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an <see cref="OptionList"/> item identified by the specified master and option identifiers for the given locale.
|
||||
@@ -40,6 +44,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="optionId">The identifier of the specific option item to retrieve within the master scope.</param>
|
||||
/// <param name="locale">The locale used to select the localized version of the option item.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="OptionList"/>, or <c>null</c> if no item is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=353f501 -->
|
||||
Task<OptionList?> FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an <see cref="OptionList"/> identified by the given master and option identifiers.
|
||||
@@ -47,17 +52,20 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="masterId">The identifier of the master record that owns the option list.</param>
|
||||
/// <param name="optionId">The identifier of the specific option item to locate within the master.</param>
|
||||
/// <returns>A <see cref="Task{OptionList}"/> that yields the matching <see cref="OptionList"/>, or <c>null</c> when no item is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=ff21f84 -->
|
||||
Task<OptionList?> FindOptionItemById(ObjectId masterId, ObjectId optionId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all items of type T.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of all items of type T.</returns>
|
||||
/// <!-- aidoc:v1 sig=48c919f -->
|
||||
Task<IEnumerable<T>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves all master list entries without applying optional filters or including related option data.
|
||||
/// Used to fetch the complete set of master list records for scenarios such as full enumeration or bulk operations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an <see cref="IEnumerable{MasterListDto}"/> with all available master list entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=5929589 -->
|
||||
Task<IEnumerable<MasterListDto>> GetAllWithoutOptions();
|
||||
/// <summary>
|
||||
/// Asynchronously finds and returns an entity of type <typeparamref name="T"/> matching the specified <paramref name="name"/>.
|
||||
@@ -65,6 +73,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the entity.</param>
|
||||
/// <returns>A task that represents the asynchronous lookup, containing the matched entity of type <typeparamref name="T"/> or <c>null</c> if no match exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=f5a2991 -->
|
||||
Task<T?> FindByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves a master list of option list entries filtered by the specified identifier and an optional text search that performs a contains match.
|
||||
@@ -72,6 +81,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The identifier used to scope the option list entries to be returned.</param>
|
||||
/// <param name="textSearch">An optional text used to filter entries whose content contains the specified value; may be null to skip text-based filtering.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="OptionList"/> entries that match the identifier and the optional text search criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=807ba8d -->
|
||||
Task<List<OptionList>> GetMasterListByIdAndTextSearchContaining(ObjectId id, string? textSearch);
|
||||
/// <summary>
|
||||
/// Asynchronously adds a <see cref="FilterOptionListElement"/> to the master option list identified by the given <see cref="ObjectId"/>.
|
||||
@@ -79,6 +89,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The identifier of the master option list to which the element will be added.</param>
|
||||
/// <param name="opt">The filter option list element to add to the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the resulting <see cref="OptionList"/>, or <c>null</c> if no list is returned.</returns>
|
||||
/// <!-- aidoc:v1 sig=07eea1e -->
|
||||
Task<OptionList?> AddOptionToMasterList(ObjectId id, FilterOptionListElement opt);
|
||||
/// <summary>
|
||||
/// Updates an existing master list option identified by the specified identifier using the provided option data and locale, returning the updated option list.
|
||||
@@ -87,6 +98,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="newOpt">The new option list data to apply to the master list option.</param>
|
||||
/// <param name="locale">The locale used for the update operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="OptionList"/> if found, or <c>null</c> if no matching master list option exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=69ad188 -->
|
||||
Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList newOpt, LocaleEnum locale);
|
||||
/// <summary>
|
||||
/// Updates an existing master list option identified by the given id with the provided data, returning the updated option or null if no matching option is found.
|
||||
@@ -94,6 +106,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The unique identifier of the master list option to update.</param>
|
||||
/// <param name="newOpt">The new option data to replace the existing master list option.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the updated <see cref="OptionList"/>, or null if no option with the specified id exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=7c563ac -->
|
||||
Task<OptionList?> UpdateFullMasterListOption(ObjectId id, OptionList newOpt);
|
||||
/// <summary>
|
||||
/// Updates an existing master list option identified by the specified id with the provided new option data.
|
||||
@@ -101,6 +114,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The unique identifier of the master list option to update.</param>
|
||||
/// <param name="newOpt">The new option data to apply to the existing master list option.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="OptionList"/>, or <c>null</c> if no matching option was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=1f17447 -->
|
||||
Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList newOpt);
|
||||
/// <summary>
|
||||
/// Deletes a master list option identified by the specified option ID.
|
||||
@@ -108,6 +122,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The identifier of the master list containing the option to delete.</param>
|
||||
/// <param name="deleteOptId">The identifier of the option to be deleted from the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean indicating whether the option was successfully deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=2e650f2 -->
|
||||
Task<bool> DeleteMasterListOption(ObjectId id, ObjectId deleteOptId);
|
||||
/// <summary>
|
||||
/// Updates the option details of an existing entry in the master list identified by the specified id.
|
||||
@@ -115,6 +130,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The unique identifier of the master list entry to update.</param>
|
||||
/// <param name="opt">The update payload containing the new option details to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated master list details, or null if no matching entry is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=1d0803c -->
|
||||
Task<UpdateMasterListDetailsDto?> UpdateOptionDetailsToMasterList(ObjectId id, UpdateMasterListDetailsDto opt);
|
||||
/// <summary>
|
||||
/// Updates the name of an existing master list identified by the specified identifier.
|
||||
@@ -122,6 +138,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The unique identifier of the master list to update.</param>
|
||||
/// <param name="name">The new name to assign to the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the master list was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=a2d47b2 -->
|
||||
Task<bool> UpdateMasterListName(ObjectId id, string name);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the description of a master list identified by the specified identifier.
|
||||
@@ -129,6 +146,7 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The unique identifier of the master list to update.</param>
|
||||
/// <param name="description">The new description to set for the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <see langword="true"/> if the update was successful; otherwise, <see langword="false"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d9584a6 -->
|
||||
Task<bool> UpdateMasterListDescription(ObjectId id, string description);
|
||||
/// <summary>
|
||||
/// Asynchronously removes the specified option from the master list associated with the given identifier.
|
||||
@@ -136,12 +154,14 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The identifier of the master list from which the option will be removed.</param>
|
||||
/// <param name="oldOpt">The option to be removed from the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous removal operation. The task result contains true if the option was successfully removed; otherwise, false.</returns>
|
||||
/// <!-- aidoc:v1 sig=f049a15 -->
|
||||
Task<bool> RemoveMasterListOption(ObjectId id, OptionList oldOpt);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated master list using the specified pagination filter, returning a fluent queryable result.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the paging criteria applied to the master list query.</param>
|
||||
/// <returns>An <see cref="IFindFluent{TDocument, TProjection}"/> that represents the paginated queryable master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=6bbc1e5 -->
|
||||
IFindFluent<T, T> GetPaginatedMasterList(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of options associated with the specified list identifier, applying the provided pagination filter to control the result set.
|
||||
@@ -149,11 +169,13 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="filter">The pagination filter defining page size, page number, and related pagination constraints.</param>
|
||||
/// <param name="listId">The unique identifier of the list whose options should be retrieved.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="OptionList"/> items for the requested page.</returns>
|
||||
/// <!-- aidoc:v1 sig=f5b427c -->
|
||||
Task<List<OptionList>> GetPaginatedOptions(PaginationFilter filter, ObjectId listId);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of items and returns the total.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the total count of items.</returns>
|
||||
/// <!-- aidoc:v1 sig=cabd009 -->
|
||||
Task<int> Count();
|
||||
/// <summary>
|
||||
/// Retrieves a master list of <see cref="OptionList"/> entries identified by the given id, optionally applying the provided search and filtering options.
|
||||
@@ -161,5 +183,6 @@ public interface IMasterListRepository<T> : IMongoRepository<T> where T : Master
|
||||
/// <param name="id">The identifier of the master list to retrieve.</param>
|
||||
/// <param name="filterOption">Optional filter criteria used to narrow the returned options. May be <c>null</c> to return the full list without additional filtering.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="OptionList"/> items that match the specified id and filter, or an empty list if no matching entries are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=437ba17 -->
|
||||
Task<List<OptionList>> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement? filterOption);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public interface IMedicineRepository : IMongoRepository<Medicine>
|
||||
/// </summary>
|
||||
/// <param name="code">The code used to look up the medicine.</param>
|
||||
/// <returns>A task that returns the matching <see cref="Medicine"/> if found, or <c>null</c> if no medicine matches the specified code.</returns>
|
||||
/// <!-- aidoc:v1 sig=27e988f -->
|
||||
Task<Medicine?> GetMedicine(string code);
|
||||
|
||||
/// <summary>
|
||||
@@ -19,17 +20,20 @@ public interface IMedicineRepository : IMongoRepository<Medicine>
|
||||
/// </summary>
|
||||
/// <param name="codeNotes">The list of codes or notes used to look up the medicines.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of matching medicines.</returns>
|
||||
/// <!-- aidoc:v1 sig=2a2f753 -->
|
||||
Task<List<Medicine>> GetMedicineByCodeOrNote(List<string> codeNotes);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Medicine"/> entity by its name asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the medicine to look up.</param>
|
||||
/// <returns>A <see cref="Task{Medicine}"/> that resolves to the matching <see cref="Medicine"/>, or <c>null</c> if no medicine with the specified name is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=2bab729 -->
|
||||
Task<Medicine?> GetMedicineByName(string name);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all medicines from the data source.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Medicine"/> objects; an empty list is returned when no medicines are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=84b2421 -->
|
||||
Task<List<Medicine>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a medicine entity by its unique identifier from the data store.
|
||||
@@ -37,29 +41,34 @@ public interface IMedicineRepository : IMongoRepository<Medicine>
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique <see cref="ObjectId"/> of the medicine to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the matching <see cref="Medicine"/> if found, or <see langword="null"/> when no record exists for the given identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=a87fd1e -->
|
||||
Task<Medicine?> GetMedicineById(ObjectId medicineId);
|
||||
/// <summary>
|
||||
/// Asynchronously creates and posts a new medicine entry, returning the persisted <see cref="Medicine"/> on success or <c>null</c> when no result is produced.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity to be created and submitted.</param>
|
||||
/// <returns>A task that resolves to the newly created <see cref="Medicine"/>, or <c>null</c> if the operation does not yield a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=9decc93 -->
|
||||
Task<Medicine?> PostMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Updates an existing medicine record with the provided information.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity containing the updated data, typically identified by its primary key.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Medicine"/>, or <c>null</c> if no matching medicine was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=2ae8490 -->
|
||||
Task<Medicine?> UpdateMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a medicine record from the data store using the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique identifier of the medicine to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=44a1285 -->
|
||||
Task DeleteMedicineById(ObjectId medicineId);
|
||||
/// <summary>
|
||||
/// Builds a MongoDB aggregation pipeline that retrieves the distinct values for the specified field.
|
||||
/// </summary>
|
||||
/// <param name="field">The name of the field whose distinct values should be queried.</param>
|
||||
/// <returns>An <see cref="IAggregateFluent{BsonDocument}"/> representing the distinct field data query.</returns>
|
||||
/// <!-- aidoc:v1 sig=ec965d8 -->
|
||||
IAggregateFluent<BsonDocument> GetDistinctFieldDataQuery(string field);
|
||||
|
||||
/// <summary>
|
||||
@@ -67,5 +76,6 @@ public interface IMedicineRepository : IMongoRepository<Medicine>
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing the page number and page size used to control the result set.</param>
|
||||
/// <returns>A fluent query interface for the paginated medicines.</returns>
|
||||
/// <!-- aidoc:v1 sig=c603913 -->
|
||||
IFindFluent<Medicine, Medicine> GetPaginatedMedicines(PaginationFilter filter);
|
||||
}
|
||||
@@ -11,23 +11,27 @@ public interface IMongoRepository<T>
|
||||
/// Gets the name of the collection.
|
||||
/// </summary>
|
||||
/// <returns>The name of the collection.</returns>
|
||||
/// <!-- aidoc:v1 sig=a1be5ef -->
|
||||
string GetCollectionName();
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single object of type <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=f786cc1 -->
|
||||
Task InsertOneAsync(T obj);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier and returns the deleted entity.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the deleted entity of type <typeparamref name="T"/>, or <c>null</c> if no matching entity was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=e29699e -->
|
||||
Task<T?> DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing document identified by the specified identifier with the provided object data.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the document to update.</param>
|
||||
/// <param name="obj">The object containing the updated values to persist.</param>
|
||||
/// <!-- aidoc:v1 sig=3e43209 -->
|
||||
Task UpdateOneAsync(ObjectId id, T obj);
|
||||
}
|
||||
@@ -9,39 +9,46 @@ public interface INoticeRepository : IMongoRepository<Notice>
|
||||
/// Deletes the entity identified by the specified <see cref="ObjectId"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the entity to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=0112d17 -->
|
||||
Task Delete(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing notice with the provided information.
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice entity containing the updated data to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=3841eb4 -->
|
||||
Task Update(Notice notice);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all notices.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of all <see cref="Notice"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=f8ca02f -->
|
||||
Task<IEnumerable<Notice>> FindAll();
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Notice"/> by its unique identifier. Returns <c>null</c> when no matching notice is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the notice to look up.</param>
|
||||
/// <returns>A task that yields the matching <see cref="Notice"/>, or <c>null</c> if no notice exists for the specified <paramref name="id"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=da1f6f5 -->
|
||||
Task<Notice?> FindById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of notices that match the specified date.
|
||||
/// </summary>
|
||||
/// <param name="date">The date used to filter the notices to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="Notice"/> objects for the specified date, or <c>null</c> if no matching notices are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=aaaf476 -->
|
||||
Task<IEnumerable<Notice>?> FindByDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="Notice"/> entries that match the specified type.
|
||||
/// </summary>
|
||||
/// <param name="type">The notice type used to filter the lookup.</param>
|
||||
/// <returns>A task containing the matching <see cref="Notice"/> items, or <c>null</c> when no results are available.</returns>
|
||||
/// <!-- aidoc:v1 sig=64b3426 -->
|
||||
Task<IEnumerable<Notice>?> FindByType(string type);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="Notice"/> entities associated with the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayId">The display identifier used to locate the matching notices.</param>
|
||||
/// <returns>A task that yields the collection of matching <see cref="Notice"/> items, or <c>null</c> if no notices are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=08d036f -->
|
||||
Task<IEnumerable<Notice>?> FindByDisplayId(ObjectId displayId);
|
||||
}
|
||||
@@ -9,17 +9,20 @@ public interface IObservationArchiveRepository : IMongoRepository<PatientObserva
|
||||
/// Asynchronously inserts a single <see cref="PatientObservation"/> into the data store.
|
||||
/// </summary>
|
||||
/// <param name="patientObservation">The patient observation to insert.</param>
|
||||
/// <!-- aidoc:v1 sig=a11df0e -->
|
||||
new Task InsertOneAsync(PatientObservation patientObservation);
|
||||
/// <summary>
|
||||
/// Deletes the records that have a date earlier than the specified cutoff date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; records dated before this value will be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=350661d -->
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a batch of patient observation records into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="observations">The collection of <see cref="PatientObservation"/> entities to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous insert operation, returning a <see cref="long"/> value (such as the number of affected rows or a generated identifier) produced by the batch insertion.</returns>
|
||||
/// <!-- aidoc:v1 sig=713717d -->
|
||||
Task<long> InsertBatch(IEnumerable<PatientObservation> observations);
|
||||
|
||||
/// <summary>
|
||||
@@ -30,6 +33,7 @@ public interface IObservationArchiveRepository : IMongoRepository<PatientObserva
|
||||
/// <param name="lastDate">The cutoff date; only observations on or before this date are considered.</param>
|
||||
/// <param name="filterObservations">An optional list of observation names to restrict the results to; pass an empty or null list to include all observations.</param>
|
||||
/// <returns>A task that resolves to a list of <see cref="PatientObservation"/> entries representing the aggregated last observations matching the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=1fb9a10 -->
|
||||
Task<List<PatientObservation>> AggregatedPatientLastObservations(ObjectId patientId, int num, DateTime lastDate,
|
||||
List<string> filterObservations);
|
||||
|
||||
@@ -38,5 +42,6 @@ public interface IObservationArchiveRepository : IMongoRepository<PatientObserva
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose observations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservation"/> records for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=644a6c3 -->
|
||||
Task<List<PatientObservation>> FindAllFromPatient(ObjectId patientId);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="patientId">The identifier of the patient whose observations will be aggregated.</param>
|
||||
/// <param name="groupedField">The field used to group the patient's observations during aggregation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of BSON documents with the aggregated results.</returns>
|
||||
/// <!-- aidoc:v1 sig=6bf1b3d -->
|
||||
Task<List<BsonDocument>> AggregatedPatientGroupedObservations(ObjectId patientId, GroupedField groupedField);
|
||||
|
||||
/// <summary>
|
||||
@@ -26,6 +27,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="num">The maximum number of most recent observations to return.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to restrict the returned results; if null, no filter is applied.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of the patient's most recent <see cref="PatientObservation"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=eaa55e7 -->
|
||||
Task<List<PatientObservation>> AggregatedPatientLastObservations(ObjectId patientId, int num,
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
@@ -37,6 +39,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="lastDate">The cutoff date; only observations on or before this date are considered.</param>
|
||||
/// <param name="filterObservations">An optional list of observation names to restrict the results to. If null, no observation-name filter is applied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of aggregated <see cref="PatientObservation"/> entries that match the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=e0e7bb3 -->
|
||||
Task<List<PatientObservation>> AggregatedPatientLastObservationsByLastDate(ObjectId patientId, int num,
|
||||
DateTime lastDate, List<string>? filterObservations = null);
|
||||
|
||||
@@ -46,6 +49,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being retrieved.</param>
|
||||
/// <param name="filterObservations">An optional list of fields to filter the observations by; if null, observations for all fields are returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of the latest patient observations grouped by field.</returns>
|
||||
/// <!-- aidoc:v1 sig=50cede3 -->
|
||||
Task<List<PatientObservation>> AggregatedPatientLastObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations = null);
|
||||
|
||||
@@ -57,6 +61,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="code">The specific code within the coding system identifying the type of observation to retrieve.</param>
|
||||
/// <param name="num">The maximum number of most recent observations to return. Defaults to 2.</param>
|
||||
/// <returns>A task that yields a collection of the matching <see cref="PatientObservation"/> records, ordered from most recent to oldest, containing at most <paramref name="num"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=f22fd00 -->
|
||||
Task<IEnumerable<PatientObservation>> FindLastObservations(ObjectId patientId, string codingSystem, string code,
|
||||
int num = 2);
|
||||
|
||||
@@ -67,6 +72,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="codingSystem">The coding system used to filter the observations.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 10.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the patient's most recent observations matching the coding system.</returns>
|
||||
/// <!-- aidoc:v1 sig=0970f2d -->
|
||||
Task<List<PatientObservation>> FindLastObservationsByCodingSystem(ObjectId patientId, string codingSystem,
|
||||
int num = 10);
|
||||
|
||||
@@ -77,12 +83,14 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="name">The optional name of the observation to filter by. If <c>null</c>, observations of any name are considered.</param>
|
||||
/// <param name="date">The cutoff date; only observations recorded strictly before this date are eligible.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="PatientObservation"/> if found, or <c>null</c> if no observation exists before the specified date.</returns>
|
||||
/// <!-- aidoc:v1 sig=2d11f04 -->
|
||||
Task<PatientObservation?> FindLastObservationBeforeDate(ObjectId patientId, string? name, DateTime date);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the state of patient observations that have expired, applying the appropriate expiration handling to each item in the provided list.
|
||||
/// </summary>
|
||||
/// <param name="expiredObservations">The list of patient observations that have expired and require their state to be updated.</param>
|
||||
/// <!-- aidoc:v1 sig=e7ed4fa -->
|
||||
Task UpdateExpiredObservations(List<PatientObservation> expiredObservations);
|
||||
|
||||
/// <summary>
|
||||
@@ -92,6 +100,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="name">The optional name of the observation to match; if null, observations of any name are considered.</param>
|
||||
/// <param name="date">The date used to match observations recorded on the same day.</param>
|
||||
/// <returns>A task that returns a list of matching <see cref="PatientObservation"/> instances, or <c>null</c> if no matching observations are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=c14ce85 -->
|
||||
Task<List<PatientObservation>?> FindAnyWithSameDate(ObjectId patientId, string? name, DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient observations recorded for the specified patient before the given date.
|
||||
@@ -99,6 +108,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="date">The cutoff date; only observations recorded prior to this date are returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patient observations found before the specified date.</returns>
|
||||
/// <!-- aidoc:v1 sig=d6e7618 -->
|
||||
Task<List<PatientObservation>> FindAnyBeforeDate(ObjectId patientId, DateTime date);
|
||||
|
||||
/// <summary>
|
||||
@@ -108,23 +118,27 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="name">The name used to match the relevant patient observations.</param>
|
||||
/// <param name="expires">An optional expiration value in seconds used to control the time window for the lookup; if <c>null</c>, no expiration is applied.</param>
|
||||
/// <returns>A task that resolves to a list of the latest unique <see cref="PatientObservation"/> records matching the specified name for the patient. The list is empty if no matching observations are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=cd1a09e -->
|
||||
Task<List<PatientObservation>> FindLatestUniqueValuesByName(ObjectId patientId, string name, int? expires);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single <see cref="PatientObservation"/> record into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientObservation">The patient observation entity to persist.</param>
|
||||
/// <!-- aidoc:v1 sig=a11df0e -->
|
||||
new Task InsertOneAsync(PatientObservation patientObservation);
|
||||
/// <summary>
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The ObjectId of the patient whose related records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=d457cb9 -->
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of patient observations associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an <see cref="IAsyncCursor{TDocument}"/> of <see cref="PatientObservation"/> instances to iterate through the matching records.</returns>
|
||||
/// <!-- aidoc:v1 sig=39ad19b -->
|
||||
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAsync(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
@@ -135,6 +149,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="codingSystem">The coding system used to classify the observations (e.g., LOINC, SNOMED).</param>
|
||||
/// <param name="name">The name of the observation to filter within the coding system.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields an <see cref="IAsyncCursor{TDocument}"/> streaming the matching <see cref="PatientObservation"/> documents.</returns>
|
||||
/// <!-- aidoc:v1 sig=d7bdee5 -->
|
||||
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAndCodingSystemAsync(ObjectId patientId, string codingSystem,
|
||||
string name);
|
||||
|
||||
@@ -143,6 +158,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=9f8dfa3 -->
|
||||
new Task DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes patient observations older than the specified retention period and returns the records that were removed.
|
||||
@@ -150,6 +166,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="name">The identifier used to locate the relevant patient observations to be evaluated for deletion.</param>
|
||||
/// <param name="retentionPolicyValue">The retention period in days; observations older than this value will be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the deleted <see cref="PatientObservation"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=221fcb6 -->
|
||||
Task<List<PatientObservation>> DeleteOlderDaysAsync(string name, int retentionPolicyValue);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes patient observations based on the specified name and retention policy value.
|
||||
@@ -157,6 +174,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="name">The name used to identify or filter the patient observations to be deleted.</param>
|
||||
/// <param name="retentionPolicyValue">The retention policy threshold value that determines which older observations should be removed.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the list of patient observations that were deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=7338971 -->
|
||||
Task<List<PatientObservation>> DeleteOlderNumberAsync(string name, int retentionPolicyValue);
|
||||
/// <summary>
|
||||
/// Asynchronously checks whether a record exists for the specified patient identified by the given system identifier.
|
||||
@@ -164,6 +182,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="patientid">The unique identifier of the patient whose record is being checked.</param>
|
||||
/// <param name="systemId">The system identifier used to look up the patient's record.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if a matching record exists; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d900b6f -->
|
||||
Task<bool> ExistBySystemId(ObjectId patientid, string systemId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes patient observations older than the specified number of seconds and returns the affected records.
|
||||
@@ -171,17 +190,20 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="name">The name used to identify the patient observations to filter for deletion.</param>
|
||||
/// <param name="value">The age threshold in seconds; observations older than this value will be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of deleted patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=5df4a1a -->
|
||||
Task<List<PatientObservation>> DeleteOlderSecondsAsync(string name, int value);
|
||||
/// <summary>
|
||||
/// Retrieves the aggregated active intravenous lines observations for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active intravenous lines observations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservation"/> entries representing the patient's active intravenous lines observations, where each entry may be null.</returns>
|
||||
/// <!-- aidoc:v1 sig=d7ee355 -->
|
||||
Task<List<PatientObservation?>> AggregatedPatientActiveIntravenousLinesObservations(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent observation timestamp for every patient, returning a mapping of patient identifiers to their last observation times.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a dictionary where each key is a patient <see cref="ObjectId"/> and the associated value is the date and time of that patient's last observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=cbcaa4c -->
|
||||
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime();
|
||||
|
||||
/// <summary>
|
||||
@@ -189,6 +211,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient observation to locate.</param>
|
||||
/// <returns>A <see cref="Task{PatientObservation}"/> that resolves to the matching <see cref="PatientObservation"/>, or <c>null</c> if no observation exists for the given identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=1d8d07e -->
|
||||
Task<PatientObservation?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -196,11 +219,13 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose observations are being retrieved.</param>
|
||||
/// <returns>A task containing a list of <see cref="PatientObservation"/> objects for the specified patient, or null if no observations are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=331eec2 -->
|
||||
Task<List<PatientObservation>?> FindByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Updates an existing patient observation with the provided data.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation containing the updated information to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=86309e7 -->
|
||||
Task Update(PatientObservation observation);
|
||||
/// <summary>
|
||||
/// Updates many records by replacing the specified old ObjectId with the new ObjectId identified by the given name.
|
||||
@@ -208,6 +233,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="nameId">The name identifier used to locate the target collection or field to update.</param>
|
||||
/// <param name="id">The new ObjectId to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId that identifies the records to be updated.</param>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
|
||||
/// <summary>
|
||||
@@ -215,6 +241,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// </summary>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to narrow the result set. May be null or contain null entries.</param>
|
||||
/// <returns>A task that resolves to a collection of non-expired <see cref="PatientObservation"/> instances matching the filter criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=dc784c5 -->
|
||||
Task<IEnumerable<PatientObservation>> FindNotExpired(List<string?>? filterObservations);
|
||||
|
||||
/// <summary>
|
||||
@@ -223,6 +250,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="name">The name used to look up the patient observations.</param>
|
||||
/// <param name="date">The optional date used to filter the observations; when null, results are not restricted by date.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="PatientObservation"/> entries that match the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=239fa0e -->
|
||||
Task<IEnumerable<PatientObservation>> FindByName(string name, DateTime? date);
|
||||
|
||||
/// <summary>
|
||||
@@ -230,18 +258,22 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// </summary>
|
||||
/// <param name="patientObservations">The collection of patient observations to update.</param>
|
||||
/// <param name="update">The update definition describing the modifications to apply to each patient observation.</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states documents are updated because they 'match the provided update definition', but the update definition describes modifications, not a filter. The method takes an explicit collection of patient observations and applies the update to each, rather than matching documents by the update definition." -->
|
||||
Task UpdateMany(IEnumerable<PatientObservation> patientObservations, UpdateDefinition<PatientObservation> update);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all patient observation records.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a collection of <see cref="PatientObservation"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=e3a2156 -->
|
||||
Task<IEnumerable<PatientObservation>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously processes and expires the specified configuration observations that have met their expiration criteria.
|
||||
/// </summary>
|
||||
/// <param name="configObservationsToExpire">The list of configuration observations to expire.</param>
|
||||
/// <!-- aidoc:v1 sig=2a24be0 -->
|
||||
Task ExpireExpiredObservations(List<ConfigObservation> configObservationsToExpire);
|
||||
//Task<PaginationResponse<PatientObservation>> GetPaginatedObservations(PaginationFilter filter);
|
||||
|
||||
@@ -250,6 +282,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and sorting criteria applied to the observations.</param>
|
||||
/// <returns>An <see cref="IFindFluent{TSource, TDocument}"/> for <see cref="PatientObservation"/> that allows further refinement and execution of the paginated query.</returns>
|
||||
/// <!-- aidoc:v1 sig=e6754ed -->
|
||||
IFindFluent<PatientObservation, PatientObservation> GetPaginatedObservations(PaginationFilter filter);
|
||||
|
||||
/// <summary>
|
||||
@@ -260,6 +293,7 @@ public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
/// <param name="endAfter">Optional pagination cursor indicating the number of results to skip.</param>
|
||||
/// <param name="num">Optional maximum number of observations to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of matching <see cref="PatientObservation"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=ba8e6f1 -->
|
||||
Task<IEnumerable<PatientObservation>> FindLastNotExpiredObservatonsByPatient(ObjectId patientId, string name,
|
||||
int? endAfter = null, int? num = null);
|
||||
}
|
||||
@@ -10,12 +10,14 @@ public interface IPatientArchiveRepository : IMongoRepository<Patient>
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the patient.</param>
|
||||
/// <returns>A <see cref="Patient"/> instance if a match is found; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=fc426b5 -->
|
||||
Task<Patient?> FindByPatientNumber(string patientNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all patients from the data source.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="Patient"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=350dff6 -->
|
||||
Task<List<Patient>> FindAll();
|
||||
/// <summary>
|
||||
/// Searches for a patient by patient number within a specific distinct unit.
|
||||
@@ -23,5 +25,6 @@ public interface IPatientArchiveRepository : IMongoRepository<Patient>
|
||||
/// <param name="patientNumber">The patient number used to locate the patient.</param>
|
||||
/// <param name="unitId">The identifier of the distinct unit in which to perform the search.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=1d70651 -->
|
||||
Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
}
|
||||
@@ -10,17 +10,20 @@ public interface IPatientCarePlanRepository : IMongoRepository<PatientCarePlan>
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose care plans are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> records for the patient, or an empty list if no care plans are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6525ef9 -->
|
||||
Task<List<PatientCarePlan>> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of patient care plans associated with the specified user identifier.
|
||||
/// </summary>
|
||||
/// <param name="userId">The unique identifier of the user whose patient care plans are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects linked to the specified user.</returns>
|
||||
/// <!-- aidoc:v1 sig=150426f -->
|
||||
Task<List<PatientCarePlan>> FindByUserId(ObjectId userId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient care plans from the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of all <see cref="PatientCarePlan"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=83af170 -->
|
||||
Task<List<PatientCarePlan>> FindAll();
|
||||
/// <summary>
|
||||
/// Updates all records that reference the specified old ObjectId so they are associated with the new patient ObjectId.
|
||||
@@ -28,5 +31,6 @@ public interface IPatientCarePlanRepository : IMongoRepository<PatientCarePlan>
|
||||
/// <param name="patientid">The string identifier of the patient whose related records will be updated.</param>
|
||||
/// <param name="patientId">The new ObjectId that will replace the previous identifier in the matching records.</param>
|
||||
/// <param name="oldId">The previous ObjectId whose references should be replaced across the matching records.</param>
|
||||
/// <!-- aidoc:v1 sig=7e33b89 -->
|
||||
Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId);
|
||||
}
|
||||
@@ -14,36 +14,42 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// Deletes the item identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the item to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=0112d17 -->
|
||||
Task Delete(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Patient"/> associated with the specified location, or <see langword="null"/> if no patient is found at that location.
|
||||
/// </summary>
|
||||
/// <param name="location">The location used to look up the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Patient"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=f818833 -->
|
||||
Task<Patient?> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Retrieves a patient by their unique identifier, returning <c>null</c> when no matching patient exists.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique <see cref="ObjectId"/> of the patient to look up.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the matching <see cref="Patient"/>, or <c>null</c> if no patient is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=bff0af8 -->
|
||||
Task<Patient?> FindById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the location of a patient identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose location is to be updated.</param>
|
||||
/// <param name="location">The new patient location data to apply to the existing record.</param>
|
||||
/// <!-- aidoc:v1 sig=80c429e -->
|
||||
Task UpdateLocation(ObjectId id, PatientLocation location);
|
||||
/// <summary>
|
||||
/// Updates the location of the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the entity whose location will be updated.</param>
|
||||
/// <param name="location">The identifier of the new location to associate with the entity.</param>
|
||||
/// <!-- aidoc:v1 sig=6663fab -->
|
||||
Task UpdateLocation(ObjectId id, ObjectId location);
|
||||
/// <summary>
|
||||
/// Updates the attending doctor for the record identified by the specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the record whose attending doctor will be updated.</param>
|
||||
/// <param name="attendingDoctor">The person to be set as the new attending doctor.</param>
|
||||
/// <!-- aidoc:v1 sig=08253ac -->
|
||||
Task UpdateAttendingDoctor(ObjectId id, Person attendingDoctor);
|
||||
/// <summary>
|
||||
/// Updates the patient data identified by the specified id, optionally updating the patient number when <paramref name="updatePatientNumber"/> is true.
|
||||
@@ -52,11 +58,13 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// <param name="patientNumber">The patient number associated with the patient.</param>
|
||||
/// <param name="data">The new person data to apply to the patient record.</param>
|
||||
/// <param name="updatePatientNumber">Indicates whether the patient number should be updated; defaults to true.</param>
|
||||
/// <!-- aidoc:v1 sig=c9778ad -->
|
||||
Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true);
|
||||
/// <summary>
|
||||
/// Updates the information of an existing patient in the system.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity containing the updated information to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=0688359 -->
|
||||
Task Update(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Patient"/> by their unique patient number.
|
||||
@@ -64,68 +72,83 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the patient.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the matching <see cref="Patient"/>, or <c>null</c> if no patient is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=fc426b5 -->
|
||||
Task<Patient?> FindByPatientNumber(string patientNumber);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Patient"/> that matches the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="Patient"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=6132bff -->
|
||||
Task<Patient?> FindByPatientId(string patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all <see cref="Patient"/> records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="Patient"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=350dff6 -->
|
||||
Task<List<Patient>> FindAll();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patients associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care identifier used to filter patients.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patients matching the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=c2cb9ce -->
|
||||
Task<List<Patient>> FindByPointOfCare(string pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of patients associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The unique identifier of the point of care used to filter patients.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of patients matching the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=a0a7e87 -->
|
||||
Task<List<Patient>> FindByPointOfCare(ObjectId pointOfCare);
|
||||
/// <summary>
|
||||
/// Retrieves a patient by their point-of-care identifier, returning <c>null</c> when no matching patient is found.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The unique identifier of the point-of-care location used to look up the patient.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Patient"/>, or <c>null</c> if no patient is associated with the specified point-of-care id.</returns>
|
||||
/// <!-- aidoc:v1 sig=dd213b7 -->
|
||||
Task<Patient?> FindByPointOfCareId(ObjectId pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patients who have been discharged.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of discharged <see cref="Patient"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=16d2227 -->
|
||||
Task<List<Patient>> FindDischargedPatients();
|
||||
/// <summary>
|
||||
/// Updates an existing patient record and returns the updated patient, or <see langword="null"/> if the patient was not found.
|
||||
/// </summary>
|
||||
/// <param name="updatedPatient">The patient containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Patient"/>, or <see langword="null"/> if no matching patient exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=1b69c26 -->
|
||||
Task<Patient?> UpdateOne(Patient updatedPatient);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patients who have an inactive Point of Care (PoC) assignment.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Patient"/> objects with inactive PoC status.</returns>
|
||||
/// <!-- aidoc:v1 sig=1eb056c -->
|
||||
Task<List<Patient>> FindInActivePoC();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patients who are currently marked as inactive points of contact (PoC).
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of inactive PoC patients.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The method name 'FindInActivePoC' uses PascalCase with a capital 'A' in 'Active', indicating two separate words 'In Active' (i.e., patients currently in an active PoC status), not 'Inactive'. The documentation describes finding 'inactive PoC' patients, which contradicts the method name." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "The <returns> description says 'a list of inactive PoC patients', but per the method name's PascalCase the result should be a list of patients in an active PoC." -->
|
||||
Task<List<Patient>> FindInInactivePoC();
|
||||
/// <summary>
|
||||
/// Retrieves a list of patients whose records have not been updated since the specified date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; patients last updated before this date will be included in the result.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Patient"/> objects that have not been updated since the specified date.</returns>
|
||||
/// <!-- aidoc:v1 sig=25a6510 -->
|
||||
Task<List<Patient>> FindPatientsNotUpdatedSince(DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient from the data store by their unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if one is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=571fb89 -->
|
||||
Task<Patient?> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Updates the incoming data for the specified patient and returns the updated patient record.
|
||||
@@ -133,6 +156,7 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// <param name="patientId">The unique identifier of the patient whose incoming data should be updated.</param>
|
||||
/// <param name="person">The patient object containing the incoming data to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Patient"/>, or <c>null</c> if the patient was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=367d157 -->
|
||||
Task<Patient?> UpdatePatientIncomingData(ObjectId patientId, Patient person);
|
||||
/// <summary>
|
||||
/// Updates the demographic data of an existing patient identified by the given identifier.
|
||||
@@ -140,6 +164,7 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// <param name="patientId">The unique identifier of the patient whose demographic data is to be updated.</param>
|
||||
/// <param name="person">The patient object containing the updated demographic information.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Patient"/>, or <c>null</c> if the patient was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=381b38d -->
|
||||
Task<Patient?> UpdatePatientDemographicData(ObjectId patientId, Patient person);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the patient matching the specified unit and point of care identifier.
|
||||
@@ -147,12 +172,14 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// <param name="unit">The identifier of the unit used to locate the patient.</param>
|
||||
/// <param name="pointOfCare">The point of care identifier used together with the unit to locate the patient.</param>
|
||||
/// <returns>A task that resolves to the <see cref="Patient"/> associated with the given unit and point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=47b83cd -->
|
||||
Task<Patient> FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the total count of records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose associated records should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total count of matching records.</returns>
|
||||
/// <!-- aidoc:v1 sig=e0dfc62 -->
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously searches for a patient by their patient number within a specific unit, ensuring the patient is associated with a distinct unit.
|
||||
@@ -160,30 +187,35 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// <param name="patientNumber">The unique patient number used to identify the patient.</param>
|
||||
/// <param name="unitId">The identifier of the unit to constrain the search to a distinct unit context.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=1d70651 -->
|
||||
Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent query of patients based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines page size, page number, and additional criteria applied to the patient query.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Patient, Patient}"/> representing the paginated patient query that can be further composed before execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=206a5f3 -->
|
||||
IFindFluent<Patient, Patient> GetPaginatedPatients(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patients who have completed procedures, filtering by the number of minutes that have elapsed since the procedure end date for archival purposes.
|
||||
/// </summary>
|
||||
/// <param name="archiveProcedureEndDateAfterMinutes">The number of minutes after the procedure end date used to determine which finished procedures are eligible for archive retrieval.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of patients with finished procedures matching the archive criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=d37257e -->
|
||||
Task<List<Patient>> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patients whose tests have finished based on the specified archive end date threshold.
|
||||
/// </summary>
|
||||
/// <param name="archiveTestEndDateAfterMinutes">The number of minutes after which a test is considered finished and eligible for retrieval.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patients with finished tests.</returns>
|
||||
/// <!-- aidoc:v1 sig=bde5551 -->
|
||||
Task<List<Patient>> FindAllPatientWithFinishedTests(int archiveTestEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Retrieves all patients whose treatment has been finished and is eligible for archival based on the specified end date threshold.
|
||||
/// </summary>
|
||||
/// <param name="archiveTreatmentEndDateAfterMinutes">The number of minutes after the treatment end date used as the archival threshold.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patients with finished treatments that meet the archival criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=bef780c -->
|
||||
Task<List<Patient>> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Updates a master list option for the specified units and returns the patients affected by the change.
|
||||
@@ -192,6 +224,7 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// <param name="opt">The DTO containing the master list option update details.</param>
|
||||
/// <param name="typeName">The name of the option type being updated.</param>
|
||||
/// <returns>A task that resolves to the list of patients impacted by the master list option update.</returns>
|
||||
/// <!-- aidoc:v1 sig=56aa456 -->
|
||||
Task<List<Patient>> UpdateMasterListOption(List<ObjectId> unitIds, UpdateOptionMasterListDto opt, string typeName);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of <see cref="Patient"/> objects associated with the specified unit identifiers and patient type.
|
||||
@@ -199,6 +232,7 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// <param name="unitIds">The list of unit identifiers used to filter the patients to be returned.</param>
|
||||
/// <param name="typeName">The name of the patient type used to further refine the query results.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing a list of <see cref="Patient"/> objects matching the provided unit identifiers and type.</returns>
|
||||
/// <!-- aidoc:v1 sig=0c3ac7e -->
|
||||
Task<List<Patient>> GetPatientsByUnitIds(List<ObjectId> unitIds, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes the specified master list option and returns the patients affected by its removal.
|
||||
@@ -207,5 +241,6 @@ public interface IPatientRepository : IMongoRepository<Patient>
|
||||
/// <param name="opt">The master list option to remove.</param>
|
||||
/// <param name="typeName">The name of the master list type to which the option belongs.</param>
|
||||
/// <returns>A task that yields the collection of patients impacted by deleting the master list option.</returns>
|
||||
/// <!-- aidoc:v1 sig=263b587 -->
|
||||
Task<IEnumerable<Patient>> DeleteMasterListOption(List<ObjectId> unitIds, OptionList opt, string typeName);
|
||||
}
|
||||
@@ -10,10 +10,12 @@ public interface IPoCMappingRepository
|
||||
/// </summary>
|
||||
/// <param name="key">The key used to look up the <see cref="PoCMapping"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="PoCMapping"/> if found, or <c>null</c> if no mapping exists for the specified key.</returns>
|
||||
/// <!-- aidoc:v1 sig=84febd1 -->
|
||||
Task<PoCMapping?> FindByKey(string key);
|
||||
/// <summary>
|
||||
/// Retrieves the name of the collection associated with the current context or entity.
|
||||
/// </summary>
|
||||
/// <returns>The collection name as a string.</returns>
|
||||
/// <!-- aidoc:v1 sig=a1be5ef -->
|
||||
string GetCollectionName();
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public interface IPoCSettingsRepository : IMongoRepository<PoCSettings>
|
||||
/// Asynchronously deletes the entity identified by the specified <see cref="ObjectId"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the entity to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=0112d17 -->
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -17,6 +18,7 @@ public interface IPoCSettingsRepository : IMongoRepository<PoCSettings>
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to look up the corresponding PoC settings.</param>
|
||||
/// <returns>A task that returns the matching <see cref="PoCSettings"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=5eb997f -->
|
||||
Task<PoCSettings?> FindByLocation(PatientLocation location);
|
||||
|
||||
/// <summary>
|
||||
@@ -24,6 +26,7 @@ public interface IPoCSettingsRepository : IMongoRepository<PoCSettings>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the PoC settings to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result contains the matching <see cref="PoCSettings"/> if found, or <c>null</c> when no settings exist for the given identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=2527bbc -->
|
||||
Task<PoCSettings?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -31,11 +34,13 @@ public interface IPoCSettingsRepository : IMongoRepository<PoCSettings>
|
||||
/// </summary>
|
||||
/// <param name="pocSettings">The PoC settings to be applied.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=6d3c931 -->
|
||||
Task Update(PoCSettings pocSettings);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all <see cref="PoCSettings"/> records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="PoCSettings"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=b718f84 -->
|
||||
Task<List<PoCSettings>> FindAll();
|
||||
}
|
||||
@@ -14,12 +14,14 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// Asynchronously deletes the entity identified by the specified <paramref name="id"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the entity to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=0112d17 -->
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the specified <see cref="PointOfCare"/> entity.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The <see cref="PointOfCare"/> instance containing the updated data to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=3647fc3 -->
|
||||
Task Update(PointOfCare pointOfCare);
|
||||
|
||||
/// <summary>
|
||||
@@ -27,6 +29,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the object whose unit will be updated.</param>
|
||||
/// <param name="unit">The unit value to apply to the object.</param>
|
||||
/// <!-- aidoc:v1 sig=d53662b -->
|
||||
Task UpdateUnitId(ObjectId id, Unit unit);
|
||||
|
||||
/// <summary>
|
||||
@@ -34,6 +37,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the point of care configuration to update.</param>
|
||||
/// <param name="configuration">The new configuration values to apply to the existing point of care record.</param>
|
||||
/// <!-- aidoc:v1 sig=92922a6 -->
|
||||
Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration);
|
||||
|
||||
/// <summary>
|
||||
@@ -41,6 +45,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the point of care to locate.</param>
|
||||
/// <returns>A task that yields the matching <see cref="PointOfCare"/>, or <c>null</c> if no record exists for the given identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=f01a187 -->
|
||||
Task<PointOfCare?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -48,6 +53,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="unit">The <see cref="ObjectId"/> of the unit whose points of care should be returned.</param>
|
||||
/// <returns>A task that yields an <see cref="IEnumerable{T}"/> of <see cref="PointOfCare"/> for the matching unit, or <c>null</c> when no results are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=d969dd8 -->
|
||||
Task<IEnumerable<PointOfCare>?> FindAllByUnitId(ObjectId unit);
|
||||
|
||||
/// <summary>
|
||||
@@ -55,6 +61,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="room">The room identifier used to look up the corresponding points of care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is a collection of <see cref="PointOfCare"/> matching the specified room, or <see langword="null"/> if no matching points of care are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4637691 -->
|
||||
Task<IEnumerable<PointOfCare>?> FindByRoom(string room);
|
||||
|
||||
/// <summary>
|
||||
@@ -63,6 +70,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// <param name="filter">The filter definition used to match <see cref="PointOfCare"/> entities in the data store.</param>
|
||||
/// <param name="projection">An optional projection definition that limits or shapes the fields returned in each result. If <c>null</c>, the full <see cref="PointOfCare"/> entity is returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PointOfCare"/> entities that satisfy the filter. Returns an empty list when no matching entities are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=e2b8c68 -->
|
||||
Task<List<PointOfCare>> FindByFilter(FilterDefinition<PointOfCare> filter,
|
||||
ProjectionDefinition<PointOfCare>? projection = null);
|
||||
|
||||
@@ -71,22 +79,26 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="bed">The bed identifier used to look up the associated points of care.</param>
|
||||
/// <returns>A task that yields an <see cref="IEnumerable{T}"/> of <see cref="PointOfCare"/> when matches exist, or <c>null</c> if none are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=604796d -->
|
||||
Task<IEnumerable<PointOfCare>?> FindByBed(string bed);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available points of care.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is a list of <see cref="PointOfCare"/> instances, or <c>null</c> if no points of care are available.</returns>
|
||||
/// <!-- aidoc:v1 sig=78b96d6 -->
|
||||
Task<List<PointOfCare>?> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves all Point of Care configurations available in the system.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a list of <see cref="PointOfCare"/> configurations, or <c>null</c> if no configurations are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=2c3ec18 -->
|
||||
Task<List<PointOfCare>?> GetAllConfigs();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all Point of Care location information.
|
||||
/// </summary>
|
||||
/// <returns>A task that resolves to a list of <see cref="PointOfCare"/> locations, or <c>null</c> if no location data is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=591d801 -->
|
||||
Task<List<PointOfCare>?> GetAllLocationInfo();
|
||||
|
||||
/// <summary>
|
||||
@@ -95,6 +107,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="pocId">The unique identifier of the Point of Care whose configuration is being requested.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="PointOfCare"/> configuration, or null if no configuration is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=d108b88 -->
|
||||
Task<PointOfCare?> GetPoCConfiguration(ObjectId pocId);
|
||||
|
||||
|
||||
@@ -104,6 +117,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// <param name="bed">The bed identifier used to locate the point of care; may be <see langword="null"/>.</param>
|
||||
/// <param name="unitId">The identifier of the unit in which the bed is located.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="PointOfCare"/>, or <see langword="null"/> if none is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=bcdaa77 -->
|
||||
Task<PointOfCare?> FindByBedAndUnitId(string? bed, ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
@@ -111,6 +125,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="patientLocation">The patient location used to look up the corresponding point of care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="PointOfCare"/>, or <c>null</c> if no point of care is found for the given patient location.</returns>
|
||||
/// <!-- aidoc:v1 sig=9158434 -->
|
||||
Task<PointOfCare?> FindByPatientLocation(PatientLocation patientLocation);
|
||||
|
||||
/// <summary>
|
||||
@@ -121,6 +136,7 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// <param name="status">The point-of-care status used to filter the results.</param>
|
||||
/// <param name="excludeVirtual">When set to <c>true</c>, virtual points of care are excluded from the returned collection.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{PointOfCare}"/> of points of care matching the specified unit and status.</returns>
|
||||
/// <!-- aidoc:v1 sig=cdc58d5 -->
|
||||
Task<IEnumerable<PointOfCare>> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare status,
|
||||
bool excludeVirtual = false);
|
||||
|
||||
@@ -129,12 +145,14 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="pocId">The unique identifier of the point of contact whose relay configuration is being updated.</param>
|
||||
/// <param name="relayConfig">The collection of relay entries to apply to the configuration.</param>
|
||||
/// <!-- aidoc:v1 sig=c7679db -->
|
||||
Task UpdateRelayConfig(ObjectId pocId, List<Relay> relayConfig);
|
||||
/// <summary>
|
||||
/// Updates the relay configuration for the specified point of configuration (POC) using the provided list of relay configuration identifiers.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The unique identifier of the point of configuration whose relay configuration will be updated.</param>
|
||||
/// <param name="relayConfig">The list of relay configuration identifiers to apply to the specified POC.</param>
|
||||
/// <!-- aidoc:v1 sig=ed2237d -->
|
||||
Task UpdateRelayConfig(ObjectId pocId, List<ObjectId> relayConfig);
|
||||
|
||||
/// <summary>
|
||||
@@ -142,24 +160,28 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines paging parameters such as page number and page size.</param>
|
||||
/// <returns>An <see cref="IFindFluent{PointOfCare, PointOfCare}"/> representing the paginated query against the PoCs collection.</returns>
|
||||
/// <!-- aidoc:v1 sig=0fe74b2 -->
|
||||
IFindFluent<PointOfCare, PointOfCare> GetPaginatedPoCs(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of entities associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit used to filter the entities to be counted.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing the total count of matching entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=e0dfc62 -->
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of virtuals associated with the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose virtuals will be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the count of virtuals for the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=abeaf32 -->
|
||||
Task<long> CountVirtualsByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Deletes multiple records associated with the specified unit identifier asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose related records should be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean value indicating whether the deletion was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=903a910 -->
|
||||
Task<bool> DeleteManyByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="PointOfCare"/> entity by its identifier, including all associated configuration data.
|
||||
@@ -167,26 +189,31 @@ public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the point of care to retrieve.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="PointOfCare"/> with all configuration, or <see langword="null"/> if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=810206b -->
|
||||
Task<PointOfCare?> FindByIdAllConfig(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of camera identifiers that are currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a hash set of <see cref="ObjectId"/> values for all cameras in use.</returns>
|
||||
/// <!-- aidoc:v1 sig=5635e4a -->
|
||||
Task<HashSet<ObjectId>> FindAllIdCamerasInUse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all ID relays that are currently in use, returning them as a hash set for efficient lookup.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a hash set of the <see cref="ObjectId"/> values of all ID relays currently in use.</returns>
|
||||
/// <!-- aidoc:v1 sig=a6e513b -->
|
||||
Task<HashSet<ObjectId>> FindAllIdRelaysInUse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of all ID beacons that are currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="HashSet{ObjectId}"/> with the identifiers of all ID beacons currently in use.</returns>
|
||||
/// <!-- aidoc:v1 sig=3084f59 -->
|
||||
Task<HashSet<ObjectId>> FindAllIdBeaconsInUse();
|
||||
/// <summary>
|
||||
/// Retrieves all points of care associated with the specified unit identifier, including their related devices.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose points of care and associated devices are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of points of care with their associated devices, or <c>null</c> if no points of care are found for the specified unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=dbf2769 -->
|
||||
Task<IEnumerable<PointOfCare>?> FindAllByUnitIdWithDevices(ObjectId unitId);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ public interface IPumpAlarmEventRepository
|
||||
/// Asynchronously inserts a pump alarm event into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="alarmEvent">The pump alarm event to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=28b5d03 -->
|
||||
Task InsertAsync(PumpAlarmEvent alarmEvent);
|
||||
|
||||
/// <summary>
|
||||
@@ -19,6 +20,7 @@ public interface IPumpAlarmEventRepository
|
||||
/// <param name="to">Optional end of the date range used to filter the events.</param>
|
||||
/// <param name="limit">Optional maximum number of alarm events to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of pump alarm events matching the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=517b04b -->
|
||||
Task<IEnumerable<PumpAlarmEvent>> FindByDeviceIdAsync(
|
||||
string deviceId,
|
||||
DateTime? from = null,
|
||||
@@ -31,6 +33,7 @@ public interface IPumpAlarmEventRepository
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose last pump alarm event is to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the most recent <see cref="PumpAlarmEvent"/> for the device, or null if none exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=7150407 -->
|
||||
Task<PumpAlarmEvent?> FindLastByDeviceIdAsync(string deviceId);
|
||||
|
||||
// cleanup
|
||||
@@ -38,6 +41,7 @@ public interface IPumpAlarmEventRepository
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose records should be deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=1e79565 -->
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
@@ -47,5 +51,6 @@ public interface IPumpAlarmEventRepository
|
||||
/// <param name="newId">The new ObjectId value to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId value used to identify the records to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the number of records that were updated.</returns>
|
||||
/// <!-- aidoc:v1 sig=2ba081a -->
|
||||
Task<long> UpdateManyObjectIdByFiledNameAsync(string fieldName, ObjectId newId, ObjectId oldId);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ public interface IPumpAlarmStateRepository
|
||||
/// <param name="alarmType">The optional alarm type to filter the search by; if <c>null</c>, no alarm type filter is applied.</param>
|
||||
/// <param name="alarmCodeMdc">The optional MDC alarm code to further filter the search; if <c>null</c>, no alarm code filter is applied.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the active <see cref="PumpAlarmState"/>, or <c>null</c> if no matching active alarm state exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=d7b60d9 -->
|
||||
Task<PumpAlarmState?> FindActiveAsync(
|
||||
string deviceId,
|
||||
PumpEnum.AlarmType? alarmType,
|
||||
@@ -24,12 +25,14 @@ public interface IPumpAlarmStateRepository
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose active pump alarm states are being queried.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a collection of active <see cref="PumpAlarmState"/> entries for the given device.</returns>
|
||||
/// <!-- aidoc:v1 sig=1cb4d36 -->
|
||||
Task<IEnumerable<PumpAlarmState>> FindAllActiveByDeviceAsync(string deviceId);
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a new active pump alarm state or updates the existing one, maintaining the current state for the alarm.
|
||||
/// </summary>
|
||||
/// <param name="state">The pump alarm state to upsert as the active record.</param>
|
||||
/// <!-- aidoc:v1 sig=3d8bd8b -->
|
||||
Task UpsertActiveAsync(PumpAlarmState state);
|
||||
|
||||
/// <summary>
|
||||
@@ -38,6 +41,7 @@ public interface IPumpAlarmStateRepository
|
||||
/// <param name="deviceId">The identifier of the device whose alarms should be removed.</param>
|
||||
/// <param name="alarmType">The optional alarm type to filter the removal; when null, all alarm types are considered.</param>
|
||||
/// <param name="alarmCodeMdc">The optional alarm code (MDC) to further filter the removal; when null, no code filter is applied.</param>
|
||||
/// <!-- aidoc:v1 sig=1a5b895 -->
|
||||
Task RemoveAsync(
|
||||
string deviceId,
|
||||
PumpEnum.AlarmType? alarmType,
|
||||
@@ -48,6 +52,7 @@ public interface IPumpAlarmStateRepository
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose related records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=1e79565 -->
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
@@ -57,5 +62,6 @@ public interface IPumpAlarmStateRepository
|
||||
/// <param name="newId">The new <see cref="ObjectId"/> value to assign.</param>
|
||||
/// <param name="oldId">The existing <see cref="ObjectId"/> value to be replaced.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous operation. The task result contains the number of documents updated.</returns>
|
||||
/// <!-- aidoc:v1 sig=dd74902 -->
|
||||
Task<long> UpdateManyObjectIdByFieldNameAsync(string fieldName, ObjectId newId, ObjectId oldId);
|
||||
}
|
||||
@@ -14,16 +14,20 @@ namespace adas_core.Application.Repositories.Interfaces
|
||||
/// <summary>
|
||||
/// Inserta una observación de bomba en la colección de archivo.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "The <param> for 'obs' (PumpObservation) is not documented." -->
|
||||
Task InsertAsync(PumpObservation obs);
|
||||
|
||||
/// <summary>
|
||||
/// Inserta múltiples observaciones en la colección de archivo.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0c99da2 -->
|
||||
Task InsertManyAsync(IEnumerable<PumpObservation> observations);
|
||||
|
||||
/// <summary>
|
||||
/// Búsqueda por paciente para auditoría o restauración.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5956bf6 -->
|
||||
Task<IEnumerable<PumpObservation>> FindByPatientIdAsync(ObjectId patientId,
|
||||
DateTime? from = null, DateTime? to = null, int? limit = null);
|
||||
}
|
||||
|
||||
@@ -9,11 +9,13 @@ public interface IPumpObservationRepository
|
||||
/// Asynchronously inserts a pump observation into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation entity to persist.</param>
|
||||
/// <!-- aidoc:v1 sig=7782312 -->
|
||||
Task InsertAsync(PumpObservation obs);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a collection of pump observations into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="observations">The collection of <see cref="PumpObservation"/> records to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=0c99da2 -->
|
||||
Task InsertManyAsync(IEnumerable<PumpObservation> observations);
|
||||
|
||||
/// <summary>
|
||||
@@ -24,6 +26,7 @@ public interface IPumpObservationRepository
|
||||
/// <param name="to">Optional inclusive upper bound for the observation timestamp; when null, no upper bound is applied.</param>
|
||||
/// <param name="limit">Optional maximum number of observations to return; when null, all matching observations are returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, yielding an enumerable collection of <see cref="PumpObservation"/> instances matching the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=3f079d3 -->
|
||||
Task<IEnumerable<PumpObservation>> FindByDeviceIdAsync(
|
||||
string deviceId,
|
||||
DateTime? from = null,
|
||||
@@ -35,11 +38,13 @@ public interface IPumpObservationRepository
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose last observation is being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the last <see cref="PumpObservation"/> for the device, or <c>null</c> if no observation exists for the given device.</returns>
|
||||
/// <!-- aidoc:v1 sig=2ce7df1 -->
|
||||
Task<PumpObservation?> FindLastByDeviceIdAsync(string deviceId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent observation time for all patients, returning a mapping of patient identifiers to their last observation timestamps.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a dictionary where each key is a patient <see cref="ObjectId"/> and the associated value is the <see cref="DateTime"/> of that patient's last observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=57fe6bb -->
|
||||
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTimeAsync();
|
||||
|
||||
/// <summary>
|
||||
@@ -47,6 +52,7 @@ public interface IPumpObservationRepository
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose pump observations are being queried. May be <see langword="null"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the collection of <see cref="PumpObservation"/> items found for the patient, or an empty collection if no observations are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=882efc8 -->
|
||||
Task<IEnumerable<PumpObservation>> FindByPatientId(ObjectId? patientId);
|
||||
|
||||
/// <summary>
|
||||
@@ -55,11 +61,13 @@ public interface IPumpObservationRepository
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="num">The maximum number of observations to return. Defaults to 100.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the patient's most recent <see cref="PumpObservation"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=c2169af -->
|
||||
Task<List<PumpObservation>> AggregatedPatientLastObservations(ObjectId patientId, int num = 100);
|
||||
/// <summary>
|
||||
/// Deletes all records associated with the specified patient identifier. If the patient identifier is null, no deletion is performed.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The optional patient identifier whose related records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=c3af748 -->
|
||||
Task DeleteByPatientId(ObjectId? patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records older than the specified number of days, optionally filtered by name, and returns the number of items removed.
|
||||
@@ -67,12 +75,14 @@ public interface IPumpObservationRepository
|
||||
/// <param name="days">The age threshold in days; only records older than this value will be deleted.</param>
|
||||
/// <param name="name">An optional name used to filter which records are targeted for deletion. If null, deletion applies to all records regardless of name.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing the total count of deleted records.</returns>
|
||||
/// <!-- aidoc:v1 sig=83b8dc2 -->
|
||||
Task<long> DeleteOlderThanDaysAsync(int days, string? name = null);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes items, retaining only the most recent <paramref name="maxCount"/> entries, and returns the number of items that were removed.
|
||||
/// </summary>
|
||||
/// <param name="maxCount">The maximum number of most recent items to keep after the deletion.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the count of items that were deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=2548ed6 -->
|
||||
Task<long> DeleteKeepLastNAsync(int maxCount);
|
||||
|
||||
/// <summary>
|
||||
@@ -82,5 +92,6 @@ public interface IPumpObservationRepository
|
||||
/// <param name="newId">The new ObjectId value to assign to the field.</param>
|
||||
/// <param name="oldId">The optional current ObjectId value used as a filter; when <see langword="null"/>, the update is applied without filtering by the previous value.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous operation, containing the number of records updated.</returns>
|
||||
/// <!-- aidoc:v1 sig=88b76ee -->
|
||||
Task<long> UpdateManyObjectIdByFieldAsync(string fieldName, ObjectId newId, ObjectId? oldId);
|
||||
}
|
||||
@@ -10,17 +10,20 @@ public interface IPumpStateRepository
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose pump state is being looked up.</param>
|
||||
/// <returns>A task that resolves to the PumpState if a match is found, or null if no pump state exists for the specified device.</returns>
|
||||
/// <!-- aidoc:v1 sig=ad2e179 -->
|
||||
Task<PumpState?> FindByDeviceIdAsync(string deviceId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously creates or updates a pump state record in the data store.
|
||||
/// </summary>
|
||||
/// <param name="state">The pump state to be inserted if it does not exist, or updated if it already exists.</param>
|
||||
/// <!-- aidoc:v1 sig=04c1a72 -->
|
||||
Task UpsertAsync(PumpState state);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available pump states.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of all <see cref="PumpState"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=46297e3 -->
|
||||
Task<IEnumerable<PumpState>> GetAllAsync();
|
||||
}
|
||||
@@ -8,16 +8,19 @@ public interface IRecordingAlertArchiveRepository : IMongoRepository<PatientReco
|
||||
/// Inserts a new patient recording alert into the underlying data store asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="recordingAlert">The patient recording alert to be inserted.</param>
|
||||
/// <!-- aidoc:v1 sig=f1cd52e -->
|
||||
new Task InsertOneAsync(PatientRecordingAlert recordingAlert);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records that have a date earlier than the specified threshold.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; records with a date value before this will be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=350661d -->
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Inserts a batch of <see cref="PatientRecordingAlert"/> entities into the data store in a single operation.
|
||||
/// </summary>
|
||||
/// <param name="recordingAlerts">The collection of patient recording alerts to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous batch insert operation, containing the number of affected or inserted records.</returns>
|
||||
/// <!-- aidoc:v1 sig=9f1ecad -->
|
||||
Task<long> InsertBatch(IEnumerable<PatientRecordingAlert> recordingAlerts);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public interface IRecordingAlertRepository : IMongoRepository<PatientRecordingAl
|
||||
/// <param name="patientId">The unique identifier of the patient whose recent alerts are being retrieved.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientRecordingAlert"/> entries for the patient's last observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=8f82904 -->
|
||||
Task<List<PatientRecordingAlert>> AggregatedPatientLastObservations(ObjectId patientId, int num);
|
||||
|
||||
/// <summary>
|
||||
@@ -21,17 +22,20 @@ public interface IRecordingAlertRepository : IMongoRepository<PatientRecordingAl
|
||||
/// <param name="name">The name of the observation to filter by.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 2.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="PatientRecordingAlert"/> entries representing the matching observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=4c1f7cc -->
|
||||
Task<List<PatientRecordingAlert>> FindLastObservations(ObjectId patientId, string name, int num = 2);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single <see cref="PatientRecordingAlert"/> into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientRecordingAlert">The patient recording alert to be inserted.</param>
|
||||
/// <!-- aidoc:v1 sig=95f54d7 -->
|
||||
new Task InsertOneAsync(PatientRecordingAlert patientRecordingAlert);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records older than the specified number of days, identified by the given name.
|
||||
/// </summary>
|
||||
/// <param name="name">The identifier or key used to locate the records to be evaluated for deletion.</param>
|
||||
/// <param name="value">The age threshold, in days, used to determine which records are considered older and eligible for deletion.</param>
|
||||
/// <!-- aidoc:v1 sig=65b0e84 -->
|
||||
Task DeleteOlderDaysAsync(string name, int value);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a number record matching the specified name and value.
|
||||
@@ -39,11 +43,14 @@ public interface IRecordingAlertRepository : IMongoRepository<PatientRecordingAl
|
||||
/// <param name="name">The name associated with the number to delete.</param>
|
||||
/// <param name="value">The numeric value of the record to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Method name 'DeleteOlderNumberAsync' implies deleting a number that is older than the specified value, but the summary describes a simple equality match on name and value, omitting the 'older' comparison semantics." -->
|
||||
Task DeleteOlderNumberAsync(string name, int value);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique <see cref="ObjectId"/> of the patient whose related records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=1e79565 -->
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Updates many records by replacing the specified <paramref name="oldId"/> with the new <paramref name="id"/> within the collection identified by <paramref name="nameId"/>.
|
||||
@@ -51,11 +58,13 @@ public interface IRecordingAlertRepository : IMongoRepository<PatientRecordingAl
|
||||
/// <param name="nameId">The name or identifier of the collection in which the update is performed.</param>
|
||||
/// <param name="id">The new ObjectId to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId used to locate the records to be updated.</param>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient recording alerts associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose recording alerts are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an asynchronous cursor over the matching <see cref="PatientRecordingAlert"/> documents.</returns>
|
||||
/// <!-- aidoc:v1 sig=7bf4b99 -->
|
||||
Task<IAsyncCursor<PatientRecordingAlert>> FindByPatientIdAsync(ObjectId patientId);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public interface IRelayRepository : IMongoRepository<Relay>
|
||||
/// </summary>
|
||||
/// <param name="relayId">The unique identifier of the relay to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Relay"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=ffa341f -->
|
||||
Task<Relay?> GetById(ObjectId relayId);
|
||||
/// <summary>
|
||||
/// Retrieves the relays of the specified type from the provided configuration relay list.
|
||||
@@ -20,24 +21,28 @@ public interface IRelayRepository : IMongoRepository<Relay>
|
||||
/// <param name="configurationRelayList">The list of relay object identifiers to search through.</param>
|
||||
/// <param name="type">The relay type used to filter the configuration relay list.</param>
|
||||
/// <returns>A list of relays matching the specified type; an empty list if no relays of that type are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=f35333c -->
|
||||
List<Relay> GetRelayByTypeInList(List<ObjectId> configurationRelayList, RelayEnum.Type type);
|
||||
/// <summary>
|
||||
/// Retrieves the <see cref="Relay"/> objects that correspond to the supplied configuration relay identifiers.
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The list of <see cref="ObjectId"/> values identifying the configuration relays to look up.</param>
|
||||
/// <returns>A <see cref="List{Relay}"/> containing the relays that match the provided configuration relay identifiers.</returns>
|
||||
/// <!-- aidoc:v1 sig=8fbadfa -->
|
||||
List<Relay> GetRelayInList(List<ObjectId> configurationRelayList);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, filterable query of relays based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter used to control paging and additional query criteria for the relay lookup.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Relay, Relay}"/> representing the paginated query that can be further refined and executed.</returns>
|
||||
/// <!-- aidoc:v1 sig=af5ebe2 -->
|
||||
IFindFluent<Relay, Relay> GetPaginatedRelays(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single <see cref="Relay"/> record and returns the inserted entity, or <see langword="null"/> if the insertion did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="request">The <see cref="Relay"/> entity to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation. The result is the inserted <see cref="Relay"/>, or <see langword="null"/> when no relay is returned.</returns>
|
||||
/// <!-- aidoc:v1 sig=4bd4f3e -->
|
||||
Task<Relay?> InsertOneRelayAsync(Relay request);
|
||||
/// <summary>
|
||||
/// Updates an existing relay identified by the specified object identifier.
|
||||
@@ -45,11 +50,13 @@ public interface IRelayRepository : IMongoRepository<Relay>
|
||||
/// <param name="objectId">The unique identifier of the relay to update.</param>
|
||||
/// <param name="relay">The relay object containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated relay, or <see langword="null"/> if no relay with the specified identifier was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6c6a3e9 -->
|
||||
Task<Relay?> UpdateRelayAsync(ObjectId objectId, Relay relay);
|
||||
/// <summary>
|
||||
/// Retrieves a relay by its name asynchronously, returning null if no matching relay is found.
|
||||
/// </summary>
|
||||
/// <param name="requestRelayName">The name of the relay to look up. May be null.</param>
|
||||
/// <returns>A task that represents the asynchronous lookup. The task result contains the matching relay, or null if no relay with the specified name exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=78bca23 -->
|
||||
Task<Relay?> GetByName(string? requestRelayName);
|
||||
}
|
||||
@@ -10,12 +10,14 @@ public interface ISectionRepository : IMongoRepository<Section>
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter the sections.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the list of sections matching the specified patient location.</returns>
|
||||
/// <!-- aidoc:v1 sig=695f16c -->
|
||||
Task<List<Section>> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Section"/> by its identifier, returning <c>null</c> when no matching section is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the section to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Section"/>, or <c>null</c> if no section with the specified identifier exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=762067a -->
|
||||
Task<Section?> FindById(object id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="Section"/> that matches the specified identifier.
|
||||
@@ -23,23 +25,27 @@ public interface ISectionRepository : IMongoRepository<Section>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the section to look up.</param>
|
||||
/// <returns>A <see cref="Task{Section}"/> that resolves to the matching <see cref="Section"/>, or <c>null</c> if no section is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=5b41cb2 -->
|
||||
Task<Section?> FindById(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Section"/> that matches the specified section identifier.
|
||||
/// </summary>
|
||||
/// <param name="section">The section name or identifier used to look up the matching <see cref="Section"/>.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="Section"/>, or <c>null</c> if no section is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a21b7e6 -->
|
||||
Task<Section?> FindBySection(string section);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="Section"/> associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care identifier used to look up the section.</param>
|
||||
/// <returns>A task that returns the matching <see cref="Section"/>, or <c>null</c> if no section is found for the given point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=ddef70d -->
|
||||
Task<Section?> FindByPointOfCare(string pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all sections.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="Section"/> items.</returns>
|
||||
/// <!-- aidoc:v1 sig=9d69dd9 -->
|
||||
Task<List<Section>> GetAll();
|
||||
|
||||
/// <summary>
|
||||
@@ -47,6 +53,7 @@ public interface ISectionRepository : IMongoRepository<Section>
|
||||
/// </summary>
|
||||
/// <param name="section">The section entity containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the updated section, or null if the section was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=02e0747 -->
|
||||
Task<Section?> UpdateSection(Section section);
|
||||
//Task<Section?> UpdateSectionItems(Section section);
|
||||
//Task<Section?> UpdateSectionConfig(Section section);
|
||||
@@ -57,5 +64,6 @@ public interface ISectionRepository : IMongoRepository<Section>
|
||||
/// </summary>
|
||||
/// <param name="section">The <see cref="Section"/> instance to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the inserted <see cref="Section"/>, or <see langword="null"/> if no section was inserted.</returns>
|
||||
/// <!-- aidoc:v1 sig=cb4b0b2 -->
|
||||
Task<Section?> InsertOneSection(Section section);
|
||||
}
|
||||
@@ -11,11 +11,13 @@ public interface IServiceConfigRepository : IMongoRepository<ServiceConfig>
|
||||
/// </summary>
|
||||
/// <param name="oid">The unique identifier of the service configuration to look up.</param>
|
||||
/// <returns>A <see cref="ServiceConfig"/> matching the provided identifier, or <c>null</c> if no configuration exists for that id.</returns>
|
||||
/// <!-- aidoc:v1 sig=233d53e -->
|
||||
Task<ServiceConfig?> FindById(ObjectId oid);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="ServiceConfig"/> by its identifier, returning <see langword="null"/> when no matching configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the service configuration to look up.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="ServiceConfig"/>, or <see langword="null"/> if no configuration exists for the given id.</returns>
|
||||
/// <!-- aidoc:v1 sig=9457927 -->
|
||||
Task<ServiceConfig?> FindById(string id);
|
||||
}
|
||||
@@ -9,17 +9,20 @@ public interface ITreatmentArchiveRepository
|
||||
/// Asynchronously inserts a new patient treatment record into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientTreatment">The patient treatment entity to insert.</param>
|
||||
/// <!-- aidoc:v1 sig=95ea25e -->
|
||||
Task InsertOneAsync(PatientTreatment patientTreatment);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes items whose associated date is earlier than the specified cutoff date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; items dated before this value are removed.</param>
|
||||
/// <!-- aidoc:v1 sig=350661d -->
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a batch of <see cref="PatientTreatment"/> records.
|
||||
/// </summary>
|
||||
/// <param name="treatments">The collection of patient treatment entities to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="long"/> value associated with the batch insertion.</returns>
|
||||
/// <!-- aidoc:v1 sig=457cfa9 -->
|
||||
Task<long> InsertBatch(IEnumerable<PatientTreatment> treatments);
|
||||
|
||||
/// <summary>
|
||||
@@ -27,5 +30,6 @@ public interface ITreatmentArchiveRepository
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientTreatment"/> records for the given patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=1ec184e -->
|
||||
Task<List<PatientTreatment>> FindAllFromPatient(ObjectId patientId);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public interface ITreatmentRepository : IMongoRepository<PatientTreatment>
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{PatientTreatment}"/> of treatments for the patient; the collection is empty if no treatments are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=905ff5f -->
|
||||
Task<IEnumerable<PatientTreatment>> GetByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient treatment record from the data store that matches the specified identifier.
|
||||
@@ -19,35 +20,41 @@ public interface ITreatmentRepository : IMongoRepository<PatientTreatment>
|
||||
/// </summary>
|
||||
/// <param name="id">The unique <see cref="ObjectId"/> of the patient treatment record to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{IAsyncCursor{PatientTreatment}}"/> that yields a cursor containing the matching patient treatment, if any.</returns>
|
||||
/// <!-- aidoc:v1 sig=8d884be -->
|
||||
Task<IAsyncCursor<PatientTreatment>> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="PatientTreatment"/> record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment entity to be persisted.</param>
|
||||
/// <returns>A <see cref="Task"/> that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=289f9f5 -->
|
||||
new Task InsertOneAsync(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=9f8dfa3 -->
|
||||
new Task DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Updates an existing <see cref="PatientTreatment"/> record in the data store asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The <see cref="PatientTreatment"/> entity containing the updated information.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous update operation. The task result contains <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=e966e11 -->
|
||||
Task<bool> Update(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of <see cref="PatientTreatment"/> records associated with the specified patient identifier, returning the results as a cursor for streaming access.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being queried.</param>
|
||||
/// <returns>A task that yields an <see cref="IAsyncCursor{TDocument}"/> of <see cref="PatientTreatment"/> records matching the given patient identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=1be8597 -->
|
||||
Task<IAsyncCursor<PatientTreatment>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of patient treatments associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of <see cref="PatientTreatment"/> records for the given patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=8e33f27 -->
|
||||
Task<IEnumerable<PatientTreatment>> FindByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
@@ -55,12 +62,14 @@ public interface ITreatmentRepository : IMongoRepository<PatientTreatment>
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose record should be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the record was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=30d6841 -->
|
||||
Task<bool> DeleteByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of bolus treatments associated with the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose bolus treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientTreatment"/> entries representing the patient's bolus treatments.</returns>
|
||||
/// <!-- aidoc:v1 sig=a6b897b -->
|
||||
Task<List<PatientTreatment>> FindBolusTreatments(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Updates many records that reference a specific ObjectId, replacing the existing ObjectId with a new one.
|
||||
@@ -69,12 +78,14 @@ public interface ITreatmentRepository : IMongoRepository<PatientTreatment>
|
||||
/// <param name="nameId">The name of the field/property that contains the ObjectId reference to be updated.</param>
|
||||
/// <param name="id">The new ObjectId value that will replace the existing reference.</param>
|
||||
/// <param name="oldId">The current ObjectId value to match and be replaced.</param>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent queryable collection of patient treatments based on the provided pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing page size, page number, and other pagination criteria.</param>
|
||||
/// <returns>An <see cref="IFindFluent{TSource, TDocument}"/> for <see cref="PatientTreatment"/> that supports further fluent query composition and pagination.</returns>
|
||||
/// <!-- aidoc:v1 sig=e758e90 -->
|
||||
IFindFluent<PatientTreatment, PatientTreatment> GetPaginatedTreatments(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of active patient treatments for the specified patient, ordered according to the provided ordering criterion.
|
||||
@@ -82,5 +93,6 @@ public interface ITreatmentRepository : IMongoRepository<PatientTreatment>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active treatments are to be retrieved.</param>
|
||||
/// <param name="order">The ordering criterion applied to the returned list of treatments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of active <see cref="PatientTreatment"/> objects for the specified patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=d9fb0b1 -->
|
||||
Task<List<PatientTreatment>> GetActiveTreatmentsByPatientIdAndOrder(ObjectId patientId, string order);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ public interface IUnitRepository : IMongoRepository<Unit>
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the <see cref="Unit"/> to locate.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Unit"/>, or <c>null</c> if no entity is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=ea48821 -->
|
||||
Task<Unit?> FindById(object id);
|
||||
|
||||
/// <summary>
|
||||
@@ -22,6 +23,7 @@ public interface IUnitRepository : IMongoRepository<Unit>
|
||||
/// </summary>
|
||||
/// <param name="section">The name of the section to search for.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the unit if found; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=ede1d64 -->
|
||||
Task<Unit?> FindByName(string section);
|
||||
|
||||
//Task<Unit?> FindByPointOfCare(PointOfCare pointOfCare);
|
||||
@@ -29,18 +31,21 @@ public interface IUnitRepository : IMongoRepository<Unit>
|
||||
/// Asynchronously retrieves all available units and returns them as a list.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="Unit"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=8307d85 -->
|
||||
Task<List<Unit>> GetAll();
|
||||
/// <summary>
|
||||
/// Updates an existing unit in the underlying store and returns the updated entity.
|
||||
/// </summary>
|
||||
/// <param name="section">The unit containing the updated data to persist.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Unit"/>, or <c>null</c> when the unit cannot be found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a321fce -->
|
||||
Task<Unit?> UpdateUnit(Unit section);
|
||||
/// <summary>
|
||||
/// Inserts a single <see cref="Unit"/> record and returns the inserted entity, or <see langword="null"/> if the insertion did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="unit">The <see cref="Unit"/> entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation. The task result contains the inserted <see cref="Unit"/>, or <see langword="null"/> when no unit is returned.</returns>
|
||||
/// <!-- aidoc:v1 sig=f7169a1 -->
|
||||
Task<Unit?> InsertOneUnit(Unit unit);
|
||||
/// <summary>
|
||||
/// Retrieves the collection of units associated with the specified master list identifier and master list type.
|
||||
@@ -48,18 +53,21 @@ public interface IUnitRepository : IMongoRepository<Unit>
|
||||
/// <param name="id">The unique identifier of the master list whose units should be retrieved.</param>
|
||||
/// <param name="masterListType">The type of the master list used to filter or scope the unit lookup.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of units linked to the specified master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=0faf184 -->
|
||||
Task<IEnumerable<Unit>> FindByMasterListId(ObjectId id, MasterListType masterListType);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of <see cref="Unit"/> entities associated with the specified master list identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the master list whose units are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{Unit}"/> with the units linked to the given master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=cf80d78 -->
|
||||
Task<IEnumerable<Unit>> FindByMasterListId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Updates the unit master list based on the provided unit identifiers. Returns the updated <see cref="Unit"/> when the operation succeeds, or <c>null</c> when no matching unit is found.
|
||||
/// </summary>
|
||||
/// <param name="updateUnitListDto">The data transfer object containing the list of unit identifiers to update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Unit"/>, or <c>null</c> if no unit was updated.</returns>
|
||||
/// <!-- aidoc:v1 sig=4b7663f -->
|
||||
Task<Unit?> UpdateUnitMasterList(UpdateUnitIdListDto updateUnitListDto);
|
||||
/// <summary>
|
||||
/// Updates the name and title of an existing unit identified by the specified identifier.
|
||||
@@ -68,6 +76,7 @@ public interface IUnitRepository : IMongoRepository<Unit>
|
||||
/// <param name="name">The new name to assign to the unit.</param>
|
||||
/// <param name="title">The new title to assign to the unit.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The task result contains the updated <see cref="Unit"/>, or <c>null</c> if the unit was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a3c7afb -->
|
||||
Task<Unit?> UpdateUnitInfo(ObjectId unitId, string name, string title);
|
||||
/// <summary>
|
||||
/// Updates the configuration of a unit identified by the specified identifier.
|
||||
@@ -75,12 +84,14 @@ public interface IUnitRepository : IMongoRepository<Unit>
|
||||
/// <param name="unitIdParsed">The parsed object identifier of the unit whose configuration will be updated.</param>
|
||||
/// <param name="unitConfiguration">The new configuration values to apply to the unit.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the configuration was successfully updated; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=bfe899b -->
|
||||
Task<bool> UpdateConfiguration(ObjectId unitIdParsed, UnitConfiguration unitConfiguration);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of <see cref="Unit"/> records based on the provided pagination criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and any additional filtering criteria.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Unit, Unit}"/> representing the fluent query for the paginated units.</returns>
|
||||
/// <!-- aidoc:v1 sig=4cab03f -->
|
||||
IFindFluent<Unit, Unit> GetPaginatedUnits(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of units associated with the master list identified by the specified identifier and type.
|
||||
@@ -88,5 +99,6 @@ public interface IUnitRepository : IMongoRepository<Unit>
|
||||
/// <param name="id">The unique identifier of the master list whose units should be counted.</param>
|
||||
/// <param name="masterListType">The type of the master list used to resolve the appropriate unit collection.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total number of units matching the specified master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=d8cd4b6 -->
|
||||
Task<long> CountUnitsByMasterListId(ObjectId id, MasterListType masterListType);
|
||||
}
|
||||
@@ -14,30 +14,35 @@ public interface IUserRepository : IMongoRepository<User>
|
||||
/// <param name="username">The username used to look up the user account.</param>
|
||||
/// <param name="password">The password used to authenticate the user.</param>
|
||||
/// <returns>A task that resolves to the authenticated <see cref="User"/>, or null if no user matches the provided credentials.</returns>
|
||||
/// <!-- aidoc:v1 sig=6f5e55d -->
|
||||
Task<User?> GetUser(string username, string password);
|
||||
/// <summary>
|
||||
/// Retrieves a user by their unique identifier asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the user to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="User"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=ab4b64e -->
|
||||
Task<User?> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a user matching the specified username. Returns <c>null</c> if no user is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The username to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="User"/> or <c>null</c> if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=117d092 -->
|
||||
Task<User?> GetByUserName(string name);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a user by their name, returning null if no matching user is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the user to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the user with the specified name, or null if no matching user exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=c29096f -->
|
||||
Task<User?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the user associated with the specified authorities name.
|
||||
/// </summary>
|
||||
/// <param name="name">The authorities name used to look up the user.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="User"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=9c416d2 -->
|
||||
Task<User?> GetByUserAndAuthoritesName(string name);
|
||||
/// <summary>
|
||||
/// Updates an existing user in the system, optionally updating the user's password when the <paramref name="updatePass"/> flag is set.
|
||||
@@ -45,16 +50,19 @@ public interface IUserRepository : IMongoRepository<User>
|
||||
/// <param name="user">The user entity containing the updated information to be persisted.</param>
|
||||
/// <param name="updatePass">A flag indicating whether the user's password should also be updated as part of this operation.</param>
|
||||
/// <returns>A task that returns the updated <see cref="User"/> entity, or <c>null</c> if the user was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=41a6482 -->
|
||||
Task<User?> UpdateUser(User user, bool updatePass);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent queryable collection of <see cref="User"/> entities based on the supplied pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines paging parameters such as page number and page size.</param>
|
||||
/// <returns>An <see cref="IFindFluent{User, User}"/> representing the queryable, paginated user results.</returns>
|
||||
/// <!-- aidoc:v1 sig=b888cec -->
|
||||
IFindFluent<User, User> GetPaginatedUsers(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves the existing system user, creating a new one if it does not already exist.
|
||||
/// </summary>
|
||||
/// <returns>The existing or newly created system <see cref="User"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=35c711b -->
|
||||
Task<User> GetOrCreateSystemUser();
|
||||
}
|
||||
@@ -45,6 +45,7 @@ public class AdminPanelService(
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
/// <returns><c>true</c> if the patient was archived successfully.</returns>
|
||||
/// <exception cref="System.Exception">Rethrows any exception thrown by the underlying patient service after logging it to the console.</exception>
|
||||
/// <!-- aidoc:v1 sig=5748d52 body=c9332aa -->
|
||||
public async Task<bool> ArchivePatient(Patient patient)
|
||||
{
|
||||
try
|
||||
@@ -66,6 +67,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="admRequest">The ADMPanel request containing the data used to populate the new patient.</param>
|
||||
/// <returns>The newly created <see cref="Patient"/> with its generated identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=e3b8218 body=5262c4e -->
|
||||
public async Task<Patient?> CreatePatient(AdmPanelRequest admRequest)
|
||||
{
|
||||
var patient = new Patient
|
||||
@@ -88,6 +90,7 @@ public class AdminPanelService(
|
||||
/// <exception cref="Exception">Thrown when the target <c>PointOfCareId</c> is already occupied by another patient.</exception>
|
||||
/// <exception cref="NotFoundException">Thrown when the requested <c>PointOfCareId</c> does not exist.</exception>
|
||||
/// <returns>The asynchronous <see cref="Task"/> representing the update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=a5986e8 body=50adbb0 -->
|
||||
private async Task UpdateNewPatient(Patient patient, AdmPanelRequest admRequest)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(admRequest.PatientNumber)) patient.PatientNumber = admRequest.PatientNumber;
|
||||
@@ -159,6 +162,7 @@ public class AdminPanelService(
|
||||
/// <param name="id">The unique identifier of the patient to look up.</param>
|
||||
/// <returns>The patient matching the provided identifier.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no patient is found for the specified identifier.</exception>
|
||||
/// <!-- aidoc:v1 sig=4bd85a6 body=0e8a91a -->
|
||||
public async Task<Patient?> FindPatientById(ObjectId id)
|
||||
{
|
||||
return await patientService.FindById(id) ??
|
||||
@@ -171,6 +175,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="location">The location to search for a patient at.</param>
|
||||
/// <returns>A <see cref="Patient"/> if one is found at the specified location; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=63de0aa body=2e39863 -->
|
||||
public async Task<Patient?> FindPatientByLocation(PatientLocation location)
|
||||
{
|
||||
return await patientService.FindByLocation(location);
|
||||
@@ -182,6 +187,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the patient.</param>
|
||||
/// <returns>A <see cref="Patient"/> if a match is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=b40610c body=3921bde -->
|
||||
public async Task<Patient?> FindPatientByPatientNumber(string patientNumber)
|
||||
{
|
||||
return await patientService.FindByPatientNumber(patientNumber);
|
||||
@@ -194,6 +200,7 @@ public class AdminPanelService(
|
||||
/// <param name="oldPatient">The existing patient record currently stored in the database that will be updated.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the patient data is successfully updated.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the request is missing the patient number, the patient payload is null, or the patient payload is empty.</exception>
|
||||
/// <!-- aidoc:v1 sig=5977876 body=627aa0c -->
|
||||
public async Task<bool> UpdatePatientData(AdmPanelRequest request, Patient oldPatient)
|
||||
{
|
||||
//traer el paciente que se quiere actualizar con los valores que tenga en la base de datos a una variable
|
||||
@@ -264,6 +271,7 @@ public class AdminPanelService(
|
||||
/// <param name="request">The admission panel request containing the patient identification data and optional location used to locate the patient.</param>
|
||||
/// <returns>The matching <see cref="Patient"/> if found.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no patient matches the provided request criteria.</exception>
|
||||
/// <!-- aidoc:v1 sig=7119165 body=2f82189 -->
|
||||
public async Task<Patient?> FindPatient(AdmPanelRequest request)
|
||||
{
|
||||
var findByLocation = !request.Location?.IsFullEmpty();
|
||||
@@ -278,6 +286,7 @@ public class AdminPanelService(
|
||||
/// <param name="location">The location used to look up the patient.</param>
|
||||
/// <returns>The patient found at the specified location.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no patient is found for the given location.</exception>
|
||||
/// <!-- aidoc:v1 sig=f2942f8 body=9a2d8fd -->
|
||||
public async Task<Patient?> FindByLocation(PatientLocation location)
|
||||
{
|
||||
return await patientService.FindByLocation(location) ??
|
||||
@@ -295,6 +304,7 @@ public class AdminPanelService(
|
||||
/// <param name="configObservation">The configuration observation containing the data to persist.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the configuration is created successfully.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the configuration creation fails, indicated by a null result from the service call.</exception>
|
||||
/// <!-- aidoc:v1 sig=78b448d body=4fbc231 -->
|
||||
public async Task<bool> CreateConfig(ConfigObservation configObservation)
|
||||
{
|
||||
_ = await configObservationService.CreateConfig(configObservation) ??
|
||||
@@ -308,6 +318,7 @@ public class AdminPanelService(
|
||||
/// <param name="configObservation">The configuration observation to update.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the configuration is successfully updated.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the underlying update operation fails, as indicated by a null result from the service.</exception>
|
||||
/// <!-- aidoc:v1 sig=255c09c body=3656b65 -->
|
||||
public async Task<bool> UpdateConfig(ConfigObservation configObservation)
|
||||
{
|
||||
_ = await configObservationService.UpdateConfig(configObservation) ??
|
||||
@@ -321,6 +332,7 @@ public class AdminPanelService(
|
||||
/// <param name="id">The unique identifier of the config observation item to delete.</param>
|
||||
/// <returns><c>true</c> when the config observation item is successfully removed.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the removal operation returns a null result, signaling a conflict with the delete request.</exception>
|
||||
/// <!-- aidoc:v1 sig=ffc4d11 body=62f915b -->
|
||||
public async Task<bool> DeleteConfigObservationItem(ObjectId id)
|
||||
{
|
||||
_ = await configObservationService.RemoveConfigItem(id) ??
|
||||
@@ -338,6 +350,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit to be inserted.</param>
|
||||
/// <returns>The inserted unit with its associated Point of Care identifiers, or null if the unit could not be inserted.</returns>
|
||||
/// <!-- aidoc:v1 sig=500cf23 body=7ff2f54 -->
|
||||
public async Task<Unit?> InsertUnit(Unit unit)
|
||||
{
|
||||
//Insertamos la unidad y creamos los PoCs por defecto para esa unidad
|
||||
@@ -375,6 +388,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit for which to build the dependency information DTO.</param>
|
||||
/// <returns>A task that resolves to a <see cref="UnitInfoDto"/> containing the unit's dependency counts, or <c>null</c> if an error occurs while retrieving the counts.</returns>
|
||||
/// <!-- aidoc:v1 sig=709a3b7 body=bcab092 -->
|
||||
public async Task<UnitInfoDto?> GetUnitDependencyDto(Unit unit)
|
||||
{
|
||||
try
|
||||
@@ -405,6 +419,12 @@ public class AdminPanelService(
|
||||
/// <returns><c>true</c> if the unit and its related resources were successfully deleted; otherwise, <c>false</c> when an error is caught and logged.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no unit is found for the specified <paramref name="unitId"/>.</exception>
|
||||
/// <exception cref="ConflictException">Thrown when the unit has patients assigned to it, preventing deletion.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_exception
|
||||
/// "NotFoundException is caught by the surrounding catch (Exception e) block and never escapes the method; the method returns false instead." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_exception
|
||||
/// "ConflictException is caught by the surrounding catch (Exception e) block and never escapes the method; the method returns false instead." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Summary states the method 'Throws' NotFoundException and ConflictException, but the catch-all handler swallows them and converts errors into a false return value." -->
|
||||
public async Task<bool> DeleteUnitById(ObjectId unitId)
|
||||
{
|
||||
try
|
||||
@@ -455,6 +475,7 @@ public class AdminPanelService(
|
||||
/// <param name="medicineId">The unique identifier of the medicine to retrieve.</param>
|
||||
/// <returns>The medicine matching the specified identifier.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no medicine is found with the specified identifier.</exception>
|
||||
/// <!-- aidoc:v1 sig=be77265 body=6784aa2 -->
|
||||
public async Task<Medicine?> GetMedicineById(ObjectId medicineId)
|
||||
{
|
||||
return await medicineService.GetMedicineById(medicineId) ??
|
||||
@@ -467,6 +488,7 @@ public class AdminPanelService(
|
||||
/// <param name="medicine">The medicine to be created.</param>
|
||||
/// <returns>The created <see cref="Medicine"/>.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the medicine service fails to create the medicine.</exception>
|
||||
/// <!-- aidoc:v1 sig=25564e2 body=595b03f -->
|
||||
public async Task<Medicine?> PostMedicine(Medicine medicine)
|
||||
{
|
||||
var newMedicine = await medicineService.PostMedicine(medicine) ??
|
||||
@@ -481,6 +503,7 @@ public class AdminPanelService(
|
||||
/// <param name="medicine">The medicine entity containing the updated information to persist.</param>
|
||||
/// <returns>The updated <see cref="Medicine"/> returned by the service.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the update operation fails and the service returns a null result.</exception>
|
||||
/// <!-- aidoc:v1 sig=baa8582 body=8e7d69d -->
|
||||
public async Task<Medicine?> UpdateMedicine(Medicine medicine)
|
||||
{
|
||||
var updatedMedicine = await medicineService.UpdateMedicine(medicine) ??
|
||||
@@ -495,6 +518,8 @@ public class AdminPanelService(
|
||||
/// <returns>A task that resolves to <c>true</c> when the medicine has been successfully deleted.</returns>
|
||||
/// <exception cref="BadRequestException">Thrown when <paramref name="medicineId"/> is not a valid ObjectId format.</exception>
|
||||
/// <exception cref="ConflictException">Thrown when the medicine still exists after the delete operation, indicating the deletion failed.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_exception
|
||||
/// "Documentation states ConflictException is thrown when the medicine still exists after deletion, but the code (`_ = await ... ?? throw new ConflictException(...)`) actually throws when GetMedicineById returns null, i.e., when the medicine does NOT exist after deletion." -->
|
||||
public async Task<bool> DeleteMedicineById(string medicineId)
|
||||
{
|
||||
if (!ObjectId.TryParse(medicineId, out var objectId))
|
||||
|
||||
@@ -44,6 +44,7 @@ public class AdmissionService(
|
||||
/// Deletes the specified admission by delegating to the delete operation using the admission's identifier.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity to delete, identified by its <see cref="Admission.Id"/>.</param>
|
||||
/// <!-- aidoc:v1 sig=bc9e848 body=3ba8fcf -->
|
||||
public async Task DeleteAdmissionAsync(Admission admission)
|
||||
{
|
||||
await DeleteAdmissionByIdAsync(admission.Id);
|
||||
@@ -53,6 +54,7 @@ public class AdmissionService(
|
||||
/// Deletes an admission identified by the given id. If the admission is not found, the operation is skipped and logged; otherwise the admission is removed, any associated point of care is detached (clearing its <c>AdmissionId</c> and <c>Admission</c>) and set to <c>Available</c> when not currently <c>Locked</c> or <c>InUse</c>, a delete broadcast is sent, and an audit log entry is created.
|
||||
/// </summary>
|
||||
/// <param name="admissionId">The identifier of the admission to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=504429d body=50c3daa -->
|
||||
public async Task DeleteAdmissionByIdAsync(ObjectId admissionId)
|
||||
{
|
||||
var admissionAux = await admissionRepository.FindById(admissionId);
|
||||
@@ -90,6 +92,7 @@ public class AdmissionService(
|
||||
/// Asynchronously deletes all admissions associated with the specified unit identifier by delegating the operation to the admission repository.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose admissions should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=6db1fa4 body=5f644a1 -->
|
||||
public async Task DeleteAdmissionsByUnitId(ObjectId unitId)
|
||||
{
|
||||
_ = await admissionRepository.DeleteAdmissionsByUnitId(unitId);
|
||||
@@ -101,6 +104,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="admissionId">The unique identifier of the admission to retrieve.</param>
|
||||
/// <returns>The matching <see cref="Admission"/> with its <see cref="Admission.PatientLocation"/> populated when applicable, or null if no admission is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=5c1a39b body=869dd3e -->
|
||||
public async Task<Admission?> GetAdmissionByIdAsync(ObjectId admissionId)
|
||||
{
|
||||
var result = await admissionRepository.FindById(admissionId);
|
||||
@@ -118,6 +122,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="Admission"/> objects with patient location details populated for those linked to a point of care.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the admission repository returns no results.</exception>
|
||||
/// <!-- aidoc:v1 sig=d4fca15 body=37e0155 -->
|
||||
public async Task<IEnumerable<Admission>> GetAdmissionsAsync()
|
||||
{
|
||||
var resultList = await admissionRepository.FindAll() ??
|
||||
@@ -141,6 +146,8 @@ public class AdmissionService(
|
||||
/// <returns>The newly inserted <see cref="Admission"/>, or <c>null</c> if no result is produced.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when an admission with the same NHC already exists, or when the insertion fails to return a result.</exception>
|
||||
/// <exception cref="NotFoundException">Thrown when the specified Point of Care does not exist.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_returns
|
||||
/// "The <returns> tag says 'or null if no result is produced', but the code uses `?? throw new ConflictException(...)` so the method never returns null — it throws instead. The null-return path does not exist." -->
|
||||
public async Task<Admission?> InsertAdmission(Admission admission)
|
||||
{
|
||||
var admissionAux = await admissionRepository.FindByNhc(admission.Nhc);
|
||||
@@ -183,6 +190,7 @@ public class AdmissionService(
|
||||
/// If the admission is not found, the method returns without making changes; point of care lookups are only applied when a <c>PointOfCareId</c> is present and yields a result.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity containing the updated information to persist.</param>
|
||||
/// <!-- aidoc:v1 sig=ca4e183 body=25ff85a -->
|
||||
public async Task UpdateAdmissionAsync(Admission admission)
|
||||
{
|
||||
var oldAdmission = await admissionRepository.FindById(admission.Id);
|
||||
@@ -212,6 +220,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission data used to create the patient and populate location, diagnosis, allergies, and other attributes.</param>
|
||||
/// <param name="isNew">When <c>false</c>, the admission record is deleted after a successful patient insertion; when <c>true</c>, the admission is retained.</param>
|
||||
/// <!-- aidoc:v1 sig=f69ed33 body=b929523 -->
|
||||
public async Task AdmitPatient(Admission admission, bool isNew = false)
|
||||
{
|
||||
if (admission.PointOfCareId == null)
|
||||
@@ -329,6 +338,7 @@ public class AdmissionService(
|
||||
/// Returns a patient to the admissions workflow by creating a new admission record, removing any existing discharge, and archiving the patient. Validates that the patient and its associated unit exist before proceeding, and only builds the admission when a point of care is assigned.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient to be returned to admissions.</param>
|
||||
/// <!-- aidoc:v1 sig=17907a9 body=0185562 -->
|
||||
public async Task ReturnPatientToAdmissions(ObjectId patientId)
|
||||
{
|
||||
var patient = await patientService.FindById(patientId);
|
||||
@@ -383,6 +393,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to be returned to admissions.</param>
|
||||
/// <param name="adm">The admission context used to resolve the unit and point of care for the new admission record.</param>
|
||||
/// <!-- aidoc:v1 sig=13b57d7 body=732c8f7 -->
|
||||
public async Task ReturnPatientToAdmissions(ObjectId patientId, Admission adm)
|
||||
{
|
||||
var patient = await patientService.FindById(patientId);
|
||||
@@ -437,6 +448,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of admissions matching the specified location, or an empty list if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=4d1cb29 body=1520dd9 -->
|
||||
public async Task<List<Admission>> GetAdmissionByLocation(PatientLocation location)
|
||||
{
|
||||
try
|
||||
@@ -456,6 +468,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of care whose admissions should be retrieved.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the list of admissions for the given point of care, or an empty list if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=24794e8 body=d8a4124 -->
|
||||
public async Task<List<Admission>> GetAdmissionByPointOfCareId(ObjectId pocId)
|
||||
{
|
||||
try
|
||||
@@ -482,6 +495,7 @@ public class AdmissionService(
|
||||
/// <param name="pocId">The identifier of the point of care whose admissions will be retrieved.</param>
|
||||
/// <param name="locale">The locale used to translate the admission fields.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of admissions with their fields translated to the specified locale.</returns>
|
||||
/// <!-- aidoc:v1 sig=2f28a6c body=8c5b998 -->
|
||||
public async Task<List<Admission>> GetAdmissionByPointOfCareIdAndLocale(ObjectId pocId, LocaleEnum locale)
|
||||
{
|
||||
var admissions = await GetAdmissionByPointOfCareId(pocId);
|
||||
@@ -500,6 +514,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose admissions (without PoC) are being requested.</param>
|
||||
/// <returns>A task that returns a list of <see cref="Admission"/> objects for the given unit, or an empty list if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=a0f7f96 body=714008c -->
|
||||
public async Task<List<Admission>> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId)
|
||||
{
|
||||
try
|
||||
@@ -520,6 +535,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose admissions should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the number of admissions for the given unit, or 0 if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=d15b339 body=27c30bc -->
|
||||
public async Task<long> CountAdmissionsByUnitId(ObjectId unitId)
|
||||
{
|
||||
try
|
||||
@@ -540,6 +556,7 @@ public class AdmissionService(
|
||||
/// <param name="patientNumber">The unique patient number used as the primary search key.</param>
|
||||
/// <param name="unitId">The identifier of the unit used to filter the archived patient and admission searches.</param>
|
||||
/// <returns>A <see cref="PatientSearch"/> aggregating the current patient, archived patient, and admission data, including flags indicating whether the patient exists only in the archive and whether any of the three sources returned a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=b6a87e4 body=624e811 -->
|
||||
public async Task<PatientSearch?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId)
|
||||
{
|
||||
var patient = await patientService.FindByPatientNumber(patientNumber);
|
||||
@@ -570,6 +587,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The patient's clinical record number (NHC) used to look up the admission.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Admission"/> if found, or <c>null</c> when no admission exists for the given patient number.</returns>
|
||||
/// <!-- aidoc:v1 sig=3fe6f66 body=9a0b8ac -->
|
||||
public Task<Admission?> GetAdmissionByPatientNumber(string patientNumber)
|
||||
{
|
||||
return admissionRepository.FindByNhc(patientNumber);
|
||||
@@ -581,6 +599,7 @@ public class AdmissionService(
|
||||
/// <param name="opt">The master list update options to apply to the matching admissions.</param>
|
||||
/// <param name="unitList">The collection of units whose admissions are affected by the update.</param>
|
||||
/// <param name="typeName">The name of the master list type being modified.</param>
|
||||
/// <!-- aidoc:v1 sig=b539b7b body=000b050 -->
|
||||
public async Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList,
|
||||
string typeName)
|
||||
{
|
||||
@@ -601,6 +620,7 @@ public class AdmissionService(
|
||||
/// <param name="opt">The master list option to remove from the admissions.</param>
|
||||
/// <param name="unitList">The collection of units whose admissions will be processed for the deletion.</param>
|
||||
/// <param name="typeName">The name of the option type being deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=cb62e44 body=c1573d6 -->
|
||||
public async Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName)
|
||||
{
|
||||
var unitIds = unitList.Select(x => x.Id).ToList();
|
||||
@@ -622,6 +642,7 @@ public class AdmissionService(
|
||||
/// Required fields (Nhc, Origin, and Diagnosis) are validated before insert and update operations, and the method exits early when the admission or any required value is missing.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the admission payload and the operation type to execute.</param>
|
||||
/// <!-- aidoc:v1 sig=229d8cd body=9f05a36 -->
|
||||
public async Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
try
|
||||
@@ -681,6 +702,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to persist.</param>
|
||||
/// <returns>A task that represents the asynchronous save operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=a3706aa body=c8d77ba -->
|
||||
public Task SaveRequestAsync(ApiRequest apiRequest)
|
||||
{
|
||||
return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); }));
|
||||
@@ -691,6 +713,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="admission">The current admission containing the updated PointOfCare identifier.</param>
|
||||
/// <param name="oldAdmission">The previous admission state used to identify the original PointOfCare to release.</param>
|
||||
/// <!-- aidoc:v1 sig=4fcd57d body=2365bd2 -->
|
||||
private async Task HandlePointOfCareChange(Admission admission, Admission oldAdmission)
|
||||
{
|
||||
// Check if PointOfCare has changed.
|
||||
@@ -747,6 +770,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="pointOfCareId">The identifier of the point of care whose status will be updated.</param>
|
||||
/// <param name="status">The new status to assign to the point of care.</param>
|
||||
/// <!-- aidoc:v1 sig=2c82bd3 body=69fe4f4 -->
|
||||
private async Task SetPointOfCareStatus(ObjectId pointOfCareId, StatusEnum.PointOfCare status)
|
||||
{
|
||||
var pointOfCare = await pointOfCareService.FindById(pointOfCareId);
|
||||
@@ -761,6 +785,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission record to broadcast.</param>
|
||||
/// <param name="operation">The operation type associated with the broadcast.</param>
|
||||
/// <!-- aidoc:v1 sig=c26bb38 body=b6386c1 -->
|
||||
private async void SendAdmissionBroadcast(Admission admission, OperationType operation)
|
||||
{
|
||||
try
|
||||
@@ -783,6 +808,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission whose broadcast is being sent; its Point of Care is used to select subscribers and locale-specific content.</param>
|
||||
/// <param name="operation">The type of operation to send to the subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=078ad3d body=8427094 -->
|
||||
private async Task SendAdmissionBroadcastByPoC(Admission admission, OperationType operation)
|
||||
{
|
||||
if (!admission.PointOfCareId.HasValue)
|
||||
@@ -821,6 +847,7 @@ public class AdmissionService(
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission to broadcast, which supplies the target unit identifier.</param>
|
||||
/// <param name="operation">The operation type associated with the broadcast message.</param>
|
||||
/// <!-- aidoc:v1 sig=d37a566 body=b40a845 -->
|
||||
private async Task SendAdmissionByUnitId(Admission admission, OperationType operation)
|
||||
{
|
||||
if (admission.UnitId == ObjectId.Empty)
|
||||
@@ -855,6 +882,7 @@ public class AdmissionService(
|
||||
/// <param name="admission">The admission whose reference names will be updated with localized values.</param>
|
||||
/// <param name="locale">The locale used to retrieve the appropriate master list translations.</param>
|
||||
/// <returns>The same <see cref="Admission"/> instance with its localized reference names applied when available.</returns>
|
||||
/// <!-- aidoc:v1 sig=0afb3a4 body=2138792 -->
|
||||
private async Task<Admission> GetAdmissionWithLocale(Admission admission, LocaleEnum locale)
|
||||
{
|
||||
var unit = await unitService.FindById(admission.UnitId);
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace adas_core.Application.Services;
|
||||
/// Provides the concrete implementation of the <see cref="IAlarmService"/> contract,
|
||||
/// encapsulating the business logic for managing and processing alarms within the application.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=060faf3 -->
|
||||
public class AlarmService : IAlarmService
|
||||
{
|
||||
private readonly IAlarmRepository _alarmRepository;
|
||||
@@ -122,6 +123,7 @@ public class AlarmService : IAlarmService
|
||||
/// <param name="apiRequest">The API request containing patient, location, observation, and alarm data to process.</param>
|
||||
/// <exception cref="InvalidFormatException">Thrown when both the patient number and location unit name are missing.</exception>
|
||||
/// <exception cref="ApiRequestException">Thrown when the API request type is not valid for observations.</exception>
|
||||
/// <!-- aidoc:v1 sig=229d8cd body=405bafb -->
|
||||
public async Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
if (
|
||||
@@ -178,6 +180,7 @@ public class AlarmService : IAlarmService
|
||||
/// Asynchronously saves the specified API request by delegating to the underlying save operation.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
/// <!-- aidoc:v1 sig=655d140 body=fe3d8b2 -->
|
||||
public async Task SaveRequestAsync(ApiRequest apiRequest)
|
||||
{
|
||||
await SaveRequest(apiRequest);
|
||||
@@ -190,6 +193,7 @@ public class AlarmService : IAlarmService
|
||||
/// <param name="obs">The patient observation alarm to be mapped.</param>
|
||||
/// <param name="onlyByName">If true, mapping is performed by name only; otherwise the full mapping is applied.</param>
|
||||
/// <returns>A mapped <see cref="PatientObservationAlarm"/> if both mapping steps succeed; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=78ca950 body=5f19c29 -->
|
||||
public async Task<PatientObservationAlarm?> MapObservation(PatientObservationAlarm obs, bool onlyByName = false)
|
||||
{
|
||||
try
|
||||
@@ -229,6 +233,7 @@ public class AlarmService : IAlarmService
|
||||
/// <param name="patientId">The identifier of the patient whose last observations should be retrieved.</param>
|
||||
/// <param name="filterObservations">An optional list of fields used to restrict which observations are returned; when null, no field filter is applied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the patient's last <see cref="PatientObservationAlarm"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=a25fefd body=4cd8879 -->
|
||||
public async Task<List<PatientObservationAlarm>> FindLastObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations = null)
|
||||
{
|
||||
@@ -244,6 +249,7 @@ public class AlarmService : IAlarmService
|
||||
/// <param name="filterObservations">The list of fields used to filter the observations included in the aggregation.</param>
|
||||
/// <param name="configAlarm">The list of alarm configurations that define the criteria applied during the aggregation.</param>
|
||||
/// <returns>A task that resolves to a list of the latest non-expired <see cref="PatientObservationAlarm"/> entries matching the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=2739a83 body=5e76a47 -->
|
||||
public async Task<List<PatientObservationAlarm>> FindLastValuesNotExpired(ObjectId patientId,
|
||||
List<Field> filterObservations, List<ConfigObservation> configAlarm)
|
||||
{
|
||||
@@ -258,6 +264,7 @@ public class AlarmService : IAlarmService
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation alarm to be mapped by name.</param>
|
||||
/// <returns>A task that returns the mapped <see cref="PatientObservationAlarm"/> if a matching configuration is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=5372879 body=c476eb8 -->
|
||||
public async Task<PatientObservationAlarm?> MapObservationsByName(PatientObservationAlarm obs)
|
||||
{
|
||||
return await _configObservationService.Map(obs, true);
|
||||
@@ -271,6 +278,7 @@ public class AlarmService : IAlarmService
|
||||
/// <param name="patient">The patient the alarms are associated with.</param>
|
||||
/// <param name="messageTime">The message time assigned to each alarm.</param>
|
||||
/// <param name="observationData">Optional parent observation metadata applied to all alarms in the batch.</param>
|
||||
/// <!-- aidoc:v1 sig=c249a9d body=81d79c0 -->
|
||||
public async Task ProcessAlarmObservations(List<PatientObservationAlarm> alarmObservations,
|
||||
List<PatientObservation> observations, Patient patient,
|
||||
DateTime messageTime, ObservationData? observationData = null)
|
||||
@@ -398,6 +406,7 @@ public class AlarmService : IAlarmService
|
||||
/// <param name="obs">The patient observation alarm to insert.</param>
|
||||
/// <param name="persistObs">Indicates whether the observation should be persisted to the repository. Defaults to true and is forced to false if the observation's <c>Persist</c> property is false.</param>
|
||||
/// <param name="mapObs">Indicates whether the observation should be mapped before being processed. Set to false only when the observation originates from the inner refactor job.</param>
|
||||
/// <!-- aidoc:v1 sig=a04333a body=d8cb988 -->
|
||||
private async Task InsertObservation(PatientObservationAlarm obs, bool persistObs = true, bool mapObs = true)
|
||||
{
|
||||
try
|
||||
@@ -436,6 +445,7 @@ public class AlarmService : IAlarmService
|
||||
/// Skips observations without a name and returns silently when the associated patient cannot be resolved from the observation or the patient service.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation to be sent to matching subscribers as an alarm operation.</param>
|
||||
/// <!-- aidoc:v1 sig=52a60f2 body=dc24760 -->
|
||||
private async Task SendObsBroadcast(BasePatientObservation obs)
|
||||
{
|
||||
if (obs.Name == null) return;
|
||||
@@ -473,6 +483,7 @@ public class AlarmService : IAlarmService
|
||||
/// Evaluates alarm configuration rules for a patient observation and, when matching conditions and preconditions are satisfied, generates a new alert observation, logs it, and triggers the corresponding alarm notification.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation whose value is evaluated against configured alert rules and preconditions.</param>
|
||||
/// <!-- aidoc:v1 sig=a86f464 body=bee7a9f -->
|
||||
public async Task CheckObservationAlarm(PatientObservation obs)
|
||||
{
|
||||
//ConfigObservations
|
||||
@@ -551,6 +562,7 @@ public class AlarmService : IAlarmService
|
||||
/// <param name="config">The configuration observation providing the coding system, code, name, and alarm settings.</param>
|
||||
/// <param name="type">The status type to assign to the new observation.</param>
|
||||
/// <returns>A new <see cref="PatientObservation"/> populated with the merged values from the source observation and configuration.</returns>
|
||||
/// <!-- aidoc:v1 sig=91e2989 body=7ec15fe -->
|
||||
private static PatientObservation CreateNewObservation(PatientObservation obs, ConfigObservation config,
|
||||
StatusEnum.Type type)
|
||||
{
|
||||
@@ -572,6 +584,7 @@ public class AlarmService : IAlarmService
|
||||
/// </summary>
|
||||
/// <param name="pobs">The patient observation whose alarm configuration will be checked and updated.</param>
|
||||
/// <returns>The patient observation with the configured alarm applied, or with a null alarm if no configuration was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4d79a28 body=efca777 -->
|
||||
private async Task<PatientObservation> CheckAlarmConfig(PatientObservation pobs)
|
||||
{
|
||||
var configObs = await _configObservationService.Get(new PatientObservation
|
||||
@@ -596,6 +609,10 @@ public class AlarmService : IAlarmService
|
||||
/// <param name="type"></param>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
/// <returns>New alarm created</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "Method returns Task (void async), not a 'New alarm created'. There is no return value produced." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=missing_param
|
||||
/// "The 'type' parameter has an empty <param> tag with no description, while name/code/severity are described." -->
|
||||
public async Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code, AlarmEnum.Severity severity,
|
||||
AlarmEnum.Type type)
|
||||
{
|
||||
@@ -775,6 +792,8 @@ public class AlarmService : IAlarmService
|
||||
/// </summary>
|
||||
/// <param name="source">The patient observation value used to look up the alarm configuration and identify the target patient.</param>
|
||||
/// <param name="name">The name associated with the observation, used for logging and alarm context.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_param_role
|
||||
/// "The 'name' parameter is documented as 'used for logging and alarm context', but the method body never references it; all logging uses obs.PatientId and obs.Name instead." -->
|
||||
public async Task CalculateAlarmTest(BasePatientObservationValue source, string name)
|
||||
{
|
||||
if (source is not PatientObservation obs) return;
|
||||
@@ -824,6 +843,7 @@ public class AlarmService : IAlarmService
|
||||
/// </summary>
|
||||
/// <param name="color">The beacon color to transmit to the light beacon service.</param>
|
||||
/// <param name="patient">The patient whose associated point of care device should display the beacon color.</param>
|
||||
/// <!-- aidoc:v1 sig=1b6b9f9 body=c0fe279 -->
|
||||
private Task SendBeaconCode(AlarmEnum.BeaconColor color, Patient patient)
|
||||
{
|
||||
if (!patient.PointOfCareId.HasValue)
|
||||
@@ -862,6 +882,12 @@ public class AlarmService : IAlarmService
|
||||
/// <param name="endAfter"></param>
|
||||
/// <param name="severity"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
|
||||
/// "Summary is empty and does not describe what the method does (starts a recording based on patient, POC, and alarm data)." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_returns
|
||||
/// "Method returns Task but no <returns> tag is present." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "No documentation for what each parameter represents (patientId, recording, alarmName, alarmDescription, endAfter, severity, type are all undocumented beyond a placeholder or a single line)." -->
|
||||
private async Task StartRecording(ObjectId patientId, DateTime eventTime, AlarmItem? recording,
|
||||
AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, string? alarmDescription, int? endAfter,
|
||||
AlarmEnum.Type type = AlarmEnum.Type.Manual)
|
||||
@@ -896,6 +922,7 @@ public class AlarmService : IAlarmService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose relay should be powered on.</param>
|
||||
/// <param name="type">The type of relay to power on, used to locate the matching configuration in the point of care's relay list.</param>
|
||||
/// <!-- aidoc:v1 sig=7ecd7ee body=04cade6 -->
|
||||
private async Task RelayPowerOn(ObjectId patientId, RelayEnum.Type type)
|
||||
{
|
||||
try
|
||||
@@ -922,6 +949,7 @@ public class AlarmService : IAlarmService
|
||||
/// Starts a periodic background timer that retrieves the list of locations and periodically checks for expired alarms, using a semaphore to ensure thread-safe execution.
|
||||
/// Logs any errors encountered during timer initialization or execution without rethrowing them.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fac87dc body=29b2aa2 -->
|
||||
private async void StartTimer()
|
||||
{
|
||||
try
|
||||
@@ -957,6 +985,7 @@ public class AlarmService : IAlarmService
|
||||
/// Asynchronously checks for expired alarms by running the beacon and relay expiration checks in parallel.
|
||||
/// </summary>
|
||||
/// <param name="pocList">The list of points of care to be evaluated for expired beacon alarms.</param>
|
||||
/// <!-- aidoc:v1 sig=e77aa4b body=99bc6c5 -->
|
||||
private async Task CheckExpiredAlarms(List<PointOfCare> pocList)
|
||||
{
|
||||
_logger.LogTrace("Checking Expired Alarms Started");
|
||||
@@ -981,6 +1010,7 @@ public class AlarmService : IAlarmService
|
||||
/// the still-valid observations.
|
||||
/// </summary>
|
||||
/// <param name="pocList">The list of points of care whose beacons should be turned off when no alarms are active.</param>
|
||||
/// <!-- aidoc:v1 sig=5baf90c body=8c4d364 -->
|
||||
private async Task CheckExpiredBeaconsAsync(List<PointOfCare> pocList)
|
||||
{
|
||||
await _beaconListSemaphore.WaitAsync();
|
||||
@@ -1050,6 +1080,7 @@ public class AlarmService : IAlarmService
|
||||
/// patients without an assigned <c>PointOfCareId</c> are processed, and the relay alarm list is
|
||||
/// synchronized under a lock with the filtered non-expired observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6193459 body=f16dcb9 -->
|
||||
private async Task CheckExpiredRelayAsync()
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace adas_core.Application.Services;
|
||||
/// Provides an implementation of the IAlertValuesService interface for managing alert values
|
||||
/// using a configuration observation repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9cef6b0 -->
|
||||
public class AlertValuesService(IConfigObservationRepository alertValueRepository) : IAlertValuesService
|
||||
{
|
||||
/// <summary>
|
||||
@@ -20,6 +21,7 @@ public class AlertValuesService(IConfigObservationRepository alertValueRepositor
|
||||
/// <param name="key">The unique identifier of the configuration observation to retrieve.</param>
|
||||
/// <returns>The matching <see cref="ConfigObservation"/> if found.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no configuration observation exists for the specified <paramref name="key"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=2645546 body=5ae5bf7 -->
|
||||
public async Task<ConfigObservation?> FindByKey(ObjectId key)
|
||||
{
|
||||
return await alertValueRepository.FindById(key) ??
|
||||
|
||||
@@ -47,6 +47,7 @@ public class AppointmentService(
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the patient number, location, type, observations, diagnosis, and related data to be processed.</param>
|
||||
/// <exception cref="ApiRequestException">Thrown when the <paramref name="apiRequest"/> has a null or empty patient number.</exception>
|
||||
/// <!-- aidoc:v1 sig=229d8cd body=bb59333 -->
|
||||
public async Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
if (string.IsNullOrEmpty(apiRequest.PatientNumber))
|
||||
@@ -91,6 +92,7 @@ public class AppointmentService(
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the HL7 message type, timestamp, and appointment payload to process.</param>
|
||||
/// <param name="patient">The patient associated with the request; if null, the method returns without processing.</param>
|
||||
/// <!-- aidoc:v1 sig=21c9ac7 body=f7a7db6 -->
|
||||
public async Task ProcessApiRequest(ApiRequest apiRequest, Patient? patient)
|
||||
{
|
||||
if (patient == null)
|
||||
@@ -232,6 +234,7 @@ public class AppointmentService(
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
/// <returns>A task that represents the asynchronous save operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=a3706aa body=c8d77ba -->
|
||||
public Task SaveRequestAsync(ApiRequest apiRequest)
|
||||
{
|
||||
return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); }));
|
||||
@@ -241,6 +244,7 @@ public class AppointmentService(
|
||||
/// Archives the specified patient by delegating the operation to <see cref="ArchiveByPatientId"/> using the patient's identifier.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=0afe718 body=be01ba0 -->
|
||||
public async Task Archive(Patient patient)
|
||||
{
|
||||
await ArchiveByPatientId(patient.Id);
|
||||
@@ -250,6 +254,7 @@ public class AppointmentService(
|
||||
/// Archives all appointments associated with the specified patient by copying them to the appointment archive repository and then deleting them from the source collection.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose appointments should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=3385472 body=fb8a531 -->
|
||||
public async Task ArchiveByPatientId(ObjectId id)
|
||||
{
|
||||
logger.LogDebug("Archive Appointments by patientId {id}", id);
|
||||
@@ -268,6 +273,7 @@ public class AppointmentService(
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointments are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> records for the given patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=c45e6c0 body=eb5edef -->
|
||||
public async Task<List<PatientAppointment>> GetByPatient(ObjectId patientId)
|
||||
{
|
||||
return await appointmentRepository.GetByPatient(patientId);
|
||||
@@ -280,6 +286,7 @@ public class AppointmentService(
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointments are being queried.</param>
|
||||
/// <param name="ct">Cancellation token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that resolves to a list of <see cref="PatientAppointment"/> instances scheduled for today; an empty list is returned when no appointments match.</returns>
|
||||
/// <!-- aidoc:v1 sig=ad66c0d body=a065213 -->
|
||||
public async Task<List<PatientAppointment>> GetTodayByPatient(
|
||||
ObjectId patientId,
|
||||
CancellationToken ct = default)
|
||||
@@ -320,6 +327,7 @@ public class AppointmentService(
|
||||
/// <param name="pocId">The identifier of the point of care whose appointments should be retrieved.</param>
|
||||
/// <param name="ct">A cancellation token to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of patient appointments scheduled for today at the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=0c69a88 body=57eddae -->
|
||||
public async Task<List<PatientAppointment>> GetTodayByPoc(
|
||||
ObjectId pocId,
|
||||
CancellationToken ct = default)
|
||||
@@ -361,6 +369,7 @@ public class AppointmentService(
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointments are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an async cursor over the matching <see cref="PatientAppointment"/> documents.</returns>
|
||||
/// <!-- aidoc:v1 sig=737aa7b body=e468a16 -->
|
||||
public Task<IAsyncCursor<PatientAppointment>> FindByPatientIdAsync(ObjectId patientId)
|
||||
{
|
||||
return appointmentRepository.FindByPatientIdAsync(patientId);
|
||||
@@ -371,6 +380,7 @@ public class AppointmentService(
|
||||
/// </summary>
|
||||
/// <param name="location">The location used to filter the patient appointments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patient appointments for the specified location.</returns>
|
||||
/// <!-- aidoc:v1 sig=0baed42 body=32f1684 -->
|
||||
public async Task<List<PatientAppointment>> FindByLocation(PatientLocation location)
|
||||
{
|
||||
return await appointmentRepository.FindByLocation(location);
|
||||
@@ -381,6 +391,7 @@ public class AppointmentService(
|
||||
/// Deletes all appointments associated with the specified patient identifier, invalidates the appointments cache, and records the action in the audit log.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose appointments will be deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=09e4e41 body=de0ba10 -->
|
||||
public async Task DeleteByPatientId(ObjectId id)
|
||||
{
|
||||
var patientApp = await FindByPatientIdAsync(id);
|
||||
@@ -399,6 +410,7 @@ public class AppointmentService(
|
||||
/// <param name="nameId">The identifier used to scope which appointment records are affected by the update.</param>
|
||||
/// <param name="id">The new ObjectId that will replace the existing one in the matching records.</param>
|
||||
/// <param name="oldId">The current ObjectId to be replaced in the matching records.</param>
|
||||
/// <!-- aidoc:v1 sig=72ce1ca body=413cf37 -->
|
||||
public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)
|
||||
{
|
||||
await appointmentRepository.UpdateManyObjectId(nameId, id, oldId);
|
||||
@@ -409,6 +421,7 @@ public class AppointmentService(
|
||||
/// </summary>
|
||||
/// <param name="appointment">The patient appointment whose resource groups and locations will be broadcast to subscribers.</param>
|
||||
/// <param name="operationType">The optional operation type describing the change performed on the appointment; passed along to the subscriber message.</param>
|
||||
/// <!-- aidoc:v1 sig=db962d9 body=b404485 -->
|
||||
private async Task SendBroadcast(PatientAppointment appointment, OperationType? operationType)
|
||||
{
|
||||
//RECORRE LOS DIFERENTES LOCATIONS DE LA CITA
|
||||
|
||||
@@ -29,6 +29,8 @@ public class ArchivePatientCarePlanService(
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient care plan to be archived and inserted.</param>
|
||||
/// <returns>The inserted patient care plan, or <see langword="null"/> if no plan was provided.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "Documentation states the method returns 'null if no plan was provided', but the code unconditionally returns the patient parameter and would throw a NullReferenceException rather than returning null." -->
|
||||
public async Task<PatientCarePlan?> InsertOneAsync(PatientCarePlan patient)
|
||||
{
|
||||
await archivedPatientRepository.InsertOneAsync(patient);
|
||||
@@ -43,6 +45,7 @@ public class ArchivePatientCarePlanService(
|
||||
/// Asynchronously inserts a batch of archived patient care plans into the repository and creates an audit log entry for each one using the current HTTP context user.
|
||||
/// </summary>
|
||||
/// <param name="patientCarePla">The list of patient care plans to insert and audit.</param>
|
||||
/// <!-- aidoc:v1 sig=8b81a0b body=1bbcfc7 -->
|
||||
public async Task InsertManyAsync(List<PatientCarePlan> patientCarePla)
|
||||
{
|
||||
await archivedPatientRepository.InsertManyAsync(patientCarePla);
|
||||
@@ -61,6 +64,7 @@ public class ArchivePatientCarePlanService(
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose archived care plans are being searched.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="PatientCarePlan"/> for the patient, or null if no records are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=33d98b1 body=3b1387d -->
|
||||
public async Task<List<PatientCarePlan>?> FindByPatientId(ObjectId patientId)
|
||||
{
|
||||
return await archivedPatientRepository.FindByPatientId(patientId);
|
||||
@@ -72,6 +76,7 @@ public class ArchivePatientCarePlanService(
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose archived care plans are being retrieved.</param>
|
||||
/// <returns>A list of <see cref="PatientCarePlan"/> entries for the patient, or <c>null</c> if no records exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=9198094 body=3b1387d -->
|
||||
public async Task<List<PatientCarePlan>?> FindByPatientId(string patientId)
|
||||
{
|
||||
return await archivedPatientRepository.FindByPatientId(patientId);
|
||||
@@ -83,6 +88,7 @@ public class ArchivePatientCarePlanService(
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose archived care plans are being searched.</param>
|
||||
/// <returns>A list of <see cref="PatientCarePlan"/> objects for the specified patient, or null if no records are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=be43759 body=7006868 -->
|
||||
public async Task<List<PatientCarePlan>?> FindByPatientNumber(string patientId)
|
||||
{
|
||||
return await archivedPatientRepository.FindByPatientNumber(patientId);
|
||||
@@ -92,6 +98,7 @@ public class ArchivePatientCarePlanService(
|
||||
/// Retrieves all archived patient care plans by delegating to the archived patient repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that resolves to a list of <see cref="PatientCarePlan"/> objects representing all archived patient care plans.</returns>
|
||||
/// <!-- aidoc:v1 sig=e5c3065 body=a2e9669 -->
|
||||
public Task<List<PatientCarePlan>> FindAll()
|
||||
{
|
||||
return archivedPatientRepository.FindAll();
|
||||
|
||||
@@ -20,6 +20,7 @@ public class ArchivePatientObservationsService(IObservationArchiveRepository arc
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose archived observations are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of archived <see cref="PatientObservation"/> records for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=dc5c962 body=1b4970c -->
|
||||
public async Task<List<PatientObservation>> FindArchivedPatientObservationsFromPatient(ObjectId patientId)
|
||||
{
|
||||
return await archivedPatientObservationService.FindAllFromPatient(patientId);
|
||||
|
||||
@@ -10,12 +10,14 @@ namespace adas_core.Application.Services;
|
||||
/// <remarks>
|
||||
/// This class uses an <see cref="IPatientArchiveRepository"/> to perform operations on archived patient records, following the repository pattern.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=d476f9b -->
|
||||
public class ArchivedPatientService(IPatientArchiveRepository archivedPatientRepository) : IArchivedPatientService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves all archived patients by delegating to the archived patient repository.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of all archived <see cref="Patient"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=3e765a0 body=6db7118 -->
|
||||
public async Task<List<Patient>> FindAllPatients()
|
||||
{
|
||||
return await archivedPatientRepository.FindAll();
|
||||
|
||||
@@ -17,6 +17,7 @@ public class ArchivedPatientTreatmentService(ITreatmentArchiveRepository archive
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose archived treatments are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientTreatment"/> records for the specified patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=d06a1c8 body=542ec4b -->
|
||||
public async Task<List<PatientTreatment>> FindAllPatientTreatmentsByPatient(ObjectId patientId)
|
||||
{
|
||||
return await archivedPatientTreatmentService.FindAllFromPatient(patientId);
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace adas_core.Application.Services;
|
||||
/// Provides an implementation of the <see cref="IAuthService"/> interface, offering
|
||||
/// authentication-related services to consuming components.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c025df9 -->
|
||||
public class AuthService : IAuthService
|
||||
{
|
||||
private readonly IAuthorityRepository _authorityRepository;
|
||||
@@ -49,6 +50,7 @@ public class AuthService : IAuthService
|
||||
/// Asynchronously obtains a login token from the recording API using the configured client credentials and caches it for reuse via <see cref="AuthUtils"/>.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="LoginResponse"/> containing the authentication token when the request succeeds and the response is valid; otherwise, <c>null</c> if the API URL is not configured, the request fails, the returned token is empty, or an exception is caught and logged.</returns>
|
||||
/// <!-- aidoc:v1 sig=6d8b512 body=bfaf63a -->
|
||||
public async Task<LoginResponse?> GetLoginResponse()
|
||||
{
|
||||
try
|
||||
@@ -100,6 +102,7 @@ public class AuthService : IAuthService
|
||||
/// Otherwise, attempts a fresh login and returns the new token, falling back to an empty string when no token is obtained.
|
||||
/// </summary>
|
||||
/// <returns>A task that resolves to the authentication token, or an empty string if the token could not be obtained.</returns>
|
||||
/// <!-- aidoc:v1 sig=2e832cc body=0ab9bf1 -->
|
||||
public async Task<string> GetToken()
|
||||
{
|
||||
var loginResponse = AuthUtils.Instance.GetLoginResponse();
|
||||
@@ -115,6 +118,7 @@ public class AuthService : IAuthService
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose authorizations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Authorization"/> objects for the specified unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=37cf403 body=9b4aba2 -->
|
||||
public async Task<List<Authorization>> GetByUnitId(ObjectId unitId)
|
||||
{
|
||||
return await _authorityRepository.GetByUnitId(unitId);
|
||||
@@ -125,6 +129,7 @@ public class AuthService : IAuthService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the user whose authorities are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Authorization"/> entries for the user.</returns>
|
||||
/// <!-- aidoc:v1 sig=7b40daa body=48ea4d9 -->
|
||||
public async Task<List<Authorization>> GetUserAuthorities(ObjectId id)
|
||||
{
|
||||
return await _authorityRepository.GetUserAuthorities(id);
|
||||
@@ -135,6 +140,7 @@ public class AuthService : IAuthService
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose authorities are to be removed.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the deletion was successful; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d4333b3 body=ae8ffe1 -->
|
||||
public async Task<bool> DeleteByUnitId(ObjectId unitId)
|
||||
{
|
||||
return await _authorityRepository.DeleteAllAuthoritiesByUnit(unitId);
|
||||
@@ -145,6 +151,7 @@ public class AuthService : IAuthService
|
||||
/// </summary>
|
||||
/// <param name="displayId">The unique identifier of the display whose related authorities should be removed.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if authorities were successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=87a9f41 body=fa867f0 -->
|
||||
public async Task<bool> DeleteByDisplayId(ObjectId displayId)
|
||||
{
|
||||
return await _authorityRepository.DeleteAllAuthoritiesByDisplay(displayId);
|
||||
@@ -153,6 +160,7 @@ public class AuthService : IAuthService
|
||||
/// <summary>
|
||||
/// Ensures the authentication utilities are initialized with a valid login token. Returns early if the recording API URL is not configured; otherwise, requests a new token when the current one is missing or expired, and updates the shared <see cref="AuthUtils"/> instance with the refreshed response when successful.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e577d60 body=e927320 -->
|
||||
private async Task InstanceAuthUtils()
|
||||
{
|
||||
if (_recordingSettings.RecordingApiUrl.IsEmpty())
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// según CacheSettings y la entidad del key.
|
||||
/// Implementa ICacheService y delega en el backend elegido.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9f15289 -->
|
||||
public class CacheDispatcher(
|
||||
RedisService redis,
|
||||
CacheService memory,
|
||||
@@ -27,6 +28,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The cache key used to determine the entity type and the corresponding cache backend.</param>
|
||||
/// <returns>The <see cref="ICacheService"/> instance that should handle caching for the supplied key.</returns>
|
||||
/// <!-- aidoc:v1 sig=26395d4 body=a1c4c59 -->
|
||||
private ICacheService SelectBackend(string key)
|
||||
{
|
||||
var entity = CacheKeyClassifier.Classify(key);
|
||||
@@ -56,6 +58,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="gf">The grouped field whose name contributes to the key.</param>
|
||||
/// <param name="patientId">The identifier of the patient associated with the grouped observation.</param>
|
||||
/// <returns>A formatted key string in the form <c>GroupedObs:{patientId}:{gf.Name}</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=72c65a6 -->
|
||||
private static string BuildGroupedKey(GroupedField gf, ObjectId patientId)
|
||||
=> $"GroupedObs:{patientId}:{gf.Name}";
|
||||
|
||||
@@ -65,6 +68,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="groupedField">The grouped field used to derive the cache key.</param>
|
||||
/// <param name="patientId">The patient identifier used to derive the cache key.</param>
|
||||
/// <returns>The <see cref="ICacheService"/> backend associated with the built grouped key.</returns>
|
||||
/// <!-- aidoc:v1 sig=2461014 -->
|
||||
private ICacheService SelectBackend(GroupedField groupedField, ObjectId patientId)
|
||||
=> SelectBackend(BuildGroupedKey(groupedField, patientId));
|
||||
|
||||
@@ -78,6 +82,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttl">An optional time-to-live duration for the cached object. If null, the backend's default expiration is applied.</param>
|
||||
/// <param name="cancellationToken">A token to observe while waiting for the operation to complete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the retrieved or newly created object of type <typeparamref name="T"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=5407b21 -->
|
||||
public Task<T> GetOrSetObjectAsync<T>(
|
||||
string key,
|
||||
Func<Task<T>> factory,
|
||||
@@ -94,6 +99,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="loader">An asynchronous function that produces the value to cache when no existing entry is found.</param>
|
||||
/// <param name="ttl">An optional time-to-live duration after which the cached entry expires. If null, the backend's default TTL is used.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the cached or loaded string value, or null if no value could be obtained.</returns>
|
||||
/// <!-- aidoc:v1 sig=0bd9db4 -->
|
||||
public Task<string?> GetOrSetValueAsync(
|
||||
string key,
|
||||
Func<Task<string>> loader,
|
||||
@@ -113,6 +119,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttl">An optional time-to-live applied to the cached object. When <c>null</c>, the backend's default expiration is used.</param>
|
||||
/// <param name="cancellationToken">The token to observe for canceling the asynchronous operation.</param>
|
||||
/// <returns>A task that represents the asynchronous get-or-set operation, containing the retrieved or newly created object.</returns>
|
||||
/// <!-- aidoc:v1 sig=c950b98 -->
|
||||
public Task<T> GetOrSetObjectAsync<T>(
|
||||
GroupedField groupedField,
|
||||
ObjectId patientId,
|
||||
@@ -129,6 +136,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The key used to select the backend and identify the value to set.</param>
|
||||
/// <param name="value">The value to associate with the specified key.</param>
|
||||
/// <!-- aidoc:v1 sig=3796865 -->
|
||||
public void SetValue(string key, string value)
|
||||
=> SelectBackend(key).SetValue(key, value);
|
||||
|
||||
@@ -137,6 +145,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The key used to select the backend and retrieve the associated value.</param>
|
||||
/// <returns>The value associated with the key, or <c>null</c> if the selected backend returns no value.</returns>
|
||||
/// <!-- aidoc:v1 sig=f39f53d -->
|
||||
public string? GetValue(string key)
|
||||
=> SelectBackend(key).GetValue(key);
|
||||
|
||||
@@ -146,6 +155,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="key">The identifier used to select the appropriate backend and to look up the object.</param>
|
||||
/// <param name="upd">Indicates whether the underlying backend should perform an update during retrieval. Defaults to <c>true</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous retrieval operation, containing the object of type <typeparamref name="T"/> or <c>null</c> if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=15709a1 -->
|
||||
public Task<T?> GetObjectAsync<T>(string key, bool upd = true)
|
||||
=> SelectBackend(key).GetObjectAsync<T>(key, upd);
|
||||
|
||||
@@ -157,6 +167,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="obj">The object to store in the selected backend.</param>
|
||||
/// <param name="upd">Indicates whether an update operation should be performed. Defaults to <c>true</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous store operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=9d84645 -->
|
||||
public Task SetObjectAsync<T>(string key, T obj, bool upd = true)
|
||||
=> SelectBackend(key).SetObjectAsync(key, obj, upd);
|
||||
|
||||
@@ -167,6 +178,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttl">An optional time-to-live applied to the object; if null, the backend's default is used.</param>
|
||||
/// <param name="upd">A flag indicating whether the retrieval should update the object's state (e.g., refresh expiration).</param>
|
||||
/// <returns>A task containing the deserialized object, or null if the object is not found in the selected backend.</returns>
|
||||
/// <!-- aidoc:v1 sig=4675112 -->
|
||||
public Task<T?> GetObjectAsync<T>(string key, TimeSpan? ttl, bool upd)
|
||||
=> SelectBackend(key).GetObjectAsync<T>(key, ttl, upd);
|
||||
|
||||
@@ -178,6 +190,8 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttl">The optional time-to-live duration for the stored object.</param>
|
||||
/// <param name="upd">Indicates whether to update an existing entry or create a new one.</param>
|
||||
/// <returns>A task that represents the asynchronous set operation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Generic type parameter T (the type of the object being stored) is not documented" -->
|
||||
public Task SetObjectAsync<T>(string key, T obj, TimeSpan? ttl, bool upd)
|
||||
=> SelectBackend(key).SetObjectAsync(key, obj, ttl, upd);
|
||||
|
||||
@@ -186,6 +200,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier of the object to delete, also used to resolve the responsible backend.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=0dde5af -->
|
||||
public Task DeleteObjectAsync(string key)
|
||||
=> SelectBackend(key).DeleteObjectAsync(key);
|
||||
|
||||
@@ -194,12 +209,14 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="pattern">The pattern used to match entries for deletion in both storage backends.</param>
|
||||
/// <returns>The combined total number of entries deleted from Redis and in-memory storage.</returns>
|
||||
/// <!-- aidoc:v1 sig=fa6dca4 -->
|
||||
public async Task<long> DeleteByPatternAsync(string pattern)
|
||||
=> await redis.DeleteByPatternAsync(pattern) + await memory.DeleteByPatternAsync(pattern);
|
||||
|
||||
/// <summary>
|
||||
/// Clears all cached data from both the in-memory cache and the Redis cache, ensuring that stale entries are removed across all configured cache providers.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d5e5e8c body=c0791ef -->
|
||||
public void CleanCache()
|
||||
{
|
||||
memory.CleanCache();
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// mediante LockManagerService + InMemoryLockProvider.
|
||||
/// Compatible con la interfaz ICacheService incluyendo GetOrSet.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=53daded -->
|
||||
public class CacheService(LockManagerService lockManager) : ICacheService
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, object> _mem = new();
|
||||
@@ -21,6 +22,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="gf">The grouped field whose name is included in the key.</param>
|
||||
/// <param name="patientId">The identifier of the patient the key is scoped to.</param>
|
||||
/// <returns>A formatted key string in the form <c>GroupedObs:{patientId}:{gf.Name}</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=72c65a6 -->
|
||||
private static string BuildGroupedKey(GroupedField gf, ObjectId patientId)
|
||||
=> $"GroupedObs:{patientId}:{gf.Name}";
|
||||
|
||||
@@ -34,6 +36,8 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttl">Optional time-to-live associated with the cached object.</param>
|
||||
/// <param name="cancellationToken">A token to observe for cancellation requests.</param>
|
||||
/// <returns>The cached or newly created object of type <typeparamref name="T"/>.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=mentions_removed_behavior
|
||||
/// "The `ttl` parameter is documented as 'Optional time-to-live associated with the cached object', but the method body never uses `ttl`—the cache assignment `_mem[key] = created;` has no TTL/expiration handling, so readers will be misled into believing the TTL is honored." -->
|
||||
public async Task<T> GetOrSetObjectAsync<T>(
|
||||
string key,
|
||||
Func<Task<T>> factory,
|
||||
@@ -71,6 +75,8 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="loader">The asynchronous function invoked to load the value when no cached entry exists for the key.</param>
|
||||
/// <param name="ttlOverride">An optional time span that overrides the default time-to-live for the cached value.</param>
|
||||
/// <returns>The cached or newly loaded string value, or <c>null</c> when the underlying cache entry is absent or cannot be cast to a string.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_returns
|
||||
/// "The <returns> text claims the method returns null 'when the underlying cache entry ... cannot be cast to a string', but the explicit cast (string?)result would throw InvalidCastException rather than yield null in that case." -->
|
||||
public async Task<string?> GetOrSetValueAsync(
|
||||
string key,
|
||||
Func<Task<string>> loader,
|
||||
@@ -94,6 +100,8 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttl">Optional time-to-live for the cached entry.</param>
|
||||
/// <param name="cancellationToken">Token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task containing the cached or newly created object.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_param_role
|
||||
/// "The `ttl` parameter is documented as 'Optional time-to-live for the cached entry', but it is never referenced in the method body — no TTL is applied to the stored entry, and the lock timeout is hardcoded to 5 seconds. A reader would expect their TTL value to be honored, but it is effectively ignored." -->
|
||||
public async Task<T> GetOrSetObjectAsync<T>(
|
||||
GroupedField groupedField,
|
||||
ObjectId patientId,
|
||||
@@ -131,6 +139,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The key that identifies where the value will be stored.</param>
|
||||
/// <param name="value">The value to associate with the specified key.</param>
|
||||
/// <!-- aidoc:v1 sig=f3491fe -->
|
||||
public void SetValue(string key, string value)
|
||||
=> _mem[key] = value;
|
||||
|
||||
@@ -140,6 +149,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The key used to look up the value in the underlying store.</param>
|
||||
/// <returns>The string representation of the stored value if the key exists; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=7a34703 -->
|
||||
public string? GetValue(string key)
|
||||
=> _mem.TryGetValue(key, out var v) ? v.ToString() : null;
|
||||
|
||||
@@ -150,6 +160,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="key">The cache key used to look up the stored object.</param>
|
||||
/// <param name="updateExpiration">Indicates whether the entry's expiration should be refreshed on access. Not currently used by this implementation.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> containing the cached value cast to <typeparamref name="T"/>, or <c>null</c> if no entry exists for the given key.</returns>
|
||||
/// <!-- aidoc:v1 sig=5046896 body=6902631 -->
|
||||
public Task<T?> GetObjectAsync<T>(string key, bool updateExpiration = true)
|
||||
{
|
||||
return Task.FromResult(
|
||||
@@ -163,6 +174,8 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="key">The cache key under which the object will be stored.</param>
|
||||
/// <param name="obj">The object to store in the cache.</param>
|
||||
/// <param name="updateExpiration">Indicates whether the cache entry's expiration should be refreshed.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=mentions_removed_behavior
|
||||
/// "The updateExpiration parameter is documented as indicating whether the cache entry's expiration should be refreshed, but the method body never references this parameter, so the documented behavior does not occur." -->
|
||||
public Task SetObjectAsync<T>(string key, T obj, bool updateExpiration = true)
|
||||
{
|
||||
_mem[key] = obj!;
|
||||
@@ -176,6 +189,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttlOverride">An optional time-to-live override accepted by this overload but ignored when delegating to the underlying retrieval call.</param>
|
||||
/// <param name="upd">A flag indicating whether the retrieval should trigger an update on the stored object.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the retrieved object of type <typeparamref name="T"/> or <c>null</c> if no object is found for the given key.</returns>
|
||||
/// <!-- aidoc:v1 sig=773648d -->
|
||||
public Task<T?> GetObjectAsync<T>(string key, TimeSpan? ttlOverride, bool upd)
|
||||
=> GetObjectAsync<T>(key, upd);
|
||||
|
||||
@@ -187,6 +201,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttlOverride">An optional time-to-live override for the stored entry; not applied by this overload.</param>
|
||||
/// <param name="upd">A flag indicating whether the operation should update an existing entry.</param>
|
||||
/// <returns>A task that represents the asynchronous set operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=874b6ce -->
|
||||
public Task SetObjectAsync<T>(string key, T obj, TimeSpan? ttlOverride, bool upd)
|
||||
=> SetObjectAsync(key, obj, upd);
|
||||
|
||||
@@ -196,6 +211,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// Asynchronously removes the object associated with the specified key from the in-memory store. The operation succeeds silently whether or not the key exists.
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier of the object to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=93555f0 body=00affc5 -->
|
||||
public Task DeleteObjectAsync(string key)
|
||||
{
|
||||
_mem.TryRemove(key, out _);
|
||||
@@ -207,6 +223,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="pattern">The pattern to match against cache keys. Asterisk (*) characters are removed and the remaining text is used as a substring match.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the count of entries that were removed.</returns>
|
||||
/// <!-- aidoc:v1 sig=a8cca2e body=81413d3 -->
|
||||
public Task<long> DeleteByPatternAsync(string pattern)
|
||||
{
|
||||
var p = pattern.Replace("*", "");
|
||||
@@ -223,6 +240,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Clears all entries from the in-memory cache, removing any previously stored data.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8762842 -->
|
||||
public void CleanCache() => _mem.Clear();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// Se basa en SemaphoreSlim y solo controla concurrencia DENTRO del proceso.
|
||||
/// Para CacheService (in-memory).
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ea44018 -->
|
||||
public class InMemoryLockProvider : ILockProvider
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, SemaphoreSlim> _locks = new(StringComparer.Ordinal);
|
||||
@@ -15,6 +16,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Crea u obtiene un semáforo asociado a la clave.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=af8b85d body=29079e4 -->
|
||||
private SemaphoreSlim GetOrCreate(string key)
|
||||
{
|
||||
return _locks.GetOrAdd(key, _ => new SemaphoreSlim(1, 1));
|
||||
@@ -23,6 +25,12 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Intenta adquirir el lock por clave.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Parameter 'key' is not documented" -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Parameter 'timeout' is not documented" -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_returns
|
||||
/// "Return value (bool indicating acquisition success) is not documented" -->
|
||||
public async Task<bool> AcquireAsync(string key, TimeSpan timeout)
|
||||
{
|
||||
var sem = GetOrCreate(key);
|
||||
@@ -42,6 +50,8 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Libera el lock (si existe y no está ya liberado).
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "The 'key' parameter is not documented; only a <summary> is provided, with no <param name=\"key\"> tag describing the lock identifier." -->
|
||||
public Task ReleaseAsync(string key)
|
||||
{
|
||||
if (!_locks.TryGetValue(key, out var sem))
|
||||
|
||||
@@ -8,6 +8,10 @@ namespace adas_core.Application.Services.Caching
|
||||
/// CacheService lo usará para evitar condiciones de carrera en GetOrSet.
|
||||
/// Funciona igual para locks locales o distribuidos.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'logger' (ILogger<LockManagerService>) is not documented." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'provider' (ILockProvider) is not documented." -->
|
||||
public class LockManagerService(
|
||||
ILogger<LockManagerService> logger,
|
||||
ILockProvider provider)
|
||||
@@ -15,6 +19,18 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Ejecuta una función que devuelve un valor bajo un lock por clave.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Parameter 'key' is not documented" -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Parameter 'timeout' is not documented" -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Parameter 'action' is not documented" -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Parameter 'cancellationToken' is not documented" -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_returns
|
||||
/// "Method returns Task<T> via action delegate, but no <returns> tag is present" -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_exception
|
||||
/// "TimeoutException is thrown when the lock cannot be acquired within the timeout, but no <exception> tag is present" -->
|
||||
public async Task<T> WithLockAsync<T>(
|
||||
string key,
|
||||
TimeSpan timeout,
|
||||
@@ -57,6 +73,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Version Task (sin valor).
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3facc4e body=59bc0c3 -->
|
||||
public Task WithLockAsync(
|
||||
string key,
|
||||
TimeSpan timeout,
|
||||
@@ -77,6 +94,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Libera el lock y registra posibles errores sin interrumpir el flujo.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=88f2f04 body=608f118 -->
|
||||
private async Task SafeReleaseAsync(string key)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// No almacena nada, no devuelve nada y no interfiere con el flujo.
|
||||
/// Se usa cuando el CacheMode es "None".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2b881c5 -->
|
||||
public class NoCacheService : ICacheService
|
||||
{
|
||||
/// <summary>
|
||||
@@ -16,6 +17,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier used to reference the value.</param>
|
||||
/// <param name="value">The value intended to be associated with the key.</param>
|
||||
/// <!-- aidoc:v1 sig=c91035b body=4448e1d -->
|
||||
public void SetValue(string key, string value)
|
||||
{
|
||||
// No hacer nada
|
||||
@@ -27,6 +29,8 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The key used to look up the associated value.</param>
|
||||
/// <returns>The value associated with <paramref name="key"/>, or <c>null</c> if no value is found.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the method 'retrieves' a value for the specified key, but the body unconditionally returns null and performs no retrieval/lookup logic. The <returns> tag also implies a non-null value path that the code cannot produce." -->
|
||||
public string? GetValue(string key)
|
||||
{
|
||||
return null;
|
||||
@@ -38,6 +42,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="key">The identifier of the object to retrieve.</param>
|
||||
/// <param name="updateExpiration">Indicates whether the expiration of the entry should be updated upon retrieval.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous retrieval, containing the object associated with the key or the default value of <typeparamref name="T"/> if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=5046896 body=772039d -->
|
||||
public Task<T?> GetObjectAsync<T>(string key, bool updateExpiration = true)
|
||||
{
|
||||
return Task.FromResult<T?>(default);
|
||||
@@ -50,6 +55,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="key">The unique identifier used to store and later retrieve the object.</param>
|
||||
/// <param name="obj">The object to store in the data store.</param>
|
||||
/// <param name="updateExpiration">Indicates whether the expiration time of the cached entry should be updated. Defaults to true.</param>
|
||||
/// <!-- aidoc:v1 sig=255c42a body=6805ef5 -->
|
||||
public Task SetObjectAsync<T>(string key, T obj, bool updateExpiration = true)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -63,6 +69,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttlOverride">An optional time-to-live value that, when provided, overrides the default expiration for the entry.</param>
|
||||
/// <param name="updateExpiration">Indicates whether the expiration of the entry should be refreshed upon a successful retrieval.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous operation, containing the retrieved object or <c>null</c> if no value is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=efdd78f body=772039d -->
|
||||
public Task<T?> GetObjectAsync<T>(string key, TimeSpan? ttlOverride, bool updateExpiration)
|
||||
{
|
||||
return Task.FromResult<T?>(default);
|
||||
@@ -76,6 +83,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttlOverride">An optional time-to-live value that overrides the default expiration period; <c>null</c> uses the default.</param>
|
||||
/// <param name="updateExpiration">A value indicating whether the expiration time should be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous set operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=25d628c body=6805ef5 -->
|
||||
public Task SetObjectAsync<T>(string key, T obj, TimeSpan? ttlOverride, bool updateExpiration)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -87,6 +95,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="pattern">The pattern used to identify the items to delete.</param>
|
||||
/// <returns>A <see cref="Task{Int64}"/> representing the asynchronous operation, with a result of 0 indicating that no items were deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=a8cca2e body=14896de -->
|
||||
public Task<long> DeleteByPatternAsync(string pattern)
|
||||
{
|
||||
return Task.FromResult(0L);
|
||||
@@ -98,6 +107,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier of the object to delete.</param>
|
||||
/// <returns>A <see cref="Task"/> that represents the asynchronous delete operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=93555f0 body=6805ef5 -->
|
||||
public Task DeleteObjectAsync(string key)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -106,6 +116,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Performs a cleanup operation on the cache. Currently, this method has no implementation and does not perform any cleanup actions.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d5e5e8c body=4448e1d -->
|
||||
public void CleanCache()
|
||||
{
|
||||
// Nada que limpiar
|
||||
@@ -142,6 +153,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="loader">The asynchronous function used to load the value.</param>
|
||||
/// <param name="ttl">An optional time-to-live duration for the value.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the loaded value as a nullable string.</returns>
|
||||
/// <!-- aidoc:v1 sig=02351fc body=f2ab08b -->
|
||||
public async Task<string?> GetOrSetValueAsync(
|
||||
string key,
|
||||
Func<Task<string>> loader,
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// Lock distribuido en Redis. Usa token por adquisición (owner)
|
||||
/// y liberación segura con script Lua: borra la key solo si el valor coincide.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=db4fe1b -->
|
||||
public class RedisLockProvider(Func<IDatabase?> getDatabase) : ILockProvider
|
||||
{
|
||||
private readonly string _prefix = "lock:";
|
||||
@@ -31,6 +32,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="key">The identifier of the resource to lock.</param>
|
||||
/// <param name="timeout">The maximum duration to keep retrying before giving up.</param>
|
||||
/// <returns><c>true</c> if the lock was successfully acquired; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=4b91964 body=b8dd956 -->
|
||||
public async Task<bool> AcquireAsync(string key, TimeSpan timeout)
|
||||
{
|
||||
var redis = getDatabase();
|
||||
@@ -58,6 +60,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// Asynchronously releases the token associated with the specified key by removing it from the in-memory token store and executing a Lua release script against Redis. If the key is not found in the local store, or the Redis database is unavailable, the method returns without performing any further action.
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier of the token to release.</param>
|
||||
/// <!-- aidoc:v1 sig=03497b0 body=db68b0e -->
|
||||
public async Task ReleaseAsync(string key)
|
||||
{
|
||||
if (!_tokens.TryRemove(key, out var token))
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Represents a Redis-based implementation of the <see cref="ICacheService"/> interface for caching operations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a3787ed -->
|
||||
public class RedisService : ICacheService
|
||||
{
|
||||
private readonly ILogger<RedisService> _logger;
|
||||
@@ -59,6 +60,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttl">Optional time-to-live duration for the cached object. If null, the cache default is used.</param>
|
||||
/// <param name="cancellationToken">The token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the cached or newly created object.</returns>
|
||||
/// <!-- aidoc:v1 sig=df20281 body=dc4ffdf -->
|
||||
public async Task<T> GetOrSetObjectAsync<T>(
|
||||
string key,
|
||||
Func<Task<T>> factory,
|
||||
@@ -100,6 +102,8 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="loader">The asynchronous function invoked to produce the value when it is not present in the cache.</param>
|
||||
/// <param name="ttl">Optional time-to-live applied to the cached value; if not provided, the default caching policy is used.</param>
|
||||
/// <returns>The cached value when available, or the value produced by the loader when the cache is empty or Redis is unavailable.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=mentions_removed_behavior
|
||||
/// "The ttl parameter is documented as 'applied to the cached value', but the code never references or passes ttl to SetValue; the parameter is unused in the method body." -->
|
||||
public async Task<string?> GetOrSetValueAsync(
|
||||
string key,
|
||||
Func<Task<string>> loader,
|
||||
@@ -136,6 +140,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="gf">The grouped field whose name is used to identify the observation group.</param>
|
||||
/// <param name="patientId">The identifier of the patient the observation belongs to.</param>
|
||||
/// <returns>A formatted string key combining the <c>GroupedObs</c> prefix, the patient identifier, and the grouped field name.</returns>
|
||||
/// <!-- aidoc:v1 sig=72c65a6 -->
|
||||
private static string BuildGroupedKey(GroupedField gf, ObjectId patientId)
|
||||
=> $"GroupedObs:{patientId}:{gf.Name}";
|
||||
|
||||
@@ -148,6 +153,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttl">Optional time-to-live applied to the stored cache entry. If null, no expiration is set.</param>
|
||||
/// <param name="cancellationToken">Token used to cancel the distributed lock operation.</param>
|
||||
/// <returns>The cached object if present, otherwise the object produced by <paramref name="factory"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=f122a12 body=a3fec17 -->
|
||||
public async Task<T> GetOrSetObjectAsync<T>(
|
||||
GroupedField groupedField,
|
||||
ObjectId patientId,
|
||||
@@ -190,6 +196,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The key under which the value will be stored.</param>
|
||||
/// <param name="value">The string value to persist.</param>
|
||||
/// <!-- aidoc:v1 sig=fb46470 -->
|
||||
public void SetValue(string key, string value)
|
||||
=> _database?.StringSet(key, value, GetEntityTtl(key), true);
|
||||
|
||||
@@ -198,6 +205,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier of the value to look up in the data store.</param>
|
||||
/// <returns>The stored string value, or <c>null</c> if the key does not exist or the data store is unavailable.</returns>
|
||||
/// <!-- aidoc:v1 sig=39e4be0 body=3910e79 -->
|
||||
public string? GetValue(string key)
|
||||
{
|
||||
var val = _database?.StringGet(key);
|
||||
@@ -214,6 +222,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="updateExpiration">When <c>true</c> (the default), resets the key's time-to-live to the configured entity TTL on a successful read, implementing sliding expiration.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> containing the deserialized object, or <c>default</c> if Redis is unavailable or the key is missing/empty.</returns>
|
||||
/// <exception cref="Exception">Thrown when the stored JSON payload cannot be deserialized into <typeparamref name="T"/>; the original exception is wrapped and rethrown.</exception>
|
||||
/// <!-- aidoc:v1 sig=a7a96b7 body=6c885c8 -->
|
||||
public async Task<T?> GetObjectAsync<T>(string key, bool updateExpiration = true)
|
||||
{
|
||||
if (!_isRedisAvailable)
|
||||
@@ -248,6 +257,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="key">The key under which the object will be stored.</param>
|
||||
/// <param name="obj">The object to store.</param>
|
||||
/// <param name="updateExpiration">Indicates whether the expiration time of the entry should be updated.</param>
|
||||
/// <!-- aidoc:v1 sig=2dac8a4 -->
|
||||
public async Task SetObjectAsync<T>(
|
||||
string key,
|
||||
T obj,
|
||||
@@ -261,6 +271,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="obj">The object to serialize and persist to Redis.</param>
|
||||
/// <param name="ttlOverride">An optional time-to-live override; when null, the entity's default TTL is applied.</param>
|
||||
/// <param name="updateExpiration">Flag indicating whether the expiration should be updated.</param>
|
||||
/// <!-- aidoc:v1 sig=b181b67 body=11fd650 -->
|
||||
public async Task SetObjectAsync<T>(
|
||||
string key,
|
||||
T obj,
|
||||
@@ -283,6 +294,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// When the Redis backend is unavailable, the call is skipped silently as a no-op fallback.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier of the cached object to remove.</param>
|
||||
/// <!-- aidoc:v1 sig=884f4b6 body=00b8917 -->
|
||||
public async Task DeleteObjectAsync(string key)
|
||||
{
|
||||
if (_isRedisAvailable)
|
||||
@@ -295,6 +307,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="pattern">The pattern used to match Redis keys to be deleted.</param>
|
||||
/// <returns>The number of keys that were deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=691e7ee body=f96f2c9 -->
|
||||
public async Task<long> DeleteByPatternAsync(string pattern)
|
||||
{
|
||||
if (!_isRedisAvailable || _server == null)
|
||||
@@ -311,6 +324,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Clears all cached data by flushing the underlying server database. If the server instance is <see langword="null"/>, the call is safely skipped as a no-op.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f510ade -->
|
||||
public void CleanCache()
|
||||
=> _server?.FlushDatabase();
|
||||
|
||||
@@ -321,6 +335,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The cache key used to classify the entity type and determine the applicable TTL.</param>
|
||||
/// <returns>A <see cref="TimeSpan"/> representing the configured TTL, or <c>null</c> if the resolved seconds value is not positive.</returns>
|
||||
/// <!-- aidoc:v1 sig=be2ec4a body=d7d015b -->
|
||||
private TimeSpan? GetEntityTtl(string key)
|
||||
{
|
||||
var entity = CacheKeyClassifier.Classify(key);
|
||||
@@ -341,6 +356,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// </summary>
|
||||
/// <param name="key">The key identifying the entity whose TTL presence is being checked.</param>
|
||||
/// <returns><c>true</c> if a TTL value is found for the specified key; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=9f4c827 -->
|
||||
private bool ShouldRenewTtl(string key)
|
||||
=> GetEntityTtl(key) != null;
|
||||
|
||||
@@ -349,6 +365,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <summary>
|
||||
/// Initializes the Redis connection for caching by connecting asynchronously, obtaining the database and server, and marking the connection as available on success. Returns early without establishing a connection when the configured Redis connection string is null, and logs any exception that occurs during initialization without rethrowing, leaving the connection marked as unavailable.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=819c56e body=e2d6e2b -->
|
||||
private async Task InitializeRedisConnectionAsync()
|
||||
{
|
||||
_isRedisAvailable = false;
|
||||
@@ -377,6 +394,7 @@ namespace adas_core.Application.Services.Caching
|
||||
/// <param name="ttlOverride">An optional time-to-live override; not applied by this overload.</param>
|
||||
/// <param name="updateExpiration">When true, the expiration of the cached entry is refreshed on retrieval.</param>
|
||||
/// <returns>A task that resolves to the cached object, or null if no entry exists for the specified key.</returns>
|
||||
/// <!-- aidoc:v1 sig=dc7158d -->
|
||||
public Task<T?> GetObjectAsync<T>(string key, TimeSpan? ttlOverride, bool updateExpiration)
|
||||
=> GetObjectAsync<T>(key, updateExpiration);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace adas_core.Application.Services;
|
||||
/// <summary>
|
||||
/// Implements the <see cref="ICalculatedObservationsService"/> contract, providing a service for working with calculated observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=955972a -->
|
||||
public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
{
|
||||
private static ICalculatedObservations? _service;
|
||||
@@ -78,6 +79,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// <param name="obs">The patient observation to map.</param>
|
||||
/// <param name="onlyByName">When <c>true</c>, restricts the mapping to lookups by name only.</param>
|
||||
/// <returns>The mapped <see cref="PatientObservation"/>, or <c>null</c> when the service yields no result; the input <paramref name="obs"/> is returned unchanged when no mapping service is configured.</returns>
|
||||
/// <!-- aidoc:v1 sig=4b4df54 body=a7f1fb2 -->
|
||||
public virtual async Task<PatientObservation?> Map(PatientObservation obs, bool onlyByName = false)
|
||||
{
|
||||
if (_service == null) return obs;
|
||||
@@ -94,6 +96,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// <param name="obs">The patient observation alarm to be mapped.</param>
|
||||
/// <param name="onlyByName">When true, restricts the mapping to a name-based lookup only.</param>
|
||||
/// <returns>The mapped <see cref="PatientObservationAlarm"/>, or <c>null</c> if the service mapped it to null, or the original <paramref name="obs"/> when no service is configured.</returns>
|
||||
/// <!-- aidoc:v1 sig=550b0f3 body=a7f1fb2 -->
|
||||
public virtual async Task<PatientObservationAlarm?> Map(PatientObservationAlarm obs, bool onlyByName = false)
|
||||
{
|
||||
if (_service == null) return obs;
|
||||
@@ -110,6 +113,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to be mapped.</param>
|
||||
/// <returns>A task that yields the mapped <see cref="PumpObservation"/>, or <see langword="null"/> if no mapping service is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=b69cb93 body=75e8a34 -->
|
||||
public virtual async Task<PumpObservation?> Map(PumpObservation obs)
|
||||
{
|
||||
if (_service == null) return null;
|
||||
@@ -122,6 +126,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// </summary>
|
||||
/// <param name="obs">The <see cref="PatientRecordingAlert"/> instance to be mapped.</param>
|
||||
/// <returns>The mapped <see cref="PatientRecordingAlert"/>, the original <paramref name="obs"/> if no service is available, or <c>null</c> if the service returned no result.</returns>
|
||||
/// <!-- aidoc:v1 sig=3678681 body=9648481 -->
|
||||
public async Task<PatientRecordingAlert?> Map(PatientRecordingAlert obs)
|
||||
{
|
||||
if (_service == null) return obs;
|
||||
@@ -137,6 +142,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment instance to be mapped or transformed.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the mapped <see cref="PatientTreatment"/> or <c>null</c> if the service returns no result.</returns>
|
||||
/// <!-- aidoc:v1 sig=b468f2f body=1c73c0e -->
|
||||
public async Task<PatientTreatment?> Map(PatientTreatment treatment)
|
||||
{
|
||||
if (_service == null) return treatment;
|
||||
@@ -149,6 +155,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis to be mapped.</param>
|
||||
/// <returns>A task that yields the mapped <see cref="PatientDiagnosis"/>, or <c>null</c> if the underlying service returns no result.</returns>
|
||||
/// <!-- aidoc:v1 sig=fd30fa4 body=5966a0e -->
|
||||
public virtual async Task<PatientDiagnosis?> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
if (_service == null) return diagnosis;
|
||||
@@ -162,6 +169,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of medicines currently active for the patient.</param>
|
||||
/// <param name="patientId">The unique identifier of the patient whose medicine observations are being calculated.</param>
|
||||
/// <!-- aidoc:v1 sig=0dfd9f3 body=65bf3e9 -->
|
||||
public virtual async Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
if (_service != null) await _service.CalculateMedicineObservation(activeMedicines, patientId);
|
||||
@@ -172,6 +180,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// If the service dependency is not initialized, the call is skipped silently as a no-op fallback.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient for whom the active bolus opiates calculation is performed.</param>
|
||||
/// <!-- aidoc:v1 sig=e30b38f body=a756e48 -->
|
||||
public async Task CalculateBolusOpiates(ObjectId patientId)
|
||||
{
|
||||
if (_service != null) await _service.CalculateActiveBolus(patientId);
|
||||
@@ -183,6 +192,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments should be retrieved.</param>
|
||||
/// <returns>A task that yields the collection of active <see cref="PatientTreatment"/> entries for the patient, or an empty list when the service is unavailable.</returns>
|
||||
/// <!-- aidoc:v1 sig=4caccd9 body=3a62497 -->
|
||||
public virtual async Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
if (_service != null) return await _service.GetActiveTreatmentsByPatient(id);
|
||||
@@ -194,6 +204,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be mapped.</param>
|
||||
/// <returns>A task containing the mapped list of patient observations, or an empty list if no service is configured.</returns>
|
||||
/// <!-- aidoc:v1 sig=8d07ed3 body=5a2680c -->
|
||||
public virtual async Task<List<PatientObservation>> MapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
if (_service != null) return await _service.PreMapList(listToInsert);
|
||||
@@ -206,6 +217,7 @@ public class CalculatedObservationsService : ICalculatedObservationsService
|
||||
/// <param name="observation">The patient observation onto which the source alarm will be mapped.</param>
|
||||
/// <param name="observationAlarm">The source alarm to be applied to the observation.</param>
|
||||
/// <returns>The <see cref="PatientObservation"/> produced by the service mapping, or the original <paramref name="observation"/> when no service is configured.</returns>
|
||||
/// <!-- aidoc:v1 sig=20c558b body=7b3984c -->
|
||||
public virtual async Task<PatientObservation> MapSourceAlarm(PatientObservation observation,
|
||||
PatientObservationAlarm observationAlarm)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace adas_core.Application.Services;
|
||||
/// <remarks>
|
||||
/// This service implements <see cref="ICameraService"/> and serves as the application-layer entry point for camera functionality.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=6d5b4e8 -->
|
||||
public class CameraService(ILogger<CameraService> logger, ICameraRepository cameraRepository, IPointOfCareService pointOfCareService) : ICameraService
|
||||
{
|
||||
private ICameraRepository _cameraRepository = cameraRepository;
|
||||
@@ -24,6 +25,7 @@ public class CameraService(ILogger<CameraService> logger, ICameraRepository came
|
||||
/// </summary>
|
||||
/// <param name="relayId">The unique identifier of the relay used to look up the camera.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Camera"/>, or null if no camera is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=b585cc5 body=450c6f8 -->
|
||||
public Task<Camera?> GetById(ObjectId relayId)
|
||||
{
|
||||
return _cameraRepository.GetById(relayId);
|
||||
@@ -33,6 +35,7 @@ public class CameraService(ILogger<CameraService> logger, ICameraRepository came
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The list of configuration relay identifiers used to look up the corresponding cameras.</param>
|
||||
/// <returns>A <see cref="List{Camera}"/> containing the cameras linked to the provided configuration relay identifiers.</returns>
|
||||
/// <!-- aidoc:v1 sig=63176e6 body=610970a -->
|
||||
public List<Camera> GetCameraInList(List<ObjectId> configurationRelayList)
|
||||
{
|
||||
return _cameraRepository.GetCameraInList(configurationRelayList);
|
||||
@@ -43,6 +46,7 @@ public class CameraService(ILogger<CameraService> logger, ICameraRepository came
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that controls page number, page size, and optional filtering criteria such as the in-use flag.</param>
|
||||
/// <returns>A paginated response containing the requested cameras, the current page metadata, and the total document count; if no data is found, an empty paginated response is returned.</returns>
|
||||
/// <!-- aidoc:v1 sig=6103643 body=d38962d -->
|
||||
public async Task<PaginationResponse<Camera>> GetPaginatedCameras(PaginationFilter filter)
|
||||
{
|
||||
var usedCameraIds = await pointOfCareService.FindAllIdCamerasInUse();
|
||||
@@ -91,6 +95,7 @@ public class CameraService(ILogger<CameraService> logger, ICameraRepository came
|
||||
/// <returns>The inserted camera, or null if the insertion did not return a result.</returns>
|
||||
/// <exception cref="System.Exception">Thrown when the camera name is null.</exception>
|
||||
/// <exception cref="System.Exception">Thrown when a camera with the same name already exists.</exception>
|
||||
/// <!-- aidoc:v1 sig=79f6b28 body=dcffae0 -->
|
||||
public async Task<Camera?> InsertCamera(Camera camera)
|
||||
{
|
||||
if (camera.Name == null) throw new Exception("Camera name cannot be null");
|
||||
@@ -105,6 +110,7 @@ public class CameraService(ILogger<CameraService> logger, ICameraRepository came
|
||||
/// <param name="objectId">The unique identifier of the camera to update.</param>
|
||||
/// <param name="camera">The camera data containing the updated values.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Camera"/>, or <c>null</c> if no camera with the specified identifier was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=b7e4a05 body=a5d1055 -->
|
||||
public async Task<Camera?> UpdateCameraById(ObjectId objectId, Camera camera)
|
||||
{
|
||||
return await _cameraRepository.UpdateCameraAsync(objectId, camera);
|
||||
@@ -115,6 +121,7 @@ public class CameraService(ILogger<CameraService> logger, ICameraRepository came
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the camera to delete.</param>
|
||||
/// <returns><c>true</c> if the camera was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=38e3ead body=afabb83 -->
|
||||
public async Task<bool> DeleteCamera(ObjectId objectId)
|
||||
{
|
||||
try
|
||||
@@ -138,6 +145,7 @@ public class CameraService(ILogger<CameraService> logger, ICameraRepository came
|
||||
/// </summary>
|
||||
/// <param name="textToSearch">The search text used to find cameras by name.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Camera"/> objects that match the search criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=a584e66 body=7c6677d -->
|
||||
public async Task<List<Camera>> GetSearchByNameCameras(string textToSearch)
|
||||
{
|
||||
return await _cameraRepository.GetSearchByNameCameras(textToSearch);
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace adas_core.Application.Services;
|
||||
/// <remarks>
|
||||
/// Acts as the default service type that fulfills the configuration observation interface.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=b6374e4 -->
|
||||
public class ConfigObservationService : IConfigObservationService
|
||||
{
|
||||
private static readonly ConcurrentDictionary<ObjectId, ConfigObservationCached> CachedConfigObservations = new();
|
||||
@@ -96,6 +97,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="ct">A token to monitor for cancellation requests.</param>
|
||||
/// <returns>A collection of all <see cref="ConfigObservation"/> entries, sourced from cache when available or from the repository otherwise.</returns>
|
||||
/// <!-- aidoc:v1 sig=c20c545 body=6a29098 -->
|
||||
public async Task<ICollection<ConfigObservation>> GetAllConfigs(CancellationToken ct = default)
|
||||
{
|
||||
|
||||
@@ -115,6 +117,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// Retrieves a compact representation of all configuration observations by returning the total item count.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="ConfigObservationDto"/> containing the total number of configuration observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=42b2f1f body=5519b7f -->
|
||||
public async Task<ConfigObservationDto> GetAllCompact()
|
||||
{
|
||||
var count = await _configObservationRepository.Count();
|
||||
@@ -126,6 +129,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing the requested page number and page size used to retrieve the items and populate the response metadata.</param>
|
||||
/// <returns>A <see cref="PaginationResponse{ConfigObservation}"/> containing the items for the requested page and the total count of all available items.</returns>
|
||||
/// <!-- aidoc:v1 sig=6f51347 body=9b21a36 -->
|
||||
public async Task<PaginationResponse<ConfigObservation>> GetPaginatedItems(PaginationFilter filter)
|
||||
{
|
||||
var result = await _configObservationRepository.GetPaginatedItems(filter);
|
||||
@@ -141,6 +145,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation to retrieve.</param>
|
||||
/// <returns>The configuration observation matching the specified identifier, or null if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=1821829 body=5e45c12 -->
|
||||
public async Task<ConfigObservation?> GetConfigById(ObjectId id)
|
||||
{
|
||||
return await _configObservationRepository.FindById(id) ?? null;
|
||||
@@ -151,6 +156,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier used to look up the related configuration names.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of configuration names matching the given identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=cff8c0e body=4d4999a -->
|
||||
public async Task<List<string>> GetConfigNames(string id)
|
||||
{
|
||||
return await _configObservationRepository.GetConfigNames(id);
|
||||
@@ -160,6 +166,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// Retrieves the list of configuration names from the configuration observation repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of configuration names.</returns>
|
||||
/// <!-- aidoc:v1 sig=fee3cef body=35d2c7e -->
|
||||
public async Task<List<string>> GetConfigNames()
|
||||
{
|
||||
return await _configObservationRepository.GetConfigNames();
|
||||
@@ -172,6 +179,8 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <typeparam name="T">The patient observation type, constrained to <see cref="BasePatientObservation"/>.</typeparam>
|
||||
/// <param name="obs">The patient observation for which the retention action is being evaluated.</param>
|
||||
/// <returns>A task containing the resolved <see cref="ObservatitonRetentionResult"/>, or null when no configuration is available.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "The method's return type is nullable, but the code always returns a non-null ObservatitonRetentionResult (falling back to NoDelete/null-policy-value), never null. The doc claims it returns null when no configuration is available, which is incorrect." -->
|
||||
public async Task<ObservatitonRetentionResult?> RetentionActions<T>(T obs) where T : BasePatientObservation
|
||||
{
|
||||
var conf = await Get(obs);
|
||||
@@ -192,6 +201,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="min">The optional minimum reference value included in the mapping.</param>
|
||||
/// <param name="max">The optional maximum reference value included in the mapping.</param>
|
||||
/// <returns>A task that resolves to the <see cref="StatusEnum.Type"/> computed from the mapped observation, or <see cref="StatusEnum.Type.Ok"/> when no applicable configuration or mapping status is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=2998c17 body=c347213 -->
|
||||
public async Task<StatusEnum.Type> GroupedObservationStatus(GroupedField groupedField,
|
||||
GroupedObservationEnum.Result result,
|
||||
string name, object value, double? min, double? max)
|
||||
@@ -228,6 +238,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="obs">The patient observation to be mapped.</param>
|
||||
/// <param name="onlyByName">If <c>true</c>, the configuration lookup is performed by name only; otherwise the full lookup is used.</param>
|
||||
/// <returns>The mapped observation, the original observation when unknown observations are allowed, or <c>null</c> when mapping is ignored or the configuration is invalid.</returns>
|
||||
/// <!-- aidoc:v1 sig=adab269 body=bb82b7b -->
|
||||
public async Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation
|
||||
{
|
||||
var conf = onlyByName ? await Get(obs, onlyByName) : await Get(obs);
|
||||
@@ -253,6 +264,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation to remove.</param>
|
||||
/// <returns>The removed <see cref="ConfigObservation"/> if it was found and deleted; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=93970f8 body=d775460 -->
|
||||
public async Task<ConfigObservation?> RemoveConfigItem(ObjectId id)
|
||||
{
|
||||
var item = await _configObservationRepository.FindById(id);
|
||||
@@ -272,6 +284,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment whose requested give codes are resolved against the configuration store.</param>
|
||||
/// <returns>The original <see cref="PatientTreatment"/> if a valid configuration is found, or <c>null</c> when the treatment should be discarded.</returns>
|
||||
/// <!-- aidoc:v1 sig=b468f2f body=f7cc310 -->
|
||||
public async Task<PatientTreatment?> Map(PatientTreatment treatment)
|
||||
{
|
||||
ConfigObservation? conf = null;
|
||||
@@ -292,6 +305,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="obs">The patient observation whose matching configuration should be resolved.</param>
|
||||
/// <param name="onlyByName">When <c>true</c>, the lookup is restricted to matching by <see cref="BasePatientObservation.Name"/> only; otherwise matching also considers code, coding system, and parent observation data.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the matched <see cref="ConfigObservation"/> processed via <c>Process</c>, or <c>null</c> if no configuration items are available or no match is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=887109c body=724c8ab -->
|
||||
public async Task<ConfigObservation?> Get<T>(T obs, bool onlyByName = false)
|
||||
where T : BasePatientObservation
|
||||
{
|
||||
@@ -369,6 +383,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="codingSystem">The coding system identifier used to filter the observation. May be <see langword="null"/>.</param>
|
||||
/// <param name="code">The code value used to filter the observation. May be <see langword="null"/>.</param>
|
||||
/// <returns>A processed <see cref="ConfigObservation"/> if a match is found; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=35cb21e body=8c37456 -->
|
||||
public async Task<ConfigObservation?> GetByCodeSysAndCode(string? codingSystem, string? code)
|
||||
{
|
||||
var filteredResult = await _configObservationRepository.GetByCodeSysAndCode(codingSystem, code);
|
||||
@@ -384,6 +399,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the configuration to look up; if null or empty, the method returns <c>null</c>.</param>
|
||||
/// <returns>A <see cref="ConfigObservation"/> when a matching configuration is found and successfully processed; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=2eba3bf body=dd0b407 -->
|
||||
public async Task<ConfigObservation?> Get(string? name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) return null;
|
||||
@@ -406,6 +422,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="configObservationItem">The configuration observation payload containing the identifier of the record to update.</param>
|
||||
/// <returns>The updated <see cref="ConfigObservation"/>.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no configuration observation exists for the supplied id.</exception>
|
||||
/// <!-- aidoc:v1 sig=9196090 body=719174b -->
|
||||
public async Task<ConfigObservation?> UpdateConfig(ConfigObservation configObservationItem)
|
||||
{
|
||||
// if (!configObservationItem.Id.HasValue)
|
||||
@@ -429,6 +446,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="name">The name used to look up the configuration observation items.</param>
|
||||
/// <returns>A collection of <see cref="ConfigObservation"/> items matching the specified name.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no configuration observation items are found for the given name.</exception>
|
||||
/// <!-- aidoc:v1 sig=9b9901d body=5a60f64 -->
|
||||
public async Task<IEnumerable<ConfigObservation>?> GetConfigObservationItem(string name)
|
||||
{
|
||||
var configObservationItems = await _configObservationRepository.FindAllByName(name);
|
||||
@@ -448,6 +466,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="originalName">The original name of the configuration observation item.</param>
|
||||
/// <returns>The matching <see cref="ConfigObservation"/> item.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no matching configuration observation item is found.</exception>
|
||||
/// <!-- aidoc:v1 sig=3639116 body=123e8de -->
|
||||
public async Task<ConfigObservation?> GetSingleConfigObservationItem(string? code, string? codingSystem,
|
||||
string? name, string? originalName)
|
||||
{
|
||||
@@ -466,6 +485,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="configObservationItem">The configuration observation item to delete; its identifier is used to locate the existing record.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the item is successfully deleted.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when no configuration observation is found with the specified identifier, or when the underlying delete operation fails.</exception>
|
||||
/// <!-- aidoc:v1 sig=ec35183 body=8a9a0b4 -->
|
||||
public async Task<bool> DeleteSingleConfigObservationItem(ConfigObservation configObservationItem)
|
||||
{
|
||||
var configObservation = await _configObservationRepository.FindById(configObservationItem.Id) ??
|
||||
@@ -489,6 +509,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to filter configuration observation items.</param>
|
||||
/// <returns>A collection of <see cref="ConfigObservation"/> items matching the specified name.</returns>
|
||||
/// <!-- aidoc:v1 sig=6809b70 body=c80c2e5 -->
|
||||
public async Task<IEnumerable<ConfigObservation>> GetConfigObservationItemsByName(string name)
|
||||
{
|
||||
return await _configObservationRepository.FindAllByName(name);
|
||||
@@ -500,6 +521,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="configObservation">The configuration observation entity to persist.</param>
|
||||
/// <returns>The created <see cref="ConfigObservation"/> if the operation succeeds.</returns>
|
||||
/// <exception cref="BadRequestException">Thrown when a configuration observation with the same identifier already exists.</exception>
|
||||
/// <!-- aidoc:v1 sig=d966188 body=7d8c724 -->
|
||||
public async Task<ConfigObservation?> CreateConfig(ConfigObservation configObservation)
|
||||
{
|
||||
|
||||
@@ -520,6 +542,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="itemName">The name of the configuration item to remove.</param>
|
||||
/// <returns>The removed <see cref="ConfigObservation"/>, or <c>null</c> if the repository did not return a result.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when no configuration item is found with the specified name.</exception>
|
||||
/// <!-- aidoc:v1 sig=f100c88 body=ec848a3 -->
|
||||
public async Task<ConfigObservation?> RemoveConfigItem(string itemName)
|
||||
{
|
||||
var configObservation = await GetConfigByName(itemName) ??
|
||||
@@ -543,6 +566,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="configObservationId">The unique identifier of the configuration observation to retrieve.</param>
|
||||
/// <returns>The configuration observation obtained from cache or repository, or a new empty instance when no matching record exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=f3c60d4 body=645b284 -->
|
||||
public async Task<ConfigObservation?> GetConfig(ObjectId configObservationId)
|
||||
{
|
||||
RefreshCachedConfigObservations();
|
||||
@@ -570,6 +594,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="name">The case-insensitive name of the configuration observation to look up.</param>
|
||||
/// <returns>The matching <see cref="ConfigObservation"/>, or <c>null</c> if not found or the name is invalid.</returns>
|
||||
/// <!-- aidoc:v1 sig=b4fcdb3 body=2875d2c -->
|
||||
public async Task<ConfigObservation?> GetConfigByName(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name)) return null;
|
||||
@@ -602,6 +627,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// Removes expired entries from the cached configuration observations when a refresh timeout is configured,
|
||||
/// performing an early return if no refresh timeout is set.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1aa90f3 body=0a408f4 -->
|
||||
private void RefreshCachedConfigObservations()
|
||||
{
|
||||
if (!_refreshTimeout.HasValue) return;
|
||||
@@ -620,6 +646,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="confItem">The configuration observation to process. Its retention policy and retention policy value are updated in place.</param>
|
||||
/// <returns>A task containing the processed <see cref="ConfigObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d6edc85 body=6ba1090 -->
|
||||
private Task<ConfigObservation> Process(ConfigObservation confItem)
|
||||
{
|
||||
confItem.RetentionPolicy ??= _defaultRetentionPolicy;
|
||||
@@ -641,6 +668,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// If no refresh timeout is set, the method returns without performing any cleanup.
|
||||
/// Any exceptions encountered during the cleanup are caught and logged.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d3e4c66 body=bb82f36 -->
|
||||
private void RefreshCachedConfigObservationKeys()
|
||||
{
|
||||
try
|
||||
@@ -670,6 +698,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <param name="obs">The observation instance to enrich with configuration values. Modified in place.</param>
|
||||
/// <param name="conf">The configuration observation providing thresholds, colors, expiration, and other settings to apply.</param>
|
||||
/// <returns>The mapped observation, returned as-is when the observation's coding system is configured to skip status calculation.</returns>
|
||||
/// <!-- aidoc:v1 sig=4cafe53 body=3ca4d27 -->
|
||||
private async Task<T?> MapConf<T>(T obs, ConfigObservation conf) where T : BasePatientObservation
|
||||
{
|
||||
_logger.LogTrace("Mapping observation: {obs}", obs);
|
||||
@@ -819,6 +848,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <remarks>
|
||||
/// This type is intended to be used internally to store and reuse configuration observation results.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=9f92750 -->
|
||||
private class ConfigObservationCached
|
||||
{
|
||||
public DateTime NextRefresh { get; set; }
|
||||
@@ -828,6 +858,7 @@ public class ConfigObservationService : IConfigObservationService
|
||||
/// <summary>
|
||||
/// Represents a private cache entry for configuration observation keys, used to store and retrieve previously computed key values associated with configuration observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=280cb2a -->
|
||||
private class ConfigObservationKeyCached
|
||||
{
|
||||
public DateTime NextRefresh { get; set; }
|
||||
|
||||
@@ -40,6 +40,7 @@ public class ConfigPumpsService(
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to map, containing the alarm type used for configuration lookup.</param>
|
||||
/// <returns>The mapped pump observation, or the original observation when mapping is skipped or the configuration lookup yields no result.</returns>
|
||||
/// <!-- aidoc:v1 sig=daf9ea9 body=b1d8856 -->
|
||||
public async Task<PumpObservation> Map(PumpObservation obs)
|
||||
{
|
||||
if (!_configPumpsRequired) return obs;
|
||||
@@ -57,6 +58,7 @@ public class ConfigPumpsService(
|
||||
/// Retrieves all available pump configurations from the underlying repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ConfigPumps"/> if any are available, or <c>null</c> when no configurations exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=23fc0df body=05ec99d -->
|
||||
public async Task<List<ConfigPumps>?> GetAllPumpConfigs()
|
||||
{
|
||||
return await configPumpsRepository.GetAllConfigs();
|
||||
@@ -68,6 +70,7 @@ public class ConfigPumpsService(
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the pump configuration to retrieve.</param>
|
||||
/// <returns>A <see cref="ConfigPumps"/> instance if a matching configuration is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d9bd34a body=d1db9d5 -->
|
||||
public async Task<ConfigPumps?> GetPumpConfigById(string id)
|
||||
{
|
||||
return await configPumpsRepository.FindById(id);
|
||||
@@ -78,6 +81,7 @@ public class ConfigPumpsService(
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the config pump to look up.</param>
|
||||
/// <returns>A task that resolves to the list of <see cref="ConfigPumpItem"/> entries, or <c>null</c> if the config pump does not exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=68a23c4 body=0689fc9 -->
|
||||
public async Task<List<ConfigPumpItem>?> GetConfigItems(string id)
|
||||
{
|
||||
var result = await configPumpsRepository.FindById(id);
|
||||
@@ -91,6 +95,7 @@ public class ConfigPumpsService(
|
||||
/// <param name="pumpConfig">The pump configuration to update, identified by its <see cref="ConfigPumps.Id"/>.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the updated <see cref="ConfigPumps"/>.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the update operation fails.</exception>
|
||||
/// <!-- aidoc:v1 sig=373d0cc body=519fb70 -->
|
||||
public async Task<ConfigPumps?> UpdatePumpConfig(ConfigPumps pumpConfig)
|
||||
{
|
||||
var oldPumpConfig = configPumpsRepository.FindById(pumpConfig.Id);
|
||||
@@ -106,6 +111,8 @@ public class ConfigPumpsService(
|
||||
/// <param name="pumpConfig">The pump configuration to insert.</param>
|
||||
/// <returns>The inserted <see cref="ConfigPumps"/> on success; otherwise, <c>null</c> when an error occurs during the operation.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the inserted configuration cannot be found in the repository after insertion.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=extra_exception
|
||||
/// "ConflictException is documented as thrown, but it is raised inside a try block whose catch handler logs it and returns null, so the exception never propagates to the caller." -->
|
||||
public async Task<ConfigPumps?> InsertPumpConfig(ConfigPumps pumpConfig)
|
||||
{
|
||||
try
|
||||
@@ -128,6 +135,7 @@ public class ConfigPumpsService(
|
||||
/// </summary>
|
||||
/// <param name="config">The <see cref="ConfigPumps"/> instance representing the pump configuration to delete.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the configuration is deleted and the audit log is recorded; <c>false</c> when the delete operation fails or an exception occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=5589ecb body=49cc999 -->
|
||||
public async Task<bool> DeletePumpConfig(ConfigPumps config)
|
||||
{
|
||||
try
|
||||
@@ -156,6 +164,7 @@ public class ConfigPumpsService(
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation for which to evaluate the retention policy.</param>
|
||||
/// <returns>A task containing the retention result with the applicable policy and associated value, or a default NoDelete result when no policy is configured.</returns>
|
||||
/// <!-- aidoc:v1 sig=57930e3 body=186775f -->
|
||||
public async Task<ObservatitonRetentionResult?> RetentionActions(PumpObservation obs)
|
||||
{
|
||||
//TODO sacarlo de la configuración específica de Bombas
|
||||
@@ -171,6 +180,7 @@ public class ConfigPumpsService(
|
||||
/// <param name="obs">The pump observation that will receive the UI configuration.</param>
|
||||
/// <param name="conf">The configuration source whose UI configuration is applied to <paramref name="obs"/> when present.</param>
|
||||
/// <returns>A completed <see cref="Task{PumpObservation}"/> containing the updated observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=ad0f0ed body=76b8f24 -->
|
||||
private static Task<PumpObservation> MapConf(PumpObservation obs, ConfigPumpItem conf)
|
||||
{
|
||||
if (conf.UiConfiguration != null && conf.UiConfiguration.Count != 0)
|
||||
@@ -184,6 +194,7 @@ public class ConfigPumpsService(
|
||||
/// </summary>
|
||||
/// <param name="alarmType">The string representation of the alarm type to look up; if it cannot be parsed into a valid <see cref="PumpEnum.AlarmType"/>, the method returns <c>null</c>.</param>
|
||||
/// <returns>A <see cref="ConfigPumpItem"/> whose <c>AlarmType</c> matches the parsed value, or <c>null</c> if parsing fails or no matching item is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=bc81e4a body=6b0def6 -->
|
||||
private async Task<ConfigPumpItem?> Get(string alarmType)
|
||||
{
|
||||
if (!Enum.TryParse(alarmType, out PumpEnum.AlarmType alarmTypeParsed))
|
||||
@@ -198,6 +209,7 @@ public class ConfigPumpsService(
|
||||
/// </summary>
|
||||
/// <param name="pobs">The pump observation whose <c>MessageType</c> is used to locate the corresponding configuration entry.</param>
|
||||
/// <returns>A <see cref="ConfigPumpItem"/> matching the observation's message type, or <c>null</c> if the configuration is unavailable or no matching item exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=41e31d5 body=63aa76f -->
|
||||
private async Task<ConfigPumpItem?> Get(PumpObservation pobs)
|
||||
{
|
||||
var config = await GetConfig();
|
||||
@@ -208,6 +220,7 @@ public class ConfigPumpsService(
|
||||
/// Returns a null list if the underlying configuration is not available.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a list of <see cref="ConfigPumpItem"/> objects, or <c>null</c> if the configuration could not be retrieved.</returns>
|
||||
/// <!-- aidoc:v1 sig=e2506bb body=a5ff078 -->
|
||||
public async Task<List<ConfigPumpItem>?> Get()
|
||||
{
|
||||
var result = await GetConfig();
|
||||
@@ -220,6 +233,7 @@ public class ConfigPumpsService(
|
||||
/// Falls back to fetching from the repository when the cache is missing or stale, and returns <c>null</c> if an error occurs during retrieval.
|
||||
/// </summary>
|
||||
/// <returns>A task containing the <see cref="ConfigPumps"/> instance if available; otherwise, <c>null</c> when the repository lookup fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=5717dca body=174bbb3 -->
|
||||
private async Task<ConfigPumps?> GetConfig()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -37,6 +37,7 @@ public class ConfigUnitsService(
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation to be mapped.</param>
|
||||
/// <returns>The mapped observation when a matching unit configuration is resolved; otherwise, the original observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=2c52e52 body=2db877e -->
|
||||
public async Task<T> Map<T>(T obs) where T : BasePatientObservation
|
||||
{
|
||||
if (!_configUnitsRequired) return obs;
|
||||
@@ -52,6 +53,7 @@ public class ConfigUnitsService(
|
||||
/// </summary>
|
||||
/// <param name="obs">The <see cref="PumpObservation"/> to be mapped.</param>
|
||||
/// <returns>The mapped <see cref="PumpObservation"/>, returned as-is when units configuration is not required or after pump value mapping otherwise.</returns>
|
||||
/// <!-- aidoc:v1 sig=daf9ea9 body=c2e84ce -->
|
||||
public async Task<PumpObservation> Map(PumpObservation obs)
|
||||
{
|
||||
if (!_configUnitsRequired) return obs;
|
||||
@@ -68,6 +70,7 @@ public class ConfigUnitsService(
|
||||
/// <summary>
|
||||
/// Recorre recursivamente las propiedades del objeto para encontrar y convertir PumpValues.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=01209a6 body=958cccd -->
|
||||
private async Task MapPumpValues(object? targetObject)
|
||||
{
|
||||
if (targetObject == null) return;
|
||||
@@ -106,6 +109,7 @@ public class ConfigUnitsService(
|
||||
/// <param name="obs">The base patient observation to which the configured unit value will be applied.</param>
|
||||
/// <param name="conf">The configuration unit item whose <c>Value</c> is used as the unit to assign.</param>
|
||||
/// <returns>The input observation, with <c>Units</c> set from <paramref name="conf"/> when applicable, or the unchanged observation when it is not a <see cref="PatientObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=ef286fc body=8674339 -->
|
||||
private T MapConf<T>(T obs, ConfigUnitItem conf) where T : BasePatientObservation
|
||||
{
|
||||
if (obs is not PatientObservation pobs) return obs;
|
||||
@@ -122,6 +126,7 @@ public class ConfigUnitsService(
|
||||
/// </summary>
|
||||
/// <param name="code">The unique code identifier of the configuration unit item to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigUnitItem"/>, or null if the configuration is unavailable or no item is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=b153e30 body=ca52840 -->
|
||||
public async Task<ConfigUnitItem?> Get(string code)
|
||||
{
|
||||
var result = await GetConfig();
|
||||
@@ -138,6 +143,7 @@ public class ConfigUnitsService(
|
||||
/// A <see cref="Task{TResult}"/> containing the cached or freshly fetched <see cref="ConfigUnits"/>, or
|
||||
/// <c>null</c> if the repository lookup fails.
|
||||
/// </returns>
|
||||
/// <!-- aidoc:v1 sig=982237a body=0843e00 -->
|
||||
private async Task<ConfigUnits?> GetConfig()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace adas_core.Application.Services;
|
||||
/// <summary>
|
||||
/// Provides the default implementation of the <see cref="ICalculatedObservations"/> interface.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9026718 -->
|
||||
public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
{
|
||||
/// <summary>
|
||||
@@ -16,6 +17,8 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of medicines currently active for the patient, used as the basis for the observation calculation.</param>
|
||||
/// <param name="patientId">The identifier of the patient whose medicine observations are being calculated.</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the method 'calculates medicine observations', but the body only returns Task.CompletedTask without performing any calculation or observation logic." -->
|
||||
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -25,6 +28,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// Calculates the active bolus for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active bolus is being calculated.</param>
|
||||
/// <!-- aidoc:v1 sig=7d38721 body=6805ef5 -->
|
||||
public Task CalculateActiveBolus(ObjectId patientId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -36,6 +40,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation to map.</param>
|
||||
/// <param name="onlyByName">A flag indicating whether mapping should be performed by name only.</param>
|
||||
/// <returns>A completed <see cref="Task{T}"/> containing the provided observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=84684f5 body=9f66f26 -->
|
||||
public Task<T?> Map<T>(T obs, bool onlyByName) where T : BasePatientObservation
|
||||
{
|
||||
return Task.FromResult(obs)!;
|
||||
@@ -46,6 +51,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment to map.</param>
|
||||
/// <returns>A <see cref="Task{PatientTreatment}"/> that completes with the supplied <paramref name="treatment"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=adce250 body=cf46cd2 -->
|
||||
public Task<PatientTreatment> Map(PatientTreatment treatment)
|
||||
{
|
||||
return Task.FromResult(treatment);
|
||||
@@ -57,6 +63,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments are being retrieved.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing an enumerable collection of the patient's active treatments, or an empty collection if none are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=db74f82 body=69cdec0 -->
|
||||
public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
|
||||
{
|
||||
return Task.FromResult<IEnumerable<PatientTreatment?>>(new List<PatientTreatment?>());
|
||||
@@ -67,6 +74,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis to map.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the provided patient diagnosis.</returns>
|
||||
/// <!-- aidoc:v1 sig=8ddf601 body=ad326e6 -->
|
||||
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
|
||||
{
|
||||
return Task.FromResult(diagnosis);
|
||||
@@ -78,6 +86,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// <param name="pumpObservation">The source <see cref="PumpObservation"/> to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting <see cref="PumpObservation"/>.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown when the method is invoked, as the mapping logic has not been implemented yet.</exception>
|
||||
/// <!-- aidoc:v1 sig=98ff725 body=bfa6f2f -->
|
||||
public Task<PumpObservation> Map(PumpObservation pumpObservation)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -88,6 +97,8 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="newObservation">The new patient observation to evaluate for time consistency with the prior observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the provided patient observation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Summary states the method 'processes a new patient observation to address potential time inconsistency with the previous observation', but the implementation simply returns the input observation unchanged without any processing or time-inconsistency handling." -->
|
||||
public Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
|
||||
{
|
||||
return Task.FromResult<PatientObservation?>(newObservation);
|
||||
@@ -98,6 +109,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be pre-mapped.</param>
|
||||
/// <returns>A completed task containing the provided list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=5a37e9b body=0791af0 -->
|
||||
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
|
||||
{
|
||||
return Task.FromResult(listToInsert);
|
||||
@@ -110,6 +122,7 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// <param name="obs">The patient observation to be returned by the mapping.</param>
|
||||
/// <param name="alarmToInsert">The patient observation alarm intended to be associated with the observation.</param>
|
||||
/// <returns>A completed <see cref="Task{TResult}"/> containing the <see cref="PatientObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=405db8e body=ea790e4 -->
|
||||
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
|
||||
{
|
||||
return Task.FromResult(obs);
|
||||
@@ -122,6 +135,8 @@ public class DefaultCalculatedObservations : ICalculatedObservations
|
||||
/// <param name="name">The name associated with the alarm being sent.</param>
|
||||
/// <param name="code">The optional alarm code that categorizes the type of alarm; may be null when no specific code applies.</param>
|
||||
/// <exception cref="NotImplementedException">Thrown in all cases, as the method has not been implemented yet.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=stale_summary
|
||||
/// "The summary states the method 'sends an alarm notification', but the method body only throws NotImplementedException and never sends anything." -->
|
||||
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace adas_core.Application.Services;
|
||||
/// Provides the concrete implementation of the <see cref="IDeviceService"/> contract,
|
||||
/// handling device-related service operations defined by the interface.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=16670f2 -->
|
||||
public class DeviceService : IDeviceService
|
||||
{
|
||||
private readonly IDeviceRepository _deviceRepository;
|
||||
@@ -53,6 +54,7 @@ public class DeviceService : IDeviceService
|
||||
/// </summary>
|
||||
/// <param name="dto">The data transfer object containing the device information to convert.</param>
|
||||
/// <returns>A new <see cref="Device"/> entity populated with the values from the supplied DTO.</returns>
|
||||
/// <!-- aidoc:v1 sig=178c6f2 body=778e6dd -->
|
||||
public Device ToEntity(DeviceDto dto)
|
||||
{
|
||||
return new Device()
|
||||
@@ -78,6 +80,8 @@ public class DeviceService : IDeviceService
|
||||
/// </summary>
|
||||
/// <param name="deviceDto">The data transfer object containing the device information to be mapped and stored.</param>
|
||||
/// <returns>The created <see cref="Device"/> entity after successful insertion, or <see langword="null"/> if the device could not be created.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "Documentation states the method returns null 'if the device could not be created', but the code has no such null return path—it always returns the non-null device entity after insertion." -->
|
||||
public async Task<Device?> Create(DeviceDto deviceDto)
|
||||
{
|
||||
var device = ToEntity(deviceDto);
|
||||
@@ -93,6 +97,7 @@ public class DeviceService : IDeviceService
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the object to delete.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the object was deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=346f3e0 body=6d416f7 -->
|
||||
public async Task<bool> Delete(ObjectId objectId)
|
||||
{
|
||||
return await _deviceRepository.DeleteAsync(objectId) != null;
|
||||
@@ -103,6 +108,8 @@ public class DeviceService : IDeviceService
|
||||
/// </summary>
|
||||
/// <param name="deviceDto">The data transfer object containing the updated device information.</param>
|
||||
/// <returns>The updated <see cref="Device"/> entity, or <c>null</c> if no device is returned.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_returns
|
||||
/// "The documentation states 'or null if no device is returned', but the implementation always returns the device produced by ToEntity with no null return path." -->
|
||||
public async Task<Device?> Update(DeviceDto deviceDto)
|
||||
{
|
||||
var device = ToEntity(deviceDto);
|
||||
@@ -116,6 +123,7 @@ public class DeviceService : IDeviceService
|
||||
/// </summary>
|
||||
/// <param name="deviceDto">The data transfer object containing the device information from the event, used for lookup and creation.</param>
|
||||
/// <returns>The existing or newly created <see cref="Device"/> associated with the event.</returns>
|
||||
/// <!-- aidoc:v1 sig=12e98a9 body=1a956d8 -->
|
||||
public async Task<Device?> ReceiveEvent(DeviceDto deviceDto)
|
||||
{
|
||||
Device? deviceExist = null;
|
||||
@@ -168,6 +176,7 @@ public class DeviceService : IDeviceService
|
||||
/// </summary>
|
||||
/// <param name="deviceExist">The existing device whose configured action settings determine which action to execute.</param>
|
||||
/// <param name="deviceDto">The incoming device event payload providing the click type that triggers the action.</param>
|
||||
/// <!-- aidoc:v1 sig=818bb69 body=1d9bf5b -->
|
||||
private async Task ManageDeviceButton(Device deviceExist, DeviceDto deviceDto)
|
||||
{
|
||||
if (deviceExist.Settings?.Action?.Type != null && deviceDto.Event?.ClickType != null)
|
||||
@@ -193,6 +202,7 @@ public class DeviceService : IDeviceService
|
||||
/// <param name="settingsAction">The device action containing the configuration observation and the per-click-type alarm values to use.</param>
|
||||
/// <param name="eventClickType">The click event that triggered the action, which determines which value from the device action is sent.</param>
|
||||
/// <param name="deviceExistPointOfCareIds">The list of point of care identifiers whose patients should receive the alarm.</param>
|
||||
/// <!-- aidoc:v1 sig=f9291cd body=9b90588 -->
|
||||
private async Task SendAlarmOnAction(
|
||||
DeviceAction settingsAction,
|
||||
ClickType eventClickType,
|
||||
@@ -256,6 +266,7 @@ public class DeviceService : IDeviceService
|
||||
/// <param name="eventClickType">The type of click event that triggered the action; selects which value (single, double, or hold) is assigned to the observation.</param>
|
||||
/// <param name="deviceExistPointOfCareIds">The list of point of care identifiers whose resolved patients will receive the generated observation.</param>
|
||||
/// <returns>A task that represents the asynchronous send operation; no meaningful business result is returned.</returns>
|
||||
/// <!-- aidoc:v1 sig=4c6f5ee body=ef5e8c7 -->
|
||||
private async Task SendObservationOnAction(
|
||||
DeviceAction settingsAction,
|
||||
ClickType eventClickType,
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace adas_core.Application.Services;
|
||||
/// Provides the implementation of the <see cref="IDiagnosisService"/> contract,
|
||||
/// offering diagnosis-related operations as defined by the interface.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c73da26 -->
|
||||
public class DiagnosisService : IDiagnosisService
|
||||
{
|
||||
private readonly ILocalAuditService _auditService;
|
||||
@@ -104,6 +105,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// Archives the specified patient by delegating to the archival routine keyed by the patient's identifier.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be archived. Its <c>Id</c> is used to locate the record to archive.</param>
|
||||
/// <!-- aidoc:v1 sig=0afe718 body=be01ba0 -->
|
||||
public async Task Archive(Patient patient)
|
||||
{
|
||||
await ArchiveByPatientId(patient.Id);
|
||||
@@ -113,6 +115,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// Archives all diagnoses associated with the specified patient by copying them to the diagnosis archive repository and then deleting the original records.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the patient whose diagnoses will be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=3385472 body=3d03acb -->
|
||||
public async Task ArchiveByPatientId(ObjectId id)
|
||||
{
|
||||
_logger.LogDebug("Archive Diagnoses by Patient Id {id}", id);
|
||||
@@ -130,6 +133,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// Deletes all diagnoses associated with the specified patient identifier and records an audit log entry capturing the previous state of the records.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose diagnoses should be deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=09e4e41 body=d64c5ea -->
|
||||
public async Task DeleteByPatientId(ObjectId id)
|
||||
{
|
||||
_logger.LogDebug("Delete Diagnoses by Patient Id {id}", id);
|
||||
@@ -143,6 +147,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose diagnoses are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientDiagnosis"/> records for the given patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=4ed162d body=4bb31fe -->
|
||||
public async Task<List<PatientDiagnosis>> GetByPatientId(ObjectId patientId)
|
||||
{
|
||||
var diagnosis = await _diagnosisRepository.GetByPatient(patientId);
|
||||
@@ -156,6 +161,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to save.</param>
|
||||
/// <returns>A task that represents the asynchronous save operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=3385bba body=5d13d47 -->
|
||||
public Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest, null); }));
|
||||
@@ -166,6 +172,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request instance to persist.</param>
|
||||
/// <returns>A task that represents the asynchronous save operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=a3706aa body=5d13d47 -->
|
||||
public Task SaveRequestAsync(ApiRequest apiRequest)
|
||||
{
|
||||
return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest, null); }));
|
||||
@@ -177,6 +184,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// <param name="apiRequest">The API request containing the observation codes, values, message time, and optional observation time used to build the diagnosis.</param>
|
||||
/// <param name="patient">The patient associated with the diagnosis, whose identifier is assigned to the new <see cref="PatientDiagnosis"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous insertion of the resulting <see cref="PatientDiagnosis"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=feeab82 body=75feb1d -->
|
||||
public async Task ProcessDiagnosisObservation(ApiRequest apiRequest, Patient patient)
|
||||
{
|
||||
_logger.LogDebug("INSERT DiagnosisObservation from obsservation");
|
||||
@@ -248,6 +256,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// <param name="apiRequest">The API request containing the type, patient identifiers, location, and observation data to be processed.</param>
|
||||
/// <param name="patient">An optional pre-resolved patient; when null, the patient is resolved via the patient service using the request data.</param>
|
||||
/// <exception cref="ApiRequestException">Thrown when both the patient number and the location unit name are missing from the request, or when the request type is not valid for diagnosis processing.</exception>
|
||||
/// <!-- aidoc:v1 sig=272fe2f body=50c8fbd -->
|
||||
public async Task SaveRequest(ApiRequest apiRequest, Patient? patient)
|
||||
{
|
||||
if (patient == null)
|
||||
@@ -319,6 +328,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// <param name="diagnosis">The list of patient diagnoses to be processed and inserted.</param>
|
||||
/// <param name="patient">The patient whose identifier is assigned to each diagnosis entry.</param>
|
||||
/// <param name="messageTime">The timestamp assigned to each diagnosis entry during processing.</param>
|
||||
/// <!-- aidoc:v1 sig=2e0a847 body=03c844f -->
|
||||
public async Task ProcessDiagnosis(List<PatientDiagnosis> diagnosis, Patient patient, DateTime messageTime)
|
||||
{
|
||||
_logger.LogDebug("INSERT DiagnosisObservation from diagnosis");
|
||||
@@ -337,6 +347,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// <param name="nameId">The name of the identifier field used to locate the records to update.</param>
|
||||
/// <param name="id">The new ObjectId to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId to be replaced in the matching records.</param>
|
||||
/// <!-- aidoc:v1 sig=72ce1ca body=3281a42 -->
|
||||
public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)
|
||||
{
|
||||
await _diagnosisRepository.UpdateManyObjectId(nameId, id, oldId);
|
||||
@@ -347,6 +358,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose diagnoses are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientDiagnosis"/> records for the given patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=3f1244f body=f584950 -->
|
||||
public async Task<List<PatientDiagnosis>> GetByPatient(ObjectId id)
|
||||
{
|
||||
return await _diagnosisRepository.GetByPatient(id);
|
||||
@@ -357,6 +369,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// If the diagnosis cannot be mapped (returns null), the insert and broadcast operations are skipped.
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis to insert.</param>
|
||||
/// <!-- aidoc:v1 sig=f1354a6 body=fcec185 -->
|
||||
public async Task Insert(PatientDiagnosis diagnosis)
|
||||
{
|
||||
_logger.LogDebug("Insert {diagnosis}", diagnosis);
|
||||
@@ -374,6 +387,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis to be mapped.</param>
|
||||
/// <returns>The mapped <see cref="PatientDiagnosis"/> produced by the calculated observations mapper, or <see langword="null"/> if the diagnosis was ignored.</returns>
|
||||
/// <!-- aidoc:v1 sig=0440056 body=83aaa02 -->
|
||||
private async Task<PatientDiagnosis?> MapDiagnosis(PatientDiagnosis diagnosis)
|
||||
{
|
||||
var diagnosis2 = await _calculatedObservations.Value.Map(diagnosis);
|
||||
@@ -386,6 +400,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// Sends a patient diagnosis broadcast to all subscribers whose registered location matches the patient's location (unit, room, and bed). Returns early without broadcasting if the patient cannot be found.
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis payload to broadcast to the matching subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=47e7826 body=f462d51 -->
|
||||
private async Task SendBroadcast(PatientDiagnosis diagnosis)
|
||||
{
|
||||
var patient = await _patientService.Value.FindById(diagnosis.PatientId);
|
||||
@@ -412,6 +427,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose diagnosis records are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an asynchronous cursor over the matching <see cref="PatientDiagnosis"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=01cba99 body=5a86d75 -->
|
||||
public Task<IAsyncCursor<PatientDiagnosis>> FindByPatientIdAsync(ObjectId patientId)
|
||||
{
|
||||
return _diagnosisRepository.FindByPatientIdAsync(patientId);
|
||||
@@ -424,6 +440,7 @@ public class DiagnosisService : IDiagnosisService
|
||||
/// A broadcast is dispatched asynchronously after a successful insert or update.
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis to persist.</param>
|
||||
/// <!-- aidoc:v1 sig=92e37f1 body=456e290 -->
|
||||
public async Task InsertDiagnosis(PatientDiagnosis diagnosis)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace adas_core.Application.Services;
|
||||
/// This service acts as the default in-memory or infrastructure-backed implementation
|
||||
/// of the discharge operations defined by <see cref="IDischargeService"/>.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=61bd286 -->
|
||||
public class DischargeService : IDischargeService
|
||||
{
|
||||
private readonly ILocalAuditService _auditService;
|
||||
@@ -80,6 +81,10 @@ public class DischargeService : IDischargeService
|
||||
/// discharge status), and otherwise falls back to deleting the discharge by its identifier.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge entity to be deleted.</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=mentions_removed_behavior
|
||||
/// "The summary describes validation of MedicalDischarge, AdminDischarge, and discharge status, but the entire validation block is commented out; the method only calls DeleteDischargeByIdAsync." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=stale_summary
|
||||
/// "The documented behavior of validating and 'falling back' to deletion by id does not match the actual code, which unconditionally deletes by id." -->
|
||||
public async Task DeleteDischargeAsync(Discharge discharge)
|
||||
{
|
||||
//var patient = await _patientServiceLazy.Value.FindById(discharge.PatientId);
|
||||
@@ -97,6 +102,7 @@ public class DischargeService : IDischargeService
|
||||
/// Deletes a discharge record by its identifier. If the discharge is not found, an error is logged and the operation is skipped; otherwise the record is removed, an audit log entry is created, and a delete broadcast is sent.
|
||||
/// </summary>
|
||||
/// <param name="dischargeId">The unique identifier of the discharge to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=0e0285f body=b646cb5 -->
|
||||
public async Task DeleteDischargeByIdAsync(ObjectId dischargeId)
|
||||
{
|
||||
try
|
||||
@@ -132,6 +138,7 @@ public class DischargeService : IDischargeService
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose discharge records will be counted.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the total number of discharges for the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=da93389 body=a6241d6 -->
|
||||
public async Task<long> CountDischargesByUnitId(ObjectId unitId)
|
||||
{
|
||||
return await _dischargeRepository.CountByUnitId(unitId);
|
||||
@@ -146,6 +153,7 @@ public class DischargeService : IDischargeService
|
||||
/// information if a point of care is linked; otherwise the discharge as stored.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no discharge is found for the specified
|
||||
/// <paramref name="dischargeId"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=12c2e8b body=3015bf8 -->
|
||||
public async Task<Discharge?> GetDischargeByIdAsync(ObjectId dischargeId)
|
||||
{
|
||||
var result = await _dischargeRepository.FindById(dischargeId) ??
|
||||
@@ -163,6 +171,7 @@ public class DischargeService : IDischargeService
|
||||
/// Asynchronously retrieves all discharge records from the repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of <see cref="Discharge"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=f526f77 body=05958d1 -->
|
||||
public async Task<IEnumerable<Discharge>> GetDischargesAsync()
|
||||
{
|
||||
return await _dischargeRepository.FindAll();
|
||||
@@ -173,6 +182,7 @@ public class DischargeService : IDischargeService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose discharge record should be retrieved.</param>
|
||||
/// <returns>A <see cref="Discharge"/> object populated with patient location information when a point of care is associated, or <c>null</c> if no discharge is found or an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=9c55b11 body=305bfa7 -->
|
||||
public async Task<Discharge?> GetDischargeByPatientId(ObjectId patientId)
|
||||
{
|
||||
try
|
||||
@@ -202,6 +212,7 @@ public class DischargeService : IDischargeService
|
||||
/// <param name="discharge">The discharge entity to be inserted.</param>
|
||||
/// <returns>The persisted <see cref="Discharge"/> entity retrieved from the repository after insertion.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the inserted discharge cannot be found by its identifier, indicating that the creation failed.</exception>
|
||||
/// <!-- aidoc:v1 sig=5b13f28 body=682f5de -->
|
||||
public async Task<Discharge?> InsertDischarge(Discharge discharge)
|
||||
{
|
||||
await _dischargeRepository.InsertOneAsync(discharge);
|
||||
@@ -220,6 +231,7 @@ public class DischargeService : IDischargeService
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to look up the associated discharge record.</param>
|
||||
/// <returns>A <see cref="Discharge"/> if one is found for the given location; otherwise, <c>null</c> when an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=d6f8db9 body=ac06f0e -->
|
||||
public async Task<Discharge?> GetDischargeByLocation(PatientLocation location)
|
||||
{
|
||||
try
|
||||
@@ -240,6 +252,7 @@ public class DischargeService : IDischargeService
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care identifier used to look up the discharge record.</param>
|
||||
/// <returns>A <see cref="Discharge"/> with the patient location populated when available, or <c>null</c> if the discharge is not found or an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=add61b9 body=16738ca -->
|
||||
public async Task<Discharge?> GetDischargeByPointOfCareId(ObjectId poc)
|
||||
{
|
||||
try
|
||||
@@ -269,6 +282,7 @@ public class DischargeService : IDischargeService
|
||||
/// <param name="location">The ObjectId identifying the point of care (location) whose discharge record should be retrieved.</param>
|
||||
/// <param name="dataLocale">The locale used to localize the discharge data when the associated unit is found.</param>
|
||||
/// <returns>A <see cref="Task{Discharge}"/> containing the localized discharge, the unmodified discharge when its unit cannot be found, or <c>null</c> when no discharge exists for the specified location.</returns>
|
||||
/// <!-- aidoc:v1 sig=4f9546e body=52d6c63 -->
|
||||
public async Task<Discharge?> GetDischargeByPointOfCareIdWithLocale(ObjectId location, LocaleEnum dataLocale)
|
||||
{
|
||||
var discharge = await GetDischargeByPointOfCareId(location);
|
||||
@@ -284,6 +298,7 @@ public class DischargeService : IDischargeService
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge entity to be updated.</param>
|
||||
/// <exception cref="ConflictException">Thrown when no discharge is found with the specified identifier, preventing the update from proceeding.</exception>
|
||||
/// <!-- aidoc:v1 sig=93dfb9f body=eba9c68 -->
|
||||
public async Task UpdateDischargeAsync(Discharge discharge)
|
||||
{
|
||||
var oldDischarge = await GetDischargeByIdAsync(discharge.Id) ??
|
||||
@@ -300,6 +315,10 @@ public class DischargeService : IDischargeService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the discharge payload and the operation type to perform.</param>
|
||||
/// <!-- aidoc:v1 sig=229d8cd body=acbd395 -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=stale_summary
|
||||
/// "The summary does not mention that the patient is always updated via _patientServiceLazy.Value.Update(apiRequest.Discharge.Patient) before the switch on apiRequest.Type is evaluated." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
|
||||
/// "The summary states the method 'logs an error when the discharge or patient is null', but when apiRequest.Discharge?.Patient is null the method simply returns silently without logging anything." -->
|
||||
public async Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
try
|
||||
@@ -367,6 +386,7 @@ public class DischargeService : IDischargeService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to save.</param>
|
||||
/// <returns>A task that completes when the request has been saved.</returns>
|
||||
/// <!-- aidoc:v1 sig=a3706aa body=c8d77ba -->
|
||||
public Task SaveRequestAsync(ApiRequest apiRequest)
|
||||
{
|
||||
return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); }));
|
||||
@@ -378,6 +398,7 @@ public class DischargeService : IDischargeService
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge whose point of care is used to locate matching subscribers and whose data is sent in the broadcast.</param>
|
||||
/// <param name="operation">The operation type associated with the outgoing message sent to each subscriber.</param>
|
||||
/// <!-- aidoc:v1 sig=f5450d6 body=93e2063 -->
|
||||
public async void SendDischargeBroadcast(Discharge discharge, OperationType operation)
|
||||
{
|
||||
try
|
||||
@@ -419,6 +440,7 @@ public class DischargeService : IDischargeService
|
||||
/// <param name="opt">The master list update options to apply to the discharges.</param>
|
||||
/// <param name="unitList">The collection of units whose associated discharges will be updated.</param>
|
||||
/// <param name="typeName">The name of the master list type used to target the update.</param>
|
||||
/// <!-- aidoc:v1 sig=b539b7b body=09153b7 -->
|
||||
public async Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList,
|
||||
string typeName)
|
||||
{
|
||||
@@ -440,6 +462,8 @@ public class DischargeService : IDischargeService
|
||||
/// <param name="opt">The option list entry to be removed from the patient master list.</param>
|
||||
/// <param name="unitList">The collection of units whose identifiers are used to scope the deletion.</param>
|
||||
/// <param name="typeName">The name of the master list type/category to which the option belongs.</param>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "Summary's parenthetical '(only when the updated discharge record is found)' reads as applying to both the audit log creation and the broadcasting, but in the code the audit log is always created for every discharge while only the broadcast is gated by the dischargeUpdated != null check." -->
|
||||
public async Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName)
|
||||
{
|
||||
var unitIds = unitList.Select(x => x.Id).ToList();
|
||||
@@ -457,6 +481,7 @@ public class DischargeService : IDischargeService
|
||||
/// Asynchronously deletes all discharge records associated with the specified unit identifier by delegating the operation to the discharge repository.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose discharge records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=0d2c782 body=6f86d40 -->
|
||||
public async Task DeleteDischargesByUnitId(ObjectId unitId)
|
||||
{
|
||||
await _dischargeRepository.DeleteByUnitId(unitId);
|
||||
@@ -471,6 +496,7 @@ public class DischargeService : IDischargeService
|
||||
/// <param name="discharge">Discharge instance whose option names may be translated in place.</param>
|
||||
/// <param name="locale">Target locale used to load the appropriate master list; when set to <see cref="LocaleEnum.Default"/>, the discharge is returned without changes.</param>
|
||||
/// <returns>The same <paramref name="discharge"/> instance, with translated option names when a matching locale-specific entry is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=f16a2d5 body=4eee788 -->
|
||||
private async Task<Discharge> GetDischargeWithLocale(Unit? unit, Discharge discharge, LocaleEnum locale)
|
||||
{
|
||||
if (unit == null)
|
||||
|
||||
@@ -43,6 +43,7 @@ public class DisplayConfigService(
|
||||
/// Configurations for which the minimal display section cannot be resolved are excluded from the result.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of enriched <see cref="DisplayConfig"/> items, omitting any entries that could not be enriched.</returns>
|
||||
/// <!-- aidoc:v1 sig=fb4ed8e body=326606c -->
|
||||
public async Task<List<DisplayConfig>> GetAll()
|
||||
{
|
||||
var result = await displayConfigRepository.GetAll();
|
||||
@@ -62,6 +63,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing the page number, page size, and any filtering criteria used to retrieve and paginate the display configurations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{T}"/> with the compact display configurations, current page metadata, and total document count.</returns>
|
||||
/// <!-- aidoc:v1 sig=002d362 body=84e79e3 -->
|
||||
public async Task<PaginationResponse<DisplayConfigMinimalResponse>> GetAllCompactPaginated(PaginationFilter filter)
|
||||
{
|
||||
var result = displayConfigRepository.GetAllPaginated(filter);
|
||||
@@ -89,6 +91,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to filter the configurations.</param>
|
||||
/// <returns>A list of enriched display configurations; entries whose display section could not be resolved are omitted.</returns>
|
||||
/// <!-- aidoc:v1 sig=8122d6c body=df89bc5 -->
|
||||
public async Task<List<DisplayConfig>> GetByType(DisplayConfigEnums.DisplayType type)
|
||||
{
|
||||
var result = await displayConfigRepository.GetByType(type);
|
||||
@@ -109,6 +112,7 @@ public class DisplayConfigService(
|
||||
/// <param name="id">The unique identifier of the display configuration to retrieve.</param>
|
||||
/// <returns>The display configuration with the minimal display section applied.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no display configuration exists for the specified <paramref name="id"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=4cfefba body=08ef01d -->
|
||||
public async Task<DisplayConfig> GetById(ObjectId id)
|
||||
{
|
||||
return await AddDisplaySectionMinimal(await displayConfigRepository.GetById(id)) ??
|
||||
@@ -122,6 +126,7 @@ public class DisplayConfigService(
|
||||
/// <param name="unitId">The unit identifier used to look up the default configuration.</param>
|
||||
/// <param name="displayType">The display type used to look up the default configuration.</param>
|
||||
/// <returns>The current configuration, the default configuration, the merged configuration, or null when neither is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=0ea6132 body=a8d8a9b -->
|
||||
public async Task<DisplayConfig?> GetById(ObjectId? configId, ObjectId unitId,
|
||||
DisplayConfigEnums.DisplayType displayType)
|
||||
{
|
||||
@@ -160,6 +165,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="config">The display configuration to insert.</param>
|
||||
/// <returns>The inserted display configuration, or null if no entity was returned by the repository.</returns>
|
||||
/// <!-- aidoc:v1 sig=819b413 body=1c53329 -->
|
||||
public async Task<DisplayConfig?> InsertOne(DisplayConfig config)
|
||||
{
|
||||
await auditService.CreateAuditLogAsync(httpContextAccessor.HttpContext?.User!, null, config);
|
||||
@@ -171,6 +177,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="config">The DTO containing the hospital and display type used to build the new configuration entity.</param>
|
||||
/// <returns>The inserted <see cref="DisplayConfig"/> entity, or <c>null</c> if the repository did not return a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=cbcb8f5 body=bb5bdb9 -->
|
||||
public async Task<DisplayConfig?> InsertOneMinimal(CreateDisplayConfigDto config)
|
||||
{
|
||||
DisplayConfig newDisplayConfig;
|
||||
@@ -198,6 +205,7 @@ public class DisplayConfigService(
|
||||
/// Inserts test records for the DisplayNurse and SmartDisplay display configuration types into the repository and returns the inserted DisplayNurse record.
|
||||
/// </summary>
|
||||
/// <returns>The inserted <see cref="DisplayConfig"/> instance of type DisplayNurse.</returns>
|
||||
/// <!-- aidoc:v1 sig=76d5040 body=e85a5cb -->
|
||||
public async Task<DisplayConfig> InsertOneTest()
|
||||
{
|
||||
var d = new DisplayNurse
|
||||
@@ -220,6 +228,7 @@ public class DisplayConfigService(
|
||||
/// <param name="newDisplayConfig">The new configuration payload, deserialized internally into the appropriate DTO based on its <c>Type</c>.</param>
|
||||
/// <returns>The updated <see cref="DisplayConfig"/> when the corresponding update succeeds; otherwise the method throws.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the configuration's <c>Type</c> is not handled, or when the underlying update returns no result.</exception>
|
||||
/// <!-- aidoc:v1 sig=2b3fe79 body=c609b50 -->
|
||||
public async Task<DisplayConfig?> UpdateConfig(ObjectId displayConfigId, object newDisplayConfig)
|
||||
{
|
||||
var baseType = JsonConvert.DeserializeObject<DisplayConfigDto>(newDisplayConfig.ToString()!);
|
||||
@@ -273,6 +282,7 @@ public class DisplayConfigService(
|
||||
/// <param name="objectIdConfigDisplay">The unique identifier of the display configuration whose field list is being updated.</param>
|
||||
/// <param name="fields">The collection of fields to be associated with the display configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean value indicating whether the update was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=ef23768 body=bc5d2e7 -->
|
||||
public Task<bool> UpdateFieldList(ObjectId objectIdConfigDisplay, List<Field> fields)
|
||||
{
|
||||
return displayConfigRepository.UpdateFieldList(objectIdConfigDisplay, fields);
|
||||
@@ -285,6 +295,7 @@ public class DisplayConfigService(
|
||||
/// <param name="colorConfig">The new color configuration to apply to the display.</param>
|
||||
/// <returns>True if the color configuration was updated successfully; otherwise, false.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the display configuration identified by <paramref name="objectIdConfigDisplay"/> cannot be found before or after the update.</exception>
|
||||
/// <!-- aidoc:v1 sig=c59a5d8 body=8b0bc38 -->
|
||||
public async Task<bool> UpdateConfigColor(ObjectId objectIdConfigDisplay, ColorConfig colorConfig)
|
||||
{
|
||||
var oldDisplayConfig = await displayConfigRepository.GetById(objectIdConfigDisplay) ??
|
||||
@@ -311,6 +322,7 @@ public class DisplayConfigService(
|
||||
/// <param name="headerConfig">The new header configuration to apply to the display configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the display configuration is not found before the update, or when the updated display configuration cannot be retrieved afterwards.</exception>
|
||||
/// <!-- aidoc:v1 sig=14b1151 body=bd5d30d -->
|
||||
public async Task<bool> UpdateHeaderConfig(ObjectId objectIdConfigDisplay, HeaderConfig headerConfig)
|
||||
{
|
||||
var oldDisplayConfig = await displayConfigRepository.GetById(objectIdConfigDisplay) ??
|
||||
@@ -330,6 +342,7 @@ public class DisplayConfigService(
|
||||
/// <param name="bannerItems">The list of banner items to set for the home banner.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the update succeeds; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the display configuration cannot be found before or after the update.</exception>
|
||||
/// <!-- aidoc:v1 sig=cb31e5c body=ded0de7 -->
|
||||
public async Task<bool> UpdateSetHomeBanner(ObjectId objectIdConfigDisplay, List<BannerItem> bannerItems)
|
||||
{
|
||||
var oldDisplayConfig = await displayConfigRepository.GetById(objectIdConfigDisplay) ??
|
||||
@@ -348,6 +361,7 @@ public class DisplayConfigService(
|
||||
/// <param name="baseConfig">The display configuration containing the updated values, identified by its <see cref="DisplayConfig.Id"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result indicates whether the update was successful.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the display configuration with the specified identifier does not exist before or after the update.</exception>
|
||||
/// <!-- aidoc:v1 sig=f59f75b body=9ad2987 -->
|
||||
public async Task<bool> UpdateBaseConfig(DisplayConfig baseConfig)
|
||||
{
|
||||
var oldDisplayConfig = await displayConfigRepository.GetById(baseConfig.Id) ??
|
||||
@@ -367,6 +381,7 @@ public class DisplayConfigService(
|
||||
/// <param name="name">The new hospital name to apply to the display configuration.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the display configuration identified by <paramref name="objectIdConfigDisplay"/> cannot be found before or after the update.</exception>
|
||||
/// <!-- aidoc:v1 sig=d760b75 body=888c314 -->
|
||||
public async Task<bool> UpdateDisplayConfigHospitalName(ObjectId objectIdConfigDisplay, string name)
|
||||
{
|
||||
var oldDisplayConfig = await displayConfigRepository.GetById(objectIdConfigDisplay) ??
|
||||
@@ -385,6 +400,7 @@ public class DisplayConfigService(
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the display configuration to delete.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the configuration was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when no default configuration is found for the related display type, or when reassigning a display to the default configuration fails.</exception>
|
||||
/// <!-- aidoc:v1 sig=700a83c body=6b3dfef -->
|
||||
public async Task<bool> DeleteDisplayConfig(ObjectId objectIdConfigDisplay)
|
||||
{
|
||||
var displays = await displayService.Value.GetByConfigId(objectIdConfigDisplay);
|
||||
@@ -413,6 +429,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the configuration display whose locations are being retrieved.</param>
|
||||
/// <returns>A task that returns a list of <see cref="DisplayConfigLocationDto"/> items for the given configuration display.</returns>
|
||||
/// <!-- aidoc:v1 sig=252e572 body=b3e689c -->
|
||||
public async Task<List<DisplayConfigLocationDto>> GetDisplayConfigLocations(ObjectId objectIdConfigDisplay)
|
||||
{
|
||||
return await displayService.Value.GetDisplayConfigLocations(objectIdConfigDisplay);
|
||||
@@ -422,6 +439,7 @@ public class DisplayConfigService(
|
||||
/// Asynchronously retrieves a compact list of all display configurations from the repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="DisplayConfigMinimalResponse"/> objects representing the compact display configuration data.</returns>
|
||||
/// <!-- aidoc:v1 sig=c9c53b0 body=61092a4 -->
|
||||
public async Task<List<DisplayConfigMinimalResponse>> GetAllCompact()
|
||||
{
|
||||
return await displayConfigRepository.GetAllCompact();
|
||||
@@ -434,6 +452,7 @@ public class DisplayConfigService(
|
||||
/// <param name="configType">The display type of the configuration to create; determines which template subtype is expected and produced.</param>
|
||||
/// <param name="configHospital">The hospital to associate with the newly created configuration.</param>
|
||||
/// <returns>The inserted <see cref="DisplayConfig"/> when the template is found and matches the requested type; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=e4369ae body=d8b0ca1 -->
|
||||
public async Task<DisplayConfig?> InsertOneWithTemplate(string objectId,
|
||||
DisplayConfigEnums.DisplayType configType, string? configHospital)
|
||||
{
|
||||
@@ -491,6 +510,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The card configuration to update.</param>
|
||||
/// <returns>True if the update was applied (repository reported changes); otherwise, false.</returns>
|
||||
/// <!-- aidoc:v1 sig=2fc94b7 body=dc034f3 -->
|
||||
public async Task<bool> UpdateCardConfig(CardConfig baseConfig)
|
||||
{
|
||||
var result = await displayCardConfigRepository.UpdateOne(baseConfig);
|
||||
@@ -520,6 +540,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The card detail configuration to update, identified by its <c>Id</c>.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the update affected one or more records; <c>false</c> when no changes were made.</returns>
|
||||
/// <!-- aidoc:v1 sig=0e8ea62 body=ea85ef1 -->
|
||||
public async Task<bool> UpdateDetailConfig(CardDetailsConfig baseConfig)
|
||||
{
|
||||
var result = await displayDetailConfigRepository.UpdateOne(baseConfig);
|
||||
@@ -535,6 +556,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The chart configuration to be updated.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the update changed at least one record; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=c679975 body=ad4b9cc -->
|
||||
public async Task<bool> UpdateChartConfig(ChartConfig baseConfig)
|
||||
{
|
||||
var result = await displayChartRepository.UpdateOne(baseConfig);
|
||||
@@ -548,6 +570,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The object ID of the chart configuration display to delete.</param>
|
||||
/// <returns><c>true</c> if the chart configuration was successfully deleted; <c>false</c> if no matching configuration was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=9d99eb7 body=79681f0 -->
|
||||
public async Task<bool> DeleteChartConfig(ObjectId objectIdConfigDisplay)
|
||||
{
|
||||
var res = await displayChartRepository.DeleteOne(objectIdConfigDisplay);
|
||||
@@ -565,6 +588,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigChart">The unique identifier of the chart configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ChartConfig"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=7ec5c6d body=0fb37c4 -->
|
||||
public async Task<ChartConfig?> GetChartConfig(ObjectId objectIdConfigChart)
|
||||
{
|
||||
return await displayChartRepository.GetById(objectIdConfigChart);
|
||||
@@ -575,6 +599,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="updateDisplayConfigNameDto">The DTO containing the detail configuration to insert and, optionally, the ID of the display configuration to associate it with.</param>
|
||||
/// <returns>The newly inserted <see cref="CardDetailsConfig"/>, or <c>null</c> when no detail configuration is provided in the DTO.</returns>
|
||||
/// <!-- aidoc:v1 sig=68e8234 body=c2b345a -->
|
||||
public async Task<CardDetailsConfig?> InsertCardDetailConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto)
|
||||
{
|
||||
if (updateDisplayConfigNameDto.DetailConfig == null) return null;
|
||||
@@ -596,6 +621,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="updateDisplayConfigNameDto">The data transfer object containing the chart configuration to insert and, optionally, the target display configuration identifier.</param>
|
||||
/// <returns>The inserted <see cref="ChartConfig"/>, or <c>null</c> if the supplied chart configuration is <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=416a744 body=c958187 -->
|
||||
public async Task<ChartConfig?> InsertChartConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto)
|
||||
{
|
||||
if (updateDisplayConfigNameDto.ChartConfig == null) return null;
|
||||
@@ -616,6 +642,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="updateDisplayConfigNameDto">The DTO containing the card configuration to insert and, optionally, the display configuration id to associate it with.</param>
|
||||
/// <returns>The inserted <see cref="CardConfig"/>, or <c>null</c> when the provided card configuration is null.</returns>
|
||||
/// <!-- aidoc:v1 sig=148185d body=cda36fc -->
|
||||
public async Task<CardConfig?> InsertCardConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto)
|
||||
{
|
||||
if (updateDisplayConfigNameDto.CardConfig == null) return null;
|
||||
@@ -635,6 +662,7 @@ public class DisplayConfigService(
|
||||
/// Asynchronously retrieves all card configurations from the display card config repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="CardConfig"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=5559d88 body=f0a2a43 -->
|
||||
public async Task<List<CardConfig>> GetCardConfigAll()
|
||||
{
|
||||
return await displayCardConfigRepository.GetAll();
|
||||
@@ -645,6 +673,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the card configuration to retrieve.</param>
|
||||
/// <returns>The matching <see cref="CardConfig"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=5561120 body=747b0df -->
|
||||
public async Task<CardConfig?> GetCardConfigById(ObjectId id)
|
||||
{
|
||||
return await displayCardConfigRepository.GetById(id);
|
||||
@@ -656,6 +685,7 @@ public class DisplayConfigService(
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to look up the default configuration.</param>
|
||||
/// <returns>A <see cref="DisplayConfig"/> representing the default configuration for the specified type, or <see langword="null"/> if no default is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=467920d body=17622e6 -->
|
||||
public async Task<DisplayConfig?> GetDefaultConfig(DisplayConfigEnums.DisplayType type)
|
||||
{
|
||||
return await displayConfigRepository.GetDefault(type);
|
||||
@@ -668,6 +698,7 @@ public class DisplayConfigService(
|
||||
/// <param name="unitId">The identifier of the unit whose default display configuration is being requested.</param>
|
||||
/// <param name="displayType">The display type used to filter the default configuration lookup.</param>
|
||||
/// <returns>A <see cref="DisplayConfig"/> instance if a default is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=1db1561 body=6a6c951 -->
|
||||
private async Task<DisplayConfig?> GetDefaultByUnitIdAndType(ObjectId unitId,
|
||||
DisplayConfigEnums.DisplayType displayType)
|
||||
{
|
||||
@@ -682,6 +713,7 @@ public class DisplayConfigService(
|
||||
/// <param name="displayConfig">The display configuration to augment with minimal display section data, or <see langword="null"/>.</param>
|
||||
/// <returns>The updated <see cref="DisplayConfig"/>, or <see langword="null"/> if the input was <see langword="null"/>.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the display configuration cannot be found in the repository by its identifier.</exception>
|
||||
/// <!-- aidoc:v1 sig=ddfc93e body=861af41 -->
|
||||
private async Task<DisplayConfig?> AddDisplaySectionMinimal(DisplayConfig? displayConfig)
|
||||
{
|
||||
if (displayConfig == null) return null;
|
||||
@@ -715,6 +747,7 @@ public class DisplayConfigService(
|
||||
/// Updates the chart configuration to mark the specified entry as deleted by delegating to the display configuration repository.
|
||||
/// </summary>
|
||||
/// <param name="deletedId">The identifier of the chart configuration entry to mark as deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=f32f258 body=1f20989 -->
|
||||
private async Task UpdateDeletedChartConfig(ObjectId deletedId)
|
||||
{
|
||||
await displayConfigRepository.UpdateDeletedChartConfig(deletedId);
|
||||
@@ -726,6 +759,7 @@ public class DisplayConfigService(
|
||||
/// <param name="displayConfigId">The identifier of the display configuration to which the chart ID will be associated. May be null.</param>
|
||||
/// <param name="resultId">The identifier of the chart result to add to the display configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean indicating whether the chart ID was successfully added.</returns>
|
||||
/// <!-- aidoc:v1 sig=ffcdc08 body=2ef8f3d -->
|
||||
private async Task<bool> AddChartId(ObjectId? displayConfigId, ObjectId resultId)
|
||||
{
|
||||
var result = await displayConfigRepository.AddChartId(displayConfigId, resultId);
|
||||
@@ -738,6 +772,7 @@ public class DisplayConfigService(
|
||||
/// <param name="displayConfigId">The identifier of the display configuration to update, or null to skip.</param>
|
||||
/// <param name="resultId">The identifier of the result to associate with the card configuration, or null to skip.</param>
|
||||
/// <returns>A task that resolves to true if the update was successful; otherwise, false.</returns>
|
||||
/// <!-- aidoc:v1 sig=6b4fc3b body=b6c033c -->
|
||||
private async Task<bool> UpdateCardConfigId(ObjectId? displayConfigId, ObjectId? resultId)
|
||||
{
|
||||
var result = await displayConfigRepository.UpdateCardConfigId(displayConfigId, resultId);
|
||||
@@ -750,6 +785,7 @@ public class DisplayConfigService(
|
||||
/// <param name="displayConfigId">The display configuration identifier to associate with the result, or <c>null</c> if not specified.</param>
|
||||
/// <param name="resultId">The result identifier whose detail configuration should be updated, or <c>null</c> if not specified.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=e79ee9d body=4def5c3 -->
|
||||
private async Task<bool> UpdateDetailConfigId(ObjectId? displayConfigId, ObjectId? resultId)
|
||||
{
|
||||
var result = await displayConfigRepository.UpdateDetailConfigId(displayConfigId, resultId);
|
||||
@@ -764,6 +800,7 @@ public class DisplayConfigService(
|
||||
/// <param name="displayConfigId">The identifier of the display configuration whose change should be broadcast to related subscribers.</param>
|
||||
/// <param name="operationType">The type of operation performed on the configuration (e.g., create, update, delete) to convey to subscribers.</param>
|
||||
/// <param name="newDisplayConfig">The new display configuration payload to send to subscribers, or null if not applicable for the operation.</param>
|
||||
/// <!-- aidoc:v1 sig=e43b436 body=ea33ca3 -->
|
||||
private async void SendDisplayConfigBroadcast(ObjectId displayConfigId, OperationType operationType,
|
||||
object? newDisplayConfig)
|
||||
{
|
||||
@@ -793,6 +830,7 @@ public class DisplayConfigService(
|
||||
/// <param name="displayConfigId">The identifier of the display configuration used to look up the associated displays and to broadcast the global update.</param>
|
||||
/// <param name="newDisplayConfig">The new SmartDisplay configuration to propagate to subscribers, or null when not available.</param>
|
||||
/// <param name="oldDisplayConfig">The previous SmartDisplay configuration used to build the update payload, or null when not available.</param>
|
||||
/// <!-- aidoc:v1 sig=4dce3cf body=6f25e75 -->
|
||||
private async void SendSmartDisplayConfigBroadcast(ObjectId displayConfigId, SmartDisplay? newDisplayConfig,
|
||||
SmartDisplay? oldDisplayConfig)
|
||||
{
|
||||
@@ -827,6 +865,7 @@ public class DisplayConfigService(
|
||||
/// <param name="subscribers">The list of WebSocket subscribers that will receive the display configuration update messages.</param>
|
||||
/// <param name="oldDisplayDisplayConfig">The previous smart display configuration, or null if there is no prior configuration to compare against.</param>
|
||||
/// <param name="newDisplayDisplayConfig">The new smart display configuration whose values will be sent to subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=0563a96 body=4372a38 -->
|
||||
private void SendSmartDisplayConfigUpdate(List<WsSubscriber> subscribers,
|
||||
SmartDisplay? oldDisplayDisplayConfig, SmartDisplay? newDisplayDisplayConfig)
|
||||
{
|
||||
|
||||
@@ -57,6 +57,7 @@ public class DisplayService(
|
||||
/// <param name="display">The display to insert. Its <c>DisplayConfigId</c> is assigned from the resolved default configuration.</param>
|
||||
/// <returns>The inserted <see cref="Display"/> with its <c>DisplayConfigId</c> populated.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no default configuration is found for the specified display type.</exception>
|
||||
/// <!-- aidoc:v1 sig=9e0b693 body=032ec82 -->
|
||||
public async Task<Display> InsertOne(Display display)
|
||||
{
|
||||
var defaultConfig = await displayConfigService.GetDefaultConfig(display.Type) ??
|
||||
@@ -71,6 +72,7 @@ public class DisplayService(
|
||||
/// Inserts a test Display record into the repository and records a corresponding audit log entry using the current HTTP context user.
|
||||
/// </summary>
|
||||
/// <returns>The newly created <see cref="Display"/> entity.</returns>
|
||||
/// <!-- aidoc:v1 sig=4ec9793 body=0fdb428 -->
|
||||
public async Task<Display> InsertOneTest()
|
||||
{
|
||||
var d = new Display
|
||||
@@ -92,6 +94,7 @@ public class DisplayService(
|
||||
/// Retrieves all displays from the repository and maps them to a compact representation.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="DisplayMinimalDto"/> with the mapped display data.</returns>
|
||||
/// <!-- aidoc:v1 sig=d065c6f body=4d0461d -->
|
||||
public async Task<List<DisplayMinimalDto>> GetAllCompact()
|
||||
{
|
||||
var result = await displayRepository.GetAll();
|
||||
@@ -106,6 +109,7 @@ public class DisplayService(
|
||||
/// <param name="userName">The user name used to filter the display items, or <see langword="null"/> to retrieve all items.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Display"/> items.</returns>
|
||||
/// <exception cref="NotImplementedException">The method has not been implemented yet.</exception>
|
||||
/// <!-- aidoc:v1 sig=7a39576 body=bfa6f2f -->
|
||||
public Task<List<Display>> GetAll(string? userName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -116,6 +120,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing the page number and page size used to determine the slice of results to return.</param>
|
||||
/// <returns>A <see cref="Task{PaginationResponse{Display}}"/> containing the requested page of displays, the current page number, the page size, and the total number of documents.</returns>
|
||||
/// <!-- aidoc:v1 sig=5ace491 body=5778d73 -->
|
||||
public async Task<PaginationResponse<Display>> GetPaginatedDisplays(PaginationFilter filter)
|
||||
{
|
||||
var result = displayRepository.GetPaginatedDisplays(filter);
|
||||
@@ -138,6 +143,7 @@ public class DisplayService(
|
||||
/// <param name="userName">The username whose displays should be retrieved; when null, the method returns an empty list.</param>
|
||||
/// <returns>A task that yields a list of <see cref="DisplayWithPermissionsDto"/> containing the displays the user can access along with their permissions.</returns>
|
||||
/// <exception cref="ForbbidenException">Thrown when permissions for a unit-scoped display cannot be obtained for the user.</exception>
|
||||
/// <!-- aidoc:v1 sig=3460ae9 body=04cbe7e -->
|
||||
public async Task<List<DisplayWithPermissionsDto>> GetAllByUser(string? userName)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
@@ -208,6 +214,7 @@ public class DisplayService(
|
||||
/// <param name="displayId">The identifier of the display to look up, compared as a string.</param>
|
||||
/// <param name="perms">The collection of display-with-permissions entries to search through.</param>
|
||||
/// <returns><c>true</c> if a non-null display with a matching identifier is found; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=3e72746 body=367999b -->
|
||||
private static bool FindDisplayInPerms(string displayId, List<DisplayWithPermissionsDto> perms)
|
||||
{
|
||||
return perms.Any(p => p.Display != null && p.Display.Id.ToString() == displayId);
|
||||
@@ -219,6 +226,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to filter the display configurations.</param>
|
||||
/// <returns>A list of displays matching the specified type, each with its related configuration assigned; an empty list is returned when no displays are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=37f36bb body=aac9b72 -->
|
||||
public async Task<List<Display>> GetByType(DisplayConfigEnums.DisplayType type)
|
||||
{
|
||||
var configs = await displayConfigService.GetByType(type);
|
||||
@@ -238,6 +246,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care used to filter the displays.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the list of displays matching the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=ad8af85 body=9447333 -->
|
||||
public async Task<List<Display>> GetByPointOfCare(PointOfCare pointOfCare)
|
||||
{
|
||||
return await displayRepository.GetByPointOfCare(pointOfCare);
|
||||
@@ -248,6 +257,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="configId">The configuration identifier used to look up the associated displays.</param>
|
||||
/// <returns>A task that returns the list of <see cref="Display"/> objects matching the given configuration identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=1ceff79 body=c343dde -->
|
||||
public Task<List<Display>> GetByConfigId(ObjectId configId)
|
||||
{
|
||||
return displayRepository.GetByConfigId(configId);
|
||||
@@ -258,6 +268,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the card configuration used to look up the associated displays.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Display"/> objects matching the provided card configuration identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=c38a1bb body=4696c61 -->
|
||||
public Task<List<Display>> GetByCardConfigId(ObjectId configId)
|
||||
{
|
||||
return displayRepository.GetByCardConfigId(configId);
|
||||
@@ -269,6 +280,7 @@ public class DisplayService(
|
||||
/// <param name="name">The name of the display to look up.</param>
|
||||
/// <returns>The <see cref="Display"/> that matches the specified name.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no display is found for the given name.</exception>
|
||||
/// <!-- aidoc:v1 sig=58df1bb body=33a5e00 -->
|
||||
public async Task<Display?> GetByName(string name)
|
||||
{
|
||||
return await displayRepository.GetByName(name) ??
|
||||
@@ -280,6 +292,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display to retrieve.</param>
|
||||
/// <returns>The matching <see cref="Display"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=06fe2a7 body=bf712b4 -->
|
||||
public async Task<Display?> GetById(ObjectId id)
|
||||
{
|
||||
return await displayRepository.GetById(id);
|
||||
@@ -292,6 +305,7 @@ public class DisplayService(
|
||||
/// <param name="localeEnum">The locale used to localize the related point-of-care information.</param>
|
||||
/// <returns>A <see cref="DisplayWithPermissionsDto"/> containing the display and its associated permissions.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the current user cannot be identified from the JWT or when no display is found for the specified <paramref name="id"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=4aa342c body=756b4f9 -->
|
||||
public async Task<DisplayWithPermissionsDto> GetByIdWithPermissions(ObjectId id, LocaleEnum localeEnum)
|
||||
{
|
||||
var username = JwtHelper.GetUsernameFromPrincipal(httpContextAccessor.HttpContext?.User!) ??
|
||||
@@ -333,6 +347,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose displays should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the total number of displays for the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=db66b12 body=1dd1fbe -->
|
||||
public async Task<long> CountDisplaysByUnitId(ObjectId unitId)
|
||||
{
|
||||
return await displayRepository.CountByUnitId(unitId);
|
||||
@@ -353,6 +368,7 @@ public class DisplayService(
|
||||
/// <param name="fillDisplayConfig">If true, retrieves the full display including its configuration (cached); otherwise retrieves the base display.</param>
|
||||
/// <param name="ct">Cancellation token to cancel the operation.</param>
|
||||
/// <returns>The requested <see cref="Display"/>, or <c>null</c> if no display is found for the given id.</returns>
|
||||
/// <!-- aidoc:v1 sig=7a4d82f body=f266015 -->
|
||||
public async Task<Display?> GetInfo(ObjectId id,
|
||||
string? userName,
|
||||
List<Authorization>? authorizations,
|
||||
@@ -429,6 +445,8 @@ public class DisplayService(
|
||||
/// <param name="id">The identifier of the display to load.</param>
|
||||
/// <param name="ct">The cancellation token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>The <see cref="Display"/> with its configuration populated, or <c>null</c> if no display exists for the given <paramref name="id"/>.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_param_role
|
||||
/// "The ct parameter is documented as 'used to cancel the asynchronous operation', but the method never passes ct to displayRepository.GetById, displayConfigService.GetById, or displayConfigService.GetCardConfigById, so the token has no effect on cancellation." -->
|
||||
private async Task<Display?> BuildDisplayWithConfig(ObjectId id, CancellationToken ct)
|
||||
{
|
||||
var display = await displayRepository.GetById(id);
|
||||
@@ -465,6 +483,7 @@ public class DisplayService(
|
||||
/// <param name="userName">The username used to look up the user and their authorities; if null, an empty list is returned.</param>
|
||||
/// <param name="authorizations">Optional pre-fetched list of user authorities; when null, authorities are retrieved from the authority service.</param>
|
||||
/// <returns>A task that resolves to a list of <see cref="MinimalDisplaySection"/> items accessible to the user and matching the specified display type.</returns>
|
||||
/// <!-- aidoc:v1 sig=64d7b66 body=cc129cf -->
|
||||
public async Task<List<MinimalDisplaySection>> GetDisplaySectionByUser(
|
||||
DisplayConfigEnums.DisplayType type,
|
||||
ObjectId? currentDisplay,
|
||||
@@ -539,6 +558,7 @@ public class DisplayService(
|
||||
/// Asynchronously retrieves all display configurations of type DisplayNurse and SmartDisplay, mapping them into minimal display sections and grouping them within a display list DTO.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a MinimalDisplayListDto with the populated DisplayNurse and SmartDisplay collections.</returns>
|
||||
/// <!-- aidoc:v1 sig=208d6c6 body=b473ad8 -->
|
||||
public async Task<MinimalDisplayListDto> GetAllDisplaySection()
|
||||
{
|
||||
var minimalDisplayListDto = new MinimalDisplayListDto();
|
||||
@@ -572,6 +592,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose displays should be returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Display"/> objects for the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=61f7d68 body=08a2310 -->
|
||||
public async Task<List<Display>> GetByUnitId(ObjectId unitId)
|
||||
{
|
||||
return await displayRepository.GetByUnitId(unitId);
|
||||
@@ -584,6 +605,8 @@ public class DisplayService(
|
||||
/// <param name="excludeVirtual">When set to <c>true</c>, virtual points of care are excluded from the result; otherwise, they are included.</param>
|
||||
/// <returns>A <see cref="PocAndUnitDto"/> containing the available points of care and their associated unit details.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when a unit associated with one of the resolved display identifiers cannot be found.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_exception
|
||||
/// "NotFoundException is thrown inside the try block but immediately caught by the generic catch(Exception) handler, which logs the error and returns an empty PocAndUnitDto. The exception never propagates to the caller, so documenting it as thrown is misleading." -->
|
||||
public async Task<PocAndUnitDto> GetAllAvailablePoc(List<string> displayIds, bool excludeVirtual = false)
|
||||
{
|
||||
try
|
||||
@@ -635,6 +658,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="id">The ObjectId of the display whose points of care should be retrieved.</param>
|
||||
/// <returns>A list of points of care linked to the display, or an empty list if the display cannot be found or if an error is encountered.</returns>
|
||||
/// <!-- aidoc:v1 sig=9215df7 body=d5eaca6 -->
|
||||
public async Task<List<PointOfCare>> GetAllPocsByDisplayId(ObjectId id)
|
||||
{
|
||||
try
|
||||
@@ -664,6 +688,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The identifier of the display configuration whose locations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="DisplayConfigLocationDto"/> objects with display and unit information.</returns>
|
||||
/// <!-- aidoc:v1 sig=0895dcd body=e5b010a -->
|
||||
public async Task<List<DisplayConfigLocationDto>> GetDisplayConfigLocations(ObjectId displayConfigId)
|
||||
{
|
||||
var displays = await GetByConfigId(displayConfigId);
|
||||
@@ -687,6 +712,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The unique identifier of the display configuration to check.</param>
|
||||
/// <returns><c>true</c> if the display configuration is referenced by at least one entity; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=685c5f5 body=f4b630c -->
|
||||
public async Task<bool> IsDisplayConfigInUse(ObjectId displayConfigId)
|
||||
{
|
||||
return await displayRepository.IsDisplayConfigInUse(displayConfigId) > 0;
|
||||
@@ -708,6 +734,7 @@ public class DisplayService(
|
||||
/// <returns>The updated <see cref="Display"/> instance after the point of care list change.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no display exists for the specified <paramref name="objectId"/>.</exception>
|
||||
/// <exception cref="ConflictException">Thrown when the point of care list update cannot be persisted.</exception>
|
||||
/// <!-- aidoc:v1 sig=68b108f body=41d1e6a -->
|
||||
public async Task<Display?> UpdatePointOfCareList(ObjectId objectId, List<ObjectId> listPocObId)
|
||||
{
|
||||
var oldDisplay = await displayRepository.GetById(objectId) ??
|
||||
@@ -729,6 +756,10 @@ public class DisplayService(
|
||||
/// <param name="oldDisplay">The existing display whose configuration will be updated.</param>
|
||||
/// <param name="newDisplayConfig">The new configuration to apply, or <c>null</c> if no update is provided.</param>
|
||||
/// <returns>The updated <see cref="Display"/> if the configuration was successfully applied; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the method returns null 'if the provided configuration type is not supported,' but newDisplayConfigCast is initialized to a non-null default and the code proceeds to the repository call for any non-null cast result, including unsupported types." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary groups broadcast, audit log creation, and cache invalidation together as happening 'on a successful update,' but cache invalidation occurs whenever a valid config type is provided, even if the repository update returns null." -->
|
||||
public async Task<Display?> UpdateConfig(Display oldDisplay, DisplayConfig? newDisplayConfig)
|
||||
{
|
||||
var newDisplayConfigCast = new DisplayConfig();
|
||||
@@ -766,6 +797,7 @@ public class DisplayService(
|
||||
/// <param name="oldDisplay">The display whose configuration ID is being updated.</param>
|
||||
/// <param name="configId">The new configuration ID to assign to the display.</param>
|
||||
/// <returns>The updated display, or <c>null</c> if the display was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a4c5a08 body=1c84331 -->
|
||||
public async Task<Display?> UpdateConfigId(Display oldDisplay, ObjectId configId)
|
||||
{
|
||||
var displayToReturn = await displayRepository.UpdateConfigId(oldDisplay.Id, configId);
|
||||
@@ -787,6 +819,8 @@ public class DisplayService(
|
||||
/// <returns>The updated <see cref="Display"/> entity, or <c>null</c> if the update could not be completed.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the update result or the resolved configuration is <c>null</c>.</exception>
|
||||
/// <exception cref="InvalidFormatException">Thrown when the configuration type is not one of the handled display types.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_returns
|
||||
/// "Documentation states the method returns 'null if the update could not be completed', but the code throws NotFoundException when result is null, never actually returning null to the caller." -->
|
||||
public async Task<Display?> UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay)
|
||||
{
|
||||
var oldConfig = await displayConfigService.GetById(objectIdConfigDisplay);
|
||||
@@ -824,6 +858,7 @@ public class DisplayService(
|
||||
/// <param name="name">The new name to assign to the display.</param>
|
||||
/// <returns>The updated <see cref="Display"/> instance, or <c>null</c> if the update could not be performed.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no display is found for the specified <paramref name="id"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=18e4a50 body=b0ad3f7 -->
|
||||
public async Task<Display?> UpdateName(ObjectId id, string name)
|
||||
{
|
||||
var display = await displayRepository.GetById(id) ??
|
||||
@@ -846,6 +881,7 @@ public class DisplayService(
|
||||
/// <param name="id">The unique identifier of the display to delete.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the display has been successfully deleted.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no display is found for the specified <paramref name="id"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=328e872 body=46f2b0a -->
|
||||
public async Task<bool> DeleteDisplay(ObjectId id)
|
||||
{
|
||||
var display = await displayRepository.GetById(id) ??
|
||||
@@ -865,6 +901,7 @@ public class DisplayService(
|
||||
/// Deletes all displays associated with the specified unit identifier, invalidates the displays cache, and removes related authority data for the unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose displays and related authority data will be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=bd663aa body=28edafe -->
|
||||
public async Task DeleteDisplaysByUnitId(ObjectId unitId)
|
||||
{
|
||||
await displayRepository.DeleteManyByUnitId(unitId);
|
||||
@@ -883,6 +920,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="subscribers">The list of WebSocket subscribers that will receive the smart display configuration update.</param>
|
||||
/// <param name="config">The smart display configuration to broadcast. May be <c>null</c> if no configuration is provided.</param>
|
||||
/// <!-- aidoc:v1 sig=57faa95 body=71328cd -->
|
||||
private void SendSmartDisplayBroadcast(List<WsSubscriber> subscribers, SmartDisplay? config)
|
||||
{
|
||||
foreach (var subscriber in subscribers)
|
||||
@@ -894,6 +932,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="subscribers">The list of WebSocket subscribers that will receive the nurse display configuration update.</param>
|
||||
/// <param name="config">The nurse display configuration to broadcast, which may be <c>null</c>.</param>
|
||||
/// <!-- aidoc:v1 sig=6730073 body=809b5d8 -->
|
||||
private void SendNurseDisplayBroadcast(List<WsSubscriber> subscribers, DisplayNurse? config)
|
||||
{
|
||||
foreach (var subscriber in subscribers)
|
||||
@@ -906,6 +945,7 @@ public class DisplayService(
|
||||
/// </summary>
|
||||
/// <param name="display">The display whose subscribers will receive the broadcast; used to filter the subscriber list by its identifier.</param>
|
||||
/// <param name="operation">The type of operation being broadcast, which determines the action taken on matching subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=30dad01 body=bbd0711 -->
|
||||
private void SendDisplayBroadcast(Display display, OperationType operation)
|
||||
{
|
||||
var subscribers = subscribersService.GetSubscribers().Where(s =>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace adas_core.Application.Services;
|
||||
/// <summary>
|
||||
/// Provides a concrete implementation of the <see cref="IFileService"/> contract for performing file-related operations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=52eb70b -->
|
||||
public class FileService : IFileService
|
||||
{
|
||||
private readonly string? _assetsDirectory;
|
||||
@@ -47,6 +48,7 @@ public class FileService : IFileService
|
||||
/// </summary>
|
||||
/// <param name="files">The collection of uploaded form files to be written to the update directory.</param>
|
||||
/// <returns>A task that resolves to true when every file is successfully copied, or false when the update directory is not configured.</returns>
|
||||
/// <!-- aidoc:v1 sig=8b3261f body=f4c95cd -->
|
||||
public async Task<bool> CopyUpdateFiles(ICollection<IFormFile> files)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_updateDirectory)) return false;
|
||||
@@ -66,6 +68,7 @@ public class FileService : IFileService
|
||||
/// <param name="files">The collection of uploaded form files to persist to the assets directory.</param>
|
||||
/// <param name="themeParse">The asset theme used to determine the subdirectory in which the files will be stored.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the files are successfully written, or <c>false</c> when the assets directory path is not configured.</returns>
|
||||
/// <!-- aidoc:v1 sig=6ee9410 body=8680e5a -->
|
||||
public async Task<bool> UploadAssetFiles(ICollection<IFormFile> files, FileEnum.AssetTheme themeParse)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_assetsDirectory)) return false;
|
||||
@@ -87,6 +90,7 @@ public class FileService : IFileService
|
||||
/// </summary>
|
||||
/// <param name="themeParse">The theme used to locate the corresponding subdirectory within the assets directory.</param>
|
||||
/// <returns>A list of <see cref="AssetDto"/> objects containing the name, extension, and full path of each file found; an empty list if the assets directory is not configured or an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=0de5997 body=8f16929 -->
|
||||
public List<AssetDto> GetAllAssetFile(FileEnum.AssetTheme themeParse)
|
||||
{
|
||||
try
|
||||
@@ -125,6 +129,7 @@ public class FileService : IFileService
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">The path of the directory to search for files.</param>
|
||||
/// <returns>A list of file paths found in the directory, or an empty list if the directory does not exist or an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=c3be2b5 body=d2272c4 -->
|
||||
public List<string> GetFilesInDirectory(string directoryPath)
|
||||
{
|
||||
List<string> fileList = [];
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace adas_core.Application.Services;
|
||||
/// <summary>
|
||||
/// Provides a concrete implementation of <see cref="IGroupedObservationService"/> for managing and exposing grouped observation data.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d252f21 -->
|
||||
public class GroupedObservationService : IGroupedObservationService
|
||||
{
|
||||
private readonly CacheSettings? _cacheSettings;
|
||||
@@ -61,6 +62,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="cacheIsChecked">When <c>true</c>, the cache is bypassed and observations are always recomputed; when <c>false</c>, results are obtained through the cache with the configured TTL.</param>
|
||||
/// <param name="ct">Token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A <see cref="Task{GroupedObservation}"/> containing the patient id, group, name, and the list of computed <see cref="GroupedObservationObs"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=17d649b body=5ba5a2e -->
|
||||
public async Task<GroupedObservation> GenerateGroupedObservation(
|
||||
ObjectId patientId,
|
||||
GroupedField groupedField,
|
||||
@@ -357,6 +359,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="obs">The new patient observation to be incorporated into the grouped observation.</param>
|
||||
/// <param name="timeZoneId">The time zone identifier used when a full recalculation is required. Defaults to "Romance Standard Time".</param>
|
||||
/// <returns>A task that resolves to the generated <see cref="GroupedObservation"/> for the patient, either from an incrementally updated cache entry or from a full recalculation.</returns>
|
||||
/// <!-- aidoc:v1 sig=63421dc body=6b8c46b -->
|
||||
public async Task<GroupedObservation> GenerateGroupedObservation(
|
||||
ObjectId patientId,
|
||||
GroupedField groupedField,
|
||||
@@ -408,6 +411,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 2.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to restrict the result set. When null, no filtering is applied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservation"/> entries representing the patient's most recent observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=6f6283b body=92c1221 -->
|
||||
public async Task<List<PatientObservation>> FindLastObservations(ObjectId patientId, int num = 2,
|
||||
List<string>? filterObservations = null)
|
||||
{
|
||||
@@ -420,6 +424,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// </summary>
|
||||
/// <param name="ws">The grouped subscriber context that supplies the group, names, regularity, max window, and cache key used to derive the next observations.</param>
|
||||
/// <returns>A <see cref="GroupedObservation"/> containing the resulting observations adjusted to the configured time window based on <see cref="GroupedObservationEnum.Regularity"/> (Minute, Second, or default hour-based).</returns>
|
||||
/// <!-- aidoc:v1 sig=b957e8f body=3a63489 -->
|
||||
public async Task<GroupedObservation> CreateNextEmptyObs(WsSubscriberGrouped ws)
|
||||
{
|
||||
var gf = new GroupedField
|
||||
@@ -525,6 +530,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="result">The existing grouped observation documents to be completed with missing intervals.</param>
|
||||
/// <param name="groupedField">The grouping configuration that defines the names, maximum number of intervals, regularity and result types to use when generating the placeholders.</param>
|
||||
/// <returns>A list of <see cref="BsonDocument"/> entries ordered by time, containing the original data and any added zero-valued filler entries for missing intervals.</returns>
|
||||
/// <!-- aidoc:v1 sig=b15a145 body=b74a0fe -->
|
||||
public List<BsonDocument> FillHours(List<BsonDocument> result, GroupedField groupedField)
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
@@ -725,6 +731,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="groupedField">The grouped field containing either a list of names to iterate over or a single name used as fallback when the list is empty.</param>
|
||||
/// <param name="patientId">The identifier of the patient whose observations are being calculated.</param>
|
||||
/// <returns>A task that returns a list of BsonDocument containing the calculated last filled observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=685bef7 body=8a6adf3 -->
|
||||
public async Task<List<BsonDocument>> CalculateLastFilledObservations(List<BsonDocument> result,
|
||||
GroupedField groupedField, ObjectId patientId)
|
||||
{
|
||||
@@ -751,6 +758,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="patientId">The patient identifier used to query the last observation before the earliest expected date.</param>
|
||||
/// <param name="name">The name assigned to the generated BsonDocument <c>_id</c> entries.</param>
|
||||
/// <returns>The result list with missing time-slot entries filled using the last-filled value, ordered by time.</returns>
|
||||
/// <!-- aidoc:v1 sig=3627386 body=09800ac -->
|
||||
private async Task<List<BsonDocument>> LastFilledCalc(List<BsonDocument> result, GroupedField groupedField,
|
||||
ObjectId patientId, string? name)
|
||||
{
|
||||
@@ -875,6 +883,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="shiftGroupObservations">The list of shift observations to be aggregated.</param>
|
||||
/// <param name="groupedField">The grouped field configuration whose Result property determines whether a Sum aggregation is applied.</param>
|
||||
/// <returns>A list of <see cref="BsonDocument"/> containing the aggregated shift observations, or the original list when no Sum operation is required.</returns>
|
||||
/// <!-- aidoc:v1 sig=37e3bfd body=e1601ec -->
|
||||
public List<BsonDocument> CalculateShiftObservations(List<BsonDocument> shiftGroupObservations,
|
||||
GroupedField groupedField)
|
||||
{
|
||||
@@ -923,6 +932,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// grouped into half-hour intervals and enriched with a "halfhour" field in place.</param>
|
||||
/// <returns>The same <see cref="List{BsonDocument}"/> instance with the "halfhour" field populated
|
||||
/// according to the half-hour grouping rules.</returns>
|
||||
/// <!-- aidoc:v1 sig=9daf918 body=efd69f0 -->
|
||||
public List<BsonDocument> CalculateHalfHourObservations(List<BsonDocument> result)
|
||||
{
|
||||
//HalfHour añadir que se rellenen las horas que no existen
|
||||
@@ -1000,6 +1010,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="result">The list of aggregated BsonDocuments to enrich; each document is modified in place to include the day and shift elements.</param>
|
||||
/// <param name="groupedField">The grouping configuration providing the ordered list of shift start times used to determine the assigned shift.</param>
|
||||
/// <returns>The same <paramref name="result"/> list with day and shift elements added to each successfully processed document.</returns>
|
||||
/// <!-- aidoc:v1 sig=f6df652 body=c517b3e -->
|
||||
public List<BsonDocument> GenerateShiftObservations(List<BsonDocument> result, GroupedField groupedField)
|
||||
{
|
||||
result.ForEach(item =>
|
||||
@@ -1095,6 +1106,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="obs">The patient observation to match against or insert into the group.</param>
|
||||
/// <param name="groupedField">The grouped field providing the regularity, result aggregation types, maximum retention count, and shift configuration.</param>
|
||||
/// <returns>The updated list of grouped observations, limited to entries whose time is within the allowed date range.</returns>
|
||||
/// <!-- aidoc:v1 sig=cca5083 body=147be01 -->
|
||||
private List<GroupedObservationObs> LocateCurrentObsInGroup(List<GroupedObservationObs> group,
|
||||
PatientObservation obs, GroupedField groupedField)
|
||||
{
|
||||
@@ -1241,6 +1253,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="currentObsDate">The observation date whose time of day is evaluated against the configured shifts.</param>
|
||||
/// <param name="groupedFieldStartTimeShift">The list of shift start time strings used to build the shift intervals; must contain at least one entry to produce a result.</param>
|
||||
/// <returns>The zero-based index of the matching shift, -1 if no shift matches, or null if <paramref name="groupedFieldStartTimeShift"/> is empty.</returns>
|
||||
/// <!-- aidoc:v1 sig=d71f06d body=ef631e3 -->
|
||||
private int? GetShift(DateTime currentObsDate, List<string> groupedFieldStartTimeShift)
|
||||
{
|
||||
if (groupedFieldStartTimeShift.Count == 0) return null;
|
||||
@@ -1264,6 +1277,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// </summary>
|
||||
/// <param name="groupedFieldStartTimeShift">A list of time span string representations to be parsed and adjusted.</param>
|
||||
/// <returns>A list of TimeSpan values where each entry is the original time plus one minute, or the subsequent time span if adding one minute would exceed it.</returns>
|
||||
/// <!-- aidoc:v1 sig=1b7da10 body=741054c -->
|
||||
private List<TimeSpan> GetTimeSpan(List<string> groupedFieldStartTimeShift)
|
||||
{
|
||||
List<TimeSpan> timeSpans = [];
|
||||
@@ -1294,6 +1308,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="min">The optional minimum bound used in the status evaluation.</param>
|
||||
/// <param name="max">The optional maximum bound used in the status evaluation.</param>
|
||||
/// <returns>A task that resolves to the <see cref="StatusEnum.Type"/> representing the status of the grouped observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=8c95413 body=a79f912 -->
|
||||
private async Task<StatusEnum.Type> GroupedObservationStatus(GroupedField groupedField,
|
||||
GroupedObservationEnum.Result result, string name, object value, double? min, double? max)
|
||||
{
|
||||
@@ -1306,6 +1321,7 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="obs">The grouped observation containing the timestamp of the last recorded observation.</param>
|
||||
/// <param name="gf">The grouped field whose regularity (second, minute, hour, or day) defines the time unit used in the calculation.</param>
|
||||
/// <returns>A tuple containing the number of times left to create an empty observation (the ceiling of the elapsed time in the selected unit) and the multiplier factor associated with the regularity unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=dcb9cc9 body=13579ae -->
|
||||
private (int timesLeft, int multiplierFactor) TimesLeftToCreateEmptyObs(GroupedObservationObs obs, GroupedField gf)
|
||||
{
|
||||
var currentDateTime = DateTime.Now;
|
||||
@@ -1346,6 +1362,8 @@ public class GroupedObservationService : IGroupedObservationService
|
||||
/// <param name="gf">The grouped field providing the list of result property names to copy and the regularity used to determine shift handling.</param>
|
||||
/// <param name="seconsToAdd">The number of seconds to add to the source observation's time for the new observation.</param>
|
||||
/// <returns>A new <see cref="GroupedObservationObs"/> populated with values derived from <paramref name="sourceObs"/>; when the regularity is <see cref="GroupedObservationEnum.Regularity.Shift"/>, the shift date and shift are also assigned.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "The <returns> description states the new observation is 'populated with values derived from sourceObs', but the code sets each property in gf.Result to a defaultValue of (0, sourceObs.Time) and never copies the actual values from sourceObs. The retrieved sourceObs value is only used to mutate sourceObs (resetting its inner Time), not to populate lastObs." -->
|
||||
private GroupedObservationObs CreateNextObs(GroupedObservationObs sourceObs, GroupedField gf, int seconsToAdd)
|
||||
{
|
||||
var lastObs = new GroupedObservationObs
|
||||
|
||||
@@ -30,6 +30,7 @@ public class HistoricalConfigChangesService(
|
||||
/// Deletes a historical configuration change record by its identifier and creates an audit log entry recording the deletion.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the historical configuration change to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=86555ed body=001920f -->
|
||||
public async Task DeleteHistoricalConfigChange(ObjectId id)
|
||||
{
|
||||
var filter = Builders<HistoricalConfigChanges>.Filter.Eq("_id", id);
|
||||
@@ -44,6 +45,7 @@ public class HistoricalConfigChangesService(
|
||||
/// </summary>
|
||||
/// <param name="configType">The configuration type used to look up the last historical change.</param>
|
||||
/// <returns>The most recent <see cref="HistoricalConfigChanges"/> entry, or <c>null</c> if no changes exist for the given type.</returns>
|
||||
/// <!-- aidoc:v1 sig=c35ac55 body=bbcde5b -->
|
||||
public async Task<HistoricalConfigChanges?> FindLastConfigChanges(DisplayConfigEnums.ConfigTypes configType)
|
||||
{
|
||||
var result = await historicalConfigChangesRepository.FindLastHistoricalConfigChangesByType(configType);
|
||||
@@ -57,6 +59,7 @@ public class HistoricalConfigChangesService(
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the historical configuration change to retrieve.</param>
|
||||
/// <returns>The matching <see cref="HistoricalConfigChanges"/> record, or null if no record is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=7f8de28 body=46df3de -->
|
||||
public async Task<HistoricalConfigChanges?> Get(ObjectId id)
|
||||
{
|
||||
return await historicalConfigChangesRepository.FindById(id);
|
||||
@@ -66,6 +69,7 @@ public class HistoricalConfigChangesService(
|
||||
/// Retrieves all historical configuration changes from the repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of all <see cref="HistoricalConfigChanges"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=f0919e8 body=6a8aec9 -->
|
||||
public async Task<ICollection<HistoricalConfigChanges>> GetAll()
|
||||
{
|
||||
return await historicalConfigChangesRepository.FindAll();
|
||||
@@ -77,6 +81,7 @@ public class HistoricalConfigChangesService(
|
||||
/// <param name="type">The configuration type used to filter the historical changes.</param>
|
||||
/// <param name="num">The maximum number of recent changes to return. Defaults to 10.</param>
|
||||
/// <returns>A collection of the latest <see cref="HistoricalConfigChanges"/> entries matching the specified type.</returns>
|
||||
/// <!-- aidoc:v1 sig=eb58afd body=9a8ae02 -->
|
||||
public async Task<ICollection<HistoricalConfigChanges>> GetByType(DisplayConfigEnums.ConfigTypes type, int num = 10)
|
||||
{
|
||||
return await historicalConfigChangesRepository.FindLastHistoricalConfigChangesByType(type, num);
|
||||
@@ -90,6 +95,7 @@ public class HistoricalConfigChangesService(
|
||||
/// <param name="configTypes">Optional filter for the configuration type; when null, all configuration types are included.</param>
|
||||
/// <param name="num">The maximum number of historical change entries to return. Defaults to 10.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of the user's historical configuration changes.</returns>
|
||||
/// <!-- aidoc:v1 sig=a9c5b43 body=8f686c3 -->
|
||||
public async Task<ICollection<HistoricalConfigChanges>> GetByUser(string user,
|
||||
DisplayConfigEnums.ConfigTypes? configTypes = null, int num = 10)
|
||||
{
|
||||
@@ -103,6 +109,7 @@ public class HistoricalConfigChangesService(
|
||||
/// <param name="historicalConfigChanges">The historical configuration change entity to insert.</param>
|
||||
/// <returns>The inserted <see cref="HistoricalConfigChanges"/> entity, or null if the operation fails.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the repository returns null after the insert operation.</exception>
|
||||
/// <!-- aidoc:v1 sig=06deefb body=1a2682f -->
|
||||
public async Task<HistoricalConfigChanges?> InsertOne(HistoricalConfigChanges historicalConfigChanges)
|
||||
{
|
||||
try
|
||||
@@ -127,6 +134,10 @@ public class HistoricalConfigChangesService(
|
||||
/// <param name="historicalConfigChanges">The historical configuration change entity containing the updated values to persist.</param>
|
||||
/// <returns>The updated <see cref="HistoricalConfigChanges"/> entity on success, or <c>null</c> if an error occurs during the operation.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when no existing historical configuration change is found with the specified <c>Id</c>.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_exception
|
||||
/// "ConflictException is thrown inside the try block but immediately caught by the outer catch (Exception ex), which logs and returns null. The exception never propagates to callers, so documenting it as thrown is misleading." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Summary states 'If the record is not found, a ConflictException is thrown', but in practice the throw is swallowed by the catch block and the method returns null with a logged error." -->
|
||||
public async Task<HistoricalConfigChanges?> UpdateHistoricalConfigChange(
|
||||
HistoricalConfigChanges historicalConfigChanges)
|
||||
{
|
||||
@@ -155,6 +166,7 @@ public class HistoricalConfigChangesService(
|
||||
/// <param name="configType">The type of configuration that was changed.</param>
|
||||
/// <param name="newConfig">The new configuration value after the change.</param>
|
||||
/// <param name="oldConfig">The previous configuration value before the change.</param>
|
||||
/// <!-- aidoc:v1 sig=dd55e13 body=56cb363 -->
|
||||
public async Task LogConfigChanged(string user, DisplayConfigEnums.ConfigTypes configType, string newConfig,
|
||||
string oldConfig)
|
||||
{
|
||||
|
||||
@@ -8,10 +8,12 @@ public interface IApiRequestService
|
||||
/// Asynchronously persists the specified <see cref="ApiRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
/// <!-- aidoc:v1 sig=24f178e -->
|
||||
Task SaveRequestAsync(ApiRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Asynchronously saves the specified API request.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to persist.</param>
|
||||
/// <!-- aidoc:v1 sig=274a023 -->
|
||||
Task SaveRequest(ApiRequest apiRequest);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user