Inspiration
We were inspired by the challenges faced by farmers in India due to climate change, such as erratic weather and soil erosion. Our goal was to create a platform that helps farmers by providing guidance based on their location and crop type, along with a marketplace for buying and selling farming equipment.
What It Does
User Input
Prompts users (farmers) to enter their zip code along with the specific crop they wish to plant. There is also a sign in option to get a detailed crop schedule. It also has crop guides for 22 crops.
Soil Analysis
Using our dataset, the website retrieves soil content information for the given zip code, including levels of nitrogen, phosphorus, potassium, and pH levels.
Machine Learning Model
This data is then fed into our machine learning model, trained on a comprehensive crop recommendation dataset from Kaggle. The model, hosted on Databricks and stored as a .pkl file on AWS, predicts the optimal conditions for temperature, humidity, and rainfall for the specified crop. We can access this model via an API call, allowing seamless integration with our platform.
Weather Forecasting
These optimal conditions are then used as input for the Perplexity API, along with the zip code, to determine when the best weather conditions will occur for planting the crop.
Crop Schedule
The website provides a detailed schedule for planting, fertilizing, and watering the crop. It also includes alerts for incoming adverse weather conditions, helping farmers make informed decisions.
Marketplace
We have integrated a marketplace that gathers data on essential farming tools and equipment, providing farmers with links to purchase these items. This feature connects farmers with the resources they need to enhance their agricultural practices.
How We Built It
Data Processing and Model Training
We utilized Pandas for data manipulation and preprocessing. This powerful library allowed us to efficiently clean and organize the crop recommendation dataset from Kaggle, preparing it for model training. Scikit-learn was our go-to library for building and training the machine learning model. It provided us with a wide range of tools for model selection, training, and evaluation, ensuring that our model was both accurate and efficient.
Machine Learning Model Deployment
Once trained, our model was serialized into a .pkl file and hosted on Databricks. This setup allowed us to leverage Databricks' robust infrastructure for scalable model deployment. By storing the model on AWS, we ensured that it was easily accessible and could be integrated into our application via API calls.
Frontend and Backend Integration
For the frontend, we used Next.js to create a dynamic and responsive user interface. This framework's capabilities in server-side rendering and static site generation helped us deliver a seamless user experience. On the backend, we developed a RESTful API using Flask. This API served as the bridge between the frontend and our machine learning model, handling requests and returning predictions. We used OAuth and JWT for user authentication and session management
Containerization and Deployment
To ensure consistency across different environments, we containerized our application using Docker. This approach allowed us to package our application, along with all its dependencies, into a single container, simplifying deployment and scaling.
Data Integration and APIs
We integrated various datasets to provide comprehensive soil and weather analysis. The Perplexity API was used to forecast weather conditions based on the model's predictions and the user's zip code, allowing us to deliver precise scheduling for agricultural activities.
Marketplace Feature
Our marketplace feature was developed to aggregate data on essential farming tools and equipment. This feature provides farmers with direct links to purchase these items, connecting them with the resources they need to enhance their agricultural practices.
Testing and Quality Assurance
We used Postman for testing our API endpoints, ensuring they functioned correctly and met the requirements of our frontend. This testing process involved simulating various scenarios and edge cases to identify and resolve issues early in the development process.
Challenges We Encountered
Initial Conceptualization
Our journey began with an ambitious idea IOTrust, which was essentially a marketplace for data. We envisioned a platform where individuals could sell their data. However, we quickly realized that this concept wasn't practical or feasible. Companies are unlikely to purchase data from individual consumers due to concerns about data quality and privacy. Similarly, consumers might not be motivated to sell their data for minimal compensation.
Learning New Technologies
- Docker: Understanding Docker's containerization technology was challenging, especially in terms of setting up and managing containers for our application.
- Next.js: Adapting to the Next.js framework required learning its structure and conventions, which was initially difficult but eventually became intuitive.
- Databricks: Hosting a machine learning model on Databricks and making it accessible via API calls was complex, particularly in terms of deployment and integration.
Model Training and Data Challenges
- Model Selection: Finding the right model for our data was difficult due to the limited number of features and numerous labels. This led to poor performance metrics like mean squared error and accuracy.
- Data Augmentation: To improve model performance, we generated additional data from the training set, which helped in training the model on a larger dataset.
- Data Acquisition: Obtaining accurate data on nitrogen, phosphorus, and potassium levels based on zip code required parsing extensive geological datasets. Similarly, accessing weather data involved navigating through thousands of CSV files, which was impractical for model training.
API Integration
While integrating the Perplexity API to fetch weather data, we encountered persistent 404 errors. These errors were primarily due to the API's limitations in handling large volumes of output data for certain requests. When specific data parameters were used, the API struggled to return the expected results, which required us to adjust our data requests multiple times. We had to use perplexity api in frontend as it was an api inside of another api.
Model Deployment
Deploying our model on Databricks and setting up API endpoints presented challenges in configuring the API calls. Understanding the specific requirements of Databricks' environment, such as setting up the correct permissions and ensuring network configurations were aligned. This made it so that the model response to API requests were sometimes slow or just unresponsive, which in turn requires more troubleshooting and adjustments to be made.
Accomplishments That We're Proud Of:
Successful Model Execution
After numerous attempts and hour-long evaluation times (which eventually just timed out), we finally got our machine learning model to run and execute successfully, providing semi-accurate predictions.
Model Hosting on Databricks
We successfully connected and hosted our model on Databricks through AWS, ensuring it is scalable and accessible for real-time predictions through API calls.
Dynamic API Utilization
We figured out how to effectively use the Perplexity API to output desired results. This was particularly challenging because the input was not static and varied based on the zip code and the model's predictions for temperature, rainfall, and humidity.
What We Learned:
Docker, MongoDB, Databricks, Postman, Flask, Next.js
What's Next For FarmNest?
Marketplace
Our code has a static marketplace with hard coded items but in the future we want to make it into a dynamic marketplace where you can buy farm equipment. We have it in the code as proof of concept
Mobile Application Development
Creating a mobile app version of FarmNest would provide farmers with convenient, on-the-go access to crop schedules, marketplace resources, and weather alerts. This would significantly increase the platform's accessibility and usability, especially for farmers who rely on mobile devices in the field.
IoT Integration
Integrating IoT devices for real-time monitoring of soil conditions and weather could provide farmers with up-to-date data, enabling more precise and timely decision-making. This could lead to improved crop management and yield optimization.
Log in or sign up for Devpost to join the conversation.