Breaking out from T385540: we need to decide whether to allow transforms to be specified on the {{#chart:}} invocation directly, or only via the Data:.chart JSON itself. Secondarily we need to decide on the syntax to use in each place.
(earlier versions of this task referred to "filters", we have gone with "transforms" as it's more general and lets us reserve the term 'filters' for possible formatting extension use later.)
Decision point 1:
- Is there only a single transform called, or do we allow a chain of multiple transforms?
- _Outcome_: provisionally going for a single transform, which can load and call other functions if it wishes
Decision point 2:
- We _will_ definitely have a place to invoke a transform in the Data:.chart JSON.
- Should we also allow specifying a transform on the parser function invocation?
- If we have both places but a single transform, is that an override?
- _Outcome:_ allow arguments to be overridden by the invocation, but not the transform itself. That lives as part of the format definition.
Decision point 3:
- What syntax should we use in the JSON?
- _Outcome_: provisionally, "transform": { "module": "Module_name", "function": "function_name", "args": { "arg1": "val1", "arg2": "val2" } }
- What syntax should we use for args in the parser function, if allowed?
- _Outcome_: provisionally, {{#chart:Foo.chart|arg1=val1|arg2=val}}
- Should we exclude data, width, and height used by {{#chart:}} itself, or pass them through?
Decision point 4:
- Do we need to support null values in tables? This is awkward with the PHP-JSON<->Lua bridging and also needs specific support in the Charts renderer anyway (cf T384341)
- _Outcome_: UNDECIDED. need to check on this still!
- Recommend doing a spike test with a sigil replacement to make sure it works cleanly.
Decision point 5:
- How should transforms be exported via the action API? Since this will be used to do the fetching it must be able to provide timestamps and dependencies for cache invalidation.
- _Outcome_: Provisional example in the ADR in progress on the patchset.
- extend action=jsondata with transform parameter, and add metadata to that data set
As this gets tested out on T388434, dropping the ADR into Chart:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Chart/+/1130651