MPH-Bali / green-village-project

Powering MPH recycling and composting facilities in Bali
MIT License
9 stars 8 forks source link

Cloud function - Public Facing Data (proposal) #16

Open JollyBrackets opened 6 years ago

JollyBrackets commented 6 years ago

For the public facing part where charts are display I propose to work with pre-aggregated data instead of querying the database for everything.

Therefore I would propose the following approach:

  1. Write firebase-function with time trigger (e.g. daily) to run aggregate queries
  2. Store the output/data in a daily-data-.json file on firebase storage
  3. Pull that file in the public facing app

This should increase performance (thanks to CDN), reduce server load and make the security rules simpler.

piggydoughnut commented 6 years ago

sounds swell :)

do we have a list of graphs/charts and values that we are displaying?

what charting library did we choose? @ejohnst2 so I can store the data in the correct format straight away?

JollyBrackets commented 6 years ago

@nicksarafa good question by daria, do we have the exact requirements for the charts/graphs?

@piggydoughnut most likely we're going to use chart.js. I built an exmaple in the latest PR, see here.

nicksarafa commented 6 years ago

@JollyBrackets we don't have exact requirements for the charts/graphs. we currently have 3 firebase cloud functions talking to our front end chart implementation

nicksarafa commented 6 years ago

we have a proof of concept init and need more live graphs

nicksarafa commented 6 years ago

we have to define our charts/graphs and public reporting to continue working through this feature. we currently have a couple of live graphs and a lot of other under developed ideas for graphs and reporting. our metrics should align with the UN metrics