pygwalker icon indicating copy to clipboard operation
pygwalker copied to clipboard

Undo, Restore state, Generate code from GUI interactions

Open westurner opened this issue 1 year ago • 6 comments

Generate code from GUI interactions; State restoration & Undo

  • https://news.ycombinator.com/item?id=26384396 (bamboolib author)
    • https://github.com/mito-ds/monorepo
    • https://github.com/tkrabel/bamboolib
    • https://github.com/man-group/dtale#predefined-filters
    • from https://docs.trymito.io/getting-started/overview-of-the-mitosheet :

      Generating Pandas Code For each edit you make to the Mitosheet, Mito generates pandas code below that corresponds to this edit, and puts this code directly below the mitosheet in the next code cell.

      Rerunning an analysis When you run mitosheet.sheet(), Mito will automatically generate a unique ID to store the set of edits make to this mitosheet. This ID will appear as an automatically generated analysis_to_replay parameter to the mitosheet.sheet() function call. As long as you pass this analysis_to_replay parameter to the mitosheet.sheet() call, Mito will attempt to replay that analysis to the mitosheet. Replaying an analysis means applying the same edits that you did in Mito again. Since Mito will try and apply the same edits when an analysis_to_replay parameter is passed, differently structured datasets might make these edits invalid and Mito will error. For example, if you change the location of the file that you imported in an analysis, and then attempt to replay this analysis, it will fail (as it can no longer find the file to import). If you want to start a fresh mitosheet, simply make a new mitosheet.sheet() call in a new code cell.

westurner avatar Mar 27 '23 02:03 westurner

With RTC, who clicked what in order to replay the series of (reversible) transformations is probably somewhat helpful:

  • https://jupyterlite.readthedocs.io/en/latest/howto/configure/rtc.html
  • https://github.com/jupyterhub/zero-to-jupyterhub-k8s/issues/2488#issuecomment-1452569524
  • https://github.com/jupyterlite/jupyterlite/issues/464
    • git
    • GDrive,
  • ~~https://github.com/jupyterlab/rtc~~
    • https://blog.jupyter.org/how-we-made-jupyter-notebooks-collaborative-with-yjs-b8dff6a9d8af
    • Y.js CRDT
    • https://github.com/yjs/yjs
    • https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type
    • https://github.com/manics/jupyterhub-rtc-example

westurner avatar Mar 27 '23 02:03 westurner

Generate code from GUI interactions; State restoration & Undo

* https://news.ycombinator.com/item?id=26384396 (bamboolib author)
  
  * https://github.com/mito-ds/monorepo
  * https://github.com/tkrabel/bamboolib
  * https://github.com/man-group/dtale#predefined-filters
  * from https://docs.trymito.io/getting-started/overview-of-the-mitosheet :

Thanks a lot! This feature sounds cool, I'll try to make it work.

Asm-Def avatar Apr 07 '23 02:04 Asm-Def

This has been on my wishlist since discovering pygwalker - glad to see this issue opened.

I haven't clicked through on all the links above, but I'd love if we could just point to a file store:

gwalker = pyg.walk(df, store="myfile.json")

In the UI there would then be a save button (optionally auto-save) that saves the current config to this file. When restarting the notebook kernel and rerunning the cell, the UI would then be repopulated with saved state. Undo/Redo is nice-to-have.

My utopia would be that this stored file/dashboard can then also be easily be imported into a standalone Graphic Walker instance, so the dashboard can then be shared with non-analysts in the team. In this case, the user should be able to replace the data source with one that's available on the standalone Graphic Walker.

jorisroovers avatar Apr 12 '23 12:04 jorisroovers

Hi @jorisroovers, the latest version of pygwalker supports you to export the chart config in the UI, you can be repopulated by this way.

Pygwalker team is also exploring some more friendly ways to export and repopulated recently.

longxiaofei avatar Jun 26 '23 14:06 longxiaofei

@longxiaofei I believe that feature has been there for a while no?

My suggestion is slightly differently, as it would auto-restore any charts when re-running a notebook. This repeatability aspect without additional actions is key IMO.

jorisroovers avatar Jun 27 '23 09:06 jorisroovers

@jorisroovers I agree with your suggestion, we will add this feature in next version.

longxiaofei avatar Jun 27 '23 09:06 longxiaofei

@jorisroovers Hi, this feature has been added.

You can try the pre-release version first.

pre-release 0.2.0: here

Also look forward to your feedback, Thanks♪(・ω・)ノ

longxiaofei avatar Jul 12 '23 13:07 longxiaofei

Thanks!

westurner avatar Jul 25 '23 18:07 westurner