Skip to main content

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.

Every piece of data shown on the SteelWorks dashboard — both the Issue Summary table and the Affected Lots table — is scoped by a week and production-line selection. The three filter controls at the top of the page determine which rows are queried, aggregated, and displayed. Adjusting any control immediately re-queries the service and re-renders both tables.

Week selector

selected_week_label = st.selectbox(
    "Week",
    options=list(week_label_to_id.keys()),
    index=0,
)
Options come from service.get_available_weeks(), which reads the calendar_weeks table ordered by start_date. Each option is an ISO week label string in the format YYYY-Www (e.g. 2026-W03). The widget maps each visible label back to an internal calendar_week_id integer before the selection is passed downstream. The first week in chronological order is selected by default (index=0).

Production lines multiselect

selected_line_names = st.multiselect(
    "Production lines",
    options=list(line_name_to_id.keys()),
    default=list(line_name_to_id.keys()),
)
Options come from service.get_available_lines(), which queries only rows where is_active = TRUE, ordered by line_name. All active lines are selected by default — users can deselect individual lines to narrow the scope. As with the week selector, displayed names are resolved to production_line_id integers before being passed to the service.

Group by line checkbox

group_by_line = st.checkbox("Group summary by line", value=True)
When checked (the default), the Issue Summary table adds a line_name column so issue counts are broken down per line. The checkbox value is forwarded directly to service.get_issue_summary() as the group_by_line parameter. It has no effect on the Affected Lots table, which always includes line_name.

IssueFilterSelection

After the widgets render, the three user inputs are consolidated into a single frozen dataclass before being handed to any service method:
@dataclass(frozen=True)
class IssueFilterSelection:
    calendar_week_id: int
    production_line_ids: list[int]
calendar_week_id
int
required
The internal integer primary key for the selected production week, resolved from the week label chosen in the selectbox.
production_line_ids
list[int]
required
A list of production_line_id integers corresponding to the lines chosen in the multiselect. The list is normalized — deduplicated and sorted — inside service.normalize_line_ids() before any repository query is executed, ensuring deterministic SQL parameterization regardless of selection order.

Line ID normalization

Before the production_line_ids list is passed to the repository the service always normalizes it:
def normalize_line_ids(self, line_ids: list[int]) -> list[int]:
    """Normalize line IDs for deterministic query behavior."""
    return sorted(set(line_ids))
This removes any accidental duplicates and ensures the IN :line_ids SQL clause is always built from a stable, sorted list.
If no production lines are selected, both service.get_issue_summary() and service.get_affected_lots() return an empty list immediately — no database query is issued. The tables will display the “no results” info message instead.

Example selection

selection = IssueFilterSelection(
    calendar_week_id=1,
    production_line_ids=[1, 3]
)
This targets week 2026-W03 (calendar_week_id=1) and filters to Line 1 (production_line_id=1) and Line 4 (production_line_id=3).

Build docs developers (and LLMs) love