Farmers markets have been hit especially hard by COVID-19. Not only have the restaurants, which provided vendors with a stable source of income, shut down, but it is also difficult for vendors to reach their customers with their products. We regularly come across news articles showing farmers dumping produce for the lack of buyers, and it is more important than ever to eat healthy and support local vendors. As per the last census data USDA estimates that around 11% of the population link![usda article] classifies as food-insecure. That is, around 3.5 million people do not have ready access to nutritious foods from grocery stores. That was the inspiration behind Farmeet: a platform where anyone can discover the nearest farmers market to match their requirements. This way, people can avoid going to crowded grocery stores to get nutritious foods.

What it does

This app gives a wide selection of nearby farmers market based on the user's selection of food/grocery products, government benefits, and other criteria. It uses smart matching, and it shows the percentage that a farmers market matches the user's selection criteria.

How we built it

The front-end of the app is created using HTML, CSS and React.JS. The code is hosted on Netlify. It has an interface where the user can enter the type of goods/groceries they would like to buy in and the type of government benefit, for example: SNAP, WIC, they would like to avail. The front-end then sends the user’s location (in terms of coordinates), the product selection and the list of selected benefits to the backend (server-side) of the app. The back-end of the app is written using Python’s Flask library. This is hosted on a Heroku server. Based on the inputs from the app’s front-end the server-side code then queries USDA’s Farmers market api to get a list of around 18 to 20 nearest Farmers markets. The API request provides the Farmer’s market ID (FMID) and the distance from the user’s location for each farmer’s market. The FMID is then used to get the products available and the benefits provided by each of the Farmers’ markets in the user’s vicinity from a copy of USDA’s Farmers market directory hosted on the server side using MongoDB.

The user’s input and the resulting list of farmer’s markets along with their products and benefits is then passed to an algorithm for computing the cosine-similarity. We used cosine_similarity from Python's Sci-Kit learn library. One vector is the user's input - consisting of 0s and 1s for each of the fields, the other vector is each of the farmer's market (consisting of 0s and 1s). This algorithm gives the degree, in terms of percentage, to which a Farmer’s market matches the user’s selections.

The computed results are then available via Flask’s GET Request. This results is then fetched by the front-end code and displayed to the user in order of decreasing percentage match and then sorted by increasing distance. An interactive map of Farmer’s market is also displayed to the user. This was created using R’s Leaflet library.

Challenges we ran into

· One of the major challenge was to try to couple the front-end and the back-end together. Both the sides are hosted on different servers and we spent quite some time trying to make them talk to each other. · The other challenge was to get the backend server up running properly on the Heroku server. · We also had to figure out a way to send the data from the backend to the front-end in a way that can be easily consumed by the front-end app.

Accomplishments that we are proud of

This app would not only help the farmer’s sell their produce more efficiently, but would also help the people have a better access to nutritious produce. During a pandemic, it can be helpful for people to be able to see what farmer’s markets available to them if they are not comfortable in commuting to a particular location which has recently seen a spike in cases. From a technical perspective, developing this app gave us a better understanding of a lot of open source technologies like Flask, React.JS, Leaflet, Heroku etc. We got experience in developing the front and back end of the app and combining them seamlessly.

What we learned

We got hands-on experience in developing a full-fledged application. Each of us gained experience in developing different aspects of the application. We got extensive experience in both creating and consuming API requests.

What's next for Farmeet

This app currently lists only the nearest farmer’s markets. However, USDA also provides other resources for getting fresh produce like – CSA directory, Food Hub and on-Farm markets. Currently, USDA does not have API available for these data. We intend to host these data on Farmeet’s Mongo-DB servers and create an API which can display all the relevant information to the user. This would be a complete solution for all non-store markets. We also intend to add an API to overlay information about local cases of the pandemic. Overlaying Covid-19 data with Farmer’s market data would help users as well as farmers make informed decisions on where to source the produce from in case of a local spike in cases. Once the app is in wide use we can also capture user’s consumption patterns and model it to create a better demand forecast for the farmers. This way the farmers can avoid spoilage and they might also be able to sell their extra produce to low-income neighborhoods at a reduced price. Farmer’s markets directly benefit the farmers. However, they also suffer from lack of resources since they do not have a backing of a large corporation. Farmeet aims to provide the farmers with an equal footing.

Share this project: