dimanche 17 octobre 2021

System & database design and for dynamic dashboard specified from-to and aggregation unit

I want to create a dynamic dashboard app that shows a line graph and its summaries such as total and average.

User inputs on the application are

  • date range e.g) from 01/10/2021 to 17/10/2021
  • aggregation unit e.g) chose daily, weekly, or monthly. The X-Axis will be based on this.

I have a database table like the following in a relational database as the minimum unit is on a daily basis.

user_id | date       | spent
-----------------------------
1       | 01-10-2021 | 10000
1       | 02-10-2021 | 100
1       | 03-10-2021 | 5000
1       | 04-10-2021 | 2300
...

I have a backend program that retrieves and aggregates the data based on a date range and aggregation unit called by front. However, when the data is big, it takes a lot of time every time users change their parameters.

I thought I could make a scheduled program for aggregation and store the result into a NoSQL database to make an idle time shorter. However, as I let users change the aggregation unit, I can't go for this solution.

Is there any better system and database design as a solution? It doesn't need to be in real-time by the way.

Aucun commentaire:

Enregistrer un commentaire