Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odyssey State Serialization #222

Open
4 tasks done
jaelafield opened this issue Nov 25, 2024 · 8 comments
Open
4 tasks done

Odyssey State Serialization #222

jaelafield opened this issue Nov 25, 2024 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@jaelafield
Copy link
Contributor

jaelafield commented Nov 25, 2024

Allow users to download and upload Odyssey state data to enable them to save analysis progress and resume. First step towards long term goal: external state (database)? Odyssey analysis sharable by link.

Feature components:

  • button to dump global values into an object and copy/download JSON
  • button to upload JSON file and load values, set all relevant globals

Steps (not necessarily in order):

  • UI component planning & implementation (probably want button in header bar, likely to open a pop up with download/upload options similar to server pop up. Do we want something on the spec entry page also? An upload option there may make more sense.)
  • Determine essential state to download, organize into JSON. (May reveal opportunities to organize state differently/remove unneeded components? Users don't need to understand JSON, but it'd be good if it is reasonably concise and organized --better look for us for sure.)
  • Implement JSON download/copy
  • Implement Odyssey initialization with JSON upload
@jaelafield jaelafield added the enhancement New feature or request label Nov 25, 2024
@jaelafield
Copy link
Contributor Author

Expected challenges:

  • Lots of state depends on each other
  • States are not plain JSON objects --> need to be able to turn JSON into (interconnected) states

First thing to try:

  • Directly setting a few global variables (spec maybe to start)
  • With set of expressions, JSON serializing that, try editing expression in the file, then uploading to see how that change handles it.
  • Try setting spec & set of expressions
  • Does react have a way to do this? Pause rendering until more states are set so it isn't temporarily broken. --> Batching updates

@jaelafield
Copy link
Contributor Author

Have a basic implementation working with a subset of states! Goal is to get rest of the state accounted for by the end of the week (meaning sufficient state can be exported then imported to replicate the page fully).

Things we may not get too before the start of next quarter:

  • error checking for import
  • file import/export instead of copying & pasting text
  • UI finalization (need feedback for that, but once we get it it should be very quick)

@jaelafield
Copy link
Contributor Author

Ben has been working on this this week! We will try to pair soon to keep it moving, if needed.
Would be nice to try to demo it Monday!

@benwang33
Copy link
Contributor

More hacking and pair programming tomorrow!

@benwang33
Copy link
Contributor

Rendering bug fixed, pushed to branch!

@jaelafield
Copy link
Contributor Author

We have successfully (🤞) added all needed state to reproduce a view of Odyssey to the import/export process, except for the selectedPoint. Steps to implement this:

  1. Add it to the export state: add the selected point context to the file, and add the selectedPoint to the state object in stateToJson
  2. Set it on import: after setting the spec and expressions in jsonToState, set the selected point (jsonState.selectedPoint)

After this, I assume there will be a problem because currently the selected point is set to undefined anytime the spec changes. We want this behavior in the general case so a user can change the spec, then return to the main page with a fresh view (no lingering artifacts from their last spec). But in this case, we want the new spec and the new selected point to both be maintained.
--> If this is in fact a problem, it can likely be fixed by moving the point where the point is set to undefined (maybe on "submit") instead of having it be a useEffect. If that seems tricky to decide, or that doesn't work, the unsetSelectedPointAndExpression function can be temporarily commented out to just test the import on its own.

Another bigger picture issue to think about later is that if sampling isn't deterministic, the selectedPoint may not exist? anymore for a new session (I'm honestly unsure), but we can put off worrying about that unless this inexplicably doesn't work.

@jaelafield
Copy link
Contributor Author

Ben is working on these ⬆️ steps this week!

@elmisback
Copy link
Collaborator

@benwang33 please take over providing updates on this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants