Skip to content

[5.6 Manual Food DB] Lightweight Database for Offline Foods #47

@fIyingPhoenix

Description

@fIyingPhoenix

Milestone: Milestone 5: Infrastructure & Tools
Category: 5.6 Manual Food DB
Task: Implement a lightweight database to store offline food items that can be accessed when there is no internet connection.


Description

This task involves creating a local, lightweight database for offline food storage. The database should be able to store food items added by the user when they are not connected to the internet. The app should sync these items with the central server when the connection is restored.


Subtasks:

  • Database Setup:
    • Choose an appropriate lightweight database for offline storage (e.g., SQLite, Realm, etc.)
    • Design the database schema to store relevant food item data (e.g., food name, calories, macronutrients, serving size, barcode)
    • Ensure the database is optimized for offline use (low storage overhead)
  • Food Item Addition:
    • Allow users to manually add food items to the local database when offline
    • Implement form fields to input necessary information (e.g., name, calories, macronutrients)
  • Local Data Retrieval:
    • Implement querying functionality to retrieve food items from the local database
    • Ensure users can view and edit the details of stored food items
  • Sync with Backend:
    • Implement a system to sync locally stored food items with the central server once the internet connection is restored
    • Handle conflicts between local and server data (e.g., merging or overwriting items)
  • UI and UX:
    • Provide a user interface to view, add, and edit offline food items
    • Show a message when the app is offline and food items are being stored locally
  • Testing:
    • Test the database setup to ensure it functions correctly when offline
    • Validate that food items are correctly saved and retrieved from the offline database
    • Test syncing functionality, including conflict handling
  • Documentation:
    • Document how offline food items are stored and synced with the server
    • Provide instructions for users on how to add and manage offline food items

Technical Considerations:

  • Consider using SQLite or Realm for the lightweight database (whichever fits the app’s performance and storage needs)
  • Ensure the database is simple to manage, with minimal storage overhead for offline use
  • Handle syncing efficiently when the app goes online, particularly with large amounts of data

Acceptance Criteria:

  • Users can add and store food items locally when offline
  • The database is accessible for adding, viewing, and editing offline food items
  • Food items can be synced to the central server once the app is online
  • The app gracefully handles data conflicts when syncing local and server data

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions