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

Add URL parameters for the measurements panel options #1815

Closed
6 tasks done
Tracked by #1463
huddlej opened this issue Aug 16, 2024 · 1 comment · Fixed by #1848
Closed
6 tasks done
Tracked by #1463

Add URL parameters for the measurements panel options #1815

huddlej opened this issue Aug 16, 2024 · 1 comment · Fixed by #1848
Assignees

Comments

@huddlej
Copy link
Contributor

huddlej commented Aug 16, 2024

Description

Modifications to the measurements panel display state should modify the URL state accordingly and the measurements panel should set its state on load based on the parameters provided through the URL. This functionality will make the measurements panel behave like the rest of the Auspice panels and allow us to share curated measurement panel views with collaborators and in narratives.

Specific state changes that need parameters include:

  • selected collection (by collection key)
  • grouping (e.g., "reference_strain" or "clade_reference")
  • display mode ("raw" or "mean")
  • toggle to show overall mean/std
  • toggle to show thresholds
  • filters (e.g., reference_strain=A/Stockholm/18/2011 or reference_strain=A/Stockholm/18/2011,A/Wisconsin/67/2005 or serum=TAIWAN/8/2002-MELB)

Design questions

  • Should measurements-specific URL parameters have a prefix like m_ to distinguish them from other panel parameters and avoid conflicts?
@joverlee521
Copy link
Contributor

joverlee521 commented Aug 30, 2024

Braindumping notes for keeping track of what happens in Redux state.

Initial load of a dataset with measurements

  1. changePage calls chooseDisplayComponentFromURL which should return datasetLoader and dispatches action PAGE_CHANGE.
  2. This updates the Redux state general.displayComponent, which triggers a re-render of the MainComponentSwitch.
  3. This renders DatasetLoader the component, which dispatches loadJSONs and another PAGE_CHANGE action to switch to the Main component that displays the dataset.
  4. loadJSONs uses the URL to determine the dataset to fetch then fetches the main dataset JSON and dispatches CLEAN_START action with the state returned from createStateFromQueryOrJSONs.
  5. Within createStateFromQueryOrJSONs, the default measurements state is set by getDefaultMeasurementsState but no measurements controls are set. Other controls are updated with modifyStateViaURLQuery
    • This is where measurements URL prams should be parsed to modify the measurements state/controls !
  6. Once the clean start action is complete, back in loadJSONs, the sidecar JSONs are fetched and loaded.
  7. loadMeasurements is dispatched and the measurements controls are set to the initial state defined in the measurements JSON.
    • This is where previously set measurements state from URL params need be used for initial load of the measurements
    • If any URL params are invalid for the selected collection, then they need to removed.

Changing measurements options should update URL params

  1. All measurements controls are grouped in MeasurementsOptions component, where each option change triggers a different action type:
    • CHANGE_MEASUREMENTS_COLLECTION
    • CHANGE_MEASUREMENTS_GROUP_BY
    • TOGGLE_MEASUREMENTS_THRESHOLD
    • TOGGLE_MEASUREMENTS_OVERALL_MEAN
    • CHANGE_MEASUREMENTS_DISPLAY
    • APPLY_MEASUREMENTS_FILTER
  2. Each action type needs added to changeURLMiddleware to modify the URL params and keep the URL in sync with the measurements options.
  3. Changing the measurements collection will be equivalent to the initial load of the dataset because it needs to check whether the current selected measurements options are valid for the new collection.

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

Successfully merging a pull request may close this issue.

2 participants