instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
osition_count[position] += 1 return [ { "position": position, "average salary": round( position_salary_data[position] / position_count[position], 2 ), } for position in position_salary_data ] @r...
team_salary_data[team] += float(player.salary) team_count[team] += 1 return [ { "team": team, "average salary": round(team_salary_data[team] / team_count[team], 2), } for team in team_salary_data ] ...
if team not in team_salary_data: team_salary_data[team] = 0 team_count[team] = 0
{ "position": position, "average salary": round( position_salary_data[position] / position_count[position], 2 ), } for position in position_salary_data ] @rx.var(cache=True) def get_team_salary_chart_data(...
team_count[team] = 0 team_salary_data[team] += float(player.salary) team_count[team] += 1 return [ { "team": team, "average salary": round(team_salary_data[team] / team_count[team], 2), } f...
team_salary_data[team] = 0
"average salary": round( position_salary_data[position] / position_count[position], 2 ), } for position in position_salary_data ] @rx.var(cache=True) def get_team_salary_chart_data(self) -> list[dict]: team_salary_data =...
team_salary_data[team] += float(player.salary) team_count[team] += 1 return [ { "team": team, "average salary": round(team_salary_data[team] / team_count[team], 2), } for team in team_salary_data ] ...
team_count[team] = 0
(player.team) and not pd.isna(player.salary) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self...
college_count = {} for player in self.players: if ( not pd.isna(player.college) and not pd.isna(player.salary) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] ...
college_salary_data = {}
not pd.isna(player.salary) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self....
for player in self.players: if ( not pd.isna(player.college) and not pd.isna(player.salary) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in s...
college_count = {}
and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0] <= float(player.sa...
return [ { "college": college, "average salary": round( college_salary_data[college] / college_count[college], 2 ), } for college in college_salary_data ] @rx.var(cache=True) def get_team_a...
for player in self.players: if ( not pd.isna(player.college) and not pd.isna(player.salary) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.select...
selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0] <= float(player.salary) <= self.salary[1] ): ...
return [ { "college": college, "average salary": round( college_salary_data[college] / college_count[college], 2 ), } for college in college_salary_data ] @rx.var(cache=True) def get_team_a...
if ( not pd.isna(player.college) and not pd.isna(player.salary) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] an...
eam_count[team] = 0 team_salary_data[team] += float(player.salary) team_count[team] += 1 return [ { "team": team, "average salary": round(team_salary_data[team] / team_count[team], 2), } for team in team_salary...
if college not in college_salary_data: college_salary_data[college] = 0 college_count[college] = 0 college_salary_data[college] += float(player.salary) college_count[college] += 1 return [ { "c...
college = player.college
_salary_data[team] += float(player.salary) team_count[team] += 1 return [ { "team": team, "average salary": round(team_salary_data[team] / team_count[team], 2), } for team in team_salary_data ] @rx.var(cache=True) ...
college_salary_data[college] += float(player.salary) college_count[college] += 1 return [ { "college": college, "average salary": round( college_salary_data[college] / college_count[college], 2 ), ...
if college not in college_salary_data: college_salary_data[college] = 0 college_count[college] = 0
team_count[team] += 1 return [ { "team": team, "average salary": round(team_salary_data[team] / team_count[team], 2), } for team in team_salary_data ] @rx.var(cache=True) def get_college_salary_chart_data(self) -> list[dict]: ...
college_count[college] = 0 college_salary_data[college] += float(player.salary) college_count[college] += 1 return [ { "college": college, "average salary": round( college_salary_data[college] ...
college_salary_data[college] = 0
"team": team, "average salary": round(team_salary_data[team] / team_count[team], 2), } for team in team_salary_data ] @rx.var(cache=True) def get_college_salary_chart_data(self) -> list[dict]: college_salary_data = {} college_coun...
college_salary_data[college] += float(player.salary) college_count[college] += 1 return [ { "college": college, "average salary": round( college_salary_data[college] / college_count[college], 2 ), ...
college_count[college] = 0
ot pd.isna(player.salary) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.sa...
@rx.var(cache=True) def get_position_age_average_data(self) -> list[dict]: position_age_data = {} position_count = {} for player in self.players: if ( not pd.isna(player.position) and not pd.isna(player.age) and player.team i...
def get_team_age_average_data(self) -> list[dict]: team_age_data = {} team_count = {} for player in self.players: if ( not pd.isna(player.team) and not pd.isna(player.age) and player.team in self.selected_items["teams"] ...
n self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0] <= float(player.salary) <= self.salary[1] ...
team_count = {} for player in self.players: if ( not pd.isna(player.team) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and pl...
team_age_data = {}
s"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0] <= float(player.salary) <= self.salary[1] ): colle...
for player in self.players: if ( not pd.isna(player.team) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.se...
team_count = {}
layer.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0] <= float(player.salary) <= self.salary[1] ): college = player.college ...
return [ { "team": team, "average age": round(sum(ages) / team_count[team], 2), } for team, ages in team_age_data.items() ] @rx.var(cache=True) def get_position_age_average_data(self) -> list[dict]: position_age_data ...
for player in self.players: if ( not pd.isna(player.team) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_ite...
lleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0] <= float(player.salary) <= self.salary[1] ): college = player.college if college not in college_sal...
return [ { "team": team, "average age": round(sum(ages) / team_count[team], 2), } for team, ages in team_age_data.items() ] @rx.var(cache=True) def get_position_age_average_data(self) -> list[dict]: position_age_data ...
if ( not pd.isna(player.team) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self...
a[college] += float(player.salary) college_count[college] += 1 return [ { "college": college, "average salary": round( college_salary_data[college] / college_count[college], 2 ), } for colleg...
if team not in team_age_data: team_age_data[team] = [] team_count[team] = 0 team_age_data[team].append(player.age) team_count[team] += 1 return [ { "team": team, "average age": ...
team = player.team
college_count[college] += 1 return [ { "college": college, "average salary": round( college_salary_data[college] / college_count[college], 2 ), } for college in college_salary_data ] ...
team_age_data[team].append(player.age) team_count[team] += 1 return [ { "team": team, "average age": round(sum(ages) / team_count[team], 2), } for team, ages in team_age_data.items() ] @rx.var(cac...
if team not in team_age_data: team_age_data[team] = [] team_count[team] = 0
return [ { "college": college, "average salary": round( college_salary_data[college] / college_count[college], 2 ), } for college in college_salary_data ] @rx.var(cache=True) def get_team_age_aver...
team_count[team] = 0 team_age_data[team].append(player.age) team_count[team] += 1 return [ { "team": team, "average age": round(sum(ages) / team_count[team], 2), } for team, ages in team_ag...
team_age_data[team] = []
llege": college, "average salary": round( college_salary_data[college] / college_count[college], 2 ), } for college in college_salary_data ] @rx.var(cache=True) def get_team_age_average_data(self) -> list[dict]: team_ag...
team_age_data[team].append(player.age) team_count[team] += 1 return [ { "team": team, "average age": round(sum(ages) / team_count[team], 2), } for team, ages in team_age_data.items() ] @rx.var(cac...
team_count[team] = 0
not pd.isna(player.team) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= ...
position_count = {} for player in self.players: if ( not pd.isna(player.position) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] ...
position_age_data = {}
am) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] ...
for player in self.players: if ( not pd.isna(player.position) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in sel...
position_count = {}
d.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0]...
return [ { "position": position, "average age": round(sum(ages) / position_count[position], 2), } for position, ages in position_age_data.items() ] def add_selected(self, list_name: str, item: str): self.selected_items[li...
for player in self.players: if ( not pd.isna(player.position) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected...
layer.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0] <= float(player.salary) <= self.salary[...
return [ { "position": position, "average age": round(sum(ages) / position_count[position], 2), } for position, ages in position_age_data.items() ] def add_selected(self, list_name: str, item: str): self.selected_items[li...
if ( not pd.isna(player.position) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and ...
team_count[team] = 0 team_age_data[team].append(player.age) team_count[team] += 1 return [ { "team": team, "average age": round(sum(ages) / team_count[team], 2), } for team, ages in team_age_data...
if position not in position_age_data: position_age_data[position] = [] position_count[position] = 0 position_age_data[position].append(player.age) position_count[position] += 1 return [ { "posi...
position = player.position
team_age_data[team].append(player.age) team_count[team] += 1 return [ { "team": team, "average age": round(sum(ages) / team_count[team], 2), } for team, ages in team_age_data.items() ] @rx.var(cache=True)...
position_age_data[position].append(player.age) position_count[position] += 1 return [ { "position": position, "average age": round(sum(ages) / position_count[position], 2), } for position, ages in position_age...
if position not in position_age_data: position_age_data[position] = [] position_count[position] = 0
team_count[team] += 1 return [ { "team": team, "average age": round(sum(ages) / team_count[team], 2), } for team, ages in team_age_data.items() ] @rx.var(cache=True) def get_position_age_average_data(self) -> list[dict]...
position_count[position] = 0 position_age_data[position].append(player.age) position_count[position] += 1 return [ { "position": position, "average age": round(sum(ages) / position_count[position], 2), ...
position_age_data[position] = []
{ "team": team, "average age": round(sum(ages) / team_count[team], 2), } for team, ages in team_age_data.items() ] @rx.var(cache=True) def get_position_age_average_data(self) -> list[dict]: position_age_data = {} position_cou...
position_age_data[position].append(player.age) position_count[position] += 1 return [ { "position": position, "average age": round(sum(ages) / position_count[position], 2), } for position, ages in position_age...
position_count[position] = 0
if ( not pd.isna(player.position) and not pd.isna(player.age) and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and ...
def remove_selected(self, list_name: str, item: str): self.selected_items[list_name].remove(item) def add_all_selected(self, list_name: str): self.selected_items[list_name] = list(all_items[list_name]) def clear_selected(self, list_name: str): self.selected_items[list_name].clear...
def add_selected(self, list_name: str, item: str): self.selected_items[list_name].append(item)
and player.team in self.selected_items["teams"] and player.college in self.selected_items["colleges"] and player.position in self.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0] <= float(player.salary) <= self....
def add_all_selected(self, list_name: str): self.selected_items[list_name] = list(all_items[list_name]) def clear_selected(self, list_name: str): self.selected_items[list_name].clear() def random_selected(self, list_name: str): self.selected_items[list_name] = np.random.choice( ...
def remove_selected(self, list_name: str, item: str): self.selected_items[list_name].remove(item)
.selected_items["positions"] and self.age[0] <= player.age <= self.age[1] and self.salary[0] <= float(player.salary) <= self.salary[1] ): position = player.position if position not in position_age_data: position_age_data[pos...
def clear_selected(self, list_name: str): self.selected_items[list_name].clear() def random_selected(self, list_name: str): self.selected_items[list_name] = np.random.choice( all_items[list_name], size=np.random.randint(1, len(all_items[list_name]) + 1), re...
self.selected_items[list_name] = list(all_items[list_name])
layer.age <= self.age[1] and self.salary[0] <= float(player.salary) <= self.salary[1] ): position = player.position if position not in position_age_data: position_age_data[position] = [] position_count[position] = 0 ...
def random_selected(self, list_name: str): self.selected_items[list_name] = np.random.choice( all_items[list_name], size=np.random.randint(1, len(all_items[list_name]) + 1), replace=False, ).tolist()
def clear_selected(self, list_name: str): self.selected_items[list_name].clear()
lary[1] ): position = player.position if position not in position_age_data: position_age_data[position] = [] position_count[position] = 0 position_age_data[position].append(player.age) position_count[pos...
def random_selected(self, list_name: str): self.selected_items[list_name] = np.random.choice( all_items[list_name], size=np.random.randint(1, len(all_items[list_name]) + 1), replace=False, ).tolist()
layer.position if position not in position_age_data: position_age_data[position] = [] position_count[position] = 0 position_age_data[position].append(player.age) position_count[position] += 1 return [ { ...
self.selected_items[list_name] = np.random.choice( all_items[list_name], size=np.random.randint(1, len(all_items[list_name]) + 1), replace=False, ).tolist()
from reflex.components.radix.themes.base import LiteralAccentColor # Teams teams_dict: Dict[str, LiteralAccentColor] = { "Boston Celtics": "green", "Brooklyn Nets": "gray", "New York Knicks": "blue", "Philadelphia 76ers": "blue", "Toronto Raptors": "red", "Chicago Bulls": "red", "Clevela...
from typing import Dict
from typing import Dict
# Teams teams_dict: Dict[str, LiteralAccentColor] = { "Boston Celtics": "green", "Brooklyn Nets": "gray", "New York Knicks": "blue", "Philadelphia 76ers": "blue", "Toronto Raptors": "red", "Chicago Bulls": "red", "Cleveland Cavaliers": "ruby", "Detroit Pistons": "red", "Indiana Pa...
from reflex.components.radix.themes.base import LiteralAccentColor
ict[str, LiteralAccentColor] = { "Boston Celtics": "green", "Brooklyn Nets": "gray", "New York Knicks": "blue", "Philadelphia 76ers": "blue", "Toronto Raptors": "red", "Chicago Bulls": "red", "Cleveland Cavaliers": "ruby", "Detroit Pistons": "red", "Indiana Pacers": "yellow", "Mi...
# Positions position_dict: Dict[str, LiteralAccentColor] = { "PG": "blue", "SG": "green", "SF": "red", "PF": "yellow", "C": "purple", } positions_list = list(position_dict.keys()) # College college_dict: Dict[str, LiteralAccentColor] = { "Texas": "orange", "Marquette": "blue", "Bos...
teams_list = list(teams_dict.keys())
cago Bulls": "red", "Cleveland Cavaliers": "ruby", "Detroit Pistons": "red", "Indiana Pacers": "yellow", "Milwaukee Bucks": "green", "Atlanta Hawks": "red", "Charlotte Hornets": "purple", "Miami Heat": "red", "Orlando Magic": "blue", "Washington Wizards": "red", "Denver Nuggets":...
# College college_dict: Dict[str, LiteralAccentColor] = { "Texas": "orange", "Marquette": "blue", "Boston University": "red", "Georgia State": "blue", "LSU": "purple", "Gonzaga": "blue", "Louisville": "red", "Oklahoma State": "orange", "Ohio State": "red", "Washington": "purpl...
positions_list = list(position_dict.keys())
"Blinn College": "blue", "Providence": "blue", "Detroit": "red", "Rhode Island": "blue", "California": "gold", "Cleveland State": "green", "Iowa State": "cardinal", "Florida State": "gold", "Long Beach State": "gold", "Penn State": "blue", "Indiana": "crimson", "San Dieg...
all_items = {"teams": teams_list, "positions": positions_list, "colleges": college_list}
college_list = list(college_dict.keys())
nce": "blue", "Detroit": "red", "Rhode Island": "blue", "California": "gold", "Cleveland State": "green", "Iowa State": "cardinal", "Florida State": "gold", "Long Beach State": "gold", "Penn State": "blue", "Indiana": "crimson", "San Diego State": "red", "Western Carolina": "...
all_items = {"teams": teams_list, "positions": positions_list, "colleges": college_list}
import reflex as rx class Player(rx.Base): """The player class.""" name: str team: str number: int position: str age: int height: str weight: int college: str salary: Union[int, str] # Can also be a string for the NaN values
from typing import Union
from typing import Union
class Player(rx.Base): """The player class.""" name: str team: str number: int position: str age: int height: str weight: int college: str salary: Union[int, str] # Can also be a string for the NaN values
import reflex as rx
import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) from ..backend.backend import State def _get_item_color( item: str, items_dict: Dict[str, LiteralAccentColor] ) -> rx.Component: return rx.match(item, *[(t, items_dict.get(t, "blue")) for t in items_dict], "blue...
from typing import Dict, List
from typing import Dict, List
from reflex.components.radix.themes.base import ( LiteralAccentColor, ) from ..backend.backend import State def _get_item_color( item: str, items_dict: Dict[str, LiteralAccentColor] ) -> rx.Component: return rx.match(item, *[(t, items_dict.get(t, "blue")) for t in items_dict], "blue") badge_props = { ...
import reflex as rx
from typing import Dict, List import reflex as rx
from ..backend.backend import State def _get_item_color( item: str, items_dict: Dict[str, LiteralAccentColor] ) -> rx.Component: return rx.match(item, *[(t, items_dict.get(t, "blue")) for t in items_dict], "blue") badge_props = { "radius": "full", "variant": "surface", "size": "3", "margin...
from reflex.components.radix.themes.base import ( LiteralAccentColor, )
from typing import Dict, List import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, )
def _get_item_color( item: str, items_dict: Dict[str, LiteralAccentColor] ) -> rx.Component: return rx.match(item, *[(t, items_dict.get(t, "blue")) for t in items_dict], "blue") badge_props = { "radius": "full", "variant": "surface", "size": "3", "margin": "5px", "cursor": "pointer", ...
from ..backend.backend import State
from typing import Dict, List import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) from ..backend.backend import State def _get_item_color( item: str, items_dict: Dict[str, LiteralAccentColor] ) -> rx.Component: return rx.match(item, *[(t, items_dict.get(t, "blue")...
def _selected_item_badge( item_name: str, items_dict: Dict[str, LiteralAccentColor], item: str ) -> rx.Component: return rx.badge( item, rx.icon("x", size=18), color_scheme=_get_item_color(item, items_dict), **badge_props, on_click=lambda: State.remove_selected(item_na...
badge_props = { "radius": "full", "variant": "surface", "size": "3", "margin": "5px", "cursor": "pointer", "style": {"_hover": {"opacity": 0.75}}, }
from ..backend.backend import State from ..backend.data_items import college_dict, position_dict, teams_dict from .item_badges import _selected_item_badge, _unselected_item_badge def _add_all_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("plus", size=16), "Add All", ...
import reflex as rx
import reflex as rx
from ..backend.data_items import college_dict, position_dict, teams_dict from .item_badges import _selected_item_badge, _unselected_item_badge def _add_all_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("plus", size=16), "Add All", variant="soft", size="2", ...
from ..backend.backend import State
import reflex as rx from ..backend.backend import State
from .item_badges import _selected_item_badge, _unselected_item_badge def _add_all_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("plus", size=16), "Add All", variant="soft", size="2", on_click=on_click, color_scheme="green", cursor="...
from ..backend.data_items import college_dict, position_dict, teams_dict
import reflex as rx from ..backend.backend import State from ..backend.data_items import college_dict, position_dict, teams_dict
def _add_all_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("plus", size=16), "Add All", variant="soft", size="2", on_click=on_click, color_scheme="green", cursor="pointer", ) def _clear_button(on_click: callable) -> rx.Componen...
from .item_badges import _selected_item_badge, _unselected_item_badge
import reflex as rx from ..backend.backend import State from ..backend.data_items import college_dict, position_dict, teams_dict from .item_badges import _selected_item_badge, _unselected_item_badge
def _clear_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("trash", size=16), "Clear", variant="soft", size="2", on_click=on_click, color_scheme="tomato", cursor="pointer", ) def _random_button(on_click: callable) -> rx.Component...
def _add_all_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("plus", size=16), "Add All", variant="soft", size="2", on_click=on_click, color_scheme="green", cursor="pointer", )
import reflex as rx from ..backend.backend import State from ..backend.data_items import college_dict, position_dict, teams_dict from .item_badges import _selected_item_badge, _unselected_item_badge def _add_all_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("plus", size=16), ...
def _random_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("shuffle", size=16), variant="soft", size="2", on_click=on_click, color_scheme="gray", cursor="pointer", ) def _items_selector(item: str, items_dict: dict) -> rx.Component: ...
def _clear_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("trash", size=16), "Clear", variant="soft", size="2", on_click=on_click, color_scheme="tomato", cursor="pointer", )
import reflex as rx from ..backend.backend import State from ..backend.data_items import college_dict, position_dict, teams_dict from .item_badges import _selected_item_badge, _unselected_item_badge def _add_all_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("plus", size=16), ...
def _items_selector(item: str, items_dict: dict) -> rx.Component: return rx.vstack( rx.flex( rx.hstack( _add_all_button(State.add_all_selected(item)), _clear_button(State.clear_selected(item)), _random_button(State.random_selected(item)), ...
def _random_button(on_click: callable) -> rx.Component: return rx.button( rx.icon("shuffle", size=16), variant="soft", size="2", on_click=on_click, color_scheme="gray", cursor="pointer", )
heme="gray", cursor="pointer", ) def _items_selector(item: str, items_dict: dict) -> rx.Component: return rx.vstack( rx.flex( rx.hstack( _add_all_button(State.add_all_selected(item)), _clear_button(State.clear_selected(item)), _random...
def _accordion_header(icon: str, text: str) -> rx.Component: return rx.hstack( rx.icon(icon, size=24), rx.heading(text, size="5"), spacing="2", align="center", width="100%", ) def _age_selector() -> rx.Component: return rx.vstack( rx.slider( d...
def _accordion_header_stat(icon: str, text: str, item: str) -> rx.Component: return rx.hstack( rx.icon(icon, size=24), rx.heading(text + f" ({(State.selected_items[item].length())})", size="5"), spacing="2", align="center", width="100%", )
tem)), _random_button(State.random_selected(item)), spacing="2", justify="end", width="100%", ), direction="row", align="center", width="100%", ), rx.flex( rx.foreach( ...
def _age_selector() -> rx.Component: return rx.vstack( rx.slider( default_value=[19, 40], min=19, variant="soft", max=40, on_change=State.set_age, ), rx.hstack( rx.badge("Min Age: ", State.age[0]), rx.spac...
def _accordion_header(icon: str, text: str) -> rx.Component: return rx.hstack( rx.icon(icon, size=24), rx.heading(text, size="5"), spacing="2", align="center", width="100%", )
r", width="100%", ), rx.flex( rx.foreach( State.selected_items[item], lambda team: _selected_item_badge(item, items_dict, team), ), wrap="wrap", ), rx.divider(), rx.flex( rx.foreach( ...
def _salary_selector() -> rx.Component: return rx.vstack( rx.slider( default_value=[0, 25000000], min=0, variant="soft", max=25000000, on_value_commit=State.set_salary, ), rx.hstack( rx.badge("Min Salary: ", State.sal...
def _age_selector() -> rx.Component: return rx.vstack( rx.slider( default_value=[19, 40], min=19, variant="soft", max=40, on_change=State.set_age, ), rx.hstack( rx.badge("Min Age: ", State.age[0]), rx.spacer(...
def navbar(): return rx.flex( rx.hstack( rx.image(src="/ball.svg", height="38px"), rx.heading("NBA DATA", size="7"), rx.badge( "2015-2016 season", radius="full", align="center", color_scheme="orange", ...
import reflex as rx
from ..backend.backend import State from ..components.stats_selector import stats_selector class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False def toggle_radarchart(self): self.radar_toggle = not self.radar_toggle def toggle_a...
import reflex as rx
import reflex as rx
from ..components.stats_selector import stats_selector class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False def toggle_radarchart(self): self.radar_toggle = not self.radar_toggle def toggle_areachart(self): self.area_tog...
from ..backend.backend import State
import reflex as rx from ..backend.backend import State
class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False def toggle_radarchart(self): self.radar_toggle = not self.radar_toggle def toggle_areachart(self): self.area_toggle = not self.area_toggle @rx.event def set_s...
from ..components.stats_selector import stats_selector
import reflex as rx from ..backend.backend import State from ..components.stats_selector import stats_selector
def _age_salary_chart() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.recharts.area_chart( rx.recharts.legend(), rx.recharts.graphing_tooltip(cursor=False), rx.recharts.cartesian_grid(), rx.recharts.area( type_="monoton...
class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False def toggle_radarchart(self): self.radar_toggle = not self.radar_toggle def toggle_areachart(self): self.area_toggle = not self.area_toggle @rx.event def set_stat...
import reflex as rx from ..backend.backend import State from ..components.stats_selector import stats_selector class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False
def toggle_areachart(self): self.area_toggle = not self.area_toggle @rx.event def set_stats_view(self, value: str): self.stats_view = value def _age_salary_chart() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.recharts.area_chart( rx.rechart...
def toggle_radarchart(self): self.radar_toggle = not self.radar_toggle
import reflex as rx from ..backend.backend import State from ..components.stats_selector import stats_selector class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False def toggle_radarchart(self):
def toggle_areachart(self): self.area_toggle = not self.area_toggle @rx.event def set_stats_view(self, value: str): self.stats_view = value def _age_salary_chart() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.recharts.area_chart( rx.rechart...
self.radar_toggle = not self.radar_toggle
import reflex as rx from ..backend.backend import State from ..components.stats_selector import stats_selector class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False def toggle_radarchart(self): self.radar_toggle = not self.radar_toggl...
@rx.event def set_stats_view(self, value: str): self.stats_view = value def _age_salary_chart() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.recharts.area_chart( rx.recharts.legend(), rx.recharts.graphing_tooltip(cursor=False), r...
def toggle_areachart(self): self.area_toggle = not self.area_toggle
import reflex as rx from ..backend.backend import State from ..components.stats_selector import stats_selector class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False def toggle_radarchart(self): self.radar_toggle = not self.radar_toggl...
@rx.event def set_stats_view(self, value: str): self.stats_view = value def _age_salary_chart() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.recharts.area_chart( rx.recharts.legend(), rx.recharts.graphing_tooltip(cursor=False), r...
self.area_toggle = not self.area_toggle
import reflex as rx from ..backend.backend import State from ..components.stats_selector import stats_selector class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False def toggle_radarchart(self): self.radar_toggle = not self.radar_toggl...
def _age_salary_chart() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.recharts.area_chart( rx.recharts.legend(), rx.recharts.graphing_tooltip(cursor=False), rx.recharts.cartesian_grid(), rx.recharts.area( type_="monoton...
def set_stats_view(self, value: str): self.stats_view = value
import reflex as rx from ..backend.backend import State from ..components.stats_selector import stats_selector class StatsState(rx.State): stats_view: str = "age_salary" radar_toggle: bool = False area_toggle: bool = False def toggle_radarchart(self): self.radar_toggle = not self.radar_toggl...
def _age_salary_chart() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.recharts.area_chart( rx.recharts.legend(), rx.recharts.graphing_tooltip(cursor=False), rx.recharts.cartesian_grid(), rx.recharts.area( type_="monoton...
self.stats_view = value
rx.recharts.radar_chart( rx.recharts.legend(), rx.recharts.graphing_tooltip(), rx.recharts.radar( data_key="average age", stroke="#E54666", fill="#e54666a0", ), rx.recharts.polar_grid(), rx.recharts....
def _area_toggle() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.icon_button( rx.icon("area-chart", size=24), size="3", cursor="pointer", variant="soft", on_click=StatsState.toggle_areachart, ), rx.icon_butt...
def _radar_toggle() -> rx.Component: return rx.cond( StatsState.radar_toggle, rx.icon_button( rx.icon("pentagon", size=24), size="3", cursor="pointer", variant="soft", on_click=StatsState.toggle_radarchart, ), rx.icon_button...
rx.recharts.graphing_tooltip(), rx.recharts.cartesian_grid(), rx.recharts.bar(data_key="average age", stroke="#E54666", fill="#e54666a0"), rx.recharts.brush(data_key="position", height=30, stroke="#E54666"), rx.recharts.x_axis(data_key="position"), ...
def stats_ui() -> rx.Component: return rx.flex( rx.scroll_area( stats_selector(), scrollbars="vertical", width=["100%", "100%", "100%", "45%"], height=["100%", "100%", "100%", "calc(100vh - 300px)"], type="always", ), rx.vstack( ...
def _area_toggle() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.icon_button( rx.icon("area-chart", size=24), size="3", cursor="pointer", variant="soft", on_click=StatsState.toggle_areachart, ), rx.icon_button(...
from ..backend.backend import Player, State from ..backend.data_items import position_dict, teams_dict from ..components.item_badges import item_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx...
import reflex as rx
import reflex as rx
from ..backend.data_items import position_dict, teams_dict from ..components.item_badges import item_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", ...
from ..backend.backend import Player, State
import reflex as rx from ..backend.backend import Player, State
from ..components.item_badges import item_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), ) def _show_player(pl...
from ..backend.data_items import position_dict, teams_dict
import reflex as rx from ..backend.backend import Player, State from ..backend.data_items import position_dict, teams_dict
def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), ) def _show_player(player: Player, index: int) -> rx.Component: b...
from ..components.item_badges import item_badge
import reflex as rx from ..backend.backend import Player, State from ..backend.data_items import position_dict, teams_dict from ..components.item_badges import item_badge
def _show_player(player: Player, index: int) -> rx.Component: bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), ) hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), ) return rx.table.row(...
def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), )
import reflex as rx from ..backend.backend import Player, State from ..backend.data_items import position_dict, teams_dict from ..components.item_badges import item_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=...
hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), ) return rx.table.row( rx.table.row_header_cell(player.name), rx.table.cell(item_badge(player.team, teams_dict)), rx.table.cell(player.number), rx.table.cell(item_badge...
bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), )
import reflex as rx from ..backend.backend import Player, State from ..backend.data_items import position_dict, teams_dict from ..components.item_badges import item_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=...
return rx.table.row( rx.table.row_header_cell(player.name), rx.table.cell(item_badge(player.team, teams_dict)), rx.table.cell(player.number), rx.table.cell(item_badge(player.position, position_dict)), rx.table.cell(player.age), rx.table.cell(player.height), r...
hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), )
from retail_analytics_dashboard.components.billing_cycle import billing_cycle from retail_analytics_dashboard.components.customize_charts_dialog import ( customize_charts_dialog, ) from retail_analytics_dashboard.components.overview_section import overview_section from retail_analytics_dashboard.components.sideba...
import reflex as rx
import reflex as rx
from retail_analytics_dashboard.components.customize_charts_dialog import ( customize_charts_dialog, ) from retail_analytics_dashboard.components.overview_section import overview_section from retail_analytics_dashboard.components.sidebar import sidebar def index() -> rx.Component: """The main dashboard page....
from retail_analytics_dashboard.components.billing_cycle import billing_cycle
import reflex as rx from retail_analytics_dashboard.components.billing_cycle import billing_cycle from retail_analytics_dashboard.components.customize_charts_dialog import ( customize_charts_dialog, ) from retail_analytics_dashboard.components.overview_section import overview_section
def index() -> rx.Component: """The main dashboard page.""" return rx.el.div( sidebar(), rx.el.main( billing_cycle(), rx.el.div(class_name="mt-6"), overview_section(), class_name="flex-1 p-6 bg-gray-50 overflow-y-auto", ), custom...
from retail_analytics_dashboard.components.sidebar import sidebar
import reflex as rx from retail_analytics_dashboard.components.billing_cycle import billing_cycle from retail_analytics_dashboard.components.customize_charts_dialog import ( customize_charts_dialog, ) from retail_analytics_dashboard.components.overview_section import overview_section from retail_analytics_dashboar...
app.add_page(index)
app = rx.App(theme=rx.theme(appearance="light"))
from retail_analytics_dashboard.components.progress_bar import ( cost_progress_bar, progress_bar, ) from retail_analytics_dashboard.states.dashboard_state import DashboardState def billing_cycle_stats() -> rx.Component: """Renders billing cycle stats.""" return rx.el.div( rx.foreach( ...
import reflex as rx
import reflex as rx
from retail_analytics_dashboard.states.dashboard_state import DashboardState def billing_cycle_stats() -> rx.Component: """Renders billing cycle stats.""" return rx.el.div( rx.foreach( DashboardState.billing_usage_stats, lambda item: progress_bar( label=item["l...
from retail_analytics_dashboard.components.progress_bar import ( cost_progress_bar, progress_bar, )
import reflex as rx from retail_analytics_dashboard.components.progress_bar import ( cost_progress_bar, progress_bar, )
def billing_cycle_stats() -> rx.Component: """Renders billing cycle stats.""" return rx.el.div( rx.foreach( DashboardState.billing_usage_stats, lambda item: progress_bar( label=item["label"], value=item["value"], total=item["tota...
from retail_analytics_dashboard.states.dashboard_state import DashboardState
cost_progress_bar, progress_bar, ) from retail_analytics_dashboard.states.dashboard_state import DashboardState def billing_cycle_stats() -> rx.Component: """Renders billing cycle stats.""" return rx.el.div( rx.foreach( DashboardState.billing_usage_stats, lambda item: progr...
def billing_cycle() -> rx.Component: """The billing cycle section with usage stats, workspace stats and cost breakdown.""" return rx.el.section( rx.el.div( rx.el.h2( "Billing Cycle", class_name="text-xl font-semibold text-gray-800", ), ...
def billing_costs() -> rx.Component: """Renders billing costs.""" return cost_progress_bar(items=DashboardState.billing_costs_items)
from retail_analytics_dashboard.components.overview_chart import overview_chart from retail_analytics_dashboard.states.dashboard_state import ( DashboardState, OverviewMetric, ) def customize_chart_item( metric: rx.Var[OverviewMetric], ) -> rx.Component: """Renders a single chart item with a checkbo...
import reflex as rx
import reflex as rx
from retail_analytics_dashboard.states.dashboard_state import ( DashboardState, OverviewMetric, ) def customize_chart_item( metric: rx.Var[OverviewMetric], ) -> rx.Component: """Renders a single chart item with a checkbox in the customize dialog.""" return rx.el.div( overview_chart(metric...
from retail_analytics_dashboard.components.overview_chart import overview_chart
import reflex as rx from retail_analytics_dashboard.components.overview_chart import overview_chart
def customize_chart_item( metric: rx.Var[OverviewMetric], ) -> rx.Component: """Renders a single chart item with a checkbox in the customize dialog.""" return rx.el.div( overview_chart(metric), rx.el.input( type="checkbox", checked=DashboardState.temp_chart_visibil...
from retail_analytics_dashboard.states.dashboard_state import ( DashboardState, OverviewMetric, )
import reflex as rx from retail_analytics_dashboard.models.models import ChartDataPoint, OverviewMetric from retail_analytics_dashboard.states.data import TOOLTIP_PROPS def overview_chart( metric: rx.Var[OverviewMetric], ) -> rx.Component: """Renders a single overview metric card with a small chart.""" ...
from typing import List
from typing import List
from retail_analytics_dashboard.models.models import ChartDataPoint, OverviewMetric from retail_analytics_dashboard.states.data import TOOLTIP_PROPS def overview_chart( metric: rx.Var[OverviewMetric], ) -> rx.Component: """Renders a single overview metric card with a small chart.""" return rx.el.div( ...
import reflex as rx
from typing import List import reflex as rx
from retail_analytics_dashboard.states.data import TOOLTIP_PROPS def overview_chart( metric: rx.Var[OverviewMetric], ) -> rx.Component: """Renders a single overview metric card with a small chart.""" return rx.el.div( rx.el.div( rx.el.p( metric["title"], ...
from retail_analytics_dashboard.models.models import ChartDataPoint, OverviewMetric
from typing import List import reflex as rx from retail_analytics_dashboard.models.models import ChartDataPoint, OverviewMetric
def overview_chart( metric: rx.Var[OverviewMetric], ) -> rx.Component: """Renders a single overview metric card with a small chart.""" return rx.el.div( rx.el.div( rx.el.p( metric["title"], class_name="text-sm text-gray-600", ), ...
from retail_analytics_dashboard.states.data import TOOLTIP_PROPS
from retail_analytics_dashboard.components.overview_chart import overview_chart from retail_analytics_dashboard.states.dashboard_state import DashboardState def overview_section() -> rx.Component: """The overview section with metric charts.""" return rx.el.section( rx.el.div( rx.el.h2( ...
import reflex as rx
import reflex as rx
from retail_analytics_dashboard.states.dashboard_state import DashboardState def overview_section() -> rx.Component: """The overview section with metric charts.""" return rx.el.section( rx.el.div( rx.el.h2( "Overview", class_name="text-xl font-semibold text...
from retail_analytics_dashboard.components.overview_chart import overview_chart
import reflex as rx from retail_analytics_dashboard.components.overview_chart import overview_chart
def overview_section() -> rx.Component: """The overview section with metric charts.""" return rx.el.section( rx.el.div( rx.el.h2( "Overview", class_name="text-xl font-semibold text-gray-800", ), rx.el.div( rx.el.butto...
from retail_analytics_dashboard.states.dashboard_state import DashboardState
from retail_analytics_dashboard.states.dashboard_state import DashboardState def progress_bar( label: rx.Var[str], value: rx.Var[str], total: rx.Var[str], percentage: rx.Var[float], ) -> rx.Component: """A simple progress bar component.""" return rx.el.div( rx.el.div( rx....
import reflex as rx
import reflex as rx
def progress_bar( label: rx.Var[str], value: rx.Var[str], total: rx.Var[str], percentage: rx.Var[float], ) -> rx.Component: """A simple progress bar component.""" return rx.el.div( rx.el.div( rx.el.p(label, class_name="text-sm text-gray-600"), rx.el.p( ...
from retail_analytics_dashboard.states.dashboard_state import DashboardState
from retail_analytics_dashboard.states.dashboard_state import DashboardState def sidebar_nav_item(item: rx.Var[dict]) -> rx.Component: """Renders a single navigation item in the sidebar.""" return rx.el.a( rx.icon(tag=item["icon"], class_name="w-5 h-5 mr-3"), item["name"], href="#", ...
import reflex as rx
import reflex as rx
def sidebar_nav_item(item: rx.Var[dict]) -> rx.Component: """Renders a single navigation item in the sidebar.""" return rx.el.a( rx.icon(tag=item["icon"], class_name="w-5 h-5 mr-3"), item["name"], href="#", on_click=lambda: DashboardState.set_active_nav(item["name"]), ...
from retail_analytics_dashboard.states.dashboard_state import DashboardState
class NavItem(TypedDict): name: str icon: str active: bool class ShortcutItem(TypedDict): name: str icon: str class BillingStat(TypedDict): label: str value: str total: str percentage: float class CostItem(TypedDict): label: str value: str value_num: float pe...
from typing import List, TypedDict