Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
15.53k stars 1.86k forks source link

Scenario Selector - Group scenarios by year/month/week/day #169

Open FlorianJacta opened 1 year ago

FlorianJacta commented 1 year ago

Feature Improvement

With many scenarios on a Daily frequency, the Scenario Selector will be very long and hard to navigate. A way to solve this issue would be to group the cycles by weeks, months, and years if needed.

In a nutshell, this is a way to group scenarios in the scenario selector when they are too many.

Motivation

The scenario selector becomes too large and hard to navigate with many scenarios or cycles. This feature helps end-users navigate within the list of scenarios.

Expected behavior

A new group_by property should be exposed to activate the feature. The property could accept an auto value to let Taipy decide the categories to group the scenarios. Otherwise, a list of possible groups among day, week, month, quarter, and year could be passed. Let’s imagine we have daily scenarios, and the groups provided are year, month, and week. The groups should be organized as follows:

2024
    |___April
    |       |___week 18
    |       |       |___Cycle - 29 April 2024
    |       |                |___ Scenario A
    |       |                |___ Scenario B
    |       |                |___ Scenario C
    |       |
    |       |___week 17
    |       |___week 16
    |       |___week 15
    |       |___week 14
    |___March
    |___February
    |___January
           |___week 4
           |___week 3
           |___week 2
           |___week 1
                   |___Cycle - 07/01/2024
                   |___Cycle - 06/01/2024
                   |___Cycle - 05/01/2024
                   |___Cycle - 04/01/2024
                   |        |___ Scenario FOO
                   |        |___ Scenario BAR
                   |        |___ Scenario BAZ
                   |
                   |___Cycle - 03/01/2024
                   |___Cycle - 02/01/2024
                   |___Cycle - 01/01/2024
2023
    |___December
    |        |___week 52
    |___November

Without Cycles, Grouped by Month (and “Year” appears as well for months to be unique)

2024
    |___April
    |       |___ Scenario A
    |       |___ Scenario B
    |       |___ Scenario C
    |___March
    |___February
    |___January
2023
    |___December
    |       |___ Scenario X
    |       |___ Scenario Y
    |___November

With auto-on and multiple scenarios per day

2024
    |___April
    |       |___Day 29
    |       |       |___ Scenario A
    |       |       |___ Scenario B
    |       |       |___ Scenario C
    |       |___Day 28
    |       |___Day 27
    |       |___Day 26
    |___March
    |___February
    |___January
2023
    |___December
    |        |___Day 31
    |        |___Day 30

Usage

<| {scenario} | scenario_selector | group_by=auto |>
<| {scenario} | scenario_selector | group_by=cycle |>
<| {scenario} | scenario_selector | group_by=date |>
FlorianJacta commented 8 months ago

Putting this issue to Medium as a customer (Intermarché) won't use the Scenario Selector as they think it is unusable if there are too many scenarios

jrobinAV commented 8 months ago

Can this be linked to a filtering capability? https://github.com/Avaiga/taipy/issues/1040

FlorianJacta commented 8 months ago

It could, but I think what this issue is about, is different

FlorianJacta commented 5 months ago

Putting this as Medium priority as Scenario Selectors have filters now.

quest-bot[bot] commented 1 month ago

New Quest! image New Quest!

A new Quest has been launched in @Avaiga’s repo. Merge a PR that solves this issue to loot the Quest and earn your reward.


Some loot has been stashed in this issue to reward the solver!

🗡 Comment @quest-bot embark to check-in for this Quest and start solving the issue. Other solvers will be notified!

⚔️ When you submit a PR, comment @quest-bot loot #169 to link your PR to this Quest.

Questions? Check out the docs.

eleensmathew commented 1 month ago

Can i work on this?

FlorianJacta commented 1 month ago

Yes, you can @eleensmathew. Thank you for your contribution!

eleensmathew commented 1 month ago

Can i get more context and details about this issue?

