RAMP API

This is the full API documentation of the different RAMP packages.

RAMP database

ramp_database.model: the database model

The ramp_database.model defines the database structure which is used for the RAMP events.

The database schema is summarized in the figure below:

_images/schema_db.png

General tables

model.Extension(**kwargs)

Extension table.

model.Keyword(**kwargs)

Keyword table.

model.UserInteraction([interaction, user, …])

UserInteraction table.

Relationship tables

model.EventTeam(event, team)

EventTeam table.

model.EventAdmin(**kwargs)

EventAdmin table.

model.EventScoreType(event, score_type_object)

EventScoreType table.

model.ProblemKeyword(**kwargs)

ProblemKeyword table.

model.SubmissionFileTypeExtension(**kwargs)

SubmissionFileTypeExtension table.

model.WorkflowElement(workflow, …[, …])

WorkflowElement table.

model.WorkflowElementType(**kwargs)

WorkflowElementType table.

ramp_database.tools: the tools to communicate with the database

The ramp_database.tools provides some routine to get and set information from and in the database.

ramp_database.exceptions: type of errors raise by the database

The ramp_database.exceptions module include all custom warnings and errors used in ramp-database.

exceptions.DuplicateSubmissionError

Error to raise when a submission is already present in the database.

exceptions.MergeTeamError

Error to raise when the merging of teams is failing.

exceptions.MissingSubmissionFileError

Error to raise when the file submitted is not present in the supposed location.

exceptions.MissingExtensionError

Error to raise when the extension is not registered in the database.

exceptions.NameClashError

Error to raise when there is a duplicate in submission name.

exceptions.TooEarlySubmissionError

Error to raise when a submission was submitted to early.

exceptions.UnknownStateError

Error to raise when the state of the submission is unknown.

ramp_database.testing: functionalities to test database model and tools

The ramp_database.testing module create facility functions to test the tools and model of ramp-database.

testing.add_events(session)

Add events in the database.

testing.add_users(session)

Add dummy users in the database.

testing.add_problems(session)

Add dummy problems into the database.

testing.create_test_db(database_config, …)

Create an empty test database and the setup the files for RAMP.

testing.create_toy_db(database_config, …)

Create a toy dataset with couple of users, problems, events.

testing.setup_toy_db(session)

Only setup the database by adding some data.

testing.setup_ramp_kit_ramp_data(…[, …])

Clone ramp-kit and ramp-data repository and setup it up.

testing.setup_files_extension_type(session)

Setup the files’ extensions and types.

testing.sign_up_teams_to_events(session)

Sign up user to the events in the database.

testing.submit_all_starting_kits(session)

Submit all starting kits.

ramp_database.utils: setup and connect RAMP database

The ramp_database.utils module provides tools to setup and connect to the RAMP database.

utils.check_password(password, hashed_password)

Check if a password is the same than the hashed password.

utils.hash_password(password)

Hash a password.

utils.setup_db(config)

Create a sqlalchemy engine and session to interact with the database.

utils.session_scope(config)

Connect to a database and provide a session to make some operation.

RAMP engine

The RAMP engine is made of a dispatcher to orchestrate the training and evaluation of submissions which are processed using workers. Since there is a dispatcher for each RAMP event, we provide a daemon which will start dispatcher for each open event.

RAMP Dispatcher

daemon.Daemon(config, events_dir)

RAMP daemon starting dispatchers for open challenges.

dispatcher.Dispatcher(config, event_config)

Dispatcher which schedule workers and communicate with the database.

RAMP Workers

base.BaseWorker(config, submission)

Metaclass used to build a RAMP worker.

local.CondaEnvWorker(config, submission)

Local worker which uses conda environment to dispatch submission.

remote.DaskWorker(config, submission)

Dask distributed worker

aws.AWSWorker(config, submission)

Run RAMP submissions on Amazon.

RAMP frontend

The RAMP frontend is the development of the website. It uses extensively Flask.

create_app(config)

Create the RAMP Flask app and register the views.

ramp_frontend.views: views used on the frontend to interact with the user

The ramp_frontend.views defines all operations a user can need to deal with the RAMP backend.

General views

general.index()

Default landing page.

general.ramp()

RAMP description request.

general.teaching()

Page related to RAMP offers for teaching classes.

general.data_science_themes()

Page reviewing problems organized by ML themes.

general.keywords(keyword_name)

Page which give details about a keyword.

Authentication views

Admin views

admin.approve_users()

