# Interface ICalculatedObservationsService

Namespace
  adas_core.Application.Services.Interfaces

Assembly
  adas-core.Application.dll

    public interface ICalculatedObservationsService

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

## Methods

### CalculateBolusOpiates(ObjectId)

Asynchronously calculates the bolus dose of opiates for the specified patient.

    Task CalculateBolusOpiates(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient for whom the bolus opiates calculation is performed.

#### Returns

Task

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

Asynchronously calculates medicine observations for a patient based on their active medicines.

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

#### Parameters

`activeMedicines` List<Medicine>

  The list of medicines currently active for the patient.

`patientId` ObjectId

  The unique identifier of the patient.

#### Returns

Task

  A task that represents the asynchronous calculation operation.

### GetActiveTreatmentsByPatient(ObjectId)

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

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

#### Parameters

`id` ObjectId

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

#### Returns

Task<IEnumerable<PatientTreatment>>

  A task that represents the asynchronous operation, containing an enumerable collection of active PatientTreatment entries for the patient.

### Map(PatientDiagnosis)

Maps a PatientDiagnosis instance to its corresponding representation, returning null when no mapping is available.

    Task<PatientDiagnosis?> Map(PatientDiagnosis obs)

#### Parameters

`obs` PatientDiagnosis

  The source PatientDiagnosis to map.

#### Returns

Task<PatientDiagnosis>

  A Task<TResult> containing the mapped PatientDiagnosis, or null if the source cannot be mapped.

### Map(PatientObservation, bool)

Maps a PatientObservation to a corresponding PatientObservation, typically resolved through a lookup or translation process.

    Task<PatientObservation?> Map(PatientObservation obs, bool onlyByName = false)

#### Parameters

`obs` PatientObservation

  The source PatientObservation to be mapped.

`onlyByName` bool

  When `true`, restricts the mapping to be performed by name only; otherwise, additional criteria are used.

#### Returns

Task<PatientObservation>

  A Task<TResult> that resolves to the mapped PatientObservation, or `null` if no match is found.

### Map(PatientObservationAlarm, bool)

Asynchronously maps a PatientObservationAlarm instance, optionally performing the mapping by name only when `onlyByName` is `true`. Returns `null` when no matching alarm can be resolved based on the selected lookup strategy.

    Task<PatientObservationAlarm?> Map(PatientObservationAlarm obs, bool onlyByName = false)

#### Parameters

`obs` PatientObservationAlarm

  The source patient observation alarm to map.

`onlyByName` bool

  When `true`, restricts the mapping to match by name only; otherwise the full mapping logic is applied. Defaults to `false`.

#### Returns

Task<PatientObservationAlarm>

  A task that represents the asynchronous operation. The task result contains the mapped PatientObservationAlarm, or `null` if no mapping is found.

### Map(PatientRecordingAlert)

Asynchronously maps the specified PatientRecordingAlert to a resulting PatientRecordingAlert, returning null when no mapping is produced.

    Task<PatientRecordingAlert?> Map(PatientRecordingAlert obs)

#### Parameters

`obs` PatientRecordingAlert

  The source PatientRecordingAlert instance to map.

#### Returns

Task<PatientRecordingAlert>

  A Task<TResult> that contains the mapped PatientRecordingAlert, or null if the source cannot be mapped.

### Map(PatientTreatment)

Maps a PatientTreatment instance to a projected PatientTreatment representation asynchronously.

    Task<PatientTreatment?> Map(PatientTreatment treatment)

#### Parameters

`treatment` PatientTreatment

  The source PatientTreatment to be mapped.

#### Returns

Task<PatientTreatment>

  A Task<TResult> that represents the asynchronous mapping operation. The result is the mapped PatientTreatment, or null if no mapping could be produced.

### Map(PumpObservation)

Maps the provided PumpObservation to a PumpObservation result, returning null when no mapping is produced.

    Task<PumpObservation?> Map(PumpObservation obs)

#### Parameters

`obs` PumpObservation

  The source PumpObservation to be mapped.

#### Returns

Task<PumpObservation>

  A Task<TResult> containing the mapped PumpObservation, or null if the mapping yields no result.

### MapList(List<PatientObservation>)

Maps a list of patient observations for insertion, returning the transformed list asynchronously.

    Task<List<PatientObservation>> MapList(List<PatientObservation> listToInsert)

#### Parameters

`listToInsert` List<PatientObservation>

  The list of patient observations to be mapped for insertion.

#### Returns

Task<List<PatientObservation>>

  A task representing the asynchronous operation, containing the mapped list of patient observations.

### MapSourceAlarm(PatientObservation, PatientObservationAlarm)

Maps a source alarm from a PatientObservationAlarm onto a PatientObservation, producing an observation enriched with the corresponding alarm information.

    Task<PatientObservation> MapSourceAlarm(PatientObservation observation, PatientObservationAlarm observationAlarm)

#### Parameters

`observation` PatientObservation

  The patient observation that serves as the base for the mapping.

`observationAlarm` PatientObservationAlarm

  The source alarm whose data is mapped onto the observation.

#### Returns

Task<PatientObservation>

  A task that represents the asynchronous operation. The task result contains the PatientObservation populated with the mapped alarm data.