# Interface IAlarmService

Namespace
  adas_core.Application.Services.Interfaces

Assembly
  adas-core.Application.dll

    public interface IAlarmService : IApiRequestService

Inherited Members
  IApiRequestService.SaveRequestAsync(ApiRequest)
  IApiRequestService.SaveRequest(ApiRequest)

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

## Methods

### CalculateAlarmTest(BasePatientObservationValue, string)

Asynchronously calculates an alarm test result based on the provided patient observation value.

    Task CalculateAlarmTest(BasePatientObservationValue source, string name)

#### Parameters

`source` BasePatientObservationValue

  The base patient observation value used as input for the alarm evaluation.

`name` string

  The name that identifies the alarm test to be calculated.

#### Returns

Task

### CheckObservationAlarm(PatientObservation)

Asynchronously checks the observation alarm for the specified patient observation.

    Task CheckObservationAlarm(PatientObservation obs4)

#### Parameters

`obs4` PatientObservation

  The patient observation to evaluate for alarm conditions.

#### Returns

Task

### FindLastObservationsByField(ObjectId, List<Field>?)

Retrieves the most recent patient observations for the specified patient, optionally filtered by a set of fields.

    Task<List<PatientObservationAlarm>> FindLastObservationsByField(ObjectId patientId, List<Field>? filterObservations = null)

#### Parameters

`patientId` ObjectId

  The identifier of the patient whose last observations should be retrieved.

`filterObservations` List<Field>

  An optional list of fields to restrict the returned observations; when null, no field filter is applied.

#### Returns

Task<List<PatientObservationAlarm>>

  A task that resolves to the list of the patient's most recent PatientObservationAlarm records.

### FindLastValuesNotExpired(ObjectId, List<Field>, List<ConfigObservation>)

Retrieves the most recent non-expired patient observation alarms for a specific patient, based on the provided alarm fields and configuration.

    Task<List<PatientObservationAlarm>> FindLastValuesNotExpired(ObjectId patientId, List<Field> dataAlarmfields, List<ConfigObservation> configAlarm)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose alarms are being queried.

`dataAlarmfields` List<Field>

  The list of fields used to identify and filter the patient observation alarm data.

`configAlarm` List<ConfigObservation>

  The list of configuration observations that define the alarm criteria, including expiration rules.

#### Returns

Task<List<PatientObservationAlarm>>

  A task that represents the asynchronous operation, containing the list of the latest non-expired PatientObservationAlarm entries for the patient.

### MapObservation(PatientObservationAlarm, bool)

Maps a patient observation alarm, optionally restricting the lookup to name-based matching only. Returns a null result when no matching alarm is found.

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

#### Parameters

`obs` PatientObservationAlarm

  The patient observation alarm to be mapped.

`onlyByName` bool

  When true, limits the mapping to lookups performed by name only.

#### Returns

Task<PatientObservationAlarm>

  A task that resolves to the mapped patient observation alarm, or null if no corresponding alarm is found.

### MapObservationsByName(PatientObservationAlarm)

Maps the given patient observation alarm to a corresponding record by name, returning a null result when no matching observation is found.

    Task<PatientObservationAlarm?> MapObservationsByName(PatientObservationAlarm obs)

#### Parameters

`obs` PatientObservationAlarm

  The patient observation alarm to be mapped by name.

#### Returns

Task<PatientObservationAlarm>

  A task containing the mapped PatientObservationAlarm, or `null` if no matching observation exists.

### ProcessAlarmObservations(List<PatientObservationAlarm>, List<PatientObservation>, Patient, DateTime, ObservationData?)

Processes a collection of patient observation alarms, associating them with the corresponding observations and patient, and recording the processing time.

    Task ProcessAlarmObservations(List<PatientObservationAlarm> alarmObservations, List<PatientObservation> observations, Patient patient, DateTime messageTime, ObservationData? observationData = null)

#### Parameters

`alarmObservations` List<PatientObservationAlarm>

  The list of patient observation alarms to be processed.

`observations` List<PatientObservation>

  The list of patient observations related to the alarms.

`patient` Patient

  The patient to whom the observations and alarms belong.

`messageTime` DateTime

  The timestamp associated with the message being processed.

`observationData` ObservationData

  Optional additional observation data used during processing.

#### Returns

Task

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

Sends an alarm notification associated with the specified patient observation, using the provided name, optional code, severity, and type.

    Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code, AlarmEnum.Severity severity, AlarmEnum.Type type)

#### Parameters

`obs` PatientObservation

  The patient observation that triggers the alarm.

`name` string

  The display name of the alarm.

`code` AlarmEnum.Name?

  The optional alarm code identifier, or null when not applicable.

`severity` AlarmEnum.Severity

  The severity level assigned to the alarm.

`type` AlarmEnum.Type

  The type category of the alarm.

#### Returns

Task

  A task that represents the asynchronous alarm sending operation.