Approve new user to log-in and sign-up to events.

admin.approve_single_user(user_name)

Approve a single user.

admin.approve_sign_up_for_event(event_name, …)

Approve a user for a specific event.

admin.update_event(event_name)

Update the parameters of an event.

admin.user_interactions()

Show the user interactions recorded on the website.

admin.dashboard_submissions(event_name)

Show information about all submissions for a given event.

Leaderboard views

leaderboard.my_submissions(event_name)

Landing page of all user’s submission information.

leaderboard.leaderboard(event_name)

Landing page showing all user’s submissions information.

leaderboard.competition_leaderboard(event_name)

Landing page for the competition leaderboard for all users.

leaderboard.private_leaderboard(event_name)

Landing page for the private leaderboard.

leaderboard.private_competition_leaderboard(…)

Landing page for the private competition leaderboard.

Submission views

ramp.problems()

Landing page showing all the RAMP problems.

ramp.problem(problem_name)

Landing page for a single RAMP problem.

ramp.user_event(event_name)

Landing page for a given event.

ramp.sign_up_for_event(event_name)

Landing page to sign-up to a specific RAMP event.

ramp.sandbox(event_name)

Landing page for the user’s sandbox.

ramp.ask_for_event(problem_name)

ramp.credit(submission_hash)

The landing page to credit other submission when a user submit is own.

ramp.event_plots(event_name)

Landing page of the plot illustrating the score evolution over time for a specific RAMP event.

ramp.view_model(submission_hash, f_name)

Rendering submission codes using templates/submission.html.

ramp.view_submission_error(submission_hash)

Rendering submission codes using templates/submission.html.

Utilities

redirect.redirect_to_credit(submission_hash, …)

Redirect the page to the credit landing page.

redirect.redirect_to_sandbox(event, message_str)

Redirect the page to the sandbox landing page.

redirect.redirect_to_user(message_str[, …])

Redirect the page to the problem landing page.

visualization.score_plot(session, event)

ramp_frontend.forms: forms used in the website

The ramp_frontend.forms module defines the different forms used on the website.

forms.LoginForm(*args, **kwargs)

Login-in form.

forms.UserUpdateProfileForm(*args, **kwargs)

User profile form.

forms.UserCreateProfileForm(*args, **kwargs)

User profile form.

forms.CodeForm(*args, **kwargs)

Code form.

forms.SubmitForm(*args, **kwargs)

Submission name form.

forms.UploadForm(*args, **kwargs)

Submission uploading form.

forms.EventUpdateProfileForm(*args, **kwargs)

Form to update the parameters of an event.

forms.MultiCheckboxField(*args, **kwargs)

A form containing multiple checkboxes.

forms.ImportForm(*args, **kwargs)

The form allowing to select which model to view.

forms.CreditForm(*args, **kwargs)

Credit form.

forms.AskForEventForm(*args, **kwargs)

Form to ask for a new event.

ramp_frontend.testing: functionalities to test the frontend

The ramp_frontend.testing module contains all functions used to easily test the frontend.

testing.login(client, username, password)

Simulate a log-in from a user.

testing.logout(client)

Simulate a log-out.

testing.login_scope(client, username, password)

Context manager to log-in during the with scope.

ramp_frontend.utils: Utilities to ease sending email

The ramp_frontend.utils provides utilities to ease sending email.

utils.body_formatter_user(user)

Create the body of an email using the user information.

utils.send_mail(to, subject, body)

Send email using Flask Mail.

RAMP utils

The RAMP utils package is made of utilities used for managing configuration, deploying RAMP events, and other utilities shared between the different RAMP packages.

Configuration utilities

generate_flask_config(config)

Generate the configuration to deal with Flask.

generate_ramp_config(event_config[, …])

Generate the configuration to deploy RAMP.

generate_worker_config(event_config[, …])

Generate the configuration for RAMP worker from a configuration file.

read_config(config_file[, filter_section, …])

Read and parse the configuration file for RAMP.

testing.database_config_template()

Return the path a template database configuration file.

testing.ramp_config_template()

Return the path a template RAMP configuration file.

Datasets utilities

datasets.fetch_from_osf(path_data, metadata)

Fetch files from OSF storage.

datasets.OSFRemoteMetaData(filename, id, …)

Deployment utilities

deploy.deploy_ramp_event(config, event_config)

Deploy a RAMP event using a configuration file.

RAMP shared utilities

import_module_from_source(source, name)

Load a module from a Python source file.