Programmatically generate requirements for analysis
jordanperr opened this issue · 1 comments
jordanperr commented
We would like to be able to use the analysis_requirements to generate a query for the ENTR warehouse. This works now if you're only using required columns, but becomes tricky when you want to use optional columns. The problem is that the use of optional columns are dictated by the arguments provided to the analysis, and these may not be known at the time the PlantData is created. I propose adding an "Analysis.generate_schema()" method to analysis classes, which generates the requirements dictionary on-the-fly, based on the arguments provided to init.
Old Workflow:
plant = PlantData.from_entr("La Haute Borne", analysis_type="MonteCarloAEP")
pa = MonteCarloAEP(plant, arg1="foo", arg2="bar")
pa.run(arg3="baz")
Proposed Workflow:
pa = MonteCarloAEP(arg1="foo", arg2="bar")
plant = PlantData.from_entr("La Haute Borne", schema=pa.get_schema())
pa.run(plant, arg3="baz").