Processing

class succulent.processing.Processing(format, config, unittest=False)

Bases: object

Class for processing and storing data.

Parameters:
  • format (str) – The format of the data (‘csv’, ‘json’, ‘sqlite’, ‘image’, or ‘xml’).

  • config (dict) – The configuration settings for data processing.

  • unittest (bool, optional) – If True, the class is being used for unit testing. Default is False.

directory

The path to storage location.

Type:

str

format

The format of the data (‘csv’, ‘json’, ‘sqlite’, ‘image’, or ‘xml’).

Type:

str

columns

List of feature names in the data.

Type:

list

boundaries

List of minimum and maximum boundaries for each feature in the data.

Type:

list

password

The password for data access. Default is None.

Type:

str

timestamp

Enable timestamp storage for the data collection.

Type:

bool

enable_results

Enable access to the collected data via the API.

Type:

bool

enable_export

Enable collected data export via the API.

Type:

bool

df

The DataFrame to hold the data (for ‘csv’, ‘json’, and ‘sqlite’ formats).

Type:

pandas.DataFrame

key

The key to retrieve the image file from the request (for ‘image’ format).

Type:

str

Raises:

ValueError – Invalid format is provided.

boundary(value, boundary, column)

Check if the value is within the specified boundary for a column.

Parameters:
  • value (float) – The value to check.

  • boundary (dict) – A dictionary containing ‘min’ and/or ‘max’ boundaries for the column.

  • column (str) – The name of the column being checked.

Raises:

ValueError – Value is outside the specified boundary.

Returns:

The original value (within the boundary).

Return type:

float

data(req)

Generate results based on the stored data.

Returns:

The results as a dictionary.

Return type:

dict

export(req)

Export the stored data.

Returns:

The exported data as a dictionary.

Return type:

dict

parameters()

Generate URL parameters based on data columns.

Returns:

URL parameters as a string.

Return type:

str

process(req)

Process the incoming request and store the data accordingly.

Parameters:

req (Request) – The incoming request object.

Raises:

ValueError – Unauthorised access.

Returns:

None