Skip to main content

Output Directory Structure

The system generates all outputs in the output/ directory:
output/
├── reporte_inventario.xlsx
└── graficos/
    ├── estado_inventario.png
    └── clasificacion_abc.png
The output/ directory and graficos/ subdirectory are created automatically if they don’t exist (see src/reportes_graficos.py:7).

Excel Report Structure

The main report file output/reporte_inventario.xlsx contains multiple sheets with different views of the inventory data.

Sheet 1: Inventario_Completo

Contains the complete inventory with all analysis columns:
ColumnDescriptionSource
Original DataProduct info, stock levels, salesInput file
porcentaje_acumuladoCumulative percentage for ABC classificationsrc/analisis.py:17
categoria_abcABC category (A, B, or C)src/analisis.py:28
estado_stockStock status (OK, RIESGO, CRITICO)src/decisiones.py:19
reponer_cantidadRecommended replenishment quantitysrc/decisiones.py:27
This sheet provides a comprehensive view of the entire inventory with all calculated metrics.

Sheet 2: Productos_Criticos

Filtered view showing only products in CRITICO status (stock at or below minimum). Filter Logic (src/reportes.py:11-12):
criticos = df[df["estado_stock"] == "CRITICO"]
criticos.to_excel(writer, sheet_name="Productos_Criticos", index=False)
Products in this sheet require immediate attention and replenishment to avoid stockouts.

Sheet 3: Productos_En_Riesgo

Filtered view showing only products in RIESGO status (stock slightly above minimum but approaching critical levels). Filter Logic (src/reportes.py:14-15):
riesgo = df[df["estado_stock"] == "RIESGO"]
riesgo.to_excel(writer, sheet_name="Productos_En_Riesgo", index=False)
Products in this sheet should be monitored closely and replenished soon to prevent reaching critical levels.

Excel Formatting

The Excel report includes automatic formatting (from src/reportes.py:17-30):
1

Column Width Adjustment

Columns are automatically sized based on content length:
max_length = max(max_length, len(str(cell.value)))
ws.column_dimensions[column].width = max_length + 2
2

Cell Alignment

All cells are centered horizontally and vertically:
cell.alignment = Alignment(horizontal="center", vertical="center")

Stock Status Classification

Understanding the estado_stock values (from src/decisiones.py:11-17):

CRITICO Status

Condition: stock_actual <= stock_minimo
if row["stock_actual"] <= row["stock_minimo"]:
    return "CRITICO"
  • Stock is at or below minimum threshold
  • Action Required: Immediate replenishment needed
  • Risk: High risk of stockout

RIESGO Status

Condition: stock_actual <= stock_minimo * 1.2
elif row["stock_actual"] <= row["stock_minimo"] * 1.2:
    return "RIESGO"
  • Stock is within 20% above minimum threshold
  • Action Required: Plan replenishment soon
  • Risk: Moderate risk, approaching critical level

OK Status

Condition: stock_actual > stock_minimo * 1.2
else:
    return "OK"
  • Stock is sufficiently above minimum threshold
  • Action Required: Monitor normally
  • Risk: Low risk, adequate inventory

ABC Classification

Products are classified using the Pareto principle (from src/analisis.py:4-31):

Category A

Criteria: Top products contributing to 70% of total sales
if p <= 0.7:
    return "A"
  • Priority: High
  • Management: Tight inventory control, frequent review
  • Typical Percentage: ~20% of products, 70% of sales value

Category B

Criteria: Products contributing to next 20% of sales (70-90% cumulative)
elif p <= 0.9:
    return "B"
  • Priority: Medium
  • Management: Moderate control, periodic review
  • Typical Percentage: ~30% of products, 20% of sales value

Category C

Criteria: Remaining products (90-100% cumulative sales)
else:
    return "C"
  • Priority: Low
  • Management: Basic control, occasional review
  • Typical Percentage: ~50% of products, 10% of sales value
Focus your attention on Category A products as they represent the majority of your sales value.

Replenishment Recommendations

The reponer_cantidad column suggests how much to reorder (from src/decisiones.py:22-27):
def recomendar_reposicion(row):
    if row["estado_stock"] in ["CRITICO", "RIESGO"]:
        return max(row["ventas_mensuales"] - row["stock_actual"], 0)
    return 0
Logic:
  • Only calculated for CRITICO and RIESGO products
  • Recommendation = Monthly Sales - Current Stock
  • Minimum recommendation is 0 (never negative)
  • OK products show 0 (no replenishment needed)
The recommendation aims to bring stock up to at least one month’s worth of sales.

Generated Charts

Chart 1: estado_inventario.png

Type: Bar Chart Location: output/graficos/estado_inventario.png Generated by: src/reportes_graficos.py:9-19
estado_counts = df["estado_stock"].value_counts()

plt.figure()
estado_counts.plot(kind="bar")
plt.title("Estado del Inventario")
plt.xlabel("Estado")
plt.ylabel("Cantidad de Productos")
plt.tight_layout()
plt.savefig(os.path.join(carpeta_salida, "estado_inventario.png"))
Displays:
  • Number of products in each status (OK, RIESGO, CRITICO)
  • Quick visual assessment of overall inventory health
A healthy inventory should have most products in “OK” status with minimal CRITICO items.

Chart 2: clasificacion_abc.png

Type: Pie Chart Location: output/graficos/clasificacion_abc.png Generated by: src/reportes_graficos.py:21-30
abc_counts = df["categoria_abc"].value_counts()

plt.figure()
abc_counts.plot(kind="pie", autopct="%1.1f%%")
plt.title("Clasificación ABC del Inventario")
plt.ylabel("")
plt.tight_layout()
plt.savefig(os.path.join(carpeta_salida, "clasificacion_abc.png"))
Displays:
  • Distribution of products across A, B, and C categories
  • Percentage breakdown of each category
The pie chart shows product count distribution, not sales value distribution.

Interpreting Results

Indication: Inventory management issues or supply chain problemsActions:
  • Review the Productos_Criticos sheet
  • Prioritize replenishment for Category A products first
  • Check reponer_cantidad for recommended order quantities
  • Investigate if minimum stock levels are set too low
Indication: Products approaching critical levelsActions:
  • Review the Productos_En_Riesgo sheet
  • Plan replenishment orders proactively
  • Monitor Category A and B products more closely
  • Adjust reorder points if this happens frequently
Indication: Normal ABC distributionActions:
  • Consider reducing inventory of slow-moving C items
  • Evaluate if Category C products are still needed
  • Focus management attention on A and B categories
Indication: Stock levels are adequateActions:
  • No immediate action needed
  • Continue normal monitoring
  • Product should show “OK” status

Using the Reports for Decision Making

1

Review Critical Products

Open the Productos_Criticos sheet and focus on Category A products first
2

Check Replenishment Quantities

Review the reponer_cantidad column to determine order sizes
3

Analyze Trends

Compare current report with previous reports to identify patterns
4

Adjust Inventory Policies

Use ABC classification to optimize inventory management strategies
5

Monitor Visual Indicators

Check the charts for quick health assessment of overall inventory

Report Frequency Recommendations

Inventory TypeRecommended Frequency
High-velocity productsDaily
Standard inventoryWeekly
Slow-moving inventoryMonthly
Seasonal productsAs needed before season

Next Steps

Configuration

Learn how to configure file paths and system settings

Email Setup

Set up automatic email delivery of reports

Build docs developers (and LLMs) love