Open thorwhalen opened 2 years ago
take_06_model_run
We now have tools for persisting stores to be used in crude. See that in the demo, when you run a model (and specify a name), it will save the results in a persisting store (in dill files placed in a temp folder of the filesystem)
The task is to write streamlit apps of growing complexity to build up (and later demo) the CRUDE GUI tools (aka "Flat Navigation Dispatch"). (CRUDE is for CRUD + Execution).
The following are (or are planned to be) in
examples/crude/
:take_01_salary.py
: A simple app to demo the use of Mappings to handle complex typetake_02_salary.py
: Like take01, but using i2.wrapper to transform the functiontake_03_salary.py
: Like take02, but wheresalary
key entry is done via a selectboxtake_04_model_run.py
: An example of how to transform (manually) a function that runs some data through a model (both too complex to enter directly and explicitly in forms) into a streamlit dispatchable function that uses a store (a Mapping) to manage complex data.take_05_model_run.py
: Same as take_04_model_run, but where the dispatch is not as manual.Flat Navigation Dispatch
front
issueCopied from front issue#12.
The design pattern I'm proposing is that when you need to dispatch a function like
where learner and data are complex python objects, you do it by creating three components:
The CRUD components are made of two parts
Sometimes the creation will itself require some complex object inputs. For example, the case of model in: run(model, data) But a model is just the output of
train(learner, data)
, so we fall back on the train component, which in turn relies on the learner and data components.The GUI navigation that the use of this pattern enables is "flat" in the sense that the process structure is less of a tree or DAG, and more of a "choose your action, and if the inputs you require don't exist, go choose the action that will make these inputs available".
This flatness may or may not be desirable from a UX point of view, but is certainly desirable from an architectural simplicity point of view, and we can get a great bang for the buck as far as component reuse.
Any code that appears in this form:
can be dispatched to such a "flat GUI" dispatching
get_data
,prep1
,prep2
anddo_something
functions, after wrapping these in a "dispatchable" form that uses stores to both solve the complex data entry problem and the action/navigation order problem. The store keys play the role of intermediate variables in the python code above.Code example
A function such as:
would have a dispatchable form (automatically created by wrappers) as such: