Applied AI Engineer Technical Assessment
Author: Alessandro Alati
Date: November 2025
This project analyzes 10 days of warehouse scan data to extract actionable intelligence about inventory accuracy, error patterns, and operational issues. It includes a complete data pipeline, exploratory analysis, anomaly detection, and a containerized REST API.
- Ingests 10 days of warehouse scan data (350K+ records)
- Merges with warehouse layout (33K+ locations)
- Outputs clean Parquet dataset with spatial features
- Includes comprehensive unit tests
- WHAT: Daily accuracy trends and error type breakdown
- WHERE: Spatial hotspots (shelf levels, aisles, height correlations)
- WHEN: Velocity analysis (fast-moving locations)
- Generates 8 publication-quality visualizations
- Statistical validation (chi-square tests, correlations)
- Composite risk scoring model (error severity + operational impact)
- Identifies Top 20 most problematic locations
- Transparent, explainable scoring system
- Output: Ranked CSV with actionable metrics
- FastAPI application with 4 endpoints
- Docker containerization with docker-compose
- Interactive Swagger documentation
- Health checks and error handling
- Random Forest classifier (zero-to-one model)
- Predicts high/low error risk from static features only
- Works on new warehouses with no scan history
- 65% accuracy (30% above baseline)
dexory-technical-task/
βββ core_scripts/ # Main analysis scripts
β βββ data_pipeline.py # Data ingestion and cleaning
β βββ eda.py # Exploratory data analysis
β βββ anomaly_detection.py # Top 20 problematic locations
β βββ error_prediction.py # ML model for error prediction
β βββ test_pipeline.py # Unit tests
β
βββ API/
β βββ warehouse-api/ # FastAPI application
β βββ app/main.py # API endpoints
β βββ Dockerfile # Container definition
β βββ docker-compose.yml # Docker orchestration
β βββ requirements.txt # API dependencies
β
βββ data_models/
β βββ technical-task-data/ # Raw input data (10 days)
β βββ output/ # Processed data & models
β βββ warehouse_data.parquet
β βββ top_20_problematic.csv
β βββ error_predictor.pkl
β βββ eda_plots/ # Analysis visualizations
β
βββ README.md # This file
- Python 3.11+
- Docker Desktop (for API)
pip install -r requirements.txt# Step 1: Process data (Point 1)
cd core_scripts
python data_pipeline.py
# Step 2: Run EDA (Point 2)
python eda.py
# Step 3: Detect anomalies (Point 3)
python anomaly_detection.py
# Step 4: Train prediction model (Point 5)
python error_prediction.py# Navigate to API folder
cd ../API/warehouse-api
# Run with Docker
docker-compose up --build
# Access API at:
# http://localhost:8000/docs- Mean Accuracy: 75.07%
- Range: 3.09% - 99.30%
- Most Common Error: Unknown item found (3.83%)
- Ground shelves: 6.24% error rate (highest)
- High shelves: 1.37% error rate (lowest)
- Most problematic aisle: AZ 1 (10.64% error rate)
- Significant correlation: Shelf level affects error rate (p < 0.001)
- High-velocity locations: ~650 (2% of total)
- Static locations: 25,234 (75% of total)
- Finding: High-velocity locations have significantly more errors
- Top 20 problematic locations identified
- Scoring factors: Error rate (40%), Operational impact (30%), Error severity (20%), Spatial context (10%)
- Highest risk score: 0.52 (Location with 18.5% error rate + high velocity)
- Algorithm: Random Forest (balanced class weights)
- Accuracy: 65% (vs 50% baseline)
- High Error Recall: 73% (catches 73% of problematic locations)
- Key features: Shelf height, position, aisle location
The API serves analysis results and predictions:
| Endpoint | Description |
|---|---|
GET /health |
System health check |
GET /warehouse/anomalies |
Top 20 problematic locations |
GET /warehouse/stats |
Daily accuracy trends & error breakdown |
GET /location/{name} |
Detailed location analysis + prediction |
Interactive docs: http://localhost:8000/docs
See API/warehouse-api/README.md for detailed API documentation.
Run unit tests:
cd core_scripts
pytest test_pipeline.py -vTest coverage includes:
- Data loading and validation
- Merge operations (no data loss)
- Feature extraction
- Edge case handling
The EDA generates 8 visualizations in data_models/output/eda_plots/:
daily_accuracy.png- Accuracy trends over 10 daysstatus_breakdown.png- Overall status distributionsubstatus_breakdown.png- Top 15 error typesspatial_hotspots.png- Error rates by shelf level and aislefast_moving_locations.png- Top 20 highest velocity locationsproblematic_locations.png- Top 20 risk scoreserror_prediction_model.png- Model performance metrics
-
Ground-Level Shelves Need Attention
- Despite easy access, ground shelves have highest error rates (6.24%)
- Hypothesis: Rushing, picking interference, or label damage
- Action: Investigate workflows for ground-level operations
-
Aisle AZ 1 Requires Investigation
- 10.64% error rate (2.7x warehouse average)
- May indicate: lighting issues, layout problems, or label quality
- Action: On-site audit of physical conditions
-
Fast-Moving Locations = Higher Risk
- Positive correlation between velocity and error rate
- More handling = more opportunities for errors
- Action: Implement more frequent audits for high-velocity locations
-
Predictive Model Enables Proactive Management
- Can identify high-risk locations before they accumulate errors
- Works on new warehouses (zero-to-one capability)
- Action: Deploy for ongoing monitoring and early intervention
- Data Processing: pandas, numpy, pyarrow
- Validation: pydantic
- Machine Learning: scikit-learn (Random Forest)
- Visualization: matplotlib, seaborn
- Statistical Analysis: scipy
- API: FastAPI, uvicorn
- Containerization: Docker, docker-compose
- Testing: pytest
Chosen over unsupervised methods (Isolation Forest, DBSCAN) because:
- β Transparent and explainable to stakeholders
- β Incorporates domain knowledge (error severity weights)
- β Tunable based on business priorities
- β Every component can be validated independently
- β Produces actionable insights
Formula:
Risk Score = 0.40 Γ Error_Severity +
0.30 Γ Operational_Impact +
0.20 Γ Error_Type_Severity +
0.10 Γ Spatial_Context
Chosen for zero-to-one prediction because:
- β Handles mixed feature types (numeric + categorical)
- β
Robust to class imbalance (with
class_weight='balanced') - β Provides feature importances (interpretability)
- β No feature scaling required
- β Proven performance on tabular data
Alternative considered: Logistic Regression (too simple), XGBoost (overkill for this data size)
See requirements.txt for complete dependencies.
Core packages:
pandas>=2.0.0
scikit-learn>=1.3.0
fastapi>=0.104.0
uvicorn>=0.24.0
Built with FastAPI β’ Docker β’ Python 3.11 π