# Interface IConfigObservationService

Namespace
  adas_core.Application.Services.Interfaces

Assembly
  adas-core.Application.dll

    public interface IConfigObservationService

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

## Methods

### CreateConfig(ConfigObservation)

Asynchronously creates a new configuration based on the provided observation data.

    Task<ConfigObservation?> CreateConfig(ConfigObservation configObservation)

#### Parameters

`configObservation` ConfigObservation

  The observation data used to create the configuration.

#### Returns

Task<ConfigObservation>

  A task that represents the asynchronous operation, containing the created ConfigObservation, or `null` if the configuration could not be created.

### DeleteSingleConfigObservationItem(ConfigObservation)

Asynchronously deletes a single configuration observation item from the underlying store.

    Task<bool> DeleteSingleConfigObservationItem(ConfigObservation configObservationItem)

#### Parameters

`configObservationItem` ConfigObservation

  The configuration observation item to be deleted.

#### Returns

Task<bool>

  A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the deletion was successful.

### Get(string)

Asynchronously retrieves a ConfigObservation identified by the given name. Returns null when no matching configuration observation is found.

    Task<ConfigObservation?> Get(string name)

#### Parameters

`name` string

  The name of the configuration observation to retrieve.

#### Returns

Task<ConfigObservation>

  A Task<TResult> that yields the matching ConfigObservation, or null if no observation is found.

### GetAllCompact()

Retrieves all configuration observations in a compact format.

    Task<ConfigObservationDto> GetAllCompact()

#### Returns

Task<ConfigObservationDto>

  A task representing the asynchronous operation that returns a ConfigObservationDto containing the compact representation of all configuration observations.

### GetAllConfigs(CancellationToken)

Retrieves all configuration observations asynchronously.

    Task<ICollection<ConfigObservation>> GetAllConfigs(CancellationToken ct = default)

#### Parameters

`ct` CancellationToken

  The cancellation token used to cancel the asynchronous operation.

#### Returns

Task<ICollection<ConfigObservation>>

  A task that represents the asynchronous operation. The task result contains a collection of ConfigObservation objects representing all available configurations.

### GetByCodeSysAndCode(string, string)

Retrieves a ConfigObservation identified by the specified coding system and code. Returns `null` when no matching configuration observation is found.

    Task<ConfigObservation?> GetByCodeSysAndCode(string codingSystem, string code)

#### Parameters

`codingSystem` string

  The coding system used to identify the configuration observation (e.g., ICD, SNOMED).

`code` string

  The code within the given coding system that uniquely identifies the configuration observation.

#### Returns

Task<ConfigObservation>

  A ConfigObservation if a match is found; otherwise, `null`.

### GetConfigById(ObjectId)

