Documentation modifications

This commit is contained in:
julian
2026-06-27 15:23:26 -07:00
parent a633fe6c06
commit a19fb90902
218 changed files with 2882 additions and 0 deletions
@@ -18,6 +18,12 @@ public class PublisherService : IPublisherService
private readonly HashSet<string> _queues = new();
private readonly IBus? _bus;
/// <summary>
/// Initializes a new instance of the <see cref="PublisherService"/> class, a RabbitMQ publisher service, by configuring the message bus from <paramref name="rabbitMqSettings"/> and storing <paramref name="logger"/> for diagnostic logging.
/// </summary>
/// <param name="rabbitMqSettings">The RabbitMQ configuration whose <see cref="RabbitMqSettings.ConnectionString"/> is used to initialize the message bus.</param>
/// <param name="logger">The logger used to record initialization status and errors.</param>
/// <!-- aidoc:v1 sig=e60da0f body=9c07ebc -->
public PublisherService(
IOptions<RabbitMqSettings> rabbitMqSettings,
ILogger<PublisherService> logger)
@@ -48,6 +54,17 @@ public class PublisherService : IPublisherService
}
}
/// <summary>
/// Registers a queue with the specified <paramref name="queueName"/> for tracking purposes,
/// while the actual queue creation is delegated to EasyNetQ. Returns false when the name is
/// null, empty, or whitespace, and returns true when the queue is newly added or already
/// registered (idempotent behavior).
/// </summary>
/// <param name="queueName">The name of the queue to register.</param>
/// <returns>A <see cref="Task{Boolean}"/> that resolves to true when the queue is successfully
/// registered (either newly added or already present), or false when <paramref name="queueName"/>
/// is null, empty, or whitespace.</returns>
/// <!-- aidoc:v1 sig=980f114 body=a6676db -->
public Task<bool> CreateQueue(string queueName)
{
if (string.IsNullOrWhiteSpace(queueName))
@@ -31,6 +31,20 @@ public class ReceiverService
private IBus? _bus;
/// <summary>
/// Initializes a new instance of <see cref="ReceiverService"/> by assigning the injected domain services, RabbitMQ settings and logger to backing fields. When <see cref="RabbitMqSettings.ConnectionString"/> is non-empty, it invokes <see cref="ReceiverService.SetQueues"/> and <see cref="ReceiverService.TryToConnect"/>; otherwise it logs an error.
/// </summary>
/// <param name="observationService">The observation service exposed by the receiver.</param>
/// <param name="treatmentService">The treatment service exposed by the receiver.</param>
/// <param name="patientsService">The patient service exposed by the receiver.</param>
/// <param name="pumpService">The pump service exposed by the receiver.</param>
/// <param name="recordingAlertService">The recording alert service exposed by the receiver.</param>
/// <param name="recordingService">The recording service exposed by the receiver.</param>
/// <param name="appointmentService">The appointment service exposed by the receiver.</param>
/// <param name="alarmService">The alarm service exposed by the receiver.</param>
/// <param name="settings">The <see cref="IOptions{TOptions}"/> wrapper providing the <see cref="RabbitMqSettings"/> configuration.</param>
/// <param name="logger">The <see cref="ILogger{TCategoryName}"/> used for diagnostic logging.</param>
/// <!-- aidoc:v1 sig=fcc45e1 body=ab58f48 -->
public ReceiverService(
IObservationService observationService,
ITreatmentService treatmentService,
@@ -139,6 +153,11 @@ public class ReceiverService
}
}
/// <summary>
/// Registers an asynchronous consumer for the specified <paramref name="queue"/> that receives messages, resolves the mapped service, and dispatches the payload for parsing and processing. When no service is mapped for the queue, the message is skipped with a warning; otherwise processing errors are logged and rethrown to enable the retry mechanism.
/// </summary>
/// <param name="queue">The name of the queue whose incoming messages will be consumed.</param>
/// <!-- aidoc:v1 sig=db55582 body=6d1e9a6 -->
private void RegisterConsumer(string queue)
{
_bus!.SendReceive.ReceiveAsync<string>(queue, async payload =>
@@ -41,6 +41,15 @@ public class RelayService : IRelayService
private readonly string _url;
private UriBuilder? _builder;
/// <summary>
/// Initializes a new instance of the <see cref="RelayService"/>, storing its logging, HTTP, configuration, point-of-care, and repository dependencies, resolving the relay endpoint from configuration, and asynchronously invoking <see cref="RelayService.InitRelayWithStatus"/>.
/// </summary>
/// <param name="logger">The <see cref="ILogger{RelayService}"/> used to record diagnostic and operational messages.</param>
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/> used to create HTTP clients for outbound calls.</param>
/// <param name="relaySettings">The <see cref="IOptions{RelaySettings}"/> providing the relay configuration, including the <see cref="RelaySettings.RecordingOrApiUrl"/> used to compute the relay endpoint.</param>
/// <param name="pointOfCareService">The <see cref="IPointOfCareService"/> used to interact with point-of-care data.</param>
/// <param name="relayRepository">The <see cref="IRelayRepository"/> used to persist and retrieve relay state.</param>
/// <!-- aidoc:v1 sig=6febd55 body=1386dc6 -->
public RelayService(
ILogger<RelayService> logger,
IHttpClientFactory httpClientFactory,
@@ -277,6 +286,12 @@ public class RelayService : IRelayService
return _relayRepository.GetRelayByTypeInList(configurationRelayList, type);
}
/// <summary>
/// Retrieves a paginated list of <see cref="Relay"/> entities, optionally filtered by whether each relay is currently in use by the point of care service.
/// </summary>
/// <param name="filter">The <see cref="PaginationFilter"/> containing paging parameters and optional filter criteria, including the <see cref="FilteredRequest.InUse"/> flag.</param>
/// <returns>A <see cref="Task"/> containing a <see cref="PaginationResponse{T}"/> of <see cref="Relay"/> with the requested page data, the current page number, page size, and total document count.</returns>
/// <!-- aidoc:v1 sig=54c231c body=89d28fb -->
public async Task<PaginationResponse<Relay>> GetPaginatedRelays(PaginationFilter filter)
{
var usedRelayIds = await _pointOfCareService.FindAllIdRelaysInUse();
@@ -343,6 +358,11 @@ public class RelayService : IRelayService
public event EventHandler<Tuple<RelayDevice, int>>? RelayStatusChanged;
/// <summary>
/// Asynchronously initializes the in-memory relay status cache by iterating the point-of-care configurations returned by the service and querying the status of each configured relay.
/// Configurations whose <c>RelayList</c> is null are skipped, and only relays flagged with the cache option have their status stored in the <c>_relayWithStatus</c> dictionary keyed by IP, port, and relay number; per-relay and overall failures are logged instead of being rethrown.
/// </summary>
/// <!-- aidoc:v1 sig=036fb02 body=082292a -->
private async Task InitRelayWithStatus()
{
try
@@ -9,6 +9,12 @@ using System.Diagnostics;
namespace adas_core.Infrastructure.Services;
/// <summary>
/// Implements <see cref="ISendAlertService"/> to publish alert messages to a RabbitMQ
/// broker, using the configuration provided by <see cref="IOptions{RabbitMqSettings}"/>
/// and the logging facility provided by <see cref="ILogger{SendAlertService}"/>.
/// </summary>
/// <!-- aidoc:v1 sig=e283346 -->
public class SendAlertService(
IOptions<RabbitMqSettings> rabbitMqSettings,
ILogger<SendAlertService> logger)