msupply-foundation / conforma-server

Conforma application manager (IRIMS) back-end
GNU Affero General Public License v3.0
4 stars 1 forks source link

Update evaluator to V2.0 #1001

Open CarlosNZ opened 1 year ago

CarlosNZ commented 1 year ago

I have re-built the expression evaluator from scratch for my own project, and it's a lot more powerful, well organised and designed, and it should be 99% backwards compatible (so existing expressions continue to work without re-configuring):

https://github.com/CarlosNZ/fig-tree-evaluator

At some stage it'd be good to move conforma over to use it, but that'll take a bit of time to refactor (though hopefully with no config changes), so only when we have time.

However, some of the features might be useful for handling the Medsafe data lookup and pre-filling the list builder. I'm not sure yet, so I'm just flagging this as a "Maybe" until I get further into it and decide if it's necessary. (Not necessary for now)

In particular, the features that might be helpful:

Steps for migration

CarlosNZ commented 1 year ago

Not required for Medsafe, leave for longer-term upgrades

CarlosNZ commented 1 year ago

Speaking of Fragments -- let's start a list of common evaluator expressions that we should define as Fragments in the system (please edit this list):

CarlosNZ commented 1 year ago

alias to "responses" object (with parameter just the code/path of required response value)

One additional bonus of doing things like this is that we'll be able to standardise the expression syntax between the front and back-end. Currently there is some discrepancy in the paths to applicationData values, but we can hard-code this into the Fragment definitions (differently for each) and then we can use the same expression syntax for both in actual configs.