Avaiga / taipy

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

[🐛 BUG] Scenario Selector - Filter on tags not working #1375

Closed FlorianJacta closed 2 months ago

FlorianJacta commented 3 months ago

What went wrong? 🤔

Filtering on tags needs to be fixed. When a scenario has a tag, and the user filters it to get it, all the other scenarios disappear, which means this scenario is also filtered.

Expected Behavior

The filter should work correctly.

Steps to Reproduce Issue

Run the code and filter the scenarios with "Tags" contains or equals test.

# Import necessary libraries
import pandas as pd
import taipy as tp
from taipy import Config, Scope, Frequency

import datetime as dt

# Function to run a Dataiku scenario
def run_something(input_1, input_2):
    datetime = dt.datetime.now()
    date = dt.date(2018, 1, 1)
    int_var = 10
    string_var = "String"
    return datetime, date, int_var, string_var

data = {"toto": [i for i in range(10_000)], 
        "titi": [2*i for i in range(10_000)],
        "tata": [4*i for i in range(10_000)]}

input_1_cfg = Config.configure_data_node(
    id="input_1_data_node",
    default_data=data,
)

input_2_cfg = Config.configure_data_node(
    id="input_2_data_node",
    default_data=data,
)

datetime_cfg = Config.configure_data_node(id="datetime_data_node")
date_cfg = Config.configure_data_node(id="date_data_node")
int_cfg = Config.configure_data_node(id="int_data_node")
string_cfg = Config.configure_data_node(id="string_data_node")

# Scenario and task configuration in Taipy
scenario_task_cfg = Config.configure_task(
    id="scenario_task",
    function=run_something,
    input=[input_1_cfg, input_2_cfg],
    output=[datetime_cfg, date_cfg, int_cfg, string_cfg]
)

scenario_cfg = Config.configure_scenario(
    id="scenario",
    task_configs=[scenario_task_cfg],
    frequency=Frequency.DAILY)

data_node = None

# GUI Markdown content
scenario_md = """
<|1 1|layout|
<|{scenario}|scenario_selector|>

<|{scenario}|scenario|>
|>

<|{scenario}|>

<|job_selector|>

<|1 1|layout|
Input 1 Dataset:
<|{scenario.input_1_data_node if scenario else None}|data_node|>

Input 2 Dataset:
<|{scenario.input_2_data_node if scenario else None}|data_node|>
|>

<|1 1|layout|
<|{data_node}|data_node_selector|>

<|{data_node}|data_node|>
|>
"""

# Main execution block with GUI setup
if __name__ == "__main__":
    tp.Core().run()
    scenario = tp.create_scenario(scenario_cfg)
    scenario.add_tag("test")
    # Run the GUI
    tp.Gui(scenario_md).run(title="Bug replication", port=3248)

Version of Taipy

Develop - 6/6/24

Code of Conduct

FredLL-Avaiga commented 3 months ago

I've fixed the problem But an issue remains: what's the behavior of the filter on multi-valued properties like tags right now, the only operator that works is "contains" and the tested value needs to equal one element of the set. What would be the ideal behavior ?

FlorianJacta commented 3 months ago

equals never works? If so, it should be deleted from the filters list, and a not contain should appear.

FredLL-Avaiga commented 3 months ago

AND you can only test again a "full" tag

FlorianJacta commented 3 months ago

I think getting the tags lov to counter this problem should be great. It can be quite hard as it is interactive but that would be best

FredLL-Avaiga commented 3 months ago

I think getting the tags lov to counter this problem should be great. It can be quite hard as it is interactive but that would be best

what do you mean?

FlorianJacta commented 3 months ago

If I add a new tag to a scenario, I should see it in the filter for tags. I should have a selector of tags inside the filter section instead of having a free text input.

FredLL-Avaiga commented 2 months ago

During the discussion, we decided to propose the list of authorized tags from the configuration. We can evaluate the possibility to support a dynamic list of tags in another issue

FredLL-Avaiga commented 2 months ago

we now support equals, not equals and contains (on each element of the tags list)