Inspiration
Oftentimes, many of us want to be more sustainable when we shop, but we may not have access to the most sustainable options, or the most sustainable options are way out of our budget. That's why we designed RightChoice.
What it does
RightChoice is an algorithm that takes as input an item, and tells you the most sustainable option, your cheapest option, and the most sustainable option within your budget.
How we built it
On the backend, we used Python. Our input into the functions is a dictionary of all items. We categorized items based on if they were compound or atomic-- compound items needed other items to make them, and atomic items were "base" items.
We have five main functions:
- lowest_cost(all_items, item,x=[])- This function takes the dictionary of all items (a dictionary where each key is an item and the value is a list of lists (each list within the list is a combination of items that can make up the key item)), and returns an integer representing the lowest cost of that item.
- cheapest(all_items,item,x=[])- This function takes the same dictionary that lowest cost takes, and returns the cheapest path (cheapest items that make up the key item).
- all_possible_paths(all_items,item, x=[])- This function takes the same dictionary as the past functions, and returns a list of dictionaries, where each dictionary contains the atomic items that can be combined to make that list.
- cheapestInBudget(all_items,item,budget,x=[])- This function takes the same dictionary as the past functions, and returns the most environmentally friendly path that is within the inputted budget.
- lowest_environment(all_items,item,x=[]- This function takes the same dictionary as the past functions, and returns the most environmentally friendly path, regardless of cost.
Note: In all of our functions we have a default argument: x=[]. This is used to specify items that a user may not want. Any item that is in this list will be removed from our result (our algorithm will not return a result that has an item that is in this list).
Challenges we ran into
Moving our code from Python to a website was the most challenging part. We also had challenges figuring out the combinational and multiplicative part of the recursion of our code in all_possible_paths.
Accomplishments that we're proud of
This was our first hackathon, and we're proud at how far we got with our project! We feel like RightChoice can be used in the real world, and it can help consumers make planet friendly decisions as well.
What we learned
We learned so much! First, we learned that hackathons are somewhat open ended! We kind of thought we were gonna come and be given problems to code. We also learned how to use recursion to solve a real world issue! And this is the first time we deployed our code into a website as well.
What's next for RightChoice
With a little more work, we believe RightChoice could be used for any consumers that are interested in shopping more sustainably! We think it would be cool if our input dictionary was composed using ML to parse the web and get the list of all items that way.
Log in or sign up for Devpost to join the conversation.