Research system for analyzing tea leaf quality and forecasting quality degradation using hybrid AI/ML models integrated with weather and environmental data, accessible via a mobile interface.
The research paper behind TeaOptima has been published in the IEEE Xplore proceedings of the MERCon-Moratuwa Engineering Research Conference 2025 :
R. J. Bandara and A. Kuruppu, “Predictive Analytics for Tea Leaf Aging and Quality Degradation,” 2025 Moratuwa Engineering Research Conference (MERCon), Moratuwa, Sri Lanka, pp. 239–244, 2025.
📄 Read the paper on IEEE Xplore
-
📸 Image Classification:
- Capture high-resolution images of tea leaves directly from the app.
- Utilize advanced machine learning models to analyze and classify the quality of tea leaves based on visual characteristics.
-
🔮 Degradate Prediction:
- Leverage AI-powered algorithms to predict the degradation of tea leaves over time.
- Provide users with insights into the expected quality changes, helping in better inventory and quality management.
-
🌤️ Weather Integration:
- Integrate real-time weather data to assess its impact on tea quality.
- Use OpenWeatherMap API to fetch current weather conditions and forecasts, influencing tea leaf quality predictions.
-
📊 Data Visualization:
- Display comprehensive charts and graphs to visualize quality trends over time.
- Enable users to track historical data and make informed decisions based on visual analytics.
-
🔥 Firebase Integration:
- Implement secure user authentication using Firebase Auth.
- Store user data and app configurations in Firebase Firestore for seamless data management and retrieval.
-
📱 Cross-Platform:
- Ensure compatibility across iOS, Android, and Web platforms.
- Provide a consistent user experience regardless of the device or platform used.
- Flutter SDK (3.7.0+)
- Firebase project
- OpenWeatherMap API account (optional)
git clone https://github.com/RavJayB/tea-leaf-quality-prediction.git
cd tea-quality-appflutter pub get.env file with the required API key.
-
Copy the environment template:
cp .env.example .env
-
Edit
.envand replace placeholder values:# Required - Get from https://openweathermap.org/api OPENWEATHER_API_KEY=your_actual_openweather_api_key # Optional - Override default service URLs if needed IMAGE_SERVICE_URL=your_image_service_url # contains YOLOv8 Model DEGRADE_SERVICE_URL=your_degrade_service_url # contains Random Forest Model
Note: The app will crash on startup if OPENWEATHER_API_KEY is missing. Service URLs have fallback values for development.
-
Copy the Firebase template:
cp lib/firebase_options.example.dart lib/firebase_options.dart
-
Replace placeholder values in
lib/firebase_options.dartwith your Firebase project credentials:- Get these from Firebase Console > Project Settings > General tab
- Replace all
YOUR_*placeholders with actual values
-
Download and place platform-specific config files:
- Android:
google-services.json→android/app/ - iOS:
GoogleService-Info.plist→ios/Runner/
- Android:
- Sign up at OpenWeatherMap
- Get your free API key
- Add it to your
.envfile - this is required for the app to run properly
If you have your own ML services, update the URLs in .env:
IMAGE_SERVICE_URL: Your image classification endpointDEGRADE_SERVICE_URL: Your quality prediction endpoint
flutter runlib/
├── main.dart # App entry point
├── firebase_options.dart # Firebase configuration (excluded from git)
├── screens/ # UI screens
├── services/ # Business logic and API calls
│ ├── api_service.dart # ML service integration
│ ├── auth_service.dart # Firebase authentication
│ └── config_service.dart # Environment configuration
└── widgets/ # Reusable UI components
This project is configured for safe public repository sharing:
- ✅ API keys are externalized to
.envfiles - ✅ Firebase configuration uses templates
- ✅ Sensitive files are in
.gitignore - ✅ Fallback values for development
Never commit real API keys or credentials to version control.
- Add the variable to
.env.example - Update
lib/services/config_service.dart - Use
ConfigService.yourVariablein your code
If you need to reconfigure Firebase:
flutterfire configure- "Missing OPENWEATHER_API_KEY": Create a
.envfile with your OpenWeatherMap API key - "Classification failed (500)": Backend service is down or misconfigured
- Firebase initialization errors: Check
firebase_options.dartconfiguration - Weather data not loading: Verify OpenWeatherMap API key in
.env - Build errors: Run
flutter clean && flutter pub get
- Check the Flutter documentation
- Review Firebase setup guides
- Ensure all API keys are correctly configured
- For any questions or collaboration, Contact me through my portfolio: ravindubandara.dev
- Fork the repository
- Create a feature branch
- Follow the security guidelines for API keys
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.



