onehealth_db.production module⚓︎
onehealth_db.production
⚓︎
Functions:
-
create_directories
–Create directories if they do not exist.
-
get_engine
– -
get_production_data
–Fetch data that is fed into the production database.
-
get_var_types_from_config
–Get the variable types from the configuration file and
-
insert_data
– -
insert_var_values
– -
main
–Main function to set up the production database and data lake.
-
read_production_config
–Read configuration of the production database.
create_directories
⚓︎
Create directories if they do not exist.
Parameters:
-
dir
(str
) –String of the directory to create/use.
get_production_data
⚓︎
Fetch data that is fed into the production database.
url (str): URL to fetch the data from. filename (str): Name of the file to be fetched. filehash (str): SHA256SUM hash of the file to verify integrity. outputdir (Path): Directory where the file will be saved. Returns: completion_code (int): Status code indicating the success or failure of the operation.
get_var_types_from_config
⚓︎
Get the variable types from the configuration file and place them in a dictionary.
main
⚓︎
Main function to set up the production database and data lake. This function reads the production configuration, creates the necessary directories, and fetches the data from the configured sources. It is intended to be run as a script.
read_production_config
⚓︎
Read configuration of the production database.
Parameters:
-
dict_path
(str | Traversable
, default:None
) –Path to the configuration dictionary. Defaults to None, which uses the default path.
Returns: dict: Dict with configuration details for the production database.