# Class CalculatedObservations

Namespace
  adas_core.Application.Customizations.NursePlan

Assembly
  adas-core.Application.dll

Provides calculated observations by leveraging services obtained from the injected service provider.

    public class CalculatedObservations : ICalculatedObservations

Inheritance
  object
  CalculatedObservations

Implements
  ICalculatedObservations

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Constructors

### CalculatedObservations(IServiceProvider)

Provides calculated observations by leveraging services obtained from the injected service provider.

    public CalculatedObservations(IServiceProvider serviceProvider)

#### Parameters

`serviceProvider` IServiceProvider

## 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 to be calculated.

#### Returns

Task

#### Exceptions

NotImplementedException

  Thrown when the method is invoked, as the calculation logic has not yet been implemented.

### CalculateMedicineObservation(List<Medicine>, ObjectId)

Asynchronously calculates a medicine observation for the specified patient based on their active medicines.

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

#### Parameters

`activeMedicines` List<Medicine>

  The collection of medicines currently active for the patient.

`patientId` ObjectId

  The identifier of the patient whose medicine observation is being calculated.

#### Returns

Task

#### Exceptions

NotImplementedException

  The method is not yet implemented.

### FixTimeInconsistencyWithLast(PatientObservation)

Asynchronously resolves time inconsistencies between the supplied observation and the most recent previous observation, returning a corrected observation or `null` when no correction is required.

    public Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation)

#### Parameters

`newObservation` PatientObservation

  The new patient observation whose timestamps may need to be reconciled with the last recorded observation.

#### Returns

Task<PatientObservation>

  A task that represents the asynchronous operation. The task result contains the fixed PatientObservation, or `null` when no time inconsistency is detected.

#### Exceptions

NotImplementedException

  Thrown because the method has not been implemented yet.

### GetActiveTreatmentsByPatient(ObjectId)

Asynchronously retrieves the active treatment records associated with the specified patient.

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

#### Parameters

`id` ObjectId

  The unique identifier of the patient whose active treatments are being queried.

#### Returns

Task<IEnumerable<PatientTreatment>>

  A task representing the asynchronous operation, containing a collection of active PatientTreatment entries, which may include null values, for the specified patient.

#### Exceptions

NotImplementedException

  The method has not yet been implemented.

### Map(PatientDiagnosis)

Maps a PatientDiagnosis instance to a completed task containing the same instance.

    public Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis)

#### Parameters

`diagnosis` PatientDiagnosis

  The patient diagnosis to be returned as a completed task result.

#### Returns

Task<PatientDiagnosis>

  A completed Task<TResult> containing the provided diagnosis.

### Map(PatientTreatment)

Maps a patient treatment to its target representation asynchronously, returning the provided treatment instance unchanged.

    public Task<PatientTreatment> Map(PatientTreatment treatment)

#### Parameters

`treatment` PatientTreatment

  The patient treatment to map.

#### Returns

Task<PatientTreatment>

  A task containing the mapped patient treatment.

### Map(PumpObservation)

Asynchronously maps the provided PumpObservation, returning the input instance as the mapping result.

    public Task<PumpObservation> Map(PumpObservation pumpObservation)

#### Parameters

`pumpObservation` PumpObservation

  The PumpObservation to be mapped.

#### Returns

Task<PumpObservation>

  A task containing the mapped PumpObservation.

### MapSourceAlarm(PatientObservation, PatientObservationAlarm)

Returns the provided `obs` as-is, ignoring the `alarmToInsert` parameter.

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

#### Parameters

`obs` PatientObservation

  The patient observation to return.

`alarmToInsert` PatientObservationAlarm

  The patient observation alarm; not used in the current implementation.

#### Returns

Task<PatientObservation>

  A completed task containing the original `obs`.

### Map<T>(T, bool)

Returns the provided patient observation wrapped in a completed task without modification.

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

#### Parameters

`obs` T

  The patient observation to return.

`onlyByName` bool

  Reserved flag that is not used in the current implementation.

#### Returns

Task<T>

  A completed task containing the provided observation.

#### Type Parameters

`T`

### PreMapList(List<PatientObservation>)

Returns the provided patient observation list unchanged as a pre-mapping step, typically used as a hook before further mapping or insertion operations.

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

#### Parameters

`listToInsert` List<PatientObservation>

  The list of patient observations to be pre-mapped.

#### Returns

Task<List<PatientObservation>>

  A completed Task<TResult> containing the original list of patient observations.

### SendAlarm(PatientObservation, string, Name?)

Sends an alarm notification based on the specified patient observation, 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 identifying the alarm type.

#### Returns

Task