cookbook icon indicating copy to clipboard operation
cookbook copied to clipboard

Integrate with Nextcloud Calendar to create a meal planner?

Open e-alfred opened this issue 5 years ago • 20 comments

Hello,

this app is quite nice, it would be awesome to make it into a full fledged meal planner by integrating it with the Nextcloud Calendar app to have a complete planner like Mealime (https://www.mealime.com/). Additionally, an Android app would complement this app very well for grocery shopping and planning on the go.

e-alfred avatar Dec 30 '19 12:12 e-alfred

Sounds like quite a bit of work, but an exciting idea nonetheless. @e-alfred do you have experience with meal planners yourself and would be able to help out with the code?

mrzapp avatar Jan 02 '20 11:01 mrzapp

Nice idea!

gruessung avatar Jan 06 '20 08:01 gruessung

I am very interested in this and looked in the code, how about an additional calendar-button in the AppControls.vue for the current recipe that opens a popup similar to the new Event dialogue in the calendar? The event it creates should have a link to the cookbook recipe in the description.

brean avatar Jul 07 '20 20:07 brean

@brean sounds like a good place to start, but we still need someone to write the actual code and submit a pull request :)

mrzapp avatar Jul 09 '20 06:07 mrzapp

Additionally, an Android app would complement this app very well for grocery shopping and planning on the go.

I guess such apps work best if they only know what’s on stock. Is it possible for nextcloud apps to deeply integrate with each other?

Together with an household management app and mobile apps for grocery shopping, which combine both, this could grow into an alternative to https://grocy.info/

basxto avatar Oct 12 '20 03:10 basxto

Basic public calendar write API has been added in nextcloud/server#29188

tcitworld avatar Nov 24 '21 13:11 tcitworld

Simple question: Why not using Polls' backend?

Maybe I misunderstood this request. I thought is was to plan a date by inventing people to a dinner and get a consensus about the date.

dartcafe avatar Nov 26 '21 15:11 dartcafe

I would love to have a Meal Planner option. Click an "Add to Meal Plan" button, pick the date/meal, and boom, Meals Calendar to share with the house.

Eschguy avatar Nov 28 '21 04:11 Eschguy

[Edit: Nothing to see here]

At least creating (but not editing) calendar entries via PHP seems to be possible now according to https://github.com/nextcloud/server/issues/20154

Edit: Just noticed that tcitworld already mentioned it above. Sorry for double-posting

seyfeb avatar Mar 19 '22 21:03 seyfeb

@seyfeb It is. I have done it before for https://github.com/nextcloud/integration_google. Maybe I can help with this part.

MarcelRobitaille avatar Mar 19 '22 22:03 MarcelRobitaille

I think many would like this feature, looking at the hearts and thumbs-up emojis of the initial post in this issue. A new API endpoint and some frontend changes would be required and also the content of the calendar entry would need to be defined. For the API part I would suggest to get input from @christianlupus since he is/has been bringing the API to a clearer structure

seyfeb avatar Mar 19 '22 22:03 seyfeb

