all_to_db module
- all_to_db.auto_insert_netstore_to_database()[source]
Automatically inserts Netstore file data into the database.
This function retrieves a list of files from a specified folder, organizes them by project, and inserts the project and file data into the specified database tables.
Returns: None
- all_to_db.auto_insert_omero_to_database()[source]
Automatically inserts OMERO data into the database.
This function connects to the OMERO server, retrieves projects, datasets, and images, and inserts them along with their tags into the specified database tables.
Returns: None
- all_to_db.convert_omero_timestamp(timestamp)[source]
Converts an OMERO timestamp to a standard datetime format.
- Args:
timestamp (str): The OMERO timestamp in the format “%Y-%m-%dT%H:%M:%S”.
- Returns:
str: The converted timestamp in the format “%Y-%m-%d %H:%M:%S”.
- all_to_db.convert_rspace_timestamp(timestamp)[source]
Converts an RSpace timestamp to a standard datetime format.
Parameters: timestamp (str): The RSpace timestamp in the format “%Y-%m-%dT%H:%M:%S.%fZ”.
Returns: str: The converted timestamp in the format “%Y-%m-%d %H:%M:%S”.
- all_to_db.get_current_username()[source]
Retrieves the current username.
- Returns:
str: The current username.
- all_to_db.get_file_stats(file_path)[source]
Retrieves statistics for a given file.
- Args:
file_path (str): The path to the file.
- Returns:
dict: A dictionary containing the file statistics.
- all_to_db.get_netstore_filelist(folder)[source]
Retrieves a list of files from a specified folder and organizes them by project.
- Args:
folder (str): The path to the folder containing the files.
- Returns:
tuple: A tuple containing the list of project names and a dictionary of file lists organized by project.
- all_to_db.get_rspace_workspace_folders(sampleParameter, elnName='rspace')[source]
Fetches RSpace workspace folders using the API.
- Args:
sampleParameter (str): A sample parameter for the API request. elnName (str): The name of the ELN (default is ‘rspace’).
- Returns:
dict: The JSON response containing the workspace folders.
- all_to_db.insert_egroupware(verbose=0)[source]
Fetches project data from eGroupWare and inserts it into a local database.
Parameters: verbose (int): If set to 1, prints the project registration and schedule data.
Returns: None
- all_to_db.insert_rspace_to_db()[source]
Fetches sample data from RSpace and inserts it into a local database.
Parameters: None
Returns: None
- all_to_db.process_rspace_documents(documents, db_name, table_name)[source]
Process RSpace documents and insert them into the database.
- Args:
documents (dict): A dictionary containing the RSpace documents. db_name (str): The name of the database. table_name (str): The name of the table to insert the documents into.
- all_to_db.process_rspace_folder(folder, db_name, table_name)[source]
Process RSpace folders and insert them into the database.
- Args:
folders (dict): A dictionary containing the RSpace documents. db_name (str): The name of the database. table_name (str): The name of the table to insert the documents into.
- all_to_db.process_tags(db_name, table_name, doc, object_document)[source]
Process the tags of an RSpace document and insert them into the database.
- Args:
db_name (str): The name of the database. table_name (str): The name of the table to insert the tags into. doc (dict): The RSpace document. object_document (dict): The object document corresponding to the RSpace document.