Class RecordingAlertService
- Namespace
- adas_core.Application.Services
- Assembly
- adas-core.Application.dll
public class RecordingAlertService : IRecordingAlertService, IApiRequestService
- Inheritance
-
RecordingAlertService
- Implements
- Inherited Members
- Extension Methods
Constructors
RecordingAlertService(Lazy<IPatientService>, IConfigObservationService, IRecordingAlertRepository, IRecordingAlertArchiveRepository, ILogger<RecordingAlertService>, IClientMessageService, ISubscribersService, IHttpContextAccessor, ILocalAuditService)
public RecordingAlertService(Lazy<IPatientService> patientService, IConfigObservationService configObservationService, IRecordingAlertRepository recordingAlertRepository, IRecordingAlertArchiveRepository recordingAlertArchiveRepository, ILogger<RecordingAlertService> logger, IClientMessageService clientMessageService, ISubscribersService subscribersService, IHttpContextAccessor httpContextAccessor, ILocalAuditService auditService)
Parameters
patientServiceLazy<IPatientService>configObservationServiceIConfigObservationServicerecordingAlertRepositoryIRecordingAlertRepositoryrecordingAlertArchiveRepositoryIRecordingAlertArchiveRepositoryloggerILogger<RecordingAlertService>clientMessageServiceIClientMessageServicesubscribersServiceISubscribersServicehttpContextAccessorIHttpContextAccessorauditServiceILocalAuditService
Methods
Archive(Patient)
Archives the specified patient by delegating to the patient identifier-based archive method.
public Task Archive(Patient patient)
Parameters
patientPatientThe patient to be archived.
Returns
- Task
A task that represents the asynchronous archive operation.
ArchiveByPatientId(ObjectId)
Archives all recording alerts associated with the specified patient identifier by copying them to the archive repository and then deleting them from the source repository.
public Task ArchiveByPatientId(ObjectId id)
Parameters
idObjectIdThe unique identifier of the patient whose recording alerts should be archived.
Returns
DeleteByPatientId(ObjectId)
Deletes all recording alerts associated with the specified patient identifier by delegating to the recording alert repository.
public Task DeleteByPatientId(ObjectId id)
Parameters
idObjectIdThe unique identifier of the patient whose recording alerts should be removed.
Returns
FindLastRecordingAlert(ObjectId, int)
Retrieves the most recent patient recording alerts by aggregating the last observations for the specified patient.
public Task<List<PatientRecordingAlert>> FindLastRecordingAlert(ObjectId patientId, int num = 2)
Parameters
patientIdObjectIdThe unique identifier of the patient whose recording alerts are being queried.
numintThe maximum number of recent alerts to return. Defaults to 2.
Returns
- Task<List<PatientRecordingAlert>>
A task that represents the asynchronous operation, containing a list of the patient's most recent PatientRecordingAlert entries.
SaveRequest(ApiRequest)
Saves observation data from an API request, processing ORU_R01, ORU_R40, and RecordingAlert types by resolving the associated patient and persisting each recording alert. If the request lacks both patient and location identifiers, or no matching patient is found, the request is ignored.
public Task SaveRequest(ApiRequest apiRequest)
Parameters
apiRequestApiRequestThe API request containing patient or location identifiers and the recording alerts to persist.
Returns
Exceptions
- ApiRequestException
Thrown when
apiRequest.Type is not a valid type for Observations.
SaveRequestAsync(ApiRequest)
Asynchronously saves the specified API request by executing the save operation on a background thread.
public Task SaveRequestAsync(ApiRequest apiRequest)
Parameters
apiRequestApiRequestThe API request to save.
Returns
- Task
A task that represents the asynchronous save operation.
UpdateManyObjectId(string, ObjectId, ObjectId)
Updates multiple recording alert records, replacing the oldId with the new id filtered by the specified nameId.
public Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)
Parameters
nameIdstringThe name identifier used to filter the records to update.
idObjectIdThe new MongoDB.Bson.ObjectId value to assign to the matching records.
oldIdObjectIdThe existing MongoDB.Bson.ObjectId value to be replaced in the matching records.