Here is a workflow to consider either within Recipes App or in a new Meal Plan App:

  • Select a recipe, assign it to a date/time, and meal type (breakfast, lunch, dinner, snack, app, dessert, etc).
  • This adds the recipe to the calendar with meal preparation/cooking time calculated based on the recipe time, calculated backwards from the meal time. (example: dinner at 6pm, with 1 hour prep/cook adds a 5-6 block on the calendar.
  • Also adds the recipe ingredients to a shopping to do task list
  • Includes some sort of recommendation based on popular meals, recommendations, meals not made yet, etc.
  • The App would also show note any missing meal slots upcoming to remind the user to add a meal. The user can also select a "no meal" option to clear the notice

rafny avatar Nov 10 '22 16:11 rafny

OK, let me ask a few questions, so I might get a cleaner picture and we might have a chance to get that eventually working.

Questions for the OP and others requesting this feature

@rafny, you want to add the appointment to an existing calendar or have the app to create a dedicated calendar for this issue? Accessing an existing one might be simpler...

The meal types (breakfast, lunch, ...) are pre-defined or user-configurable? Every day in the same time slot (maybe different on weekends)?

By task list you mean a task (as a calendar task) or a list in a notes file? If calendar tasks: One would have to either have another calendar to register all the shopping tasks to or use the same calendar as for the meal planner itself. When would you like a new task to be created? Once the old one is marked as done? If you mean file: Can the file be completely overwritten without taking into account any other things on it?

Maybe we can separate the concerns a bit and you post that part of your request in #460, @rafny? Thanks!

Questions on implementation

@seyfeb and @MarcelRobitaille the calendar integration might be feasible. The question would be what parts we need to store in the app (database) to keep track of the meals. I would rather avoid parsing the calendar entries and try to guess what was what. This means, however, that we duplicate some data in the database (not too much of a problem to store a few bytes per day).

Are we on the same page, here? So, the calendar would be accessed and managed in the backend and the frontend keeps just calling internal API requests? Or did I misunderstand your intention?

christianlupus avatar Nov 11 '22 19:11 christianlupus

Probably it would be a good idea to start with predefined meals (breakfast, lunch, etc.) in the first iteration, but keeping in mind that the structure should be build to support any number of user-defined meal types in the future.

I think it makes sense to store a reference to the calendar entry and the meal type in the cookbook part of the database. One can still add the meal type in the description of the calendar item, but editing this in the calendar entry manually then would not break the identification of the entry.

According to the issue updating and deleting calendar entries via the API is still not possible, only creating(?)

Edit:

A dedicated calendar may be best since this can be shared among users/family members without having to share their personal calendars. Maybe on app installation, it creates the calendar that is managed directly.

Reading this statement in #460 , let me add: When storing info in the database regarding the created meals, we should also keep in mind a multi-user meal-planning scenario, i.e., multiple users (e.g., a family) planning the meals for the week together, everybody with his/her own account.

seyfeb avatar Nov 11 '22 20:11 seyfeb

I pushed this out just hours ago: https://github.com/nextcloud/documentation/pull/9326

This allows to circumvent the problem with the missing features in the core.

christianlupus avatar Nov 11 '22 21:11 christianlupus

For the first iteration, I'm not sure we would even need pre-defined meal types (breakfast, lunch...). I think just being able to add a meal to a calendar (with a link back to the cookbook app) would be sufficient since we can rely on Nextcloud tags to indicate the type for now.

Ideally i think it would be best to have a separate "cookbook" or "mealplan" calendar that has an associated task list that can then be synced to any caldav client. Optionally the user should be able to add the recipe ingredients to the task list. I see a few options for creating the tasks:

  • Create Separate task for each needed ingredient
  • Create single task for each recipe
  • Create single task for each recipe but create sub-tasks for each ingredient (I'm not sure if subtasks are possible in the back-end caldav implementation or only in the nextcloud client)

meichthys avatar Nov 11 '22 21:11 meichthys

@christianlupus

The question would be what parts we need to store in the app (database) to keep track of the meals. I would rather avoid parsing the calendar entries and try to guess what was what. This means, however, that we duplicate some data in the database (not too much of a problem to store a few bytes per day).

I agree completely with this.

MarcelRobitaille avatar Nov 11 '22 22:11 MarcelRobitaille

To properly manage calendar entries, created by Cookbook, I could imagine using custom iCal properties, such as X-NEXTCLOUD-COOK-MEALTYPE could work…

This would allow to not only push new items to the calendar, but also to manage existing ones.

eliasp avatar Nov 12 '22 00:11 eliasp

This is turning into a game-changing idea!

* This adds the recipe to the calendar with meal preparation/cooking time calculated based on the recipe time, calculated backwards from the meal time. (example: dinner at 6pm, with 1 hour prep/cook adds a 5-6 block on the calendar.

Building on this:

  • A break-out to a tasking app (Cards)?
    • A frozen ingredient needs to be taken out of the freezer between X and Y hours prior to cooking. Cards has a "due time" down to the minute (the "Y" time); in this workflow the task would need to be generated at the "X" time to not pollute the "upcoming cards" section (or spoil food by doing something too early!)
    • Some recipes have leave-alone gaps (Simmer for 4 hours, chill overnight). If a dedicated cookery calendar is used this may not be a problem, but if an existing day planner calendar is filled in then having the intermediary hours blocked may not be the best. (This is leading very far for a niche use-case?)
* Also adds the recipe ingredients to a shopping to do task list

#460 seems very exciting!

* The App would also show note any missing meal slots upcoming to remind the user to add a meal. The user can also select a "no meal" option to clear the notice

For me a separate "meals/cooking" calendar would solve this in a way compatible with the rest of my planning: scroll through the week, notice the gap and go to Cookbook to fill it.

Mousketeer avatar Dec 03 '22 09:12 Mousketeer