A comprehensive logistics analytics platform built with Streamlit that provides real-time insights into Amazon delivery operations, cost analysis, and predictive analytics for delivery delays.
- Prime Performance: Comprehensive delivery metrics and carrier analysis
- Last-Mile Operations: Real-time route optimization and vehicle efficiency
- Cost Efficiency Analysis: Cost analysis and optimization insights
- Amazon Purchase Trends: Product sales and category analysis
- ML Prediction Demo: Real-time delivery delay prediction
- AI Dispatcher Assistant: Intelligent logistics advisor with guided questions
- Delivery Delay Prediction: Machine learning model for predicting delivery delays
- Natural Language Queries: Ask questions about logistics data in plain English
- Proactive Alerts: Real-time monitoring of internal and external factors
- Route Optimization: Google Routes API integration for traffic-aware routing
- Real-time APIs: Weather alerts, news alerts, traffic data
- Historical Data: Amazon purchase history and simulated logistics data
- External Sources: OpenWeatherMap, NewsAPI, Google Maps APIs
- Frontend: Streamlit
- Backend: Python, FastAPI
- Data Processing: Pandas, NumPy
- Visualization: Altair, Plotly
- Machine Learning: Scikit-learn, SHAP
- APIs: Google Routes, OpenWeatherMap, NewsAPI
- Database: PostgreSQL (optional)
- Python 3.8+
- pip package manager
- Google Routes API key (optional, for route optimization)
- OpenWeatherMap API key (optional, for weather data)
- NewsAPI key (optional, for news alerts)
-
Clone the repository
git clone <repository-url> cd AWS_Project
-
Create and activate virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables Create a
.envfile in the project root:# API Keys (optional - app works without them) GOOGLE_ROUTES_API_KEY=your_google_routes_api_key OPENWEATHERMAP_API_KEY=your_openweathermap_api_key NEWSAPI_API_KEY=your_newsapi_key MAPS_API_KEY=your_google_maps_api_key # Database (optional) DB_HOST=localhost DB_PORT=5432 DB_NAME=amazon_delivery_db DB_USER=postgres DB_PASSWORD=your_database_password
-
Set up Streamlit secrets (alternative to .env) Create
.streamlit/secrets.toml:GOOGLE_ROUTES_API_KEY = "your_google_routes_api_key" OPENWEATHERMAP_API_KEY = "your_openweathermap_api_key" NEWSAPI_API_KEY = "your_newsapi_key" MAPS_API_KEY = "your_google_maps_api_key"
streamlit run scripts/web_app.pycd scripts
uvicorn ml_prediction_api:app --reload --port 8000python scripts/run_pipeline.pyAWS_Project/
βββ scripts/
β βββ web_app.py # Main Streamlit application
β βββ pages/ # Dashboard page modules
β β βββ prime_performance.py
β β βββ last_mile_operations.py
β β βββ cost_efficiency_analysis.py
β βββ utils/ # Utility functions
β βββ config/ # Configuration files
β βββ ml_prediction_api.py # FastAPI for ML predictions
β βββ data_generator.py # Simulated data generation
β βββ api_integrator.py # External API integrations
βββ data/ # Data files (not in git)
βββ models/ # ML models (not in git)
βββ .streamlit/ # Streamlit configuration
βββ config/ # Project configuration
βββ requirements.txt # Python dependencies
- Never commit API keys to version control
- Use environment variables or Streamlit secrets
- Rotate keys regularly
- Use least-privilege access
- All data is simulated or anonymized
- No real customer data is used
- External APIs are optional
- Use strong passwords
- Enable SSL connections
- Restrict network access
- Regular security updates
python -c "import sys; sys.path.append('.'); from scripts.pages.cost_efficiency_analysis import render_page; print('β
Cost Analysis page works')"curl http://localhost:8000/health- Orders: 15,000+ simulated Amazon orders
- Carriers: AMZL, UPS, FedEx, USPS
- Cities: 15 major US cities
- Time Period: 6 months of historical data
- Weather: OpenWeatherMap API
- News: NewsAPI
- Traffic: Google Maps Directions API
- Routing: Google Routes API
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is for educational and demonstration purposes.
API Key Errors
- Ensure API keys are set in environment variables or Streamlit secrets
- Check API key permissions and quotas
- Verify API key format
Database Connection Issues
- Check database credentials
- Ensure PostgreSQL is running
- Verify network connectivity
Missing Dependencies
- Reinstall requirements:
pip install -r requirements.txt - Check Python version compatibility
- Check the logs in
app.loganddata_processing.log - Review the
IMPROVEMENTS_GUIDE.mdfor known issues - Open an issue with detailed error information
- β Modular code structure with separate page modules
- β Enhanced security with proper API key management
- β Simplified cost efficiency analysis
- β Improved error handling and logging
- β Comprehensive documentation
- π Advanced filtering and search
- π Real-time data streaming
- π Custom dashboard builder
- π Mobile-responsive design
- π Export functionality
Note: This is a demonstration project. For production use, implement proper security measures, error handling, and monitoring.