## Inspiration

Unhealthy diet is the leading cause of death in the U.S., contributing to approximately 678,000 deaths each year, due to nutrition and obesity-related diseases, such as heart disease, cancer, and type 2 diabetes. Let that sink in; the leading cause of death in the U.S. could be completely nullified if only more people cared to monitor their daily nutrition and made better decisions as a result. But **who** has the time to meticulously track every thing they eat down to the individual almond, figure out how much sugar, dietary fiber, and cholesterol is really in their meals, and of course, keep track of their macros! In addition, how would somebody with accessibility problems, say blindness for example, even go about using an existing app to track their intake? Wouldn't it be amazing to be able to get the full nutritional breakdown of a meal consisting of a cup of grapes, 12 almonds, 5 peanuts, 46 grams of white rice, 250 mL of milk, a glass of red wine, and a big mac, all in a matter of **seconds**, and furthermore, if that really is your lunch for the day, be able to log it and view rich visualizations of what you're eating compared to your custom nutrition goals?? We set out to find the answer by developing macroS.

## What it does

macroS integrates seamlessly with the Google Assistant on your smartphone and let's you query for a full nutritional breakdown of any combination of foods that you can think of. Making a query is **so easy**, you can literally do it while *closing your eyes*. Users can also make a macroS account to log the meals they're eating everyday conveniently and without hassle with the powerful built-in natural language processing model. They can view their account on a browser to set nutrition goals and view rich visualizations of their nutrition habits to help them outline the steps they need to take to improve.

## How we built it

DialogFlow and the Google Action Console were used to build a realistic voice assistant that responds to user queries for nutritional data and food logging. We trained a natural language processing model to identify the difference between a call to log a food eaten entry and simply a request for a nutritional breakdown. We deployed our functions written in node.js to the Firebase Cloud, from where they process user input to the Google Assistant when the test app is started. When a request for nutritional information is made, the cloud function makes an external API call to nutrionix that provides nlp for querying from a database of over 900k grocery and restaurant foods. A mongo database is to be used to store user accounts and pass data from the cloud function API calls to the frontend of the web application, developed using HTML/CSS/Javascript.

## Challenges we ran into

Learning how to use the different APIs and the Google Action Console to create intents, contexts, and fulfillment was challenging on it's own, but the challenges amplified when we introduced the ambitious goal of training the voice agent to differentiate between a request to log a meal and a simple request for nutritional information. In addition, actually finding the data we needed to make the queries to nutrionix were often nested deep within various JSON objects that were being thrown all over the place between the voice assistant and cloud functions. The team was finally able to find what they were looking for after spending a lot of time in the firebase logs.In addition, the entire team lacked any experience using Natural Language Processing and voice enabled technologies, and 3 out of the 4 members had never even used an API before, so there was certainly a steep learning curve in getting comfortable with it all.

## Accomplishments that we're proud of

We are proud to tackle such a prominent issue with a very practical and convenient solution that really nobody would have any excuse not to use; by making something so important, self-monitoring of your health and nutrition, much more convenient and even more accessible, we're confident that we can help large amounts of people finally start making sense of what they're consuming on a daily basis. We're literally able to get full nutritional breakdowns of combinations of foods in a matter of **seconds**, that would otherwise take upwards of 30 minutes of tedious google searching and calculating. In addition, we're confident that this has never been done before to this extent with voice enabled technology. Finally, we're incredibly proud of ourselves for learning so much and for actually delivering on a product in the short amount of time that we had with the levels of experience we came into this hackathon with.

## What we learned

We made and deployed the cloud functions that integrated with our Google Action Console and trained the nlp model to differentiate between a food log and nutritional data request. In addition, we learned how to use DialogFlow to develop really nice conversations and gained a much greater appreciation to the power of voice enabled technologies. Team members who were interested in honing their front end skills also got the opportunity to do that by working on the actual web application. This was also most team members first hackathon ever, and nobody had ever used any of the APIs or tools that we used in this project but we were able to figure out how everything works by staying focused and dedicated to our work, which makes us really proud. We're all coming out of this hackathon with a lot more confidence in our own abilities.

## What's next for macroS

We want to finish building out the user database and integrating the voice application with the actual frontend. The technology is really scalable and once a database is complete, it can be made so valuable to really anybody who would like to monitor their health and nutrition more closely. Being able to, as a user, identify my own age, gender, weight, height, and possible dietary diseases could help us as macroS give users suggestions on what their goals should be, and in addition, we could build custom queries for certain profiles of individuals; for example, if a diabetic person asks macroS if they can eat a chocolate bar for lunch, macroS would tell them no because they should be monitoring their sugar levels more closely. There's really no end to where we can go with this!
## Inspiration

Using “nutrition” as a keyword in the Otsuka valuenex visualization tool, we found that there is a cluster of companies creating personalized nutrition and fitness plans. But when we used the “and” function to try to find intersections with mental wellness, we found that none of those companies that offer a personalized plan really focused on either stress or mental health. This inspired us to create a service where we use a data-driven, personalized, nutritional approach to reduce stress.

## What it does

We offer healthy recipe recommendations that are likely to reduce stress. We do this by looking at how the nutrients in the users’ past diets contributed to changes in stress. We combine this with their personal information to generate a model of which nutrients are likely to improve their mental wellness and recommend recipes that contain those nutrients. Most people do want to eat healthier, but they don’t because it is inconvenient and perceived to be less delicious. Our service makes it easy and convenient to eat delicious healthy food by making the recipe selection and ingredient collection processes simpler.

