Class CalculatedObservations
- Namespace
- adas_core.Application.Customizations.HPAZ
- Assembly
- adas-core.Application.dll
Represents a service that provides calculated observations, receiving its dependencies through the supplied IServiceProvider.
public class CalculatedObservations : ICalculatedObservations
- Inheritance
-
CalculatedObservations
- Implements
- Inherited Members
- Extension Methods
Remarks
This class implements the ICalculatedObservations contract, exposing the behavior defined by that interface while relying on constructor-injected services for its operations.
Constructors
CalculatedObservations(IServiceProvider)
Represents a service that provides calculated observations, receiving its dependencies through the supplied IServiceProvider.
public CalculatedObservations(IServiceProvider serviceProvider)
Parameters
serviceProviderIServiceProvider
Remarks
This class implements the ICalculatedObservations contract, exposing the behavior defined by that interface while relying on constructor-injected services for its operations.
Methods
CalculateActiveBolus(ObjectId)
Asynchronously calculates the active bolus for the specified patient.
public Task CalculateActiveBolus(ObjectId patientId)
Parameters
patientIdObjectIdThe unique identifier of the patient whose active bolus is to be calculated.
Returns
CalculateBlueCodeList(List<PatientObservation?>?)
Checks if a blue code observation Lists needs to be generated and inserts it.
public Task CalculateBlueCodeList(List<PatientObservation?>? obsList)
Parameters
obsListList<PatientObservation>
Returns
CalculateMedicineObservation(List<Medicine>, ObjectId)
Calculates medicine observations for the specified patient based on their active medicines.
public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)
Parameters
activeMedicinesList<Medicine>The list of medicines currently active for the patient.
patientIdObjectIdThe unique identifier of the patient whose medicine observations are being calculated.
Returns
CalculateOxygenationIndex(BasePatientObservationValue, string)
Oxygenation index is calculated => P_VAM x FiO2 x 100 / PaO2_Tidal the method is called when it receives P_VAM or FiO2 or PaO2_Tidal and tries to take the other values to perform the calculation if they are not in database then does nothing.
public Task CalculateOxygenationIndex(BasePatientObservationValue obs, string name)
Parameters
obsBasePatientObservationValuenamestring
Returns
FixTimeInconsistencyWithLast(PatientObservation)
Ensures chronological order of patient observations by adjusting a new observation's time to one second after the most recent observation with the same name, when its time is earlier than or equal to the previous one (compared at second precision). Returns the observation unchanged and logs an error if the observation name is null or empty.
public Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)
Parameters
newObservationPatientObservationThe new patient observation to validate and potentially adjust for time consistency.
Returns
- Task<PatientObservation>
The patient observation with its time corrected if a time inconsistency was detected, otherwise the original observation.
GetActiveTreatmentsByPatient(ObjectId)
Retrieves the active treatments associated with the specified patient identifier. Returns an empty collection when no active treatments are found.
public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)
Parameters
idObjectIdThe unique identifier of the patient whose active treatments are being retrieved.
Returns
- Task<IEnumerable<PatientTreatment>>
A task that represents the asynchronous operation, containing a collection of active PatientTreatment records for the patient, or an empty collection if none exist.
Map(PatientDiagnosis)
Maps a PatientDiagnosis instance. This method is a placeholder and has not been implemented yet.
public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)
Parameters
diagnosisPatientDiagnosisThe PatientDiagnosis to be mapped.
Returns
- Task<PatientDiagnosis>
A task that represents the asynchronous operation, containing the mapped PatientDiagnosis.
Exceptions
- NotImplementedException
Thrown to indicate that the mapping logic has not been implemented.
Map(PatientTreatment)
Maps a PatientTreatment instance, performing the required transformation logic.
public Task<PatientTreatment> Map(PatientTreatment treatment)
Parameters
treatmentPatientTreatmentThe PatientTreatment to be mapped.
Returns
- Task<PatientTreatment>
A task representing the asynchronous operation, containing the mapped PatientTreatment.
Exceptions
- NotImplementedException
Thrown in all cases because the method has not yet been implemented.
Map(PumpObservation)
Maps the specified pump observation to a new PumpObservation instance asynchronously.
public Task<PumpObservation> Map(PumpObservation pumpObservation)
Parameters
pumpObservationPumpObservationThe source PumpObservation to map.
Returns
- Task<PumpObservation>
A task that represents the asynchronous mapping operation. The task result contains the mapped PumpObservation.
MapSourceAlarm(PatientObservation, PatientObservationAlarm)
Maps fields from a PatientObservationAlarm onto an existing PatientObservation, copying the alarm's EventId to Code and Event to Name when those values are provided, and always copying the alarm's Value.
public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)
Parameters
obsPatientObservationThe target PatientObservation instance that will be updated with values from the alarm.
alarmToInsertPatientObservationAlarmThe source PatientObservationAlarm whose values are applied to
obs.
Returns
- Task<PatientObservation>
A completed Task<TResult> containing the updated
obs.
Map<T>(T, bool)
Maps the obs to an event or alarm depending on its type and inserts it if needed
public Task<T?> Map<T>(T source, bool onlyByName) where T : BasePatientObservation
Parameters
sourceTObservation
onlyByNameboolTrue if the observation needs to generate an alert
Returns
- Task<T>
Mapped observation
Type Parameters
TType
PreMapList(List<PatientObservation>)
Pre-maps a list of patient observations by creating deep copies, applying configuration-based mapping, and triggering blue code calculation. Returns the original list of patient observations unchanged.
public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToMap)
Parameters
listToMapList<PatientObservation>The list of patient observations to process for mapping and blue code calculation.
Returns
- Task<List<PatientObservation>>
The original list of patient observations passed to the method.