my_application.repositories package

Submodules

my_application.repositories.BaselineToMongo module

class my_application.repositories.BaselineToMongo.BaselineToMongo(kafka_server, topic, competition, competition_config)[source]

Bases: object

static classification(message, target_dict, prediction_dict)[source]
consumer = None
mongo_repository = None
static regression(message, prediction_dict, num_records, sum_values)[source]
write()[source]

my_application.repositories.CompetitionRepository module

class my_application.repositories.CompetitionRepository.BaseRepository(host, dbname)[source]

Bases: object

Repository base class. Implements the methods to write or delete rows in the table.

insert_one(): inserts one row in the table

insert_many(): insets multiple rows in the table

delete_one(): deletes one row from the table

cleanup()[source]
delete_one(row)[source]
insert_many(rows)[source]
insert_one(row)[source]
instance = None
class my_application.repositories.CompetitionRepository.Competition(competition_id, name, datastream_id, initial_batch_size, initial_training_time, batch_size, time_interval, start_date, end_date, target_class, file_path, predictions_time_interval, description, code)[source]

Bases: sqlalchemy.ext.declarative.api.Base

batch_size
code
competition_id
datastream
datastream_id
description
end_date
file_path
initial_batch_size
initial_training_time
name
predictions_time_interval
serialize()[source]
start_date
target_class
time_interval
class my_application.repositories.CompetitionRepository.CompetitionRepository(host, dbname)[source]

Bases: my_application.repositories.CompetitionRepository.BaseRepository

Competition repository class.

Implements the methods to retrieve competitions by different condititons.

get_competition_by_id(): Retrieve competition by its ID

set_competition_code(): Update the competition code

get_all_competitions(): Retrieve all competition

get_competition_by_code(): Retrieve the competition by code

get_competitions_by_user(): Retrieve competition for a given user

get_all_competitions(status=None, page=None, step=None)[source]
get_competition_by_code(code)[source]
get_competition_by_id(competition_id)[source]
get_competitions_by_user(user_id, status, page, step)[source]
set_competition_code(competition_id, code)[source]
class my_application.repositories.CompetitionRepository.Datastream(datastream_id, name, description, file_path)[source]

Bases: sqlalchemy.ext.declarative.api.Base

competitions
datastream_id
description
file_path
name
serialize()[source]
class my_application.repositories.CompetitionRepository.DatastreamRepository(host, dbname)[source]

Bases: my_application.repositories.CompetitionRepository.BaseRepository

Competition repository class.

Implements the methods to retrieve competitions by different condititons.

get_competition_by_id(): Retrieve competition by its ID

set_competition_code(): Update the competition code

get_all_competitions(): Retrieve all competition

get_competition_by_code(): Retrieve the competition by code

get_competitions_by_user(): Retrieve competition for a given user

get_all_datastreams(page=None, step=None)[source]
get_datastream_by_id(datastream_id)[source]
class my_application.repositories.CompetitionRepository.Subscription(subscription_id, competition_id, user_id)[source]

Bases: sqlalchemy.ext.declarative.api.Base

competition
competition_id
subscription_id
time_create
user
user_id
class my_application.repositories.CompetitionRepository.SubscriptionRepository(host, dbname)[source]

Bases: my_application.repositories.CompetitionRepository.BaseRepository

Subscription repository class.

Implements the methods to retrieve subscriptions by different condititons.

get_competition_subscribers(): Get users that subscribed to the competition

check_subscription(): Check if a given user is subscribed to a given competition

get_subscription(): Retrieve the subscription for a user

check_subscription(competition_id, user_id)[source]
get_competition_subscribers(competition_id)[source]
get_subscription(competition_id, user_id)[source]
class my_application.repositories.CompetitionRepository.User(user_id, first_name, last_name, email, password, role, confirmed, confirmed_on)[source]

Bases: sqlalchemy.ext.declarative.api.Base

check_password(password)[source]
confirmed
confirmed_on
email
first_name
last_name
password_hash
role
serialize()[source]
set_password(password)[source]
user_id
class my_application.repositories.CompetitionRepository.UserRepository(host, dbname)[source]

Bases: my_application.repositories.CompetitionRepository.BaseRepository

User repository class.

Implements the methods to query the USERS table.

get_user_by_id(): Retrieve user information based on his ID

get_user_by_email(): Retrieve user information based on his email

get_all_users(): List all users

delete_many(): Delete several users at the same time

confirm_user(): Manually confirm user’s registration

confirm_user(user)[source]
delete_many(users)[source]
get_all_users()[source]
get_user_by_email(email)[source]
get_user_by_id(id)[source]

my_application.repositories.KafkaToMongo module

class my_application.repositories.KafkaToMongo.ConsumerToMongo(kafka_server, topic, competition)[source]

Bases: object

Kafka Consumer class for writing to MongoDB.

consumer = None
mongo_repository = None
write()[source]

Writes data to the MongoDB. :return:

Module contents