e-mission / op-admin-dashboard

An admin/deployer dashboard for the NREL OpenPATH platform
0 stars 8 forks source link

added mode specific filter for maps #91

Closed achasmita closed 5 months ago

achasmita commented 8 months ago

Adding mode specific filter to maps

I started grouping data by confirmed modes and used that data to filter all three maps: ![Screen Shot 2023-12-11 at 11 27 53 AM](https://github.com/e-mission/op-admin-dashboard/assets/79387860/6cb3d6b6-aa3b-4afa-bfe4-a60ce25e775b) ![Screen Shot 2023-12-11 at 11 28 23 AM](https://github.com/e-mission/op-admin-dashboard/assets/79387860/08cc110c-8595-46c3-83b2-ee3389c96e45) ![Screen Shot 2023-12-11 at 11 29 22 AM](https://github.com/e-mission/op-admin-dashboard/assets/79387860/30893b16-f6a9-4c32-ab5a-6c8f77741db6)
achasmita commented 8 months ago

Here I have grouped data by mode, so that data is plotted based on selected modes:

Bubble map:

Before: Screen Shot 2023-12-13 at 7 04 11 PM

After mode filter is added: Screen Shot 2023-12-13 at 7 09 30 PM Screen Shot 2023-12-13 at 7 09 41 PM

Density Heatmap:

Before: Screen Shot 2023-12-13 at 7 04 24 PM

After mode filter is added: Screen Shot 2023-12-13 at 7 10 03 PM

Trip Lines map:

achasmita commented 8 months ago

With the new changes

We can now filter bubble and density heat map by different modes (there were no filters in this two maps before). And for trip map as there was already a filter option with UUID's and emails:

now it can be either filtered by mode or by UUID's and emails

achasmita commented 7 months ago
All three maps can now be filtered using modes: > ### Map Type 2. **Bubble Map** and **Density Heatmap** > - There were no filter for Bubble Map and Density Heatmap before. >>![2](https://github.com/e-mission/op-admin-dashboard/assets/79387860/e7376ef0-cf2e-4c60-ba89-f88e974f36a9) >>![3](https://github.com/e-mission/op-admin-dashboard/assets/79387860/350d4125-12fa-428c-a56e-fb56677c102a) > - Now a filter 'Modes' is added: For now, it functions similarly to the Trip lines map, where coordinates will be plotted once the user selects the modes. Alternatively, We can continue to plot them as before: once the map is selected, all co-ordinates will be plotted with different colors corresponding to the modes. >> ![Screen Shot 2024-01-10 at 12 52 25 PM](https://github.com/e-mission/op-admin-dashboard/assets/79387860/85519337-d067-424d-9ede-62fe40e79d06) >> ![Screen Shot 2024-01-10 at 12 52 42 PM](https://github.com/e-mission/op-admin-dashboard/assets/79387860/0c51832d-0f3f-4c64-86bd-8ad448cae07e) To filter data by modes: - Started with grouping data by modes using a function ```get_trips_group_by_user_mode``` ``` def get_trips_group_by_user_mode(trips_data): trips_group_by_user_mode = None trips_df = pd.DataFrame(trips_data['data']) if not trips_df.empty: trips_df['data.user_input.mode_confirm'] = trips_df['data.user_input.mode_confirm'].fillna('Unknown') trips_group_by_user_mode = trips_df.groupby('data.user_input.mode_confirm') return trips_group_by_user_mode ``` - Edited function ```store_trips_map_data```: > - created new function ``` process_trips_groups``` so it can be used for both ```trips_group_by_user_id``` and ```trips_group_by_user_mode```. ``` users_data = dict() if trips_group: keys = list(trips_group) n = len(keys) % 360 k = 359 // (n - 1) if n > 1 else 0 for ind, key in enumerate(trips_group.groups.keys()): color = f'hsl({ind * k}, 100%, 50%)' trips = trips_group.get_group(key).sort_values('trip_start_time_str').to_dict("records") users_data[key] = {'color': color, 'trips': trips} return users_data ``` >> This code block was previously inside ```store_trips_map_data``` (it processes a group of trips, assigns color to each group, sorts the trips within each group and stores the processed data in a dictionary).
shankari commented 7 months ago

@achasmita

Please see my comment above:

I checked to see if the commits had more information, but each commit only has a single line "added mode specific filter for maps "

I still only see one line for this comment "cleaned and made changes in previous code" I expect to see an actual description of the changes, similar to https://github.com/e-mission/em-public-dashboard/pull/112/commits/68911815a6b3168f9c48fcd0169f2e64fb0d17be

Please confirm that you have seen this message and will implement it going forward

achasmita commented 7 months ago

@achasmita

Please see my comment above:

I checked to see if the commits had more information, but each commit only has a single line "added mode specific filter for maps "

I still only see one line for this comment "cleaned and made changes in previous code" I expect to see an actual description of the changes, similar to e-mission/em-public-dashboard@6891181

Please confirm that you have seen this message and will implement it going forward

I will make sure to follow it going forward

shankari commented 6 months ago

Pending feedback from @JGreenlee and potential removal of the scatterplot in the heatmap.

shankari commented 5 months ago

@achasmita please add testing done after the last set of changes

achasmita commented 5 months ago

Scatter plot is removed from heatmap and testing is done. Screen Shot 2024-03-05 at 9 29 29 PM