Machine Manufacturer

This documentation provides an overview of the Machine Manufacturer (german: Hersteller) module within the FastIoT ecosystem.

Services

This section provides an overview of the services available in the Hersteller (Manufacturer) module. Each service is responsible for a specific functionality within the FastIoT ecosystem.

EdcHerstellerService

class EdcHerstellerService(*args, **kwargs)

Bases: FastIoTService

EDC Hersteller Service

Parameters:
  • args – Positional arguments passed to the superclass or internal use.

  • kwargs – Arbitrary keyword arguments, allowing for extensibility or forwarding to the superclass constructor or other components.

async get_prediction()

Requests an EDC prediction

Returns:

The prediction

Return type:

quart.Response

async run_app()

Starts the application

MlServingService

class MlServingService(*args, **kwargs)

Bases: FastIoTService

ML Serving Service

Parameters:
  • args – Positional arguments passed to the superclass or internal use.

  • kwargs – Arbitrary keyword arguments, allowing for extensibility or forwarding to the superclass constructor or other components.

async get_prediction(_: str, msg: Thing) Thing

Gets a prediction using perform_prediction() and returns it to the requesting service

Parameters:
  • _ (str) – The topic of the message.

  • msg (Thing) – The data to be used for the prediction

Returns:

The prediction

Return type:

Thing

async perform_prediction(data: list[dict]) list[dict]

Performs a prediction using the model set in the ModelURI

Parameters:

data (list[dict]) – The data used for the prediction

Returns:

The predictions

Return type:

list[dict]

Broker Facade

ok_response_thing(payload: dict | list, fiot_service: FastIoTService) Thing

Creates a Thing object with the payload and the name of the service that created it.

Parameters:
  • payload (dict | list) – The payload to be sent.

  • fiot_service (FastIoTService) – The service that created the payload.

Returns:

A Thing object with the payload and the name of the service that created it.

Return type:

Thing

error_response_thing(exception: Exception, fiot_service: FastIoTService) Thing

Creates a Thing object with the error information and the name of the service that created it.

Parameters:
  • exception (Exception) – The exception that was raised.

  • fiot_service (FastIoTService) – The service that raised the exception.

Returns:

A Thing object with the error information and the name of the service that created it.

Return type:

Thing

async request_replysubject_thing_wrapper(fiot_service: FastIoTService, data: dict | list[dict], subject: str, timeout: float) Future[dict | list[dict] | int | float | str | None]

This function wraps the request to the broker and handles the response.

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (dict) – The data to be sent to the broker.

  • subject (str) – The subject to which the request is sent.

  • timeout (float) – Seconds to wait for a response.

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_save_many_raw_data_points(fiot_service: FastIoTService, data: list[dict], timeout: float = 10) Future[dict | list[dict]]

This function sends a request to the broker under the DB_SAVE_MANY_RAW_DATAPOINTS_SUBJECT subject to save raw datapoints to the database utilizing the request_replysubject_thing_wrapper

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (list[dict]) – The data to be sent to the broker.

  • timeout (float) – Seconds to wait for a response

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_upsert_many_processed_data_points(fiot_service: FastIoTService, data: list[dict], timeout: float = 10) Future[dict | list[dict]]

This function sends a request to the broker under the DB_UPSERT_MANY_PROCESSED_DATAPOINTS_SUBJECT subject to update processed datapoints in the database utilizing the request_replysubject_thing_wrapper

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (list[dict]) – The data to be sent to the broker.

  • timeout (float) – Seconds to wait for a response

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_get_all_raw_data_points(fiot_service: FastIoTService, timeout: float = 10) Future[dict | list[dict]]

This function sends a request to the broker under the DB_GET_ALL_RAW_DATA_SUBJECT for all raw datapoints in the database utilizing the request_replysubject_thing_wrapper

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (list[dict]) – The data to be sent to the broker.

  • timeout (float) – Seconds to wait for a response

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_get_all_processed_data_points(fiot_service: FastIoTService, timeout: float = 10) Future[dict | list[dict]]

This function sends a request to the broker under the DB_GET_ALL_PROCESSED_DATA_SUBJECT for all processed datapoints in the database utilizing the request_replysubject_thing_wrapper

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (list[dict]) – The data to be sent to the broker.

  • timeout (float) – Seconds to wait for a response

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_get_processed_data_points_count(fiot_service: FastIoTService, timeout: float = 10) Future[int]

