nextcloud / cookbook

🍲 A library for all your recipes
https://apps.nextcloud.com/apps/cookbook
GNU Affero General Public License v3.0
536 stars 93 forks source link

Integrate with Nextcloud Calendar to create a meal planner? #127

Open e-alfred opened 4 years ago

e-alfred commented 4 years ago

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.

mrzapp commented 4 years ago

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?

gruessung commented 4 years ago

Nice idea!

brean commented 4 years ago

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.

mrzapp commented 4 years ago

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

basxto commented 4 years ago

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/

tcitworld commented 2 years ago

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

dartcafe commented 2 years ago

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.

Eschguy commented 2 years ago

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.

seyfeb commented 2 years ago

[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

MarcelRobitaille commented 2 years ago

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

seyfeb commented 2 years ago

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

rafny commented 1 year ago

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

christianlupus commented 1 year ago

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?

seyfeb commented 1 year ago

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.

christianlupus commented 1 year ago

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.

meichthys commented 1 year ago

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:

MarcelRobitaille commented 1 year ago

@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.

eliasp commented 1 year ago

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.

Mousketeer commented 1 year ago

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:

* 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.

stevoovets commented 1 month ago

Please! This would be an amazing enhancement. Great ideas!