projects

Module Contents

Functions

add_project(conn: db.mongodb.AsyncIOMotorClient, project: models.iemap.Project)

list_projects(conn: db.mongodb.AsyncIOMotorClient, limit, skip)

Function to list all projects in DB

list_project_properties_files(conn: db.mongodb.AsyncIOMotorClient, affiliation: str, useremail: str)

Function returns page_size number of documents after last_id

add_property_file(conn: db.mongodb.AsyncIOMotorClient, id: str, fileHash: str, strFileSize: str, strFileExt: str, elementName: str, elementType: str)

Function to add file hash to a property file.

add_project_file(conn: db.mongodb.AsyncIOMotorClient, id: str, fileHash: str, fileSize: str, fileExt: str, fileName: str)

# Function to add file to PROJECT

find_project_file_by_hash(conn: db.mongodb.AsyncIOMotorClient, file_hash: str, id: str)

Function to check if file hash already exists in the database.

count_projects(conn: db.mongodb.AsyncIOMotorClient) → int

add_project_file_and_data(conn: db.mongodb.AsyncIOMotorClient, id: str, file_data: models.iemap.FileProject)

Function to add file hash to PROJECT

add_property(conn: db.mongodb.AsyncIOMotorClient, id: str, property: models.iemap.Property)

Function to add file hash to a property file.

generate_pagination_query(query, sort=None, next_key=None)

find_all_project_paginated(conn: db.mongodb.AsyncIOMotorClient, query={}, limit=10, sort=['_id', -1], next_key=None)

async projects.add_project(conn: db.mongodb.AsyncIOMotorClient, project: models.iemap.Project)
async projects.list_projects(conn: db.mongodb.AsyncIOMotorClient, limit, skip)

Function to list all projects in DB

Parameters
  • conn (AsyncIOMotorClient) – Motor MongoDB client connection

  • limit (int) – number of documents to return

  • skip (int) – number of documents to skip

Returns

list of documents as result of the query (find({}))

Return type

List[Any]

async projects.list_project_properties_files(conn: db.mongodb.AsyncIOMotorClient, affiliation: str, useremail: str)

Function returns page_size number of documents after last_id and the new last_id.

async projects.add_property_file(conn: db.mongodb.AsyncIOMotorClient, id: str, fileHash: str, strFileSize: str, strFileExt: str, elementName: str, elementType: str)

Function to add file hash to a property file. The document to update is identified by the document’s id, and the property file’s name.

async projects.add_project_file(conn: db.mongodb.AsyncIOMotorClient, id: str, fileHash: str, fileSize: str, fileExt: str, fileName: str)

# Function to add file to PROJECT (using filne name hash and original extention) The document to update is identified by the mdocuent’s id, and file’s name and extention.

conn: AsyncIOMotorClient - Motor MongoDB client connection id: str - MongoDB document’s id (ObjectId) to update fileHash: str - file hash fileSize: str - file size fileExt: str - file extention fileName: str - file name

modified_count, matched_cound: (int,int) - number of modified documents, number of matched documents

async projects.find_project_file_by_hash(conn: db.mongodb.AsyncIOMotorClient, file_hash: str, id: str)

Function to check if file hash already exists in the database.

async projects.count_projects(conn: db.mongodb.AsyncIOMotorClient) int
async projects.add_project_file_and_data(conn: db.mongodb.AsyncIOMotorClient, id: str, file_data: models.iemap.FileProject)

Function to add file hash to PROJECT The document to update is identified by the document’s id, and file’s name and extention.

async projects.add_property(conn: db.mongodb.AsyncIOMotorClient, id: str, property: models.iemap.Property)

Function to add file hash to a property file. The document to update is identified by the document’s id, and the property file’s name.

projects.generate_pagination_query(query, sort=None, next_key=None)
async projects.find_all_project_paginated(conn: db.mongodb.AsyncIOMotorClient, query={}, limit=10, sort=['_id', - 1], next_key=None)