Generate time slots for an online doctor appointment system, is it good or terrible?

Hello everyone
I’m working on a doctor appointment booking system and I have:

  1. Schedules Model: to store doctors’ scheduled day of the week, start time, and end time
  2. Appointment ModeL: to store doctors’ available dates for booking based on their schedules
  3. TimeSlot Model to store available time slots of each appointment
  4. Reservation Model: to store booked appointments

Here is my question: Is it a bad idea to precompute doctors’ available dates and times in a background task using the Postgres generate_series() function and store them in the database?

If it is a bad idea what approaches would be better?

My concern is data storage volume. For example, if I want to have 1 million reservations, I have to store 1 million time slots as well.

First, I need to mention that this really isn’t a Django-related question. This isn’t even a data modelling question as you already have your models defined.

This is more of a business-process / system architecture issue, and really isn’t a suitable topic for this forum. (The answers you appear to be looking for wouldn’t be any different if you were building this on Drupal, Liferay, or even SharePoint instead of Django.)

Most importantly, if you’re really working at the scale that you are talking about here, there would be many factors involved in these kinds of decisions concerning the usage of this data - the types, numbers, and frequency of queries being made - requiring a greater depth of knowledge about the overal system than what can be reasonably covered here.

If this is actually a commercial endeavor and not just an academic exercise, I suggest you hire the appropriate expertise to help guide you through this.

1 Like

Thank you Ken
You’re right.