# Interface IPumpService

Namespace
  adas_core.Application.Services.Interfaces

Assembly
  adas-core.Application.dll

    public interface IPumpService : IApiRequestService

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

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

## Methods

### Archive(Patient)

Archives the specified patient, marking the patient record as archived in the system.

    Task Archive(Patient patient)

#### Parameters

`patient` Patient

  The patient to be archived.

#### Returns

Task

### ArchiveByPatientId(ObjectId)

Asynchronously archives the data associated with the specified patient identifier.

    Task ArchiveByPatientId(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the patient whose data should be archived.

#### Returns

Task

  A task that represents the asynchronous archive operation.

### DeleteByPatientId(ObjectId)

Asynchronously deletes records associated with the specified patient identifier.

    Task DeleteByPatientId(ObjectId id)

#### Parameters

`id` ObjectId

  The ObjectId of the patient whose related records should be deleted.

#### Returns

Task

### DeletePumpConfig(ConfigPumps)

Deletes the specified pump configuration.

    Task<bool> DeletePumpConfig(ConfigPumps config)

#### Parameters

`config` ConfigPumps

  The pump configuration to delete.

#### Returns

Task<bool>

  A task that represents the asynchronous delete operation. The task result is `true` if the configuration was deleted successfully; otherwise, `false`.

### FindAllLastPatientObservationTime()

Asynchronously retrieves the most recent observation timestamp for every patient, returning a dictionary keyed by patient identifier.

    Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime()

#### Returns

Task<Dictionary<ObjectId, DateTime>>

  A task that represents the asynchronous operation. The task result contains a dictionary mapping each patient's MongoDB.Bson.ObjectId to their last observation DateTime.

### FindLastPumpObservations(ObjectId, int)

Retrieves the most recent pump observations for the specified patient.

    Task<List<PumpObservation>> FindLastPumpObservations(ObjectId patientId, int num = 1)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose pump observations are being queried.

`num` int

  The maximum number of recent observations to return. Defaults to 1.

#### Returns

Task<List<PumpObservation>>

  A task that represents the asynchronous operation. The task result contains a list of the most recent pump observations for the patient, up to the specified count.

### GetAllPumpConfig()

Asynchronously retrieves the full list of pump configurations from the underlying data source.

    Task<List<ConfigPumps>?> GetAllPumpConfig()

#### Returns

Task<List<ConfigPumps>>

  A task that resolves to a List<T> containing all pump configurations, or `null` if no configurations are available.

### GetItemsById(string)

Retrieves the list of configuration pump items associated with the specified identifier.

    Task<List<ConfigPumpItem>?> GetItemsById(string id)

#### Parameters

`id` string

  The unique identifier used to look up the configuration pump items.

#### Returns

Task<List<ConfigPumpItem>>

  A task that resolves to a list of ConfigPumpItem objects matching the given identifier, or `null` when no items are found.

### GetPaginatedPump(PaginationFilter)

Retrieves a paginated collection of pump observations based on the provided filter criteria. Returns null when no pump observations match the supplied pagination filter.

    Task<PaginationResponse<PumpObservation>?> GetPaginatedPump(PaginationFilter filter)

#### Parameters

`filter` PaginationFilter

  The pagination filter that defines page size, page number, and any additional filtering criteria applied to the pump observations.

#### Returns

Task<PaginationResponse<PumpObservation>>

  A task that resolves to a PaginationResponse<T> containing the matching pump observations, or null when no results are found.

### GetPumpConfigsById(string)

Asynchronously retrieves the pump configuration associated with the specified identifier.

    Task<ConfigPumps?> GetPumpConfigsById(string id)

#### Parameters

`id` string

  The unique identifier of the pump configuration to retrieve.

#### Returns

Task<ConfigPumps>

  A task that represents the asynchronous operation. The task result contains the ConfigPumps instance matching the specified identifier, or null if no configuration is found.

### InsertPumpConfig(ConfigPumps)

Inserts a new pump configuration into the system asynchronously.

    Task<ConfigPumps?> InsertPumpConfig(ConfigPumps config)

#### Parameters

`config` ConfigPumps

  The pump configuration to be inserted.

#### Returns

Task<ConfigPumps>

  A task that represents the asynchronous operation, containing the inserted ConfigPumps or `null` if the insertion fails.

### InsertPumpObservation(PumpObservation)

Asynchronously inserts a pump observation record into the underlying data store.

    Task InsertPumpObservation(PumpObservation obs)

#### Parameters

`obs` PumpObservation

  The pump observation to persist.

#### Returns

Task

### MapPumpObservation(PumpObservation)

Asynchronously maps the specified pump observation to a resulting PumpObservation, returning `null` when no mapping result is produced.

    Task<PumpObservation?> MapPumpObservation(PumpObservation obs)

#### Parameters

`obs` PumpObservation

  The source pump observation to be mapped.

#### Returns

Task<PumpObservation>

  A task that represents the asynchronous mapping operation, containing the resulting PumpObservation or `null` if no result is available.

### UpdateManyObjectId(string, ObjectId, ObjectId)

Asynchronously updates multiple records, replacing the specified old ObjectId with a new one in the field identified by `nameId`.

    Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)

#### Parameters

`nameId` string

  The name of the field whose ObjectId value should be updated.

`id` ObjectId

  The new ObjectId value to assign.

`oldId` ObjectId

  The existing ObjectId value to be replaced.

#### Returns

Task

### UpdatePumpConfig(ConfigPumps)

Asynchronously updates the pump configuration.

    Task<ConfigPumps?> UpdatePumpConfig(ConfigPumps config)

#### Parameters

`config` ConfigPumps

  The pump configuration to update.

#### Returns

Task<ConfigPumps>

  A task that represents the asynchronous operation, containing the updated ConfigPumps or null if not found.