FlorianJacta commented 1 month ago

In a nutshell, this is a way to group scenarios in the scenario selector when they are too many.

Motivation

The scenario selector becomes too large and hard to navigate with many scenarios or cycles. This feature helps end-users navigate within the list of scenarios.

Expected behavior

A new group_by property should be exposed to activate the feature. The property could accept an auto value to let Taipy decide the categories to group the scenarios. Otherwise, a list of possible groups among day, week, month, quarter, and year could be passed. Let’s imagine we have daily scenarios, and the groups provided are year, month, and week. The groups should be organized as follows:

2024
    |___April
    |       |___week 18
    |       |       |___Cycle - 29 April 2024
    |       |                |___ Scenario A
    |       |                |___ Scenario B
    |       |                |___ Scenario C
    |       |
    |       |___week 17
    |       |___week 16
    |       |___week 15
    |       |___week 14
    |___March
    |___February
    |___January
           |___week 4
           |___week 3
           |___week 2
           |___week 1
                   |___Cycle - 07/01/2024
                   |___Cycle - 06/01/2024
                   |___Cycle - 05/01/2024
                   |___Cycle - 04/01/2024
                   |        |___ Scenario FOO
                   |        |___ Scenario BAR
                   |        |___ Scenario BAZ
                   |
                   |___Cycle - 03/01/2024
                   |___Cycle - 02/01/2024
                   |___Cycle - 01/01/2024
2023
    |___December
    |        |___week 52
    |___November

Without Cycles, Grouped by Month (and “Year” appears as well for months to be unique)

2024
    |___April
    |       |___ Scenario A
    |       |___ Scenario B
    |       |___ Scenario C
    |___March
    |___February
    |___January
2023
    |___December
    |       |___ Scenario X
    |       |___ Scenario Y
    |___November

With auto-on and multiple scenarios per day

2024
    |___April
    |       |___Day 29
    |       |       |___ Scenario A
    |       |       |___ Scenario B
    |       |       |___ Scenario C
    |       |___Day 28
    |       |___Day 27
    |       |___Day 26
    |___March
    |___February
    |___January
2023
    |___December
    |        |___Day 31
    |        |___Day 30

Usage

<| {scenario} | scenario_selector | group_by=auto |>
<| {scenario} | scenario_selector | group_by=cycle |>
<| {scenario} | scenario_selector | group_by=date |>
eleensmathew commented 1 month ago

Thanks so much for this :)

eleensmathew commented 1 month ago

Do you also mind letting me know which files is perhahs relevant to this issue? so I can take a better look into it

FlorianJacta commented 1 month ago

@FredLL-Avaiga will be able to help you on this

FredLL-Avaiga commented 1 month ago

I guess this would mainly be done on the backend ie taipy\gui_core_context.py [method get_scenarios}(https://github.com/Avaiga/taipy/blob/03b3ff3100361d0306ce3f77c146418fb0888c66/taipy/gui_core/_context.py#L355)

I'm sorry but there's not much documentation, If you feel like adding on that topic, you'll be more than welcome

eleensmathew commented 1 month ago

I made a few code changes that looks like this https://gist.github.com/eleensmathew/a6801e9c97a9196a940a0cd81828416f I am not able to understand the code very well so let me know where I am going wrong @FredLL-Avaiga

FredLL-Avaiga commented 1 month ago

does it work ? Can you provide a PR so that we can discuss on the actual code (that we're able to run and test) ? Tx

github-actions[bot] commented 1 month ago

This issue has been labelled as "🥶Waiting for contributor" because it has been inactive for more than 14 days. If you would like to continue working on this issue, please add another comment or create a PR that links to this issue. If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. Otherwise, you will be unassigned in 14 days. For more information please refer to the contributing guidelines.

github-actions[bot] commented 2 weeks ago

This issue has been unassigned automatically because it has been marked as "🥶Waiting for contributor" for more than 14 days with no activity.