Value calculations
This is triggered by the DLT4EU grant to create a small additional feature that will make use of ReflowOS and CommonsPub. The users are the Amsterdam pilot of Reflow, which deals with circular economy focused on textiles.
There are 2 proposed sets of requirements, pending further discussion with the user group:
- One is creation of tokens that can be used locally, or documentation of ecological benefits, in return for an agent's donation.
- The other is a more complete value equation scenario, where when income is received, some of it is passed down to contributors to the creation of the resources that brought in the income, including donating citizens.
Both of these options actually will rely on the feature of claim calculation, which I am proposing be the scope of this effort, with the actual payments later. This will involve:
- Adding Claim to the database and graphql api, with basic CRUD and whatever else is standard.
- Creating a way to configure formulas that can be used to calculate a claim when an economic event is logged. (This is the lowest level piece of a larger "value equation", which would also have definitions to find all the relevant claims to be balanced and paid.)
- Would include some "filter" elements, like ResourceSpecification, scoping Agent, Action, maybe others.
- Would include user ability to write a formula with basic math symbols and a set of pre-defined variables involving quantity and quality.
- Would need a very simple UI so users can do this.
- Adding missing variables (quality variables for sure) to the economic events that record contributions into the textile circular economy. Might be some configuration involved?
- This might be best implemented by creating quality variables as separate measurements, rather than including in the event. We've had some discussion before on that, and could create a simple implementation of something like "measurement events" for a resource. And this separates the feature more completely.
- Very simple UI to enter economic events for demoing. (?)
- Creating a Claim when an economic event is saved, and a matching claim formula is found. (It would be nice if Elixir has a facility where you can take the formula as a string and make it "code". But in any case, some way to execute the formula with the appropriate variables.)
- Add Claim to the federation code and api, if needed. (placeholder, as I'm not familiar with that code)
- Making the whole feature configurable at some level so that it is an optional add-on.
- Ability to query the claims created, to demonstrate the backend functionality. (graphiql or LiveView?)
- Test. Regression test with the feature configuration turned off.
An additional thought: If there is time left over within the grant, a possible next piece could be to query a trace of incoming value flows to a resource, reading the claims also, to show an accumulated "cost", at least of the contributions that are claimed.