# Class ConfigUnitsService

Namespace
  adas_core.Application.Services

Assembly
  adas-core.Application.dll

    public class ConfigUnitsService : IConfigUnitsService

Inheritance
  object
  ConfigUnitsService

Implements
  IConfigUnitsService

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

### ConfigUnitsService(IConfigUnitsRepository, IOptions<ApiSettings>, ILogger<ConfigUnitsService>)

    public ConfigUnitsService(IConfigUnitsRepository configUnitsRepository, IOptions<ApiSettings> apiSettings, ILogger<ConfigUnitsService> logger)

#### Parameters

`configUnitsRepository` IConfigUnitsRepository
`apiSettings` IOptions<ApiSettings>
`logger` ILogger<ConfigUnitsService>

## Methods

### Get(string)

Retrieves a configuration unit item by its unique code from the configuration store. Returns null when the configuration cannot be loaded or when no item matches the specified code.

    public Task<ConfigUnitItem?> Get(string code)

#### Parameters

`code` string

  The unique code identifier of the configuration unit item to look up.

#### Returns

Task<ConfigUnitItem>

  A task that represents the asynchronous operation. The task result contains the matching ConfigUnitItem, or null if the configuration is unavailable or no item is found.

### Map(PumpObservation)

Maps a PumpObservation by processing its pump value properties. If configuration units are not required, the observation is returned unchanged; otherwise, the pump values are mapped via `MapPumpValues` and the observation is returned.

    public Task<PumpObservation> Map(PumpObservation obs)

#### Parameters

`obs` PumpObservation

  The PumpObservation to be mapped.

#### Returns

Task<PumpObservation>

  The mapped PumpObservation, returned as-is when units configuration is not required or after pump value mapping otherwise.

### Map<T>(T)

Maps a patient observation using the unit configuration when configuration units are required. If configuration units are not required, the observation's units are not specified, or no matching configuration is found, the original observation is returned unchanged.

    public Task<T> Map<T>(T obs) where T : BasePatientObservation

#### Parameters

`obs` T

  The patient observation to be mapped.

#### Returns

Task<T>

  The mapped observation when a matching unit configuration is resolved; otherwise, the original observation.

#### Type Parameters

`T`