bci.saver.drivers package

Submodules

bci.saver.drivers.find_driver module

bci.saver.drivers.find_driver.find_driver(scheme)

Finds the driver corresponding to scheme.

Parameters

scheme (str) – The database scheme.

Returns

The driver corresponding to scheme.

Raises

ValueError – If scheme is unknown.

bci.saver.drivers.postgresql module

class bci.saver.drivers.postgresql.ColorImage(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

path
snapshot_id
class bci.saver.drivers.postgresql.DepthImage(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

path
snapshot_id
class bci.saver.drivers.postgresql.Feelings(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

exhaustion
happiness
hunger
snapshot_id
thirst
class bci.saver.drivers.postgresql.Pose(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

rotation_w
rotation_x
rotation_y
rotation_z
snapshot_id
translation_x
translation_y
translation_z
class bci.saver.drivers.postgresql.PostgresqlDriver(db_url, setup=None)

Bases: object

Represents a PostgresSQL database driver.

db_url

URL of the running database.

Type

str

Parameters
  • db_url (str) – URL of the running database.

  • setup (bool) – If true, setups the running database. Default to DEFAULT_SETUP.

close()
get(endpoint, str_dates=None, **kwargs)

Gets the rows corresponding to the specified API endpoint from the database.

Parameters
  • endpoint (str) – API endpoint.

  • str_dates (bool) – If true, converts the dates in the result to str, according to the appropriate format. Default to DEFAULT_STR_DATES.

  • kwargs (dict) – enpoint’s arguments

Returns

A dictionary representation of the required rows.

Return type

dict

Raises

ValueError – If endpoint is unknown.

save(topic, data)

Saves data under topic in the database.

Parameters
  • topic (str) – Topic name.

  • data (str) – JSON-formatted raw data, as consumed from the message queue. The data contains the result received from the topic parser as well as the corresponding snapshot and user information.

Raises

ValueError – If topic is unknown.

scheme = 'postgresql'
class bci.saver.drivers.postgresql.Snapshot(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

datetime
snapshot_id
user_id
class bci.saver.drivers.postgresql.User(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

birthday
gender
user_id
username
bci.saver.drivers.postgresql.get_results()

Module contents

bci.saver.drivers.find_driver(scheme)

Finds the driver corresponding to scheme.

Parameters

scheme (str) – The database scheme.

Returns

The driver corresponding to scheme.

Raises

ValueError – If scheme is unknown.