SteelWorks is a single-page Streamlit dashboard that surfaces weekly manufacturing operations issue metrics stored in PostgreSQL. The page is laid out in a top-to-bottom flow: a title and caption at the top, followed by three filter controls (week selector, production-lines multiselect, and a group-by-line checkbox), then two data tables (Issue Summary and Affected Lots), each paired with a CSV download button. All data is scoped to the week and lines selected — changing a filter immediately re-runs every query and re-renders both tables.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kishnahai0806/SteelWorks/llms.txt
Use this file to discover all available pages before exploring further.
Page configuration
The page is bootstrapped with a wide layout so both tables can expand across the full browser viewport:Data flow
Every render cycle follows these steps in order:Resolve DATABASE_URL
_resolve_database_url() calls load_dotenv() then reads DATABASE_URL from the environment. If the variable is empty the app renders an st.error and returns early.Create and cache the service
_cached_service(database_url) is decorated with @st.cache_resource(show_spinner=False), so the OperationsRepository (SQLAlchemy engine) and OperationsMetricsService are constructed only once per process. Subsequent renders reuse the cached instance. The decorated function delegates to _build_service():Load filter options
service.get_available_weeks() returns calendar weeks ordered by start_date.service.get_available_lines() returns only active lines (is_active = TRUE), ordered by line_name.Results are converted into label-to-ID mappings used by the Streamlit widgets.
Render filter widgets
Three controls are rendered: a
st.selectbox for the production week, a st.multiselect for production lines (all selected by default), and a st.checkbox for grouping the summary by line.Build IssueFilterSelection
User selections are packaged into a frozen
IssueFilterSelection dataclass before being passed to the service layer.Error handling
The app has five guarded error paths, all of which halt rendering early:| Condition | Streamlit call |
|---|---|
DATABASE_URL is missing or empty | st.error("DATABASE_URL is not set. Add it to \.env` before starting the app.”)` |
| Database connection or service init fails | st.error(f"Unable to initialize database connection: {exc}") |
| Loading weeks or lines raises an exception | st.error(f"Unable to load filter values: {exc}") |
| Weeks list is empty after successful load | st.warning("No weeks found in the database.") |
| Lines list is empty after successful load | st.warning("No active production lines found in the database.") |
st.error (hard failures); empty-data conditions use st.warning to signal a data-population issue rather than a system fault.
Explore further
Filters
Week selector, production-lines multiselect, group-by-line checkbox, and how selections are translated into
IssueFilterSelection objects.Issue Summary
Issue counts per type — optionally broken down per production line — with total issue count and per-line toggle.
Affected Lots
Per-lot issue breakdown showing lot code, issue count, and comma-separated issue types for every affected production lot.
CSV Exports
One-click downloads for both tables, always reflecting the current week and line filter selection.