ccs4dt.main.modules.data_management package

Submodules

ccs4dt.main.modules.data_management.input_batch_service module

class ccs4dt.main.modules.data_management.input_batch_service.InputBatchService(core_db, influx_db, location_service, object_identifier_mapping_service)

Bases: object

InputBatchService responsible for handling input batches

Parameters
  • core_db (CoreDB) – database connection of core_db

  • influx_db (InfluxDB) – database connection of influx_db

  • location_service (LocationService) – location service

  • object_identifier_mapping_service (ObjectMatchingService) – object matching service

create(location_id, input_batch)

Start the processing of the input batch async in a new thread

Parameters
  • location_id (int) – id of the location

  • input_batch (list) – the input data batch

Return type

dict

get_all_by_location_id(location_id)

Get all input batches of the given location

Return type

list

get_by_id(input_batch_id)

Get an input batch by id

Parameters

input_batch_id (int) – id of the input batch

Return type

dict

get_output_by_id(input_batch_id)

Get output batch by input batch id.

Parameters

input_batch_id (int) – id of input batch

Return type

dict

save_batch_to_influx(input_batch_id, output_batch)

Save output batch to influxDB.

Parameters
  • input_batch_id (int) – id of input batch

  • output_batch – Result of input batch calculation

Type

list

update(input_batch_id, data)

Update an input batch by id

Parameters
  • input_batch_id (int) – id of the input batch

  • data – the data to update

Type

data: dict

Return type

dict

update_status(input_batch_id, new_status)

Update status of an input batch by id

Parameters
  • input_batch_id (int) – id of the input batch

  • new_status (str) – the new status

Return type

dict

ccs4dt.main.modules.data_management.location_service module

class ccs4dt.main.modules.data_management.location_service.LocationService(core_db)

Bases: object

Location service responsible to manage locations

Parameters

core_db (CoreDB) – connection of the core_db

create(data)

Create a new location

Parameters

data (dict) – location data

Return type

dict

get_all()

Get all locations

Return type

list

get_by_id(location_id)

Get a location by id

Parameters

location_id (int) – id of the location

Return type

dict

ccs4dt.main.modules.data_management.object_identifier_mapping_service module

class ccs4dt.main.modules.data_management.object_identifier_mapping_service.ObjectIdentifierMappingService(core_db)

Bases: object

Handle mapping between object_identifiers and external_object_identifiers. object_identifiers are generated in the object_matching module. external_object_identifiers are the assigned externally by the sensors.

Parameters

core_db (CoreDB) – database connection of core_db

create(input_batch_id, object_identifier, external_object_identifier)

Store a new relationship.

Parameters
  • input_batch_id (int) – id of the input batch

  • object_identifier (str) – internal identifier

  • external_object_identifier (str) – external identifier

Return type

dict

get_by_id(id)

Get matching by id

Parameters

id (int) – id of the matching

Return type

dict

get_by_input_batch_id(input_batch_id)

Get all object_identifier mappings by input_batch_id

Parameters

input_batch_id (int) – id of the input batch

Return type

list

ccs4dt.main.modules.data_management.process_batch_thread module

class ccs4dt.main.modules.data_management.process_batch_thread.ProcessBatchThread(group=None, target=None, name=None, args=None, kwargs=None, *, daemon=None)

Bases: threading.Thread

Handle the processing of an input data batch and store the result to influxDB.

run()

Run the input batch processing

Module contents