This function sends a request to the broker under the DB_GET_PROCESSED_DATA_POINTS_COUNT_SUBJECT for the processed datapoints count in the database utilizing the request_replysubject_thing_wrapper

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (list[dict]) – The data to be sent to the broker.

  • timeout (float) – Seconds to wait for a response

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_get_processed_data_points_page(fiot_service: FastIoTService, page: int = 0, page_size: int = 10, timeout: float = 10) Future[list[dict]]

This function sends a request to the broker under the DB_GET_PROCESSED_DATA_PAGE_SUBJECT for a page of processed datapoints in the database utilizing the request_replysubject_thing_wrapper

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (list[dict]) – The data to be sent to the broker.

  • timeout (float) – Seconds to wait for a response

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_get_processed_data_points_from_raw_data(fiot_service: FastIoTService, data: dict, timeout: float = 10) Future[list[dict]]

This function sends a request to the broker under the DATA_PROCESSING_PROCESS_RAW_DATA_SUBJECT for a set of raw data to be processed and handed back to the requesting service utilizing the request_replysubject_thing_wrapper

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (list[dict]) – The data to be sent to the broker.

  • timeout (float) – Seconds to wait for a response

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_get_prediction(fiot_service: FastIoTService, data: list[dict], timeout: float = 10) Future[list[dict]]

This function sends a request to the broker under the ML_SERVING_SUBJECT for a prediction utilizing the request_replysubject_thing_wrapper

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (list[dict]) – The data to be sent to the broker.

  • timeout (float) – Seconds to wait for a response

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_get_labeled_dataset(fiot_service: FastIoTService, data: dict = {}, timeout: float = 10) Future[list[dict]]

This function sends a request to the broker under the DB_GET_LABELED_DATASET_SUBJECT for a labeled dataset from the database utilizing the request_replysubject_thing_wrapper

Parameters:
  • fiot_service (FastIoTService) – The FastIoTService instance that is used to send the request.

  • data (list[dict]) – The data to be sent to the broker.

  • timeout (float) – Seconds to wait for a response

Returns:

Future placeholder for the awaited Reply

Return type:

Future[dict | list[dict] | int | float | str | None]

async request_get_edc_labeled_dataset(fiot_service: FastIoTService, data: dict = {}, timeout: float = 10) Future[list[dict]]

Broker Lifecycle Topics

DB_GET_LABELED_DATASET_SUBJECT = ReplySubject(name='get-labeled-dataset', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with retrieving a labeled dataset

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

DB_SAVE_MANY_RAW_DATAPOINTS_SUBJECT = ReplySubject(name='save-many-raw-datapoints', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with saving a set of datapoints to the database

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

DB_GET_ALL_RAW_DATA_SUBJECT = ReplySubject(name='get-all-raw-datapoints', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with retrieving all raw data contained in the database

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

DB_GET_ALL_PROCESSED_DATA_SUBJECT = ReplySubject(name='get-all-processed-datapoints', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with retrieving all processed data contained in the database

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

DB_GET_PROCESSED_DATA_POINTS_COUNT_SUBJECT = ReplySubject(name='get-processed-datapoints-count', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with retrieving a certain count of processed datapoints

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

DB_UPSERT_MANY_PROCESSED_DATAPOINTS_SUBJECT = ReplySubject(name='upsert-many-processed-datapoints', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with updating a set of processed datapoints in the database

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

DB_GET_PROCESSED_DATA_COUNT_SUBJECT = ReplySubject(name='get-processed-data-count', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with retrieving the count of processed datapoints in the database

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

DB_GET_PROCESSED_DATA_PAGE_SUBJECT = ReplySubject(name='get-processed-data-page', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with retrieving processed data page from the database

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

DATA_PROCESSING_PROCESS_RAW_DATA_SUBJECT = ReplySubject(name='process-raw-datapoints', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with processing raw attached data

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

ML_SERVING_SUBJECT = ReplySubject(name='get-prediction', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with ML services

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker

DB_GET_EDC_LABELED_DATASET_SUBJECT = ReplySubject(name='get-edc-labeled-dataset', msg_cls=<class 'fastiot.msg.thing.Thing'>, reply_cls=<class 'fastiot.msg.thing.Thing'>)

Broker Subject associated with requesting a labeled EDC dataset from the database

Parameters:
  • name (string) – Subject Label

  • msg_cls (Thing) – Class of the message sent to broker

  • reply_cls (Thing) – Class of the reply received from the broker