module dbmanager

Inheritance diagram of lightmlboard.dbmanager

Short summary

module lightmlboard.dbmanager

Manages a sqlite3 database to store the results.

source on GitHub

Classes

class truncated documentation
DatabaseCompetition Holds the data used for competitions. Tables: Competitions

Properties

property truncated documentation
Connection Returns the connexion.

Static Methods

staticmethod truncated documentation
_col_competitions  
_col_players  
_col_submissions  
_col_teams  
_dummy_submissions  

Methods

method truncated documentation
__init__  
_init Creates the tables if not present.
get_competition Retrieves a competition.
get_competitions Returns the list of competitions as list of (cpt_id, cpt_name).
get_cpt_id Returns the list of competation id.
get_player_id Returns the list of competation id.
get_results Retrieves the results of a competition.
init_from_options Initializes the database. It skips a table if it exists.
submit Adds a submission to the database.
to_df Returns the content of a table as a dataframe.

Documentation

Manages a sqlite3 database to store the results.

source on GitHub

class lightmlboard.dbmanager.DatabaseCompetition(dbfile)[source]

Bases: lightmlboard.dbengine.Database

Holds the data used for competitions. Tables:

Competitions

  • cpt_id
  • cpt_name
  • metric
  • datafile
  • description
  • expected_values

Teams

  • team_id
  • team_name

Players

  • player_id
  • team_id
  • player_name
  • mail
  • login
  • pwd

Submission

  • cpt_id
  • player_id
  • date
  • filename
  • metric_value

source on GitHub

Parameters:dbfile – filename or :memory:

source on GitHub

Connection

Returns the connexion.

source on GitHub

__init__(dbfile)[source]
Parameters:dbfile – filename or :memory:

source on GitHub

static _col_competitions()[source]
static _col_players()[source]
static _col_submissions()[source]
static _col_teams()[source]
static _dummy_submissions()[source]
_init()[source]

Creates the tables if not present.

source on GitHub

get_competition(cpt_id)[source]

Retrieves a competition.

Parameters:cpt_id – competition id
Returns:Competition

source on GitHub

get_competitions()[source]

Returns the list of competitions as list of (cpt_id, cpt_name).

source on GitHub

get_cpt_id()[source]

Returns the list of competation id.

source on GitHub

get_player_id()[source]

Returns the list of competation id.

source on GitHub

get_results(cpt_id)[source]

Retrieves the results of a competition.

Parameters:cpt_id – competition id
Returns:a data frame

source on GitHub

init_from_options(filename)[source]

Initializes the database. It skips a table if it exists.

Parameters:filename – filename

source on GitHub

submit(cpt_id, player_id, data, date=datetime.datetime(2019, 3, 23, 3, 4, 10, 369680))[source]

Adds a submission to the database.

Parameters:
  • cpt_id – competition id
  • player_id – player who did the submission
  • data – data of the submission

The function computes the metric associated to the submission.

source on GitHub

to_df(table)[source]

Returns the content of a table as a dataframe.

source on GitHub