Utils package

Utils.app_args module

The app_args module: Command line args.

Provides functionality to determine what configuration the application has been run with via command line arguments.

Src.Utils.app_args.check_admin_arg()[source]

Checks the command line arguments that the Flask application was run with to determine if the -set-admin argument was passed.

Returns:

Boolean representation of whether the command line arg was found

Return type:

Boolean

Src.Utils.app_args.check_debug_arg()[source]

Checks the command line arguments that the Flask application was run with to determine if the -debug argument was passed.

Returns:

Boolean representation of whether the command line arg was found

Return type:

Boolean

Utils.app_logging module

The Utils.app_logging module: Application logging.

Provides functionality to support logging throughout the application runtime.

Src.Utils.app_logging.log(func)[source]

A logging decorator function, used to log entry and exit of a given function.

Parameters:

func (Function) – The callback function to log against.

Returns:

The return value of the decorated function.

Return type:

Any

Src.Utils.app_logging.prod_logging()[source]

Configures the Flask applications logger to write logs to files found within the applications Log directory.

Utils.bootstrap_admin module

The bootstrap_admin module: Admin user construction.

Provides functionality to create an admin user for the application.

Src.Utils.bootstrap_admin.bootstrap_admin(app, force_bootstrap)[source]

The admin user setup function, used to gain user input of the desired admin credentials of the applications admin user.

Parameters:
  • app (Flask application) – The Flask application to provide context

  • force_bootstrap (Boolean) – A Boolean flag used to force new admin creation

Utils.constants module

The constants module: Application constants.

Provides global constants to be used throughout the application.

Utils.http module

The http module: HTTP request utilities.

Provides functionality to process the received responses from HTTP requests sent by the application in order to integrate with the NCTS Server.

Src.Utils.http.response_to_csv(http_response, file_name)[source]

Retrieves and downloads the given CSV file from a HTTP request response

Parameters:
  • http_response (Response) – The response object to retrieve the CSV file from

  • file_name (str) – The file name to save the CSV file as

Src.Utils.http.xml_response_to_version(http_response)[source]

Converts the NCTS API available distribution response in to a easily passable dictionary consisting of only the available AMT distributions.

Parameters:

http_response (Response) – The response object to retrieve the CSV file from

Returns:

A dictionary representation of all available AMT distribution

Return type:

dict

Utils.lib module

The lib module: Random Utility functions.

Src.Utils.lib.delete_csv_dist_collection()[source]
Src.Utils.lib.is_outdated_versions(current_version_date, latest_version_date)[source]

Checks if the current AMT distribution date matches the latest available AMT distribution date.

Parameters:
  • current_version_date (Date) – The date of the applications current AMT distribution version

  • latest_version_date (Date) – The date of the NCTS API latest AMT distribution version

Returns:

Boolean representation of whether the applications current version date is not the latest NCTS version

Return type:

Boolean

Src.Utils.lib.retrieve_export_csv()[source]

Builds a pandas dataframe, which represents a merged and formatted implementation of the applications current Amt and Snomed SQLite tables.

Returns:

The dataframe consisting of both the Amt and Snomed SQLite tables

Return type:

Dataframe

Src.Utils.lib.setup_data_dir()[source]

Creates the applications Data directory, to store the AMT distribution CSV files.

Utils.startup_tasks module

The startup_tasks module: Application startup tasks.

Provides the application with tasks intended to be run on application startup.

Src.Utils.startup_tasks.import_snomed_csv(app)[source]

Imports the applications SNOMED CSV file found within the Data directory, on in order for the application to populate it’s Snomed table.

Parameters:

app (Flask Application) – The Flask application to provide context