Add start/end date selectors for experiment filtering#370
Add start/end date selectors for experiment filtering#370RemiLehe merged 13 commits intoBLAST-AI-ML:mainfrom
Conversation
|
Thanks! |
There was a problem hiding this comment.
Pull request overview
This PR adds date range filtering functionality for experiments in the dashboard. Users can select a start and end date to filter experiment data displayed in the dashboard.
Changes:
- Added a
VDateInputcomponent to the dashboard toolbar for date range selection - Implemented date filtering logic in the database query for experiment data
- Configured state management to track the selected date range and trigger updates
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dashboard/state_manager.py | Added experiment_date_range state variable and enabled Vuetify Labs components |
| dashboard/app.py | Added VDateInput component to toolbar and updated state change handler to respond to date range changes |
| dashboard/utils.py | Implemented date filtering logic in load_data() to filter database queries based on selected date range |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # add date range filter to the configuration dictionary | ||
| date_filter = create_date_filter(state.experiment_date_range) | ||
| config_dict["date_filter"] = date_filter |
There was a problem hiding this comment.
This should add to the configuration file a new section that reads, e.g.,
date_filter:
date:
$gte: 2024-03-28 00:00:00
$lte: 2024-03-28 23:59:59.999000| df_exp = pd.DataFrame(db[experiment].find({"experiment_flag": 1})) | ||
| date_filter = config_dict["date_filter"] | ||
| df_exp = pd.DataFrame(db[experiment].find({"experiment_flag": 1, **date_filter})) |
There was a problem hiding this comment.
This change mimics the new lines 111-113 in dashboard/utils.py:
- exp_data = pd.DataFrame(db[state.experiment].find({"experiment_flag": 1}))
+ exp_data = pd.DataFrame(
+ db[state.experiment].find({"experiment_flag": 1, **date_filter})
+ )|
I think this PR is ready for review. |
ml/train_model.py
Outdated
| # Extract experimental and simulation data from the database as pandas dataframe | ||
| db = connect_to_db(config_dict) | ||
| df_exp = pd.DataFrame(db[experiment].find({"experiment_flag": 1})) | ||
| date_filter = config_dict["date_filter"] |
There was a problem hiding this comment.
Could we modify this so that, if there is no dates in the config.yaml file, it simply ignores the date selection? e.g. config_dict.get( 'date_filter', {} )
| ][0] | ||
| print(f"Setting default experiment to {default_experiment}...") | ||
| state.experiment = default_experiment | ||
| state.experiment_date_range = [] |
There was a problem hiding this comment.
If the config.yaml file contains a section
date_filter:
date:
$gte: 2024-03-28 00:00:00
$lte: 2024-03-28 23:59:59.999000
will experiment_date_range be initialized with these values in the dashboad?
Overview
Add a date range selector (including single dates) using the
VDateInputcomponent to filter the experiment data points used for visualization and ML training.To do
VTextFieldwithVDateInputfor date range selection (full range at once, one state variable).Notes
See related discussion Kitware/trame#846.