Ameobea / orange3

Orange 3 data mining suite: http://orange.biolab.si
Other
1 stars 0 forks source link

Daily Progress Updates #1

Closed ameo-unito-bot closed 8 years ago

ameo-unito-bot commented 8 years ago

┆Issue is synchronized with this Asana task

Ameobea commented 8 years ago

I started off the project by creating the framework for the script export pipeline. The first thing I did was add a script export button to the File menu which brings up a file selection dialogue so that the user can pick where the exported file will be saved.

After that, I created some internal functions that pass the export process off to an internal schema function. This function converts the Directed Acyclic Graph which represents the connections between the widgets in the schema into a linear set of steps which can be followed to calculate the nodes in an order where all dependencies are met in time for widgets that depend on them.

I used a modified breadth-first search that starts with all nodes in the graph that have no parents (dependencies). The children of each of these are added to the output list as soon as all of their dependencies are met, with the search moving on to the next parent once all children are checked. This continues until every node in the graph has been added to the linear processing schedule which is returned to the main export pipeline function.

Ameobea commented 8 years ago

After implementing the basis for the topographically sorted linear version of the directed acyclic graph represented in the schema, I moved on to creating the architecture for the code generation pipeline.

For now, I've decided to split generated code into three categories: Preamble, header, and body. The preamble goes above all module code at the beginning of the script and contains stuff like module imports, constant initialization, etc. The header comes before the main widget code but in the order of the linear topology. It contains stuff like local variable and environment initialization for the main widget code. The main widget code is located in the body and is inserted in order after the header.

It's possible that I'll add or remove sections in the future depending on the needs presented by the individual widgets I convert, but for now this seems like a good starting point.

I also put some thought into methods by which I can manipulate and make static the widget's core code, much of which is nested deep into Orange code. I recorded these ideas in a text document: https://ameo.link/u/bin/2ht

It's clear that creating a robust code generation engine will be a challenge without resorting to raw string manipulation and other messy and arbitrary methods. However, I believe that I've made a good start and set a strong foundation for future work in this first day of coding on the project.