# Class ObservationDemoService

Namespace
  adas_core.Application.Services

Assembly
  adas-core.Application.dll

    public class ObservationDemoService : IObservationDemoService

Inheritance
  object
  ObservationDemoService

Implements
  IObservationDemoService

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

### ObservationDemoService(IConfigObservationService, Lazy<IAlarmService>)

    public ObservationDemoService(IConfigObservationService configObservationService, Lazy<IAlarmService> alarmService)

#### Parameters

`configObservationService` IConfigObservationService
`alarmService` Lazy<IAlarmService>

## Methods

### GenerateAlarmByField(Patient, List<Field>)

Generates a list of patient observation alarms based on the provided alarm fields, randomly skipping fields and skipping those with no matching configuration.

    public Task<List<PatientObservationAlarm>> GenerateAlarmByField(Patient patient, List<Field> dataAlarmfields)

#### Parameters

`patient` Patient

  The patient to associate with the generated alarms.

`dataAlarmfields` List<Field>

  The list of fields used to look up alarm configurations and produce alarms.

#### Returns

Task<List<PatientObservationAlarm>>

  A task that represents the asynchronous operation, containing the list of mapped PatientObservationAlarm instances that were successfully resolved.

### GenerateGroupedObservation(Patient, GroupedField)

Generates a GroupedObservation for the given patient and grouped field, producing time-spaced observations for each configured name and result type based on the field's regularity.

    public Task<GroupedObservation> GenerateGroupedObservation(Patient patient, GroupedField groupedField)

#### Parameters

`patient` Patient

  The patient to associate the generated grouped observation with.

`groupedField` GroupedField

  The grouped field configuration that defines the names, results, regularity, and maximum number of observations to generate.

#### Returns

Task<GroupedObservation>

  A task that returns the populated GroupedObservation containing the generated observations.

### GenerateObservationByField(Patient, List<Field>)

Generates a list of patient observations for the specified patient based on the provided data fields, using the corresponding configuration items to populate observation values, thresholds, and metadata. Fields without a name or without a matching configuration are skipped. When a configuration includes demo settings, the resulting observation is adjusted with a randomized initial date and, if required, an end time.

    public Task<List<PatientObservation>> GenerateObservationByField(Patient patient, List<Field> dataFields)

#### Parameters

`patient` Patient

  The patient to associate the generated observations with.

`dataFields` List<Field>

  The list of fields used to look up observation configurations and drive observation generation.

#### Returns

Task<List<PatientObservation>>

  A task that returns the list of generated PatientObservation instances; entries are omitted when no configuration is found for a field.