wildlife-dynamics / ecoscope-workflows

An extensible task specification and compiler for local and distributed workflows.
https://ecoscope-workflows.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
4 stars 2 forks source link

In app template, parse params from nested to flat #278

Open cisaacstern opened 1 week ago

cisaacstern commented 1 week ago

277 introduced the notion of a nested or flat view of the jsonschema. The former uses task group nesting, and is intended for user-facing configuration (i.e. RJSF on the frontend). The latter is the used for actually running the workflow, and is the internal representation. See:

https://github.com/wildlife-dynamics/ecoscope-workflows/blob/3963bb265310d6b8315330352ff498dfbce8fa43/src/ecoscope-workflows-core/ecoscope_workflows_core/compiler.py#L821-L823

Right now, all of the testing uses parameters that are already in the flat view. But when we start accepting actual user-defined parameters from the frontend, they will come in as nested objects. Therefore, we should have a way to translate from nested to flat, here:

https://github.com/wildlife-dynamics/ecoscope-workflows/blob/3963bb265310d6b8315330352ff498dfbce8fa43/src/ecoscope-workflows-core/ecoscope_workflows_core/templates/pkg/app.jinja2#L63-L64

cisaacstern commented 1 week ago

This parsing should support flat params, nested params, and mixed flat/nested params, and it can tell which properties are task groups because those property names are not in the set of values of this dict:

https://github.com/wildlife-dynamics/ecoscope-workflows/blob/3963bb265310d6b8315330352ff498dfbce8fa43/src/ecoscope-workflows-core/ecoscope_workflows_core/compiler.py#L446-L450

(This is compiler information that we will need to encode in the generated package somehow/where.)