Add URL parameters for the measurements panel options
Closed this issue · 1 comments
huddlej commented
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
orreference_strain=A/Stockholm/18/2011,A/Wisconsin/67/2005
orserum=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 commented
Braindumping notes for keeping track of what happens in Redux state.
Initial load of a dataset with measurements
changePage
callschooseDisplayComponentFromURL
which should returndatasetLoader
and dispatches actionPAGE_CHANGE
.- This updates the Redux state
general.displayComponent
, which triggers a re-render of theMainComponentSwitch
. - This renders
DatasetLoader
the component, which dispatchesloadJSONs
and anotherPAGE_CHANGE
action to switch to theMain
component that displays the dataset. loadJSONs
uses the URL to determine the dataset to fetch then fetches the main dataset JSON and dispatchesCLEAN_START
action with the state returned fromcreateStateFromQueryOrJSONs
.- Within
createStateFromQueryOrJSONs
, the default measurements state is set bygetDefaultMeasurementsState
but no measurements controls are set. Other controls are updated withmodifyStateViaURLQuery
- This is where measurements URL prams should be parsed to modify the measurements state/controls !
- Once the clean start action is complete, back in
loadJSONs
, the sidecar JSONs are fetched and loaded. 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
- 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
- Each action type needs added to
changeURLMiddleware
to modify the URL params and keep the URL in sync with the measurements options. - 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.