This repository contains the Python Flask application supporting the Usint Website.
For information related to the web server backend, support, and development of this application, consult the Flask/Usint folder in the MTA shared drive.
This is the server process startup command, running under Syshelp control, using the usint.py entrypoint. https://flask.palletsprojects.com/en/stable/deploying/gunicorn/#running
gunicorn -c <server_config_name>.conf.py usint:application
The gunicorn server configuration file handles settings to allow the cxc web servers to send requests to the application server. Flask application specific settings, such as database connections and email settings, exists as flask config files, and thus within MTA file ownership.
Syshelp uses a separate setup for processing logs which relate to their Apache web server operations. For Flask Usint on the Gunicorn sever,
this differs to provided more direct access to compartmentalized logs for each application installation.
Starting at the root folder of the application, /proj/web-cxc/wsgi-scripts/cus for example, there is an instance/logs directory which contains three types of logs
- access: This contains a log of the HTTP requests made to the server. Here you can see what URL's are requested by which user and other HTTP request header information
- error: This contains runtime errors for both the gunicorn server running the flask application, and runtime errors within the flask application.
- operation: This is a log for noromal operational messages, such as a revision being submitted, or a signoff being performed.
The top level of this project is the application root, containing the server entrypoint modules, base configuration settings, the instance directory containing file relevant to this application installation's specific runtime, and the cus_app package containing our source code.
-
usint.py
Python module entrypoint for the Gunicorn server which determine application creation and configuration. By acting as an entrypoint, MTA can perform file edits to the application configuration and creation without necessarily requiring a gunicorn server restart. Conceptually, the application could still run if gunicorn called the cus_app package create_app() function directly. -
baseconfig.py
Configuration file. -
instance/
Instance folder for storing application-specific files such as logs and theusint.dbdatabase.logs/
Containsocat.logfiles for logging application runtime information. Used by web server processes.
-
cus_app/
Main Flask application folder containing relevant page generation scripts:__init__.py— Application instantiation scriptemailing.py— Email-related functions for notificationsmodels.py— SQLAlchemy ORM models for interfacing with the Usint Revision databaseextensions.py- Module for instantiating the Flask Extension class instances.
chkupdata/— Parameter check page scriptserrors/— Error handler scriptsexpress/— Express sign-off page scriptsocatdatapage/— Ocat data page scriptsorupdate/— Parameter status page scriptsscheduler/— TOO duty scheduler page scriptssupple/— Supplemental Python scripts
color.json— Maps color names to RGB valueslabels.json— Maps Ocat parameters to visual labelsparameter_selections.json— Parameter group mappings used across the applicationusint.js— jQuery library for the Ocat data pageocat_style.css— CSS stylesocatdatapage/— Static files for the Ocat data pageorupdate/— Static files for the parameter status pagescheduler/— Static files for the scheduler page
base.html- Base template block for general web pages.app_base.html— Base template for application pages (mainly CSS differences)index.html— Main index page- Additional page-specific templates (see sections below)
Displays original, requested, and current parameter values for a given <obsid>.<rev>.
routes.py— Main logicforms.py— WTForms definitions__init__.py— Module setup
index.html— Main pageprovide_obsidrev.html— Shown when<obsid>.<rev>is not foundmacros.html— Template macros
Application error handling.
handlers.py— Main error handling logic__init__.py— Module setup
404.html— Not found page500.html— Server error page
Express sign-off / approval workflow.
routes.py— Main logicforms.py— WTForms definitions__init__.py— Module setup
index.html— Main pageconfirm.html— Confirmation pagemacros.html— Template macros
Ocat data page used for updating parameter values.
routes.py— Main logicforms.py— WTForms definitionsformat_ocat_data.py— Data formatting utilities__init__.py— Module setup
<obs_ss>/mp_long_term— Planned roll angle from MP site<obs_ss>/scheduled_obs_list— Scheduled observations
index.html— Main update pagemacros.html— Template macrosconfirm.html— Update confirmation pagefinalize.html— Job completion pageprovide_obsid.html— Shown when<obsid>is not found
Target parameter status page.
routes.py— Main logicforms.py— WTForms definitions__init__.py— Module setup
index.html— Main pagemacros.html— Template macros
Note:
This page refreshes every 3 minutes to display the latest data. This ensures consistency when multiple users are updating the database simultaneously.
Remove accidental submissions.
routes.py— Main logicforms.py— WTForms definitions__init__.py— Module setup
index.html— Main pagemacros.html— Template macros
POC duty sign-up sheet.
routes.py— Main logicforms.py— WTForms definitions__init__.py— Module setup
index.html— Main pagemacros.html— Template macros
Supplemental scripts used across the application.
database_interface.py— SQLAlchemy interface for the Usint Revision SQLite databasehelper_functions.py— General helper utilitiesread_ocat_data.py— Fetches and formats Ocat Sybase data via theska_dbi SQSHinterface
- CXC Ocat Sybase database (via
read_ocat_data.py) - Usint Revision SQLite database (via
database_interface.py)