To personally tailor each user's recipe suggestions to their stress history, we have users save food items to their food log and fill out a daily questionnaire with common stress indicators. We then use the USDA food database to view the specific nutrients each food item has and use this data to calculate the relationship between the user's stress and the specific nutrients they consumed. Finally, we use this model to suggest future recipes that contain nutrients likely to reduce stress for that user.

In order to proactively reduce user's stress, we offer a simple interface to plan meals in advance for your entire week, an auto-generated ingredients list based on selected recipes for the week, and a seamless way to order and pay for the ingredients using the Checkbook API service. To make it easier for users, the food log will automatically populate each day with the ingredients from the recipes the user selected to eat for that day.

## How we built it

We used Bubble to build a no-code front end by dragging and dropping the design elements we needed. We used Bubble's USDA plugin to let users search for and enter foods that they consumed. The USDA food database is also used to determine the nutrients present in each of the foods the user reports consuming. We also used Bubble's Toolbox plugin to write Javascript code that allows us to run the Checkbook API. We use the Spoonacular API to get the recipe suggestions based on the user's personalized preference quiz answers where they give the types of cuisines they like and their dietary restrictions. We use a linear regression model to suggest future recipes for users based on the nutrients that are likely to reduce their stress.

## Challenges we ran into

One challenge for us was using Bubble. Only one team member had previous design experience, but everyone on the team wanted to contribute to building the front-end, so we faced a huge learning curve for all members of the team to learn about good design principles and how to space elements out on Bubble. Grouping elements together was sometimes weird on Bubble and caused issues with parts of our header not lining up the way we wanted it to. Elements would sometimes disappear under other elements and it would become hard to get them out. Formatting was weird because our laptops had different aspect ratios, so what looked good on one person's laptop looked bad on another person's laptop. We were debugging Bubble until the end of the hackathon.

## Accomplishments that we're proud of

Our team had little to no front-end design experience coming into this hackathon. We are proud of how much we all learned about front-end design through Bubble. We feel that moving forward, we can create better front-end designs for our future projects.

We are also proud of finding and figuring out how to use the Spoonacular API to get recipe recommendations. This API had very thorough documentation, so it was relatively easy to pick it up and figure out how to implement it.

## What we learned

The first thing we learned was how to use the Otsuka valuenex visualization tool for ideation. We found this tool to be extremely helpful with our brainstorming process and when coming up with our idea.

We learned how to use Bubble to create a front-end without needing to write code. Despite the struggles we initially faced, we grew to find Bubble more intuitive and fun to use with more practice and managed to create a pretty nice front-end for our service. We hosted our server on Bubble.

We also learned how to use the Checkbook API to seamlessly send and receive payments.

Finally, we learned how to use the Spoonacular API to generate recipe recommendations based on a set of parameters that includes preferred types of cuisines, dietary restrictions, and nutrients present in each dish.

## What's next for mood food

We feel very passionate about exploring this project in more depth by applying more complex machine learning models to determine better recipe recommendations for users. We would also like to have the opportunity to deploy this service to collect real data to analyze.

## Thanks

Thank you very much to Koji Yamada from Otsuka for meeting up with our team to discuss our idea and offer us feedback. We are very grateful to you for offering our team support in this form.

Thank you to the amazing TreeHacks organizers for putting together this awesome event. Everyone on our team learned a lot and had fun.
## Inspiration

We all came together to solve a problem that people struggle with on a regular basis. We are we were immigrants who hail from different places in the world where English is not a prevalent language! We thought to ourselves, what is someone that is difficult and is often. detriment to various communities? We discovered that we could leverage our knowledge to help communities that either are drawn into confusion or are taken advantage of through legal documentation that is often difficult to understand, even for those who are fluent in English.

## What it does

We leveraged large language models, ORC, and base 64 to scan documents, summarize them, and translate them to a person's language. We do this summarization and translation by implementing Together.ai's api and fine tuning models using our datasets.

## How we built it

We built it by splitting the team into various roles - Juan: Front-end, Aleks: Front-end / Back-end, Randolf: APIs, ML/AI, and Xiang (UI/UX / Front-end). Our technology/ Design stack: Tailwind.css, Python, Javascript, Together.ai API, Google Vision API, Typescript, Javascript, Next.js, Libraries for transforming PDFs.

## Challenges we ran into

We all ran into tough challenges as we struggled to connect components together which include:
 - Working with Pdf documents: searching for the best libraries to help convert documents to images
 - Connecting to google vision api after obtaining said images
 - Working with timeouts with displaying words using visual effects in the front-end
 - Loading effects, creating try-catch statements using logical processing
 - Designing the website using sigma to have a simple but elegant UI/UX
 - Congregating data to use in together.ai's LLMs (LLaMA - for summarization, llama 2 - for key points / insights) using python scripting
 - Working with Together.ai's prompting to ensure the best answer quality for the queries needed to operate our platforms

## Accomplishments that we're proud of

```
- Undertaking such an ambitious project
- Working tirelessly through problems without sleeping much
- Communicating our ideas about the project, while also helping each troubleshoot problems

```

## What we learned

```
- We learned that creating projects that are meaningful to us as individuals is much more rewarding than simply creating a project for the sake of a project
- How different technologies interact with each other and how they all play a role in the development process.
- Working with a team, delegating tasks so that each person has something to work on.

```

## What's next for LegalLingua

```
- Improving the large language models so that the summarization and translation process is easier to do/ much faster
- Increase capacity sizes for pdf / document input so that we can accept a larger variety of legal documentation.

```