A comprehensive Streamlit-powered analytics dashboard for analyzing CTC (Crush, Tear, Curl) tea sales data across North and South India markets. This application provides AI-powered market insights, statistical analysis, and interactive visualizations for tea auction data.
- Interactive Data Visualization: Dynamic charts showing price trends, volume analysis, and market efficiency
- Market Comparison: Compare different tea markets (North/South India, Leaf/Dust varieties)
- Statistical Analysis: Comprehensive analysis including correlations, trends, and market positions
- Data Processing: Support for Excel (.xlsx, .xls) and CSV file formats with intelligent column mapping
- Market Narrative: AI-generated market analysis and insights
- Price Analysis: Detailed price trend analysis with forecasting
- Market Intelligence: Competitive analysis and strategic recommendations
- Automated Reporting: AI-powered insights generation using OpenAI GPT models
- Multi-tab Interface: Organized analysis across Position, Trends, Comparison, and Levels tabs
- Responsive Design: Mobile-optimized interface with touch-friendly controls
- Real-time Processing: Dynamic data filtering and analysis
- Export Capabilities: PDF report generation for detailed analysis
- Welcome Brewing Sequence: Animated introduction for first-time users with tea preparation stages
- Data Upload Animations: Tea steeping progress indicators during file processing
- AI Analysis Animations: Tea master tasting animations for market intelligence generation
- Visualization Brewing: Tea preparation animations while charts are being generated
- Correlation Blending: Tea blending animations for relationship analysis
- Progress Tracking: Multi-stage tea ceremony progress indicators with elapsed time
- Frontend: Streamlit 1.29.0
- Data Processing: Pandas 2.1.3, NumPy 1.26.2
- Visualization: Plotly 5.18.0, Plotly Express
- AI Integration: OpenAI 1.3.5
- File Processing: openpyxl, xlrd
- Report Generation: ReportLab
- Python: 3.11+
-
Clone the repository:
git clone https://github.com/your-username/ctc-tea-sales-analytics.git cd ctc-tea-sales-analytics
-
Install dependencies using pip:
pip install .
Or install from pyproject.toml directly:
pip install -e .
-
Set up environment variables (optional for AI features):
export OPENAI_API_KEY="your-openai-api-key"
Using pip with dependencies list:
pip install streamlit==1.29.0 pandas==2.1.3 plotly==5.18.0 openai==1.3.5 numpy==1.26.2 openpyxl xlrd reportlab plotly-express
For development:
pip install -e ".[dev]"
Local Development:
streamlit run main.py --server.port=5000 --server.address=0.0.0.0
On Replit: Click the "Run" button or use the configured workflow.
The application expects Excel or CSV files with the following columns (accepts variations):
Required Column | Accepted Variations |
---|---|
Centre | Centre, Center, Market Center, Location |
Sale No | Sale No, Sale Number, Sale_No, SaleNo |
Sales Price(Kg) | Price/Kg, Price (Kg), Sales Price, Price |
Sold Qty (Ton) | Sold Quantity, Sold_Qty, Quantity Sold |
Unsold Qty (Ton) | Unsold Quantity, Unsold_Qty, Quantity Unsold |
Markets should follow the format: {Region} CTC {Type}
- Regions: North India, South India
- Types: Leaf, Dust
Example: "North India CTC Leaf", "South India CTC Dust"
- Drag-and-drop file upload
- Intelligent column mapping with fuzzy matching
- Data validation and cleaning
- Support for multiple file formats
- Multi-select filters for regions and tea types
- Dynamic market filtering
- Real-time data updates 8000 ul>
- Current market position metrics
- Price, volume, and efficiency analysis
- Historical context and percentile rankings
- Price trend visualization with trend lines
- Market efficiency tracking
- Rolling correlations and moving averages
- Cross-market comparisons
- Correlation heatmaps
- Competitive benchmarking
- Price distribution analysis
- Volume analysis with multiple aggregation methods
- Statistical summaries and insights
- Market Narrative: Comprehensive market analysis
- Price Analysis: Detailed price insights and forecasting
- Market Intelligence: Strategic recommendations
- Tea Messages: 50+ themed messages across 5 categories (upload, processing, ai_analysis, visualization, report)
- Tea Icons: 10 animated tea-related emojis (teapot, cup, leaves, steam, etc.)
- Progress Animations: Spinning teapot, tea leaf progress bars, steaming cup sequences
- Multi-step Progress: Tracks progress across multiple processing stages
- Elapsed Time Display: Shows processing duration for transparency
- Automatic Cleanup: Removes animation placeholders when complete
- Category-based Messages: Different message sets for different operations
- Chart Brewing: 4-stage visualization preparation with progress tracking
- Correlation Blending: Tea blending metaphor for relationship analysis
- Market Intelligence: Sophisticated tea tasting animation for AI analysis
- Traditional Ceremony: Classical tea preparation with reverent styling
- Modern Station: Contemporary brewing with digital aesthetics
- Artisan Crafting: Hand-crafted approach with premium styling
- App Initialization: Welcome brewing sequence on first visit
- Data Upload: Tea steeping animations during file processing
- Sample Data Loading: Quick brewing animation for instant data access
- AI Analysis: Tea master tasting sequence for all AI-powered insights
- Chart Generation: Visualization brewing for market position charts
- Correlation Analysis: Tea blending animation for relationship matrices
- Statistical Processing: Multi-stage progress tracking for complex calculations
- HTML/CSS Animations: Custom styled progress bars with gradient effects
- Dynamic Content: Real-time message updates with contextual tea terminology
- Responsive Design: Animations adapt to mobile and desktop viewports
- Performance Optimized: Lightweight animations that don't impact data processing
- State Management: Proper cleanup prevents UI conflicts and memory leaks
process_excel_data()
: File processing and column mappingstandardize_market_category()
: Market name standardizationcalculate_weighted_price()
: Weighted average price calculationsanalyze_levels()
: Market position analysisanalyze_trends()
: Trend analysis and patternsanalyze_comparatives()
: Cross-market comparisonscalculate_correlations()
: Correlation matrix generationgenerate_ai_narrative()
: AI-powered market insightsgenerate_price_analysis()
: Price analysis with AIgenerate_market_insights()
: Strategic market intelligenceOPENAI_API_KEY
: Required for AI-powered features- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Click the "Deploy" button in Replit
- The app will be available on your Replit domain
- Supports both development and production modes
- Python 3.11+ environment
- All dependencies installed
- Environment variables configured
- Port 5000 accessible
- File Upload Errors: Ensure your file has the required columns with accepted naming variations
- AI Features Not Working: Check that
OPENAI_API_KEY
is properly set - Performance Issues: For large d 717D atasets, the app includes optimized batch processing
- Check the troubleshooting section
- Review the console logs for error details
- Ensure all dependencies are properly installed
- Built with Streamlit for the web interface
- Plotly for interactive visualizations
- OpenAI for AI-powered insights
- Pandas and NumPy for data processing
βββ main.py # Main Streamlit application
βββ utils.py # Data processing and analysis utilities
βββ styles.py # Custom CSS styling
βββ loading_animations.py # Tea-themed loading animation system
βββ assets/ # Sample data and resources
β βββ default_data.csv # Sample tea market dataset
βββ pyproject.toml # Project dependencies
βββ .replit # Replit configuration
βββ README.md # This file
The dashboard features a comprehensive tea-themed loading animation system that enhances user experience during data processing and analysis operations.
The app includes custom styling and mobile optimization. Configuration can be found in styles.py
.
This application is optimized for Replit deployment:
For other platforms, ensure:
Run with debug logging:
streamlit run main.py --logger.level=debug
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
Note: This application is designed for tea market analysis and can be adapted for other commodity markets with similar data structures.