epyt_flow.rest_api.scada_data

epyt_flow.rest_api.scada_data.handlers

The module provides REST API handlers for some SCADA data requests.

class epyt_flow.rest_api.scada_data.handlers.ScadaDataBaseHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: BaseHandler

Base class for all handlers concerning SCADA data.

Parameters:

scada_data_mgr (ScadaDataManager) – SCADA data manager.

class epyt_flow.rest_api.scada_data.handlers.ScadaDataConvertUnitsHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling POST requests concerning unit conversion of a given SCADA data instance.

on_post(req: falcon.Request, resp: falcon.Response, data_id: str) None[source]

Converts the units of a given SCADA data instance and returns a new SCADA data instance.

Parameters:
class epyt_flow.rest_api.scada_data.handlers.ScadaDataManager[source]

Bases: ResourceManager

Class for managing SCADA data.

class epyt_flow.rest_api.scada_data.handlers.ScadaDataRemoveHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling a DELETE request for a given SCADA data instance.

on_delete(_, resp: falcon.Response, data_id: str) None[source]

Deletes a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data instance.

class epyt_flow.rest_api.scada_data.handlers.ScadaDataSensorConfigHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET and POST requests for the sensor configuration of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the sensor configuration of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

on_post(req: falcon.Request, resp: falcon.Response, data_id: str) None[source]

Sets the sensor configuration of a given SCADA data instance.

Parameters:
  • req – Request instance.

  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.handlers.ScadaDataSensorFaultsHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET and POST requests concerning sensor faults in a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets all sensor faults of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

on_post(req: falcon.Request, resp: falcon.Response, data_id: str) None[source]

Sets (i.e. overrides) the sensor faults in a given SCADA data instance.

Parameters:
  • req – Request instance.

  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

epyt_flow.rest_api.scada_data.data_handlers

This module provides REST API handlers for accessing the final sensor readings (e.g. pressure, flow rate, etc.).

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataDemandsHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the demand sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the demand sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataFlowsHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the flow sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the flow sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataLinkBulkSpeciesHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the bulk species link/pipe concentration sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the bulk species link/pipe concentrations sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataLinksQualityHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the link quality sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the link/pipe quality sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataNodeBulkSpeciesHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the bulk species node concentration sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the bulk species node concentrations sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataNodesQualityHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the node quality sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the node quality sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataPressuresHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the pressure sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the pressure sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataPumpStatesHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the pump state sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the pump state sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataSurfaceSpeciesHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the surface species concentration sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the surface species concentrations sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataTankVolumesHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the tank volume sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the tank volume sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

class epyt_flow.rest_api.scada_data.data_handlers.ScadaDataValveStatesHandler(scada_data_mgr: ScadaDataManager)[source]

Bases: ScadaDataBaseHandler

Class for handling GET requests for the valve state sensor readings of a given SCADA data instance.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the valve state sensor readings of a given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

epyt_flow.rest_api.scada_data.export_handlers

This module provides REST API handlers for exporting a given SCADA data instance.

class epyt_flow.rest_api.scada_data.export_handlers.ScadaDataBaseExportHandler(file_ext: str, **kwds)[source]

Bases: ScadaDataBaseHandler

Base handler for exporting a given SCADA data instance.

create_temp_file_path(data_id: str, file_ext: str) None[source]

Returns a path to a temporary file for storing the SCADA data instance.

Parameters:
  • data_id (str) – UUID of the SCADA data.

  • file_ext (str) – File extension.

abstract export(scada_data: ScadaData, tmp_file: str) None[source]

Exports a given SCADA data instance to a temporary file.

Parameters:
  • scada_data (ScadaData) – SCADA data instance to be exported.

  • tmp_file (str) – Path to temporary file.

on_get(_, resp: falcon.Response, data_id: str) None[source]

Gets the given SCADA data instance.

Parameters:
  • resp – Response instance.

  • data_id (str) – UUID of the SCADA data.

send_temp_file(resp: falcon.Response, tmp_file: str, content_type: str = 'application/octet-stream') None[source]

Sends a given file (tmp_file) to the the client.

Parameters:
  • resp – Response instance.

  • tmp_file (str) – Path to the temporary file to be send.

class epyt_flow.rest_api.scada_data.export_handlers.ScadaDataExportHandler(**kwds)[source]

Bases: ScadaDataBaseExportHandler

Class for handling a GET requests for exporting a given SCADA data instance to an .epytflow_scada_data file.

export(scada_data: ScadaData, tmp_file: str) None[source]

Exports a given SCADA data instance to a temporary file.

Parameters:
  • scada_data (ScadaData) – SCADA data instance to be exported.

  • tmp_file (str) – Path to temporary file.

class epyt_flow.rest_api.scada_data.export_handlers.ScadaDataMatlabExportHandler(**kwds)[source]

Bases: ScadaDataBaseExportHandler

Class for handling a GET requests for exporting a given SCADA data instance to a Matlab data file.

export(scada_data: ScadaData, tmp_file: str) None[source]

Exports a given SCADA data instance to a temporary file.

Parameters:
  • scada_data (ScadaData) – SCADA data instance to be exported.

  • tmp_file (str) – Path to temporary file.

class epyt_flow.rest_api.scada_data.export_handlers.ScadaDataNumpyExportHandler(**kwds)[source]

Bases: ScadaDataBaseExportHandler

Class for handling a GET requests for exporting a given SCADA data instance to Numpy data file.

export(scada_data: ScadaData, tmp_file: str) None[source]

Exports a given SCADA data instance to a temporary file.

Parameters:
  • scada_data (ScadaData) – SCADA data instance to be exported.

  • tmp_file (str) – Path to temporary file.

class epyt_flow.rest_api.scada_data.export_handlers.ScadaDataXlsxExportHandler(**kwds)[source]

Bases: ScadaDataBaseExportHandler

Class for handling a GET requests for exporting a given SCADA data instance to a .xlsx file.

export(scada_data: ScadaData, tmp_file: str) None[source]

Exports a given SCADA data instance to a temporary file.

Parameters:
  • scada_data (ScadaData) – SCADA data instance to be exported.

  • tmp_file (str) – Path to temporary file.