def get_evaluation_collection(project): """Connects to the specified project and returns a pointer to the evaluations collection. """ connection = mongo_utils.mongo_get_connection(project) collection = mongo_utils.mongo_get_collection(connection, 'evaluations') return collection
def get_template_collection(database): """Connects to the database and returns a pointer to the templates collection. """ connection = mongo_utils.mongo_get_connection(database) collection = mongo_utils.mongo_get_collection(connection, "mars_templates") return collection
def get_project_collection(database="project"): """Connects to the project admin database (defaults to project) and returns a pointer to the project collection. """ connection = mongo_utils.mongo_get_connection(database) collection = mongo_utils.mongo_get_collection(connection, "project") return collection
def get_workflow_collection(project): """Connects to the specified project and returns a pointer to the workflows collection. """ connection = mongo_utils.mongo_get_connection(project) collection = mongo_utils.mongo_get_collection(connection, 'workflows') return collection
def get_language_collection(project): """Connects to the specified project and returns a pointer to the functions collection. """ connection = mongo_utils.mongo_get_connection(project) collection = mongo_utils.mongo_get_collection(connection, 'language') return collection
def get_record_collection(database, collection): """Connects to the database and returns a pointer to the record collection. """ connection = mongo_utils.mongo_get_connection(database) collection = mongo_utils.mongo_get_collection(connection, collection) return collection
def get_component_collection(database): """Connects to the specified database and returns a pointer to the components collection. """ connection = mongo_utils.mongo_get_connection(database) collection = mongo_utils.mongo_get_collection(connection, 'components') return collection
def validate_project_database(database_name): """Creates a new database to hold data (components, evaluations, comparisons, parameters, etc) relating to a specified project. If the method succeeds, returns the name of the newly created database. Otherwise, returns false. """ connection = mongo_utils.mongo_get_connection(database_name) if connection: collections = connection.collection_names() if not collections: return database_name return False
def get_group_collection(database): """Connects to the project database and returns a pointer to the group collection. """ connection = mongo_utils.mongo_get_connection(database) collection = mongo_utils.mongo_get_collection(connection, "mars_groups") return collection