Class CalculatedObservations
- Namespace
- adas_core.Application.Customizations.HUVH.UCIN
- Assembly
- adas-core.Application.dll
Represents a concrete implementation of the ICalculatedObservations interface, providing a collection of calculated observation data.
public class CalculatedObservations : ICalculatedObservations
- Inheritance
-
CalculatedObservations
- Implements
- Inherited Members
- Extension Methods
Constructors
CalculatedObservations(IServiceProvider)
public CalculatedObservations(IServiceProvider serviceProvider)
Parameters
serviceProviderIServiceProvider
Methods
CalculateActiveBolus(ObjectId)
Calculates the active bolus for the specified patient.
public Task CalculateActiveBolus(ObjectId patientId)
Parameters
patientIdObjectIdThe unique identifier of the patient for whom the active bolus is calculated.
Returns
Exceptions
- NotImplementedException
Thrown because the method has not been implemented yet.
CalculateMedicineObservation(List<Medicine>, ObjectId)
Persists a multivalue medication observation for the specified patient based on the currently active medicines, expiring any previous medication observation recorded for the same patient.
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
Parameters
activeMedicinesList<Medicine>The list of active medicines from which distinct medication names are extracted to build the observation value.
patientIdObjectIdThe identifier of the patient for whom the medication observation is calculated and stored.
Returns
FixTimeInconsistencyWithLast(PatientObservation)
Adjusts the time of a new patient observation to ensure it is at least one second after the most recent observation with the same name, preventing time conflicts. If the observation name is null or empty, the method logs an error and returns the observation unchanged.
public Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
Parameters
newObservationPatientObservationThe new patient observation whose time may be adjusted to follow the most recent observation for the same patient and measurement.
Returns
- Task<PatientObservation>
The patient observation with a corrected time if a time conflict was detected, or the original observation if no adjustment was needed or the name was invalid.
GetActiveTreatmentsByPatient(ObjectId)
Asynchronously retrieves the collection of active treatments associated with the specified patient identifier.
public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
Parameters
idObjectIdThe unique MongoDB.Bson.ObjectId of the patient whose active treatments should be fetched.
Returns
- Task<IEnumerable<PatientTreatment>>
A task that represents the asynchronous operation, containing an IEnumerable<T> of nullable PatientTreatment instances for the patient.
Map(PatientDiagnosis)
Asynchronously maps a PatientDiagnosis to a target PatientDiagnosis representation.
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
Parameters
diagnosisPatientDiagnosisThe source PatientDiagnosis instance to be mapped.
Returns
- Task<PatientDiagnosis>
A Task<TResult> that represents the asynchronous mapping operation, containing the mapped PatientDiagnosis.
Exceptions
- NotImplementedException
Thrown when the method is invoked, as the mapping logic has not yet been implemented.
Map(PatientTreatment)
Maps a PatientTreatment by determining its OrderControlType based on prior treatments and expiration status. If the placer order number is missing, the treatment is returned unchanged. The order control is set to Xo when previous treatments exist, Dc when the treatment has expired (end time set), or Nw otherwise.
public Task<PatientTreatment> Map(PatientTreatment treatment)
Parameters
treatmentPatientTreatmentThe patient treatment to map, including its placer order, end time, and medicines.
Returns
- Task<PatientTreatment>
The mapped PatientTreatment with its order control type and medicines updated.
Map(PumpObservation)
Maps the provided PumpObservation instance by returning it unchanged, wrapped in a completed task.
public Task<PumpObservation> Map(PumpObservation pumpObservation)
Parameters
pumpObservationPumpObservationThe pump observation to map.
Returns
- Task<PumpObservation>
A completed Task<TResult> containing the provided PumpObservation.
MapSourceAlarm(PatientObservation, PatientObservationAlarm)
Maps a source alarm onto a patient observation, returning the observation unchanged without applying the alarm data.
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
Parameters
obsPatientObservationThe patient observation that the alarm is to be associated with.
alarmToInsertPatientObservationAlarmThe alarm intended to be inserted into the observation.
Returns
- Task<PatientObservation>
A task containing the patient observation, returned as-is.
Map<T>(T, bool)
Maps a patient observation by applying the appropriate calculation logic based on its name, handling multi-value interventions, surgeries, complexity scoring, pre/post saturation differences, pain scales, and last defecation value.
public Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation
Parameters
obsTThe patient observation to be mapped, which may be transformed depending on its name.
onlyByNameboolIndicates whether the mapping should be performed using only the observation name.
Returns
- Task<T>
The mapped patient observation, potentially enriched with computed values, wrapped in a task.
Type Parameters
T
PreMapList(List<PatientObservation>)
Performs a pre-mapping operation on a list of patient observations, returning the list for further processing.
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)
Parameters
listToInsertList<PatientObservation>The list of patient observations to pre-map.
Returns
- Task<List<PatientObservation>>
A task that represents the asynchronous operation, containing the provided list of patient observations.
SendAlarm(PatientObservation, string, Name?)
Sends an alarm notification for the specified patient observation, identified by name and optional alarm code.
public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)
Parameters
obsPatientObservationThe patient observation that triggers the alarm.
namestringThe name associated with the alarm.
codeAlarmEnum.Name?The optional alarm code categorizing the type of alarm to be sent.
Returns
Exceptions
- NotImplementedException
Thrown because the method has not been implemented.