=== 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:
@@ -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);
|
||||
}
|
||||
@@ -13,12 +13,14 @@ public interface IAdminPanelService
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the unit was successfully deleted; otherwise, <c>false</c> if the unit was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=3dcac9a -->
|
||||
Task<bool> DeleteUnitById(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Inserts a new <see cref="Unit"/> into the data store and returns the inserted entity.
|
||||
/// </summary>
|
||||
/// <param name="unit">The <see cref="Unit"/> to insert.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the inserted <see cref="Unit"/>, or <see langword="null"/> if the insert could not be completed.</returns>
|
||||
/// <!-- aidoc:v1 sig=9d5e322 -->
|
||||
Task<Unit?> InsertUnit(Unit unit);
|
||||
|
||||
#region Patient
|
||||
@@ -28,18 +30,21 @@ public interface IAdminPanelService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The admin panel request containing the data needed to create the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the created <see cref="Patient"/>, or <c>null</c> if no patient was created.</returns>
|
||||
/// <!-- aidoc:v1 sig=9a79f3c -->
|
||||
Task<Patient?> CreatePatient(AdmPanelRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the patient associated with the specified location.
|
||||
/// </summary>
|
||||
/// <param name="location">The location used to look up the associated patient.</param>
|
||||
/// <returns>A task that resolves to the <see cref="Patient"/> found at the given location, or <c>null</c> if no patient is associated with that location.</returns>
|
||||
/// <!-- aidoc:v1 sig=bfbcfb4 -->
|
||||
Task<Patient?> FindPatientByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Patient"/> by their unique patient number.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique identifier of the patient to look up.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="Patient"/>, or <c>null</c> if no patient is found with the specified number.</returns>
|
||||
/// <!-- aidoc:v1 sig=088434b -->
|
||||
Task<Patient?> FindPatientByPatientNumber(string patientNumber);
|
||||
|
||||
/// <summary>
|
||||
@@ -48,6 +53,7 @@ public interface IAdminPanelService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the patient if found; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=0210ac7 -->
|
||||
Task<Patient?> FindPatientById(ObjectId id);
|
||||
|
||||
//List<person> FindAllPatient();
|
||||
@@ -57,6 +63,7 @@ public interface IAdminPanelService
|
||||
/// </summary>
|
||||
/// <param name="request">The admission panel request containing the search criteria used to locate the patient.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="Patient"/> if found, or <c>null</c> otherwise.</returns>
|
||||
/// <!-- aidoc:v1 sig=c3d3d62 -->
|
||||
Task<Patient?> FindPatient(AdmPanelRequest request);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the dependency information DTO for the specified <paramref name="unit"/>.
|
||||
@@ -64,6 +71,7 @@ public interface IAdminPanelService
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit for which to retrieve dependency information.</param>
|
||||
/// <returns>A <see cref="Task{UnitInfoDto}"/> that yields the unit dependency DTO, or <c>null</c> if none is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4a1eecb -->
|
||||
Task<UnitInfoDto?> GetUnitDependencyDto(Unit unit);
|
||||
|
||||
/// <summary>
|
||||
@@ -71,6 +79,7 @@ public interface IAdminPanelService
|
||||
/// </summary>
|
||||
/// <param name="request">The admission panel request containing the patient location details to update.</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>
|
||||
/// <!-- aidoc:v1 sig=82018b5 -->
|
||||
Task<bool> UpdatePatientLocation(AdmPanelRequest request);
|
||||
/// <summary>
|
||||
/// Updates the patient data based on the provided admission panel request, using the existing patient record as a reference.
|
||||
@@ -78,12 +87,14 @@ public interface IAdminPanelService
|
||||
/// <param name="request">The admission panel request containing the updated patient data.</param>
|
||||
/// <param name="oldPatient">The existing patient record to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the patient data was successfully updated; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=72c8ec4 -->
|
||||
Task<bool> UpdatePatientData(AdmPanelRequest request, Patient oldPatient);
|
||||
/// <summary>
|
||||
/// Archives the specified patient, marking them as inactive while preserving their record.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be archived.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the patient was successfully archived; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=9285b16 -->
|
||||
Task<bool> ArchivePatient(Patient patient);
|
||||
|
||||
#endregion
|
||||
@@ -94,18 +105,21 @@ public interface IAdminPanelService
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The observation data used to create the configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous create operation, containing a value indicating whether the configuration was created successfully.</returns>
|
||||
/// <!-- aidoc:v1 sig=067bf2d -->
|
||||
Task<bool> CreateConfig(ConfigObservation configObservation);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the configuration based on the provided <see cref="ConfigObservation"/>, applying any required changes derived from the observation data.
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The observation data used to determine and apply configuration updates.</param>
|
||||
/// <returns>A <see cref="Task{Boolean}"/> that represents the asynchronous update operation, containing a value indicating whether the configuration was successfully updated.</returns>
|
||||
/// <!-- aidoc:v1 sig=e4c099d -->
|
||||
Task<bool> UpdateConfig(ConfigObservation configObservation);
|
||||
/// <summary>
|
||||
/// Deletes the configuration observation item identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation item to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the item was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=e7902ac -->
|
||||
Task<bool> DeleteConfigObservationItem(ObjectId id);
|
||||
|
||||
#endregion
|
||||
@@ -118,24 +132,28 @@ public interface IAdminPanelService
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique <see cref="ObjectId"/> 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 not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a87fd1e -->
|
||||
Task<Medicine?> GetMedicineById(ObjectId medicineId);
|
||||
/// <summary>
|
||||
/// Asynchronously creates and persists a new medicine record.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity to be created and posted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the newly created <see cref="Medicine"/>, or <c>null</c> if the operation fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=9decc93 -->
|
||||
Task<Medicine?> PostMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Updates an existing medicine record in the system.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity containing the updated information to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Medicine"/> if found, or <c>null</c> if the medicine does not exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=2ae8490 -->
|
||||
Task<Medicine?> UpdateMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Deletes a medicine identified by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique identifier of the medicine to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the medicine was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=fe8649a -->
|
||||
Task<bool> DeleteMedicineById(string medicineId);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -14,21 +14,25 @@ public interface IAdmissionService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="admissionId">The unique identifier of the admission to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Admission"/> if found, or <c>null</c> if no admission matches the specified identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=11f3852 -->
|
||||
Task<Admission?> GetAdmissionByIdAsync(ObjectId admissionId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes an admission record identified by the specified admission ID.
|
||||
/// </summary>
|
||||
/// <param name="admissionId">The unique identifier of the admission to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=33e47dc -->
|
||||
Task DeleteAdmissionByIdAsync(ObjectId admissionId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the specified admission record.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity to remove.</param>
|
||||
/// <!-- aidoc:v1 sig=f6c9117 -->
|
||||
Task DeleteAdmissionAsync(Admission admission);
|
||||
/// <summary>
|
||||
/// Deletes all admissions associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose admissions will be deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=94c7556 -->
|
||||
Task DeleteAdmissionsByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
@@ -36,46 +40,54 @@ public interface IAdmissionService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity containing the updated data to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=4327caa -->
|
||||
Task UpdateAdmissionAsync(Admission admission);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of admissions.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of <see cref="Admission"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=a1ad970 -->
|
||||
Task<IEnumerable<Admission>> GetAdmissionsAsync();
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new admission record and returns the created entry, or <see langword="null"/> if the insertion was not performed.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity to be inserted into the data store.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the inserted <see cref="Admission"/>, or <see langword="null"/> when no record is produced.</returns>
|
||||
/// <!-- aidoc:v1 sig=d13b5c5 -->
|
||||
Task<Admission?> InsertAdmission(Admission admission);
|
||||
/// <summary>
|
||||
/// Admits a patient based on the provided admission details, optionally registering the patient as new.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission information used to process the patient admission.</param>
|
||||
/// <param name="isNew">Indicates whether the patient is being admitted for the first time. Defaults to <c>false</c>.</param>
|
||||
/// <!-- aidoc:v1 sig=9f57e3f -->
|
||||
Task AdmitPatient(Admission admission, bool isNew = false);
|
||||
/// <summary>
|
||||
/// Processes the return of a patient to the admissions workflow, typically used when a patient needs to be re-queued or reinstated for admission processing.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to be returned to admissions.</param>
|
||||
/// <!-- aidoc:v1 sig=4258668 -->
|
||||
Task ReturnPatientToAdmissions(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously returns a patient to the admissions workflow using the specified admission record.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient being returned to admissions.</param>
|
||||
/// <param name="adm">The admission record associated with the patient being returned.</param>
|
||||
/// <!-- aidoc:v1 sig=d4a135f -->
|
||||
Task ReturnPatientToAdmissions(ObjectId patientId, Admission adm);
|
||||
/// <summary>
|
||||
/// Retrieves a list of admissions associated with the specified patient location.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter the admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of admissions for the given location.</returns>
|
||||
/// <!-- aidoc:v1 sig=b81f02e -->
|
||||
Task<List<Admission>> GetAdmissionByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of admissions associated with the specified point of care identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the point of care used to filter the admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Admission"/> objects matching the specified point of care id, or an empty list if no admissions are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=dc63c5a -->
|
||||
Task<List<Admission>> GetAdmissionByPointOfCareId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the list of admissions associated with the specified point of care, localized for the given locale.
|
||||
@@ -83,18 +95,21 @@ public interface IAdmissionService : IApiRequestService
|
||||
/// <param name="pocId">The identifier of the point of care whose admissions are being queried.</param>
|
||||
/// <param name="locale">The locale used to localize the returned admission data.</param>
|
||||
/// <returns>A task that resolves to the list of admissions matching the point of care and locale; an empty list when no matches are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=9479688 -->
|
||||
Task<List<Admission>> GetAdmissionByPointOfCareIdAndLocale(ObjectId pocId, LocaleEnum locale);
|
||||
/// <summary>
|
||||
/// Retrieves a list of admissions associated with the specified unit identifier, excluding any Point of Care (PoC) related admissions.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose admissions should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of admissions for the specified unit, excluding PoC admissions.</returns>
|
||||
/// <!-- aidoc:v1 sig=609220d -->
|
||||
Task<List<Admission>> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of admissions associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The MongoDB ObjectId of the unit whose admissions should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total count of admissions for the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=d273b51 -->
|
||||
Task<long> CountAdmissionsByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
@@ -103,12 +118,14 @@ public interface IAdmissionService : IApiRequestService
|
||||
/// <param name="patientNumber">The patient number used to identify the patient.</param>
|
||||
/// <param name="unitId">The identifier of the unit in which the patient is being searched.</param>
|
||||
/// <returns>A task that returns the matching <see cref="PatientSearch"/> if found; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=3a4d9fd -->
|
||||
Task<PatientSearch?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves the admission record associated with the specified patient number, returning <c>null</c> when no matching admission is found.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient 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 exists for the given patient number.</returns>
|
||||
/// <!-- aidoc:v1 sig=c602701 -->
|
||||
Task<Admission?> GetAdmissionByPatientNumber(string patientNumber);
|
||||
|
||||
/// <summary>
|
||||
@@ -118,6 +135,7 @@ public interface IAdmissionService : IApiRequestService
|
||||
/// <param name="unitList">The collection of units associated with the master list item change.</param>
|
||||
/// <param name="typeName">The name of the type used to identify the master list item category.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=6d7dd8e -->
|
||||
Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes a patient master list item identified by the specified options, units, and type name.
|
||||
@@ -125,5 +143,6 @@ public interface IAdmissionService : IApiRequestService
|
||||
/// <param name="opt">The option list used to identify the master list item to delete.</param>
|
||||
/// <param name="unitList">The collection of units associated with the master list item.</param>
|
||||
/// <param name="typeName">The name of the type associated with the master list item.</param>
|
||||
/// <!-- aidoc:v1 sig=bbc71d1 -->
|
||||
Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ public interface IAlarmService : IApiRequestService
|
||||
/// <param name="patientId">The identifier of the patient whose last observations should be retrieved.</param>
|
||||
/// <param name="filterObservations">An optional list of fields to restrict the returned observations; when null, no field filter is applied.</param>
|
||||
/// <returns>A task that resolves to the list of the patient's most recent <see cref="PatientObservationAlarm"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=db70ab6 -->
|
||||
public Task<List<PatientObservationAlarm>> FindLastObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations = null);
|
||||
|
||||
@@ -24,6 +25,7 @@ public interface IAlarmService : IApiRequestService
|
||||
/// <param name="dataAlarmfields">The list of fields used to identify and filter the patient observation alarm data.</param>
|
||||
/// <param name="configAlarm">The list of configuration observations that define the alarm criteria, including expiration rules.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of the latest non-expired <see cref="PatientObservationAlarm"/> entries for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=cee772b -->
|
||||
Task<List<PatientObservationAlarm>> FindLastValuesNotExpired(ObjectId patientId, List<Field> dataAlarmfields,
|
||||
List<ConfigObservation> configAlarm);
|
||||
|
||||
@@ -33,12 +35,14 @@ public interface IAlarmService : IApiRequestService
|
||||
/// <param name="obs">The patient observation alarm to be mapped.</param>
|
||||
/// <param name="onlyByName">When true, limits the mapping to lookups performed by name only.</param>
|
||||
/// <returns>A task that resolves to the mapped patient observation alarm, or null if no corresponding alarm is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a6ed4ac -->
|
||||
public Task<PatientObservationAlarm?> MapObservation(PatientObservationAlarm obs, bool onlyByName = false);
|
||||
/// <summary>
|
||||
/// Maps the given patient observation alarm to a corresponding record by name, returning a null result when no matching observation is found.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation alarm to be mapped by name.</param>
|
||||
/// <returns>A task containing the mapped <see cref="PatientObservationAlarm"/>, or <c>null</c> if no matching observation exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=bc68e0c -->
|
||||
public Task<PatientObservationAlarm?> MapObservationsByName(PatientObservationAlarm obs);
|
||||
|
||||
/// <summary>
|
||||
@@ -46,6 +50,7 @@ public interface IAlarmService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="source">The base patient observation value used as input for the alarm evaluation.</param>
|
||||
/// <param name="name">The name that identifies the alarm test to be calculated.</param>
|
||||
/// <!-- aidoc:v1 sig=6689f69 -->
|
||||
Task CalculateAlarmTest(BasePatientObservationValue source, string name);
|
||||
|
||||
/// <summary>
|
||||
@@ -57,6 +62,7 @@ public interface IAlarmService : IApiRequestService
|
||||
/// <param name="severity">The severity level assigned to the alarm.</param>
|
||||
/// <param name="type">The type category of the alarm.</param>
|
||||
/// <returns>A task that represents the asynchronous alarm sending operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=1e4624b -->
|
||||
Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code, AlarmEnum.Severity severity,
|
||||
AlarmEnum.Type type);
|
||||
|
||||
@@ -64,6 +70,7 @@ public interface IAlarmService : IApiRequestService
|
||||
/// Asynchronously checks the observation alarm for the specified patient observation.
|
||||
/// </summary>
|
||||
/// <param name="obs4">The patient observation to evaluate for alarm conditions.</param>
|
||||
/// <!-- aidoc:v1 sig=db0bd32 -->
|
||||
Task CheckObservationAlarm(PatientObservation obs4);
|
||||
|
||||
/// <summary>
|
||||
@@ -74,6 +81,7 @@ public interface IAlarmService : IApiRequestService
|
||||
/// <param name="patient">The patient to whom the observations and alarms belong.</param>
|
||||
/// <param name="messageTime">The timestamp associated with the message being processed.</param>
|
||||
/// <param name="observationData">Optional additional observation data used during processing.</param>
|
||||
/// <!-- aidoc:v1 sig=b10b184 -->
|
||||
Task ProcessAlarmObservations(List<PatientObservationAlarm> alarmObservations,
|
||||
List<PatientObservation> observations, Patient patient,
|
||||
DateTime messageTime, ObservationData? observationData = null);
|
||||
|
||||
@@ -11,5 +11,6 @@ public interface IAlertValuesService
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier of the configuration observation to look up.</param>
|
||||
/// <returns>A task that yields the matching <see cref="ConfigObservation"/>, or <c>null</c> if no record is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=938830c -->
|
||||
Task<ConfigObservation?> FindByKey(ObjectId key);
|
||||
}
|
||||
@@ -12,12 +12,14 @@ public interface IAppointmentService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter and locate the relevant appointments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> items matching the given location.</returns>
|
||||
/// <!-- aidoc:v1 sig=8d1c435 -->
|
||||
Task<List<PatientAppointment>> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Retrieves all appointments associated with the specified patient asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The 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"/> entries for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=44280ba -->
|
||||
Task<List<PatientAppointment>> GetByPatient(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of patient appointments scheduled for today for the specified patient.
|
||||
@@ -25,6 +27,7 @@ public interface IAppointmentService : IApiRequestService
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointments are being queried.</param>
|
||||
/// <param name="ct">A cancellation token to observe while waiting for the task to complete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> entries for the given patient for the current day.</returns>
|
||||
/// <!-- aidoc:v1 sig=4fb06f0 -->
|
||||
Task<List<PatientAppointment>> GetTodayByPatient(ObjectId patientId, CancellationToken ct = default);
|
||||
/// <summary>
|
||||
/// Retrieves the list of patient appointments scheduled for today at the specified point of care.
|
||||
@@ -32,33 +35,39 @@ public interface IAppointmentService : IApiRequestService
|
||||
/// <param name="pocId">The identifier of the point of care whose appointments will be returned.</param>
|
||||
/// <param name="ct">The cancellation token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of today's patient appointments for the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=b1e7397 -->
|
||||
Task<List<PatientAppointment>> GetTodayByPoc(ObjectId pocId, CancellationToken ct = default);
|
||||
/// <summary>
|
||||
/// Asynchronously finds all <see cref="PatientAppointment"/> records associated with the specified patient identifier.
|
||||
/// </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 an <see cref="IAsyncCursor{TDocument}"/> for iterating over the matching <see cref="PatientAppointment"/> documents.</returns>
|
||||
/// <!-- aidoc:v1 sig=2d5cd9f -->
|
||||
Task<IAsyncCursor<PatientAppointment>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the specified patient, marking the record as archived in the system.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose record should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=52c2373 -->
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously archives records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the patient whose related records should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=e5916ec -->
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Deletes a record associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the patient whose related record should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=d457cb9 -->
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Processes an incoming API request in the context of the specified patient, handling the required business logic and returning when the processing completes.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be processed.</param>
|
||||
/// <param name="patient">The patient associated with the API request.</param>
|
||||
/// <!-- aidoc:v1 sig=eae6711 -->
|
||||
Task ProcessApiRequest(ApiRequest apiRequest, Patient patient);
|
||||
/// <summary>
|
||||
/// Updates multiple records by replacing the old <see cref="ObjectId"/> with the new one for the field identified by <paramref name="nameId"/>.
|
||||
@@ -66,5 +75,6 @@ public interface IAppointmentService : IApiRequestService
|
||||
/// <param name="nameId">The name of the field whose <see cref="ObjectId"/> value should be updated.</param>
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to set on matching records.</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);
|
||||
}
|
||||
@@ -10,24 +10,28 @@ public interface IArchivePatientCarePlanService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose care plans are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="PatientCarePlan"/> objects if found, or <c>null</c> if no care plans exist for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=e64875e -->
|
||||
Task<List<PatientCarePlan>?> FindByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the list of care plans associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose care plans should be retrieved.</param>
|
||||
/// <returns>A task that returns a list of <see cref="PatientCarePlan"/> records for the patient, or <c>null</c> if no care plans are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=2001a29 -->
|
||||
Task<List<PatientCarePlan>?> FindByPatientId(string id);
|
||||
/// <summary>
|
||||
/// Retrieves a list of patient care plans associated with the specified patient number.
|
||||
/// </summary>
|
||||
/// <param name="id">The patient number used to locate the associated care plans.</param>
|
||||
/// <returns>A task that returns a list of <see cref="PatientCarePlan"/> for the given patient number, or <c>null</c> if no care plans are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=da83156 -->
|
||||
Task<List<PatientCarePlan>?> FindByPatientNumber(string id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient care plans.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=83af170 -->
|
||||
Task<List<PatientCarePlan>> FindAll();
|
||||
|
||||
// Task<PatientCarePlan?> UpdateTreatment(PatientCarePlan patientCarePla, List<OptionList> options);
|
||||
@@ -37,11 +41,13 @@ public interface IArchivePatientCarePlanService
|
||||
/// </summary>
|
||||
/// <param name="patientCarePla">The patient care plan to insert.</param>
|
||||
/// <returns>A <see cref="Task{PatientCarePlan}"/> that represents the asynchronous insert operation, containing the inserted <see cref="PatientCarePlan"/> or null if no entity was returned.</returns>
|
||||
/// <!-- aidoc:v1 sig=a99067e -->
|
||||
Task<PatientCarePlan?> InsertOneAsync(PatientCarePlan patientCarePla);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a collection of patient care plans into the data store in a single bulk operation.
|
||||
/// </summary>
|
||||
/// <param name="patientCarePla">The list of <see cref="PatientCarePlan"/> entities to be inserted.</param>
|
||||
/// <!-- aidoc:v1 sig=fea7cc8 -->
|
||||
Task InsertManyAsync(List<PatientCarePlan> patientCarePla);
|
||||
|
||||
// Task Update(PatientCarePlan oldPatientCarePla, PatientCarePlan newPatientCarePla);
|
||||
|
||||
@@ -10,5 +10,6 @@ public interface IArchivedPatientObservationService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose archived observations are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservation"/> objects representing the archived observations for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=cedb842 -->
|
||||
public Task<List<PatientObservation>> FindArchivedPatientObservationsFromPatient(ObjectId patientId);
|
||||
}
|
||||
@@ -8,5 +8,6 @@ public interface IArchivedPatientService
|
||||
/// Asynchronously retrieves all patients from the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all patients.</returns>
|
||||
/// <!-- aidoc:v1 sig=3685411 -->
|
||||
public Task<List<Patient>> FindAllPatients();
|
||||
}
|
||||
@@ -10,5 +10,6 @@ public interface IArchivedPatientTreatmentService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being retrieved.</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=17e4911 -->
|
||||
Task<List<PatientTreatment>> FindAllPatientTreatmentsByPatient(ObjectId patientId);
|
||||
}
|
||||
@@ -10,34 +10,40 @@ public interface IAuthService
|
||||
/// Asynchronously retrieves the current login response, returning <c>null</c> when no login state is available.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the current <see cref="LoginResponse"/>, or <c>null</c> if no login response exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=17789be -->
|
||||
Task<LoginResponse?> GetLoginResponse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a token.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the retrieved token string.</returns>
|
||||
/// <!-- aidoc:v1 sig=288a8f8 -->
|
||||
Task<string> GetToken();
|
||||
/// <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 queried.</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);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the record identified by the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayId">The display identifier of the record to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a value indicating whether the record was successfully deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=9bea906 -->
|
||||
Task<bool> DeleteByDisplayId(ObjectId displayId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose associated entity should be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a value indicating whether the deletion was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=7032be4 -->
|
||||
Task<bool> DeleteByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of authorizations associated with the specified user identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the user whose authorizations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of authorizations for the user.</returns>
|
||||
/// <!-- aidoc:v1 sig=884297c -->
|
||||
Task<List<Authorization>> GetUserAuthorities(ObjectId id);
|
||||
}
|
||||
@@ -11,12 +11,14 @@ namespace adas_core.Application.Services.Interfaces
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier used to associate the value.</param>
|
||||
/// <param name="value">The value to store for the specified key.</param>
|
||||
/// <!-- aidoc:v1 sig=a3acfbd -->
|
||||
void SetValue(string key, string value);
|
||||
/// <summary>
|
||||
/// Retrieves the string value associated with the specified key.
|
||||
/// </summary>
|
||||
/// <param name="key">The key used to look up the value.</param>
|
||||
/// <returns>The value associated with the key, or <c>null</c> if the key is not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=09e20ab -->
|
||||
string? GetValue(string key);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an object associated with the specified <paramref name="key"/>, returning null if no entry is found.
|
||||
@@ -25,6 +27,7 @@ namespace adas_core.Application.Services.Interfaces
|
||||
/// <param name="key">The unique identifier of the object to retrieve.</param>
|
||||
/// <param name="updateExpiration">Indicates whether the expiration of the entry should be extended when it is successfully retrieved. Defaults to true.</param>
|
||||
/// <returns>A task that represents the asynchronous retrieval operation. The task result contains the object of type <typeparamref name="T"/> associated with the key, or null if no matching entry exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=a85ace8 -->
|
||||
Task<T?> GetObjectAsync<T>(string key, bool updateExpiration = true);
|
||||
/// <summary>
|
||||
/// Asynchronously stores an object of type <typeparamref name="T"/> using the specified key, optionally updating its expiration time.
|
||||
@@ -33,6 +36,7 @@ namespace adas_core.Application.Services.Interfaces
|
||||
/// <param name="key">The identifier under which the object will be stored.</param>
|
||||
/// <param name="obj">The object to be stored.</param>
|
||||
/// <param name="updateExpiration">Specifies whether the expiration time of the entry should be refreshed. Defaults to true.</param>
|
||||
/// <!-- aidoc:v1 sig=af94cc4 -->
|
||||
Task SetObjectAsync<T>(string key, T obj, bool updateExpiration = true);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an object of type <typeparamref name="T"/> associated with the specified <paramref name="key"/>.
|
||||
@@ -43,6 +47,7 @@ namespace adas_core.Application.Services.Interfaces
|
||||
/// <param name="ttlOverride">An optional time-to-live value that overrides the default expiration period; if <see langword="null"/>, the default TTL is used.</param>
|
||||
/// <param name="updateExpiration">A value indicating whether the object's expiration should be extended when it is successfully retrieved.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous operation, containing the retrieved object of type <typeparamref name="T"/>, or <see langword="null"/> if the object is not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=ef3aa47 -->
|
||||
Task<T?> GetObjectAsync<T>(string key, TimeSpan? ttlOverride, bool updateExpiration);
|
||||
/// <summary>
|
||||
/// Asynchronously stores the specified object associated with the given key, using an optional time-to-live override and expiration update behavior.
|
||||
@@ -52,21 +57,25 @@ namespace adas_core.Application.Services.Interfaces
|
||||
/// <param name="ttlOverride">An optional <see cref="TimeSpan"/> that overrides the default time-to-live for the stored object.</param>
|
||||
/// <param name="updateExpiration">A value indicating whether the expiration of the stored object should be updated based on the provided TTL.</param>
|
||||
/// <returns>A <see cref="Task"/> that represents the asynchronous storage operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=85ff65d -->
|
||||
Task SetObjectAsync<T>(string key, T obj, TimeSpan? ttlOverride, bool updateExpiration);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes an object identified by the specified key.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier of the object to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=a568485 -->
|
||||
Task DeleteObjectAsync(string key);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes entries matching the specified pattern and returns the number of deleted items.
|
||||
/// </summary>
|
||||
/// <param name="pattern">The pattern used to match the entries to be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains the total number of entries that were deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=d0828a6 -->
|
||||
Task<long> DeleteByPatternAsync(string pattern);
|
||||
/// <summary>
|
||||
/// Clears the application cache, removing all cached entries.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fe89cd5 -->
|
||||
void CleanCache();
|
||||
|
||||
|
||||
@@ -80,6 +89,7 @@ namespace adas_core.Application.Services.Interfaces
|
||||
/// <param name="loader">The asynchronous function invoked to produce the value when no cached entry exists for the specified key.</param>
|
||||
/// <param name="ttlOverride">An optional time-to-live duration that overrides the default expiration for the cached entry; when <c>null</c>, the default TTL is used.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is the cached or freshly loaded string value, or <c>null</c> when no value is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=9201892 -->
|
||||
Task<string?> GetOrSetValueAsync(string key, Func<Task<string>> loader, TimeSpan? ttlOverride = null);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an object associated with the specified key from the cache, or invokes the factory to create and cache a new one when the key is not found.
|
||||
@@ -89,6 +99,7 @@ namespace adas_core.Application.Services.Interfaces
|
||||
/// <param name="ttl">The optional expiration period for the cached entry; if null, the default cache lifetime is applied.</param>
|
||||
/// <param name="cancellationToken">The token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that resolves to the cached or newly created object of type <typeparamref name="T"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=3a49f2f -->
|
||||
Task<T> GetOrSetObjectAsync<T>(
|
||||
string key,
|
||||
Func<Task<T>> factory,
|
||||
@@ -105,6 +116,7 @@ namespace adas_core.Application.Services.Interfaces
|
||||
/// <param name="ttl">The optional time-to-live duration applied to the cached entry.</param>
|
||||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
||||
/// <returns>A task containing the cached or newly created object of type <typeparamref name="T"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=b6c9631 -->
|
||||
Task<T> GetOrSetObjectAsync<T>(
|
||||
GroupedField groupedField,
|
||||
ObjectId patientId,
|
||||
|
||||
@@ -13,18 +13,21 @@ public interface ICalculatedObservations
|
||||
/// <param name="obs">The source patient observation to be mapped.</param>
|
||||
/// <param name="onlyByName">When set to <c>true</c>, the mapping is performed considering only the observation name; otherwise, additional mapping criteria are applied. Defaults to <c>false</c>.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous mapping operation. The result is the mapped observation of type <typeparamref name="T"/>, or <c>null</c> when no matching mapping is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=7c2c1e5 -->
|
||||
Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation;
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <paramref name="treatment"/> to a <see cref="PatientTreatment"/> result.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment instance to map.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation. The task result contains the mapped <see cref="PatientTreatment"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=be008d3 -->
|
||||
Task<PatientTreatment> Map(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Asynchronously maps a <see cref="PatientDiagnosis"/> to a <see cref="PatientDiagnosis"/> representation.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
/// <!-- aidoc:v1 sig=b4c53f0 -->
|
||||
Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis);
|
||||
|
||||
/// <summary>
|
||||
@@ -32,6 +35,7 @@ public interface ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The <see cref="PumpObservation"/> to be mapped.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> representing the asynchronous operation, containing the mapped <see cref="PumpObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=47d6f99 -->
|
||||
Task<PumpObservation> Map(PumpObservation pumpObservation);
|
||||
|
||||
/// <summary>
|
||||
@@ -39,12 +43,14 @@ public interface ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of medicines currently active for the patient.</param>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observation is being calculated.</param>
|
||||
/// <!-- aidoc:v1 sig=341d0d1 -->
|
||||
Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// 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:v1 sig=db92fab -->
|
||||
Task CalculateActiveBolus(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
@@ -52,6 +58,7 @@ public interface ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of nullable <see cref="PatientTreatment"/> entries that represent the active treatments for the specified patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=9eb0d98 -->
|
||||
Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -59,12 +66,14 @@ public interface ICalculatedObservations
|
||||
/// </summary>
|
||||
/// <param name="newObservation">The new patient observation to validate and reconcile against the previous observation's time information.</param>
|
||||
/// <returns>A task that yields the fixed <see cref="PatientObservation"/>, or <c>null</c> when no time inconsistency is detected or no correction is required.</returns>
|
||||
/// <!-- aidoc:v1 sig=ae6ddc1 -->
|
||||
Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation);
|
||||
/// <summary>
|
||||
/// Performs pre-insertion mapping on a list of patient observations, transforming or preparing the data before it is persisted.
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be pre-mapped prior to insertion.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the mapped list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=c6d4218 -->
|
||||
Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert);
|
||||
/// <summary>
|
||||
/// Maps the source alarm onto the specified patient observation and returns the resulting observation.
|
||||
@@ -72,6 +81,7 @@ public interface ICalculatedObservations
|
||||
/// <param name="obs">The patient observation to which the source alarm will be mapped.</param>
|
||||
/// <param name="alarmToInsert">The patient observation alarm to insert and map as the source alarm.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the patient observation with the source alarm mapped.</returns>
|
||||
/// <!-- aidoc:v1 sig=c22dba5 -->
|
||||
Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert);
|
||||
|
||||
/// <summary>
|
||||
@@ -80,5 +90,7 @@ public interface ICalculatedObservations
|
||||
/// <param name="obs">The patient observation that triggered the alarm.</param>
|
||||
/// <param name="name">The name associated with the alarm.</param>
|
||||
/// <param name="code">An optional alarm code categorizing the type of alarm to send.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_returns
|
||||
/// "Method returns Task but no <returns> tag documents the async return value or what completion of the task represents." -->
|
||||
Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public interface ICalculatedObservationsService
|
||||
/// <param name="obs">The source <see cref="PatientObservation"/> to be mapped.</param>
|
||||
/// <param name="onlyByName">When <c>true</c>, restricts the mapping to be performed by name only; otherwise, additional criteria are used.</param>
|
||||
/// <returns>A <see cref="Task{PatientObservation}"/> that resolves to the mapped <see cref="PatientObservation"/>, or <c>null</c> if no match is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=41cebf4 -->
|
||||
Task<PatientObservation?> Map(PatientObservation obs, bool onlyByName = false);
|
||||
/// <summary>
|
||||
/// Asynchronously maps a <see cref="PatientObservationAlarm"/> instance, optionally performing the mapping
|
||||
@@ -23,41 +24,48 @@ public interface ICalculatedObservationsService
|
||||
/// full mapping logic is applied. Defaults to <c>false</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the mapped
|
||||
/// <see cref="PatientObservationAlarm"/>, or <c>null</c> if no mapping is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=2a563ad -->
|
||||
Task<PatientObservationAlarm?> Map(PatientObservationAlarm obs, bool onlyByName = false);
|
||||
/// <summary>
|
||||
/// Maps a <see cref="PatientTreatment"/> instance to a projected <see cref="PatientTreatment"/> representation asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The source <see cref="PatientTreatment"/> to be mapped.</param>
|
||||
/// <returns>A <see cref="Task{PatientTreatment}"/> that represents the asynchronous mapping operation. The result is the mapped <see cref="PatientTreatment"/>, or <see langword="null"/> if no mapping could be produced.</returns>
|
||||
/// <!-- aidoc:v1 sig=05e1494 -->
|
||||
Task<PatientTreatment?> Map(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Maps the provided <see cref="PumpObservation"/> to a <see cref="PumpObservation"/> result, returning <see langword="null"/> when no mapping is produced.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source <see cref="PumpObservation"/> to be mapped.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the mapped <see cref="PumpObservation"/>, or <see langword="null"/> if the mapping yields no result.</returns>
|
||||
/// <!-- aidoc:v1 sig=919e4c3 -->
|
||||
Task<PumpObservation?> Map(PumpObservation obs);
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <see cref="PatientRecordingAlert"/> to a resulting <see cref="PatientRecordingAlert"/>, returning <see langword="null"/> when no mapping is produced.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source <see cref="PatientRecordingAlert"/> instance to map.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that contains the mapped <see cref="PatientRecordingAlert"/>, or <see langword="null"/> if the source cannot be mapped.</returns>
|
||||
/// <!-- aidoc:v1 sig=2805400 -->
|
||||
Task<PatientRecordingAlert?> Map(PatientRecordingAlert obs);
|
||||
/// <summary>
|
||||
/// Maps a <see cref="PatientDiagnosis"/> instance to its corresponding representation, returning <see langword="null"/> when no mapping is available.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source <see cref="PatientDiagnosis"/> to map.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> containing the mapped <see cref="PatientDiagnosis"/>, or <see langword="null"/> if the source cannot be mapped.</returns>
|
||||
/// <!-- aidoc:v1 sig=c9284b0 -->
|
||||
Task<PatientDiagnosis?> Map(PatientDiagnosis obs);
|
||||
/// <summary>
|
||||
/// Maps a list of patient observations for insertion, returning the transformed list asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be mapped for insertion.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the mapped list of patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=619bfe1 -->
|
||||
Task<List<PatientObservation>> MapList(List<PatientObservation> listToInsert);
|
||||
/// <summary>
|
||||
/// Asynchronously calculates the bolus dose of opiates for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient for whom the bolus opiates calculation is performed.</param>
|
||||
/// <!-- aidoc:v1 sig=859008a -->
|
||||
Task CalculateBolusOpiates(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously calculates medicine observations for a patient based on their active medicines.
|
||||
@@ -65,12 +73,14 @@ public interface ICalculatedObservationsService
|
||||
/// <param name="activeMedicines">The list of medicines currently active for 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=341d0d1 -->
|
||||
Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves the active patient treatments associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of active PatientTreatment entries for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=9eb0d98 -->
|
||||
Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id);
|
||||
/// <summary>
|
||||
/// Maps a source alarm from a <see cref="PatientObservationAlarm"/> onto a <see cref="PatientObservation"/>, producing an observation enriched with the corresponding alarm information.
|
||||
@@ -78,5 +88,6 @@ public interface ICalculatedObservationsService
|
||||
/// <param name="observation">The patient observation that serves as the base for the mapping.</param>
|
||||
/// <param name="observationAlarm">The source alarm whose data is mapped onto the observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="PatientObservation"/> populated with the mapped alarm data.</returns>
|
||||
/// <!-- aidoc:v1 sig=1c0c4ce -->
|
||||
Task<PatientObservation> MapSourceAlarm(PatientObservation observation, PatientObservationAlarm observationAlarm);
|
||||
}
|
||||
@@ -12,24 +12,28 @@ public interface ICameraService
|
||||
/// </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 <see cref="Camera"/> if a matching record is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=dcfdfde -->
|
||||
Task<Camera?> GetById(ObjectId relayId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of cameras associated with the specified configuration relay identifiers.
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The list of configuration relay object identifiers used to look up the associated cameras.</param>
|
||||
/// <returns>A list of cameras that correspond to the provided configuration relay identifiers.</returns>
|
||||
/// <!-- aidoc:v1 sig=4523ee6 -->
|
||||
List<Camera> GetCameraInList(List<ObjectId> configurationRelayList);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of cameras based on the provided pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing the page size, page number, and optional search criteria used to query cameras.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PaginationResponse{Camera}"/> with the requested page of cameras and pagination metadata.</returns>
|
||||
/// <!-- aidoc:v1 sig=3886498 -->
|
||||
Task<PaginationResponse<Camera>> GetPaginatedCameras(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Inserts a new camera into the system asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="camera">The camera entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the inserted camera with its generated identifier, or <c>null</c> if the camera could not be inserted.</returns>
|
||||
/// <!-- aidoc:v1 sig=7c18638 -->
|
||||
Task<Camera?> InsertCamera(Camera camera);
|
||||
/// <summary>
|
||||
/// Updates an existing camera identified by the specified object identifier with the provided camera data.
|
||||
@@ -38,17 +42,20 @@ public interface ICameraService
|
||||
/// <param name="objectId">The unique identifier of the camera to update.</param>
|
||||
/// <param name="camera">The camera data containing the updated values to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated camera, or <see langword="null"/> if the camera was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=cb8ad73 -->
|
||||
Task<Camera?> UpdateCameraById(ObjectId objectId, Camera camera);
|
||||
/// <summary>
|
||||
/// Deletes a camera identified by the specified object identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the camera to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The result is <c>true</c> if the camera was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=7b8b4e5 -->
|
||||
Task<bool> DeleteCamera(ObjectId objectId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of cameras whose names match the specified search text.
|
||||
/// </summary>
|
||||
/// <param name="textToSearch">The text used to search camera names.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Camera"/> objects matching the search criteria; an empty list is returned if no matches are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=b1c98a2 -->
|
||||
Task<List<Camera>> GetSearchByNameCameras(string textToSearch);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public interface IClientMessageService
|
||||
/// <param name="type">The optional operation type used to classify the message.</param>
|
||||
/// <param name="msg">The optional message payload to be sent.</param>
|
||||
/// <returns>A task that represents the asynchronous send operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=3c62336 -->
|
||||
Task SendAsync(string receiverId, OperationType? type, object? msg);
|
||||
/// <summary>
|
||||
/// Asynchronously broadcasts a message of the specified operation type to all connected recipients.
|
||||
@@ -20,16 +21,20 @@ public interface IClientMessageService
|
||||
/// <param name="type">The operation type that classifies the broadcast message.</param>
|
||||
/// <param name="msg">The message payload to send, or <c>null</c> when no payload is required.</param>
|
||||
/// <returns>A task that represents the asynchronous broadcast operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=e5d4ff6 -->
|
||||
Task SendToAllAsync(OperationType type, object? msg);
|
||||
/// <summary>
|
||||
/// Processes an incoming message within the context of the specified connection.
|
||||
/// </summary>
|
||||
/// <param name="msg">The message to be processed.</param>
|
||||
/// <param name="contextConnectionId">The identifier of the connection context associated with the message.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_returns
|
||||
/// "Method returns Task (indicating asynchronous processing) but no <returns> tag is present to describe the returned task." -->
|
||||
Task ProcessMessage(Message msg, string contextConnectionId);
|
||||
/// <summary>
|
||||
/// Sends an update message to the specified list of patient location boxes.
|
||||
/// </summary>
|
||||
/// <param name="boxes">The list of patient locations that will receive the update message.</param>
|
||||
/// <!-- aidoc:v1 sig=4a52d06 -->
|
||||
void SendUpdateMessageToBoxes(List<PatientLocation> boxes);
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public interface IConfigObservationService
|
||||
/// <param name="codingSystem">The coding system used to identify the configuration observation (e.g., ICD, SNOMED).</param>
|
||||
/// <param name="code">The code within the given coding system that uniquely identifies the configuration observation.</param>
|
||||
/// <returns>A <see cref="ConfigObservation"/> if a match is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=b4251de -->
|
||||
Task<ConfigObservation?> GetByCodeSysAndCode(string codingSystem, string code);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="ConfigObservation"/> identified by the given name.
|
||||
@@ -26,6 +27,7 @@ public interface IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the configuration observation to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="ConfigObservation"/>, or <see langword="null"/> if no observation is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=f39308c -->
|
||||
Task<ConfigObservation?> Get(string name);
|
||||
|
||||
/// <summary>
|
||||
@@ -34,6 +36,7 @@ public interface IConfigObservationService
|
||||
/// <param name="obs">The patient observation whose corresponding configuration observation is being requested.</param>
|
||||
/// <param name="onlyByName">When <c>true</c>, limits the lookup to a name-based match; otherwise, other matching criteria may be applied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigObservation"/>, or <c>null</c> if no matching observation is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=5d51beb -->
|
||||
Task<ConfigObservation?> Get<T>(T obs, bool onlyByName = false) where T : BasePatientObservation;
|
||||
|
||||
/// <summary>
|
||||
@@ -41,6 +44,7 @@ public interface IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation of type <typeparamref name="T"/> on which retention actions will be executed.</param>
|
||||
/// <returns>A task that represents the asynchronous retention operation. The task result contains the <see cref="ObservatitonRetentionResult"/> produced by the retention actions, or <c>null</c> when no retention result is produced.</returns>
|
||||
/// <!-- aidoc:v1 sig=67748d9 -->
|
||||
Task<ObservatitonRetentionResult?> RetentionActions<T>(T obs) where T : BasePatientObservation;
|
||||
/// <summary>
|
||||
/// Maps a patient observation to a corresponding target observation of the same type, optionally restricting the lookup to name-based matching only.
|
||||
@@ -48,12 +52,14 @@ public interface IConfigObservationService
|
||||
/// <param name="obs">The source patient observation to be mapped.</param>
|
||||
/// <param name="onlyByName">When set to <c>true</c>, the mapping is performed using the observation's name only; otherwise, additional matching criteria are considered. Defaults to <c>false</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the mapped patient observation of type <typeparamref name="T"/>, or <c>null</c> if no matching observation is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=7c2c1e5 -->
|
||||
Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation;
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <see cref="PatientTreatment"/> to a populated <see cref="PatientTreatment"/> instance, returning <see langword="null"/> when the treatment cannot be resolved.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The <see cref="PatientTreatment"/> to be mapped.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the mapped <see cref="PatientTreatment"/>, or <see langword="null"/> if no mapping result is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=05e1494 -->
|
||||
Task<PatientTreatment?> Map(PatientTreatment treatment);
|
||||
|
||||
/// <summary>
|
||||
@@ -66,6 +72,7 @@ public interface IConfigObservationService
|
||||
/// <param name="min">The optional minimum threshold for the value.</param>
|
||||
/// <param name="max">The optional maximum threshold for the value.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the evaluated <see cref="StatusEnum.Type"/> for the grouped observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=4f9fc90 -->
|
||||
Task<StatusEnum.Type> GroupedObservationStatus(GroupedField groupedField, GroupedObservationEnum.Result result,
|
||||
string name, object value, double? min, double? max);
|
||||
|
||||
@@ -74,64 +81,75 @@ public interface IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="ct">The cancellation token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="ConfigObservation"/> objects representing all available configurations.</returns>
|
||||
/// <!-- aidoc:v1 sig=c9e275b -->
|
||||
Task<ICollection<ConfigObservation>> GetAllConfigs(CancellationToken ct = default);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of <see cref="ConfigObservation"/> items based on the supplied filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and query criteria used to retrieve the configuration observations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{ConfigObservation}"/> with the requested items and pagination metadata.</returns>
|
||||
/// <!-- aidoc:v1 sig=2a96e75 -->
|
||||
Task<PaginationResponse<ConfigObservation>> GetPaginatedItems(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves all configuration observations in a compact format.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation that returns a <see cref="ConfigObservationDto"/> containing the compact representation of all configuration observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=474ef97 -->
|
||||
Task<ConfigObservationDto> GetAllCompact();
|
||||
/// <summary>
|
||||
/// Retrieves a configuration observation by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ConfigObservation"/> if a matching record is found, or <c>null</c> if no configuration exists for the specified id.</returns>
|
||||
/// <!-- aidoc:v1 sig=aacda16 -->
|
||||
Task<ConfigObservation?> GetConfigById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of configuration names associated with the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier used to look up the associated configuration names.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains 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 a list of configuration names.</returns>
|
||||
/// <!-- aidoc:v1 sig=45b7793 -->
|
||||
Task<List<string>> GetConfigNames();
|
||||
/// <summary>
|
||||
/// Updates an existing configuration observation and returns the updated result.
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The configuration observation containing the data to update.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="ConfigObservation"/>, or <c>null</c> when no matching configuration is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=15fa841 -->
|
||||
Task<ConfigObservation?> UpdateConfig(ConfigObservation configObservation);
|
||||
/// <summary>
|
||||
/// Asynchronously creates a new configuration based on the provided observation data.
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The observation data used to create the configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the created <see cref="ConfigObservation"/>, or <c>null</c> if the configuration could not be created.</returns>
|
||||
/// <!-- aidoc:v1 sig=9317e04 -->
|
||||
Task<ConfigObservation?> CreateConfig(ConfigObservation configObservation);
|
||||
/// <summary>
|
||||
/// Asynchronously removes the configuration item with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="itemName">The name of the configuration item to remove.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="ConfigObservation"/> describing the removed item, or <c>null</c> if no matching item was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=ce6276e -->
|
||||
Task<ConfigObservation?> RemoveConfigItem(string itemName);
|
||||
/// <summary>
|
||||
/// Asynchronously removes the configuration item identified by the specified identifier and returns the resulting observation.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration item to remove.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ConfigObservation"/> describing the removed configuration item, or <c>null</c> if no matching item was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=9730dbb -->
|
||||
Task<ConfigObservation?> RemoveConfigItem(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the configuration observation items associated with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the configuration observation items.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result contains a collection of <see cref="ConfigObservation"/> items matching the provided name, or <c>null</c> if no matching items are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=3cb29fa -->
|
||||
Task<IEnumerable<ConfigObservation>?> GetConfigObservationItem(string name);
|
||||
|
||||
/// <summary>
|
||||
@@ -142,6 +160,7 @@ public interface IConfigObservationService
|
||||
/// <param name="name">The name of the configuration observation item.</param>
|
||||
/// <param name="originalName">The original name of the configuration observation item.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigObservation"/>, or <c>null</c> if no item is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=2c7c75f -->
|
||||
Task<ConfigObservation?> GetSingleConfigObservationItem(string? code, string? codingSystem, string? name,
|
||||
string? originalName);
|
||||
|
||||
@@ -150,11 +169,13 @@ public interface IConfigObservationService
|
||||
/// </summary>
|
||||
/// <param name="configObservationItem">The configuration observation item to be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the deletion was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=1f61b9b -->
|
||||
Task<bool> DeleteSingleConfigObservationItem(ConfigObservation configObservationItem);
|
||||
/// <summary>
|
||||
/// Retrieves configuration observation items that match the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to filter the configuration observation items.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the collection of <see cref="ConfigObservation"/> items matching the specified name.</returns>
|
||||
/// <!-- aidoc:v1 sig=69b9196 -->
|
||||
Task<IEnumerable<ConfigObservation>> GetConfigObservationItemsByName(string name);
|
||||
}
|
||||
@@ -11,11 +11,13 @@ public interface IConfigPumpsService
|
||||
/// </summary>
|
||||
/// <param name="obs">The source PumpObservation to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting PumpObservation.</returns>
|
||||
/// <!-- aidoc:v1 sig=e90f6a3 -->
|
||||
Task<PumpObservation> Map(PumpObservation obs);
|
||||
/// <summary>
|
||||
/// Retrieves all available pump configurations from the configuration store.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a list of <see cref="ConfigPumps"/> with all pump configurations, or <c>null</c> if no configurations are available.</returns>
|
||||
/// <!-- aidoc:v1 sig=02da65c -->
|
||||
Task<List<ConfigPumps>?> GetAllPumpConfigs();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the configuration pump items associated with the specified identifier.
|
||||
@@ -23,36 +25,42 @@ public interface IConfigPumpsService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier used to look up the configuration items.</param>
|
||||
/// <returns>A task containing a list of ConfigPumpItem objects if found, or null if no items exist for the specified id.</returns>
|
||||
/// <!-- aidoc:v1 sig=f88a8a5 -->
|
||||
Task<List<ConfigPumpItem>?> GetConfigItems(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the pump configuration that matches the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the pump configuration to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigPumps"/> configuration if found; otherwise, <c>null</c> when no configuration exists for the given identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=6e00a1d -->
|
||||
Task<ConfigPumps?> GetPumpConfigById(string id);
|
||||
/// <summary>
|
||||
/// Updates the pump configuration asynchronously and returns the updated configuration.
|
||||
/// </summary>
|
||||
/// <param name="pumpConfig">The pump configuration to update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="ConfigPumps"/>, or <c>null</c> if the configuration was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=8810f19 -->
|
||||
Task<ConfigPumps?> UpdatePumpConfig(ConfigPumps pumpConfig);
|
||||
/// <summary>
|
||||
/// Inserts a new pump configuration into the data store.
|
||||
/// </summary>
|
||||
/// <param name="pumpConfig">The pump configuration to insert.</param>
|
||||
/// <returns>The inserted <see cref="ConfigPumps"/> entity, or <c>null</c> if the insertion was not performed.</returns>
|
||||
/// <!-- aidoc:v1 sig=65d91df -->
|
||||
Task<ConfigPumps?> InsertPumpConfig(ConfigPumps pumpConfig);
|
||||
/// <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 a boolean indicating whether the deletion was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=ce3f871 -->
|
||||
Task<bool> DeletePumpConfig(ConfigPumps config);
|
||||
/// <summary>
|
||||
/// Asynchronously evaluates and applies retention actions for a pump observation, returning the resulting retention outcome.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to process for retention actions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the retention result, or null if no retention action applies.</returns>
|
||||
/// <!-- aidoc:v1 sig=9f98a57 -->
|
||||
Task<ObservatitonRetentionResult?> RetentionActions(PumpObservation obs);
|
||||
|
||||
}
|
||||
@@ -11,11 +11,13 @@ public interface IConfigUnitsService
|
||||
/// <typeparam name="T">The specific patient observation type, constrained to <see cref="BasePatientObservation"/>.</typeparam>
|
||||
/// <param name="obs">The patient observation instance to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, yielding the mapped patient observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=f302314 -->
|
||||
Task<T> Map<T>(T obs) where T : BasePatientObservation;
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <see cref="PumpObservation"/> to a resulting <see cref="PumpObservation"/>.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting <see cref="PumpObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=e90f6a3 -->
|
||||
Task<PumpObservation> Map(PumpObservation obs);
|
||||
}
|
||||
@@ -11,18 +11,21 @@ public interface IDeviceService
|
||||
/// </summary>
|
||||
/// <param name="device">The data transfer object containing the information used to create the device.</param>
|
||||
/// <returns>A task that represents the asynchronous create operation. The task result contains the created <see cref="Device"/>, or <see langword="null"/> if the device could not be created.</returns>
|
||||
/// <!-- aidoc:v1 sig=f960817 -->
|
||||
Task<Device?> Create(DeviceDto device);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the object identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the object to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The result is <c>true</c> if the object was deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=9c1b1e3 -->
|
||||
Task<bool> Delete(ObjectId objectId);
|
||||
/// <summary>
|
||||
/// Updates an existing device using the provided data transfer object.
|
||||
/// </summary>
|
||||
/// <param name="device">The data transfer object containing the updated device information.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated device, or <c>null</c> if the device was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=74ac7b4 -->
|
||||
Task<Device?> Update(DeviceDto device);
|
||||
/// <summary>
|
||||
/// Processes an incoming event for the specified device and returns the associated <see cref="Device"/>.
|
||||
@@ -30,5 +33,6 @@ public interface IDeviceService
|
||||
/// </summary>
|
||||
/// <param name="device">The device data transfer object carrying the event information to be processed.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the resolved <see cref="Device"/> or <c>null</c> if no matching device was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4985fb0 -->
|
||||
Task<Device?> ReceiveEvent(DeviceDto device);
|
||||
}
|
||||
@@ -11,33 +11,39 @@ public interface IDiagnosisService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose diagnoses are being retrieved.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientDiagnosis"/> records for the specified patient; an empty list is returned if no diagnoses are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=002b366 -->
|
||||
Task<List<PatientDiagnosis>> GetByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose related records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=d457cb9 -->
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the specified patient, marking the patient record as archived rather than permanently deleting it.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
/// <!-- aidoc:v1 sig=52c2373 -->
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives the records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose records will be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=e5916ec -->
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Processes a diagnosis observation for the specified patient based on the supplied API request data.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the diagnosis observation payload and contextual information to process.</param>
|
||||
/// <param name="patient">The patient to whom the diagnosis observation pertains.</param>
|
||||
/// <!-- aidoc:v1 sig=c6a1fc2 -->
|
||||
Task ProcessDiagnosisObservation(ApiRequest apiRequest, Patient patient);
|
||||
/// <summary>
|
||||
/// Persists the specified API request along with its associated patient data.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
/// <param name="patient">The patient associated with the API request.</param>
|
||||
/// <!-- aidoc:v1 sig=565473c -->
|
||||
Task SaveRequest(ApiRequest apiRequest, Patient patient);
|
||||
/// <summary>
|
||||
/// Processes the provided list of patient diagnoses for the specified patient at the given message time.
|
||||
@@ -45,6 +51,7 @@ public interface IDiagnosisService : IApiRequestService
|
||||
/// <param name="diagnosis">The list of patient diagnoses to be processed.</param>
|
||||
/// <param name="patient">The patient associated with the diagnoses.</param>
|
||||
/// <param name="messageTime">The timestamp of the message triggering the diagnosis processing.</param>
|
||||
/// <!-- aidoc:v1 sig=c62208b -->
|
||||
Task ProcessDiagnosis(List<PatientDiagnosis> diagnosis, Patient patient, DateTime messageTime);
|
||||
/// <summary>
|
||||
/// Updates multiple records by replacing the <paramref name="oldId"/> with the new <paramref name="id"/> in the field identified by <paramref name="nameId"/>.
|
||||
@@ -52,5 +59,6 @@ public interface IDiagnosisService : IApiRequestService
|
||||
/// <param name="nameId">The identifier of the field or property whose ObjectId values will be updated.</param>
|
||||
/// <param name="id">The new ObjectId value to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced in the matching records.</param>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
}
|
||||
@@ -14,56 +14,66 @@ public interface IDischargeService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="dischargeId">The unique identifier of the discharge to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Discharge"/> if found, or null when no record matches the provided identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=5d8f706 -->
|
||||
Task<Discharge?> GetDischargeByIdAsync(ObjectId dischargeId);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of discharge records associated with the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose discharges should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total number of discharges for the specified unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=f2e3592 -->
|
||||
Task<long> CountDischargesByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a discharge record identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="dischargeId">The unique identifier of the discharge to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=717b98a -->
|
||||
Task DeleteDischargeByIdAsync(ObjectId dischargeId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the specified discharge record.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge entity to be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=a368605 -->
|
||||
Task DeleteDischargeAsync(Discharge discharge);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing discharge record in the data store.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The <see cref="Discharge"/> entity containing the updated information to persist.</param>
|
||||
/// <!-- aidoc:v1 sig=5401c24 -->
|
||||
Task UpdateDischargeAsync(Discharge discharge);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of discharge records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of <see cref="Discharge"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=41d8002 -->
|
||||
Task<IEnumerable<Discharge>> GetDischargesAsync();
|
||||
/// <summary>
|
||||
/// Inserts a new discharge record into the data store. Returns the inserted <see cref="Discharge"/> entity, or <see langword="null"/> if the record could not be created.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The <see cref="Discharge"/> entity containing the data to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the inserted <see cref="Discharge"/>, or <see langword="null"/> when the insertion does not produce a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=b5ed14b -->
|
||||
Task<Discharge?> InsertDischarge(Discharge discharge);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge record associated with the specified patient location, returning null if no matching discharge is found.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to look up the discharge record.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Discharge"/> if found, or null if no discharge is associated with the specified location.</returns>
|
||||
/// <!-- aidoc:v1 sig=8da289b -->
|
||||
Task<Discharge?> GetDischargeByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge record associated with the specified patient identifier.
|
||||
/// </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"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=baed031 -->
|
||||
Task<Discharge?> GetDischargeByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves a discharge record associated with the specified point of care location identifier.
|
||||
/// </summary>
|
||||
/// <param name="location">The ObjectId of the point of care location used to look up the discharge.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Discharge"/> if found, or <c>null</c> if no discharge exists for the specified point of care location.</returns>
|
||||
/// <!-- aidoc:v1 sig=fba113c -->
|
||||
Task<Discharge?> GetDischargeByPointOfCareId(ObjectId location);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge associated with the specified point of care location, returning localized data for the requested locale.
|
||||
@@ -72,12 +82,14 @@ public interface IDischargeService : IApiRequestService
|
||||
/// <param name="location">The identifier of the point of care location whose discharge should be retrieved.</param>
|
||||
/// <param name="dataLocale">The locale used to determine the language of the returned discharge data.</param>
|
||||
/// <returns>A task containing the matching <see cref="Discharge"/>, or null if no discharge exists for the given location.</returns>
|
||||
/// <!-- aidoc:v1 sig=3b965d9 -->
|
||||
Task<Discharge?> GetDischargeByPointOfCareIdWithLocale(ObjectId location, LocaleEnum dataLocale);
|
||||
/// <summary>
|
||||
/// Sends a broadcast notification for the specified discharge based on the given operation type.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge entity to be included in the broadcast.</param>
|
||||
/// <param name="operation">The type of operation (e.g., create, update, delete) that determines the broadcast context.</param>
|
||||
/// <!-- aidoc:v1 sig=d7c2e1f -->
|
||||
void SendDischargeBroadcast(Discharge discharge, OperationType operation);
|
||||
/// <summary>
|
||||
/// Updates a patient master list item change using the provided update options, applying the change across the specified unit list and master list type.
|
||||
@@ -85,6 +97,7 @@ public interface IDischargeService : IApiRequestService
|
||||
/// <param name="opt">The update options describing the change to apply to the patient master list item.</param>
|
||||
/// <param name="unitList">The collection of units to which the master list item change should be applied.</param>
|
||||
/// <param name="typeName">The name of the master list type that identifies which list the item belongs to.</param>
|
||||
/// <!-- aidoc:v1 sig=6d7dd8e -->
|
||||
Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes the specified patient master list item associated with the given option list and units.
|
||||
@@ -93,10 +106,12 @@ public interface IDischargeService : IApiRequestService
|
||||
/// <param name="unitList">The collection of units associated with the item to be deleted.</param>
|
||||
/// <param name="typeName">The name of the type used to identify the patient master list item.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=bbc71d1 -->
|
||||
Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes discharge records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose discharge records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=df1942b -->
|
||||
Task DeleteDischargesByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -14,24 +14,28 @@ public interface IDisplayConfigService
|
||||
/// Retrieves all display configurations asynchronously.
|
||||
/// </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 list of display configurations in a compact (minimal) representation.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter that controls page size, page number, and sorting criteria.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{T}"/> with the compact display configuration entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=1dc5924 -->
|
||||
Task<PaginationResponse<DisplayConfigMinimalResponse>> GetAllCompactPaginated(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Retrieves a list of display configurations filtered by the specified display type.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to filter the configurations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="DisplayConfig"/> objects matching the specified type.</returns>
|
||||
/// <!-- aidoc:v1 sig=2f20b32 -->
|
||||
Task<List<DisplayConfig>> GetByType(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="DisplayConfig"/> by its identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="DisplayConfig"/> matching the specified identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=fad8438 -->
|
||||
Task<DisplayConfig> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="DisplayConfig"/> identified by the specified configuration identifier, unit identifier, and display type.
|
||||
@@ -40,23 +44,27 @@ public interface IDisplayConfigService
|
||||
/// <param name="unitId">The identifier of the unit the display configuration belongs to.</param>
|
||||
/// <param name="displayType">The display type used to filter or scope the lookup.</param>
|
||||
/// <returns>A <see cref="Task{DisplayConfig}"/> that resolves to the matching <see cref="DisplayConfig"/>, or <c>null</c> if no configuration is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=fecb3b8 -->
|
||||
Task<DisplayConfig?> GetById(ObjectId? configId, ObjectId unitId, DisplayConfigEnums.DisplayType displayType);
|
||||
/// <summary>
|
||||
/// Inserts a single display configuration asynchronously and returns the resulting configuration, or null when no record is produced.
|
||||
/// </summary>
|
||||
/// <param name="config">The display configuration to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="DisplayConfig"/> or null.</returns>
|
||||
/// <!-- aidoc:v1 sig=aa331a5 -->
|
||||
Task<DisplayConfig?> InsertOne(DisplayConfig config);
|
||||
/// <summary>
|
||||
/// Inserts a new display configuration in a minimal fashion and returns the created <see cref="DisplayConfig"/>, or <c>null</c> when no configuration could be produced.
|
||||
/// </summary>
|
||||
/// <param name="config">The data transfer object containing the values used to create the new display configuration.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the created <see cref="DisplayConfig"/> when successful, or <c>null</c> when no result is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=8e1aa52 -->
|
||||
Task<DisplayConfig?> InsertOneMinimal(CreateDisplayConfigDto config);
|
||||
/// <summary>
|
||||
/// Performs a test insertion operation that returns a <see cref="DisplayConfig"/> instance, used to validate insertion behavior.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{DisplayConfig}"/> representing the asynchronous test insertion result.</returns>
|
||||
/// <!-- aidoc:v1 sig=0a20de7 -->
|
||||
Task<DisplayConfig> InsertOneTest();
|
||||
/// <summary>
|
||||
/// Updates the display configuration identified by the specified identifier with the provided new configuration data.
|
||||
@@ -64,6 +72,7 @@ public interface IDisplayConfigService
|
||||
/// <param name="displayConfigId">The unique identifier of the display configuration to update.</param>
|
||||
/// <param name="newDisplayConfig">The new display configuration data to apply to the existing configuration.</param>
|
||||
/// <returns>The updated <see cref="DisplayConfig"/>, or <c>null</c> if no display configuration with the specified identifier is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=aa86543 -->
|
||||
Task<DisplayConfig?> UpdateConfig(ObjectId displayConfigId, object newDisplayConfig);
|
||||
/// <summary>
|
||||
/// Updates the list of fields associated with the specified configuration display.
|
||||
@@ -71,6 +80,7 @@ public interface IDisplayConfigService
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the configuration display whose field list will be updated.</param>
|
||||
/// <param name="fields">The list of fields to be applied to the configuration display.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a value indicating whether the update was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=62079e1 -->
|
||||
Task<bool> UpdateFieldList(ObjectId objectIdConfigDisplay, List<Field> fields);
|
||||
/// <summary>
|
||||
/// Updates the color configuration for the specified config display.
|
||||
@@ -78,6 +88,7 @@ public interface IDisplayConfigService
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the config display whose color configuration will be updated.</param>
|
||||
/// <param name="colorConfigDto">The color configuration data to apply to the config display.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=965cbeb -->
|
||||
Task<bool> UpdateConfigColor(ObjectId objectIdConfigDisplay, ColorConfig colorConfigDto);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the header configuration associated with the specified config display identifier.
|
||||
@@ -85,6 +96,7 @@ public interface IDisplayConfigService
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the config display whose header configuration will be updated.</param>
|
||||
/// <param name="headerConfig">The new header configuration to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=979f311 -->
|
||||
Task<bool> UpdateHeaderConfig(ObjectId objectIdConfigDisplay, HeaderConfig headerConfig);
|
||||
/// <summary>
|
||||
/// Updates the home banner configuration for the specified config display with the provided list of banner items.
|
||||
@@ -92,12 +104,14 @@ public interface IDisplayConfigService
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the config display whose home banner will be updated.</param>
|
||||
/// <param name="bannerItems">The list of banner items to set as the home banner configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the home banner 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 with the specified settings.
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The display configuration to apply as the new base configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The task result contains a boolean value indicating whether the update was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=ab543ce -->
|
||||
Task<bool> UpdateBaseConfig(DisplayConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the hospital name associated with the specified display configuration.
|
||||
@@ -105,29 +119,34 @@ public interface IDisplayConfigService
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the display configuration whose hospital name will be updated.</param>
|
||||
/// <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 applied successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=519223f -->
|
||||
Task<bool> UpdateDisplayConfigHospitalName(ObjectId objectIdConfigDisplay, string name);
|
||||
/// <summary>
|
||||
/// Deletes a display configuration identified by the specified object identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The unique identifier of the display configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains a boolean value indicating whether the display configuration was successfully deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=8887abf -->
|
||||
Task<bool> DeleteDisplayConfig(ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the default display configuration for the specified display type.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to look up the default configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the default <see cref="DisplayConfig"/> for the given display type, or <c>null</c> if no default configuration is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=4360847 -->
|
||||
Task<DisplayConfig?> GetDefaultConfig(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Retrieves the list of display configuration locations associated with the specified configuration display identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The ObjectId of the configuration display whose locations are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of DisplayConfigLocationDto objects for the specified configuration display.</returns>
|
||||
/// <!-- aidoc:v1 sig=38e01cc -->
|
||||
Task<List<DisplayConfigLocationDto>> GetDisplayConfigLocations(ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all display configurations in a compact (minimal) representation.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="DisplayConfigMinimalResponse"/> objects representing the compact display configurations.</returns>
|
||||
/// <!-- aidoc:v1 sig=784f030 -->
|
||||
Task<List<DisplayConfigMinimalResponse>> GetAllCompact();
|
||||
|
||||
/// <summary>
|
||||
@@ -137,6 +156,7 @@ public interface IDisplayConfigService
|
||||
/// <param name="configType">The type of display configuration template to use for the insertion.</param>
|
||||
/// <param name="configHospital">The optional hospital identifier used to scope the configuration; may be null when the configuration is not hospital-specific.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the inserted <see cref="DisplayConfig"/>, or null if the configuration could not be created.</returns>
|
||||
/// <!-- aidoc:v1 sig=fd98439 -->
|
||||
Task<DisplayConfig?> InsertOneWithTemplate(string objectId,
|
||||
DisplayConfigEnums.DisplayType configType, string? configHospital);
|
||||
|
||||
@@ -145,17 +165,20 @@ public interface IDisplayConfigService
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The card configuration to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the update was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=a78296b -->
|
||||
Task<bool> UpdateCardConfig(CardConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Inserts a new card configuration using the supplied data and returns the resulting <see cref="CardConfig"/>, or null if no card config is created.
|
||||
/// </summary>
|
||||
/// <param name="updateDisplayConfigNameDto">The DTO containing the data used to create the display config card.</param>
|
||||
/// <returns>A task that resolves to the inserted <see cref="CardConfig"/>, or null if the insert did not produce a card config.</returns>
|
||||
/// <!-- aidoc:v1 sig=aa15ede -->
|
||||
Task<CardConfig?> InsertCardConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all 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=c76009a -->
|
||||
Task<List<CardConfig>> GetCardConfigAll();
|
||||
/// <summary>
|
||||
/// Retrieves the card configuration associated with the specified identifier.
|
||||
@@ -163,41 +186,48 @@ public interface IDisplayConfigService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the card configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="CardConfig"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=8c670e5 -->
|
||||
Task<CardConfig?> GetCardConfigById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the card details configuration based on the provided base configuration.
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The base card details configuration to apply during the update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean value indicating whether the update was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=8e7d63d -->
|
||||
Task<bool> UpdateDetailConfig(CardDetailsConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Inserts a new card detail configuration based on the provided display config data.
|
||||
/// </summary>
|
||||
/// <param name="updateDisplayConfigNameDto">The DTO containing the data required to create the card detail configuration.</param>
|
||||
/// <returns>A task that resolves to the created <see cref="CardDetailsConfig"/>, or <c>null</c> if the configuration could not be inserted.</returns>
|
||||
/// <!-- aidoc:v1 sig=c90d7b5 -->
|
||||
Task<CardDetailsConfig?> InsertCardDetailConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto);
|
||||
/// <summary>
|
||||
/// Inserts a new chart configuration based on the provided display config card data.
|
||||
/// </summary>
|
||||
/// <param name="updateDisplayConfigNameDto">The data transfer object containing the details of the chart configuration to create.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the newly inserted <see cref="ChartConfig"/>, or <c>null</c> if the insertion was not successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=98c18b3 -->
|
||||
Task<ChartConfig?> InsertChartConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the chart configuration based on the provided base configuration and returns a value indicating whether the update was successful.
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The base chart configuration to apply during the update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is <c>true</c> if the chart configuration was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=115a30f -->
|
||||
Task<bool> UpdateChartConfig(ChartConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a chart configuration identified by the specified configuration display identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The <see cref="ObjectId"/> of the chart configuration display to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation, containing a value indicating whether the deletion was successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=88cfab6 -->
|
||||
Task<bool> DeleteChartConfig(ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the chart configuration associated with the specified chart identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigChart">The unique identifier of the chart whose configuration should be fetched.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ChartConfig"/> associated with the provided identifier, or <c>null</c> if no configuration is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=15bc45a -->
|
||||
Task<ChartConfig?> GetChartConfig(ObjectId objectIdConfigChart);
|
||||
}
|
||||
@@ -16,6 +16,7 @@ public interface IDisplayService
|
||||
/// Asynchronously retrieves all displays in a compact format containing only minimal identifying information.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="DisplayMinimalDto"/> objects representing all available displays in a compact projection.</returns>
|
||||
/// <!-- aidoc:v1 sig=05ec358 -->
|
||||
Task<List<DisplayMinimalDto>> GetAllCompact();
|
||||
/// <summary>
|
||||
/// Retrieves all displays along with their associated permissions for the specified user.
|
||||
@@ -23,30 +24,35 @@ public interface IDisplayService
|
||||
/// </summary>
|
||||
/// <param name="userName">The username used to look up the associated displays and permissions. May be null.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="DisplayWithPermissionsDto"/> entries for the user.</returns>
|
||||
/// <!-- aidoc:v1 sig=970fb6e -->
|
||||
Task<List<DisplayWithPermissionsDto>> GetAllByUser(string? userName);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of <see cref="Display"/> entries filtered by the specified display type.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to filter the returned collection.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Display"/> items matching the specified type.</returns>
|
||||
/// <!-- aidoc:v1 sig=257ad89 -->
|
||||
Task<List<Display>> GetByType(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of displays associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care used to filter the displays to be returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Display"/> items linked to the given point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=04ec30c -->
|
||||
Task<List<Display>> GetByPointOfCare(PointOfCare pointOfCare);
|
||||
/// <summary>
|
||||
/// Retrieves a list of displays associated with the specified configuration identifier.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the configuration used to filter the displays.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of displays matching the specified configuration identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=b59323e -->
|
||||
Task<List<Display>> GetByConfigId(ObjectId configId);
|
||||
/// <summary>
|
||||
/// Retrieves a list of <see cref="Display"/> entities associated with the specified card configuration identifier.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the card configuration whose associated displays are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Display"/> objects linked to the given card configuration.</returns>
|
||||
/// <!-- aidoc:v1 sig=7885fbb -->
|
||||
Task<List<Display>> GetByCardConfigId(ObjectId configId);
|
||||
|
||||
// Task<List<Display>> GetByUser();
|
||||
@@ -56,12 +62,14 @@ public interface IDisplayService
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the display to look up.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> that resolves to the matching <see cref="Display"/>, or <c>null</c> if none is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=02f4c9c -->
|
||||
Task<Display?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Display"/> entity by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Display"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=3467c35 -->
|
||||
Task<Display?> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a display representation of an entity along with its associated permissions, localized for the specified locale.
|
||||
@@ -69,12 +77,14 @@ public interface IDisplayService
|
||||
/// <param name="id">The unique identifier of the entity to retrieve.</param>
|
||||
/// <param name="localeEnum">The locale used to localize the returned display data.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the localized display data with permissions.</returns>
|
||||
/// <!-- aidoc:v1 sig=22adc98 -->
|
||||
Task<DisplayWithPermissionsDto> GetByIdWithPermissions(ObjectId id, LocaleEnum localeEnum);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of displays associated with the specified unit identifier.
|
||||
/// </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 count of displays linked to the specified unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=c09d0d4 -->
|
||||
Task<long> CountDisplaysByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
@@ -90,6 +100,7 @@ public interface IDisplayService
|
||||
/// <param name="fillDisplayConfig">When <c>true</c>, includes the display configuration in the result.</param>
|
||||
/// <param name="ct">Token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the <see cref="Display"/> if found, or <c>null</c> if no display matches the specified <paramref name="id"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=04117d6 -->
|
||||
Task<Display?> GetInfo(
|
||||
ObjectId id,
|
||||
string? userName,
|
||||
@@ -111,6 +122,7 @@ public interface IDisplayService
|
||||
/// <param name="userName">The user name used to resolve user-specific sections, or <c>null</c> if not applicable.</param>
|
||||
/// <param name="authorizations">The list of authorizations used to authorize and filter the returned sections, or <c>null</c> if no authorization filtering is required.</param>
|
||||
/// <returns>A task that yields the list of <see cref="MinimalDisplaySection"/> instances matching the supplied criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=1bea901 -->
|
||||
Task<List<MinimalDisplaySection>> GetDisplaySectionByUser(
|
||||
DisplayConfigEnums.DisplayType type,
|
||||
ObjectId? currentDisplay,
|
||||
@@ -121,12 +133,14 @@ public interface IDisplayService
|
||||
/// Asynchronously retrieves all display sections as a minimal display list.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="MinimalDisplayListDto"/> with the display section data.</returns>
|
||||
/// <!-- aidoc:v1 sig=a8be7f7 -->
|
||||
Task<MinimalDisplayListDto> GetAllDisplaySection();
|
||||
/// <summary>
|
||||
/// Retrieves a list of <see cref="Display"/> records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> that identifies the unit whose displays are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="List{Display}"/> of displays linked to the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=a786839 -->
|
||||
Task<List<Display>> GetByUnitId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves all available Points of Contact (POCs) along with their associated unit information, optionally filtered by the provided display identifiers and allowing exclusion of virtual entries.
|
||||
@@ -134,23 +148,27 @@ public interface IDisplayService
|
||||
/// <param name="displayIds">The list of display identifiers used to filter the available POCs.</param>
|
||||
/// <param name="excludeVirtual">When set to <c>true</c>, excludes virtual POCs from the results; otherwise, virtual POCs are included.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PocAndUnitDto"/> with the matching POCs and their unit details.</returns>
|
||||
/// <!-- aidoc:v1 sig=1142e26 -->
|
||||
Task<PocAndUnitDto> GetAllAvailablePoc(List<string> displayIds, bool excludeVirtual = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all Points of Care (POCs) associated with the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The display identifier used to look up the associated Points of Care.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of Points of Care matching the specified display identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=9c3ab00 -->
|
||||
Task<List<PointOfCare>> GetAllPocsByDisplayId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Inserts a new display record into the data store and returns the persisted entity.
|
||||
/// </summary>
|
||||
/// <param name="display">The display entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the inserted <see cref="Display"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=333acbc -->
|
||||
Task<Display> InsertOne(Display display);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single test <see cref="Display"/> record and returns the persisted result.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{Display}"/> that represents the asynchronous insert operation, containing the inserted <see cref="Display"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=eba6c71 -->
|
||||
Task<Display> InsertOneTest();
|
||||
/// <summary>
|
||||
/// Updates the configuration of an existing display using the provided new configuration.
|
||||
@@ -158,6 +176,7 @@ public interface IDisplayService
|
||||
/// <param name="oldDisplay">The current display whose configuration will be updated.</param>
|
||||
/// <param name="newDisplayConfig">The new display configuration to apply, or null to leave the configuration unchanged.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Display"/>, or null if the update was not performed.</returns>
|
||||
/// <!-- aidoc:v1 sig=d4b8ee5 -->
|
||||
Task<Display?> UpdateConfig(Display oldDisplay, DisplayConfig? newDisplayConfig);
|
||||
/// <summary>
|
||||
/// Updates the configuration identifier associated with the specified display.
|
||||
@@ -165,6 +184,7 @@ public interface IDisplayService
|
||||
/// <param name="oldDisplay">The existing display whose configuration identifier will be updated.</param>
|
||||
/// <param name="configId">The new configuration identifier to associate with the display.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Display"/>, or <c>null</c> if no result is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=8265f8f -->
|
||||
Task<Display?> UpdateConfigId(Display oldDisplay, ObjectId configId);
|
||||
/// <summary>
|
||||
/// Updates the point of care list associated with the specified object identifier, replacing or merging it with the provided list of point of care object identifiers.
|
||||
@@ -172,6 +192,7 @@ public interface IDisplayService
|
||||
/// <param name="objectId">The identifier of the object whose point of care list is being updated.</param>
|
||||
/// <param name="listPocObId">The collection of point of care object identifiers to apply to the target object.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the resulting <see cref="Display"/> when the update succeeds, or <c>null</c> when no matching object is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=48f0e68 -->
|
||||
Task<Display?> UpdatePointOfCareList(ObjectId objectId, List<ObjectId> listPocObId);
|
||||
/// <summary>
|
||||
/// Updates the configuration preset associated with the specified display using the provided configuration display.
|
||||
@@ -179,6 +200,7 @@ public interface IDisplayService
|
||||
/// <param name="objectIdDisplay">The unique identifier of the display whose configuration preset will be updated.</param>
|
||||
/// <param name="objectIdConfigDisplay">The unique identifier of the configuration display to apply as the preset.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Display"/>, or <c>null</c> if no matching display is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6061a62 -->
|
||||
Task<Display?> UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Updates the name of the entity identified by the given identifier and returns the resulting <see cref="Display"/>.
|
||||
@@ -186,34 +208,40 @@ public interface IDisplayService
|
||||
/// <param name="id">The identifier of the entity whose name should be updated.</param>
|
||||
/// <param name="name">The new name to apply to the entity.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the updated <see cref="Display"/> or <c>null</c> if no entity was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=67bb64c -->
|
||||
Task<Display?> UpdateName(ObjectId id, string name);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of displays based on the provided filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and any additional filtering criteria for the display results.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{Display}"/> with the requested page of displays and pagination metadata.</returns>
|
||||
/// <!-- aidoc:v1 sig=847a84e -->
|
||||
Task<PaginationResponse<Display>> GetPaginatedDisplays(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the display identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a value indicating whether the display was successfully deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=5bb6263 -->
|
||||
Task<bool> DeleteDisplay(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the list of display configuration locations associated with the specified display configuration.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The unique identifier of the display configuration whose locations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="DisplayConfigLocationDto"/> objects for the specified display configuration.</returns>
|
||||
/// <!-- aidoc:v1 sig=89491e6 -->
|
||||
Task<List<DisplayConfigLocationDto>> GetDisplayConfigLocations(ObjectId displayConfigId);
|
||||
/// <summary>
|
||||
/// Asynchronously determines whether the specified display configuration is currently in use.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The identifier of the display configuration to check.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the display configuration is in use; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=387c518 -->
|
||||
Task<bool> IsDisplayConfigInUse(ObjectId displayConfigId);
|
||||
/// <summary>
|
||||
/// Deletes display records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose displays should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=6bb1d75 -->
|
||||
Task DeleteDisplaysByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public interface IFileService
|
||||
/// </summary>
|
||||
/// <param name="files">The collection of update files to be copied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the copy operation succeeded.</returns>
|
||||
/// <!-- aidoc:v1 sig=53643ff -->
|
||||
Task<bool> CopyUpdateFiles(ICollection<IFormFile> files);
|
||||
/// <summary>
|
||||
/// Uploads the provided asset files categorized by the specified theme, returning a value indicating whether the operation completed successfully.
|
||||
@@ -20,12 +21,14 @@ public interface IFileService
|
||||
/// <param name="files">The collection of uploaded form files to process and store as assets.</param>
|
||||
/// <param name="themeParse">The asset theme used to classify and organize the uploaded files.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the asset files were uploaded successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=1b9d2d8 -->
|
||||
Task<bool> UploadAssetFiles(ICollection<IFormFile> files, FileEnum.AssetTheme themeParse);
|
||||
/// <summary>
|
||||
/// Retrieves all asset files for the specified asset theme as a list of asset data transfer objects.
|
||||
/// </summary>
|
||||
/// <param name="themeParse">The asset theme used to retrieve the corresponding assets.</param>
|
||||
/// <returns>A <see cref="List{AssetDto}"/> containing the asset data transfer objects for the specified theme.</returns>
|
||||
/// <!-- aidoc:v1 sig=26bd29d -->
|
||||
List<AssetDto> GetAllAssetFile(FileEnum.AssetTheme themeParse);
|
||||
|
||||
/// <summary>
|
||||
@@ -33,5 +36,6 @@ public interface IFileService
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">The path of the directory from which to retrieve the files.</param>
|
||||
/// <returns>A list of strings representing the names of the files in the specified directory.</returns>
|
||||
/// <!-- aidoc:v1 sig=491d1e8 -->
|
||||
List<string> GetFilesInDirectory(string directoryPath);
|
||||
}
|
||||
@@ -16,6 +16,8 @@ public interface IGroupedObservationService
|
||||
/// <param name="cacheIsChecked">Indicates whether the cache should be consulted before generating the result. Defaults to <c>false</c>.</param>
|
||||
/// <param name="ct">The cancellation token used to cancel the operation.</param>
|
||||
/// <returns>A task that represents the asynchronous generation, producing the resulting <see cref="GroupedObservation"/>.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_param_role
|
||||
/// "Documented default value for timeZoneId has a typo: 'Romence Standard Time' should be 'Romance Standard Time' to match the code" -->
|
||||
Task<GroupedObservation> GenerateGroupedObservation(ObjectId id, GroupedField groupedField,
|
||||
string timeZoneId = "Romance Standard Time", bool cacheIsChecked = false, CancellationToken ct = default);
|
||||
|
||||
@@ -30,6 +32,7 @@ public interface IGroupedObservationService
|
||||
/// <param name="obs">The patient observation to be processed and grouped.</param>
|
||||
/// <param name="timeZoneId">The time zone identifier used when computing date and time values for the grouped observation. Defaults to "Romance Standard Time".</param>
|
||||
/// <returns>A <see cref="Task{GroupedObservation}"/> that resolves to the generated grouped observation for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=3672d15 -->
|
||||
Task<GroupedObservation> GenerateGroupedObservation(ObjectId obsPatientId, GroupedField groupedField,
|
||||
List<GroupedObservation.GroupedObservationObs> wsgLastGroupedObservationObs, PatientObservation obs,
|
||||
string timeZoneId = "Romance Standard Time");
|
||||
@@ -41,6 +44,7 @@ public interface IGroupedObservationService
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 2.</param>
|
||||
/// <param name="filterObservations">An optional list of observation names to include; if null, all observation types are considered.</param>
|
||||
/// <returns>A task that resolves to a list of the most recent <see cref="PatientObservation"/> entries for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=40372b5 -->
|
||||
Task<List<PatientObservation>> FindLastObservations(ObjectId patientId, int num = 2,
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
@@ -49,6 +53,7 @@ public interface IGroupedObservationService
|
||||
/// </summary>
|
||||
/// <param name="ws">The grouped web service subscriber for which the next empty observation is created.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the newly created <see cref="GroupedObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d148522 -->
|
||||
Task<GroupedObservation> CreateNextEmptyObs(WsSubscriberGrouped ws);
|
||||
/*
|
||||
*
|
||||
|
||||
@@ -10,6 +10,7 @@ public interface IHistoricalConfigChangesService
|
||||
/// Asynchronously retrieves all historical configuration changes recorded in the system.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of all <see cref="HistoricalConfigChanges"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=89e2dae -->
|
||||
Task<ICollection<HistoricalConfigChanges>> GetAll();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a historical configuration change entry by its unique identifier.
|
||||
@@ -17,6 +18,7 @@ public interface IHistoricalConfigChangesService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the historical configuration change to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="HistoricalConfigChanges"/> or null if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4bce1e5 -->
|
||||
Task<HistoricalConfigChanges?> Get(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of historical configuration changes filtered by the specified configuration type.
|
||||
@@ -24,6 +26,7 @@ public interface IHistoricalConfigChangesService
|
||||
/// <param name="type">The configuration type used to filter the historical changes.</param>
|
||||
/// <param name="num">The maximum number of historical change records to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="HistoricalConfigChanges"/> for the specified type.</returns>
|
||||
/// <!-- aidoc:v1 sig=984ce5a -->
|
||||
Task<ICollection<HistoricalConfigChanges>> GetByType(DisplayConfigEnums.ConfigTypes type, int num);
|
||||
|
||||
/// <summary>
|
||||
@@ -34,6 +37,7 @@ public interface IHistoricalConfigChangesService
|
||||
/// <param name="configTypes">The optional configuration type used to filter the results; if null, changes for all configuration types are returned.</param>
|
||||
/// <param name="num">The maximum number of historical configuration change records to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of historical configuration changes matching the specified criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=ceca012 -->
|
||||
Task<ICollection<HistoricalConfigChanges>> GetByUser(string user, DisplayConfigEnums.ConfigTypes? configTypes,
|
||||
int num);
|
||||
|
||||
@@ -43,6 +47,7 @@ public interface IHistoricalConfigChangesService
|
||||
/// </summary>
|
||||
/// <param name="configTypes">The configuration type used to look up the most recent historical changes.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the last <see cref="HistoricalConfigChanges"/> for the specified type, or null if no changes are available.</returns>
|
||||
/// <!-- aidoc:v1 sig=899c410 -->
|
||||
Task<HistoricalConfigChanges?> FindLastConfigChanges(DisplayConfigEnums.ConfigTypes configTypes);
|
||||
|
||||
|
||||
@@ -52,18 +57,21 @@ public interface IHistoricalConfigChangesService
|
||||
/// </summary>
|
||||
/// <param name="historicalConfigChanges">The historical configuration change entity to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the inserted <see cref="HistoricalConfigChanges"/> entity, or null if the insertion did not produce a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=ae5c68c -->
|
||||
Task<HistoricalConfigChanges?> InsertOne(HistoricalConfigChanges historicalConfigChanges);
|
||||
/// <summary>
|
||||
/// Updates an existing historical configuration change record with the provided data and returns the updated entity.
|
||||
/// </summary>
|
||||
/// <param name="historicalConfigChanges">The historical configuration change entity containing the updated values to be persisted.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="HistoricalConfigChanges"/>, or <c>null</c> if the record was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=f875ebb -->
|
||||
Task<HistoricalConfigChanges?> UpdateHistoricalConfigChange(HistoricalConfigChanges historicalConfigChanges);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a historical configuration change identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the historical configuration change to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=b0535af -->
|
||||
Task DeleteHistoricalConfigChange(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -73,5 +81,6 @@ public interface IHistoricalConfigChangesService
|
||||
/// <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=6dd04c6 -->
|
||||
Task LogConfigChanged(string user, DisplayConfigEnums.ConfigTypes configType, string newConfig, string oldConfig);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ public interface ILightBeaconService
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of control that targets the light beacon.</param>
|
||||
/// <param name="color">The color to apply to the light beacon.</param>
|
||||
/// <!-- aidoc:v1 sig=4279fa1 -->
|
||||
Task SendColor(ObjectId pocId, LightBeaconColor color);
|
||||
/// <summary>
|
||||
/// Sends a color command to the light beacon of the specified point of care device,
|
||||
@@ -22,34 +23,41 @@ public interface ILightBeaconService
|
||||
/// <param name="pocId">The identifier of the point of care device whose light beacon will be updated.</param>
|
||||
/// <param name="color">The color to apply to the light beacon.</param>
|
||||
/// <returns>A task that represents the asynchronous color send operation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_param_role
|
||||
/// "pocId is documented as 'The identifier of the point of care device' but the parameter type is PointOfCare, a full object, not an identifier." -->
|
||||
Task SendColor(PointOfCare pocId, LightBeaconColor color);
|
||||
/// <summary>
|
||||
/// Sends a light beacon broadcast for the specified point of care, setting the beacon to display the specified color.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care device or location whose beacon will be updated.</param>
|
||||
/// <param name="color">The color to display on the light beacon.</param>
|
||||
/// <!-- aidoc:v1 sig=7a336c8 -->
|
||||
Task SendBeaconBroadcast(PointOfCare poc, LightBeaconColor color);
|
||||
/// <summary>
|
||||
/// Sends a broadcast signal to the beacon associated with the specified point of care identifier using the given beacon color.
|
||||
/// </summary>
|
||||
/// <param name="poc">The identifier of the point of care (or beacon) that will receive the broadcast.</param>
|
||||
/// <param name="color">The color of the light beacon used for the broadcast.</param>
|
||||
/// <!-- aidoc:v1 sig=4fec682 -->
|
||||
Task SendBeaconBroadcast(ObjectId poc, LightBeaconColor color);
|
||||
/// <summary>
|
||||
/// Asynchronously powers off the LED associated with the specified point of connection identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of connection whose LED will be turned off.</param>
|
||||
/// <!-- aidoc:v1 sig=bde6341 -->
|
||||
Task PowerOffLed(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Asynchronously powers off the LED indicator associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care whose LED indicator should be turned off.</param>
|
||||
/// <!-- aidoc:v1 sig=ce5eefc -->
|
||||
Task PowerOffLed(PointOfCare poc);
|
||||
|
||||
/// <summary>
|
||||
/// Generates a color-coded alert based on the provided patient observation.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation used to determine the alert level and color.</param>
|
||||
/// <!-- aidoc:v1 sig=5f77447 -->
|
||||
void GenerateColorAlert(PatientObservation obs);
|
||||
|
||||
//TODO refactor, one patient can have multiple beacons
|
||||
@@ -58,12 +66,14 @@ public interface ILightBeaconService
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of care whose light beacon color is being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="LightBeaconColor"/> for the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=0f47559 -->
|
||||
public Task<LightBeaconColor> GetColor(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the light beacon color associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care for which to look up the light beacon color.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="LightBeaconColor"/> for the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=2bcbc4b -->
|
||||
public Task<LightBeaconColor> GetColor(PointOfCare poc);
|
||||
/// <summary>
|
||||
/// Updates a single light beacon record in the data store.
|
||||
@@ -71,23 +81,27 @@ public interface ILightBeaconService
|
||||
/// </summary>
|
||||
/// <param name="beacon">The light beacon containing the updated values to persist.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="LightBeacon"/>, or <see langword="null"/> if no matching beacon was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=dea8894 -->
|
||||
Task<LightBeacon?> UpdateOne(LightBeacon beacon);
|
||||
/// <summary>
|
||||
/// Inserts a single light beacon into the data store.
|
||||
/// </summary>
|
||||
/// <param name="beacon">The light beacon entity to insert.</param>
|
||||
/// <returns>A task that resolves to the inserted <see cref="LightBeacon"/>, or <c>null</c> when no result is produced.</returns>
|
||||
/// <!-- aidoc:v1 sig=e90c40d -->
|
||||
Task<LightBeacon?> InsertOne(LightBeacon beacon);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a paginated collection of light beacons based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing the criteria used to page the beacon results.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a pagination response with the requested light beacons.</returns>
|
||||
/// <!-- aidoc:v1 sig=91c5832 -->
|
||||
Task<PaginationResponse<LightBeacon>> GetPaginatedBeacons(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Asynchronously searches for light beacons by name using the specified search text.
|
||||
/// </summary>
|
||||
/// <param name="textToSearch">The text used to search for matching light beacons by name.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="LightBeacon"/> objects matching the search criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=2c88e45 -->
|
||||
Task<List<LightBeacon>> GetSearchByName(string textToSearch);
|
||||
}
|
||||
@@ -12,11 +12,13 @@ public interface ILocalAuditService
|
||||
/// <param name="dataModified">The modified state of the data after the change. May be null when the action deletes an existing record.</param>
|
||||
/// <param name="reason">An optional explanation or justification for the change. Defaults to null when no reason is provided.</param>
|
||||
/// <returns>A task that represents the asynchronous creation of the audit log entry.</returns>
|
||||
/// <!-- aidoc:v1 sig=f137579 -->
|
||||
Task CreateAuditLogAsync(ClaimsPrincipal? user, object? dataOriginal, object? dataModified, string? reason = null);
|
||||
/// <summary>
|
||||
/// Asynchronously creates a deep copy of the specified data, producing a new independent instance of the same type.
|
||||
/// </summary>
|
||||
/// <param name="data">The data instance to be deep copied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the deep-copied instance of type <typeparamref name="T"/>, or <c>null</c> if the copy could not be produced.</returns>
|
||||
/// <!-- aidoc:v1 sig=a6d959a -->
|
||||
Task<T?> DeepCopyAsync<T>(T data);
|
||||
}
|
||||
@@ -10,11 +10,14 @@
|
||||
/// <summary>
|
||||
/// Intenta adquirir el lock para una clave dentro del timeout.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_returns
|
||||
/// "The method returns Task<bool> indicating whether the lock was acquired, but the documentation does not describe the return value." -->
|
||||
Task<bool> AcquireAsync(string key, TimeSpan timeout);
|
||||
|
||||
/// <summary>
|
||||
/// Libera el lock para la clave (idempotente).
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5956b6c -->
|
||||
Task ReleaseAsync(string key);
|
||||
}
|
||||
}
|
||||
@@ -13,17 +13,20 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// Asynchronously retrieves the complete master list of items of type <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{T}"/> with all items from the master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=bbf098e -->
|
||||
Task<IEnumerable<T>> GetAllMasterList();
|
||||
/// <summary>
|
||||
/// Retrieves all master list entries, excluding items categorized as options.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="MasterListDto"/> items representing the master list without options.</returns>
|
||||
/// <!-- aidoc:v1 sig=53f27dd -->
|
||||
Task<IEnumerable<MasterListDto>> GetAllMasterListWithoutOptions();
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of master list items with their associated options based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing paging criteria such as page number and page size.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of <see cref="MasterListWithPaginatedOptionsDto"/> items for the requested page.</returns>
|
||||
/// <!-- aidoc:v1 sig=576fdd0 -->
|
||||
Task<IEnumerable<MasterListWithPaginatedOptionsDto>> GetAllMasterListWithPaginatedOptions(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Retrieves a master list entry identified by the specified <paramref name="id"/>, optionally resolving localized content based on the provided <paramref name="locale"/>. Returns <c>null</c> when no matching entry is found.
|
||||
@@ -31,6 +34,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="id">The unique identifier of the master list entry to retrieve.</param>
|
||||
/// <param name="locale">The optional locale used to resolve localized fields; when <c>null</c>, a default or non-localized representation is returned.</param>
|
||||
/// <returns>A task that resolves to the matching master list entry of type <typeparamref name="T"/>, or <c>null</c> if the entry does not exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=fab0bce -->
|
||||
Task<T?> GetMasterListById(ObjectId id, LocaleEnum? locale);
|
||||
|
||||
/// <summary>
|
||||
@@ -40,6 +44,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="id">The unique identifier of the master list to retrieve.</param>
|
||||
/// <param name="request">The pagination filter used to control the paginated options returned with the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="MasterListWithPaginatedOptionsDto"/> if a matching master list is found, otherwise null.</returns>
|
||||
/// <!-- aidoc:v1 sig=46550b5 -->
|
||||
Task<MasterListWithPaginatedOptionsDto?> GetMasterListByIdWithPaginatedOptions(ObjectId id,
|
||||
PaginationFilter request);
|
||||
|
||||
@@ -48,6 +53,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list whose option names are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of option names for the specified master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=5b1bec6 -->
|
||||
Task<List<string>> GetMasterListOptionsNamesById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves a master list of <see cref="OptionList"/> entries filtered by the specified identifier and an optional text search criterion.
|
||||
@@ -55,6 +61,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="id">The unique identifier used to scope the master list lookup.</param>
|
||||
/// <param name="textSearch">An optional text string used to further filter the results; may be <c>null</c> to return all matching entries.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="OptionList"/> items matching the provided identifier and text search.</returns>
|
||||
/// <!-- aidoc:v1 sig=b1e3b91 -->
|
||||
Task<List<OptionList>> GetMasterListByIdAndTextSearch(ObjectId id, string? textSearch);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a master list of options associated with the specified identifier, applying the provided search and filter criteria.
|
||||
@@ -62,29 +69,34 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="id">The identifier used to locate the master list to retrieve.</param>
|
||||
/// <param name="filterOption">The filter and search options used to refine the returned list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="OptionList"/> entries that match the specified id and filter options.</returns>
|
||||
/// <!-- aidoc:v1 sig=74ffbb0 -->
|
||||
Task<List<OptionList>> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement filterOption);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a master list that matches the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is the matching master list of type <typeparamref name="T"/>, or <c>null</c> if no master list with the specified name is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=f88b34e -->
|
||||
Task<T?> GetMasterListByName(string name);
|
||||
/// <summary>
|
||||
/// Inserts the specified item into the master list and returns the resulting entry, or <c>null</c> if the operation did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to insert into the master list.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the inserted item, or <c>null</c> when no result is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=56ebb96 -->
|
||||
Task<T?> InsertMasterList(T item);
|
||||
/// <summary>
|
||||
/// Updates the master list with the specified item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to be updated in the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the updated item or <c>null</c> if the update could not be performed.</returns>
|
||||
/// <!-- aidoc:v1 sig=4dd0c3c -->
|
||||
Task<T?> UpdateMasterList(T item);
|
||||
/// <summary>
|
||||
/// Deletes a master list identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=5af7c2c -->
|
||||
Task DeleteMasterListById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Adds the specified option element to the master option list identified by the given identifier.
|
||||
@@ -92,6 +104,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="id">The unique identifier of the master option list to which the option will be added.</param>
|
||||
/// <param name="opt">The filter option list element to append to the master list.</param>
|
||||
/// <returns>A task that returns the updated <see cref="OptionList"/>, or <c>null</c> if the master list could not be found.</returns>
|
||||
/// <!-- aidoc:v1 sig=07eea1e -->
|
||||
Task<OptionList?> AddOptionToMasterList(ObjectId id, FilterOptionListElement opt);
|
||||
/// <summary>
|
||||
/// Updates an option in a master list, localized for the specified locale, and returns the updated option list.
|
||||
@@ -101,6 +114,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="typeName">The name of the master list type that owns the option.</param>
|
||||
/// <param name="locale">The locale used to resolve or apply localized values.</param>
|
||||
/// <returns>A task that returns the updated <see cref="OptionList"/>, or <c>null</c> if the option could not be found.</returns>
|
||||
/// <!-- aidoc:v1 sig=cda7ccb -->
|
||||
Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName, LocaleEnum locale);
|
||||
/// <summary>
|
||||
/// Updates the full master list option identified by the specified identifier and type name.
|
||||
@@ -109,6 +123,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="opt">The option list containing the updated values.</param>
|
||||
/// <param name="typeName">The name of the type associated with the master list option.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="OptionList"/>, or <c>null</c> if the option was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6aed753 -->
|
||||
Task<OptionList?> UpdateFullMasterListOption(ObjectId id, OptionList opt, string typeName);
|
||||
/// <summary>
|
||||
/// Updates a master list option for the specified type with the provided option data.
|
||||
@@ -117,6 +132,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="opt">The option data to apply to the master list.</param>
|
||||
/// <param name="typeName">The name of the master list type containing the option.</param>
|
||||
/// <returns>The updated <see cref="OptionList"/>, or null if the option is not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=11de0a9 -->
|
||||
Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an option list item identified by the specified master ID, option ID, and locale.
|
||||
@@ -125,6 +141,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="optionId">The identifier of the specific option item to find.</param>
|
||||
/// <param name="locale">The locale used to retrieve the localized option item.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing 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>
|
||||
/// Updates the option details of a master list entry identified by the specified id.
|
||||
@@ -132,6 +149,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="id">The identifier of the master list entry to update.</param>
|
||||
/// <param name="opt">The master list details to apply to the entry.</param>
|
||||
/// <returns>A task that returns 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.
|
||||
@@ -139,6 +157,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="id">The 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 successfully updated; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=a2d47b2 -->
|
||||
Task<bool> UpdateMasterListName(ObjectId id, string name);
|
||||
/// <summary>
|
||||
/// Updates the description (name) of a master list entry identified by the specified identifier.
|
||||
@@ -146,6 +165,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="id">The unique identifier of the master list entry to update.</param>
|
||||
/// <param name="name">The new description to apply to the master list entry.</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>
|
||||
/// <!-- aidoc:v1 sig=8d9103c -->
|
||||
Task<bool> UpdateMasterListDescription(ObjectId id, string name);
|
||||
/// <summary>
|
||||
/// Asynchronously removes the specified option from the master list identified by the given id.
|
||||
@@ -153,17 +173,20 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="id">The identifier of the master list from which the option will be removed.</param>
|
||||
/// <param name="oldOpt">The option entry to be removed from the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the option was successfully removed; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=f049a15 -->
|
||||
Task<bool> RemoveMasterListOption(ObjectId id, OptionList oldOpt);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the total count of all items in the master list.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the total number of items in the master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=819b090 -->
|
||||
Task<int> GetAllMasterListCount();
|
||||
/// <summary>
|
||||
/// Retrieves a paginated master list of items based on the specified filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines paging parameters such as page number and page size.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response with the requested master list items.</returns>
|
||||
/// <!-- aidoc:v1 sig=836cb10 -->
|
||||
Task<PaginationResponse<T>> GetPaginatedMasterList(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a master list option identified by the supplied identifiers.
|
||||
@@ -172,6 +195,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="optId">The identifier of the specific option to remove from the master list.</param>
|
||||
/// <param name="typeName">The name of the master list type to which the option belongs.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the option was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=59b3577 -->
|
||||
Task<bool> DeleteMasterListOption(ObjectId id, ObjectId optId, string typeName);
|
||||
|
||||
/// <summary>
|
||||
@@ -180,6 +204,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="listFilter">The pagination filter applied to the master list results.</param>
|
||||
/// <param name="optionsFilter">The pagination filter applied to the associated options.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response with master list and options data.</returns>
|
||||
/// <!-- aidoc:v1 sig=95a8b2b -->
|
||||
Task<PaginationResponse<MasterListWithPaginatedOptionsDto>> GetPaginatedMasterListWithPaginatedOptions(
|
||||
PaginationFilter listFilter, PaginationFilter optionsFilter);
|
||||
|
||||
@@ -189,6 +214,7 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="filter">The pagination parameters used to control the page size and page index of the returned results.</param>
|
||||
/// <param name="listId">The identifier of the list whose options should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{OptionList}"/> with the requested options.</returns>
|
||||
/// <!-- aidoc:v1 sig=0df2157 -->
|
||||
Task<PaginationResponse<OptionList>> GetPaginatedOptions(PaginationFilter filter, ObjectId listId);
|
||||
/// <summary>
|
||||
/// Retrieves the associated list identifier for the given object based on the specified master list types.
|
||||
@@ -197,11 +223,13 @@ public interface IMasterListService<T> where T : MasterList
|
||||
/// <param name="masterListType1">The first master list type used to determine the association.</param>
|
||||
/// <param name="masterListType2">The second master list type used to determine the association.</param>
|
||||
/// <returns>A task that returns the associated <see cref="ObjectId"/> if found, or <c>null</c> if no association exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=6f6f775 -->
|
||||
Task<ObjectId?> GetAssociatedList(ObjectId id, MasterListType masterListType1, MasterListType masterListType2);
|
||||
/// <summary>
|
||||
/// Retrieves the available options associated with the specified list identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the list whose options are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of option strings for the specified list.</returns>
|
||||
/// <!-- aidoc:v1 sig=f43c75d -->
|
||||
Task<List<string>> GetOptionsOfList(ObjectId id);
|
||||
}
|
||||
@@ -15,12 +15,14 @@ public interface IMasterListServiceFactory
|
||||
/// A service object of type <paramref name="serviceType"/>, or <c>null</c> if there is no service
|
||||
/// object of that type registered.
|
||||
/// </returns>
|
||||
/// <!-- aidoc:v1 sig=8eed041 -->
|
||||
object GetService(Type serviceType);
|
||||
/// <summary>
|
||||
/// Retrieves a service instance from the master list based on the specified service name.
|
||||
/// </summary>
|
||||
/// <param name="serviceName">The <see cref="MasterListType"/> identifier used to look up the desired service.</param>
|
||||
/// <returns>An <see cref="object"/> representing the resolved service, or <see langword="null"/> if no matching service is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=14dc6e0 -->
|
||||
object GetService(MasterListType serviceName);
|
||||
/// <summary>
|
||||
/// Retrieves a typed representation of the specified <paramref name="masterList"/> based on the given <paramref name="masterListType"/>.
|
||||
@@ -28,12 +30,14 @@ public interface IMasterListServiceFactory
|
||||
/// <param name="masterListType">The type that determines how the master list should be converted or filtered.</param>
|
||||
/// <param name="masterList">The master list to be returned in a typed form.</param>
|
||||
/// <returns>A typed object representing the master list, or <c>null</c> if no matching type is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=c73cdf1 -->
|
||||
object? GetTypedMasterList(MasterListType masterListType, MasterList masterList);
|
||||
/// <summary>
|
||||
/// Gets the specific <see cref="Type"/> associated with the given master list type, mapping the master list category to its corresponding implementation type.
|
||||
/// </summary>
|
||||
/// <param name="masterListType">The master list type whose associated <see cref="Type"/> should be returned.</param>
|
||||
/// <returns>The <see cref="Type"/> that corresponds to the specified <paramref name="masterListType"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=c05f08e -->
|
||||
Type GetMasterListSpecificType(MasterListType masterListType);
|
||||
/// <summary>
|
||||
/// Inserts a new <see cref="MasterList"/> record based on the specified <paramref name="masterListType"/>.
|
||||
@@ -41,6 +45,7 @@ public interface IMasterListServiceFactory
|
||||
/// <param name="masterListType">The type of master list to insert.</param>
|
||||
/// <param name="masterList">The master list entity to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation. The result contains the inserted master list data, or <c>null</c> if the insert was not successful.</returns>
|
||||
/// <!-- aidoc:v1 sig=a5d5b54 -->
|
||||
Task<object?> InsertMasterList(MasterListType masterListType, MasterList masterList);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing master list entry based on the specified master list type and master list data.
|
||||
@@ -48,6 +53,7 @@ public interface IMasterListServiceFactory
|
||||
/// <param name="masterListType">The type of master list to update, used to determine the target list or category.</param>
|
||||
/// <param name="masterList">The master list entity containing the updated data to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The result is an object containing the updated master list information, or <c>null</c> if no matching record was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6dbb193 -->
|
||||
Task<object?> UpdateMasterList(MasterListType masterListType, MasterList masterList);
|
||||
/// <summary>
|
||||
/// Retrieves a master list entry by its identifier and type, optionally filtered by the specified data locale.
|
||||
@@ -56,11 +62,13 @@ public interface IMasterListServiceFactory
|
||||
/// <param name="masterListId">The unique identifier of the master list entry to retrieve.</param>
|
||||
/// <param name="dataLocale">The optional locale used to resolve localized data; when null, no locale filtering is applied.</param>
|
||||
/// <returns>A task that yields the matching master list entry as an object, or null if no entry is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=edcfcb0 -->
|
||||
Task<object?> GetMasterListById(MasterListType masterListType, ObjectId masterListId, LocaleEnum? dataLocale);
|
||||
/// <summary>
|
||||
/// Retrieves a list of nurse observation entries as string values.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="List{T}"/> of <see cref="string"/> containing the nurse observation data.</returns>
|
||||
/// <!-- aidoc:v1 sig=1c82859 -->
|
||||
List<string> StringNurseObs();
|
||||
/// <summary>
|
||||
/// Retrieves a translated <see cref="Patient"/> based on the provided <paramref name="unit"/> and <paramref name="locale"/>.
|
||||
@@ -70,6 +78,7 @@ public interface IMasterListServiceFactory
|
||||
/// <param name="locale">The target locale for the translation. May be <c>null</c>.</param>
|
||||
/// <param name="patient">The patient to be translated. May be <c>null</c>.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the translated <see cref="Patient"/>, or <c>null</c> if no translation is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=096dcea -->
|
||||
Task<Patient?> GetPatientTraslated(Unit? unit, LocaleEnum? locale, Patient? patient);
|
||||
|
||||
/// <summary>
|
||||
@@ -81,6 +90,7 @@ public interface IMasterListServiceFactory
|
||||
/// <param name="masterListOptionId">The identifier of the master list option to retrieve.</param>
|
||||
/// <param name="dataLocale">The optional locale used to localize the returned option data.</param>
|
||||
/// <returns>A task that yields the matching master list option as an <see cref="object"/>, or <see langword="null"/> if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=2952bb7 -->
|
||||
Task<object?> GetMasterListOptionById(MasterListType masterListType, ObjectId masterListId,
|
||||
ObjectId masterListOptionId,
|
||||
LocaleEnum? dataLocale);
|
||||
|
||||
@@ -13,83 +13,98 @@ public interface IMedicineService
|
||||
/// </summary>
|
||||
/// <param name="code">The unique code used to look up the medicine.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="Medicine"/> or <c>null</c> if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=92ecf01 -->
|
||||
Task<Medicine?> GetByCode(string code);
|
||||
/// <summary>
|
||||
/// Retrieves a list of medicines that match the provided codes or notes.
|
||||
/// </summary>
|
||||
/// <param name="codeNote">A list of strings representing the codes or notes used to look up medicines.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Medicine"/> objects matching the provided codes or notes.</returns>
|
||||
/// <!-- aidoc:v1 sig=14e1a2b -->
|
||||
Task<List<Medicine>> GetByCodeOrNote(List<string> codeNote);
|
||||
/// <summary>
|
||||
/// Retrieves a medicine by its name, returning null if no matching medicine is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the medicine to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="Medicine"/> or null if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a835f90 -->
|
||||
Task<Medicine?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves the medicines associated with the specified patient treatments.
|
||||
/// </summary>
|
||||
/// <param name="treatments">The collection of patient treatments, which may include null entries, whose medicines are to be obtained.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of medicines linked to the provided treatments.</returns>
|
||||
/// <!-- aidoc:v1 sig=f7f9499 -->
|
||||
Task<IEnumerable<Medicine>> GetMedicinesOfTreatments(IEnumerable<PatientTreatment?> treatments);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of active medicines associated with the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active medicines are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of active <see cref="Medicine"/> records for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=60d4b58 -->
|
||||
Task<IEnumerable<Medicine>> GetActiveMedicinesByPatient(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of medicines based on the provided filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing page size, page number, and optional search criteria.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{T}"/> with the requested <see cref="Medicine"/> items and pagination metadata.</returns>
|
||||
/// <!-- aidoc:v1 sig=719bac1 -->
|
||||
Task<PaginationResponse<Medicine>> GetPaginatedMedicines(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all medicines from the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="Medicine"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=84b2421 -->
|
||||
Task<List<Medicine>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a medicine by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique identifier of the medicine to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Medicine"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=a87fd1e -->
|
||||
Task<Medicine?> GetMedicineById(ObjectId medicineId);
|
||||
/// <summary>
|
||||
/// Asynchronously posts a new medicine and returns the created medicine, or null if the operation fails.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity to be posted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the posted <see cref="Medicine"/>, or null if the medicine could not be posted.</returns>
|
||||
/// <!-- aidoc:v1 sig=9decc93 -->
|
||||
Task<Medicine?> PostMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Updates an existing medicine in the data store and returns the updated entity, or <c>null</c> if no matching medicine was found.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity containing the updated values to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The result is the updated <see cref="Medicine"/> when the update succeeds, or <c>null</c> when the medicine does not exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=2ae8490 -->
|
||||
Task<Medicine?> UpdateMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Deletes a medicine record identified by 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>
|
||||
/// Asynchronously retrieves all available types as a list of string identifiers.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of type identifiers.</returns>
|
||||
/// <!-- aidoc:v1 sig=c476963 -->
|
||||
Task<List<string>> GetAllTypes();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available groups, returning their identifiers or names as a list of strings.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of strings representing all groups.</returns>
|
||||
/// <!-- aidoc:v1 sig=060fe47 -->
|
||||
Task<List<string>> GetAllGroups();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available names.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all names.</returns>
|
||||
/// <!-- aidoc:v1 sig=24a3647 -->
|
||||
Task<List<string>> GetAllNames();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the complete list of available codes from the data source.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of code strings.</returns>
|
||||
/// <!-- aidoc:v1 sig=9b0f08a -->
|
||||
Task<List<string>> GetAllCodes();
|
||||
}
|
||||
@@ -11,11 +11,13 @@ public interface INoticeService
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=d29db0d -->
|
||||
Task DeleteNoticeAsync(Notice notice);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a notice identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="noticeId">The unique identifier of the notice to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=d491033 -->
|
||||
Task DeleteNoticeByIdAsync(ObjectId noticeId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Notice"/> entity by its unique identifier from the data store.
|
||||
@@ -23,6 +25,7 @@ public interface INoticeService
|
||||
/// </summary>
|
||||
/// <param name="noticeId">The <see cref="ObjectId"/> that uniquely identifies the notice to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> containing the matching <see cref="Notice"/>, or <see langword="null"/> if no notice is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=ed98d3c -->
|
||||
Task<Notice?> GetNoticeByIdAsync(ObjectId noticeId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of notices filtered by the specified notice type.
|
||||
@@ -30,37 +33,44 @@ public interface INoticeService
|
||||
/// </summary>
|
||||
/// <param name="noticeType">The type of notice to filter by.</param>
|
||||
/// <returns>A task containing an enumerable of matching <see cref="Notice"/> objects, or null if none are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=532654c -->
|
||||
Task<IEnumerable<Notice>?> GetNoticeByTypeAsync(string noticeType);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of notices.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of <see cref="Notice"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=d3b0c51 -->
|
||||
Task<IEnumerable<Notice>> GetNoticesAsync();
|
||||
/// <summary>
|
||||
/// Inserts a new notice into the data store.
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the inserted <see cref="Notice"/>, or <c>null</c> if the notice could not be inserted.</returns>
|
||||
/// <!-- aidoc:v1 sig=9bc91b1 -->
|
||||
Task<Notice?> InsertNotice(Notice notice);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing notice in the system.
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice entity containing the updated information to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=a1ae02b -->
|
||||
Task UpdateNoticeAsync(Notice notice);
|
||||
/// <summary>
|
||||
/// Persists the provided API request to the data store.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
/// <!-- aidoc:v1 sig=274a023 -->
|
||||
Task SaveRequest(ApiRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Asynchronously persists the specified API request.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to save.</param>
|
||||
/// <!-- aidoc:v1 sig=24f178e -->
|
||||
Task SaveRequestAsync(ApiRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of notices associated with the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayId">The identifier of the display whose notices should be retrieved.</param>
|
||||
/// <returns>A task that returns the notices for the display, or <c>null</c> when no notices are found for the given display.</returns>
|
||||
/// <!-- aidoc:v1 sig=9e0ab44 -->
|
||||
Task<IEnumerable<Notice>?> GetNoticesByDisplayId(ObjectId displayId);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public interface IObservationDemoService
|
||||
/// <param name="patient">The patient for whom the observations are being generated.</param>
|
||||
/// <param name="dataFields">The collection of fields used to drive the observation generation.</param>
|
||||
/// <returns>A task representing the asynchronous operation that returns the list of generated patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=4891e1c -->
|
||||
Task<List<PatientObservation>> GenerateObservationByField(Patient patient, List<Field> dataFields);
|
||||
/// <summary>
|
||||
/// Generates a grouped observation for the specified patient based on the provided grouped field configuration.
|
||||
@@ -19,6 +20,7 @@ public interface IObservationDemoService
|
||||
/// <param name="patient">The patient for whom the grouped observation is generated.</param>
|
||||
/// <param name="groupedField">The grouped field definition that determines the grouping criteria for the observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the generated <see cref="GroupedObservation"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=7c0b714 -->
|
||||
Task<GroupedObservation> GenerateGroupedObservation(Patient patient, GroupedField groupedField);
|
||||
/// <summary>
|
||||
/// Generates a list of patient observation alarms for the specified patient based on the provided data alarm fields.
|
||||
@@ -26,5 +28,6 @@ public interface IObservationDemoService
|
||||
/// <param name="patient">The patient for whom the observation alarms are generated.</param>
|
||||
/// <param name="dataAlarmfields">The list of fields used to determine and generate the data alarms.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservationAlarm"/> objects generated for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=f61d9a3 -->
|
||||
Task<List<PatientObservationAlarm>> GenerateAlarmByField(Patient patient, List<Field> dataAlarmfields);
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are to be retrieved.</param>
|
||||
/// <returns>A task that returns an <see cref="IAsyncCursor{TDocument}"/> of <see cref="PatientObservation"/> instances for the given patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=39ad19b -->
|
||||
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAsync(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
@@ -28,6 +29,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <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 by.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an <see cref="IAsyncCursor{TDocument}"/> of <see cref="PatientObservation"/> matching the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=d7bdee5 -->
|
||||
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAndCodingSystemAsync(ObjectId patientId, string codingSystem,
|
||||
string name);
|
||||
|
||||
@@ -38,6 +40,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="num">The maximum number of most recent observations to return. Defaults to 2.</param>
|
||||
/// <param name="filterObservations">An optional list of observation codes used to restrict the result set; if null, observations are not filtered by code.</param>
|
||||
/// <returns>A task that resolves to a list of the most recent <see cref="PatientObservation"/> entries matching the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=40372b5 -->
|
||||
Task<List<PatientObservation>> FindLastObservations(ObjectId patientId, int num = 2,
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
@@ -45,14 +48,17 @@ public interface IObservationService : IApiRequestService
|
||||
/// Updates the status of the provided patient observations that have reached their expiration.
|
||||
/// </summary>
|
||||
/// <param name="expiredObservations">The list of patient observations to update as expired.</param>
|
||||
/// <!-- aidoc:v1 sig=e7ed4fa -->
|
||||
Task UpdateExpiredObservations(List<PatientObservation> expiredObservations);
|
||||
/// <summary>
|
||||
/// Asynchronously expires observations that are no longer valid and recalculates the dependent data.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=209fa1b -->
|
||||
Task ExpireObservationsAndRecalculateAsync();
|
||||
/// <summary>
|
||||
/// Asynchronously expires active alerts and powers off the device.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=db747c2 -->
|
||||
Task ExpireAlertsAndPowerOffAsync();
|
||||
|
||||
/// <summary>
|
||||
@@ -62,6 +68,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="name">The name of the observation to filter by.</param>
|
||||
/// <param name="expires">Optional expiration time in seconds applied to the cached results. If <c>null</c>, no expiration is applied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of the latest unique <see cref="PatientObservation"/> values matching the specified patient and name.</returns>
|
||||
/// <!-- aidoc:v1 sig=cd1a09e -->
|
||||
Task<List<PatientObservation>> FindLatestUniqueValuesByName(ObjectId patientId, string name, int? expires);
|
||||
|
||||
/// <summary>
|
||||
@@ -72,6 +79,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="mapped">Indicates whether the returned observations should be mapped (default true) or returned in their raw form.</param>
|
||||
/// <param name="ct">The cancellation token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that resolves to a list of the patient's most recent <see cref="PatientObservation"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=5966f87 -->
|
||||
Task<List<PatientObservation>> FindLastObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations = null, bool mapped = true, CancellationToken ct = default);
|
||||
|
||||
@@ -80,6 +88,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose intravenous line observations are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of nullable <see cref="PatientObservation"/> entries representing the latest intravenous line observations by location, where individual entries may be <c>null</c> when no data is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=b696654 -->
|
||||
Task<List<PatientObservation?>> FindLastIntravenousLinesObservationByLocation(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a patient observation, with options to control whether the observation is persisted and whether it is mapped.
|
||||
@@ -87,6 +96,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="patientObservation">The patient observation to insert.</param>
|
||||
/// <param name="persistObs">Indicates whether the observation should be persisted; defaults to <c>true</c>.</param>
|
||||
/// <param name="mapObs">Indicates whether the observation should be mapped; defaults to <c>true</c>.</param>
|
||||
/// <!-- aidoc:v1 sig=f65b171 -->
|
||||
Task InsertObservation(PatientObservation patientObservation, bool persistObs = true, bool mapObs = true);
|
||||
/// <summary>
|
||||
/// Inserts the specified patient observation only if it has changed, optionally persisting the observation and applying a mapping during the insert.
|
||||
@@ -96,22 +106,26 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="persistObs">Indicates whether the observation should be persisted when it is inserted. Defaults to <c>true</c>.</param>
|
||||
/// <param name="mapObs">Indicates whether the observation should be mapped as part of the insert operation. Defaults to <c>true</c>.</param>
|
||||
/// <returns>A task that returns <c>true</c> if the observation was inserted because a change was detected; otherwise, <c>false</c> if no insert was performed.</returns>
|
||||
/// <!-- aidoc:v1 sig=2d74a4d -->
|
||||
Task<bool> InsertIfChanged(string name, PatientObservation observation, bool persistObs = true, bool mapObs = true);
|
||||
/// <summary>
|
||||
/// Inserts a new nurse observation for a patient into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation data recorded by the nurse to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=cbc1b6e -->
|
||||
Task InsertNurseObservation(PatientObservation obs);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the patient whose related records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=d457cb9 -->
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the specified patient observation, preserving it for historical or compliance purposes while removing it from the active set.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation to archive.</param>
|
||||
/// <returns>A task that represents the asynchronous archive operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=44e255f -->
|
||||
Task Archive(PatientObservation observation);
|
||||
/// <summary>
|
||||
/// Asynchronously maps a <see cref="PatientObservation"/> to a corresponding observation, optionally restricting the lookup to name-based matching. Returns <see langword="null"/> when no matching observation is found.
|
||||
@@ -119,27 +133,32 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="obs">The source <see cref="PatientObservation"/> to be mapped.</param>
|
||||
/// <param name="onlyByName">When <see langword="true"/>, restricts the lookup to name-based matching; otherwise, the default mapping behavior is applied.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the mapped <see cref="PatientObservation"/>, or <see langword="null"/> if no match is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6377232 -->
|
||||
Task<PatientObservation?> MapObservation(PatientObservation obs, bool onlyByName = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent observation time for each patient, 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 latest observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=cbcaa4c -->
|
||||
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime();
|
||||
/// <summary>
|
||||
/// Asynchronously maps or looks up a <see cref="PatientObservation"/> based on the name of the provided observation, returning the matching observation or <c>null</c> when no match is found.
|
||||
/// </summary>
|
||||
/// <param name="obs">The <see cref="PatientObservation"/> whose name is used to perform the mapping or lookup.</param>
|
||||
/// <returns>A <see cref="Task{PatientObservation}"/> that resolves to the matching <see cref="PatientObservation"/>, or <c>null</c> if no corresponding observation is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a41fe3f -->
|
||||
Task<PatientObservation?> MapObservationsByName(PatientObservation obs);
|
||||
/// <summary>
|
||||
/// Archives the specified patient, moving their record out of the active set so that it is retained for historical or compliance purposes while no longer appearing in routine operational queries.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose record is to be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=52c2373 -->
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose records should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=e5916ec -->
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -147,6 +166,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=325f985 -->
|
||||
Task UpdateObservation(PatientObservation observation);
|
||||
/// <summary>
|
||||
/// Updates the specified identifier field (<paramref name="nameId"/>) across multiple objects, replacing the existing value <paramref name="oldId"/> with the new value <paramref name="id"/>.
|
||||
@@ -155,24 +175,28 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to assign to the field.</param>
|
||||
/// <param name="oldId">The current <see cref="ObjectId"/> value to be replaced.</param>
|
||||
/// <returns>A task that represents the asynchronous bulk update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously broadcasts a patient observation to subscribed listeners or endpoints.
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation to be broadcast.</param>
|
||||
/// <!-- aidoc:v1 sig=875526d -->
|
||||
Task SendObsBroadcast(BasePatientObservation obs);
|
||||
/// <summary>
|
||||
/// Sends a broadcast containing the specified patient observations to the given patient location.
|
||||
/// </summary>
|
||||
/// <param name="obs">The list of patient observations to include in the broadcast.</param>
|
||||
/// <param name="location">The target patient location that will receive the broadcast.</param>
|
||||
/// <!-- aidoc:v1 sig=eba4dc4 -->
|
||||
Task SendObsBroadcast(List<PatientObservation> obs, PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously sends a broadcast of patient observations to the specified Point of Care (POC) system.
|
||||
/// </summary>
|
||||
/// <param name="obs">The list of patient observations to be transmitted in the broadcast.</param>
|
||||
/// <param name="pocId">The identifier of the Point of Care system that will receive the observations.</param>
|
||||
/// <!-- aidoc:v1 sig=7b85a82 -->
|
||||
Task SendObsBroadcast(List<PatientObservation> obs, ObjectId pocId);
|
||||
|
||||
/// <summary>
|
||||
@@ -182,6 +206,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="date">The cutoff date; only observations recorded strictly before this date are considered.</param>
|
||||
/// <param name="obsName">The optional name of the observation to filter by, or <c>null</c> to match any observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the latest matching <see cref="PatientObservation"/>, or <c>null</c> if none was found before the given date.</returns>
|
||||
/// <!-- aidoc:v1 sig=9dd6e55 -->
|
||||
Task<PatientObservation?> FindLastBeforeDate(ObjectId patientId, DateTime date, string? obsName);
|
||||
|
||||
/// <summary>
|
||||
@@ -191,6 +216,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="date">The date used to match observations.</param>
|
||||
/// <param name="obsName">The optional observation name used to filter the results. When null, observations are not filtered by name.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of matching <see cref="PatientObservation"/> records, or null when no observations match the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=b609e73 -->
|
||||
Task<List<PatientObservation>?> FindAnyWithSameDate(ObjectId patientId, DateTime date, string? obsName);
|
||||
|
||||
//TODO To implement
|
||||
@@ -201,6 +227,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="date">The cutoff date; only observations recorded before this date will be returned.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to restrict the results to specific observation types. When null, all observation types are included.</param>
|
||||
/// <returns>A task that resolves to a list of PatientObservation instances matching the criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=1182280 -->
|
||||
Task<List<PatientObservation>> FindAllBeforeDate(ObjectId patientId, DateTime date,
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
@@ -212,6 +239,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="date">The cutoff date; only observations with a timestamp after this value are returned.</param>
|
||||
/// <param name="filterObservations">An optional list of observation names to restrict the result to. When <c>null</c> or empty, all observations after the date are returned.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that yields the list of matching <see cref="PatientObservation"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=793de04 -->
|
||||
Task<List<PatientObservation>> FindAllAfterDate(ObjectId patientId, DateTime date,
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
@@ -225,6 +253,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="fromArchived">When true, observations are retrieved from archived records; otherwise, only active records are considered.</param>
|
||||
/// <param name="filter">An optional pagination filter applied to the result set.</param>
|
||||
/// <returns>A task that resolves to a list of <see cref="PatientObservation"/> entries matching the provided criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=2f8c17f -->
|
||||
Task<List<PatientObservation>> FindAllBetweenDates(ObjectId patientId, DateTime? startDate, DateTime? endDate,
|
||||
List<string>? filterObservations = null, bool fromArchived = false, PaginationFilter? filter = null);
|
||||
|
||||
@@ -236,6 +265,7 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="endAfter">Optional parameter that defines the pagination boundary; when provided, observations are returned starting after this position.</param>
|
||||
/// <param name="num">Optional parameter that limits the maximum number of observations returned.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a collection of matching non-expired <see cref="PatientObservation"/> records; an empty collection is returned if none are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=ba8e6f1 -->
|
||||
Task<IEnumerable<PatientObservation>> FindLastNotExpiredObservatonsByPatient(ObjectId patientId, string name,
|
||||
int? endAfter = null, int? num = null);
|
||||
|
||||
@@ -243,12 +273,14 @@ public interface IObservationService : IApiRequestService
|
||||
/// <summary>
|
||||
/// Checks observations and expires those that meet the expiration criteria.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0d8befa -->
|
||||
Task CheckAndExpireObservations();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves patient observations that have not been marked as expired but should be, based on their validity period or business rules.
|
||||
/// </summary>
|
||||
/// <returns>An asynchronous stream of <see cref="PatientObservation"/> instances that are not expired but meet the criteria to be expired.</returns>
|
||||
/// <!-- aidoc:v1 sig=ef73cf5 -->
|
||||
IAsyncEnumerable<PatientObservation> FindNotExpiredObservationsShouldBeExpired();
|
||||
|
||||
|
||||
@@ -259,12 +291,14 @@ public interface IObservationService : IApiRequestService
|
||||
/// <param name="patient">The patient associated with the observations.</param>
|
||||
/// <param name="messageTime">The timestamp of the message containing the observations.</param>
|
||||
/// <param name="observationData">Optional additional data related to the observations.</param>
|
||||
/// <!-- aidoc:v1 sig=26ab597 -->
|
||||
void ProcessObservations(List<PatientObservation> observations, Patient patient, DateTime messageTime,
|
||||
ObservationData? observationData = null);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously processes and expires observations that have exceeded their validity period.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=386e4a2 -->
|
||||
Task ExpireObservations();
|
||||
|
||||
/// <summary>
|
||||
@@ -272,16 +306,19 @@ public interface IObservationService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=5bd41b8 -->
|
||||
Task InsertSimpleObservation(PatientObservation observation);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a paginated collection of patient observations based on the specified filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that controls the page size, page number, and any additional query criteria applied to the patient observations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{T}"/> of <see cref="PatientObservation"/> with the requested page of results.</returns>
|
||||
/// <!-- aidoc:v1 sig=55ee5d3 -->
|
||||
Task<PaginationResponse<PatientObservation>> GetPaginatedObservations(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously saves a nurse observation request.
|
||||
/// </summary>
|
||||
/// <param name="request">The API request containing the nurse observation data to save.</param>
|
||||
/// <!-- aidoc:v1 sig=bc3f3e7 -->
|
||||
Task SaveRequestNurseObsAsync(ApiRequest request);
|
||||
}
|
||||
@@ -11,34 +11,40 @@ public interface IPatientCarePlanService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose care plans are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> records for the given patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=6525ef9 -->
|
||||
Task<List<PatientCarePlan>> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves a 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 retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of patient care plans associated with the user.</returns>
|
||||
/// <!-- aidoc:v1 sig=150426f -->
|
||||
Task<List<PatientCarePlan>> FindByUserId(ObjectId userId);
|
||||
/// <summary>
|
||||
/// Retrieves all patient care plans from the system.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a list of all <see cref="PatientCarePlan"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=83af170 -->
|
||||
Task<List<PatientCarePlan>> FindAll();
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single patient care plan into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientCarePlan">The patient care plan to insert.</param>
|
||||
/// <!-- aidoc:v1 sig=0e9c8f0 -->
|
||||
Task InsertOneAsync(PatientCarePlan patientCarePlan);
|
||||
/// <summary>
|
||||
/// Archives the care plan associated with a finished procedure for the specified patient, processing the provided list of items to be archived.
|
||||
/// </summary>
|
||||
/// <param name="patientWithFinishedProcedure">The patient whose procedure has been completed and whose care plan should be archived.</param>
|
||||
/// <param name="itemsToArchive">The collection of option list items to be archived as part of the care plan archival process.</param>
|
||||
/// <!-- aidoc:v1 sig=7ddd7f6 -->
|
||||
Task ArchiveCarePlanFromJob(Patient patientWithFinishedProcedure, List<OptionList> itemsToArchive);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously archives records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientid">The unique identifier of the patient whose records are to be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=af2b0d3 -->
|
||||
Task ArchiveByPatientId(ObjectId patientid);
|
||||
/// <summary>
|
||||
/// Updates the ObjectId references from the specified old identifier to a new one across multiple records associated with the given patient.
|
||||
@@ -46,5 +52,7 @@ public interface IPatientCarePlanService
|
||||
/// <param name="patientid">The string identifier of the patient whose related records will be updated.</param>
|
||||
/// <param name="patientId">The ObjectId of the patient used to locate the records to update.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced in the matched records.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=stale_summary
|
||||
/// "Summary states the method updates references 'to a new one', but the method signature has no parameter for a new ObjectId value; only an oldId is provided for replacement." -->
|
||||
Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="patientId">The unique identifier of the patient to find.</param>
|
||||
/// <param name="withLocation">When set to <c>true</c>, includes location details in the returned patient; otherwise, only basic patient data is returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the found <see cref="Patient"/>, or <c>null</c> if no patient matches the specified identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=823c22c -->
|
||||
Task<Patient?> FindByPatientId(string patientId, bool withLocation = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient by their unique identifier, applying the specified locale for localized data.
|
||||
@@ -24,12 +25,14 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="patientId">The unique identifier of the patient to locate.</param>
|
||||
/// <param name="localeEnum">The locale to use when retrieving or formatting localized patient information.</param>
|
||||
/// <returns>A task that resolves to the matching patient, or <c>null</c> if no patient is found for the given identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=0b2d8b0 -->
|
||||
Task<Patient?> FindByPatientIdWithLocale(string patientId, LocaleEnum localeEnum);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an archived <see cref="Patient"/> matching the specified patient number, returning <c>null</c> when no matching archived record is found.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the archived patient record.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> that yields the matching archived <see cref="Patient"/>, or <c>null</c> if no archived patient is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=38fda84 -->
|
||||
Task<Patient?> FindByPatientNumberArchived(string patientNumber);
|
||||
/// <summary>
|
||||
/// Retrieves a patient by their unique patient number, optionally including location information in the result.
|
||||
@@ -37,6 +40,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="patientNumber">The unique patient number used to look up the patient.</param>
|
||||
/// <param name="withLocation">When <c>true</c>, location information is included in the returned patient; otherwise, it is omitted.</param>
|
||||
/// <returns>A task that yields the matching <see cref="Patient"/> if one is found, or <c>null</c> when no patient matches the given number.</returns>
|
||||
/// <!-- aidoc:v1 sig=d9f5471 -->
|
||||
Task<Patient?> FindByPatientNumber(string patientNumber, bool withLocation = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient associated with the specified location.
|
||||
@@ -44,12 +48,14 @@ public interface IPatientService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to search for a matching patient. May be <see langword="null"/>.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="Patient"/>, or <see langword="null"/> if no patient is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=ca2dffa -->
|
||||
Task<Patient?> FindByLocation(PatientLocation? location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient associated with the specified Point of Care identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The ObjectId representing the Point of Care identifier used to look up the patient.</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=1336816 -->
|
||||
Task<Patient?> FindByPointOfCareId(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient identified by the specified unit and point-of-care identifiers.
|
||||
@@ -57,18 +63,21 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="unit">The unique identifier of the unit to search within.</param>
|
||||
/// <param name="pointOfCare">The unique identifier of the point-of-care associated with the patient.</param>
|
||||
/// <returns>A task that yields the matching <see cref="Patient"/>, or <c>null</c> if no patient is found for the given unit and point-of-care.</returns>
|
||||
/// <!-- aidoc:v1 sig=a028676 -->
|
||||
Task<Patient?> FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare);
|
||||
/// <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 locate matching patients.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Patient"/> objects that match the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=c2cb9ce -->
|
||||
Task<List<Patient>> FindByPointOfCare(string pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of patients associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The ObjectId of the unit whose patients should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total count of patients for the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=867c6c1 -->
|
||||
Task<long> CountPatientsByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
@@ -82,6 +91,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <paramref name="location"/> instead of the patient identifiers.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> that yields the matching <see cref="Patient"/>, or
|
||||
/// <c>null</c> if no patient is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=9cea35f -->
|
||||
Task<Patient?> FindPatient(string? patientId, string? patientNumber, PatientLocation? location,
|
||||
bool findByLocation = false);
|
||||
|
||||
@@ -89,33 +99,39 @@ public interface IPatientService : IApiRequestService
|
||||
/// Asynchronously inserts a new patient record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity to be inserted.</param>
|
||||
/// <!-- aidoc:v1 sig=3c6f3e8 -->
|
||||
Task Insert(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts the specified <see cref="Patient"/> into the data store.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=6e78a3b -->
|
||||
Task InsertAsync(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives the specified patient record.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
/// <!-- aidoc:v1 sig=a500807 -->
|
||||
Task ArchivePatient(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives the patient data identified by the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientid">The unique identifier of the patient whose data should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=1a00b68 -->
|
||||
Task ArchivePatientData(ObjectId patientid);
|
||||
/// <summary>
|
||||
/// Merges the specified patient record with the existing patient identified by the old patient number.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient data to merge into the existing record.</param>
|
||||
/// <param name="oldPatienNumber">The identifier of the existing patient record to be merged.</param>
|
||||
/// <!-- aidoc:v1 sig=1e8bdc4 -->
|
||||
Task MergePatient(Patient patient, string oldPatienNumber);
|
||||
/// <summary>
|
||||
/// Updates the location of a patient identified by the specified object identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose location will be updated.</param>
|
||||
/// <param name="location">The new patient location, or <c>null</c> if no location is provided.</param>
|
||||
/// <!-- aidoc:v1 sig=aa67e50 -->
|
||||
Task UpdateLocation(ObjectId id, PatientLocation? location);
|
||||
/// <summary>
|
||||
/// Updates the attending doctor for the entity identified by the specified identifier.
|
||||
@@ -123,6 +139,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="id">The identifier of the entity whose attending doctor will be updated.</param>
|
||||
/// <param name="doctor">The new attending doctor to assign to the entity.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=c6b59f4 -->
|
||||
Task UpdateAttendingDoctor(ObjectId id, Person doctor);
|
||||
/// <summary>
|
||||
/// Updates the data of an existing patient identified by the given identifier, optionally replacing the patient number when the <paramref name="updatePatientNumber"/> flag is true.
|
||||
@@ -131,6 +148,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="patientNumber">The patient number to be applied to the patient.</param>
|
||||
/// <param name="data">The person data to assign to the patient.</param>
|
||||
/// <param name="updatePatientNumber">Indicates whether the patient number should also be updated; defaults to true.</param>
|
||||
/// <!-- aidoc:v1 sig=c9778ad -->
|
||||
Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true);
|
||||
/// <summary>
|
||||
/// Updates the patient data for the specified patient identified by <paramref name="id"/> and <paramref name="patientNumber"/>, applying the changes from the provided <paramref name="patient"/> object. When <paramref name="updatePatientNumber"/> is <c>true</c>, the patient number is also updated as part of the operation; otherwise, only the remaining patient fields are updated.
|
||||
@@ -140,11 +158,13 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="patient">The patient object containing the updated data to be applied.</param>
|
||||
/// <param name="updatePatientNumber">A flag indicating whether the patient number should also be updated; defaults to <c>true</c>.</param>
|
||||
/// <returns>A <see cref="Task"/> that represents the asynchronous update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=d6fb956 -->
|
||||
Task UpdatePatientData(ObjectId id, string patientNumber, Patient patient, bool updatePatientNumber = true);
|
||||
/// <summary>
|
||||
/// Updates the specified patient record.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose information will be updated.</param>
|
||||
/// <!-- aidoc:v1 sig=0688359 -->
|
||||
Task Update(Patient patient);
|
||||
/// <summary>
|
||||
/// Moves the specified patient from the old point of care to the new point of care.
|
||||
@@ -153,6 +173,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="newPocId">The identifier of the destination point of care.</param>
|
||||
/// <param name="oldPocId">The identifier of the source point of care.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the move was successful; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=40515dd -->
|
||||
Task<bool> Move(Patient patient, ObjectId newPocId, ObjectId oldPocId);
|
||||
/// <summary>
|
||||
/// Retrieves a patient by their unique identifier, optionally including location information.
|
||||
@@ -161,6 +182,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="id">The <see cref="ObjectId"/> used to look up the patient.</param>
|
||||
/// <param name="withLocation">When <c>true</c>, includes the patient's location data in the result; otherwise, location data is omitted.</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=a1146e7 -->
|
||||
Task<Patient?> FindById(ObjectId id, bool withLocation = false);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Box"/> associated with the specified <see cref="PointOfCare"/>, returning <see langword="null"/> when no box is found for the given point of care.
|
||||
@@ -169,6 +191,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="observations">When <see langword="true"/>, observations are included with the returned box; otherwise, observations are omitted.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to restrict which observations are loaded when <paramref name="observations"/> is <see langword="true"/>.</param>
|
||||
/// <returns>A <see cref="Task{Box}"/> that resolves to the matching <see cref="Box"/>, or <see langword="null"/> if no box exists for the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=8cd91c3 -->
|
||||
Task<Box?> GetBox(PointOfCare poc, bool observations = false, List<string>? filterObservations = null);
|
||||
/// <summary>
|
||||
/// Creates a <see cref="Patient"/> instance from the provided <see cref="ApiRequest"/>, optionally ignoring location information during the creation process.
|
||||
@@ -176,35 +199,41 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="apiRequest">The API request containing the data used to construct the patient.</param>
|
||||
/// <param name="ignoreLocation">When <c>true</c>, location information is ignored during patient creation. Defaults to <c>false</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the created <see cref="Patient"/>, or <c>null</c> if the patient could not be created.</returns>
|
||||
/// <!-- aidoc:v1 sig=f7ca273 -->
|
||||
Task<Patient?> CreatePatientFromRequest(ApiRequest apiRequest, bool ignoreLocation = false);
|
||||
/// <summary>
|
||||
/// Asynchronously finds a patient based on the information provided in the specified API request.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the data used to look up the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if found, or null if no patient matches the request.</returns>
|
||||
/// <!-- aidoc:v1 sig=9bc220c -->
|
||||
Task<Patient?> FindPatientByApiRequest(ApiRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Archives patients who have no observations recorded since the specified date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; patients without observations after this date are archived.</param>
|
||||
/// <!-- aidoc:v1 sig=ab342f5 -->
|
||||
Task ArchivePatientWithoutObservationsSinceDate(DateTime date);
|
||||
|
||||
/// <summary>
|
||||
/// Archives patient records for patients who have been discharged longer than the specified time threshold.
|
||||
/// </summary>
|
||||
/// <param name="hoursBeforeArchive">The number of hours a patient must have been discharged before being archived.</param>
|
||||
/// <!-- aidoc:v1 sig=218184e -->
|
||||
Task ArchiveDischargedPatients(int hoursBeforeArchive);
|
||||
/// <summary>
|
||||
/// Retrieves all patients, optionally including their location data when requested.
|
||||
/// </summary>
|
||||
/// <param name="withLocation">Indicates whether location information should be included in the returned patient records.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Patient"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=4462ed0 -->
|
||||
Task<List<Patient>> FindAll(bool withLocation = false);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of patients based on the provided pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the paging criteria used to retrieve patients.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PaginationResponse{Patient}"/> with the requested page of patients.</returns>
|
||||
/// <!-- aidoc:v1 sig=8405329 -->
|
||||
Task<PaginationResponse<Patient>> GetPaginatedPatients(PaginationFilter filter);
|
||||
|
||||
/// <summary>
|
||||
@@ -212,34 +241,40 @@ public interface IPatientService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="sinceDate">The date used to identify patients that have been inactive since this point in time.</param>
|
||||
/// <param name="hoursBeforeArchive">The number of hours of inactivity that must elapse before a discharged patient is archived.</param>
|
||||
/// <!-- aidoc:v1 sig=ac3e223 -->
|
||||
Task DischargeInactivePatients(DateTime sinceDate, int hoursBeforeArchive);
|
||||
/// <summary>
|
||||
/// Updates an existing patient record with the provided patient data. Returns the updated patient, or <c>null</c> if no matching patient was found.
|
||||
/// </summary>
|
||||
/// <param name="updatedPatient">The patient object containing the updated information to be persisted.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> that resolves to the updated <see cref="Patient"/>, or <c>null</c> if the patient could not be found.</returns>
|
||||
/// <!-- aidoc:v1 sig=1b69c26 -->
|
||||
Task<Patient?> UpdateOne(Patient updatedPatient);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous broadcast notification to inform relevant subscribers or systems about a newly registered patient.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose information will be included in the broadcast notification.</param>
|
||||
/// <!-- aidoc:v1 sig=8b73b63 -->
|
||||
Task SendNewPatientBroadcast(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously sends a broadcast notification about an update to the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose update information will be broadcast.</param>
|
||||
/// <!-- aidoc:v1 sig=9f4f683 -->
|
||||
Task SendPatientUpdateBroadcast(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of inactive Patients of Care (PoC), allowing consumers to identify
|
||||
/// patients that are no longer active in the system for reporting, cleanup, or follow-up workflows.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of inactive <see cref="Patient"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=1eb056c -->
|
||||
Task<List<Patient>> FindInActivePoC();
|
||||
/// <summary>
|
||||
/// Retrieves a list of patients associated with inactive PoC records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Patient"/> objects associated with inactive PoC records.</returns>
|
||||
/// <!-- aidoc:v1 sig=ace85d3 -->
|
||||
Task<List<Patient>> FindInInactivePoC();
|
||||
|
||||
/// <summary>
|
||||
@@ -250,6 +285,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="observations">Indicates whether the patient's observations should be included in the returned patient.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to filter which observations are returned when <paramref name="observations"/> is <c>true</c>.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> that resolves to the matching <see cref="Patient"/>, or <c>null</c> if no patient is found for the given point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=d512c37 -->
|
||||
Task<Patient?> GetByPointOfCare(PointOfCare item, bool observations = false,
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
@@ -260,6 +296,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="unit">An optional unit that further filters the lookup.</param>
|
||||
/// <param name="localeEnum">An optional locale used to scope the search.</param>
|
||||
/// <returns>A task that yields the matching <see cref="Patient"/>, or <c>null</c> when no patient is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=7e6d4de -->
|
||||
Task<Patient?> GetByPointOfCareAndLocale(PointOfCare item, Unit? unit, LocaleEnum? localeEnum);
|
||||
/// <summary>
|
||||
/// Updates the altable (allergy table) information for the specified patient and returns the updated patient.
|
||||
@@ -268,12 +305,14 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="altable">The option list containing the altable data to apply to the patient.</param>
|
||||
/// <param name="user">The user performing the update, or <c>null</c> when no user context is available.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Patient"/>, or <c>null</c> if the patient was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6bc7695 -->
|
||||
Task<Patient?> UpdatePatientAltable(ObjectId patientId, OptionList altable, User? user);
|
||||
/// <summary>
|
||||
/// Exits a patient identified by the given identifier, optionally archiving the patient record.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient to exit.</param>
|
||||
/// <param name="archivePatient">When true, the patient record is archived as part of the exit process; when false, archiving is skipped.</param>
|
||||
/// <!-- aidoc:v1 sig=8436023 -->
|
||||
Task ExitPatientById(ObjectId id, bool archivePatient = true);
|
||||
|
||||
/// <summary>
|
||||
@@ -285,6 +324,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="user">The user performing the update, or null if not specified.</param>
|
||||
/// <param name="carePlanLog">Optional care plan log entries associated with the update.</param>
|
||||
/// <returns>A task that returns the updated <see cref="Patient"/>, or null if the patient was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=003aa16 -->
|
||||
Task<Patient?> UpdatePatientMasterList(ObjectId patientId, MasterListType typeName,
|
||||
List<OptionList> updatedOptions,
|
||||
User? user, List<OptionList>? carePlanLog);
|
||||
@@ -297,6 +337,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="patient">The patient for whom the nurse care plan is generated and inserted.</param>
|
||||
/// <param name="user">The user associated with the care plan generation. May be null.</param>
|
||||
/// <returns>A task that completes when the nurse care plan has been generated and inserted.</returns>
|
||||
/// <!-- aidoc:v1 sig=ddba9de -->
|
||||
Task GenerateNurseCarePlanAndInsert(MasterListType carePlanType, List<OptionList>? options,
|
||||
Patient patient, User? user);
|
||||
|
||||
@@ -305,6 +346,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose incoming data is being updated.</param>
|
||||
/// <param name="person">The patient object containing the incoming data to be applied to the patient record.</param>
|
||||
/// <!-- aidoc:v1 sig=43355e2 -->
|
||||
Task UpdatePatientIncomingData(ObjectId patientId, Patient person);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the demographic data of an existing patient identified by the specified patient identifier.
|
||||
@@ -312,6 +354,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <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 new demographic information to apply.</param>
|
||||
/// <param name="user">The user performing the update operation, or <see langword="null"/> if no user context is available.</param>
|
||||
/// <!-- aidoc:v1 sig=592313b -->
|
||||
Task UpdatePatientDemographicData(ObjectId patientId, Patient person, User? user);
|
||||
/// <summary>
|
||||
/// Searches for a patient by their patient number within a distinct unit.
|
||||
@@ -319,24 +362,28 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="patientNumber">The patient number used to identify the patient.</param>
|
||||
/// <param name="unitId">The identifier of the distinct unit where the patient is registered.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=1d70651 -->
|
||||
Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patients whose procedures have been finished, filtering based on the specified archive threshold for procedure end times.
|
||||
/// </summary>
|
||||
/// <param name="archiveProcedureEndDateAfterMinutes">The number of minutes after the procedure end date used as the archive threshold to qualify patients with finished procedures.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Patient"/> objects that match the finished procedures criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=d37257e -->
|
||||
Task<List<Patient>> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patients who have completed a test, using the specified archive window in minutes to determine which tests are considered finished.
|
||||
/// </summary>
|
||||
/// <param name="archiveTestEndDateAfterMinutes">The time window in minutes applied to the test end date to identify tests that should be treated as finished/archived.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Patient"/> instances with finished tests.</returns>
|
||||
/// <!-- aidoc:v1 sig=650b7bb -->
|
||||
Task<List<Patient>> FindAllPatientWithFinishedTest(int archiveTestEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Retrieves a list of patients whose treatments have finished, based on the specified archive time threshold in minutes after the treatment end date.
|
||||
/// </summary>
|
||||
/// <param name="archiveTreatmentEndDateAfterMinutes">The number of minutes after the treatment end date used to determine which finished treatments should be included.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of patients with finished treatment matching the specified criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=bef780c -->
|
||||
Task<List<Patient>> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes);
|
||||
|
||||
/// <summary>
|
||||
@@ -346,6 +393,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="person">The patient entity associated with the update.</param>
|
||||
/// <param name="personDataChange">The income data changes to apply to the patient.</param>
|
||||
/// <param name="user">The user performing the update operation.</param>
|
||||
/// <!-- aidoc:v1 sig=9a965eb -->
|
||||
Task UpdatePatientIncomingData(ObjectId patientId, Patient person, PatientIncomeData personDataChange,
|
||||
User user);
|
||||
|
||||
@@ -355,6 +403,7 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="opt">The update options for the master list item.</param>
|
||||
/// <param name="unitList">The collection of units associated with the update.</param>
|
||||
/// <param name="typeName">The name of the type used to categorize the master list item.</param>
|
||||
/// <!-- aidoc:v1 sig=6d7dd8e -->
|
||||
Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList,
|
||||
string typeName);
|
||||
|
||||
@@ -364,5 +413,6 @@ public interface IPatientService : IApiRequestService
|
||||
/// <param name="opt">The option list containing the details of the patient master list item to delete.</param>
|
||||
/// <param name="unitList">The collection of units associated with the patient master list item.</param>
|
||||
/// <param name="typeName">The name of the type identifying the patient master list item to be deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=bbc71d1 -->
|
||||
Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public interface IPermissionService
|
||||
/// <param name="display">The display for which permissions are being evaluated.</param>
|
||||
/// <param name="user">The user whose permissions for the display are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="DisplayPermissionTypes"/> granted to the user for the display.</returns>
|
||||
/// <!-- aidoc:v1 sig=ba241eb -->
|
||||
public Task<DisplayPermissionTypes> GetPermissionsForDisplay(Display display, User user);
|
||||
/// <summary>
|
||||
/// Retrieves the display-friendly permission types applicable to the specified user for the given unit.
|
||||
@@ -19,18 +20,21 @@ public interface IPermissionService
|
||||
/// <param name="unitId">The identifier of the unit whose permissions are being queried.</param>
|
||||
/// <param name="user">The user whose permissions for the unit should be evaluated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="DisplayPermissionTypes"/> for the specified unit and user.</returns>
|
||||
/// <!-- aidoc:v1 sig=a645ad9 -->
|
||||
public Task<DisplayPermissionTypes> GetPermissionsForUnit(string unitId, User user);
|
||||
/// <summary>
|
||||
/// Retrieves the panel permission types associated with the specified user.
|
||||
/// </summary>
|
||||
/// <param name="user">The user whose panel permissions are being queried.</param>
|
||||
/// <returns>The <see cref="PanelPermissionTypes"/> granted to the specified user.</returns>
|
||||
/// <!-- aidoc:v1 sig=a5da6a5 -->
|
||||
public PanelPermissionTypes GetPermissionsForPanel(User user);
|
||||
/// <summary>
|
||||
/// Retrieves the panel permission types associated with the specified user.
|
||||
/// </summary>
|
||||
/// <param name="user">The identifier or name of the user whose panel permissions are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="PanelPermissionTypes"/> granted to the user.</returns>
|
||||
/// <!-- aidoc:v1 sig=7d60015 -->
|
||||
public Task<PanelPermissionTypes> GetPermissionsForPanel(string user);
|
||||
|
||||
/// <summary>
|
||||
@@ -41,6 +45,7 @@ public interface IPermissionService
|
||||
/// <param name="source">The source permission type considered when evaluating access.</param>
|
||||
/// <param name="displayId">The identifier of the display for which access is being checked.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the user has access to the display; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d0c67ae -->
|
||||
Task<bool> HasAccessToDisplay(string username, PermissionEnum.RolesType role,
|
||||
PermissionEnum.SourcePermissionsEnum source, string displayId);
|
||||
|
||||
@@ -52,6 +57,7 @@ public interface IPermissionService
|
||||
/// <param name="source">The permission source used to resolve the user's access rights.</param>
|
||||
/// <param name="unitId">The identifier of the unit to check access against.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the user has access to the specified unit; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=382550b -->
|
||||
Task<bool> HasAccessToUnit(string username, PermissionEnum.RolesType role,
|
||||
PermissionEnum.SourcePermissionsEnum source, string unitId);
|
||||
|
||||
@@ -62,6 +68,7 @@ public interface IPermissionService
|
||||
/// <param name="role">The role assigned to the user, used to resolve applicable permissions.</param>
|
||||
/// <param name="source">The source permission being checked against the user's access rights.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the user has access to the panel; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=b661393 -->
|
||||
Task<bool> HasAccessToPanel(string username, PermissionEnum.RolesType role,
|
||||
PermissionEnum.SourcePermissionsEnum source);
|
||||
}
|
||||
@@ -9,5 +9,6 @@ public interface IPoCMappingService
|
||||
/// </summary>
|
||||
/// <param name="original">The source patient location to map from.</param>
|
||||
/// <returns>A task that yields the mapped <see cref="PatientLocation"/>, or <c>null</c> if no mapping result is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=e9beb22 -->
|
||||
Task<PatientLocation?> Map(PatientLocation original);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ public interface IPointOfCareService
|
||||
/// </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=0112d17 -->
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -21,6 +22,7 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care entity containing the updated data.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the updated point of care, or null if no matching record was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=6e2aa0e -->
|
||||
Task<PointOfCare?> Update(PointOfCare pointOfCare);
|
||||
|
||||
/// <summary>
|
||||
@@ -28,22 +30,26 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the unit to update.</param>
|
||||
/// <param name="unit">The unit data to apply to the existing record.</param>
|
||||
/// <!-- aidoc:v1 sig=d59a50c -->
|
||||
Task UpdateUnit(ObjectId id, Unit unit);
|
||||
/// <summary>
|
||||
/// Retrieves all PointOfCare records asynchronously.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all PointOfCare entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=8074bfb -->
|
||||
Task<List<PointOfCare>> GetAll();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all PointOfCare configurations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="PointOfCare"/> configurations.</returns>
|
||||
/// <!-- aidoc:v1 sig=b9af568 -->
|
||||
Task<List<PointOfCare>> GetAllConfigs();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all point-of-care location information.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of all <see cref="PointOfCare"/> locations.</returns>
|
||||
/// <!-- aidoc:v1 sig=c0c2738 -->
|
||||
Task<List<PointOfCare>> GetAllLocationInfo();
|
||||
|
||||
/// <summary>
|
||||
@@ -51,6 +57,7 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the point of care configuration to update.</param>
|
||||
/// <param name="configuration">The new configuration data to apply.</param>
|
||||
/// <!-- aidoc:v1 sig=92922a6 -->
|
||||
Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration);
|
||||
|
||||
/// <summary>
|
||||
@@ -58,12 +65,14 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the <see cref="PointOfCare"/> to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous lookup operation. The task result contains the matching <see cref="PointOfCare"/> if found, or null when no entity with the specified identifier exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=f01a187 -->
|
||||
Task<PointOfCare?> FindById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="PointOfCare"/> entity by its identifier, including all of its associated configuration data.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the <see cref="PointOfCare"/> to locate.</param>
|
||||
/// <returns>A task that yields the matching <see cref="PointOfCare"/> with its full configuration, or <c>null</c> if no entity is found for the supplied identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=810206b -->
|
||||
Task<PointOfCare?> FindByIdAllConfig(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -71,6 +80,7 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="unit">The unique identifier of the unit whose PointOfCare records should be retrieved.</param>
|
||||
/// <returns>A task that returns a collection of PointOfCare records for the specified unit, or <c>null</c> if no records are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=d969dd8 -->
|
||||
Task<IEnumerable<PointOfCare>?> FindAllByUnitId(ObjectId unit);
|
||||
|
||||
/// <summary>
|
||||
@@ -78,6 +88,7 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="room">The room identifier used to look up the associated Points of Care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable of Points of Care found for the given room, or <c>null</c> if no matching results are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=4637691 -->
|
||||
Task<IEnumerable<PointOfCare>?> FindByRoom(string room);
|
||||
|
||||
/// <summary>
|
||||
@@ -85,6 +96,7 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="bed">The bed identifier used to look up the associated points of care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="PointOfCare"/> instances matching the bed, or <c>null</c> if no match is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=604796d -->
|
||||
Task<IEnumerable<PointOfCare>?> FindByBed(string bed);
|
||||
|
||||
/// <summary>
|
||||
@@ -92,6 +104,7 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The list of unit identifiers used to look up the associated points of care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of points of care matching the provided unit identifiers.</returns>
|
||||
/// <!-- aidoc:v1 sig=f8dba62 -->
|
||||
Task<List<PointOfCare>> FindAllByUnitIds(List<ObjectId> unitIds);
|
||||
|
||||
/// <summary>
|
||||
@@ -103,6 +116,7 @@ public interface IPointOfCareService
|
||||
/// <param name="fillPatientData">When <c>true</c>, associated patient data is included in the result; when <c>false</c>, only the point of care information is returned.</param>
|
||||
/// <param name="ct">Token to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that yields the <see cref="PointOfCare"/> corresponding to the given identifier, or <c>null</c> if it is not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=815317f -->
|
||||
Task<PointOfCare?> GetInfo(ObjectId id, LocaleEnum? locale = null, bool fillPatientData = true, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
@@ -110,12 +124,14 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The <see cref="PointOfCare"/> entity to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{PointOfCare}"/> containing the inserted <see cref="PointOfCare"/>, or <c>null</c> if the insertion was not performed.</returns>
|
||||
/// <!-- aidoc:v1 sig=de1c6f7 -->
|
||||
Task<PointOfCare?> InsertPointOfCare(PointOfCare pointOfCare);
|
||||
/// <summary>
|
||||
/// Retrieves the Point of Care associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose Point of Care is being looked up.</param>
|
||||
/// <returns>A task that yields the <see cref="PointOfCare"/> associated with the patient, or <c>null</c> if no Point of Care is found for the given patient identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=c43c4f3 -->
|
||||
Task<PointOfCare?> FindPoCByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
@@ -124,6 +140,7 @@ public interface IPointOfCareService
|
||||
/// <param name="id">The unique identifier of the entity whose Point of Care status will be updated.</param>
|
||||
/// <param name="status">The Point of Care status to assign to the entity.</param>
|
||||
/// <returns>A task that represents the asynchronous status update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=486326c -->
|
||||
Task SetPointOfCareStatus(ObjectId id, StatusEnum.PointOfCare status);
|
||||
|
||||
/// <summary>
|
||||
@@ -133,6 +150,7 @@ public interface IPointOfCareService
|
||||
/// <param name="poc">The point-of-care status used to filter the results.</param>
|
||||
/// <param name="excludeVirtual">When <c>true</c>, virtual points of care are excluded from the results; otherwise, they are included.</param>
|
||||
/// <returns>A task that returns the matching collection of <see cref="PointOfCare"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=078d6e7 -->
|
||||
Task<IEnumerable<PointOfCare>> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare poc,
|
||||
bool excludeVirtual = false);
|
||||
|
||||
@@ -140,6 +158,7 @@ public interface IPointOfCareService
|
||||
/// Checks the next admission for the specified patient location.
|
||||
/// </summary>
|
||||
/// <param name="patientLocation">The optional identifier of the patient location to check.</param>
|
||||
/// <!-- aidoc:v1 sig=050dfd4 -->
|
||||
void CheckNextAdmission(ObjectId? patientLocation);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="PointOfCare"/> associated with the specified bed and unit identifier, returning <c>null</c> when no matching record is found.
|
||||
@@ -147,11 +166,13 @@ public interface IPointOfCareService
|
||||
/// <param name="bed">The bed identifier used to locate the point of care.</param>
|
||||
/// <param name="unitId">The MongoDB <see cref="ObjectId"/> of the unit the point of care belongs to.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the matching <see cref="PointOfCare"/> or <c>null</c> if no record matches the supplied bed and unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=b2740c6 -->
|
||||
Task<PointOfCare?> FindByBedAndUnitId(string? bed, ObjectId? unitId);
|
||||
/// <summary>
|
||||
/// Updates the relay configuration associated with the specified point-of-care device.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point-of-care device whose relay configuration should be updated.</param>
|
||||
/// <!-- aidoc:v1 sig=a1848f1 -->
|
||||
Task UpdateRelayConfig(PointOfCare poc);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the Point of Care (PoC) associated with the specified patient number.
|
||||
@@ -159,6 +180,7 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the associated Point of Care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="PointOfCare"/> if found, or <c>null</c> if no match exists.</returns>
|
||||
/// <!-- aidoc:v1 sig=ea5395f -->
|
||||
Task<PointOfCare?> FindPoCByPatientNumber(string patientNumber);
|
||||
|
||||
/// <summary>
|
||||
@@ -166,43 +188,51 @@ public interface IPointOfCareService
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose PoCs should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total number of PoCs linked to the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=41f9c5e -->
|
||||
Task<long> CountPoCsByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the total number of virtual Proofs of Concept (PoCs) associated with the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose virtual PoCs should be counted.</param>
|
||||
/// <returns>A <see cref="Task{Int64}"/> that represents the asynchronous operation, containing the count of virtual PoCs for the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=2a40a4f -->
|
||||
Task<long> CountVirtualPoCsByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of Points of Care based on the provided filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination parameters used to control page size and page number.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response of Points of Care.</returns>
|
||||
/// <!-- aidoc:v1 sig=6ceec7c -->
|
||||
Task<PaginationResponse<PointOfCare>> GetPaginatedPoCs(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Deletes all PoCs associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose PoCs should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=2c44a9e -->
|
||||
Task DeletePoCsByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of all camera identifiers that are currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a HashSet of ObjectId values representing the cameras currently in use.</returns>
|
||||
/// <!-- aidoc:v1 sig=5635e4a -->
|
||||
Task<HashSet<ObjectId>> FindAllIdCamerasInUse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of all ID relays that are currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="HashSet{ObjectId}"/> of the ID relays currently in use.</returns>
|
||||
/// <!-- aidoc:v1 sig=a6e513b -->
|
||||
Task<HashSet<ObjectId>> FindAllIdRelaysInUse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of all ID beacons currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a <see cref="HashSet{ObjectId}"/> of the ID beacons that are active or in use.</returns>
|
||||
/// <!-- aidoc:v1 sig=3084f59 -->
|
||||
Task<HashSet<ObjectId>> FindAllIdBeaconsInUse();
|
||||
/// <summary>
|
||||
/// Retrieves all Point of Care entries associated with the specified unit, including their related devices.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose Point of Care entries should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of Point of Care entries with their devices, or <c>null</c> if no entries are found for the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=dbf2769 -->
|
||||
Task<IEnumerable<PointOfCare>?> FindAllByUnitIdWithDevices(ObjectId unitId);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ public interface IPublisherService
|
||||
/// </summary>
|
||||
/// <param name="queueName">The name of the queue to create.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <see langword="true"/> if the queue was created successfully; otherwise, <see langword="false"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=8ce64d8 -->
|
||||
Task<bool> CreateQueue(string queueName);
|
||||
/// <summary>
|
||||
/// Asynchronously sends an error message to the specified message queue.
|
||||
@@ -14,6 +15,7 @@ public interface IPublisherService
|
||||
/// <param name="obj">The error payload or message object to be sent to the queue.</param>
|
||||
/// <param name="queueName">The name of the target message queue.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean value that indicates whether the message was successfully sent.</returns>
|
||||
/// <!-- aidoc:v1 sig=4c43b3f -->
|
||||
Task<bool> SendMessageError(object obj, string queueName);
|
||||
/// <summary>
|
||||
/// Asynchronously sends the specified object as a message to the named queue.
|
||||
@@ -21,6 +23,7 @@ public interface IPublisherService
|
||||
/// <param name="obj">The object payload to serialize and publish to the queue.</param>
|
||||
/// <param name="queueName">The name of the target queue that will receive the message.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the message was sent successfully, otherwise <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=8eb8873 -->
|
||||
Task<bool> SendMessage(object obj, string queueName);
|
||||
/// <summary>
|
||||
/// Asynchronously sends a message to the specified message queue and returns a value indicating whether the operation succeeded.
|
||||
@@ -28,5 +31,6 @@ public interface IPublisherService
|
||||
/// <param name="message">The message content to be sent to the queue.</param>
|
||||
/// <param name="queueName">The name of the target queue where the message will be delivered.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the message was sent successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=e20a929 -->
|
||||
Task<bool> SendMessage(string message, string queueName);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ public interface IPumpService: IApiRequestService
|
||||
/// Asynchronously inserts a pump observation record into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to persist.</param>
|
||||
/// <!-- aidoc:v1 sig=dc84e4b -->
|
||||
Task InsertPumpObservation(PumpObservation obs);
|
||||
|
||||
// Mapping
|
||||
@@ -22,6 +23,7 @@ public interface IPumpService: IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="obs">The source pump observation to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting <see cref="PumpObservation"/> or <c>null</c> if no result is available.</returns>
|
||||
/// <!-- aidoc:v1 sig=825d828 -->
|
||||
Task<PumpObservation?> MapPumpObservation(PumpObservation obs);
|
||||
|
||||
// Consultas por paciente
|
||||
@@ -31,11 +33,13 @@ public interface IPumpService: IApiRequestService
|
||||
/// <param name="patientId">The unique identifier of the patient whose pump observations are being queried.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 1.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of the most recent pump observations for the patient, up to the specified count.</returns>
|
||||
/// <!-- aidoc:v1 sig=c6e10b9 -->
|
||||
Task<List<PumpObservation>> FindLastPumpObservations(ObjectId patientId, int num = 1);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent observation timestamp for every patient, returning a dictionary keyed by patient identifier.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a dictionary mapping each patient's <see cref="ObjectId"/> to their last observation <see cref="DateTime"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=cbcaa4c -->
|
||||
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime();
|
||||
|
||||
// Gestión de configuración
|
||||
@@ -44,35 +48,41 @@ public interface IPumpService: IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier used to look up the configuration pump items.</param>
|
||||
/// <returns>A task that resolves to a list of <see cref="ConfigPumpItem"/> objects matching the given identifier, or <c>null</c> when no items are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=0480417 -->
|
||||
Task<List<ConfigPumpItem>?> GetItemsById(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the full list of pump configurations from the underlying data source.
|
||||
/// </summary>
|
||||
/// <returns>A task that resolves to a <see cref="List{ConfigPumps}"/> containing all pump configurations, or <c>null</c> if no configurations are available.</returns>
|
||||
/// <!-- aidoc:v1 sig=b9aae05 -->
|
||||
Task<List<ConfigPumps>?> GetAllPumpConfig();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the pump configuration associated with the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the pump configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ConfigPumps"/> instance matching the specified identifier, or <see langword="null"/> if no configuration is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=3958f50 -->
|
||||
Task<ConfigPumps?> GetPumpConfigsById(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the pump configuration.
|
||||
/// </summary>
|
||||
/// <param name="config">The pump configuration to update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="ConfigPumps"/> or null if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=563e48a -->
|
||||
Task<ConfigPumps?> UpdatePumpConfig(ConfigPumps config);
|
||||
/// <summary>
|
||||
/// Inserts a new pump configuration into the system asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="config">The pump configuration to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the inserted <see cref="ConfigPumps"/> or <c>null</c> if the insertion fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=7fd9494 -->
|
||||
Task<ConfigPumps?> InsertPumpConfig(ConfigPumps config);
|
||||
/// <summary>
|
||||
/// Deletes the specified pump configuration.
|
||||
/// </summary>
|
||||
/// <param name="config">The pump configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result is <c>true</c> if the configuration was deleted successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=ce3f871 -->
|
||||
Task<bool> DeletePumpConfig(ConfigPumps config);
|
||||
|
||||
// Paginación
|
||||
@@ -82,6 +92,7 @@ public interface IPumpService: IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines page size, page number, and any additional filtering criteria applied to the pump observations.</param>
|
||||
/// <returns>A task that resolves to a <see cref="PaginationResponse{PumpObservation}"/> containing the matching pump observations, or null when no results are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=f72dd47 -->
|
||||
Task<PaginationResponse<PumpObservation>?> GetPaginatedPump(PaginationFilter filter);
|
||||
|
||||
// Archivado / limpieza
|
||||
@@ -89,17 +100,20 @@ public interface IPumpService: IApiRequestService
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The ObjectId of the patient whose related records should be deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=d457cb9 -->
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Archives the specified patient, marking the patient record as archived in the system.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=52c2373 -->
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the data associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose data should be archived.</param>
|
||||
/// <returns>A task that represents the asynchronous archive operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=e5916ec -->
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
|
||||
// Mantenimiento ids
|
||||
@@ -109,5 +123,6 @@ public interface IPumpService: IApiRequestService
|
||||
/// <param name="nameId">The name of the field whose ObjectId value should be updated.</param>
|
||||
/// <param name="id">The new ObjectId value to assign.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced.</param>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
}
|
||||
@@ -12,21 +12,25 @@ public interface IRecordingAlertService : IApiRequestService
|
||||
/// <param name="patientId">The identifier of the patient whose recording alerts are being queried.</param>
|
||||
/// <param name="num">The maximum number of most recent recording alerts to return. Defaults to 2.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of the patient's most recent recording alerts.</returns>
|
||||
/// <!-- aidoc:v1 sig=452ab2a -->
|
||||
Task<List<PatientRecordingAlert>> FindLastRecordingAlert(ObjectId patientId, int num = 2);
|
||||
/// <summary>
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose related records should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=d457cb9 -->
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the specified patient, moving their record out of the active set.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
/// <!-- aidoc:v1 sig=52c2373 -->
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives the records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> identifying the patient whose related records should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=e5916ec -->
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
@@ -36,5 +40,6 @@ public interface IRecordingAlertService : IApiRequestService
|
||||
/// <param name="nameId">The identifier used to select the target records to update.</param>
|
||||
/// <param name="id">The new ObjectId value to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced in the matching records.</param>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ public interface IRecordingService : IApiRequestService
|
||||
/// <param name="patient">The patient whose recording should be cancelled.</param>
|
||||
/// <param name="poc">The point of care associated with the recording to be cancelled.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean value indicating the outcome of the cancel recording request.</returns>
|
||||
/// <!-- aidoc:v1 sig=3c3bc68 -->
|
||||
Task<bool> SendCancelRecordingToRecordingApi(Patient patient, PointOfCare poc);
|
||||
|
||||
/// <summary>
|
||||
@@ -31,6 +32,7 @@ public interface IRecordingService : IApiRequestService
|
||||
/// <param name="alarmDescription">The description of the alarm, if applicable.</param>
|
||||
/// <param name="start">Indicates whether to start the recording (default is true).</param>
|
||||
/// <param name="type">The type of alarm (default is Manual).</param>
|
||||
/// <!-- aidoc:v1 sig=aa9d33d -->
|
||||
Task SendRecordingDataToQueue(Patient patient, PointOfCare poc, DateTime? date, DateTime? endDate,
|
||||
DateTime? eventDate, AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, string? alarmDescription,
|
||||
bool start = true, AlarmEnum.Type type = AlarmEnum.Type.Manual);
|
||||
@@ -42,6 +44,7 @@ public interface IRecordingService : IApiRequestService
|
||||
/// <param name="poc">The point of care associated with the recording.</param>
|
||||
/// <param name="manualRecording">The manual recording payload to transmit.</param>
|
||||
/// <param name="start">A flag indicating whether the recording is being started or stopped.</param>
|
||||
/// <!-- aidoc:v1 sig=102dc90 -->
|
||||
Task SendRecordingData(Patient patient, PointOfCare poc, ManualRecording manualRecording, bool start);
|
||||
|
||||
/// <summary>
|
||||
@@ -51,6 +54,7 @@ public interface IRecordingService : IApiRequestService
|
||||
/// <param name="poc">The point of care where the recording was taken.</param>
|
||||
/// <param name="automaticRecording">The automatic recording data to be sent.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean indicating whether the data was sent successfully.</returns>
|
||||
/// <!-- aidoc:v1 sig=0e48f1a -->
|
||||
Task<bool> SendAutoRecordingData(Patient patient, PointOfCare poc, RecordingData automaticRecording);
|
||||
|
||||
/// <summary>
|
||||
@@ -58,5 +62,6 @@ public interface IRecordingService : IApiRequestService
|
||||
/// </summary>
|
||||
/// <param name="roomName">The identifier of the room whose recordings are being requested.</param>
|
||||
/// <returns>A task that returns a list of <see cref="RecordingData"/> for the room, or <c>null</c> if no recordings are available.</returns>
|
||||
/// <!-- aidoc:v1 sig=e92f1dd -->
|
||||
Task<List<RecordingData>?> GetRecordings(int roomName);
|
||||
}
|
||||
@@ -13,23 +13,27 @@ public interface IRelayService
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay whose status is being checked.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the current <see cref="RelayEnum.Status"/> of the relay.</returns>
|
||||
/// <!-- aidoc:v1 sig=2b11d08 -->
|
||||
Task<RelayEnum.Status> CheckRelayStatus(Relay relay);
|
||||
/// <summary>
|
||||
/// Asynchronously checks the current status of the relay identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="relayId">The unique identifier of the relay whose status is being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="RelayEnum.Status"/> of the requested relay.</returns>
|
||||
/// <!-- aidoc:v1 sig=8240e77 -->
|
||||
Task<RelayEnum.Status> CheckRelayStatus(ObjectId relayId);
|
||||
|
||||
/// <summary>
|
||||
/// Powers on the specified relay.
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay to power on.</param>
|
||||
/// <!-- aidoc:v1 sig=a6937ad -->
|
||||
Task PowerOn(Relay relay);
|
||||
/// <summary>
|
||||
/// Powers off the specified relay by sending a command to deactivate it.
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay to power off.</param>
|
||||
/// <!-- aidoc:v1 sig=5540326 -->
|
||||
Task PowerOff(Relay relay);
|
||||
/// <summary>
|
||||
/// Sets a manual relay with the specified status for the given point of contact and relay type.
|
||||
@@ -37,18 +41,21 @@ public interface IRelayService
|
||||
/// <param name="status">The status to apply to the manual relay.</param>
|
||||
/// <param name="pocId">The identifier of the point of contact associated with the relay.</param>
|
||||
/// <param name="type">The type of relay to set manually.</param>
|
||||
/// <!-- aidoc:v1 sig=a56b641 -->
|
||||
Task SetManualRelay(RelayEnum.Status status, ObjectId pocId, RelayEnum.Type type);
|
||||
/// <summary>
|
||||
/// Retrieves a relay by its unique identifier, returning <c>null</c> if no matching relay is found.
|
||||
/// </summary>
|
||||
/// <param name="relay">The unique identifier of the relay to look up.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the <see cref="Relay"/> if found, or <c>null</c> if no relay matches the provided identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=89a52df -->
|
||||
Task<Relay?> GetById(ObjectId relay);
|
||||
/// <summary>
|
||||
/// Retrieves the list of <see cref="Relay"/> objects corresponding to the specified collection of relay identifiers.
|
||||
/// </summary>
|
||||
/// <param name="relayList">The list of <see cref="ObjectId"/> values identifying the relays to retrieve. May be <c>null</c>.</param>
|
||||
/// <returns>A <see cref="List{Relay}"/> containing the relays found for the provided identifiers.</returns>
|
||||
/// <!-- aidoc:v1 sig=cab20f9 -->
|
||||
List<Relay> GetRelayInList(List<ObjectId>? relayList);
|
||||
/// <summary>
|
||||
/// Retrieves the relays of a specified type from the provided configuration relay list.
|
||||
@@ -56,6 +63,7 @@ public interface IRelayService
|
||||
/// <param name="configurationRelayList">The list of relay ObjectIds to filter, or null if no configuration relays are available.</param>
|
||||
/// <param name="type">The relay type to match against the configuration relays.</param>
|
||||
/// <returns>A list of <see cref="Relay"/> objects that match the specified <paramref name="type"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=ac9918d -->
|
||||
List<Relay> GetRelayByTypeInList(List<ObjectId>? configurationRelayList, RelayEnum.Type type);
|
||||
|
||||
/// <summary>
|
||||
@@ -63,12 +71,14 @@ public interface IRelayService
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing the criteria used to retrieve the relays.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response with the requested relays.</returns>
|
||||
/// <!-- aidoc:v1 sig=171773b -->
|
||||
Task<PaginationResponse<Relay>> GetPaginatedRelays(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Inserts a new relay record based on the provided request data.
|
||||
/// </summary>
|
||||
/// <param name="request">The relay entity to be inserted.</param>
|
||||
/// <returns>A task that resolves to the inserted <see cref="Relay"/>, or <c>null</c> if the insert did not return a value.</returns>
|
||||
/// <!-- aidoc:v1 sig=8e83e60 -->
|
||||
Task<Relay?> InsertRelay(Relay request);
|
||||
/// <summary>
|
||||
/// Updates an existing relay identified by the specified <paramref name="objectId"/> with the provided <paramref name="relay"/> data.
|
||||
@@ -77,5 +87,6 @@ public interface IRelayService
|
||||
/// <param name="objectId">The unique identifier of the relay to update.</param>
|
||||
/// <param name="relay">The relay data containing the updated values.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Relay"/>, or <c>null</c> if the relay was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=cbb172b -->
|
||||
Task<Relay?> UpdateRelayById(ObjectId objectId, Relay relay);
|
||||
}
|
||||
@@ -8,15 +8,18 @@ public interface ISendAlertService
|
||||
/// Asynchronously retrieves a list of available queues.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Queue"/> instances.</returns>
|
||||
/// <!-- aidoc:v1 sig=f99b362 -->
|
||||
Task<List<Queue>> GetQueues();
|
||||
/// <summary>
|
||||
/// Retrieves a list of performance records.
|
||||
/// </summary>
|
||||
/// <returns>A list of <see cref="Performance"/> objects.</returns>
|
||||
/// <!-- aidoc:v1 sig=3205076 -->
|
||||
List<Performance> GetPerformance();
|
||||
/// <summary>
|
||||
/// Retrieves a list of API clients.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="ApiClients"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=5b1f979 -->
|
||||
Task<List<ApiClients>> GetApiClients();
|
||||
}
|
||||
@@ -9,5 +9,6 @@ public interface IServiceConfigService
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the service configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ServiceConfig"/> if found, or <c>null</c> if no configuration exists for the given identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=86fa8c8 -->
|
||||
Task<ServiceConfig?> Get(string id);
|
||||
}
|
||||
@@ -11,34 +11,40 @@ public interface ISubscriberGroupedService
|
||||
/// Retrieves a list of subscribers organized into groups.
|
||||
/// </summary>
|
||||
/// <returns>A list of <see cref="WsSubscriberGrouped"/> instances representing the grouped subscribers.</returns>
|
||||
/// <!-- aidoc:v1 sig=f5051ca -->
|
||||
List<WsSubscriberGrouped> GetGrouped();
|
||||
/// <summary>
|
||||
/// Removes grouped observations associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose grouped observations should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=f293e05 -->
|
||||
void RemoveGroupedObsByPatientId(string patientId);
|
||||
/// <summary>
|
||||
/// Removes a WebSocket subscriber associated with the specified patient based on the provided location.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose WebSocket subscriber should be removed.</param>
|
||||
/// <param name="newLocation">The new patient location used to identify the subscriber to remove, or null to remove without location filtering.</param>
|
||||
/// <!-- aidoc:v1 sig=a9f97d5 -->
|
||||
void RemoveWsSubscriberByLocation(string patientId, PatientLocation? newLocation);
|
||||
/// <summary>
|
||||
/// Removes the specified workstation identifier associated with a patient's WS subscriber entry.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose WS subscriber entry will be updated.</param>
|
||||
/// <param name="wsIdToRemove">The workstation identifier to remove from the patient's WS subscriber entry.</param>
|
||||
/// <!-- aidoc:v1 sig=4add1da -->
|
||||
void RemoveWsSubscriberPatientIdAndWsId(string patientId, string wsIdToRemove);
|
||||
/// <summary>
|
||||
/// Validates the provided <see cref="WsSubscriberGrouped"/> instance to identify empty subscriber groups.
|
||||
/// </summary>
|
||||
/// <param name="wsl">The subscriber group instance to be checked for empty groups.</param>
|
||||
/// <returns>A <see cref="List{String}"/> containing validation messages for any empty subscriber groups found; returns an empty list if all groups are valid.</returns>
|
||||
/// <!-- aidoc:v1 sig=d6864a4 -->
|
||||
List<string> CheckEmptySubscriberGroup(WsSubscriberGrouped wsl);
|
||||
/// <summary>
|
||||
/// Adds a new subscriber together with its associated group information to the system.
|
||||
/// </summary>
|
||||
/// <param name="wsSubscriberGrouped">The web service representation of the subscriber and its group assignments to be added.</param>
|
||||
/// <!-- aidoc:v1 sig=fdb64fe -->
|
||||
void AddSubscriberGrouped(WsSubscriberGrouped wsSubscriberGrouped);
|
||||
|
||||
/// <summary>
|
||||
@@ -49,6 +55,7 @@ public interface ISubscriberGroupedService
|
||||
/// <param name="timeZoneId">The time zone identifier used for the observation context.</param>
|
||||
/// <param name="connectionId">The connection identifier for the current request or session.</param>
|
||||
/// <param name="go">The grouped observation to be checked against the subscription.</param>
|
||||
/// <!-- aidoc:v1 sig=adb6856 -->
|
||||
void CheckOnSubscriptionGroup(GroupedField groupedField, ObjectId patientId, string timeZoneId, string connectionId,
|
||||
GroupedObservation go);
|
||||
|
||||
@@ -57,5 +64,6 @@ public interface ISubscriberGroupedService
|
||||
/// </summary>
|
||||
/// <param name="wsgHashCode">The hash code identifying the group whose last grouped observation should be updated.</param>
|
||||
/// <param name="newGroupedObservation">The new grouped observation to set as the last grouped observation in the group.</param>
|
||||
/// <!-- aidoc:v1 sig=3b3409a -->
|
||||
void UpdateLastGroupedObsInGroup(string wsgHashCode, GroupedObservation newGroupedObservation);
|
||||
}
|
||||
@@ -9,28 +9,33 @@ public interface ISubscribersService
|
||||
/// Retrieves the list of subscribers.
|
||||
/// </summary>
|
||||
/// <returns>A list of <see cref="WsSubscriber"/> instances representing the subscribers.</returns>
|
||||
/// <!-- aidoc:v1 sig=7e137ae -->
|
||||
List<WsSubscriber> GetSubscribers();
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="WsSubscriber"/> associated with the specified context connection identifier.
|
||||
/// </summary>
|
||||
/// <param name="contextConnectionId">The unique identifier of the context connection used to look up the subscriber.</param>
|
||||
/// <returns>The <see cref="WsSubscriber"/> matching the given connection identifier, or <c>null</c> if no subscriber is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=b24d002 -->
|
||||
WsSubscriber? GetById(string contextConnectionId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of subscribers associated with the specified point of contact (POC) identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of contact whose subscribers should be returned.</param>
|
||||
/// <returns>A list of <see cref="WsSubscriber"/> instances matching the provided POC identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=aec8331 -->
|
||||
List<WsSubscriber> GetByPocId(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Removes a connection identified by the specified context connection identifier.
|
||||
/// </summary>
|
||||
/// <param name="contextConnectionId">The unique identifier of the connection to remove.</param>
|
||||
/// <returns>An integer indicating the result of the removal operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=26b732e -->
|
||||
int RemoveConnectionById(string contextConnectionId);
|
||||
/// <summary>
|
||||
/// Registers the specified WebSocket subscriber to receive notifications or messages.
|
||||
/// </summary>
|
||||
/// <param name="subscriber">The <see cref="WsSubscriber"/> instance to be added to the collection of subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=695cf06 -->
|
||||
void AddSubscriber(WsSubscriber subscriber);
|
||||
}
|
||||
@@ -13,33 +13,39 @@ public interface ITreatmentService : IApiRequestService
|
||||
/// Inserts a new <see cref="PatientTreatment"/> record into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment entity to be added.</param>
|
||||
/// <!-- aidoc:v1 sig=64e0091 -->
|
||||
Task Insert(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes an entity associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> representing the unique identifier of the patient whose related entity should be removed.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing <c>true</c> if the deletion was successful; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=fa9d1b9 -->
|
||||
Task<bool> DeleteByPatientId(ObjectId id);
|
||||
/// <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=9d4aeba -->
|
||||
Task DeleteById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Archives records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The ObjectId of the patient whose records should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=e5916ec -->
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Archives the specified patient, marking them as archived in the system.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
/// <!-- aidoc:v1 sig=52c2373 -->
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Updates an existing patient treatment record in the system.
|
||||
/// </summary>
|
||||
/// <param name="patientTreatment">The patient treatment entity containing the updated information to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the treatment was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=fa7946f -->
|
||||
Task<bool> UpdateTreatment(PatientTreatment patientTreatment);
|
||||
/// <summary>
|
||||
/// Updates many records by replacing the specified old ObjectId with the new ObjectId in the field identified by nameId.
|
||||
@@ -47,42 +53,49 @@ public interface ITreatmentService : IApiRequestService
|
||||
/// <param name="nameId">The name of the field that contains the ObjectId to be updated.</param>
|
||||
/// <param name="id">The new ObjectId value that will replace the existing one.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced.</param>
|
||||
/// <!-- aidoc:v1 sig=24ef97c -->
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Retrieves all treatments associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose treatments are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of PatientTreatment objects for the specified patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=464e56c -->
|
||||
Task<IEnumerable<PatientTreatment>> GetTreatmentsByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the active treatment records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of active <see cref="PatientTreatment"/> records, which may include null entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=9eb0d98 -->
|
||||
Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a cursor over the <see cref="PatientTreatment"/> records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments should be returned.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> yielding an <see cref="IAsyncCursor{TDocument}"/> that iterates the matching <see cref="PatientTreatment"/> documents.</returns>
|
||||
/// <!-- aidoc:v1 sig=1be8597 -->
|
||||
Task<IAsyncCursor<PatientTreatment>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all 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 a collection of <see cref="PatientTreatment"/> instances for the specified patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=8e33f27 -->
|
||||
Task<IEnumerable<PatientTreatment>> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// 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 retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientTreatment"/> records representing the patient's bolus treatments.</returns>
|
||||
/// <!-- aidoc:v1 sig=e8ec7d6 -->
|
||||
Task<List<PatientTreatment>> GetBolusTreatments(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of patient treatments based on the specified filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter used to control the page number, page size, and other query options.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated patient treatment results.</returns>
|
||||
/// <!-- aidoc:v1 sig=b165424 -->
|
||||
Task<PaginationResponse<PatientTreatment>> GetPaginatedTreatments(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves the list of active treatments associated with the specified patient, sorted according to the provided order parameter.
|
||||
@@ -90,5 +103,6 @@ public interface ITreatmentService : IApiRequestService
|
||||
/// <param name="patientId">The unique identifier of the patient whose active treatments are being queried.</param>
|
||||
/// <param name="order">A string defining the ordering criteria applied to the returned treatments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of active <see cref="PatientTreatment"/> entries for the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=d9fb0b1 -->
|
||||
Task<List<PatientTreatment>> GetActiveTreatmentsByPatientIdAndOrder(ObjectId patientId, string order);
|
||||
}
|
||||
@@ -15,11 +15,13 @@ public interface IUnitService
|
||||
/// </summary>
|
||||
/// <param name="withPocs">Indicates whether the returned units should include their associated POCs.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the list of units.</returns>
|
||||
/// <!-- aidoc:v1 sig=d5d641e -->
|
||||
Task<List<Unit>> GetAll(bool withPocs = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a compact list of all units, returning minimal summary information for each unit.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="UnitInfoDto"/> objects with the compact information of all units.</returns>
|
||||
/// <!-- aidoc:v1 sig=85c8e61 -->
|
||||
Task<List<UnitInfoDto>> GetAllCompact();
|
||||
|
||||
/// <summary>
|
||||
@@ -27,6 +29,7 @@ public interface IUnitService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the unit to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the compact unit information.</returns>
|
||||
/// <!-- aidoc:v1 sig=ea6d80a -->
|
||||
Task<UnitInfoDto> GetOneCompact(ObjectId id);
|
||||
|
||||
// Task<Unit?> GetByCodeSysAndCode(string unit);
|
||||
@@ -35,6 +38,7 @@ public interface IUnitService
|
||||
/// </summary>
|
||||
/// <param name="unit">The name of the unit to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Unit"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d855f4f -->
|
||||
Task<Unit?> GetByName(string unit);
|
||||
|
||||
// Task<Unit?> GetByPointOfCare(PointOfCare pointOfCare);
|
||||
@@ -46,6 +50,7 @@ public interface IUnitService
|
||||
/// <param name="fillLists">When <see langword="true"/>, populates the related lists on the returned unit.</param>
|
||||
/// <param name="withPoCs">When <see langword="true"/>, includes the unit's points of contact in the result.</param>
|
||||
/// <returns>A task that yields the located <see cref="Unit"/>, or <see langword="null"/> if no unit matches the given id.</returns>
|
||||
/// <!-- aidoc:v1 sig=59363d0 -->
|
||||
Task<Unit?> GetInfo(ObjectId id, LocaleEnum? dataLocale, bool fillLists = true, bool withPoCs = false);
|
||||
/// <summary>
|
||||
/// Retrieves information about a unit identified by the specified <paramref name="id"/>, optionally including related points of contact and devices.
|
||||
@@ -54,6 +59,7 @@ public interface IUnitService
|
||||
/// <param name="withPoCs">Indicates whether related points of contact should be included in the result. Defaults to <c>true</c>.</param>
|
||||
/// <param name="withDevices">Indicates whether related devices should be included in the result. Defaults to <c>true</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <c>Unit</c> if found, or <c>null</c> if no unit matches the specified identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=83c1253 -->
|
||||
Task<Unit?> GetInfo(ObjectId id, bool withPoCs = true, bool withDevices = true);
|
||||
|
||||
/// <summary>
|
||||
@@ -61,6 +67,7 @@ public interface IUnitService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose unit is being looked up.</param>
|
||||
/// <returns>A task that represents the asynchronous lookup, containing the matching <see cref="Unit"/> if found, or <c>null</c> if no unit is associated with the patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=2a55026 -->
|
||||
Task<Unit?> FindByPatientId(ObjectId patientId);
|
||||
|
||||
// Task<List<Unit>?> FindByLocation(PatientLocation location);
|
||||
@@ -69,12 +76,14 @@ public interface IUnitService
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the <see cref="Unit"/> to retrieve. May be <c>null</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Unit"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=31e43d9 -->
|
||||
Task<Unit?> FindById(ObjectId? id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Unit"/> entity matching the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the unit. Can be null.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Unit"/> if found; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=1e5dd65 -->
|
||||
Task<Unit?> FindByName(string? name);
|
||||
|
||||
/// <summary>
|
||||
@@ -84,6 +93,8 @@ public interface IUnitService
|
||||
/// <param name="name">The unit name to search for. May be <c>null</c>.</param>
|
||||
/// <param name="pocName">The point-of-contact (POC) name to search for. May be <c>null</c>.</param>
|
||||
/// <returns>A <see cref="Task{Unit}"/> containing the matched <see cref="Unit"/>, or <c>null</c> if no unit is found.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_returns
|
||||
/// "<see cref=\"Task{Unit}\"/> should be <see cref=\"Task{Unit?}\"/> to reflect the nullable Unit return type; text correctly describes null result." -->
|
||||
Task<Unit?> FindByUnitNameOrPocName(string? name, string? pocName);
|
||||
|
||||
//Task<Unit?> FindByPointOfCare(PointOfCare pointOfCare);
|
||||
@@ -92,12 +103,14 @@ public interface IUnitService
|
||||
/// </summary>
|
||||
/// <param name="unit">The <see cref="Unit"/> instance to be inserted.</param>
|
||||
/// <returns>A task that resolves to the inserted <see cref="Unit"/>, or <c>null</c> if the insertion did not produce a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=dcc73fd -->
|
||||
Task<Unit?> InsertOne(Unit unit);
|
||||
/// <summary>
|
||||
/// Updates the specified unit in the system.
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit containing the updated information to persist.</param>
|
||||
/// <returns>A task that returns the updated <see cref="Unit"/>, or <c>null</c> if the unit was not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=fb3e248 -->
|
||||
Task<Unit?> UpdateUnit(Unit unit);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of units associated with the specified master list identifier and master list type.
|
||||
@@ -106,6 +119,7 @@ public interface IUnitService
|
||||
/// <param name="masterListId">The unique identifier of the master list whose units should be retrieved.</param>
|
||||
/// <param name="masterListType">The type of the master list used to scope the unit lookup.</param>
|
||||
/// <returns>A task that returns an <see cref="IEnumerable{T}"/> of <see cref="Unit"/> when matches exist, or null when no matching units are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=af11dcc -->
|
||||
Task<IEnumerable<Unit>?> FindUnitsByMasterListId(ObjectId masterListId, MasterListType masterListType);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of units associated with the specified master list, filtered by the given master list type.
|
||||
@@ -113,18 +127,21 @@ public interface IUnitService
|
||||
/// <param name="masterListId">The unique identifier of the master list whose units should be counted.</param>
|
||||
/// <param name="masterListType">The type of the master list used to scope the count to the appropriate unit category.</param>
|
||||
/// <returns>A <see cref="Task{Int64}"/> that represents the asynchronous operation, containing the total number of units matching the specified master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=64362ca -->
|
||||
Task<long> CountUnitsByMasterListId(ObjectId masterListId, MasterListType masterListType);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of units associated with the specified master list identifier.
|
||||
/// </summary>
|
||||
/// <param name="masterListId">The identifier of the master list whose units are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of units that belong to the specified master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=2e9fc3b -->
|
||||
Task<IEnumerable<Unit>> FindUnitsByMasterListId(ObjectId masterListId);
|
||||
/// <summary>
|
||||
/// Updates the unit master list based on the provided unit ID list DTO.
|
||||
/// </summary>
|
||||
/// <param name="updateUnitListDto">The DTO containing the list of unit IDs to be used for updating the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Unit"/>, or <c>null</c> if the update was not applicable.</returns>
|
||||
/// <!-- aidoc:v1 sig=4b7663f -->
|
||||
Task<Unit?> UpdateUnitMasterList(UpdateUnitIdListDto updateUnitListDto);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the configuration for the specified unit using the provided configuration data.
|
||||
@@ -132,12 +149,14 @@ public interface IUnitService
|
||||
/// <param name="unitIdParsed">The parsed 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 resolves to <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>
|
||||
/// Asynchronously deletes a unit identified by the provided <paramref name="unit"/> entity's identifier.
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit entity whose identifier is used to locate and delete the record.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing a value indicating whether the unit was successfully deleted.</returns>
|
||||
/// <!-- aidoc:v1 sig=734db28 -->
|
||||
Task<bool> DeleteUnitById(Unit unit);
|
||||
/// <summary>
|
||||
/// Updates the information of an existing unit identified by <paramref name="unitId"/>, including its name, title, and optionally its configuration object ID.
|
||||
@@ -148,6 +167,7 @@ public interface IUnitService
|
||||
/// <param name="title">The new title to assign to the unit.</param>
|
||||
/// <param name="configObsId">An optional configuration object ID to associate with the unit.</param>
|
||||
/// <returns>A task that yields the updated <see cref="Unit"/>, or <c>null</c> if the unit does not exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=89b9f8d -->
|
||||
Task<Unit?> UpdateUnitInfo(ObjectId unitId, string name, string title, string? configObsId = null);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of units based on the provided filter, optionally including their associated points of contact.
|
||||
@@ -155,5 +175,6 @@ public interface IUnitService
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and any additional query criteria.</param>
|
||||
/// <param name="withPoCs">A flag indicating whether the response should include the points of contact associated with each unit.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response of units.</returns>
|
||||
/// <!-- aidoc:v1 sig=5b42d0a -->
|
||||
Task<PaginationResponse<Unit>> GetPaginatedUnits(PaginationFilter filter, bool withPoCs);
|
||||
}
|
||||
@@ -21,6 +21,7 @@ public class LocalAuditService(
|
||||
/// <param name="dataOriginal">The original data before the change.</param>
|
||||
/// <param name="dataModified">The modified data after the change.</param>
|
||||
/// <param name="reason">An optional reason for the change; when null, the audit log is created without supplying a reason.</param>
|
||||
/// <!-- aidoc:v1 sig=5416223 body=dfb91a0 -->
|
||||
public async Task CreateAuditLogAsync(ClaimsPrincipal? user, object? dataOriginal, object? dataModified,
|
||||
string? reason)
|
||||
{
|
||||
@@ -48,6 +49,7 @@ public class LocalAuditService(
|
||||
/// </summary>
|
||||
/// <param name="data">The data to be deep copied.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the deep copy of the data, or <c>null</c> if both copy methods fail.</returns>
|
||||
/// <!-- aidoc:v1 sig=8c305ad body=f157829 -->
|
||||
public async Task<T?> DeepCopyAsync<T>(T data)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace adas_core.Application.Services;
|
||||
/// Acts as the concrete implementation of the <see cref="IMasterListService{T}"/> contract for master list operations.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of master list entity managed by the service. Must derive from <see cref="MasterList"/> and expose a public parameterless constructor.</typeparam>
|
||||
/// <!-- aidoc:v1 sig=6dd13a3 -->
|
||||
public class MasterListService<T> : IMasterListService<T> where T : MasterList, new()
|
||||
{
|
||||
private readonly Lazy<IAdmissionService> _admissionService;
|
||||
@@ -88,6 +89,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the master list to delete.</param>
|
||||
/// <exception cref="ConflictException">Thrown when the master list is currently in use and cannot be deleted.</exception>
|
||||
/// <!-- aidoc:v1 sig=bbde86c body=1e4169e -->
|
||||
public async Task DeleteMasterListById(ObjectId id)
|
||||
{
|
||||
var repository = GetRepository();
|
||||
@@ -133,6 +135,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The identifier of the master list to which the option will be added.</param>
|
||||
/// <param name="opt">The filter option element to add to the master list.</param>
|
||||
/// <returns>The resulting <see cref="OptionList"/> entry if the option is successfully added; <c>null</c> if the master list cannot be found, no result is produced, or an error is encountered during the operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=1602f0d body=c7da593 -->
|
||||
public async Task<OptionList?> AddOptionToMasterList(ObjectId id, FilterOptionListElement opt)
|
||||
{
|
||||
try
|
||||
@@ -172,6 +175,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="typeName">The type name used when propagating the update to the patient item list.</param>
|
||||
/// <param name="locale">The locale used for the master list option update and retrieval of the updated entity for auditing.</param>
|
||||
/// <returns>The updated <see cref="OptionList"/>, or <c>null</c> if the update failed, the result was <c>null</c>, or an exception occurred.</returns>
|
||||
/// <!-- aidoc:v1 sig=da045e6 body=6f739c4 -->
|
||||
public async Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName,
|
||||
LocaleEnum locale)
|
||||
{
|
||||
@@ -210,6 +214,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="opt">The option containing the new values to apply.</param>
|
||||
/// <param name="typeName">The name of the type used when updating the associated patient item list.</param>
|
||||
/// <returns>The updated <see cref="OptionList"/> if the operation succeeds, or <c>null</c> if the master list is not found or an exception is thrown.</returns>
|
||||
/// <!-- aidoc:v1 sig=f0915ad body=ec1df57 -->
|
||||
public async Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName)
|
||||
{
|
||||
try
|
||||
@@ -249,6 +254,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="opt">The option with the new values to apply to the master list.</param>
|
||||
/// <param name="typeName">The name of the entity type used when updating the related patient item list.</param>
|
||||
/// <returns>The updated <see cref="OptionList"/> when the operation succeeds; <c>null</c> when the update fails or an error is caught.</returns>
|
||||
/// <!-- aidoc:v1 sig=4a7ad76 body=2986e84 -->
|
||||
public async Task<OptionList?> UpdateFullMasterListOption(ObjectId id, OptionList opt, string typeName)
|
||||
{
|
||||
try
|
||||
@@ -286,6 +292,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="optId">The identifier of the option to remove from the master list.</param>
|
||||
/// <param name="typeName">The name of the type used when cascading the deletion to related patient item lists.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the option is successfully deleted and the side-effects are applied; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=e654e5f body=b693722 -->
|
||||
public async Task<bool> DeleteMasterListOption(ObjectId id, ObjectId optId, string typeName)
|
||||
{
|
||||
try
|
||||
@@ -322,6 +329,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The identifier of the master list whose option details will be updated.</param>
|
||||
/// <param name="opt">The new option details to apply to the master list.</param>
|
||||
/// <returns>A task that yields the updated <see cref="UpdateMasterListDetailsDto"/> on success, or <c>null</c> when the update fails or an exception is caught and logged.</returns>
|
||||
/// <!-- aidoc:v1 sig=53d4179 body=f5f38c9 -->
|
||||
public async Task<UpdateMasterListDetailsDto?> UpdateOptionDetailsToMasterList(ObjectId id,
|
||||
UpdateMasterListDetailsDto opt)
|
||||
{
|
||||
@@ -354,6 +362,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The identifier of the master list to rename.</param>
|
||||
/// <param name="name">The new name to assign to the master list.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the master list name was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=5b79a51 body=2b55065 -->
|
||||
public async Task<bool> UpdateMasterListName(ObjectId id, string name)
|
||||
{
|
||||
try
|
||||
@@ -384,6 +393,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The identifier of the master list to update.</param>
|
||||
/// <param name="name">The new description to apply to the master list.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the update succeeded; otherwise, <c>false</c> when the update fails or an exception is caught and logged.</returns>
|
||||
/// <!-- aidoc:v1 sig=f402203 body=2065699 -->
|
||||
public async Task<bool> UpdateMasterListDescription(ObjectId id, string name)
|
||||
{
|
||||
try
|
||||
@@ -414,6 +424,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The identifier of the master list from which the option will be removed.</param>
|
||||
/// <param name="oldOpt">The option to remove from the master list.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the option was successfully removed; <c>false</c> if the operation failed or an error occurred.</returns>
|
||||
/// <!-- aidoc:v1 sig=8de50cd body=2393e14 -->
|
||||
public async Task<bool> RemoveMasterListOption(ObjectId id, OptionList oldOpt)
|
||||
{
|
||||
try
|
||||
@@ -444,6 +455,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// If an exception occurs during retrieval, the error is logged and an empty collection is returned as a fallback.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains all retrieved entries, or an empty collection if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=438d930 body=23055ad -->
|
||||
public async Task<IEnumerable<T>> GetAllMasterList()
|
||||
{
|
||||
try
|
||||
@@ -463,6 +475,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// If an error occurs, the exception is logged and an empty collection is returned as a fallback.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="MasterListDto"/> items, or an empty collection if an error is encountered.</returns>
|
||||
/// <!-- aidoc:v1 sig=ff97d15 body=6dc7eab -->
|
||||
public async Task<IEnumerable<MasterListDto>> GetAllMasterListWithoutOptions()
|
||||
{
|
||||
try
|
||||
@@ -485,6 +498,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="optionId">The identifier of the specific option to locate.</param>
|
||||
/// <param name="locale">The locale used to resolve the localized option item.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> containing the matching <see cref="OptionList"/>, or <c>null</c> if no item is found or an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=fdb2628 body=57f7d69 -->
|
||||
public async Task<OptionList?> FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale)
|
||||
{
|
||||
try
|
||||
@@ -505,6 +519,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter whose page size is applied when building each result entry.</param>
|
||||
/// <returns>A task that yields an enumerable of <see cref="MasterListWithPaginatedOptionsDto"/> containing the mapped master lists, or an empty enumerable if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=e2b42f3 body=87dac37 -->
|
||||
public async Task<IEnumerable<MasterListWithPaginatedOptionsDto>> GetAllMasterListWithPaginatedOptions(
|
||||
PaginationFilter request)
|
||||
{
|
||||
@@ -534,6 +549,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// Returns 0 if an error occurs while accessing the repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the total count of records, or 0 if an error was encountered.</returns>
|
||||
/// <!-- aidoc:v1 sig=c52b4f8 body=ba61e78 -->
|
||||
public async Task<int> GetAllMasterListCount()
|
||||
{
|
||||
try
|
||||
@@ -555,6 +571,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The unique identifier of the master list to retrieve.</param>
|
||||
/// <param name="locale">The optional locale used to localize the retrieved master list.</param>
|
||||
/// <returns>The master list of type <typeparamref name="T"/> if found; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=3e8f3d7 body=947fcc9 -->
|
||||
public async Task<T?> GetMasterListById(ObjectId id, LocaleEnum? locale)
|
||||
{
|
||||
try
|
||||
@@ -576,6 +593,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The unique identifier of the master list to retrieve.</param>
|
||||
/// <param name="request">The pagination filter that determines the page size for the returned options.</param>
|
||||
/// <returns>A task that yields a <see cref="MasterListWithPaginatedOptionsDto"/> when the master list is found; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=d2dd8ff body=6215360 -->
|
||||
public async Task<MasterListWithPaginatedOptionsDto?> GetMasterListByIdWithPaginatedOptions(ObjectId id,
|
||||
PaginationFilter request)
|
||||
{
|
||||
@@ -604,6 +622,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the master list whose option names are to be retrieved.</param>
|
||||
/// <returns>A list of option names for the found master list, or an empty list if the list is not found or an error is encountered.</returns>
|
||||
/// <!-- aidoc:v1 sig=6fb6e81 body=27002bc -->
|
||||
public async Task<List<string>> GetMasterListOptionsNamesById(ObjectId id)
|
||||
{
|
||||
try
|
||||
@@ -629,6 +648,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The identifier used to locate the master list in the repository.</param>
|
||||
/// <param name="textSearch">The optional text search term used to filter the results; may be null.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="OptionList"/> entries that match the specified identifier and text search criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=a3a824e body=218b0ef -->
|
||||
public async Task<List<OptionList>> GetMasterListByIdAndTextSearch(ObjectId id, string? textSearch)
|
||||
{
|
||||
try
|
||||
@@ -649,6 +669,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The identifier used to locate the master list.</param>
|
||||
/// <param name="filterOption">The filter options applied to narrow the search within the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="OptionList"/> items matching the given criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=2a76fbd body=1d979f3 -->
|
||||
public async Task<List<OptionList>> GetMasterListByIdAndSearchOptions(ObjectId id,
|
||||
FilterOptionListElement filterOption)
|
||||
{
|
||||
@@ -661,6 +682,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the master list entry to look up.</param>
|
||||
/// <returns>A task that resolves to the matching item of type T, or null when no item is found or the lookup fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=4e2a946 body=4d99da2 -->
|
||||
public async Task<T?> GetMasterListByName(string name)
|
||||
{
|
||||
try
|
||||
@@ -681,6 +703,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing the page number and page size used to determine the subset of records to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PaginationResponse{T}"/> with the paginated data, the current page number, the page size, and the total document count.</returns>
|
||||
/// <!-- aidoc:v1 sig=c6c73b2 body=8453888 -->
|
||||
public async Task<PaginationResponse<T>> GetPaginatedMasterList(PaginationFilter filter)
|
||||
{
|
||||
var repository = GetRepository();
|
||||
@@ -707,6 +730,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="listFilter">Pagination parameters (page number and page size) used to slice the master list result set.</param>
|
||||
/// <param name="optionFilter">Pagination parameters whose page size is applied to the options associated with each returned master list item.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing a <see cref="PaginationResponse{T}"/> of <see cref="MasterListWithPaginatedOptionsDto"/> with the requested page of master lists, their paginated options, the current page metadata, and the total document count.</returns>
|
||||
/// <!-- aidoc:v1 sig=97d48e5 body=dadadb5 -->
|
||||
public async Task<PaginationResponse<MasterListWithPaginatedOptionsDto>> GetPaginatedMasterListWithPaginatedOptions(
|
||||
PaginationFilter listFilter, PaginationFilter optionFilter)
|
||||
{
|
||||
@@ -741,6 +765,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="filter">The pagination filter that defines the page number and page size to apply to the results.</param>
|
||||
/// <param name="listId">The identifier of the list whose options are being retrieved.</param>
|
||||
/// <returns>A <see cref="PaginationResponse{OptionList}"/> containing the requested page of options, the current page metadata, and the total count of available options.</returns>
|
||||
/// <!-- aidoc:v1 sig=5a05956 body=0aee55a -->
|
||||
public async Task<PaginationResponse<OptionList>> GetPaginatedOptions(PaginationFilter filter, ObjectId listId)
|
||||
{
|
||||
var repository = GetRepository();
|
||||
@@ -757,6 +782,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="item">The master list entity to insert.</param>
|
||||
/// <returns>The inserted entity retrieved from the repository, or <c>null</c> if the operation fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=70bbd79 body=44b9a00 -->
|
||||
public async Task<T?> InsertMasterList(T item)
|
||||
{
|
||||
try
|
||||
@@ -781,6 +807,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="item">The item to update in the master list.</param>
|
||||
/// <returns>The updated item retrieved from the repository, or <c>null</c> if an error occurred during the update.</returns>
|
||||
/// <!-- aidoc:v1 sig=525dfd0 body=7010df2 -->
|
||||
public async Task<T?> UpdateMasterList(T item)
|
||||
{
|
||||
try
|
||||
@@ -810,6 +837,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="masterListType1">The master list type used to find the unit (e.g., the primary list reference on the unit).</param>
|
||||
/// <param name="masterListType2">The master list type that determines which associated list identifier is returned from the resolved unit.</param>
|
||||
/// <returns>A task that yields the associated <see cref="ObjectId"/> when a matching list exists, or <c>null</c> when no unit is found or the type is not mapped.</returns>
|
||||
/// <!-- aidoc:v1 sig=e127506 body=2c24e0e -->
|
||||
public async Task<ObjectId?> GetAssociatedList(ObjectId id, MasterListType masterListType1,
|
||||
MasterListType masterListType2)
|
||||
{
|
||||
@@ -855,6 +883,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the list whose options should be retrieved.</param>
|
||||
/// <returns>A list of option names belonging to the matching list, or an empty list if the list is not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=ec8c6e3 body=716cd88 -->
|
||||
public async Task<List<string>> GetOptionsOfList(ObjectId id)
|
||||
{
|
||||
var repository = GetRepository();
|
||||
@@ -869,6 +898,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// Resolves and returns the master list repository instance for the current entity type from the dependency injection service provider.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="IMasterListRepository{T}"/> instance retrieved from the configured <see cref="IServiceProvider"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d65745e body=789f6e7 -->
|
||||
private IMasterListRepository<T> GetRepository()
|
||||
{
|
||||
return _serviceProvider.GetRequiredService<IMasterListRepository<T>>();
|
||||
@@ -880,6 +910,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The identifier of the master list whose dependent units and related records need to be updated.</param>
|
||||
/// <param name="opt">The update payload describing the master list change to apply to the related patient records.</param>
|
||||
/// <param name="typeName">The name of the master list type used to scope the update across the affected services.</param>
|
||||
/// <!-- aidoc:v1 sig=624e0d5 body=c47ad11 -->
|
||||
private async Task UpdatePatientItemList(ObjectId id, UpdateOptionMasterListDto opt, string typeName)
|
||||
{
|
||||
// Necesito saber que unidades tienen el id de lista que estamos modificando
|
||||
@@ -897,6 +928,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="id">The master list identifier used to locate the units that reference it.</param>
|
||||
/// <param name="opt">The option list containing the item to be removed from the affected records.</param>
|
||||
/// <param name="typeName">The type name of the master list item to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=4492294 body=9b327f2 -->
|
||||
private async Task DeletePatientItemList(ObjectId id, OptionList opt, string typeName)
|
||||
{
|
||||
// Necesito saber que unidades tienen el id de lista que estamos modificando
|
||||
@@ -912,6 +944,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// Asynchronously saves the specified API request by offloading the save operation to a background task.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
/// <!-- aidoc:v1 sig=a3706aa body=c8d77ba -->
|
||||
public Task SaveRequestAsync(ApiRequest apiRequest)
|
||||
{
|
||||
return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); }));
|
||||
@@ -921,6 +954,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// Saves the specified API request.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to save.</param>
|
||||
/// <!-- aidoc:v1 sig=3385bba body=6805ef5 -->
|
||||
public Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -932,6 +966,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="masterList">The master list entity triggering the broadcast; its runtime type name is used to determine the master list category.</param>
|
||||
/// <param name="operation">The operation performed on the master list, which is sent to each subscriber along with the localized master list options.</param>
|
||||
/// <!-- aidoc:v1 sig=73619af body=f177e6e -->
|
||||
private async Task SendMasterListBroadcast(T masterList, OperationType operation)
|
||||
{
|
||||
try
|
||||
@@ -974,6 +1009,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// <param name="updatedItem">The new or modified option list item, included in add and update operations.</param>
|
||||
/// <param name="oldItem">The previous option list item, included in delete and update operations.</param>
|
||||
/// <param name="operation">The operation type that determines the structure of the broadcast message sent to subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=e48c5b0 body=c41b16d -->
|
||||
private async Task SendMasterListItemBroadcast(T masterList, OptionList? updatedItem, OptionList? oldItem,
|
||||
OperationType operation)
|
||||
{
|
||||
@@ -1043,6 +1079,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="list">The master list whose associated units should be retrieved. Its identifier and list type are used to look up the related units.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="UnitInfoDto"/> instances for the units linked to the specified list, or an empty list if none exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=e1e565a body=764dda0 -->
|
||||
private async Task<List<UnitInfoDto>> IsInUse(T list)
|
||||
{
|
||||
var units = await _unitService.Value.FindUnitsByMasterListId(list.Id, list.ListType);
|
||||
@@ -1063,6 +1100,7 @@ public class MasterListService<T> : IMasterListService<T> where T : MasterList,
|
||||
/// </summary>
|
||||
/// <param name="list">The master list entity whose associated unit count is being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the number of units referencing the master list.</returns>
|
||||
/// <!-- aidoc:v1 sig=83c6ba6 body=a349dfa -->
|
||||
private async Task<long> IsInUseCount(T list)
|
||||
{
|
||||
return await _unitService.Value.CountUnitsByMasterListId(list.Id, list.ListType);
|
||||
|
||||
@@ -35,6 +35,7 @@ public class MasterListServiceFactory(
|
||||
/// <returns>An object representing the resolved service instance for the requested master list type.</returns>
|
||||
/// <exception cref="BadRequestException">Thrown when the type corresponding to <paramref name="serviceName"/> cannot be resolved in the adas_core.Domain.Models.Masters namespace.</exception>
|
||||
/// <exception cref="NotFoundException">Thrown when the generic service type cannot be constructed for the resolved type parameter.</exception>
|
||||
/// <!-- aidoc:v1 sig=fb7b709 body=3d6f937 -->
|
||||
public object GetService(MasterListType serviceName)
|
||||
{
|
||||
var typeParameter = Type.GetType($"adas_core.Domain.Models.Masters.{serviceName}, adas-core.Domain") ??
|
||||
@@ -53,6 +54,7 @@ public class MasterListServiceFactory(
|
||||
/// <param name="serviceType">The type of the service to resolve. Must be a generic type based on <c>MasterListService<></c> to be successfully handled.</param>
|
||||
/// <returns>The resolved service instance implementing <see cref="IMasterListService{T}"/> for the corresponding item type.</returns>
|
||||
/// <exception cref="System.InvalidOperationException">Thrown when the requested <paramref name="serviceType"/> is not a generic <c>MasterListService<></c>, or when no implementation of <see cref="IMasterListService{T}"/> can be resolved for the requested item type.</exception>
|
||||
/// <!-- aidoc:v1 sig=614ae51 body=8ee1e7f -->
|
||||
public object GetService(Type serviceType)
|
||||
{
|
||||
// Verifica si el tipo es genérico y está basado en MasterList
|
||||
@@ -81,6 +83,7 @@ public class MasterListServiceFactory(
|
||||
/// </summary>
|
||||
/// <param name="masterListType">The enumeration value identifying which master list category to resolve to its concrete type.</param>
|
||||
/// <returns>The <see cref="Type"/> that implements the requested master list category, or <see cref="MasterList"/> when no specific type applies.</returns>
|
||||
/// <!-- aidoc:v1 sig=6c365b2 body=880f6dd -->
|
||||
public Type GetMasterListSpecificType(MasterListType masterListType)
|
||||
{
|
||||
// mapear cada valor de MasterListType a su respectivo tipo específico
|
||||
@@ -118,6 +121,7 @@ public class MasterListServiceFactory(
|
||||
/// <param name="masterListType">The discriminator used to resolve the concrete <see cref="MasterList"/> subtype to create.</param>
|
||||
/// <param name="masterList">The source <see cref="MasterList"/> whose properties are mapped onto the created specific instance.</param>
|
||||
/// <returns>The created specific <see cref="MasterList"/> instance with mapped properties, or null if reflection failed to create the instance.</returns>
|
||||
/// <!-- aidoc:v1 sig=2fcd123 body=40fe8bf -->
|
||||
public object? GetTypedMasterList(MasterListType masterListType, MasterList masterList)
|
||||
{
|
||||
// Obtiene el tipo específico de MasterList basado en masterListType
|
||||
@@ -141,6 +145,7 @@ public class MasterListServiceFactory(
|
||||
/// <param name="masterList">The master list entity to be converted and inserted.</param>
|
||||
/// <returns>The result produced by the dynamically invoked <c>InsertMasterList</c> method, or <c>null</c> when the awaited task exposes no result value.</returns>
|
||||
/// <exception cref="InvalidOperationException">Thrown when no service is registered for the specified <paramref name="masterListType"/>, when the master list cannot be converted to its expected typed instance, or when the <c>InsertMasterList</c> method cannot be found on the resolved service.</exception>
|
||||
/// <!-- aidoc:v1 sig=bf8421c body=6aa822f -->
|
||||
public async Task<object?> InsertMasterList(MasterListType masterListType, MasterList masterList)
|
||||
{
|
||||
dynamic service = GetService(masterListType) ??
|
||||
@@ -167,6 +172,7 @@ public class MasterListServiceFactory(
|
||||
/// <exception cref="InvalidOperationException">Thrown when no service is registered for the specified <paramref name="masterListType"/>.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown when the provided <paramref name="masterList"/> cannot be converted to its specific typed master list.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown when the resolved service does not expose an <c>UpdateMasterList</c> method matching the typed master list argument.</exception>
|
||||
/// <!-- aidoc:v1 sig=d9a7df7 body=d1a68c9 -->
|
||||
public async Task<object?> UpdateMasterList(MasterListType masterListType, MasterList masterList)
|
||||
{
|
||||
dynamic service = GetService(masterListType) ??
|
||||
@@ -192,6 +198,7 @@ public class MasterListServiceFactory(
|
||||
/// <param name="dataLocale">An optional locale used to localize the returned data; may be <c>null</c> when localization is not required.</param>
|
||||
/// <returns>A task that resolves to the retrieved master list item as an <see cref="object"/>, or <c>null</c> when the awaited result has no value.</returns>
|
||||
/// <exception cref="System.InvalidOperationException">Thrown when no service is registered for the supplied <paramref name="masterListType"/>, or when the target service does not expose a compatible <c>GetMasterListById</c> method matching the expected parameters.</exception>
|
||||
/// <!-- aidoc:v1 sig=f1cc73f body=1ede241 -->
|
||||
public async Task<object?> GetMasterListById(MasterListType masterListType, ObjectId masterListId,
|
||||
LocaleEnum? dataLocale)
|
||||
{
|
||||
@@ -221,6 +228,7 @@ public class MasterListServiceFactory(
|
||||
/// <returns>A task that resolves to the located master list option as an <see cref="object"/>, or <see langword="null"/> if the underlying task produced no result.</returns>
|
||||
/// <exception cref="InvalidOperationException">Thrown when no service implementation is registered for the given <paramref name="masterListType"/>.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown when the resolved service does not expose the expected <c>FindOptionItemById</c> method.</exception>
|
||||
/// <!-- aidoc:v1 sig=ba7db8d body=81e73c2 -->
|
||||
public async Task<object?> GetMasterListOptionById(MasterListType masterListType, ObjectId masterListId,
|
||||
ObjectId masterListOptionId,
|
||||
LocaleEnum? dataLocale)
|
||||
@@ -248,6 +256,7 @@ public class MasterListServiceFactory(
|
||||
/// and appending the fixed observation "PatientIncomingData".
|
||||
/// </summary>
|
||||
/// <returns>A list of nurse observation names, including all configured manual observations and the fixed "PatientIncomingData" entry.</returns>
|
||||
/// <!-- aidoc:v1 sig=c39c888 body=a74adf6 -->
|
||||
public List<string> StringNurseObs()
|
||||
{
|
||||
var stringNurseObs = new List<string>();
|
||||
@@ -286,6 +295,7 @@ public class MasterListServiceFactory(
|
||||
/// <param name="locale">The target locale for translation; when set to <c>Default</c>, no translation is performed.</param>
|
||||
/// <param name="patient">The patient whose option list values will be translated in place.</param>
|
||||
/// <returns>A task that resolves to the same <see cref="Patient"/> instance with translated option names, or null if the input patient is null.</returns>
|
||||
/// <!-- aidoc:v1 sig=83910e9 body=96fe28d -->
|
||||
public async Task<Patient?> GetPatientTraslated(Unit? unit, LocaleEnum? locale, Patient? patient)
|
||||
{
|
||||
if (patient == null)
|
||||
@@ -368,6 +378,7 @@ public class MasterListServiceFactory(
|
||||
/// </summary>
|
||||
/// <param name="source">The <see cref="MasterList"/> instance whose property values are read.</param>
|
||||
/// <param name="destination">The target object that receives the matching property values.</param>
|
||||
/// <!-- aidoc:v1 sig=b6041e3 body=1170a2a -->
|
||||
private void MapMasterListProperties(MasterList source, object destination)
|
||||
{
|
||||
// Obtiene las propiedades del tipo de origen y destino
|
||||
|
||||
@@ -36,6 +36,7 @@ public class MedicineService(
|
||||
/// Retrieves all medicines from the repository asynchronously.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of all <see cref="Medicine"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=6bce187 body=38d3044 -->
|
||||
public async Task<List<Medicine>> GetAll()
|
||||
{
|
||||
return await medicineRepository.GetAll();
|
||||
@@ -46,6 +47,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="code">The unique code identifier of the medicine to retrieve.</param>
|
||||
/// <returns>A <see cref="Medicine"/> instance if a medicine with the specified code exists; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=9f0c493 body=0fd6bb1 -->
|
||||
public async Task<Medicine?> GetByCode(string code)
|
||||
{
|
||||
return await medicineRepository.GetMedicine(code);
|
||||
@@ -56,6 +58,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="codeNote">A list of strings representing the codes or notes used to search for matching medicines.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Medicine"/> objects that match the specified codes or notes.</returns>
|
||||
/// <!-- aidoc:v1 sig=3cc75c7 body=40ffa28 -->
|
||||
public async Task<List<Medicine>> GetByCodeOrNote(List<string> codeNote)
|
||||
{
|
||||
return await medicineRepository.GetMedicineByCodeOrNote(codeNote);
|
||||
@@ -67,6 +70,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the medicine to look up.</param>
|
||||
/// <returns>A <see cref="Medicine"/> if a match is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=c2409b6 body=1be51c8 -->
|
||||
public async Task<Medicine?> GetByName(string name)
|
||||
{
|
||||
return await medicineRepository.GetMedicineByName(name);
|
||||
@@ -77,6 +81,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="treatments">The patient treatments to resolve medicines for. Null entries are skipped.</param>
|
||||
/// <returns>An enumerable of medicines resolved from the supplied treatments, aggregating types, codes, groups, and notes when a treatment specifies a <c>RequestedGiveTreatment</c> name.</returns>
|
||||
/// <!-- aidoc:v1 sig=c254229 body=d49d316 -->
|
||||
public async Task<IEnumerable<Medicine>> GetMedicinesOfTreatments(IEnumerable<PatientTreatment?> treatments)
|
||||
{
|
||||
var totalMedicines = new List<Medicine>();
|
||||
@@ -165,6 +170,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active medicines are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of <see cref="Medicine"/> instances linked to the patient's active treatments.</returns>
|
||||
/// <!-- aidoc:v1 sig=1d2d0a9 body=c9a2dcc -->
|
||||
public async Task<IEnumerable<Medicine>> GetActiveMedicinesByPatient(ObjectId patientId)
|
||||
{
|
||||
var activeTreatments = await treatmentService.GetActiveTreatmentsByPatient(patientId);
|
||||
@@ -177,6 +183,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing the page number and page size used to determine which subset of medicines to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PaginationResponse{Medicine}"/> with the medicines for the requested page, the current page number, the page size, and the total count of medicines matching the query.</returns>
|
||||
/// <!-- aidoc:v1 sig=806bf86 body=f9249ed -->
|
||||
public async Task<PaginationResponse<Medicine>> GetPaginatedMedicines(PaginationFilter filter)
|
||||
{
|
||||
var result = medicineRepository.GetPaginatedMedicines(filter);
|
||||
@@ -201,6 +208,7 @@ public class MedicineService(
|
||||
/// <param name="medicineId">The unique identifier of the medicine to retrieve.</param>
|
||||
/// <returns>The <see cref="Medicine"/> entity if found; otherwise, the method throws an exception.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no medicine is found for the specified <paramref name="medicineId"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=be77265 body=440a8fa -->
|
||||
public async Task<Medicine?> GetMedicineById(ObjectId medicineId)
|
||||
{
|
||||
return await medicineRepository.GetMedicineById(medicineId) ??
|
||||
@@ -213,6 +221,7 @@ public class MedicineService(
|
||||
/// <param name="medicine">The medicine entity to create.</param>
|
||||
/// <returns>The newly created <see cref="Medicine"/> entity.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the repository returns a null result, indicating the creation failed.</exception>
|
||||
/// <!-- aidoc:v1 sig=25564e2 body=3bf2108 -->
|
||||
public async Task<Medicine?> PostMedicine(Medicine medicine)
|
||||
{
|
||||
var result = await medicineRepository.PostMedicine(medicine) ??
|
||||
@@ -226,6 +235,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity containing the updated information.</param>
|
||||
/// <returns>The updated <see cref="Medicine"/>, or <c>null</c> if the update did not produce a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=baa8582 body=2626b7e -->
|
||||
public async Task<Medicine?> UpdateMedicine(Medicine medicine)
|
||||
{
|
||||
var oldMedicine = GetMedicineById(medicine.Id);
|
||||
@@ -239,6 +249,7 @@ public class MedicineService(
|
||||
/// Captures the existing medicine state prior to deletion to preserve audit trail details.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique identifier of the medicine to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=ea3ac00 body=1689aa2 -->
|
||||
public async Task DeleteMedicineById(ObjectId medicineId)
|
||||
{
|
||||
var oldMedicine = GetMedicineById(medicineId);
|
||||
@@ -250,6 +261,7 @@ public class MedicineService(
|
||||
/// Asynchronously retrieves all distinct medicine types from the repository. Returns an empty list if an exception occurs during the retrieval process.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of distinct medicine type strings, or an empty list if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=39dbb1c body=e709a32 -->
|
||||
public async Task<List<string>> GetAllTypes()
|
||||
{
|
||||
try
|
||||
@@ -269,6 +281,7 @@ public class MedicineService(
|
||||
/// Returns an empty list if an error occurs while fetching or converting the data.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of distinct group strings, or an empty list if an exception is encountered.</returns>
|
||||
/// <!-- aidoc:v1 sig=fa46f44 body=e246c96 -->
|
||||
public async Task<List<string>> GetAllGroups()
|
||||
{
|
||||
try
|
||||
@@ -287,6 +300,7 @@ public class MedicineService(
|
||||
/// Retrieves all distinct medicine names from the repository asynchronously, returning an empty list if any error occurs during the data retrieval or mapping process.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of medicine names, or an empty list if the operation fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=beaf9c9 body=8f4cffa -->
|
||||
public async Task<List<string>> GetAllNames()
|
||||
{
|
||||
try
|
||||
@@ -306,6 +320,7 @@ public class MedicineService(
|
||||
/// Returns an empty list if an exception occurs during retrieval.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of code strings, or an empty list if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=5dbd383 body=c312526 -->
|
||||
public async Task<List<string>> GetAllCodes()
|
||||
{
|
||||
try
|
||||
@@ -327,6 +342,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment whose notes are used to derive the parental nutrition medicine.</param>
|
||||
/// <returns>A task containing the calculated <see cref="Medicine"/>, or <c>null</c> when no "NPT" note is found or when an error is logged during processing.</returns>
|
||||
/// <!-- aidoc:v1 sig=448874c body=b5dfee6 -->
|
||||
private Task<Medicine?> CalculateParentalNutritionMedicine(PatientTreatment treatment)
|
||||
{
|
||||
Medicine? medicine = null;
|
||||
|
||||
@@ -35,6 +35,7 @@ public class NoticeService(
|
||||
/// Deletes the specified notice by delegating to the ID-based deletion routine.
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice to delete; its <c>Id</c> is used to identify the record to remove.</param>
|
||||
/// <!-- aidoc:v1 sig=8a4d223 body=3e9937f -->
|
||||
public async Task DeleteNoticeAsync(Notice notice)
|
||||
{
|
||||
await DeleteNoticeByIdAsync(notice.Id);
|
||||
@@ -44,6 +45,7 @@ public class NoticeService(
|
||||
/// Deletes a notice identified by its unique ID, creating an audit log entry and broadcasting the deletion when successful. If the notice is not found, the operation is logged and the method returns without making changes; any unexpected exception is logged without being rethrown.
|
||||
/// </summary>
|
||||
/// <param name="noticeId">The unique identifier of the notice to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=fc4fef5 body=3b2109f -->
|
||||
public async Task DeleteNoticeByIdAsync(ObjectId noticeId)
|
||||
{
|
||||
try
|
||||
@@ -72,6 +74,7 @@ public class NoticeService(
|
||||
/// </summary>
|
||||
/// <param name="noticeId">The unique <see cref="ObjectId"/> of the notice to retrieve.</param>
|
||||
/// <returns>A <see cref="Notice"/> instance if found; otherwise, <c>null</c> when an exception is thrown during the search.</returns>
|
||||
/// <!-- aidoc:v1 sig=a29748d body=b9afac8 -->
|
||||
public async Task<Notice?> GetNoticeByIdAsync(ObjectId noticeId)
|
||||
{
|
||||
try
|
||||
@@ -92,6 +95,7 @@ public class NoticeService(
|
||||
/// <param name="noticeType">The type of notice to filter the search by.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="Notice"/> objects matching the specified type.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no notices are found for the specified <paramref name="noticeType"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=f464ed9 body=32bab14 -->
|
||||
public async Task<IEnumerable<Notice>?> GetNoticeByTypeAsync(string noticeType)
|
||||
{
|
||||
return await noticeRepository.FindByType(noticeType) ??
|
||||
@@ -102,6 +106,7 @@ public class NoticeService(
|
||||
/// Retrieves all notices from the repository asynchronously.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of all <see cref="Notice"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=bb01c16 body=1c55179 -->
|
||||
public async Task<IEnumerable<Notice>> GetNoticesAsync()
|
||||
{
|
||||
return await noticeRepository.FindAll();
|
||||
@@ -112,6 +117,7 @@ public class NoticeService(
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice to insert. A new identifier is assigned before persistence.</param>
|
||||
/// <returns>The inserted notice with its newly assigned identifier, or null if the operation fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=3214327 body=e0c3682 -->
|
||||
public async Task<Notice?> InsertNotice(Notice notice)
|
||||
{
|
||||
try
|
||||
@@ -138,6 +144,7 @@ public class NoticeService(
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice entity containing the updated data.</param>
|
||||
/// <exception cref="ConflictException">Thrown when the notice cannot be found in the repository.</exception>
|
||||
/// <!-- aidoc:v1 sig=b9bba8f body=19a0acb -->
|
||||
public async Task UpdateNoticeAsync(Notice notice)
|
||||
{
|
||||
try
|
||||
@@ -158,6 +165,7 @@ public class NoticeService(
|
||||
/// Processes an API request to create, update, or delete a notice based on the request type. Validates required fields for new and updated notices, skips processing when the notice or its description is missing, and logs any exceptions encountered.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the notice payload and the operation type (NewNotice, UpdateNotice, or DeleteNotice) to perform.</param>
|
||||
/// <!-- aidoc:v1 sig=229d8cd body=c1e382c -->
|
||||
public async Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
try
|
||||
@@ -209,6 +217,7 @@ public class NoticeService(
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to save.</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); }));
|
||||
@@ -220,6 +229,7 @@ public class NoticeService(
|
||||
/// </summary>
|
||||
/// <param name="displayId">The ObjectId of the display used to look up associated notices.</param>
|
||||
/// <returns>A task containing an <see cref="IEnumerable{T}"/> of <see cref="Notice"/> objects matching the display, or null if the operation fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=0f1e6c7 body=ebcd280 -->
|
||||
public async Task<IEnumerable<Notice>?> GetNoticesByDisplayId(ObjectId displayId)
|
||||
{
|
||||
try
|
||||
@@ -239,6 +249,8 @@ public class NoticeService(
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice to broadcast. Its <c>DisplayId</c> is used to resolve the target display and its subscribers.</param>
|
||||
/// <param name="operation">The operation type that identifies the kind of notice being broadcast and is forwarded to each subscriber.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
|
||||
/// "The summary states 'any exception thrown while sending is caught and logged,' but the SendAsync calls are invoked fire-and-forget (`_ = clientMessageService.SendAsync(...)`), so exceptions thrown within those tasks are not caught by this method's try/catch and would surface as unobserved task exceptions." -->
|
||||
private async void SendNoticeBroadcast(Notice notice, OperationType operation)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -26,6 +26,7 @@ public class ObservationDemoService(
|
||||
/// <param name="patient">The patient to associate with the generated alarms.</param>
|
||||
/// <param name="dataAlarmfields">The list of fields used to look up alarm configurations and produce alarms.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of mapped <see cref="PatientObservationAlarm"/> instances that were successfully resolved.</returns>
|
||||
/// <!-- aidoc:v1 sig=bc2b31e body=f044666 -->
|
||||
public async Task<List<PatientObservationAlarm>> GenerateAlarmByField(Patient patient, List<Field> dataAlarmfields)
|
||||
{
|
||||
var listToReturn = new List<PatientObservationAlarm>();
|
||||
@@ -87,6 +88,7 @@ public class ObservationDemoService(
|
||||
/// <param name="patient">The patient to associate the generated observations with.</param>
|
||||
/// <param name="dataFields">The list of fields used to look up observation configurations and drive observation generation.</param>
|
||||
/// <returns>A task that returns the list of generated <see cref="PatientObservation"/> instances; entries are omitted when no configuration is found for a field.</returns>
|
||||
/// <!-- aidoc:v1 sig=1045c66 body=1145e03 -->
|
||||
public async Task<List<PatientObservation>> GenerateObservationByField(Patient patient, List<Field> dataFields)
|
||||
{
|
||||
var listToReturn = new List<PatientObservation>();
|
||||
@@ -161,6 +163,7 @@ public class ObservationDemoService(
|
||||
/// <param name="patient">The patient to associate the generated grouped observation with.</param>
|
||||
/// <param name="groupedField">The grouped field configuration that defines the names, results, regularity, and maximum number of observations to generate.</param>
|
||||
/// <returns>A task that returns the populated <see cref="GroupedObservation"/> containing the generated observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=32f5cfc body=c681ea4 -->
|
||||
public async Task<GroupedObservation> GenerateGroupedObservation(Patient patient, GroupedField groupedField)
|
||||
{
|
||||
if (groupedField.Names.IsNullOrEmpty() && groupedField.Name != null) groupedField.Names.Add(groupedField.Name);
|
||||
@@ -235,6 +238,7 @@ public class ObservationDemoService(
|
||||
/// <param name="firstCof">The configuration observation whose <c>DemoConfig</c> drives the value generation. If null or its <c>DemoConfig</c> is null, the method returns "-".</param>
|
||||
/// <param name="prevValue">The previous value, passed through to <c>PickSingleValue</c> as context for the new random value generation.</param>
|
||||
/// <returns>A list of generated values when the configuration indicates an array, or a single generated value otherwise. Null is returned when no value could be picked.</returns>
|
||||
/// <!-- aidoc:v1 sig=22e46d9 body=7abbfc1 -->
|
||||
private static object? GenerateValueRandom(ConfigObservation? firstCof, object? prevValue)
|
||||
{
|
||||
if (firstCof?.DemoConfig == null)
|
||||
@@ -261,6 +265,8 @@ public class ObservationDemoService(
|
||||
/// <param name="config">The configuration that defines how the value should be selected, including the list of options, the numeric range, and the selection mode.</param>
|
||||
/// <param name="prevValue">The previously selected value, used as the base for percentage-based variation when generating a new numeric value; ignored when no previous integer value is available.</param>
|
||||
/// <returns>A randomly selected value from the configured options or a generated numeric value clamped within the defined range; <c>null</c> when the configuration does not allow a value to be produced.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
|
||||
/// "The summary and returns tag state the method returns null when the options list is empty, but the code throws ArgumentOutOfRangeException via rnd.Next(0) on the empty list rather than returning null." -->
|
||||
private static object? PickSingleValue(DemoConfig? config, object? prevValue)
|
||||
{
|
||||
if (config == null) return null;
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace adas_core.Application.Services;
|
||||
/// Provides the concrete implementation of the <see cref="IObservationService"/> contract,
|
||||
/// encapsulating the business logic required to manage and expose observation-related operations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=974bc4c -->
|
||||
public class ObservationService : IObservationService
|
||||
{
|
||||
private readonly ICacheService _cacheService;
|
||||
@@ -170,6 +171,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 2.</param>
|
||||
/// <param name="filterObservations">An optional list of observation codes/names used to narrow down which observations are considered.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the patient's most recent <see cref="PatientObservation"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=6f6283b body=92c1221 -->
|
||||
public async Task<List<PatientObservation>> FindLastObservations(ObjectId patientId, int num = 2,
|
||||
List<string>? filterObservations = null)
|
||||
{
|
||||
@@ -185,6 +187,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="filterObservations">Optional list of fields to filter the aggregated observations by; entries with null or whitespace names are ignored when building the cache key. When null, an empty field set is used.</param>
|
||||
/// <param name="ct">Cancellation token forwarded to the cache and repository operations.</param>
|
||||
/// <returns>A task containing the list of <see cref="PatientObservation"/> values, either served from cache or freshly aggregated from the repository on a cache miss.</returns>
|
||||
/// <!-- aidoc:v1 sig=06c6fa6 body=f861637 -->
|
||||
private async Task<List<PatientObservation>> AggregatedLastObsCached(
|
||||
ObjectId patientId,
|
||||
List<Field>? filterObservations,
|
||||
@@ -227,6 +230,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="mapped">When <c>true</c> (default), applies a name-based mapping to each observation; when <c>false</c>, returns the raw results as they come from the cache.</param>
|
||||
/// <param name="ct">Cancellation token to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task containing the list of patient observations, either as raw cached entries or as mapped values depending on <paramref name="mapped"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=8272c2c body=9cf7a87 -->
|
||||
public async Task<List<PatientObservation>> FindLastObservationsByField(
|
||||
ObjectId patientId,
|
||||
List<Field>? filterObservations = null,
|
||||
@@ -256,6 +260,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the mapped <see cref="PatientObservation"/>, or null if no matching mapping is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=5df4888 body=c476eb8 -->
|
||||
public async Task<PatientObservation?> MapObservationsByName(PatientObservation obs)
|
||||
{
|
||||
return await _configObservationService.Map(obs, true);
|
||||
@@ -267,6 +272,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="obs">The patient observation to be mapped.</param>
|
||||
/// <param name="onlyByName">When <c>true</c>, restricts the mapping to name-based lookups only.</param>
|
||||
/// <returns>A task containing the mapped <see cref="PatientObservation"/>, or <c>null</c> if the observation is ignored, not found, or an exception is raised during processing.</returns>
|
||||
/// <!-- aidoc:v1 sig=70a9515 body=67bca22 -->
|
||||
public async Task<PatientObservation?> MapObservation(PatientObservation obs, bool onlyByName = false)
|
||||
{
|
||||
try
|
||||
@@ -311,6 +317,10 @@ public class ObservationService : IObservationService
|
||||
/// <param name="obs">Observation</param>
|
||||
/// <param name="persistObs"></param>
|
||||
/// <param name="mapObs">True if it needs to be inserted</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_param_role
|
||||
/// "mapObs is documented as 'True if it needs to be inserted' but the code shows it controls whether to map the observation via MapObservation" -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=missing_param
|
||||
/// "persistObs parameter has no description; it controls whether the observation is persisted to the repository" -->
|
||||
public async Task InsertObservation(PatientObservation obs, bool persistObs = true, bool mapObs = true)
|
||||
{
|
||||
try
|
||||
@@ -369,6 +379,7 @@ public class ObservationService : IObservationService
|
||||
/// Any exception thrown during the operation is caught and logged.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation provided by the nurse to be mapped, persisted, cached, broadcast, and audited.</param>
|
||||
/// <!-- aidoc:v1 sig=975cc72 body=34767d6 -->
|
||||
public async Task InsertNurseObservation(PatientObservation obs)
|
||||
{
|
||||
try
|
||||
@@ -416,6 +427,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="persistObs">Indicates whether the new observation should be persisted when inserted.</param>
|
||||
/// <param name="mapObs">Indicates whether the new observation should be mapped when inserted.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the observation was inserted because the value changed, or <c>false</c> if the most recent observation already has the same value and no insertion was made.</returns>
|
||||
/// <!-- aidoc:v1 sig=ca5a8c1 body=049bcaf -->
|
||||
public async Task<bool> InsertIfChanged(string name, PatientObservation observation, bool persistObs = true,
|
||||
bool mapObs = true)
|
||||
{
|
||||
@@ -434,6 +446,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="obsList">The list of patient observations to send to matching subscribers.</param>
|
||||
/// <param name="location">The patient location used to identify subscribers to notify.</param>
|
||||
/// <!-- aidoc:v1 sig=9af0676 body=1e5ea24 -->
|
||||
public Task SendObsBroadcast(List<PatientObservation> obsList, PatientLocation location)
|
||||
{
|
||||
// Display Subscription
|
||||
@@ -458,6 +471,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="obsList">The collection of patient observations to be sent to the matched subscribers.</param>
|
||||
/// <param name="pocId">The point of care identifier used to filter the subscribers by their configured location identifiers.</param>
|
||||
/// <!-- aidoc:v1 sig=2fbfda1 body=8d7eaaa -->
|
||||
public Task SendObsBroadcast(List<PatientObservation> obsList, ObjectId pocId)
|
||||
{
|
||||
// Display Subscription
|
||||
@@ -479,6 +493,7 @@ public class ObservationService : IObservationService
|
||||
/// The method skips the broadcast if the observation has no name, and falls back to looking up the patient by id when it is not included in the observation.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation to broadcast. May include the patient or require a lookup via <see cref="BasePatientObservation.PatientId"/>.</param>
|
||||
/// <!-- aidoc:v1 sig=1e50a7a body=505987b -->
|
||||
public async Task SendObsBroadcast(BasePatientObservation obs)
|
||||
{
|
||||
if (obs.Name == null) return;
|
||||
@@ -515,6 +530,10 @@ public class ObservationService : IObservationService
|
||||
/// <param name="patient">The patient to whom the observations belong.</param>
|
||||
/// <param name="messageTime">The timestamp associated with the source message.</param>
|
||||
/// <param name="observationData">Optional parent observation metadata used to populate the parent data of each observation.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
|
||||
/// "States 'persists them asynchronously through the calculated observations mapping service', but the mapping service only maps observations; actual persistence is performed by InsertObservation in fire-and-forget tasks." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
|
||||
/// "States 'any errors during processing are logged without being rethrown', but the final Task.WhenAll is fire-and-forget (assigned to `_`), so exceptions thrown by InsertObservation tasks are not caught by the outer try/catch and will not be logged here." -->
|
||||
public async void ProcessObservations(List<PatientObservation> observations, Patient patient,
|
||||
DateTime messageTime, ObservationData? observationData = null)
|
||||
{
|
||||
@@ -575,6 +594,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="request">The API request containing the nurse observation data to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous nurse observation save operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=bad7899 body=cf9afd9 -->
|
||||
public Task SaveRequestNurseObsAsync(ApiRequest request)
|
||||
{
|
||||
return Task.Run(() => SaveRequestNurseObs(request));
|
||||
@@ -589,6 +609,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The incoming API request containing patient/location identifiers, message type, and observation data.</param>
|
||||
/// <exception cref="ApiRequestException">Thrown when both the patient number and location are null or empty, or when the request type is not valid for observations.</exception>
|
||||
/// <!-- aidoc:v1 sig=229d8cd body=04a5ed7 -->
|
||||
public async Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
if (
|
||||
@@ -688,6 +709,7 @@ public class ObservationService : IObservationService
|
||||
/// </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=a312b13 -->
|
||||
public Task SaveRequestAsync(ApiRequest apiRequest)
|
||||
{
|
||||
//return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); }));
|
||||
@@ -700,6 +722,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <returns>An <see cref="IAsyncCursor{PatientObservation}"/> that iterates over the matching patient observations.</returns>
|
||||
/// <!-- aidoc:v1 sig=3727a3e body=8e212ac -->
|
||||
public async Task<IAsyncCursor<PatientObservation>> FindByPatientIdAsync(ObjectId patientId)
|
||||
{
|
||||
return await _observationRepository.FindByPatientIdAsync(patientId);
|
||||
@@ -712,6 +735,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="codingSystem">The coding system used to classify the observations.</param>
|
||||
/// <param name="name">The name associated with the observations to filter by.</param>
|
||||
/// <returns>An asynchronous cursor over the matching <see cref="PatientObservation"/> documents.</returns>
|
||||
/// <!-- aidoc:v1 sig=6e7afc6 body=835e601 -->
|
||||
public async Task<IAsyncCursor<PatientObservation>> FindByPatientIdAndCodingSystemAsync(ObjectId patientId,
|
||||
string codingSystem, string name)
|
||||
{
|
||||
@@ -724,6 +748,7 @@ public class ObservationService : IObservationService
|
||||
/// Any exception encountered during the process is logged and swallowed without being rethrown.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose observations should be deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=09e4e41 body=c5228ee -->
|
||||
public async Task DeleteByPatientId(ObjectId id)
|
||||
{
|
||||
try
|
||||
@@ -751,6 +776,7 @@ public class ObservationService : IObservationService
|
||||
/// Archives a patient observation by persisting it to the archive repository, removing it from the active observations, and invalidating the related cache entries for the patient's latest observations.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation to be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=026c725 body=ac22ce5 -->
|
||||
public async Task Archive(PatientObservation observation)
|
||||
{
|
||||
await _observationArchiveRepository.InsertOneAsync(observation);
|
||||
@@ -763,6 +789,7 @@ public class ObservationService : IObservationService
|
||||
/// Archives the specified patient by delegating to the archive operation keyed by the patient's identifier.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be archived. Its identifier is used to locate and archive the corresponding record.</param>
|
||||
/// <!-- aidoc:v1 sig=0afe718 body=be01ba0 -->
|
||||
public async Task Archive(Patient patient)
|
||||
{
|
||||
await ArchiveByPatientId(patient.Id);
|
||||
@@ -772,6 +799,7 @@ public class ObservationService : IObservationService
|
||||
/// Archives all observations associated with the specified patient by copying them into the archive repository with newly generated identifiers, then removes the originals and invalidates the related cache entries.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose observations should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=3385472 body=a839154 -->
|
||||
public async Task ArchiveByPatientId(ObjectId id)
|
||||
{
|
||||
_logger.LogDebug("Archive Observations by Patient Id {id}", id);
|
||||
@@ -794,6 +822,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose intravenous lines observations are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="PatientObservation"/> objects, which may include null entries, representing the latest active intravenous lines observations grouped by location.</returns>
|
||||
/// <!-- aidoc:v1 sig=867a12b body=af359b4 -->
|
||||
public async Task<List<PatientObservation?>> FindLastIntravenousLinesObservationByLocation(ObjectId patientId)
|
||||
{
|
||||
return await _observationRepository.AggregatedPatientActiveIntravenousLinesObservations(patientId);
|
||||
@@ -803,6 +832,7 @@ public class ObservationService : IObservationService
|
||||
/// Retrieves the most recent observation time for all patients by delegating to the observation repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a dictionary mapping patient <see cref="ObjectId"/> values to their last observation <see cref="DateTime"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=115ac00 body=d447d05 -->
|
||||
public async Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime()
|
||||
{
|
||||
return await _observationRepository.FindAllLastPatientObservationTime();
|
||||
@@ -814,6 +844,7 @@ public class ObservationService : IObservationService
|
||||
/// If no observation with the specified identifier is found, the method performs no action.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation containing the updated data to be persisted.</param>
|
||||
/// <!-- aidoc:v1 sig=c0ac237 body=3e235cb -->
|
||||
public async Task UpdateObservation(PatientObservation observation)
|
||||
{
|
||||
var obs = await _observationRepository.FindById(observation.Id);
|
||||
@@ -835,6 +866,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="date">The upper bound date; only observations recorded prior to this date are considered.</param>
|
||||
/// <param name="obsName">The optional name of the observation to filter by. When <c>null</c>, observations of any name are considered.</param>
|
||||
/// <returns>The latest <see cref="PatientObservation"/> recorded before the specified date, or <c>null</c> if none was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=babda83 body=e05ec66 -->
|
||||
public async Task<PatientObservation?> FindLastBeforeDate(ObjectId patientId, DateTime date, string? obsName)
|
||||
{
|
||||
return await _observationRepository.FindLastObservationBeforeDate(patientId, obsName, date);
|
||||
@@ -848,6 +880,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="date">The date used to find observations recorded on the same day.</param>
|
||||
/// <param name="obsName">The optional name of the observation to filter by; when null, observations of any name on the given date are considered.</param>
|
||||
/// <returns>A task that resolves to a list of matching <see cref="PatientObservation"/> instances, or null if no observations match the specified criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=15a1606 body=8af3163 -->
|
||||
public async Task<List<PatientObservation>?> FindAnyWithSameDate(ObjectId patientId, DateTime date,
|
||||
string? obsName)
|
||||
{
|
||||
@@ -862,6 +895,8 @@ public class ObservationService : IObservationService
|
||||
/// <param name="date">The cutoff date; observations recorded before this date will be returned.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers to filter the results.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientObservation"/> entries found before the specified date.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=mentions_removed_behavior
|
||||
/// "The filterObservations parameter is documented as filtering the results, but the method body does not pass it to the repository call (only patientId and date are forwarded), so no filtering actually occurs." -->
|
||||
public async Task<List<PatientObservation>> FindAllBeforeDate(ObjectId patientId, DateTime date,
|
||||
List<string>? filterObservations = null)
|
||||
{
|
||||
@@ -875,6 +910,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="name">The name of the observation to search for.</param>
|
||||
/// <param name="expires">An optional expiration value (in seconds) applied to the query.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the latest unique <see cref="PatientObservation"/> values.</returns>
|
||||
/// <!-- aidoc:v1 sig=fbdab74 body=6467bab -->
|
||||
public async Task<List<PatientObservation>> FindLatestUniqueValuesByName(ObjectId patientId, string name,
|
||||
int? expires)
|
||||
{
|
||||
@@ -890,6 +926,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to narrow the returned results.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patient observations matching the criteria.</returns>
|
||||
/// <exception cref="NotImplementedException">Thrown when the method is invoked, as the implementation has not yet been provided.</exception>
|
||||
/// <!-- aidoc:v1 sig=a2b1d09 body=bfa6f2f -->
|
||||
public Task<List<PatientObservation>> FindAllAfterDate(ObjectId patientId, DateTime date,
|
||||
List<string>? filterObservations = null)
|
||||
{
|
||||
@@ -904,6 +941,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="endAfter">Optional threshold used to restrict which observations are considered; if null, no end-after filter is applied.</param>
|
||||
/// <param name="num">Optional maximum number of observations to return; if null, all matching observations are returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of matching <see cref="PatientObservation"/> instances.</returns>
|
||||
/// <!-- aidoc:v1 sig=fa7c1b4 body=d00a4ef -->
|
||||
public async Task<IEnumerable<PatientObservation>> FindLastNotExpiredObservatonsByPatient(ObjectId patientId,
|
||||
string name, int? endAfter = null, int? num = null)
|
||||
{
|
||||
@@ -916,6 +954,7 @@ public class ObservationService : IObservationService
|
||||
/// current time
|
||||
/// mark as expired in bd.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=076e4fe body=3b48a1e -->
|
||||
public async Task CheckAndExpireObservations()
|
||||
{
|
||||
var count = 0;
|
||||
@@ -940,6 +979,7 @@ public class ObservationService : IObservationService
|
||||
/// Updates the repository to mark a list of patient observations as expired, invalidates the corresponding cache entries, and creates audit log entries capturing the pre-update state of each observation.
|
||||
/// </summary>
|
||||
/// <param name="patientObservations">The list of patient observations to be marked as expired.</param>
|
||||
/// <!-- aidoc:v1 sig=606ff2e body=5f2ea53 -->
|
||||
public async Task UpdateExpiredObservations(List<PatientObservation> patientObservations)
|
||||
{
|
||||
await _observationRepository.UpdateExpiredObservations(patientObservations);
|
||||
@@ -959,6 +999,7 @@ public class ObservationService : IObservationService
|
||||
/// For each candidate observation, the patient is validated; missing patients trigger cleanup of their observations and cached entries. Observations with missing names or unparsable expiration values are skipped, and only those whose expected expiration time (observation time plus configured minutes) has passed are yielded.
|
||||
/// </summary>
|
||||
/// <returns>An asynchronous stream of <see cref="PatientObservation"/> instances that are not expired in storage but whose effective expiration time has elapsed.</returns>
|
||||
/// <!-- aidoc:v1 sig=08302b5 body=277c7e5 -->
|
||||
public async IAsyncEnumerable<PatientObservation> FindNotExpiredObservationsShouldBeExpired()
|
||||
{
|
||||
var expiringObservations = await _configObservationService.GetAllConfigs();
|
||||
@@ -1008,6 +1049,7 @@ public class ObservationService : IObservationService
|
||||
/// <summary>
|
||||
/// Retrieves all observation configurations and expires those whose <c>Expires</c> value is set to a positive number, ignoring configurations with a null or non-positive expiry.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=085cd58 body=23edba8 -->
|
||||
public async Task ExpireObservations()
|
||||
{
|
||||
//TODO expire each section
|
||||
@@ -1022,6 +1064,7 @@ public class ObservationService : IObservationService
|
||||
/// <summary>
|
||||
/// Expires patient observations that should no longer be active and recalculates the latest observation values per configured field. Sets a global flag while running to signal that expiration is in progress, processes expirations in batches of 1000 to limit memory usage, and clears the patient observations cache once finished; any error is logged and swallowed without rethrowing.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b7c6d53 body=adc503e -->
|
||||
public async Task ExpireObservationsAndRecalculateAsync()
|
||||
{
|
||||
try
|
||||
@@ -1094,6 +1137,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="nameId">The name identifier of the field whose value should be updated across matching records.</param>
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing <see cref="ObjectId"/> value to be replaced.</param>
|
||||
/// <!-- aidoc:v1 sig=72ce1ca body=46d3367 -->
|
||||
public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)
|
||||
{
|
||||
await _observationRepository.UpdateManyObjectId(nameId, id, oldId);
|
||||
@@ -1103,6 +1147,7 @@ public class ObservationService : IObservationService
|
||||
/// Inserts a simple patient observation into the repository and records an audit log entry for the operation using the current HTTP context user.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation to insert.</param>
|
||||
/// <!-- aidoc:v1 sig=983d9dc body=cfd144b -->
|
||||
public async Task InsertSimpleObservation(PatientObservation observation)
|
||||
{
|
||||
await _observationRepository.InsertOneAsync(observation);
|
||||
@@ -1119,6 +1164,8 @@ public class ObservationService : IObservationService
|
||||
/// <param name="fromArchived">When true, queries the archived observation collection; otherwise, queries the active observation collection.</param>
|
||||
/// <param name="filter">Optional pagination settings controlling the page number and page size of the returned results.</param>
|
||||
/// <returns>A task that resolves to the list of <see cref="PatientObservation"/> records matching the specified criteria.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_param_role
|
||||
/// "startDate is documented as 'inclusive lower bound' but the code uses filterBuilder.Gt(o => o.Time, ...), which is exclusive (strict greater-than). Records with Time == startDate are NOT included in results." -->
|
||||
public async Task<List<PatientObservation>> FindAllBetweenDates(
|
||||
ObjectId patientId,
|
||||
DateTime? startDate = null,
|
||||
@@ -1174,6 +1221,7 @@ public class ObservationService : IObservationService
|
||||
/// Asynchronously processes alert expiration and powers off beacon LEDs for points of care that are not currently in use.
|
||||
/// Skips patients located in virtual/moved/deleted/pushed/unknown locations and ignores emulated beacons and configurations with disabled alarms.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e82bf03 body=a65a543 -->
|
||||
public async Task ExpireAlertsAndPowerOffAsync()
|
||||
{
|
||||
try
|
||||
@@ -1260,6 +1308,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that specifies the page number and page size used to compute the skip/limit range.</param>
|
||||
/// <returns>A <see cref="PaginationResponse{PatientObservation}"/> containing the page of patient observations along with pagination metadata.</returns>
|
||||
/// <!-- aidoc:v1 sig=09d4b6c body=3ba0256 -->
|
||||
public async Task<PaginationResponse<PatientObservation>> GetPaginatedObservations(PaginationFilter filter)
|
||||
{
|
||||
var result = _observationRepository.GetPaginatedObservations(filter);
|
||||
@@ -1284,6 +1333,7 @@ public class ObservationService : IObservationService
|
||||
/// or the observation name is empty, and logs any errors that occur during processing.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation used to resolve the retention policy and identify which records to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=b72421f body=75a9bf8 -->
|
||||
private async Task DoRetentionActions(PatientObservation obs)
|
||||
{
|
||||
try
|
||||
@@ -1329,6 +1379,7 @@ public class ObservationService : IObservationService
|
||||
/// in the group's names or where the group does not consider the observation relevant.
|
||||
/// </summary>
|
||||
/// <param name="obs">The incoming patient observation used to find and update matching groups.</param>
|
||||
/// <!-- aidoc:v1 sig=6945ee7 body=3ec5c18 -->
|
||||
private async void CheckForGroupedObs(PatientObservation obs)
|
||||
{
|
||||
try
|
||||
@@ -1387,6 +1438,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the observation text, parent data, message time, and additional observations used to build the intravenous line record.</param>
|
||||
/// <param name="patient">The patient to associate the resulting observation with.</param>
|
||||
/// <!-- aidoc:v1 sig=6d902c0 body=6131bea -->
|
||||
private async Task ProcessIntravenousLinesObservation(ApiRequest apiRequest, Patient patient)
|
||||
{
|
||||
var isInsertable = false;
|
||||
@@ -1473,6 +1525,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the observation data and coded allergy entries to process.</param>
|
||||
/// <param name="patient">The patient associated with the allergies observation being recorded.</param>
|
||||
/// <!-- aidoc:v1 sig=87cd8c3 body=b361033 -->
|
||||
private async Task ProcessAllergiesObservation(ApiRequest apiRequest, Patient patient)
|
||||
{
|
||||
_logger.LogDebug("INSERT AllergiesObservation");
|
||||
@@ -1582,6 +1635,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The incoming API request whose <c>ObservationData</c> is inspected for the isolation marker text and timestamp.</param>
|
||||
/// <param name="patient">The patient associated with the observation, used to assign the patient identifier to the new record.</param>
|
||||
/// <!-- aidoc:v1 sig=3e77398 body=f0f74d8 -->
|
||||
private async Task ProcessIsolationObservation(ApiRequest apiRequest, Patient patient)
|
||||
{
|
||||
if (apiRequest.ObservationData is { Text: "Aislamiento", Time: not null })
|
||||
@@ -1615,6 +1669,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The incoming API request containing the observation data, observations collection, and message timestamp to be processed.</param>
|
||||
/// <param name="patient">The patient associated with the observation; its identifier is stored in the resulting <see cref="PatientObservation"/>.</param>
|
||||
/// <!-- aidoc:v1 sig=0d9f42f body=316c55d -->
|
||||
private async Task ProcessPositionObservation(ApiRequest apiRequest, Patient patient)
|
||||
{
|
||||
if (apiRequest.ObservationData != null &&
|
||||
@@ -1662,6 +1717,7 @@ public class ObservationService : IObservationService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the observation data, time, and the list of observations to be processed.</param>
|
||||
/// <param name="patient">The patient associated with the drainage observation being recorded.</param>
|
||||
/// <!-- aidoc:v1 sig=0d44621 body=0ec2fb5 -->
|
||||
private async Task ProcessDrainageObservation(ApiRequest apiRequest, Patient patient)
|
||||
{
|
||||
_logger.LogDebug("INSERT DrainageObservation");
|
||||
@@ -1742,6 +1798,8 @@ public class ObservationService : IObservationService
|
||||
/// <param name="apiRequest">The API request containing the data required to locate the patient and the observations to be saved.</param>
|
||||
/// <returns>A task that represents the asynchronous save operation.</returns>
|
||||
/// <exception cref="ArgumentNullException">Thrown when <paramref name="apiRequest"/> is null.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_exception
|
||||
/// "ArgumentNullException is documented but the method does not throw it; if apiRequest is null, accessing apiRequest.PatientNumber or apiRequest.Location would throw NullReferenceException" -->
|
||||
public async Task SaveRequestNurseObs(ApiRequest apiRequest)
|
||||
{
|
||||
var patient = await _patientService.FindPatientByApiRequest(apiRequest);
|
||||
@@ -1768,6 +1826,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="configs">The list of point of care configurations used to locate the configuration associated with the patient.</param>
|
||||
/// <param name="obsConfigList">The observation configurations from which the recording end-after time is derived, falling back to <paramref name="defaultValue"/> when no recording alarms are configured.</param>
|
||||
/// <param name="defaultValue">The default end-after value applied when no observation configuration specifies a recording alarm.</param>
|
||||
/// <!-- aidoc:v1 sig=9902090 body=5b3f7b2 -->
|
||||
private async Task CheckRecordings(Patient patient, List<PointOfCare> configs,
|
||||
IEnumerable<ConfigObservation> obsConfigList, int defaultValue)
|
||||
{
|
||||
@@ -1828,6 +1887,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="patient">The patient whose relay state is being evaluated; must have a valid <c>PointOfCareId</c>.</param>
|
||||
/// <param name="obsConfigList">Collection of observation configurations used to determine the relay end-after threshold via the <c>OpenDoor</c> alarm.</param>
|
||||
/// <param name="defaultValue">Fallback value used for the relay end-after threshold when no <c>OpenDoor</c> alarm configuration is present.</param>
|
||||
/// <!-- aidoc:v1 sig=b9117cf body=d76f723 -->
|
||||
private async Task CheckRelay(Patient patient,
|
||||
IEnumerable<ConfigObservation> obsConfigList, int defaultValue)
|
||||
{
|
||||
@@ -1874,6 +1934,7 @@ public class ObservationService : IObservationService
|
||||
/// <param name="patient">The patient whose beacon state is being evaluated; its identifier and point of care assignment are used to locate recent observations and target the beacon.</param>
|
||||
/// <param name="obsConfigList">The list of observation configurations used to determine the maximum beacon end-after value from the alarms that are both enabled and have their beacon enabled, falling back to <paramref name="defaultValue"/> when no configuration matches or the beacon is null.</param>
|
||||
/// <param name="defaultValue">The fallback value used for the beacon end-after period when no configuration provides a value or when the matching configuration's beacon is null.</param>
|
||||
/// <!-- aidoc:v1 sig=0dd4f68 body=8372da2 -->
|
||||
private async Task CheckBeacon(Patient patient,
|
||||
IEnumerable<ConfigObservation> obsConfigList, int defaultValue)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace adas_core.Application.Services;
|
||||
/// Provides operations for managing patient care plans, implementing the contract defined by <see cref="IPatientCarePlanService"/>.
|
||||
/// Serves as the concrete service layer responsible for handling care plan related business logic.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=22e8377 -->
|
||||
public class PatientCarePlanService : IPatientCarePlanService
|
||||
{
|
||||
private readonly IArchivePatientCarePlanService _archivePatientCarePlanService;
|
||||
@@ -55,6 +56,7 @@ public class PatientCarePlanService : IPatientCarePlanService
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose care plans are to be retrieved.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> for the patient, or an empty list if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=9706d89 body=ccd645c -->
|
||||
public async Task<List<PatientCarePlan>> FindByPatientId(ObjectId patientId)
|
||||
{
|
||||
try
|
||||
@@ -74,6 +76,7 @@ public class PatientCarePlanService : IPatientCarePlanService
|
||||
/// </summary>
|
||||
/// <param name="userId">The unique identifier of the user whose patient care plans are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects for the user, or an empty list if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=7520aa9 body=666052d -->
|
||||
public async Task<List<PatientCarePlan>> FindByUserId(ObjectId userId)
|
||||
{
|
||||
try
|
||||
@@ -92,6 +95,7 @@ public class PatientCarePlanService : IPatientCarePlanService
|
||||
/// Retrieves all patient care plans from the repository, returning an empty list if an error occurs while fetching the data.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects, or an empty list if the retrieval fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=6a558a7 body=19f83a8 -->
|
||||
public async Task<List<PatientCarePlan>> FindAll()
|
||||
{
|
||||
try
|
||||
@@ -109,6 +113,7 @@ public class PatientCarePlanService : IPatientCarePlanService
|
||||
/// Inserts a new patient care plan into the repository, stamping it with the current UTC time, and records an audit log entry for the operation. Any errors encountered during the insertion or audit logging are caught and logged without rethrowing.
|
||||
/// </summary>
|
||||
/// <param name="patientCarePlan">The patient care plan entity to be inserted into the repository.</param>
|
||||
/// <!-- aidoc:v1 sig=cbefa20 body=2a84bb1 -->
|
||||
public async Task InsertOneAsync(PatientCarePlan patientCarePlan)
|
||||
{
|
||||
try
|
||||
@@ -129,6 +134,7 @@ public class PatientCarePlanService : IPatientCarePlanService
|
||||
/// </summary>
|
||||
/// <param name="patientWithFinishedProcedure">The patient associated with the finished procedure whose care plan items are being archived.</param>
|
||||
/// <param name="itemsToArchive">The list of care plan options to archive.</param>
|
||||
/// <!-- aidoc:v1 sig=6d8145d body=dab75f5 -->
|
||||
public async Task ArchiveCarePlanFromJob(Patient patientWithFinishedProcedure, List<OptionList> itemsToArchive)
|
||||
{
|
||||
var systemUser = await _userRepository.GetOrCreateSystemUser();
|
||||
@@ -153,6 +159,7 @@ public class PatientCarePlanService : IPatientCarePlanService
|
||||
/// Archives all care plans associated with the specified patient by moving them to the archive service, removing them from the active repository, and creating audit log entries for each archived record.
|
||||
/// </summary>
|
||||
/// <param name="patientid">The identifier of the patient whose care plans will be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=8a48aa7 body=4ede7e2 -->
|
||||
public async Task ArchiveByPatientId(ObjectId patientid)
|
||||
{
|
||||
var carePlansToArchive = await FindByPatientId(patientid);
|
||||
@@ -170,6 +177,7 @@ public class PatientCarePlanService : IPatientCarePlanService
|
||||
/// <param name="patientid">The unique identifier of the patient whose care plan records will be updated.</param>
|
||||
/// <param name="patientId">The new object identifier that will replace the old identifier in the matching care plan records.</param>
|
||||
/// <param name="oldId">The existing object identifier to be replaced by the new identifier.</param>
|
||||
/// <!-- aidoc:v1 sig=9a63bf8 body=c2a07bf -->
|
||||
public async Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId)
|
||||
{
|
||||
await _patientCarePlanRepository.UpdateManyObjectId(patientid, patientId, oldId);
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace adas_core.Application.Services;
|
||||
/// Provides a concrete implementation of the <see cref="IPatientService"/> interface,
|
||||
/// encapsulating patient-related service operations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=10bbe0c -->
|
||||
public class PatientService : IPatientService
|
||||
{
|
||||
private readonly Lazy<IAdmissionService> _admissionService;
|
||||
@@ -171,6 +172,7 @@ public class PatientService : IPatientService
|
||||
/// Inserts a new patient into the repository after validating it. If the patient fails validation, the method returns without performing the insertion. After a successful insert, a new patient broadcast notification is dispatched asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity to be inserted into the repository.</param>
|
||||
/// <!-- aidoc:v1 sig=d1581db body=77e1954 -->
|
||||
public async Task Insert(Patient patient)
|
||||
{
|
||||
if (!CheckPatient(patient))
|
||||
@@ -189,6 +191,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="patientId">The string representation of the patient identifier to parse and look up.</param>
|
||||
/// <param name="localeEnum">The locale used to translate the patient data via the master list service.</param>
|
||||
/// <returns>A task containing the translated patient, the untranslated patient if the unit is not found, or null if the patient has no associated unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=f4d1347 body=c678377 -->
|
||||
public async Task<Patient?> FindByPatientIdWithLocale(string patientId, LocaleEnum localeEnum)
|
||||
{
|
||||
ObjectId.TryParse(patientId, out var id);
|
||||
@@ -206,6 +209,7 @@ public class PatientService : IPatientService
|
||||
/// On a successful insert, an audit log is created and a broadcast is dispatched to notify other components.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity to be inserted into the system.</param>
|
||||
/// <!-- aidoc:v1 sig=f6b2b46 body=88c5d39 -->
|
||||
public async Task InsertAsync(Patient patient)
|
||||
{
|
||||
if (!CheckPatient(patient))
|
||||
@@ -223,6 +227,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="newPocId">The identifier of the destination point of care.</param>
|
||||
/// <param name="oldPocId">The identifier of the source point of care that the patient is leaving.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the patient is successfully moved; otherwise, <c>false</c> if the new point of care is null, the old point of care is null, or the new point of care is already in use or locked.</returns>
|
||||
/// <!-- aidoc:v1 sig=39388b7 body=c03ac2e -->
|
||||
public async Task<bool> Move(Patient patient, ObjectId newPocId, ObjectId oldPocId)
|
||||
{
|
||||
var newPoc = await _pointOfCareService.GetInfo(newPocId);
|
||||
@@ -289,6 +294,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="withLocation">When <c>true</c>, enriches the patient with location information such as bed, room, and unit name.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> containing the found patient, or <c>null</c> if no patient matches the identifier or the identifier is empty.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the patient has an associated point of care that cannot be found.</exception>
|
||||
/// <!-- aidoc:v1 sig=a22429e body=12ee318 -->
|
||||
public async Task<Patient?> FindById(ObjectId id, bool withLocation = false)
|
||||
{
|
||||
if (id == ObjectId.Empty)
|
||||
@@ -330,6 +336,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location containing the unit name and bed used to locate the patient.</param>
|
||||
/// <returns>A <see cref="Patient"/> if one is found for the given location; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=556acef body=8a73352 -->
|
||||
public async Task<Patient?> FindByLocation(PatientLocation? location)
|
||||
{
|
||||
if (location?.UnitName == null || location.Bed == null)
|
||||
@@ -347,6 +354,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="pocId">The point of care identifier used to locate the patient.</param>
|
||||
/// <returns>A <see cref="Patient"/> if one is found with the specified point of care identifier; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=ddcf124 body=0f46364 -->
|
||||
public async Task<Patient?> FindByPointOfCareId(ObjectId pocId)
|
||||
{
|
||||
return await _patientRepository.FindByPointOfCareId(pocId);
|
||||
@@ -357,6 +365,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="unitId">The <see cref="ObjectId"/> of the unit whose patients should be counted.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the number of patients linked to the given unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=783969e body=27e7534 -->
|
||||
public async Task<long> CountPatientsByUnitId(ObjectId unitId)
|
||||
{
|
||||
return await _patientRepository.CountByUnitId(unitId);
|
||||
@@ -366,6 +375,7 @@ public class PatientService : IPatientService
|
||||
/// Archives a patient according to the configured <see cref="OnArchiveAction"/>: either inserts the patient into the archive repository (with the current UTC time as the archive date) or simply performs no archival step. The patient record is then deleted, an audit log entry is created, associated patient data is archived, and if the patient was assigned to a point of care, a delete broadcast is sent and that point of care is set to Available.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to archive. If its <c>DisTime</c> is null, it is set to the current UTC time before further processing.</param>
|
||||
/// <!-- aidoc:v1 sig=f9c9380 body=db59c7e -->
|
||||
public async Task ArchivePatient(Patient patient)
|
||||
{
|
||||
patient.DisTime ??= DateTime.UtcNow;
|
||||
@@ -402,6 +412,7 @@ public class PatientService : IPatientService
|
||||
/// Archives or deletes all data associated with a patient based on the configured <c>OnArchiveAction</c>. When the action is set to <c>Archive</c> (the default), patient observations, treatments, diagnoses, appointments, pumps, recording alerts, and care plans are archived; when set to <c>Delete</c>, observations, treatments, diagnoses, appointments, pumps, and recording alerts are deleted (care plan archival is not performed in this case).
|
||||
/// </summary>
|
||||
/// <param name="patientid">The <see cref="ObjectId"/> of the patient whose related data should be archived or deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=734ad23 body=6ea277f -->
|
||||
public async Task ArchivePatientData(ObjectId patientid)
|
||||
{
|
||||
_logger.LogDebug("Archiving patient data action: {onArchiveAction} : {patientid}", _onArchiveAction,
|
||||
@@ -434,6 +445,7 @@ public class PatientService : IPatientService
|
||||
/// Updates a patient record in the repository, handling special cases such as resolving duplicated "Sin cama" bed assignments from ICCADB by generating a unique bed identifier, and assigning a patient number when missing. Also creates an audit log comparing the previous and updated patient and asynchronously broadcasts the update.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity to update.</param>
|
||||
/// <!-- aidoc:v1 sig=f9d52dc body=68e4897 -->
|
||||
public async Task Update(Patient patient)
|
||||
{
|
||||
var oldPatient = await _patientRepository.FindById(patient.Id);
|
||||
@@ -468,6 +480,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the patient whose location will be updated.</param>
|
||||
/// <param name="location">The new patient location, or <c>null</c> to abort the update.</param>
|
||||
/// <!-- aidoc:v1 sig=9fbc6f9 body=0a33496 -->
|
||||
public async Task UpdateLocation(ObjectId id, PatientLocation? location)
|
||||
{
|
||||
try
|
||||
@@ -558,6 +571,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="id">The unique identifier of the patient whose attending doctor is being updated.</param>
|
||||
/// <param name="doctor">The new attending doctor to assign to the patient.</param>
|
||||
/// <exception cref="ConflictException">Thrown when the patient cannot be found by id before or after the update operation.</exception>
|
||||
/// <!-- aidoc:v1 sig=75ae010 body=d0f12e3 -->
|
||||
public async Task UpdateAttendingDoctor(ObjectId id, Person doctor)
|
||||
{
|
||||
var oldPatient = await _patientRepository.FindById(id) ??
|
||||
@@ -578,6 +592,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="data">The new <see cref="Person"/> data to apply to the patient.</param>
|
||||
/// <param name="updatePatientNumber">When <c>true</c>, the patient number is also updated; otherwise only the personal data is changed.</param>
|
||||
/// <exception cref="ConflictException">Thrown when the patient cannot be found by <paramref name="id"/> either before or after the update operation.</exception>
|
||||
/// <!-- aidoc:v1 sig=06ac587 body=7aeda33 -->
|
||||
public async Task UpdatePatientData(ObjectId id, string patientNumber, Person data,
|
||||
bool updatePatientNumber = true)
|
||||
{
|
||||
@@ -600,6 +615,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="patient">The patient entity containing the updated data.</param>
|
||||
/// <param name="updatePatientNumber">Indicates whether the patient number should be updated as part of the operation.</param>
|
||||
/// <exception cref="ConflictException">Thrown when the patient cannot be found before or after the update operation.</exception>
|
||||
/// <!-- aidoc:v1 sig=0c07015 body=33d6834 -->
|
||||
public async Task UpdatePatientData(ObjectId id, string patientNumber, Patient patient,
|
||||
bool updatePatientNumber = true)
|
||||
{
|
||||
@@ -624,6 +640,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="patientId">The unique identifier of the patient to retrieve.</param>
|
||||
/// <param name="withLocation">When <c>true</c>, additional lookups are performed to populate the patient's bed, room, and unit information; otherwise only the patient record is returned.</param>
|
||||
/// <returns>The <see cref="Patient"/> matching the specified identifier, or <c>null</c> if no patient is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=f272074 body=5df30c2 -->
|
||||
public async Task<Patient?> FindByPatientId(string patientId, bool withLocation = false)
|
||||
{
|
||||
|
||||
@@ -653,6 +670,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="patientNumber">The unique identifier of the patient to look up.</param>
|
||||
/// <param name="withLocation">When set to <c>true</c>, populates the returned patient with bed and room information from the point of care and the unit name from the unit service, provided the patient has associated location identifiers.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the matching <see cref="Patient"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=890ea54 body=8336edf -->
|
||||
public async Task<Patient?> FindByPatientNumber(string patientNumber, bool withLocation = false)
|
||||
{
|
||||
var patient = await _patientRepository.FindByPatientNumber(patientNumber);
|
||||
@@ -681,6 +699,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the archived patient.</param>
|
||||
/// <returns>The archived <see cref="Patient"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d3378f0 body=aa9384c -->
|
||||
public async Task<Patient?> FindByPatientNumberArchived(string patientNumber)
|
||||
{
|
||||
return await _patientArchiveRepository.FindByPatientNumber(patientNumber);
|
||||
@@ -695,6 +714,7 @@ public class PatientService : IPatientService
|
||||
/// any unexpected failure causes the original exception to be rethrown after logging.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; patients with no observations updated after this date will be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=549ade5 body=7f270ff -->
|
||||
public async Task ArchivePatientWithoutObservationsSinceDate(DateTime date)
|
||||
{
|
||||
try
|
||||
@@ -777,6 +797,7 @@ public class PatientService : IPatientService
|
||||
/// and any error encountered during archiving is logged rather than propagated.
|
||||
/// </summary>
|
||||
/// <param name="hoursBeforeArchive">The number of hours that must elapse after a patient's discharge time before they are eligible for archiving.</param>
|
||||
/// <!-- aidoc:v1 sig=2cc3c13 body=11413f9 -->
|
||||
public async Task ArchiveDischargedPatients(int hoursBeforeArchive)
|
||||
{
|
||||
var disBeforeDate = DateTime.Now.AddHours(-hoursBeforeArchive);
|
||||
@@ -806,6 +827,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="location">The patient location used for a location-based lookup; the search only proceeds when both the unit name and the bed are set, and the location is mapped through the POC mapping service before being applied to the resulting patient.</param>
|
||||
/// <param name="findPatientByLocation">When <c>true</c>, allows a location-based lookup even if the corresponding configuration option is disabled.</param>
|
||||
/// <returns>The matching <see cref="Patient"/> if found by any of the attempted criteria, or <c>null</c> when no patient can be located.</returns>
|
||||
/// <!-- aidoc:v1 sig=ef50845 body=2a9514b -->
|
||||
public async Task<Patient?> FindPatient(string? patientId, string? patientNumber, PatientLocation? location,
|
||||
bool findPatientByLocation = false)
|
||||
{
|
||||
@@ -842,6 +864,8 @@ public class PatientService : IPatientService
|
||||
/// <param name="observations">Indicates whether related observations should be included in the result.</param>
|
||||
/// <param name="filterObservations">Optional list of observation identifiers used to filter observations when they are included.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Patient"/>, or null if the lookup fails.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=mentions_removed_behavior
|
||||
/// "The 'observations' and 'filterObservations' parameters are documented as controlling observation inclusion/filtering, but the method body only calls _patientRepository.FindByPointOfCareId(item.Id) and never references either parameter." -->
|
||||
public async Task<Patient?> GetByPointOfCare(PointOfCare item, bool observations = false,
|
||||
List<string>? filterObservations = null)
|
||||
{
|
||||
@@ -863,6 +887,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="unit">The unit used to determine the translation; when <c>null</c>, the patient is returned without translation.</param>
|
||||
/// <param name="localeEnum">The target locale for translation; when <c>null</c>, the patient is returned without translation.</param>
|
||||
/// <returns>The matching <see cref="Patient"/>, or <c>null</c> if the patient is not found or an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=fce6f5d body=821f100 -->
|
||||
public async Task<Patient?> GetByPointOfCareAndLocale(PointOfCare item, Unit? unit, LocaleEnum? localeEnum)
|
||||
{
|
||||
try
|
||||
@@ -885,6 +910,8 @@ public class PatientService : IPatientService
|
||||
/// <param name="observations">When true, the most recent observations for the patient are loaded and mapped by name; when false, only patient data is returned.</param>
|
||||
/// <param name="filterObservations">Optional list of observation names used to restrict which observations are retrieved; applies only when <paramref name="observations"/> is true.</param>
|
||||
/// <returns>A <see cref="Task{Box}"/> containing the populated box. The <c>HasPatient</c> flag is set to false if no patient is found for the point of care, and the box's <c>Observations</c> are populated only when requested.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_returns
|
||||
/// "The <returns> tag references Task{Box} (non-nullable), but the method's actual return type is Task<Box?>. The method never returns null in practice, so the practical meaning is unchanged." -->
|
||||
public async Task<Box?> GetBox(PointOfCare poc, bool observations = false,
|
||||
List<string>? filterObservations = null)
|
||||
{
|
||||
@@ -931,6 +958,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose arrival should be broadcast to matching subscribers.</param>
|
||||
/// <returns>A completed task once the broadcast has been dispatched.</returns>
|
||||
/// <!-- aidoc:v1 sig=fd19240 body=a90f9bf -->
|
||||
public Task SendNewPatientBroadcast(Patient patient)
|
||||
{
|
||||
var subscribers = new List<WsSubscriber>();
|
||||
@@ -959,6 +987,7 @@ public class PatientService : IPatientService
|
||||
/// If the patient has no point of care id, the update is skipped and an error is logged.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose update will be broadcast; its point of care id is used to filter subscribers and its unit is used to resolve translations.</param>
|
||||
/// <!-- aidoc:v1 sig=947720c body=71d60b3 -->
|
||||
public async Task SendPatientUpdateBroadcast(Patient patient)
|
||||
{
|
||||
if (!patient.PointOfCareId.HasValue)
|
||||
@@ -989,6 +1018,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
/// <returns>A <see cref="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); }));
|
||||
@@ -999,6 +1029,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the ADT type, patient identifiers, locations, and related clinical data to be processed.</param>
|
||||
/// <exception cref="ApiRequestException">Thrown when both the patient number and location unit name are missing for non-ICCA requests, or when the request type is not a valid patient ADT type.</exception>
|
||||
/// <!-- aidoc:v1 sig=229d8cd body=bcf1b57 -->
|
||||
public async Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
if (string.IsNullOrEmpty(apiRequest.PatientNumber) &&
|
||||
@@ -1399,6 +1430,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="apiRequest">The API request containing the data used to initialize the new patient.</param>
|
||||
/// <param name="ignoreLocation">When <c>true</c>, location information from the request is ignored during the patient update.</param>
|
||||
/// <returns>The newly created patient.</returns>
|
||||
/// <!-- aidoc:v1 sig=7f3758a body=fdf45d9 -->
|
||||
public async Task<Patient?> CreatePatientFromRequest(ApiRequest apiRequest, bool ignoreLocation = false)
|
||||
{
|
||||
var patient = new Patient
|
||||
@@ -1417,6 +1449,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The incoming API request containing the patient identifier, location, facility, request type, and optional person/doctor information used to resolve or create the patient.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> that resolves to the resolved or newly created <see cref="Patient"/>, or <c>null</c> if the point of care cannot be mapped, the request is not handled, no matching patient is found and creation is disabled, or an error occurs while processing the request.</returns>
|
||||
/// <!-- aidoc:v1 sig=c55d64f body=15f7bac -->
|
||||
public async Task<Patient?> FindPatientByApiRequest(ApiRequest apiRequest)
|
||||
{
|
||||
Patient? patient = null;
|
||||
@@ -1737,6 +1770,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="withLocation">When <c>true</c>, populates each patient's <see cref="Patient.Bed"/>, <see cref="Patient.Room"/>, and <see cref="Patient.UnitString"/> by looking up the related point of care and unit; when <c>false</c>, returns the patients without performing those lookups.</param>
|
||||
/// <returns>A task containing the list of patients, with location fields populated when <paramref name="withLocation"/> is <c>true</c> and the corresponding identifiers are present.</returns>
|
||||
/// <!-- aidoc:v1 sig=9ed8fb2 body=0e56b87 -->
|
||||
public async Task<List<Patient>> FindAll(bool withLocation = false)
|
||||
{
|
||||
var patients = await _patientRepository.FindAll();
|
||||
@@ -1767,6 +1801,7 @@ public class PatientService : IPatientService
|
||||
/// Asynchronously retrieves a list of inactive patients of care (PoC) by delegating to the patient repository.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of inactive <see cref="Patient"/> records.</returns>
|
||||
/// <!-- aidoc:v1 sig=2479e43 body=4a13d43 -->
|
||||
public async Task<List<Patient>> FindInActivePoC()
|
||||
{
|
||||
return await _patientRepository.FindInActivePoC();
|
||||
@@ -1776,6 +1811,7 @@ public class PatientService : IPatientService
|
||||
/// Retrieves a list of patients currently in active Point of Care (PoC).
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of patients in active PoC.</returns>
|
||||
/// <!-- aidoc:v1 sig=1a67064 body=36208e3 -->
|
||||
public async Task<List<Patient>> FindInInactivePoC()
|
||||
{
|
||||
return await _patientRepository.FindInInactivePoC();
|
||||
@@ -1787,6 +1823,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing the page number and page size used to calculate the skip and limit for the query.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PaginationResponse{Patient}"/> with the patients for the requested page, along with the total count and pagination metadata.</returns>
|
||||
/// <!-- aidoc:v1 sig=02d2827 body=88e214b -->
|
||||
public async Task<PaginationResponse<Patient>> GetPaginatedPatients(PaginationFilter filter)
|
||||
{
|
||||
var result = _patientRepository.GetPaginatedPatients(filter);
|
||||
@@ -1810,6 +1847,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="unit">The identifier of the unit to search by.</param>
|
||||
/// <param name="pointOfCare">The identifier of the point of care to search by.</param>
|
||||
/// <returns>A <see cref="Patient"/> if a match is found; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=927765b body=f356295 -->
|
||||
public async Task<Patient?> FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare)
|
||||
{
|
||||
return await _patientRepository.FindByUnitAndPocId(unit, pointOfCare);
|
||||
@@ -1820,6 +1858,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care identifier used to filter patients.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Patient"/> entities matching the specified point of care.</returns>
|
||||
/// <!-- aidoc:v1 sig=c4523a3 body=4e528f1 -->
|
||||
public async Task<List<Patient>> FindByPointOfCare(string pointOfCare)
|
||||
{
|
||||
return await _patientRepository.FindByPointOfCare(pointOfCare);
|
||||
@@ -1833,6 +1872,8 @@ public class PatientService : IPatientService
|
||||
/// <param name="patient">The target patient that will absorb the old patient's data.</param>
|
||||
/// <param name="oldPatientNumber">The patient number of the patient to be merged into <paramref name="patient"/>.</param>
|
||||
/// <returns>A task representing the asynchronous merge operation.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states 'if the old patient has a point of care' as the trigger, but the code checks `oldLocation.HasValue` where `oldLocation` was assigned from `patient.PointOfCareId` (the target/new patient), not from the old patient." -->
|
||||
public async Task MergePatient(Patient patient, string oldPatientNumber)
|
||||
{
|
||||
var oldLocation = patient.PointOfCareId; // sectionService.FindByPatient(patient.id);
|
||||
@@ -1874,6 +1915,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="sinceDate">The cutoff date used to archive patients who have not had any observations since this time.</param>
|
||||
/// <param name="hoursBeforeArchive">The number of hours of inactivity used to determine which discharged and inactive point-of-care patients should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=54328ba body=397ed49 -->
|
||||
public async Task DischargeInactivePatients(DateTime sinceDate, int hoursBeforeArchive)
|
||||
{
|
||||
try
|
||||
@@ -1897,6 +1939,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="updatedPatient">The patient object containing the updated information, identified by its Id.</param>
|
||||
/// <returns>The updated patient, or null if no matching patient was found or the update did not produce a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=5cf3377 body=975e64a -->
|
||||
public async Task<Patient?> UpdateOne(Patient updatedPatient)
|
||||
{
|
||||
var oldPatient = await _patientRepository.FindById(updatedPatient.Id);
|
||||
@@ -1912,6 +1955,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="altable">The new altable option to assign to the patient.</param>
|
||||
/// <param name="user">The user performing the operation, used to attribute the generated nurse observation.</param>
|
||||
/// <returns>The updated <see cref="Patient"/>, or <c>null</c> if no patient was found with the specified id.</returns>
|
||||
/// <!-- aidoc:v1 sig=ba8b79d body=376c710 -->
|
||||
public async Task<Patient?> UpdatePatientAltable(ObjectId patientId, OptionList altable, User? user)
|
||||
{
|
||||
var patient = await _patientRepository.FindByPatientId(patientId);
|
||||
@@ -1986,6 +2030,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="id"></param>
|
||||
/// <param name="archivePatient"></param>
|
||||
/// <returns></returns>
|
||||
/// <!-- aidoc:v1 sig=a446242 body=7196f4b -->
|
||||
public async Task ExitPatientById(ObjectId id, bool archivePatient = true)
|
||||
{
|
||||
try
|
||||
@@ -2025,6 +2070,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="user">The user performing the update, used for audit purposes and observation generation.</param>
|
||||
/// <param name="carePlanLog">An optional list of care plan options used when generating care plans for Treatment, Procedure, and Test list types.</param>
|
||||
/// <returns>The updated <see cref="Patient"/> if the operation succeeds; otherwise, <c>null</c> if the patient is not found or an exception is caught.</returns>
|
||||
/// <!-- aidoc:v1 sig=99d957a body=ae3ce1f -->
|
||||
public async Task<Patient?> UpdatePatientMasterList(ObjectId patientId, MasterListType typeName,
|
||||
List<OptionList> updatedOptions, User? user, List<OptionList>? carePlanLog)
|
||||
{
|
||||
@@ -2150,6 +2196,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="options">The list of options to evaluate against the patient's current items; may be null.</param>
|
||||
/// <param name="patient">The patient whose care plan is being generated.</param>
|
||||
/// <param name="user">The user performing the action; may be null.</param>
|
||||
/// <!-- aidoc:v1 sig=4bf9dea body=9cdb19e -->
|
||||
public async Task GenerateNurseCarePlanAndInsert(MasterListType carePlanType, List<OptionList>? options,
|
||||
Patient patient, User? user)
|
||||
{
|
||||
@@ -2296,6 +2343,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="patientId">The unique identifier of the patient to update.</param>
|
||||
/// <param name="person">The patient object containing the updated incoming data.</param>
|
||||
/// <exception cref="ConflictException">Thrown when the patient cannot be found by the given identifier, or when the incoming data update operation fails.</exception>
|
||||
/// <!-- aidoc:v1 sig=a6c56e3 body=de5d2fe -->
|
||||
public async Task UpdatePatientIncomingData(ObjectId patientId, Patient person)
|
||||
{
|
||||
var oldPatient = await _patientRepository.FindByPatientId(patientId) ??
|
||||
@@ -2315,6 +2363,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="person">The patient entity containing the updated information to apply.</param>
|
||||
/// <param name="patientIncomeData">The patient income information to store as a new observation.</param>
|
||||
/// <param name="user">The user performing the operation, recorded as the author of the observation.</param>
|
||||
/// <!-- aidoc:v1 sig=35aee7f body=adb3f38 -->
|
||||
public async Task UpdatePatientIncomingData(ObjectId patientId, Patient person,
|
||||
PatientIncomeData patientIncomeData, User user)
|
||||
{
|
||||
@@ -2337,6 +2386,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="opt">The master list option update data to apply to the patients.</param>
|
||||
/// <param name="unitList">The collection of units whose associated patients will have the master list option updated.</param>
|
||||
/// <param name="typeName">The name of the master list type used to identify which option to update.</param>
|
||||
/// <!-- aidoc:v1 sig=b539b7b body=162a786 -->
|
||||
public async Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList,
|
||||
string typeName)
|
||||
{
|
||||
@@ -2359,6 +2409,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="opt">The master list option to be removed from patient records.</param>
|
||||
/// <param name="unitList">The collection of units whose associated patients will be updated.</param>
|
||||
/// <param name="typeName">The name of the master list type from which the option is being deleted.</param>
|
||||
/// <!-- aidoc:v1 sig=cb62e44 body=7318409 -->
|
||||
public async Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName)
|
||||
{
|
||||
var unitIds = unitList.Select(x => x.Id).ToList();
|
||||
@@ -2388,6 +2439,8 @@ public class PatientService : IPatientService
|
||||
/// <param name="person">The patient object containing the updated demographic data.</param>
|
||||
/// <param name="user">The user performing the update, used for audit logging; may be null.</param>
|
||||
/// <exception cref="ConflictException">Thrown when no patient is found for the specified patient ID.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_param_role
|
||||
/// "The 'user' parameter is documented as 'used for audit logging', but in the code it is passed to UpdatePatientMasterList calls; the audit log entry instead uses _httpContextAccessor.HttpContext?.User!." -->
|
||||
public async Task UpdatePatientDemographicData(ObjectId patientId, Patient person, User? user)
|
||||
{
|
||||
var oldPatient = await _patientRepository.FindByPatientId(patientId) ??
|
||||
@@ -2411,6 +2464,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="patientNumber">The patient number to search for.</param>
|
||||
/// <param name="unitId">The identifier of the unit used to find a patient that is distinct from it.</param>
|
||||
/// <returns>A task containing the found <see cref="Patient"/>, or <c>null</c> if no matching patient is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=c4b3389 body=200f3e6 -->
|
||||
public Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId)
|
||||
{
|
||||
return _patientRepository.SearchByPatientNumberAndDistinctUnit(patientNumber, unitId);
|
||||
@@ -2421,6 +2475,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="archiveProcedureEndDateAfterMinutes">The minimum age, in minutes, of a finished procedure's end date used as the cutoff for including patients in the result.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Patient"/> instances associated with finished procedures matching the specified threshold.</returns>
|
||||
/// <!-- aidoc:v1 sig=8527a2e body=c772e96 -->
|
||||
public async Task<List<Patient>> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes)
|
||||
{
|
||||
return await _patientRepository.FindAllPatientWithFinishedProcedures(archiveProcedureEndDateAfterMinutes);
|
||||
@@ -2431,6 +2486,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="archiveTestEndDateAfterMinutes">The number of minutes after the archive test end date used to determine which finished tests to include.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patients with finished tests.</returns>
|
||||
/// <!-- aidoc:v1 sig=30ee17f body=2964041 -->
|
||||
public async Task<List<Patient>> FindAllPatientWithFinishedTest(int archiveTestEndDateAfterMinutes)
|
||||
{
|
||||
return await _patientRepository.FindAllPatientWithFinishedTests(archiveTestEndDateAfterMinutes);
|
||||
@@ -2441,6 +2497,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="archiveTreatmentEndDateAfterMinutes">The minimum number of minutes that must have elapsed since the treatment end date for a patient to be included in the result.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of patients with finished treatments matching the archive criteria.</returns>
|
||||
/// <!-- aidoc:v1 sig=6b43cdf body=d57d2f6 -->
|
||||
public async Task<List<Patient>> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes)
|
||||
{
|
||||
return await _patientRepository.FindAllPatientWithFinishedTreatment(archiveTreatmentEndDateAfterMinutes);
|
||||
@@ -2452,6 +2509,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient instance to validate before insertion.</param>
|
||||
/// <returns><c>true</c> if the patient passes all validation checks; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=6b334f4 body=b0c1885 -->
|
||||
private bool CheckPatient(Patient patient)
|
||||
{
|
||||
//patient.AdmTime ??= DateTime.UtcNow;
|
||||
@@ -2491,6 +2549,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="oldPoc">The optional identifier of the previous point of care; when present, subscribers still associated
|
||||
/// with it but not with <paramref name="newPoc"/> are removed from the subscription group.</param>
|
||||
/// <param name="patient">The patient whose grouped observations are generated and dispatched to the subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=48b46da body=5e1c89a -->
|
||||
private async Task SendLastGroupedObsToSubscriberByPoc(ObjectId newPoc, ObjectId? oldPoc,
|
||||
Patient patient)
|
||||
{
|
||||
@@ -2548,6 +2607,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="newPoc">The Point of Care used to look up the list of relevant subscribers.</param>
|
||||
/// <param name="patient">The patient whose last observations are retrieved and forwarded to the subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=12e14ef body=c278c3c -->
|
||||
private async Task SendLastObsToSubscriberByPoc(PointOfCare newPoc, Patient patient)
|
||||
{
|
||||
// Obtén la lista de suscriptores
|
||||
@@ -2589,6 +2649,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="id">The identifier of the patient whose location will be updated.</param>
|
||||
/// <param name="unitId">The identifier of the new unit the patient is being moved to.</param>
|
||||
/// <param name="pocId">The identifier of the new point-of-care the patient is being moved to.</param>
|
||||
/// <!-- aidoc:v1 sig=f267994 body=442e412 -->
|
||||
private async Task UpdateLocation(ObjectId id, ObjectId unitId, ObjectId pocId)
|
||||
{
|
||||
try
|
||||
@@ -2689,6 +2750,8 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="newLocation">New location where patient is getting updated</param>
|
||||
/// <param name="patientId">Object Id for patient</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the if-branch triggers on 'DELETED or PUSHED', but the code also checks for 'Moved' as a third condition that triggers the same branch (RemoveGroupedObsByPatientId). A reader would incorrectly assume Moved falls into the else branch." -->
|
||||
private void CheckLocationForWsSubscriber(PatientLocation? newLocation, ObjectId? patientId)
|
||||
{
|
||||
if (patientId == null || newLocation == null) return;
|
||||
@@ -2712,6 +2775,12 @@ public class PatientService : IPatientService
|
||||
/// <param>hoursBeforeArchive</param>
|
||||
/// .
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Summary says it archives 'all patients who have not updated since', but the code only archives patients who are NOT in an active PoC (`.Where(p => !p.IsInActivePoC())`); the 'InInactivePoC' filter is the defining behavior of the method and is omitted." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "References the method name `ArchiveNotUpdatedSince` inside `<c>`, but the actual method is `ArchiveNotUpdatedPatientsInInactivePoCSince`." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=missing_param
|
||||
/// "No proper `<param name=\"hoursBeforeArchive\">` element is declared; the existing `<param>hoursBeforeArchive</param>` is malformed and nested inside `<summary>` rather than being a child parameter element." -->
|
||||
public async Task ArchiveNotUpdatedPatientsInInactivePoCSince(int hoursBeforeArchive)
|
||||
{
|
||||
_logger.LogDebug(
|
||||
@@ -2736,6 +2805,8 @@ public class PatientService : IPatientService
|
||||
/// <param name="patient">The patient associated with the location update.</param>
|
||||
/// <param name="location">The patient location information to broadcast.</param>
|
||||
/// <param name="pocs">The list of point-of-care location identifiers used to filter eligible subscribers. If null or empty, no broadcast is performed.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_returns
|
||||
/// "The method returns Task but no <returns> tag is present." -->
|
||||
public Task SendPatientLocationBroadcast(object patient, PatientLocation location,
|
||||
List<ObjectId>? pocs)
|
||||
{
|
||||
@@ -2764,6 +2835,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patientid">The unique identifier of the patient whose attending doctor assignment should be broadcast.</param>
|
||||
/// <param name="attendingDoctor">The <see cref="Person"/> representing the doctor now attending the patient, included in the broadcast payload.</param>
|
||||
/// <!-- aidoc:v1 sig=d13f6aa body=65b8601 -->
|
||||
private async Task SendPatientAttendingDoctorBroadcast(ObjectId patientid, Person attendingDoctor)
|
||||
{
|
||||
var patient = await FindById(patientid);
|
||||
@@ -2794,6 +2866,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patientid">The unique identifier of the patient whose data will be broadcast.</param>
|
||||
/// <param name="data">The person data payload to be sent to the matching subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=06d0d2d body=8761d5c -->
|
||||
private async Task SendPatientDataBroadcast(ObjectId patientid, Person data)
|
||||
{
|
||||
var patient = await FindById(patientid);
|
||||
@@ -2816,6 +2889,7 @@ public class PatientService : IPatientService
|
||||
/// Sends an asynchronous patient update broadcast to all subscribers whose location matches the patient's point of care, grouped by their locale. Falls back to the default locale when a group has no locale key, and translates the patient data per locale before dispatching each message as a fire-and-forget send.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose information is being broadcast; its <c>PointOfCareId</c> is used to match subscribers and its <c>UnitId</c> is used to resolve the unit for translation.</param>
|
||||
/// <!-- aidoc:v1 sig=c2a5661 body=d73de90 -->
|
||||
private async Task SendPatientBroadcast(Patient patient)
|
||||
{
|
||||
var subscribersGroup =
|
||||
@@ -2843,6 +2917,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patientid">The unique identifier of the patient whose deletion will be broadcast.</param>
|
||||
/// <param name="pocId">The point of care location identifier used to filter the targeted subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=9bf1b1b body=a401d7f -->
|
||||
private Task SendDeletePatientBroadcast(ObjectId patientid, ObjectId pocId)
|
||||
{
|
||||
var subscribers = _subscribersService.GetSubscribers().Where(s => s.LocationIds.Any(x => x == pocId)).ToList();
|
||||
@@ -2871,6 +2946,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity to be updated in place.</param>
|
||||
/// <param name="apiRequest">The API request providing the source data for the update.</param>
|
||||
/// <!-- aidoc:v1 sig=4cf567a body=9d597d8 -->
|
||||
private void UpdatePatientFromRequestToIdList(Patient patient, ApiRequest apiRequest)
|
||||
{
|
||||
if (apiRequest.AdmTime.HasValue) patient.AdmTime = apiRequest.AdmTime;
|
||||
@@ -2910,6 +2986,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="apiRequest">The API request containing operational data such as the discharge time used to set the patient's discharge timestamp.</param>
|
||||
/// <param name="patient">The patient to be moved, updated with the new point of care, unit, and location information.</param>
|
||||
/// <param name="virtualPocEnum">The virtual point of care identifier used to look up the destination bed, room, and unit.</param>
|
||||
/// <!-- aidoc:v1 sig=3f3e524 body=d3f1b47 -->
|
||||
private async Task RemovePatientAndSendToVirtualPoc(ApiRequest apiRequest, Patient patient,
|
||||
VirtualPointOfCare virtualPocEnum)
|
||||
{
|
||||
@@ -2951,6 +3028,7 @@ public class PatientService : IPatientService
|
||||
/// Handles three main cases: creating/updating patients present in ICCA but not in the DB, matching existing patients by number, and moving patients absent from ICCA to a temporal/unknown bed. Also persists patients from ICCA locations that are outside the configured point-of-care boxes, falling back to a default unknown point-of-care when a matching location is not found.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the list of ICCA patients to synchronize with the local database.</param>
|
||||
/// <!-- aidoc:v1 sig=48ce95c body=52bb041 -->
|
||||
private async Task ProcessIccaSync(ApiRequest apiRequest)
|
||||
{
|
||||
//var sections = await _sectionService.GetAll();
|
||||
@@ -3077,6 +3155,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the patient number, patient data, and target location information used for the move operation.</param>
|
||||
/// <param name="patient">The optional patient to be moved; if null, a new patient is created from the request.</param>
|
||||
/// <!-- aidoc:v1 sig=6ec4557 body=1b97e64 -->
|
||||
private async Task ProcessAdtMovePatient(ApiRequest apiRequest, Patient? patient)
|
||||
{
|
||||
try
|
||||
@@ -3234,6 +3313,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest"></param>
|
||||
/// <returns>The Inserted patient or null.</returns>
|
||||
/// <!-- aidoc:v1 sig=5108cc1 body=2ac8fa1 -->
|
||||
private async Task<Patient?> ProcessAdtPatientAdmit(ApiRequest apiRequest)
|
||||
{
|
||||
Patient? patient;
|
||||
@@ -3374,6 +3454,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose properties will be updated with the values from the admission.</param>
|
||||
/// <param name="patientInAdmission">The admission record providing the source values to be merged into the patient.</param>
|
||||
/// <!-- aidoc:v1 sig=3ff958f body=1711774 -->
|
||||
private async Task MergePatientWithAdmission(Patient patient, Admission patientInAdmission)
|
||||
{
|
||||
patient.Insulation = patientInAdmission.Insulation;
|
||||
@@ -3414,6 +3495,8 @@ public class PatientService : IPatientService
|
||||
/// <param name="patient">The patient entity to mutate with values coming from the request.</param>
|
||||
/// <param name="apiRequest">The incoming API request whose non-empty fields are applied to the patient.</param>
|
||||
/// <param name="ignoreLocation">When <c>true</c>, skips unit and point-of-care lookups and any location-based updates.</param>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_param_role
|
||||
/// "ignoreLocation does not skip the unit lookup itself; _unitService.FindByName is invoked unconditionally. It only suppresses the 'unit not found' warning, the main point-of-care lookup, and the location assignment. The 'sin cama' remap block also runs without checking ignoreLocation, so 'any location-based updates' is not fully accurate." -->
|
||||
private async Task UpdatePatientFromRequest(Patient patient, ApiRequest apiRequest,
|
||||
bool ignoreLocation = false)
|
||||
{
|
||||
@@ -3507,6 +3590,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose location will be updated.</param>
|
||||
/// <param name="apiRequest">The API request containing the new location information.</param>
|
||||
/// <!-- aidoc:v1 sig=4a3fa9a body=86ff39c -->
|
||||
private async Task ProcessUpdatePatientLocationWithOru(Patient patient, ApiRequest apiRequest)
|
||||
{
|
||||
await UpdateLocation(patient.Id, apiRequest.Location);
|
||||
@@ -3518,6 +3602,7 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="patient">The incoming patient to be updated with merged data.</param>
|
||||
/// <param name="oldPatient">The previous patient record whose missing treatments, procedures and tests are preserved during the merge.</param>
|
||||
/// <!-- aidoc:v1 sig=de7cab7 body=b879387 -->
|
||||
public async Task UpdatePatientFromMerge(Patient patient, Patient oldPatient)
|
||||
{
|
||||
var listObsName = _masterListServiceFactory.StringNurseObs();
|
||||
@@ -3627,6 +3712,8 @@ public class PatientService : IPatientService
|
||||
/// <param name="value">The list of option values for the observation, or null to default to an empty list.</param>
|
||||
/// <param name="param name="patientId">The identifier of the patient associated with the observation.</param>
|
||||
/// <param name="user">The user creating the observation, whose identifier is assigned to the observation; may be null.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "The <param> tag for patientId is malformed as `<param name=\"param name=\"patientId\">`, which breaks the XML and effectively omits the patientId parameter documentation." -->
|
||||
private async Task GenerateNurseObsAndInsert(string name, List<OptionList>? value, ObjectId patientId, User? user)
|
||||
{
|
||||
var obs = GenerateObs(
|
||||
@@ -3645,6 +3732,7 @@ public class PatientService : IPatientService
|
||||
/// <param name="value">The list of <see cref="OptionList"/> values for the observation, or <c>null</c> to use an empty list.</param>
|
||||
/// <param name="patientId">The identifier of the patient associated with the observation.</param>
|
||||
/// <returns>A new <see cref="PatientObservation"/> populated with the provided data, the current date/time, and manual insert mode.</returns>
|
||||
/// <!-- aidoc:v1 sig=ad36884 body=0603f48 -->
|
||||
private PatientObservation GenerateObs(string name, List<OptionList>? value, ObjectId patientId)
|
||||
{
|
||||
var valueList = value ?? [];
|
||||
@@ -3664,6 +3752,8 @@ public class PatientService : IPatientService
|
||||
/// </summary>
|
||||
/// <param name="masterListNameString">The name of the property in <see cref="ListSettings"/> whose associated manual observation name should be returned. Must match the property name exactly.</param>
|
||||
/// <returns>The <c>ManualObservationName</c> of the resolved <see cref="ListSettingItem"/>, or a descriptive error string if the property is not found or the property value is not a <see cref="ListSettingItem"/>.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "The summary describes the error messages as 'localized', but the code returns hardcoded Spanish string literals rather than localized resources." -->
|
||||
public string GetManualObservationName(string masterListNameString)
|
||||
{
|
||||
// 1. Obtener el tipo de la clase ListSettings.
|
||||
|
||||
@@ -34,6 +34,7 @@ public class PermissionService(
|
||||
/// <param name="user">The user whose authorizations and roles are evaluated to determine the applicable display permissions.</param>
|
||||
/// <returns>A <see cref="Task{DisplayPermissionTypes}"/> containing the display permission configuration corresponding to the matched role.</returns>
|
||||
/// <exception cref="ForbbidenException">Thrown when the user has no authorizations available, or when none of the user's authorities match the given display or its unit.</exception>
|
||||
/// <!-- aidoc:v1 sig=d8506c7 body=38a9690 -->
|
||||
public async Task<DisplayPermissionTypes> GetPermissionsForDisplay(Display display, User user)
|
||||
{
|
||||
var authorities = user.Authorization;
|
||||
@@ -92,6 +93,7 @@ public class PermissionService(
|
||||
/// <param name="user">The user whose authorizations and role are used to determine the permissions for the unit.</param>
|
||||
/// <returns>A <see cref="Task{DisplayPermissionTypes}"/> that resolves to the permission configuration matching the user's role for the specified unit.</returns>
|
||||
/// <exception cref="ForbbidenException">Thrown when the user has no authorizations, or when no authorization entry matches the provided <paramref name="unitId"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=759c4e6 body=fead12d -->
|
||||
public Task<DisplayPermissionTypes> GetPermissionsForUnit(string unitId, User user)
|
||||
{
|
||||
var authorities = user.Authorization;
|
||||
@@ -165,6 +167,7 @@ public class PermissionService(
|
||||
/// <param name="user">The username of the user whose panel permissions are being requested.</param>
|
||||
/// <returns>The <see cref="PanelPermissionTypes"/> that apply to the user based on their authorities.</returns>
|
||||
/// <exception cref="ForbbidenException">Thrown when no user is found with the specified username.</exception>
|
||||
/// <!-- aidoc:v1 sig=d26061a body=58fe8bf -->
|
||||
public async Task<PanelPermissionTypes> GetPermissionsForPanel(string user)
|
||||
{
|
||||
var userFound = await userRepository.Value.GetByUserName(user);
|
||||
@@ -179,6 +182,7 @@ public class PermissionService(
|
||||
/// <param name="user">The user whose panel permissions are being resolved; must carry authorization data.</param>
|
||||
/// <returns>The <see cref="PanelPermissionTypes"/> associated with the matched role.</returns>
|
||||
/// <exception cref="ForbbidenException">Thrown when the user has no authorities or no authority grants panel access.</exception>
|
||||
/// <!-- aidoc:v1 sig=cd8a599 body=982b53f -->
|
||||
public PanelPermissionTypes GetPermissionsForPanel(User user)
|
||||
{
|
||||
var authorities = user.Authorization;
|
||||
@@ -222,6 +226,7 @@ public class PermissionService(
|
||||
/// <param name="source">The source permission context used when evaluating access to the display.</param>
|
||||
/// <param name="displayId">The string identifier of the display; must be parseable as an ObjectId or access is denied.</param>
|
||||
/// <returns>A task that resolves to true if the user's role and authorities grant access to the specified display; otherwise, false.</returns>
|
||||
/// <!-- aidoc:v1 sig=90064ea body=c31fd83 -->
|
||||
public async Task<bool> HasAccessToDisplay(string username, PermissionEnum.RolesType userRole,
|
||||
PermissionEnum.SourcePermissionsEnum source, string displayId)
|
||||
{
|
||||
@@ -246,6 +251,7 @@ public class PermissionService(
|
||||
/// <param name="source">The source permission context associated with the access evaluation.</param>
|
||||
/// <param name="unitId">The identifier of the unit to check access against.</param>
|
||||
/// <returns>A task that resolves to true if the user has the required access to the unit; otherwise, false.</returns>
|
||||
/// <!-- aidoc:v1 sig=906d082 body=40fc526 -->
|
||||
public async Task<bool> HasAccessToUnit(string username, PermissionEnum.RolesType userRole,
|
||||
PermissionEnum.SourcePermissionsEnum source, string unitId)
|
||||
{
|
||||
@@ -265,6 +271,8 @@ public class PermissionService(
|
||||
/// <param name="userRole">The role required to access the panel.</param>
|
||||
/// <param name="source">The source permission context used for the access check.</param>
|
||||
/// <returns>true if the user exists and has the required role within the panel; otherwise, false.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=mentions_removed_behavior
|
||||
/// "The 'source' parameter is documented as 'The source permission context used for the access check', but the parameter is never referenced in the method body." -->
|
||||
public async Task<bool> HasAccessToPanel(string username, PermissionEnum.RolesType userRole,
|
||||
PermissionEnum.SourcePermissionsEnum source)
|
||||
{
|
||||
@@ -286,6 +294,7 @@ public class PermissionService(
|
||||
/// <param name="authorities">The list of authorizations to search; a null or empty value causes the method to return <c>false</c>.</param>
|
||||
/// <param name="role">The role to find within the matched authorizations or the display's unit.</param>
|
||||
/// <returns><c>true</c> if the role is found in any matched authorization or in the display's unit; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=991ebcc body=1585fe1 -->
|
||||
private static bool SearchRoleInDisplay(Display display, List<Authorization>? authorities,
|
||||
PermissionEnum.RolesType role)
|
||||
{
|
||||
@@ -309,6 +318,7 @@ public class PermissionService(
|
||||
/// <param name="authorities">The list of authorizations to inspect; if <c>null</c>, the method short-circuits and returns <c>false</c>.</param>
|
||||
/// <param name="role">The role type to look for within the authorities of the specified unit.</param>
|
||||
/// <returns><c>true</c> if an authority exists for <paramref name="unitId"/> with a role equal to <paramref name="role"/>; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=693c67c body=dfaeeb7 -->
|
||||
private static bool SearchRoleInUnit(string unitId, List<Authorization>? authorities, PermissionEnum.RolesType role)
|
||||
{
|
||||
if (authorities == null)
|
||||
@@ -331,6 +341,8 @@ public class PermissionService(
|
||||
/// <param name="role">The role to look for within the panel-authorized entries.</param>
|
||||
/// <returns><c>true</c> if at least one entry has <c>PanelAuthorization</c> enabled and matches the specified role; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when an entry's <c>Rol</c> value cannot be parsed into a valid <see cref="PermissionEnum.RolesType"/>.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the method 'Returns false... when an entry has no role mapping', but when auth.Rol is null, the code calls Enum.Parse with string.Empty, which throws ArgumentException rather than returning false." -->
|
||||
private static bool SearchRoleInPanel(List<Authorization>? authorities, PermissionEnum.RolesType role)
|
||||
{
|
||||
if (authorities == null)
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace adas_core.Application.Services;
|
||||
/// Provides a proof-of-concept implementation of the IPoCMappingService interface,
|
||||
/// delivering the mapping functionality defined by that contract.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=47ed72e -->
|
||||
public class PoCMappingService : IPoCMappingService
|
||||
{
|
||||
private readonly string _key;
|
||||
@@ -41,6 +42,8 @@ public class PoCMappingService : IPoCMappingService
|
||||
/// </summary>
|
||||
/// <param name="original">location</param>
|
||||
/// <returns>mapped location</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Summary states 'otherwise it returns null', but the code returns the original `PatientLocation` when `newBed` is empty and `_mappingRequired` is false, not always null." -->
|
||||
public async Task<PatientLocation?> Map(PatientLocation original)
|
||||
{
|
||||
var pocMapping = await GetMapping();
|
||||
@@ -55,6 +58,8 @@ public class PoCMappingService : IPoCMappingService
|
||||
/// Return mapping from cache of database based on refreshTime
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_returns
|
||||
/// "The <returns> tag is empty and does not describe that the method returns a Task<PoCMapping?> (the cached or freshly fetched mapping, or null)." -->
|
||||
private async Task<PoCMapping?> GetMapping()
|
||||
{
|
||||
if (_mapping == null || DateTime.Now > _nextRefresh)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace adas_core.Application.Services
|
||||
/// - Snapshot (pump_state)
|
||||
/// - Broadcast de snapshots (PumpState + PumpAlarmState)
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0b0aa26 -->
|
||||
public class PumpService(
|
||||
IPumpObservationRepository pumpObservationRepository,
|
||||
IPumpStateRepository pumpStateRepo,
|
||||
@@ -57,6 +58,7 @@ namespace adas_core.Application.Services
|
||||
/// Processes an incoming <see cref="ApiRequest"/> by normalizing its pump observations, resolving or creating the associated patient, and handling each observation according to its message type (HL7 PCD-01/04/10 or AlarisPump). For each observation, it dispatches to the appropriate observation or alarm pipeline, updates the pump state snapshot, broadcasts the resulting snapshots with any active device alarms, and applies retention rules on the historical observations. AlarisPump observations without a PatientId are discarded, and per-observation processing errors are logged without aborting the whole request.
|
||||
/// </summary>
|
||||
/// <param name="req">The API request containing the pump observations and message type to be persisted and broadcast.</param>
|
||||
/// <!-- aidoc:v1 sig=3ced5b9 body=c626166 -->
|
||||
public async Task SaveRequest(ApiRequest req)
|
||||
{
|
||||
// Normalizar single vs list (Alaris puede mandar 1 sola)
|
||||
@@ -142,6 +144,7 @@ namespace adas_core.Application.Services
|
||||
/// Processes a pump observation by assigning an identifier and expiration, mapping it to the persistence model, and persisting it together with an audit log entry when the mapping succeeds.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to process. Its <c>Id</c> and <c>Expires</c> are populated before mapping.</param>
|
||||
/// <!-- aidoc:v1 sig=9e025e2 body=74d05a4 -->
|
||||
private async Task ProcessObservation(PumpObservation obs)
|
||||
{
|
||||
logger.LogDebug("Insertando OBSERVATION DeviceId={dev} Time={time}", obs.DeviceId, obs.Time);
|
||||
@@ -165,6 +168,7 @@ namespace adas_core.Application.Services
|
||||
/// Persists a pump alarm event derived from the supplied observation and updates the associated alarm state.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation providing the device, infusion, alarm, and patient context used to build the alarm event.</param>
|
||||
/// <!-- aidoc:v1 sig=e9b46d7 body=fc7e79f -->
|
||||
private async Task ProcessAlarm(PumpObservation obs)
|
||||
{
|
||||
logger.LogDebug("Insertando ALARM DeviceId={dev}, Phase={phase}, Type={type}",
|
||||
@@ -205,6 +209,7 @@ namespace adas_core.Application.Services
|
||||
/// Updates the alarm state for a pump observation, removing the active alarm when the event phase is "end" and upserting a new alarm state record for start or continue phases.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation providing the event phase, device identifier, alarm type, and related alarm metadata used to drive the alarm state change.</param>
|
||||
/// <!-- aidoc:v1 sig=cc5c035 body=95b81e6 -->
|
||||
private async Task UpdateAlarmState(PumpObservation obs)
|
||||
{
|
||||
if (obs.EventPhase == null) return;
|
||||
@@ -251,6 +256,7 @@ namespace adas_core.Application.Services
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation whose values are merged into the current state and used to locate the device's existing record.</param>
|
||||
/// <returns>The updated <see cref="PumpState"/> instance reflecting the merged observation and the new <c>LastUpdated</c> timestamp.</returns>
|
||||
/// <!-- aidoc:v1 sig=e28e643 body=185db9d -->
|
||||
private async Task<PumpState> UpdatePumpState(PumpObservation obs)
|
||||
{
|
||||
var current = await pumpStateRepo.FindByDeviceIdAsync(obs.DeviceId!)
|
||||
@@ -274,6 +280,8 @@ namespace adas_core.Application.Services
|
||||
/// </summary>
|
||||
/// <param name="state">The target <see cref="PumpState"/> instance whose fields will be updated in place.</param>
|
||||
/// <param name="obs">The <see cref="PumpObservation"/> instance supplying the new candidate values to merge.</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary claims 'each field' is updated only when the observation provides a valid value, but the last line unconditionally assigns state.PatientId = obs.PatientId with no null/whitespace guard, contradicting that universal claim." -->
|
||||
private static void MergePumpState(PumpState state, PumpObservation obs)
|
||||
{
|
||||
// Identidad / físico
|
||||
@@ -343,6 +351,7 @@ namespace adas_core.Application.Services
|
||||
/// </summary>
|
||||
/// <param name="v">The nullable pump value to inspect.</param>
|
||||
/// <returns><c>true</c> when <paramref name="v"/> is not null and its <c>Value</c> is not null; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=c30317b -->
|
||||
private static bool HasValue(CommonPumpTypes.PumpValue? v) => v is { Value: not null };
|
||||
|
||||
// MAP
|
||||
@@ -352,6 +361,8 @@ namespace adas_core.Application.Services
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to be transformed through the mapping pipeline.</param>
|
||||
/// <returns>A task that yields the mapped <see cref="PumpObservation"/>, or <c>null</c> when the calculated observations stage produces no result.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "The <returns> tag states the method returns null 'when the calculated observations stage produces no result', but obs4 is only used for logging via LogDebug; the method always returns obs3, so a null result from the calculated observations stage has no effect on the returned value." -->
|
||||
public async Task<PumpObservation?> MapPumpObservation(PumpObservation obs)
|
||||
{
|
||||
var obs2 = await configPumpsService.Map(obs);
|
||||
@@ -371,6 +382,7 @@ namespace adas_core.Application.Services
|
||||
/// </summary>
|
||||
/// <param name="req">The API request to be saved.</param>
|
||||
/// <returns>A task that represents the asynchronous save operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=951b5f8 -->
|
||||
public Task SaveRequestAsync(ApiRequest req) => SaveRequest(req);
|
||||
|
||||
|
||||
@@ -381,6 +393,7 @@ namespace adas_core.Application.Services
|
||||
/// <param name="patientId">The unique identifier of the patient whose pump observations are being retrieved.</param>
|
||||
/// <param name="num">The maximum number of recent pump observations to return. Defaults to 1.</param>
|
||||
/// <returns>A task that resolves to a list of the most recent <see cref="PumpObservation"/> records for the patient, or an empty list when none are available.</returns>
|
||||
/// <!-- aidoc:v1 sig=0a9eb02 body=3be1853 -->
|
||||
public async Task<List<PumpObservation>> FindLastPumpObservations(ObjectId patientId, int num = 1)
|
||||
{
|
||||
var list = await pumpObservationRepository.FindByPatientId(patientId);
|
||||
@@ -396,6 +409,7 @@ namespace adas_core.Application.Services
|
||||
/// Asynchronously retrieves the most recent pump observation timestamp for every patient by delegating to the pump observation repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that resolves to a dictionary mapping each patient's <see cref="ObjectId"/> to the <see cref="DateTime"/> of their last pump observation.</returns>
|
||||
/// <!-- aidoc:v1 sig=115ac00 body=dd1cce6 -->
|
||||
public async Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime()
|
||||
{
|
||||
return await pumpObservationRepository.FindAllLastPatientObservationTimeAsync();
|
||||
@@ -407,6 +421,7 @@ namespace adas_core.Application.Services
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose related pump data should be removed.</param>
|
||||
/// <returns>A task that represents the asynchronous deletion of the patient's data across the pump observation, alarm event, and alarm state repositories.</returns>
|
||||
/// <!-- aidoc:v1 sig=09e4e41 body=fee3771 -->
|
||||
public async Task DeleteByPatientId(ObjectId id)
|
||||
{
|
||||
logger.LogDebug("Delete Pump data by Patient Id {id}", id);
|
||||
@@ -420,6 +435,7 @@ namespace adas_core.Application.Services
|
||||
/// Archives the specified patient by delegating the operation to the archive routine identified by the patient's identifier.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=14b3e19 -->
|
||||
public async Task Archive(Patient patient) => await ArchiveByPatientId(patient.Id);
|
||||
|
||||
// Archivo → por PatientId (mueve a archive_pumpobservations y elimina del activo)
|
||||
@@ -427,6 +443,7 @@ namespace adas_core.Application.Services
|
||||
/// Archives all pump observations associated with the specified patient by moving them to the archive repository and then deleting the active data. If no pump observations are found for the patient, the archive insertion is skipped while the deletion of active data still proceeds.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose pump observations should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=3385472 body=58d55f6 -->
|
||||
public async Task ArchiveByPatientId(ObjectId id)
|
||||
{
|
||||
var list = await pumpObservationRepository.FindByPatientId(id);
|
||||
@@ -446,6 +463,7 @@ namespace adas_core.Application.Services
|
||||
/// <param name="id">The new ObjectId to assign.</param>
|
||||
/// <param name="oldId">The existing ObjectId to be replaced.</param>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="nameId"/> is null, empty, or whitespace.</exception>
|
||||
/// <!-- aidoc:v1 sig=72ce1ca body=f3ec601 -->
|
||||
public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)
|
||||
{
|
||||
|
||||
@@ -476,6 +494,7 @@ namespace adas_core.Application.Services
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier used to look up the configuration pump items.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is a list of <see cref="ConfigPumpItem"/> matching the given identifier, or <c>null</c> if no items are found.</returns>
|
||||
/// <!-- aidoc:v1 sig=eedef4c -->
|
||||
public async Task<List<ConfigPumpItem>?> GetItemsById(string id)
|
||||
=> await configPumpsService.GetConfigItems(id);
|
||||
|
||||
@@ -485,6 +504,7 @@ namespace adas_core.Application.Services
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ConfigPumps"/> configurations.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the underlying service returns a null result, meaning the pump configuration resource was not found.</exception>
|
||||
/// <!-- aidoc:v1 sig=e34911b -->
|
||||
public async Task<List<ConfigPumps>?> GetAllPumpConfig()
|
||||
=> await configPumpsService.GetAllPumpConfigs()
|
||||
?? throw new NotFoundException(HttpEnum.ErrorMessage.NotFoundResourceMissing);
|
||||
@@ -496,6 +516,8 @@ namespace adas_core.Application.Services
|
||||
/// <param name="id">The unique identifier of the pump configuration to retrieve.</param>
|
||||
/// <returns>The matching <see cref="ConfigPumps"/> instance, or <c>null</c> if the service returns one; otherwise a <see cref="NotFoundException"/> is thrown.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the configuration service returns <c>null</c>, indicating that the requested resource is missing.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "The <returns> tag states the method may return null if the service returns one, but the code throws NotFoundException in that case, so null is never returned." -->
|
||||
public async Task<ConfigPumps?> GetPumpConfigsById(string id)
|
||||
=> await configPumpsService.GetPumpConfigById(id)
|
||||
?? throw new NotFoundException(HttpEnum.ErrorMessage.NotFoundResourceMissing);
|
||||
@@ -506,6 +528,7 @@ namespace adas_core.Application.Services
|
||||
/// <param name="config">The pump configuration containing the updated values to persist.</param>
|
||||
/// <returns>The updated <see cref="ConfigPumps"/> configuration if the update succeeds.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the underlying update operation does not return a configuration, indicating the resource is missing.</exception>
|
||||
/// <!-- aidoc:v1 sig=16f1333 body=f673ce7 -->
|
||||
public async Task<ConfigPumps?> UpdatePumpConfig(ConfigPumps config)
|
||||
{
|
||||
var oldConfig = await configPumpsService.GetPumpConfigById(config.Id);
|
||||
@@ -520,6 +543,8 @@ namespace adas_core.Application.Services
|
||||
/// <param name="config">The pump configuration to insert.</param>
|
||||
/// <returns>The newly inserted <see cref="ConfigPumps"/>, or <see langword="null"/> if the operation yields no result.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the pump configuration could not be created by the underlying service.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "The documentation states the method may return null when the operation yields no result, but the code uses `?? throw new ConflictException(...)`, so a null result is converted into a thrown exception rather than returned. The method never actually returns null." -->
|
||||
public async Task<ConfigPumps?> InsertPumpConfig(ConfigPumps config)
|
||||
{
|
||||
await auditService.CreateAuditLogAsync(httpContextAccessor.HttpContext?.User!, null, config);
|
||||
@@ -533,6 +558,7 @@ namespace adas_core.Application.Services
|
||||
/// <param name="config">The pump configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a value indicating whether the deletion was successful.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the underlying deletion operation fails.</exception>
|
||||
/// <!-- aidoc:v1 sig=5589ecb body=1433282 -->
|
||||
public async Task<bool> DeletePumpConfig(ConfigPumps config)
|
||||
{
|
||||
var result = await configPumpsService.DeletePumpConfig(config);
|
||||
@@ -547,6 +573,8 @@ namespace adas_core.Application.Services
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination and filter criteria, including page number, page size, optional patient identifier, device identifier, and date range.</param>
|
||||
/// <returns>A task that yields the paginated response of pump observations, or <c>null</c> if the operation cannot be performed.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_returns
|
||||
/// "Documentation states the method may return null when the operation cannot be performed, but the code never returns null in any code path (it always returns a non-null PaginationResponse, possibly empty). Note: the type signature PaginationResponse<PumpObservation>? permits null, but the implementation never produces it." -->
|
||||
public async Task<PaginationResponse<PumpObservation>?> GetPaginatedPump(PaginationFilter filter)
|
||||
{
|
||||
// Implementación compatible sin nuevos métodos en los repos:
|
||||
@@ -600,6 +628,8 @@ namespace adas_core.Application.Services
|
||||
/// Inserts a pump observation into the repository, applying default values for missing identifier and timestamp, and triggers post-insertion side effects such as audit logging, state updates, snapshot broadcasting, and retention actions. If the mapped observation is null, no further action is taken. Observations with a number of zero are skipped from post-insertion processing when zero-value emissions are disabled.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to insert. Its <c>Id</c> is generated if not set, and its <c>Time</c> defaults to UTC now if set to <see cref="DateTime.MinValue"/>.</param>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "The summary states default values are applied for 'missing identifier', but the code unconditionally generates a new Id (obs.Id = ObjectId.GenerateNewId()) regardless of whether one was previously set, while the timestamp default is actually conditional." -->
|
||||
public async Task InsertPumpObservation(PumpObservation obs)
|
||||
{
|
||||
logger.LogDebug("Insert {obs}", obs);
|
||||
@@ -627,6 +657,7 @@ namespace adas_core.Application.Services
|
||||
/// Applies the configured retention policy to pump observations, executing deletion by age (days) or by count (keeping the last N), and logging a warning for unrecognized policies. Returns early when no retention policy value is available.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation used to resolve the applicable retention configuration.</param>
|
||||
/// <!-- aidoc:v1 sig=69d9eb2 body=4a9842a -->
|
||||
private async Task DoRetentionActions(PumpObservation obs)
|
||||
{
|
||||
var result = await configPumpsService.RetentionActions(obs);
|
||||
@@ -679,6 +710,7 @@ namespace adas_core.Application.Services
|
||||
/// <param name="patientId">Optional patient identifier used to resolve the patient and derive the target location; when null the request location is used instead.</param>
|
||||
/// <param name="req">Optional API request whose <c>Location</c> is used as a fallback to resolve the target location when no patient identifier is provided.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes once the pump state and all active alarms have been dispatched, or immediately when there are no matching subscribers.</returns>
|
||||
/// <!-- aidoc:v1 sig=f2630b9 body=43b3596 -->
|
||||
private async Task SendSnapshotsBroadcast(
|
||||
PumpState state,
|
||||
IEnumerable<PumpAlarmState> activeAlarms,
|
||||
@@ -734,6 +766,7 @@ namespace adas_core.Application.Services
|
||||
/// <param name="req">The API request that may contain a patient id to be parsed and assigned.</param>
|
||||
/// <param name="obs">The pump observation whose patient id is being updated in place.</param>
|
||||
/// <param name="foundPatientId">An optional patient id obtained from a prior lookup, used as a fallback when the observation has no patient id assigned.</param>
|
||||
/// <!-- aidoc:v1 sig=a9136e6 body=0d864ed -->
|
||||
private static void UpdatePatientFromRequest(ApiRequest req, PumpObservation obs, ObjectId? foundPatientId)
|
||||
{
|
||||
if (obs.PatientId == null && foundPatientId != null)
|
||||
|
||||
@@ -17,6 +17,22 @@ namespace adas_core.Application.Services;
|
||||
/// Uses <see cref="IRecordingAlertRepository"/> and <see cref="IRecordingAlertArchiveRepository"/> for alert persistence, and lazily resolves <see cref="IPatientService"/> through <paramref name="patientService"/>.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=6c23cec -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'configObservationService' is not documented with a <param> tag." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'recordingAlertRepository' is not documented with a <param> tag." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'recordingAlertArchiveRepository' is not documented with a <param> tag." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'logger' is not documented with a <param> tag." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'clientMessageService' is not documented with a <param> tag." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'subscribersService' is not documented with a <param> tag." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'httpContextAccessor' is not documented with a <param> tag." -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_param
|
||||
/// "Constructor parameter 'auditService' is not documented with a <param> tag." -->
|
||||
public class RecordingAlertService(
|
||||
Lazy<IPatientService> patientService,
|
||||
IConfigObservationService configObservationService,
|
||||
@@ -34,6 +50,7 @@ public class RecordingAlertService(
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be archived.</param>
|
||||
/// <returns>A task that represents the asynchronous archive operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=0afe718 body=be01ba0 -->
|
||||
public async Task Archive(Patient patient)
|
||||
{
|
||||
await ArchiveByPatientId(patient.Id);
|
||||
@@ -44,6 +61,7 @@ public class RecordingAlertService(
|
||||
/// to the archive repository and then deleting them from the source repository.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose recording alerts should be archived.</param>
|
||||
/// <!-- aidoc:v1 sig=3385472 body=286b52c -->
|
||||
public async Task ArchiveByPatientId(ObjectId id)
|
||||
{
|
||||
logger.LogDebug("Archive Recording Alerts by Patient Id {id}", id);
|
||||
@@ -61,6 +79,7 @@ public class RecordingAlertService(
|
||||
/// Deletes all recording alerts associated with the specified patient identifier by delegating to the recording alert repository.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose recording alerts should be removed.</param>
|
||||
/// <!-- aidoc:v1 sig=09e4e41 body=b6d232c -->
|
||||
public async Task DeleteByPatientId(ObjectId id)
|
||||
{
|
||||
logger.LogDebug("Delete Recording Alerts by Patient Id {id}", id);
|
||||
@@ -73,6 +92,7 @@ public class RecordingAlertService(
|
||||
/// <param name="patientId">The unique identifier of the patient whose recording alerts are being queried.</param>
|
||||
/// <param name="num">The maximum number of recent alerts to return. Defaults to 2.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the patient's most recent <see cref="PatientRecordingAlert"/> entries.</returns>
|
||||
/// <!-- aidoc:v1 sig=8d69c21 body=4613a27 -->
|
||||
public async Task<List<PatientRecordingAlert>> FindLastRecordingAlert(ObjectId patientId, int num = 2)
|
||||
{
|
||||
return await recordingAlertRepository.AggregatedPatientLastObservations(patientId, num);
|
||||
@@ -84,6 +104,7 @@ public class RecordingAlertService(
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to save.</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); }));
|
||||
@@ -95,6 +116,7 @@ public class RecordingAlertService(
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing patient or location identifiers and the recording alerts to persist.</param>
|
||||
/// <exception cref="ApiRequestException">Thrown when <paramref name="apiRequest"/>.Type is not a valid type for Observations.</exception>
|
||||
/// <!-- aidoc:v1 sig=229d8cd body=d93e92b -->
|
||||
public async Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
if (string.IsNullOrEmpty(apiRequest.PatientNumber) && string.IsNullOrEmpty(apiRequest.Location?.UnitName) &&
|
||||
@@ -164,6 +186,7 @@ public class RecordingAlertService(
|
||||
/// <param name="nameId">The name identifier used to filter the records to update.</param>
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing <see cref="ObjectId"/> value to be replaced in the matching records.</param>
|
||||
/// <!-- aidoc:v1 sig=72ce1ca body=c1620c4 -->
|
||||
public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)
|
||||
{
|
||||
await recordingAlertRepository.UpdateManyObjectId(nameId, id, oldId);
|
||||
@@ -173,6 +196,7 @@ public class RecordingAlertService(
|
||||
/// Inserts a new patient recording alert by persisting it, creating an audit log entry, broadcasting the alert, and executing any associated retention actions.
|
||||
/// </summary>
|
||||
/// <param name="recAlert">The patient recording alert to be inserted and processed.</param>
|
||||
/// <!-- aidoc:v1 sig=4687f06 body=311839c -->
|
||||
private async Task InsertRecordingAlert(PatientRecordingAlert recAlert)
|
||||
{
|
||||
logger.LogDebug("Insert {recAlert}", recAlert);
|
||||
@@ -186,6 +210,7 @@ public class RecordingAlertService(
|
||||
/// Asynchronously broadcasts a patient observation to subscribers whose registered locations include the patient's point of care, sending a recording alert when the observation is a recording alert and a generic observation otherwise. The method returns early without sending any message if the observation has no name, the patient cannot be resolved, or the patient has no point of care assigned.
|
||||
/// </summary>
|
||||
/// <param name="recAlert">The patient observation to broadcast to matching subscribers.</param>
|
||||
/// <!-- aidoc:v1 sig=6f93bc2 body=b6d7077 -->
|
||||
private async Task SendObsBroadcast(BasePatientObservation recAlert)
|
||||
{
|
||||
if (recAlert.Name == null) return;
|
||||
@@ -210,6 +235,7 @@ public class RecordingAlertService(
|
||||
/// </summary>
|
||||
/// <param name="recAlert">The patient recording alert whose retention actions will be evaluated and applied.</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Thrown when the resolved <see cref="RetentionPolicy"/> value is not handled by the switch statement.</exception>
|
||||
/// <!-- aidoc:v1 sig=90f8187 body=a64ba52 -->
|
||||
private async Task DoRetentionActions(PatientRecordingAlert recAlert)
|
||||
{
|
||||
var result = await configObservationService.RetentionActions(recAlert);
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace adas_core.Application.Services;
|
||||
/// <summary>
|
||||
/// Provides functionality for recording operations as defined by the <see cref="IRecordingService"/> contract.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5872d8b -->
|
||||
public class RecordingService : IRecordingService
|
||||
{
|
||||
private readonly IAuthService _authService;
|
||||
@@ -95,6 +96,7 @@ public class RecordingService : IRecordingService
|
||||
/// <param name="poc">The point of care associated with the recording.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the cancel request succeeded; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="Exception">Thrown when the recording API URL is not defined or the authentication token is null or empty.</exception>
|
||||
/// <!-- aidoc:v1 sig=34368ee body=ee5471e -->
|
||||
public async Task<bool> SendCancelRecordingToRecordingApi(Patient patient, PointOfCare poc)
|
||||
{
|
||||
var token = await _authService.GetToken();
|
||||
@@ -125,6 +127,7 @@ public class RecordingService : IRecordingService
|
||||
/// <param name="poc">The point of care where the recording was performed.</param>
|
||||
/// <param name="manualRecording">The manual recording whose start and stop times are forwarded to the queue.</param>
|
||||
/// <param name="start">A flag indicating whether the recording is being started or stopped.</param>
|
||||
/// <!-- aidoc:v1 sig=f624109 body=55cd11e -->
|
||||
public async Task SendRecordingData(Patient patient, PointOfCare poc, ManualRecording manualRecording,
|
||||
bool start)
|
||||
{
|
||||
@@ -140,6 +143,7 @@ public class RecordingService : IRecordingService
|
||||
/// <param name="poc">The point of care where the recording was captured.</param>
|
||||
/// <param name="automaticRecording">The automatic recording payload, including alarm name, start/stop/event timestamps, severity, and description.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the recording data was queued successfully; otherwise, <c>false</c> when the alarm name cannot be parsed or the send operation fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=3c0ea0c body=f69af0b -->
|
||||
public async Task<bool> SendAutoRecordingData(Patient patient, PointOfCare poc, RecordingData automaticRecording)
|
||||
{
|
||||
try
|
||||
@@ -178,6 +182,7 @@ public class RecordingService : IRecordingService
|
||||
/// <param name="start">Flag indicating whether the recording is a start event; defaults to true.</param>
|
||||
/// <param name="type">The alarm type for the recording; defaults to <see cref="AlarmEnum.Type.Manual"/>.</param>
|
||||
/// <exception cref="Exception">Thrown when the point of care status is not <see cref="StatusEnum.PointOfCare.InUse"/>, including the serialized point of care in the message.</exception>
|
||||
/// <!-- aidoc:v1 sig=e6985f2 body=01a1208 -->
|
||||
public async Task SendRecordingDataToQueue(Patient patient, PointOfCare poc, DateTime? date, DateTime? endDate,
|
||||
DateTime? eventDate, AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, string? alarmDescription,
|
||||
bool start = true, AlarmEnum.Type type = AlarmEnum.Type.Manual)
|
||||
@@ -242,6 +247,8 @@ public class RecordingService : IRecordingService
|
||||
/// </summary>
|
||||
/// <param name="roomId">The identifier of the room whose recordings should be fetched.</param>
|
||||
/// <returns>A task that resolves to a list of <see cref="RecordingData"/> for the room, an empty list when the request fails or the room has no recordings, or <c>null</c> when the recording API URL or authentication token is not configured or when the maximum number of retries is reached.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_returns
|
||||
/// "The documentation states the method returns null 'when the maximum number of retries is reached', but the post-loop check `if (retryCount == _rabbitMqSettings.MaxRetries)` is unreachable: after all retries throw HttpRequestException, `retryCount` is `MaxRetries + 1`, so the null branch is skipped and an empty list is returned instead." -->
|
||||
public async Task<List<RecordingData>?> GetRecordings(int roomId)
|
||||
{
|
||||
var retryCount = 1;
|
||||
@@ -331,6 +338,7 @@ public class RecordingService : IRecordingService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request whose recording data and patient information will be sent to the Recording API.</param>
|
||||
/// <exception cref="Exception">Rethrown via Task.FromException when a non-HTTP error occurs while sending the recording request.</exception>
|
||||
/// <!-- aidoc:v1 sig=655d140 body=ec1d813 -->
|
||||
public async Task SaveRequestAsync(ApiRequest apiRequest)
|
||||
{
|
||||
var retryCount = 1;
|
||||
@@ -420,6 +428,7 @@ public class RecordingService : IRecordingService
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to save.</param>
|
||||
/// <exception cref="NotImplementedException">Always thrown because the method has not been implemented.</exception>
|
||||
/// <!-- aidoc:v1 sig=3385bba body=bfa6f2f -->
|
||||
public Task SaveRequest(ApiRequest apiRequest)
|
||||
{
|
||||
//return Task.CompletedTask;
|
||||
@@ -442,6 +451,7 @@ public class RecordingService : IRecordingService
|
||||
/// <param name="alarmDescription">A textual description of the alarm.</param>
|
||||
/// <param name="alarm">The alarm type, defaulting to <see cref="AlarmEnum.Type.Manual"/> when not specified.</param>
|
||||
/// <returns>A configured <see cref="RecordingData"/> instance, or <c>null</c> if any required identifier is invalid.</returns>
|
||||
/// <!-- aidoc:v1 sig=912bcd8 body=3236ae1 -->
|
||||
private RecordingData? GenerateRecordingData(Patient patient, PointOfCare poc, DateTime? startDate,
|
||||
DateTime? endDate, DateTime? eventTime, int? minToExpired, AlarmEnum.Name? alarmName,
|
||||
AlarmEnum.Severity severity,
|
||||
@@ -502,6 +512,7 @@ public class RecordingService : IRecordingService
|
||||
/// and silently returns when the patient cannot be resolved.
|
||||
/// </summary>
|
||||
/// <param name="recording">The list of recording entries to broadcast; the first item is used to resolve the patient and room context.</param>
|
||||
/// <!-- aidoc:v1 sig=f4cef29 body=92782d1 -->
|
||||
private async Task SendRecordingBroadcast(List<RecordingData> recording)
|
||||
{
|
||||
if (!recording.IsNullOrEmpty())
|
||||
@@ -534,6 +545,7 @@ public class RecordingService : IRecordingService
|
||||
/// </summary>
|
||||
/// <param name="plainText">The text to encode.</param>
|
||||
/// <returns>The Base64 encoded representation of the input text.</returns>
|
||||
/// <!-- aidoc:v1 sig=7418cfd body=746e11b -->
|
||||
protected static string Base64Encode(string plainText)
|
||||
{
|
||||
var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace adas_core.Application.Services;
|
||||
/// <summary>
|
||||
/// Provides scheduling functionality as a service to manage and coordinate timed or periodic operations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=524e1c4 -->
|
||||
public class SchedulerService
|
||||
{
|
||||
private readonly bool _activateCheckExpiredAlerts;
|
||||
@@ -73,6 +74,7 @@ public class SchedulerService
|
||||
/// <param name="httpClientFactory">Factory used to create HTTP clients for provider integrations.</param>
|
||||
/// <param name="calculatedObservationsService">Lazy provider of calculated observations operations.</param>
|
||||
/// <param name="patientProcedureService">Lazy provider of patient care plan operations.</param>
|
||||
/// <!-- aidoc:v1 sig=2ce1d53 body=1abbe4d -->
|
||||
public SchedulerService(IOptions<ApiSettings> apiSettings,
|
||||
IOptions<List<ProvidersSettings>> providersSettings,
|
||||
Lazy<IPatientService> patientService,
|
||||
@@ -167,6 +169,8 @@ public class SchedulerService
|
||||
/// <summary>
|
||||
/// Initializes the Quartz scheduler by wiring up service dependencies for background jobs, creating job and trigger definitions, and conditionally scheduling them based on feature flag configuration settings before starting the scheduler.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "The summary states jobs are scheduled 'before starting the scheduler', but the code starts the scheduler first (await scheduler.Start()) and then calls ScheduleJobs afterwards." -->
|
||||
private async Task InitScheduler()
|
||||
{
|
||||
//TODO con el cambio a .net core y el repaso a la inyección de dependencias de estructure map
|
||||
@@ -398,6 +402,7 @@ public class SchedulerService
|
||||
/// <remarks>
|
||||
/// The DisallowConcurrentExecution attribute prevents overlapping executions of this job.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=e3fb42b -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class CheckHydricBalanceRyCJob : IJob
|
||||
{
|
||||
@@ -413,6 +418,7 @@ public class CheckHydricBalanceRyCJob : IJob
|
||||
/// All exceptions raised during processing are caught and logged, allowing the job to finish without interrupting the scheduler.
|
||||
/// </summary>
|
||||
/// <param name="context">The Quartz job execution context provided by the scheduler when the job trigger fires.</param>
|
||||
/// <!-- aidoc:v1 sig=1b2454a body=41f8cfc -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
@@ -457,6 +463,7 @@ public class CheckHydricBalanceRyCJob : IJob
|
||||
/// <remarks>
|
||||
/// The DisallowConcurrentExecution attribute ensures that only one instance of this job can execute at any given time.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=e9c40b0 -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class CheckActiveTreatmentsJob : IJob
|
||||
{
|
||||
@@ -474,6 +481,7 @@ public class CheckActiveTreatmentsJob : IJob
|
||||
/// Executes the scheduled job that iterates through all patients, retrieves their active treatments and the associated medicines (excluding nutrition-type medicines), and calculates medicine observations for each patient. Exceptions are caught and logged without rethrowing, and the total execution duration is logged upon completion.
|
||||
/// </summary>
|
||||
/// <param name="context">The job execution context provided by the scheduler.</param>
|
||||
/// <!-- aidoc:v1 sig=1b2454a body=0440983 -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
@@ -525,6 +533,7 @@ public class CheckActiveTreatmentsJob : IJob
|
||||
/// <remarks>
|
||||
/// The <see cref="DisallowConcurrentExecutionAttribute"/> attribute prevents multiple instances of this job from running at the same time.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=0dd74bf -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class CheckActiveAppointmentsJob : IJob
|
||||
{
|
||||
@@ -540,6 +549,7 @@ public class CheckActiveAppointmentsJob : IJob
|
||||
/// Executes the scheduled check active appointments job, logging the start and completion times along with the total elapsed time. Any exception thrown during execution is caught and logged without being rethrown.
|
||||
/// </summary>
|
||||
/// <param name="context">The Quartz scheduler context that provides runtime information for the job execution.</param>
|
||||
/// <!-- aidoc:v1 sig=1b2454a body=5d53712 -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
@@ -567,6 +577,7 @@ public class CheckActiveAppointmentsJob : IJob
|
||||
/// <remarks>
|
||||
/// The DisallowConcurrentExecution attribute prevents multiple instances of this job from running simultaneously.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=df3113f -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class CheckInactivePatientsJob : IJob
|
||||
{
|
||||
@@ -579,6 +590,7 @@ public class CheckInactivePatientsJob : IJob
|
||||
/// Skips processing when another instance is already running, as indicated by the global <c>isCheckingInactivePatients</c> flag, and logs the elapsed execution time.
|
||||
/// </summary>
|
||||
/// <param name="context">The Quartz job execution context whose <see cref="IJobExecutionContext.JobDetail"/> data map supplies the inactivity and discharge thresholds.</param>
|
||||
/// <!-- aidoc:v1 sig=1b2454a body=b1deaf7 -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
//LogExecutionContext.TrySetTraceIdentifier(Guid.NewGuid().ToString(), true);
|
||||
@@ -617,6 +629,7 @@ public class CheckInactivePatientsJob : IJob
|
||||
/// <remarks>
|
||||
/// The <c>DisallowConcurrentExecution</c> attribute ensures that overlapping executions of this job are prevented, guaranteeing that only one instance runs at a time.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=ea835b5 -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class CheckOpiateBolusesJob : IJob
|
||||
{
|
||||
@@ -630,6 +643,8 @@ public class CheckOpiateBolusesJob : IJob
|
||||
/// logging any errors that occur and reporting the total execution time upon completion.
|
||||
/// </summary>
|
||||
/// <param name="context">The Quartz job execution context provided by the scheduler for this job run.</param>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=missing_returns
|
||||
/// "The method returns Task but no <returns> tag is provided (low severity since Quartz Execute methods typically have no meaningful return value)." -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
@@ -660,6 +675,7 @@ public class CheckOpiateBolusesJob : IJob
|
||||
/// <remarks>
|
||||
/// The <see cref="DisallowConcurrentExecutionAttribute"/> attribute ensures that only one instance of this job can execute at a given time, preventing overlapping runs that could lead to duplicate processing of expired observations.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=5ab6b97 -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class CheckExpiredObservationsJob : IJob
|
||||
{
|
||||
@@ -672,6 +688,7 @@ public class CheckExpiredObservationsJob : IJob
|
||||
/// Executes the scheduled job that checks and expires observations, recalculating dependent data. Uses a global flag to prevent concurrent execution of the expiration logic, and logs the start, duration, and any errors encountered.
|
||||
/// </summary>
|
||||
/// <param name="context">The job execution context provided by the scheduler.</param>
|
||||
/// <!-- aidoc:v1 sig=1b2454a body=05b3176 -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
@@ -705,6 +722,7 @@ public class CheckExpiredObservationsJob : IJob
|
||||
/// <summary>
|
||||
/// Job for calculate NEWS based on FR, SPo2, Temperature, Tas and FC
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3533a62 -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class CalculateNewsJob : IJob
|
||||
{
|
||||
@@ -728,6 +746,7 @@ public class CalculateNewsJob : IJob
|
||||
/// the latest underlying observation is not expired.
|
||||
/// </summary>
|
||||
/// <param name="context">The Quartz job execution context provided by the scheduler.</param>
|
||||
/// <!-- aidoc:v1 sig=1b2454a body=2929244 -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
//Filter patients in real locations
|
||||
@@ -885,6 +904,7 @@ public class CalculateNewsJob : IJob
|
||||
/// <remarks>
|
||||
/// This job is decorated with the <see cref="DisallowConcurrentExecutionAttribute"/> to prevent overlapping executions of the same job instance.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=de60ccf -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class CheckExpiredAlertsJob : IJob
|
||||
{
|
||||
@@ -898,6 +918,7 @@ public class CheckExpiredAlertsJob : IJob
|
||||
/// Runs the expiration logic only when the global "isCheckingAlertsExpiration" flag is absent or set to false; any exception is caught and logged without being rethrown.
|
||||
/// </summary>
|
||||
/// <param name="context">The Quartz job execution context provided by the scheduler when the job trigger fires.</param>
|
||||
/// <!-- aidoc:v1 sig=1b2454a body=fe3b1b9 -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
@@ -929,6 +950,7 @@ public class CheckExpiredAlertsJob : IJob
|
||||
/// <remarks>
|
||||
/// The <see cref="DisallowConcurrentExecutionAttribute"/> attribute ensures that the job will not be triggered while a previous execution is still running.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=36ea806 -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class ArchiveNurseDataJob : IJob
|
||||
{
|
||||
@@ -945,6 +967,7 @@ public class ArchiveNurseDataJob : IJob
|
||||
/// Executes the ArchiveNurseDataJob which archives finished nurse procedures, tests, and treatments for patients whose associated end dates exceed the configured thresholds defined in <see cref="ArchiveNurseDataSettings"/>. Each archive category is only processed when its corresponding setting flag is active, and any exception is caught and logged without interrupting the remaining work.
|
||||
/// </summary>
|
||||
/// <param name="context">The Quartz.NET job execution context that provides runtime information for the scheduled job execution.</param>
|
||||
/// <!-- aidoc:v1 sig=1b2454a body=d478de0 -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
@@ -1053,6 +1076,7 @@ public class ArchiveNurseDataJob : IJob
|
||||
/// Represents a scheduled job that retrieves observations associated with providers.
|
||||
/// </summary>
|
||||
/// <remarks>The DisallowConcurrentExecution attribute prevents overlapping executions of this job instance.</remarks>
|
||||
/// <!-- aidoc:v1 sig=172abfc -->
|
||||
[DisallowConcurrentExecution]
|
||||
public class GetProvidersObservationsJob : IJob
|
||||
{
|
||||
@@ -1073,6 +1097,7 @@ public class GetProvidersObservationsJob : IJob
|
||||
/// skips providers whose type or required constructor cannot be found, and logs and recovers from any exception raised during processing.
|
||||
/// </summary>
|
||||
/// <param name="context">The Quartz job execution context provided by the scheduler when the job is triggered.</param>
|
||||
/// <!-- aidoc:v1 sig=1b2454a body=6326f48 -->
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
|
||||
@@ -30,6 +30,7 @@ public class ServiceConfigService(
|
||||
/// <param name="id">The identifier of the service configuration to retrieve. May be a string id or a valid ObjectId representation.</param>
|
||||
/// <returns>The matching <see cref="ServiceConfig"/>, or <c>null</c> when no record is found for the provided id.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when the resource cannot be found after attempting both the string id and the parsed <see cref="ObjectId"/> lookup.</exception>
|
||||
/// <!-- aidoc:v1 sig=61e5b19 body=92358a2 -->
|
||||
public async Task<ServiceConfig?> Get(string id)
|
||||
{
|
||||
var result = await serviceConfigRepository.FindById(id);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user