=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===

This commit is contained in:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -52,6 +52,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="pointOfCare">The point of care to be inserted; its <c>UnitId</c> is validated against the existing unit and reassigned to the resolved unit's identifier.</param>
/// <returns>A task that resolves to the newly inserted <see cref="PointOfCare"/>, or <c>null</c> when the referenced unit is not found or the operation fails.</returns>
/// <!-- aidoc:v1 sig=bca0a55 body=8473996 -->
public async Task<PointOfCare?> InsertPointOfCare(PointOfCare pointOfCare)
{
try
@@ -81,6 +82,7 @@ public class PointOfCareService(
/// The deletion is skipped if the record cannot be found or if it is linked to an admission.
/// </summary>
/// <param name="id">The unique identifier of the Point of Care record to delete.</param>
/// <!-- aidoc:v1 sig=3de1ad6 body=b092e75 -->
public async Task Delete(ObjectId id)
{
var poc = await FindById(id);
@@ -98,6 +100,7 @@ public class PointOfCareService(
/// Deletes all Points of Care associated with the specified unit identifier and removes the corresponding cached entries.
/// </summary>
/// <param name="unitId">The identifier of the unit whose Points of Care records will be removed.</param>
/// <!-- aidoc:v1 sig=0ae7fa6 body=e4e0ee7 -->
public async Task DeletePoCsByUnitId(ObjectId unitId)
{
await pointOfCareRepository.DeleteManyByUnitId(unitId);
@@ -110,6 +113,7 @@ public class PointOfCareService(
/// Asynchronously retrieves the set of camera identifiers that are currently in use by delegating to the point of care repository.
/// </summary>
/// <returns>A task that represents the asynchronous operation, containing a <see cref="HashSet{ObjectId}"/> of camera identifiers in use.</returns>
/// <!-- aidoc:v1 sig=f6346fe body=f9c2e26 -->
public async Task<HashSet<ObjectId>> FindAllIdCamerasInUse()
{
return await pointOfCareRepository.FindAllIdCamerasInUse();
@@ -118,6 +122,7 @@ public class PointOfCareService(
/// Asynchronously retrieves the set of all ID relay identifiers currently in use by delegating to the point of care repository.
/// </summary>
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="HashSet{T}"/> of <see cref="ObjectId"/> values representing the ID relays that are in use.</returns>
/// <!-- aidoc:v1 sig=7d4add8 body=33e52a4 -->
public async Task<HashSet<ObjectId>> FindAllIdRelaysInUse()
{
return await pointOfCareRepository.FindAllIdRelaysInUse();
@@ -126,6 +131,7 @@ public class PointOfCareService(
/// Asynchronously retrieves the set of beacon identifiers that are currently in use from the point of care repository.
/// </summary>
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="HashSet{ObjectId}"/> with the identifiers of all beacons in use.</returns>
/// <!-- aidoc:v1 sig=7e41dd8 body=03369a7 -->
public async Task<HashSet<ObjectId>> FindAllIdBeaconsInUse()
{
return await pointOfCareRepository.FindAllIdBeaconsInUse();
@@ -137,6 +143,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="unitId">The unique identifier of the unit whose points of care are being queried.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="PointOfCare"/> with their devices, or an empty collection if the repository returns no results.</returns>
/// <!-- aidoc:v1 sig=74ce5ed body=1883f5a -->
public async Task<IEnumerable<PointOfCare>?> FindAllByUnitIdWithDevices(ObjectId unitId)
{
var result = await pointOfCareRepository.FindAllByUnitIdWithDevices(unitId);
@@ -151,6 +158,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="pointOfCare">The point of care entity containing the updated information to persist.</param>
/// <returns>The updated <see cref="PointOfCare"/>, or <c>null</c> if the record was not found after the update.</returns>
/// <!-- aidoc:v1 sig=686be32 body=fcf3e9a -->
public async Task<PointOfCare?> Update(PointOfCare pointOfCare)
{
var oldPoc = await pointOfCareRepository.FindById(pointOfCare.Id);
@@ -169,6 +177,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="id">The identifier of the point of care to update.</param>
/// <param name="unit">The unit to assign to the point of care.</param>
/// <!-- aidoc:v1 sig=bd40218 body=687d0e1 -->
public async Task UpdateUnit(ObjectId id, Unit unit)
{
var poc = await FindById(id);
@@ -187,6 +196,7 @@ public class PointOfCareService(
/// Asynchronously retrieves all points of care from the repository, returning an empty list when the repository yields a null result.
/// </summary>
/// <returns>A task representing the asynchronous operation, containing the list of points of care, or an empty list if none are available.</returns>
/// <!-- aidoc:v1 sig=c48e6dc body=e5d1056 -->
public async Task<List<PointOfCare>> GetAll()
{
var c = await pointOfCareRepository.GetAll();
@@ -198,6 +208,7 @@ public class PointOfCareService(
/// Returns an empty list if the repository result is null.
/// </summary>
/// <returns>A list of PointOfCare configurations, or an empty list when no configurations are available.</returns>
/// <!-- aidoc:v1 sig=cb7ad06 body=64bfd0c -->
public async Task<List<PointOfCare>> GetAllConfigs()
{
var c = await pointOfCareRepository.GetAllConfigs();
@@ -209,6 +220,7 @@ public class PointOfCareService(
/// Returns an empty list when the repository yields no results, ensuring callers never receive a null collection.
/// </summary>
/// <returns>A task that resolves to a list of <see cref="PointOfCare"/> entries, or an empty list if no locations are found.</returns>
/// <!-- aidoc:v1 sig=7c1c627 body=b5ec7ac -->
public async Task<List<PointOfCare>> GetAllLocationInfo()
{
var c = await pointOfCareRepository.GetAllLocationInfo();
@@ -221,6 +233,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="filter">The pagination filter containing the page number and page size used to compute the skip offset and limit the number of returned items.</param>
/// <returns>A <see cref="PaginationResponse{PointOfCare}"/> containing the requested page of points of care, the current page number, page size, and the total document count.</returns>
/// <!-- aidoc:v1 sig=e44c6c3 body=1f1be82 -->
public async Task<PaginationResponse<PointOfCare>> GetPaginatedPoCs(PaginationFilter filter)
{
var result = pointOfCareRepository.GetPaginatedPoCs(filter);
@@ -241,6 +254,7 @@ public class PointOfCareService(
/// <param name="configuration">The new configuration values to persist.</param>
/// <returns>A task that represents the asynchronous update operation.</returns>
/// <exception cref="ConflictException">Thrown when no existing Point of Care configuration is found for the specified identifier.</exception>
/// <!-- aidoc:v1 sig=1874ae4 body=04cf29d -->
public async Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration)
{
var old = await pointOfCareRepository.GetPoCConfiguration(id) ??
@@ -258,6 +272,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="id">The unique identifier of the point of care to retrieve.</param>
/// <returns>The matching <see cref="PointOfCare"/> with all configurations, or <c>null</c> if no point of care is found.</returns>
/// <!-- aidoc:v1 sig=2826028 body=4c3b92d -->
public async Task<PointOfCare?> FindById(ObjectId id)
{
return await pointOfCareRepository.FindByIdAllConfig(id);
@@ -267,6 +282,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="id">The unique identifier of the point of care to retrieve.</param>
/// <returns>The matching <see cref="PointOfCare"/> with all configuration when found; otherwise, <c>null</c>.</returns>
/// <!-- aidoc:v1 sig=3a998f5 body=4c3b92d -->
public async Task<PointOfCare?> FindByIdAllConfig(ObjectId id)
{
return await pointOfCareRepository.FindByIdAllConfig(id);
@@ -278,6 +294,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="unit">The unique identifier of the unit whose points of care should be retrieved.</param>
/// <returns>A task that represents the asynchronous operation, containing a collection of points of care for the given unit, or an empty collection if none are found.</returns>
/// <!-- aidoc:v1 sig=1265646 body=83d400d -->
public async Task<IEnumerable<PointOfCare>?> FindAllByUnitId(ObjectId unit)
{
var result = await pointOfCareRepository.FindAllByUnitId(unit);
@@ -292,6 +309,7 @@ public class PointOfCareService(
/// <param name="poc">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 the collection of points of care matching the specified unit and status.</returns>
/// <!-- aidoc:v1 sig=6b7e346 body=a9f878c -->
public async Task<IEnumerable<PointOfCare>> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare poc,
bool excludeVirtual = false)
{
@@ -302,6 +320,7 @@ public class PointOfCareService(
/// Check nex admission when patient has exit from poc
/// </summary>
/// <param name="patientLocation">PoC id</param>
/// <!-- aidoc:v1 sig=825e453 body=dc756f7 -->
public async void CheckNextAdmission(ObjectId? patientLocation)
{
try
@@ -347,6 +366,7 @@ public class PointOfCareService(
/// <param name="bed">The bed identifier used to locate the point of care.</param>
/// <param name="unitId">The unit identifier; when <c>null</c>, the method short-circuits and returns <c>null</c>.</param>
/// <returns>A <see cref="Task{T}"/> containing the matching <see cref="PointOfCare"/>, or <c>null</c> if no input is valid or no record is found.</returns>
/// <!-- aidoc:v1 sig=f5e0229 body=ecc3ffd -->
public async Task<PointOfCare?> FindByBedAndUnitId(string? bed, ObjectId? unitId)
{
if (unitId == null || string.IsNullOrEmpty(bed)) return null;
@@ -358,6 +378,7 @@ public class PointOfCareService(
/// The update, cache invalidation, and audit logging are only performed when <see cref="PointOfCare.Configuration"/> and its <c>RelayIdList</c> are not null.
/// </summary>
/// <param name="poc">The Point of Care whose relay configuration will be updated.</param>
/// <!-- aidoc:v1 sig=5d59b5d body=b7b7775 -->
public async Task UpdateRelayConfig(PointOfCare poc)
{
var oldPoc = await pointOfCareRepository.GetPoCConfiguration(poc.Id);
@@ -374,6 +395,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="room">The room identifier used to look up matching points of care.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{PointOfCare}"/> of points of care for the given room, or <c>null</c> if no matching points of care are found.</returns>
/// <!-- aidoc:v1 sig=d9b8bd7 body=a7c7ece -->
public async Task<IEnumerable<PointOfCare>?> FindByRoom(string room)
{
return await pointOfCareRepository.FindByRoom(room);
@@ -384,6 +406,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="bed">The bed identifier used to look up the associated points of care.</param>
/// <returns>A task that returns an <see cref="IEnumerable{PointOfCare}"/> of points of care linked to the given bed, or <c>null</c> if no points of care are found.</returns>
/// <!-- aidoc:v1 sig=27196b1 body=71b820c -->
public async Task<IEnumerable<PointOfCare>?> FindByBed(string bed)
{
return await pointOfCareRepository.FindByBed(bed);
@@ -394,6 +417,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="unitIds">The list of unit identifiers used to filter the points of care.</param>
/// <returns>A task that represents the asynchronous operation, containing the list of matching points of care.</returns>
/// <!-- aidoc:v1 sig=17b231e body=a6cc8e1 -->
public async Task<List<PointOfCare>> FindAllByUnitIds(List<ObjectId> unitIds)
{
var filter = Builders<PointOfCare>.Filter.In(p => p.UnitId, unitIds);
@@ -407,6 +431,7 @@ public class PointOfCareService(
/// <param name="id">The identifier of the point of care to retrieve.</param>
/// <param name="fillPatientData">If <c>true</c>, loads and attaches the related patient and admission (when an admission id is present) to the returned point of care.</param>
/// <returns>A task that yields the <see cref="PointOfCare"/> with resolved related data, or <c>null</c> if no point of care is found for the given id.</returns>
/// <!-- aidoc:v1 sig=0a64187 body=c5c8930 -->
public async Task<PointOfCare?> GetInfo(ObjectId id, bool fillPatientData = true)
{
var poc = await FindById(id);
@@ -446,6 +471,7 @@ public class PointOfCareService(
/// <param name="fillPatientData">When <c>true</c>, enriches the result with unit, patient, and admission data; when <c>false</c>, returns the point of care as-is.</param>
/// <param name="ct">Token used to cancel the asynchronous operation.</param>
/// <returns>The retrieved and optionally enriched <see cref="PointOfCare"/>, or <c>null</c> if no point of care is found for the given identifier.</returns>
/// <!-- aidoc:v1 sig=90b64a6 body=60870a4 -->
public async Task<PointOfCare?> GetInfo(ObjectId id, LocaleEnum? locale, bool fillPatientData = true,
CancellationToken ct = default)
{
@@ -487,6 +513,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="patientId">The unique identifier of the patient whose Point of Care is being requested.</param>
/// <returns>The <see cref="PointOfCare"/> associated with the patient if one is assigned; otherwise, <c>null</c>.</returns>
/// <!-- aidoc:v1 sig=efa0335 body=a99a4ec -->
public async Task<PointOfCare?> FindPoCByPatientId(ObjectId patientId)
{
var patient = await patientService.Value.FindById(patientId);
@@ -501,6 +528,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="patientNumber">The unique patient number used to look up the patient.</param>
/// <returns>A task that represents the asynchronous operation, containing the associated <see cref="PointOfCare"/> if found; otherwise, null.</returns>
/// <!-- aidoc:v1 sig=f14442d body=02a6db9 -->
public async Task<PointOfCare?> FindPoCByPatientNumber(string patientNumber)
{
var patient = await patientService.Value.FindByPatientNumber(patientNumber);
@@ -514,6 +542,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="unitId">The unique identifier of the unit whose PoCs should be counted.</param>
/// <returns>A task representing the asynchronous operation, containing the total number of PoCs linked to the given unit.</returns>
/// <!-- aidoc:v1 sig=5433677 body=692ab9e -->
public async Task<long> CountPoCsByUnitId(ObjectId unitId)
{
return await pointOfCareRepository.CountByUnitId(unitId);
@@ -524,6 +553,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="unitId">The unique identifier of the unit whose virtual PoCs are being counted.</param>
/// <returns>A <see cref="Task{long}"/> representing the asynchronous operation, containing the total number of virtual PoCs linked to the given unit.</returns>
/// <!-- aidoc:v1 sig=62cdca4 body=a5dd4e4 -->
public async Task<long> CountVirtualPoCsByUnitId(ObjectId unitId)
{
return await pointOfCareRepository.CountVirtualsByUnitId(unitId);
@@ -537,6 +567,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="id">The unique identifier of the point of care whose status should be updated.</param>
/// <param name="status">The new point of care status to apply.</param>
/// <!-- aidoc:v1 sig=8b769d6 body=e16609b -->
public async Task SetPointOfCareStatus(ObjectId id, StatusEnum.PointOfCare status)
{
var pointOfCare = await GetInfo(id, null);
@@ -562,6 +593,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="patientLocation">The patient location used to look up the associated Point of Care.</param>
/// <returns>A task that yields the matching <see cref="PointOfCare"/>, or <c>null</c> if no Point of Care is found for the given location.</returns>
/// <!-- aidoc:v1 sig=81e2a50 body=1670341 -->
public async Task<PointOfCare?> FindPoCByPatientLocation(PatientLocation patientLocation)
{
return await pointOfCareRepository.FindByPatientLocation(patientLocation);
@@ -573,6 +605,7 @@ public class PointOfCareService(
/// </summary>
/// <param name="pointOfCare">The point of care whose related subscribers should receive the notification. Its <c>Id</c> is used to match subscriber location identifiers.</param>
/// <param name="operation">The type of operation (e.g., create, update, delete) being broadcast, sent as the message payload.</param>
/// <!-- aidoc:v1 sig=6782e58 body=7d10a0d -->
private void SendPointOfCareBroadcast(PointOfCare pointOfCare, OperationType operation)
{
try