Retrieves a configuration observation by its unique identifier.

    Task<ConfigObservation?> GetConfigById(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the configuration observation to retrieve.

#### Returns

Task<ConfigObservation>

  A task that represents the asynchronous operation. The task result contains the ConfigObservation if a matching record is found, or `null` if no configuration exists for the specified id.

### GetConfigNames()

Asynchronously retrieves the list of available configuration names.

    Task<List<string>> GetConfigNames()

#### Returns

Task<List<string>>

  A task that represents the asynchronous operation, containing a list of configuration names.

### GetConfigNames(string)

Asynchronously retrieves a list of configuration names associated with the specified identifier.

    Task<List<string>> GetConfigNames(string id)

#### Parameters

`id` string

  The identifier used to look up the associated configuration names.

#### Returns

Task<List<string>>

  A task that represents the asynchronous operation. The task result contains a list of configuration names.

### GetConfigObservationItem(string)

Retrieves the configuration observation items associated with the specified name.

    Task<IEnumerable<ConfigObservation>?> GetConfigObservationItem(string name)

#### Parameters

`name` string

  The name used to look up the configuration observation items.

#### Returns

Task<IEnumerable<ConfigObservation>>

  A task that represents the asynchronous operation. The result contains a collection of ConfigObservation items matching the provided name, or `null` if no matching items are found.

### GetConfigObservationItemsByName(string)

Retrieves configuration observation items that match the specified name.

    Task<IEnumerable<ConfigObservation>> GetConfigObservationItemsByName(string name)

#### Parameters

`name` string

  The name used to filter the configuration observation items.

#### Returns

Task<IEnumerable<ConfigObservation>>

  A task that represents the asynchronous operation. The task result contains the collection of ConfigObservation items matching the specified name.

### GetPaginatedItems(PaginationFilter)

Retrieves a paginated collection of ConfigObservation items based on the supplied filter criteria.

    Task<PaginationResponse<ConfigObservation>> GetPaginatedItems(PaginationFilter filter)

#### Parameters

`filter` PaginationFilter

  The pagination filter that defines the page size, page number, and query criteria used to retrieve the configuration observations.

#### Returns

Task<PaginationResponse<ConfigObservation>>

  A task that represents the asynchronous operation, containing a PaginationResponse<T> with the requested items and pagination metadata.

### GetSingleConfigObservationItem(string?, string?, string?, string?)

Retrieves a single configuration observation item based on the provided code, coding system, name, and original name.

    Task<ConfigObservation?> GetSingleConfigObservationItem(string? code, string? codingSystem, string? name, string? originalName)

#### Parameters

`code` string

  The code used to identify the configuration observation item.

`codingSystem` string

  The coding system associated with the code.

`name` string

  The name of the configuration observation item.

`originalName` string

  The original name of the configuration observation item.

#### Returns

Task<ConfigObservation>

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

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

Retrieves the ConfigObservation associated with the specified patient observation, optionally restricting the lookup to a match performed by name only.

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

#### Parameters

`obs` T

  The patient observation whose corresponding configuration observation is being requested.

`onlyByName` bool

  When `true`, limits the lookup to a name-based match; otherwise, other matching criteria may be applied.

#### Returns

Task<ConfigObservation>

  A task that represents the asynchronous operation. The task result contains the matching ConfigObservation, or `null` if no matching observation is found.

#### Type Parameters

`T`

### GroupedObservationStatus(GroupedField, Result, string, object, double?, double?)

Determines the status of a grouped observation field based on the provided result, value, and optional threshold range.

    Task<StatusEnum.Type> GroupedObservationStatus(GroupedField groupedField, GroupedObservationEnum.Result result, string name, object value, double? min, double? max)

#### Parameters

`groupedField` GroupedField

  The grouped field associated with the observation.

`result` GroupedObservationEnum.Result

  The result of the grouped observation used to evaluate the status.

`name` string

  The name of the field or value being evaluated.

`value` object

  The value associated with the grouped observation.

`min` double?

  The optional minimum threshold for the value.

`max` double?

  The optional maximum threshold for the value.

#### Returns

Task<StatusEnum.Type>

  A task that represents the asynchronous operation. The task result contains the evaluated StatusEnum.Type for the grouped observation.

### Map(PatientTreatment)

Asynchronously maps the specified PatientTreatment to a populated PatientTreatment instance, returning null when the treatment cannot be resolved.

    Task<PatientTreatment?> Map(PatientTreatment treatment)

#### Parameters

`treatment` PatientTreatment

  The PatientTreatment to be mapped.

#### Returns

Task<PatientTreatment>

  A Task<TResult> that yields the mapped PatientTreatment, or null if no mapping result is available.

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

Maps a patient observation to a corresponding target observation of the same type, optionally restricting the lookup to name-based matching only.

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

#### Parameters

`obs` T

  The source patient observation to be mapped.

`onlyByName` bool

  When set to `true`, the mapping is performed using the observation's name only; otherwise, additional matching criteria are considered. Defaults to `false`.

#### Returns

Task<T>

  A task that represents the asynchronous operation. The task result contains the mapped patient observation of type `T`, or `null` if no matching observation is found.

#### Type Parameters

`T`

### RemoveConfigItem(ObjectId)

Asynchronously removes the configuration item identified by the specified identifier and returns the resulting observation.

    Task<ConfigObservation?> RemoveConfigItem(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the configuration item to remove.

#### Returns

Task<ConfigObservation>

  A task that represents the asynchronous operation. The task result contains the ConfigObservation describing the removed configuration item, or `null` if no matching item was found.

### RemoveConfigItem(string)

Asynchronously removes the configuration item with the specified name.

    Task<ConfigObservation?> RemoveConfigItem(string itemName)

#### Parameters

`itemName` string

  The name of the configuration item to remove.

#### Returns

Task<ConfigObservation>

  A task that represents the asynchronous operation. The task result contains a ConfigObservation describing the removed item, or `null` if no matching item was found.

### RetentionActions<T>(T)

Performs retention actions for the specified patient observation and returns the resulting retention outcome.

    Task<ObservatitonRetentionResult?> RetentionActions<T>(T obs) where T : BasePatientObservation

#### Parameters

`obs` T

  The patient observation of type `T` on which retention actions will be executed.

#### Returns

Task<ObservatitonRetentionResult>

  A task that represents the asynchronous retention operation. The task result contains the ObservatitonRetentionResult produced by the retention actions, or `null` when no retention result is produced.

#### Type Parameters

`T`

### UpdateConfig(ConfigObservation)

Updates an existing configuration observation and returns the updated result.

    Task<ConfigObservation?> UpdateConfig(ConfigObservation configObservation)

#### Parameters

`configObservation` ConfigObservation

  The configuration observation containing the data to update.

#### Returns

Task<ConfigObservation>

  A task that resolves to the updated ConfigObservation, or `null` when no matching configuration is found.