Store excel formulae for calculated intervention data rows/cells #351
Labels
2023-Sprint-1
area::costings
Related to costs of micronutrient programs and internventions
Priority::1
User story that we want to focus on
Whilst the definitive values for the intervention calculations should be the ones in the database (re-calculated on updates to the individual values in
intervention_data
via @andy-bevan's script, we should also encode the relationships in a manner that they can be sent to the front-end.This will allow (for example), fields that contain totals to be updated in the UI on the fly when values are updated (multiplying no. of factories by number of inspections etc).
To facilitate this, the intention is to utilise jsonLogic (http://jsonlogic.com) to encode the relationships in a format that can be sent in the API response and parsed and calculated on the front-end. @bgsandan has already managed to demonstrate a proof-of-concept of automatically converting an Excel formula e.g.
=(D57+D60+D63)*D73+D70*D74
into its jsonLogic representation which can then utilised in the front-end:If the database can store the input formulae for fields with field types of
totals
orcalculatedvalues
then these formulae can be exposed in the appropriate views allowing this conversion to jsonLogic to be handled at the API layer.See https://kwvmxgit.ad.nerc.ac.uk/-/snippets/125 / https://kwvmxgit.ad.nerc.ac.uk/-/snippets/126 for more info
The text was updated successfully, but these errors were encountered: