TheDocumentation 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.
issue_occurrences view is the single authoritative source for every issue-related metric in the SteelWorks dashboard. It denormalizes the three-way join between production_issues, production_runs, and issue_types so that reporting queries never need to re-state that join. All issue count summaries, affected-lot lists, and CSV exports should be built on top of this view. Never query production_issues directly for metrics — the view exists precisely to prevent inconsistent join logic spreading across multiple queries.
View DDL
Columns
Primary key of the underlying
production_issues row. Use this for row-level identification when drilling into a specific issue record.Foreign key value from
production_issues.issue_type_id. Useful for filtering or grouping by type ID when joining to other tables that reference issue_types.Human-readable issue classification (e.g.,
tool_wear, material_shortage), sourced from issue_types.issue_type_name. Use this column for display labels and GROUP BY in summary queries.Primary key of the related
production_runs row. Use this to join back to production_runs when you need columns not exposed by the view (e.g., units_actual, downtime_minutes).Calendar date of the production run on which the issue was recorded, sourced from
production_runs.run_date.ISO calendar week identifier of the production run, sourced from
production_runs.calendar_week_id. The primary filter parameter for weekly issue reports — use this to scope queries to a selected week.Production line on which the issue occurred, sourced from
production_runs.production_line_id. The secondary filter parameter for per-line issue breakdowns.Lot being processed when the issue was recorded, sourced from
production_runs.lot_id. Join to the lots table to surface the lot_code for display.Optional free-text notes from the shift supervisor, sourced from
production_issues.supervisor_notes. May be NULL when no notes were entered.Using the view
Issue totals for a selected week and selected lines (Query 12)
This query powers the issue summary panel. Substitute:week_id and :line_ids with the dashboard’s active filter values. In psql, set variables with \set week_id 1 and \set line_ids '{1,2}'.
Affected lots for a selected week and selected lines (Query 13)
Returns each lot that had at least one issue in the selected scope, along with a count and a comma-separated list of distinct issue type names. Use this for the affected-lots drill-down panel.Dashboard usage note
The dashboard’s
OperationsRepository does not query issue_occurrences directly at runtime — it performs equivalent joins inline in its SQL. The view is provided for ad-hoc reporting, psql-based investigation, and data export workflows. Any change to the three underlying tables (production_issues, production_runs, issue_types) is automatically reflected in the view without code changes.