Table of Contents

Class CalculatedObservations

Namespace
adas_core.Application.Customizations.BD
Assembly
adas-core.Application.dll

Represents a service that provides calculated observations, implementing the ICalculatedObservations interface.

public class CalculatedObservations : ICalculatedObservations
Inheritance
CalculatedObservations
Implements
Inherited Members
Extension Methods

Remarks

This type is instantiated with a primary constructor that accepts an IServiceProvider to resolve its dependencies.

Constructors

CalculatedObservations(IServiceProvider)

Represents a service that provides calculated observations, implementing the ICalculatedObservations interface.

public CalculatedObservations(IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

Remarks

This type is instantiated with a primary constructor that accepts an IServiceProvider to resolve its dependencies.

Methods

CalculateActiveBolus(ObjectId)

Asynchronously calculates the active bolus for the specified patient.

public Task CalculateActiveBolus(ObjectId patientId)

Parameters

patientId ObjectId

The unique identifier of the patient whose active bolus is being calculated.

Returns

Task

A task that represents the asynchronous calculation of the active bolus.

CalculateMedicineObservation(List<Medicine>, ObjectId)

Calculates medicine observations for the specified patient using the provided list of active medicines.

public Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId)

Parameters

activeMedicines List<Medicine>

The list of active medicines associated with the patient.

patientId ObjectId

The unique identifier of the patient for whom the observations are calculated.

Returns

Task

FixTimeInconsistencyWithLast(PatientObservation)

Resolves time inconsistencies between the provided new patient observation and the previously recorded one, returning a corrected observation when applicable.

public Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)

Parameters

newObservation PatientObservation

The new patient observation to be reconciled against the last stored observation.

Returns

Task<PatientObservation>

A task that yields the time-corrected PatientObservation, or null when no correction is required or no prior observation exists.

Exceptions

NotImplementedException

Thrown because the method has not been implemented yet.

GetActiveTreatmentsByPatient(ObjectId)

Retrieves the collection of active treatments associated with the specified patient identifier.

public Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)

Parameters

id ObjectId

The unique MongoDB.Bson.ObjectId identifier of the patient whose active treatments are being requested.

Returns

Task<IEnumerable<PatientTreatment>>

A task that represents the asynchronous operation, containing an IEnumerable<T> of nullable PatientTreatment entries for the patient's active treatments.

Exceptions

NotImplementedException

Thrown to indicate that the method is not yet implemented.

Map(PatientDiagnosis)

Maps the provided PatientDiagnosis instance to a completed Task<TResult>, returning the same diagnosis unchanged.

public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)

Parameters

diagnosis PatientDiagnosis

The PatientDiagnosis instance to map.

Returns

Task<PatientDiagnosis>

A Task<TResult> containing the provided PatientDiagnosis.

Map(PatientTreatment)

Returns the provided PatientTreatment as a completed task without modification.

public Task<PatientTreatment> Map(PatientTreatment treatment)

Parameters

treatment PatientTreatment

The patient treatment instance to map.

Returns

Task<PatientTreatment>

A completed Task<TResult> containing the provided treatment.

Map(PumpObservation)

Maps a pump observation, creating an associated alarm observation when the observation code is "IHE PCD-04".

public Task<PumpObservation> Map(PumpObservation pumpObservation)

Parameters

pumpObservation PumpObservation

The pump observation to be mapped.

Returns

Task<PumpObservation>

The mapped pump observation.

MapSourceAlarm(PatientObservation, PatientObservationAlarm)

Maps a source PatientObservationAlarm onto an existing PatientObservation, producing an updated observation that incorporates the alarm data.

public Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert)

Parameters

obs PatientObservation

The existing patient observation to which the alarm will be mapped.

alarmToInsert PatientObservationAlarm

The source alarm to be inserted/mapped into the observation.

Returns

Task<PatientObservation>

A Task<TResult> that represents the asynchronous mapping operation, returning the resulting patient observation.

Exceptions

NotImplementedException

Thrown because the method has not been implemented yet.

Map<T>(T, bool)

Maps the specified patient observation by returning it unchanged within a completed task. The onlyByName parameter is accepted to indicate whether the mapping should match observations by name only.

public Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation

Parameters

obs T

The patient observation to map.

onlyByName bool

Indicates whether the mapping should match observations by name only.

Returns

Task<T>

A Task<TResult> containing the provided observation.

Type Parameters

T

PreMapList(List<PatientObservation>)

Performs a pre-mapping operation on the list of patient observations before further processing. In the base implementation, the list is returned unchanged, serving as a pass-through that may be overridden to apply custom transformations or validations.

public Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert)

Parameters

listToInsert List<PatientObservation>

The list of patient observations to be pre-mapped before insertion.

Returns

Task<List<PatientObservation>>

A task containing the provided list of patient observations.

SendAlarm(PatientObservation, string, Name?)

Sends an alarm notification based on a patient observation, associated name, and optional alarm code.

public Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code)

Parameters

obs PatientObservation

The patient observation that triggers the alarm.

name string

The name associated with the alarm.

code AlarmEnum.Name?

The optional alarm code that categorizes the alarm; may be null.

Returns

Task

A task that represents the asynchronous alarm sending operation.

Exceptions

NotImplementedException

Thrown because the method is not yet implemented.