Green-Software-Foundation / if

Impact Framework
https://if.greensoftware.foundation/
MIT License
134 stars 37 forks source link

Design a generic `subtract` plugin #672

Closed zanete closed 3 weeks ago

zanete commented 1 month ago

Sub of: #656

What Create a new generic subtract plugin in 'if-plugins`

Why We want to support as many pipelines as possible using generic plugins that can be adapted to many use cases. We currently have sum, multiply, coefficient. We also need to support subtract. As a user I want to be able to execute any arbitrary logic using if plugins.

Prerequisites/resources None

SoW (scope of work)

Note the plugin code can be copied from the sum plugin and modified to subtract rather than add.

Acceptance criteria

jmcook1186 commented 1 month ago

@zanete @pazbardanl please take a look at the ticket - I consider this ready to work on.

zanete commented 1 month ago

@jmcook1186 , that's awesome, very quick work! All of the scenarios make sense apart from the first one. Perhaps this is because I'm really new to the framework and have n't used it myself, I'm a bit confused about what you'd expect to happen. I'd recommend phrasing it so that the Given is a precondition, When is the trigger and Then is all that happens, for example: Given A User has downloaded and installed if and if-plugins When User executes a pipeline that contains subtract Then The framework subtracts any parameters ... etc,

You could even be more specific about the use of the subtract and add multiple pipeline examples in a table and the corresponding outputs you expect. This would show a few ways you'd envisage the plugin to be used and what the behaviour for each case should be e.g. Given A User has downloaded and installed if and if-plugins When User executes the pipeline defined in the table Then The framework outputs the results as defined in the table for the corresponding row

ID Pipeline Results
1 pipeline 1 results 1
2 pipeline 2 results 2
3 pipeline 3 results 3

cc @pazbardanl @jawache

pazbardanl commented 1 month ago

hi @zanete / @jmcook1186 can i get a hint / pointer on this: documentation is added to if.greensoftware.foundation which repo is that? thanks :)

jmcook1186 commented 1 month ago

Hi @pazbardanl you can add dosc to if.greensoftware.foundation by raising PRs against the if-docs repo (https://github.com/Green-Software-Foundation/if-docs). All that is required there is to add the link to the plugin README file on https://if.greensoftware.foundation/reference/plugins following the format of the other plugins.

jawache commented 1 month ago

Thanks for this @pazbardanl, great work.

And @zanete that's a great idea, generally I think it's good for plugin ACs to just be manifest files that people can run so there is no ambiguity, but if there are lots of edge cases it can save a lot of time if it's just a table, given this manifest file, if you replace the values according to those in this table then it should output the last col etc...

zanete commented 3 weeks ago

@manushak please review