Three branches exist:
production: Production branch, hosting the live app (https://instituteforgovernment.streamlit.app/)staging: Staging branch, hosting the pre-production version of the app (https://instituteforgovernment-stage.streamlit.app/: NB: Note URL pattern, asstagingcan't be used in Streamlit Community Cloud app URLs)development: Development branch, hosting the latest development version of the app
The app uses Microsoft Entra authentication, following Streamlit's guide to implementing this.
A separate set of secrets exists for each of these environments:
- Production environment on Streamlit Community Cloud
- Staging environment on Streamlit Community Cloud
- Local development
This is because the redirect_uri differs for each of these environments, and different secrets are needed for each redirect_uri.
The identity app registration that has been created has an expiry date: 3 April 2027.
Hosted on Streamlit Community Cloud at https://instituteforgovernment.streamlit.app/.
Environment variables and authentication secrets are held as app secrets.
- Add environment variables as system environment variables
- Add a
secrets.tomlfile in a.streamlitdirectory containing authentication details - Create a new virtual environment using
python -m venv env - Activate the virtual environment using
env\Scripts\activate - Run
pip install -r requirements.txtto install packages - Run
pre-commit installto installpre-commit - Run
streamlit run streamlit_app.py
βββ .streamlit/
β βββ config.toml
β
βββ docs/
β βββ design_notes.md
β
βββ ifg_data_app/
| βββ config/ <<< Variables used app-wide
| β βββ ag_grid_theme.py
| β βββ colours.py
| β
| βββ js/ <<< JS functions used app-wide
| β βββ <function name>.js
| β
| βββ pages/
| β βββ dashboard/
| β βββ web_metrics/
| β βββ md/ <<< Markdown text to be rendered in pages
| β βββ roadmap/
| β βββ doing.md
| β βββ done.md
| β βββ future.md
| β βββ <page name>.md
| β βββ <page name>.py
| β βββ chart_annotations.py <<< Chart annotations used across multiple pages
| β βββ config.py <<< Variables used across multiple pages
| β βββ definitions.py <<< Definitions to be rendered in the UI
| β βββ elements.py <<< Page elements used across multiple pages
| β βββ notes.py <<< Notes to be rendered in the UI
| β βββ utils.py <<< (Non-page element) functions and code snippets used across multiple pages
| β
| βββ sql/
| β βββ dashboard/
| β βββ web_metrics/
| β βββ <page name>.sql
β
βββ .gitignore
βββ .pre-commit-config.yaml
βββ README.md
βββ streamlit_app.py
βββ requirements.txt
Documentation of key design decisions can be found in design_notes.md.
The following environment variables are used by the app:
ODBC_DRIVER: ODBC driver name to be used in database connectionODBC_SERVER: Server name to be used in database connectionODBC_DATABASE: Database name to be used in database connectionODBC_AUTHENTICATION: Authentication type to be used in database connectionAZURE_CLIENT_ID: Username to be used in database connectionAZURE_CLIENT_SECRET: Password to be used in database connectionDS_CONTACT_EMAIL_ADDRESS: Email address to be used for contacting the data science teamIFG_WEB_ISSUES_FILE_LINK: Link to document where web issues are logged
Command line arguments can be passed to the Streamlit app using the following syntax:
streamlit run streamlit_app.py -- --redact-dataNB: Note the use of -- before the addition of these command line arguments. This is required to differentiate them from Streamlit command-line arguments.
| Argument | Description | Default |
|---|---|---|
--redact-data |
Enable redact data mode. This replaces table values, chart axis labels and chart tooltip values with a xxxxx string |
false |
An AG Grid licence is held in order to make use of all streamlit-aggrid features. The license is perpetual - i.e. no need for renewal.