Skip to content

UserPantryItems

Barney Boisvert edited this page May 19, 2024 · 5 revisions

User Pantry Items

Initially, the idea was to move towards shared pantry items. It's now morphed to include nutrients (specifically Calories) per item to compute recipe (and then plan) values.

First

  • ❌ add optional plural name to data model; missing means "add an 's'"
  • ✅ add synonoym collection to data model w/ unique key
    • name and plural name should be aliases, for one-stop query-by-name, but filtered out when showing the aliases to a human
  • add flag for "stocked_staple" items, which should always be auto-acquired when planned (e.g., water)
  • add an fdcId (point-in-time datapoint id) plus ndbNumber (foundation) and gtinUpc (branded) to eventually ref FoodData Central (https://fdc.nal.usda.gov/)
  • add per-pantry-item unit conversions between volume/mass/etc
    • 1 c celery is XXX grams
    • share/reuse across classes of related items in some form or another?
  • add per-pantry-item unit conversions for units that are specific to the item
    • 1 rib celery is YYY grams
    • 1 each is ZZZ UUU
  • add per-pantry-item nutrient info
    • which nutrient
    • how much of it (quantity/unit)
    • per (quantity/unit)
  • GraphQL queries/mutations for administration (developer-only)
    • ✅ list of items (relay?!)
      • ✅ filter by name/alias/label
      • ✅ order by name, use count, first use
      • ✅ client or server?
    • ✅ set name /plural name
      • ✅ old names should be auto-added to aliases
    • ✅ add/remove aliases
    • ✅ add/remove labels
    • add/remove unit conversions (both types?)
    • combine items
      • ✅ restate all recipes
      • ✅ combine alias collections
      • unit collections?
        • what if they are inconsistent?!
  • ✅ admin UI (developer-only)
    • it only need work, not be good

Then

  • clean up pantry items
  • use a "seed item" label in the admin to identify pantry items which will be part of the seed items
  • create a seed user, in some fashion we can impersonate-ish
  • add unique key to pantry item aliases
  • update IngredientService's querying to use the aliases
    • still need recipes-by-name, of course

Later

This part is still fairly nebulous...

  • new UserPantryItem for all user-specific stuff
  • populate the seed user w/ the seed
  • update the graphql resolvers to operate "through the user lens"
    • administrative GraphQL fields
    • IngredientService's querying
  • tune the seed (as the seed user), if needed
  • hook user creation to duplicate the seed from the seed user
  • seed existing users from the seed user
  • add additional per-user records for each user's in-use pantry items
  • remove developer-only admin restriction

Finally

  • user's first use of item known to another user should suggest copying "stuff"
  • promote user stuff to shared/seed

Clone this wiki locally