feat: add locale formatting config and update notebook outputs
Add configurable locale/display formatting environment variables (`PALLADIUM_CURRENCY_SYMBOL`, `PALLADIUM_THOUSANDS_SEP`, `PALLADIUM_DECIMAL_SEP`) to support regional number formatting in the Streamlit app. Update `.env.example` with documentation for these new variables. Also refresh `00_setup.ipynb` with current execution outputs reflecting a live Athena connection with report templates, a selected client (Global Guardian Insurance, ID=2), and resolved NameError in assumption override cells.
This commit is contained in:
45
app/utils.py
Normal file
45
app/utils.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""
|
||||
Shared UI utilities for the Palladium Streamlit app.
|
||||
|
||||
Kept in a separate module so that ``app.main`` and ``app.views.*`` can both
|
||||
import from here without creating a circular dependency.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import streamlit as st
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Bootstrap Icons — injected once at the top of every page render.
|
||||
# Using the CDN stylesheet so no npm/build step is needed.
|
||||
# ---------------------------------------------------------------------------
|
||||
_BI_CSS = """
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
|
||||
/>
|
||||
<style>
|
||||
/* Tighten up the default Streamlit header spacing */
|
||||
.block-container { padding-top: 1.5rem; }
|
||||
/* Make BI icons align nicely with surrounding text */
|
||||
.bi { vertical-align: -0.125em; }
|
||||
</style>
|
||||
"""
|
||||
|
||||
|
||||
def inject_icons() -> None:
|
||||
"""Inject Bootstrap Icons CSS (idempotent — Streamlit deduplicates identical HTML)."""
|
||||
st.markdown(_BI_CSS, unsafe_allow_html=True)
|
||||
|
||||
|
||||
def icon(name: str, *, cls: str = "") -> str:
|
||||
"""Return an inline Bootstrap Icon ``<i>`` tag.
|
||||
|
||||
Usage::
|
||||
|
||||
st.markdown(icon("bar-chart") + " Financial Summary", unsafe_allow_html=True)
|
||||
|
||||
See the full icon catalogue at https://icons.getbootstrap.com/
|
||||
"""
|
||||
extra = f" {cls}" if cls else ""
|
||||
return f'<i class="bi bi-{name}{extra}"></i>'
|
||||
Reference in New Issue
Block a user