DEV Community

n00bgineer
n00bgineer

Posted on • Originally published at n00bgineer.wordpress.com on

Building a privacy-first health app - update #6

Introduction

In the previous update, I was able to implement the foodItemSearch service, which allowed me to search for food items, but it was buggy at best, since pagination didn’t work as expected. By this update, I was able to fix the basic fetching issues, but I also discovered another issue.

Update

  1. I discovered a pretty weird issue in the FDC API, that is the 0th page of /v1/foods/search endpoint returns the same output as the 1st page. To fix this, I’d to replace the default page count as 1, instead of 0.
  2. There were also some other minor updates that I made to fix the issue with pagination, as only the first page was getting re-fetched every time.
  3. I updated the foodItemSearch service, to also return the servingCount value for both foundational and branded food, with it’s default value being 0.25 & 1 respectively. Why 0.25 as the default servingCount for foundational foods? That’s because the default servingSize for foundation foods is 100g, but it needs to be broken down so that users can select smaller portions.
  4. I also added the NutritionModal , which shows the nutritional information of a food. It is shown upon clicking the “Nutrition” button at the bottom of the FoodCard component.

Next steps

  1. Now I can finally implement the feature to implement food item mutation, which is linked with both food and account screens. To make the food item mutation work, I’ll have to build a modal in which the users can view, add and remove food items from their list. Think of it like a cart for food, i.e. A food cart.

Screenshots


Viewing nutritional information (desktop)


Nutritional info modal in mobile (light mode)


Nutritional info modal in mobile (dark mode)

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo 📊✨

Top comments (0)

Image of DataStax

AI Agents Made Easy with Langflow

Connect models, vector stores, memory and other AI building blocks with the click of a button to build and deploy AI-powered agents.

Get started for free

👋 Kindness is contagious

If you found this article helpful, please give a ❤️ or share a friendly comment!

Got it