The dashboard is the first screen client users see after logging in. It aggregates the most important logistics data for their warehouses into a single view: four KPI cards, interactive Plotly charts, a budget vs. actual spend comparison, and a live activity feed of recent stock movements.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ElthonJohan/Sistema-MRP/llms.txt
Use this file to discover all available pages before exploring further.
What the dashboard shows
The page is divided into five sections rendered in order from top to bottom:- KPI cards — Four summary metrics at a glance.
- Movement trend + stock distribution — A 7-day line chart paired with a donut chart showing stock share per warehouse.
- Stock per warehouse + top materials — A vertical bar chart of absolute stock levels and a horizontal bar chart of the five most-moved materials.
- Budget vs. actual spend — A grouped bar chart comparing budgeted vs. spent amounts per project (only shown when projects with a
budget_soles > 0exist). - Activity feed — A scrollable list of the last 8 movements alongside a full movement table.
KPI cards
Four cards are displayed side by side at the top of the page. Each card reads from theget_kpis() function in services/dashboard_service.py.
| Card | Key | What it counts |
|---|---|---|
| Stock Total | total_stock | Sum of all units across every active inventory record for the client’s warehouses |
| Materiales Críticos | critical | Materials where stock ≤ 5 in the principal warehouse — shown with an amber “Atención” badge when greater than zero |
| Pendientes | pending_req | Requirements with status pending or partial linked to the client’s warehouses |
| Despachos | dispatch_today | Total count of all OUT movement records ever recorded for the client (not just today, despite the internal key name) |
Charts
7-day movement trend
A line chart with filled areas showing Entradas (IN) in green and Salidas (OUT) in amber for each of the last 7 calendar days. Rendered by
get_movements_last_7_days(), which counts movements per day in the range 00:00:00–23:59:59 local time.Stock distribution (donut)
A donut chart showing each warehouse’s share of total stock as a percentage. The center label shows the aggregate unit count. Data comes from
get_stock_by_warehouse(), which sums Inventory.stock grouped by warehouse name.Stock per warehouse (bar)
A vertical bar chart with one bar per warehouse, sorted descending by stock level. Uses the same dataset as the donut chart, rendered alongside it in the row below the trend chart.
Top 5 most-moved materials (horizontal bar)
A horizontal bar chart of the five materials with the highest total movement count (IN + OUT combined). Fetched by
get_top_materials_by_movement(), which groups Movement records by material_id and orders by count descending.Budget vs. actual spend
This section only renders when at least one project exists withbudget_soles > 0. It shows a grouped bar chart with two bars per project:
- Blue bar — the budgeted amount in soles (
budget_soles) - Colored bar — the actual spend calculated from dispatch costs since the project’s
created_atdate
| Color | Meaning |
|---|---|
| Green | Spend is within budget |
| Red | Spend exceeds budget |
| Indigo | Project is marked as finished (is_finished = True) |
Activity feed
The activity feed section is split into two columns:- Left column — The last 8 movements displayed as a vertical feed. Each entry shows a colored dot (green for IN, amber for OUT), the material name, warehouse, quantity change, and timestamp.
- Right column — A full
st.dataframetable of all movements returned byget_recent_movements()(last 10 by default), with row background shading that matches the movement type.
Movement table, ordered by timestamp descending, and filtered to the current client’s warehouse IDs.