How to implement the business logic (e.g. emission calculation and aggregation)?
Options include:
- Try to implement everything in the Postgres-DB using FUNCTIONs and TRIGGERs
- Probably not a great idea since this will be hard to maintain
- Use Hasura's events to trigger business logic
- Create a flask-based python docker image that has all the business code (or any other similar technology)
- Would also maybe work with serverless functions on some platform like AWS, Azure, GCP etc.
- Make Hasura call the business logic using event trigger based on database changes, e.g. when values in time series are updated
- Use GraphQL subscriptions to monitor database changes and then react as needed
- Could use something like https://gql.readthedocs.io/en/latest/usage/subscriptions.html