instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
self.current_page = 1 self.close_filter_dropdowns() @rx.event def apply_country_filter(self): """Apply the temporary country filter to the main selection.""" self.selected_countries = self.temp_selected_countries.copy() self.current_page = 1 self.close_filter_dropdow...
self.max_cost = new_max_cost self.show_costs_filter = False self.current_page = 1 @rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset the coun...
self.min_cost = new_min_cost
ose_filter_dropdowns() @rx.event def apply_country_filter(self): """Apply the temporary country filter to the main selection.""" self.selected_countries = self.temp_selected_countries.copy() self.current_page = 1 self.close_filter_dropdowns() @rx.event def apply_costs_f...
self.show_costs_filter = False self.current_page = 1 @rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset the country filter.""" self.temp_selected...
self.max_cost = new_max_cost
def apply_country_filter(self): """Apply the temporary country filter to the main selection.""" self.selected_countries = self.temp_selected_countries.copy() self.current_page = 1 self.close_filter_dropdowns() @rx.event def apply_costs_filter(self): new_min_cost = N...
self.current_page = 1 @rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set() @rx.event d...
self.show_costs_filter = False
"""Apply the temporary country filter to the main selection.""" self.selected_countries = self.temp_selected_countries.copy() self.current_page = 1 self.close_filter_dropdowns() @rx.event def apply_costs_filter(self): new_min_cost = None new_max_cost = None ...
@rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set() @rx.event def reset_costs_filter(self): ...
self.current_page = 1
er to the main selection.""" self.selected_countries = self.temp_selected_countries.copy() self.current_page = 1 self.close_filter_dropdowns() @rx.event def apply_costs_filter(self): new_min_cost = None new_max_cost = None try: if self.temp_min_cost_s...
@rx.event def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set() @rx.event def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None ...
def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set()
ted_countries.copy() self.current_page = 1 self.close_filter_dropdowns() @rx.event def apply_costs_filter(self): new_min_cost = None new_max_cost = None try: if self.temp_min_cost_str: new_min_cost = float(self.temp_min_cost_str) excep...
@rx.event def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set() @rx.event def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None ...
self.temp_selected_statuses = set()
self.close_filter_dropdowns() @rx.event def apply_costs_filter(self): new_min_cost = None new_max_cost = None try: if self.temp_min_cost_str: new_min_cost = float(self.temp_min_cost_str) except ValueError: pass try: ...
@rx.event def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None self.show_costs_filter = False self.current_page = 1 @rx.event def reset_all_filters(self): """Reset all ac...
def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set()
): new_min_cost = None new_max_cost = None try: if self.temp_min_cost_str: new_min_cost = float(self.temp_min_cost_str) except ValueError: pass try: if self.temp_max_cost_str: new_max_cost = float(self.temp_max_c...
@rx.event def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None self.show_costs_filter = False self.current_page = 1 @rx.event def reset_all_filters(self): """Reset all ac...
self.temp_selected_countries = set()
ne try: if self.temp_min_cost_str: new_min_cost = float(self.temp_min_cost_str) except ValueError: pass try: if self.temp_max_cost_str: new_max_cost = float(self.temp_max_cost_str) except ValueError: pass ...
@rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_statuses = set() self.selected_countries = set() self.min_cost = None self.max_cost = None self.temp_selected_statuses = set() ...
def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None self.show_costs_filter = False self.current_page = 1
mp_min_cost_str: new_min_cost = float(self.temp_min_cost_str) except ValueError: pass try: if self.temp_max_cost_str: new_max_cost = float(self.temp_max_cost_str) except ValueError: pass if ( new_min_cost is ...
self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None self.show_costs_filter = False self.current_page = 1 @rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_stat...
self.temp_min_cost_str = ""
_min_cost = float(self.temp_min_cost_str) except ValueError: pass try: if self.temp_max_cost_str: new_max_cost = float(self.temp_max_cost_str) except ValueError: pass if ( new_min_cost is not None and new_max_cos...
self.min_cost = None self.max_cost = None self.show_costs_filter = False self.current_page = 1 @rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_statuses = set() self.selected_c...
self.temp_max_cost_str = ""
_str) except ValueError: pass try: if self.temp_max_cost_str: new_max_cost = float(self.temp_max_cost_str) except ValueError: pass if ( new_min_cost is not None and new_max_cost is not None and (new_m...
self.max_cost = None self.show_costs_filter = False self.current_page = 1 @rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_statuses = set() self.selected_countries = set() self...
self.min_cost = None
or: pass try: if self.temp_max_cost_str: new_max_cost = float(self.temp_max_cost_str) except ValueError: pass if ( new_min_cost is not None and new_max_cost is not None and (new_min_cost > new_max_cost) ...
self.show_costs_filter = False self.current_page = 1 @rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_statuses = set() self.selected_countries = set() self.min_cost = None self...
self.max_cost = None
try: if self.temp_max_cost_str: new_max_cost = float(self.temp_max_cost_str) except ValueError: pass if ( new_min_cost is not None and new_max_cost is not None and (new_min_cost > new_max_cost) ): self.min_co...
self.current_page = 1 @rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_statuses = set() self.selected_countries = set() self.min_cost = None self.max_cost = None self.temp_sele...
self.show_costs_filter = False
str: new_max_cost = float(self.temp_max_cost_str) except ValueError: pass if ( new_min_cost is not None and new_max_cost is not None and (new_min_cost > new_max_cost) ): self.min_cost = new_max_cost self.max_...
@rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_statuses = set() self.selected_countries = set() self.min_cost = None self.max_cost = None self.temp_selected_statuses = set() ...
self.current_page = 1
(self.temp_max_cost_str) except ValueError: pass if ( new_min_cost is not None and new_max_cost is not None and (new_min_cost > new_max_cost) ): self.min_cost = new_max_cost self.max_cost = new_min_cost else: ...
@rx.event def close_filter_dropdowns(self): self.show_status_filter = False self.show_country_filter = False self.show_costs_filter = False @rx.event def download_csv(self): """Download the filtered and sorted data as CSV.""" if not self.filtered_and_sorted_dat...
def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_statuses = set() self.selected_countries = set() self.min_cost = None self.max_cost = None self.temp_selected_statuses = set() self.temp_selected_c...
new_min_cost is not None and new_max_cost is not None and (new_min_cost > new_max_cost) ): self.min_cost = new_max_cost self.max_cost = new_min_cost else: self.min_cost = new_min_cost self.max_cost = new_max_cost self....
self.selected_statuses = set() self.selected_countries = set() self.min_cost = None self.max_cost = None self.temp_selected_statuses = set() self.temp_selected_countries = set() self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_col...
self.search_owner = ""
and new_max_cost is not None and (new_min_cost > new_max_cost) ): self.min_cost = new_max_cost self.max_cost = new_min_cost else: self.min_cost = new_min_cost self.max_cost = new_max_cost self.show_costs_filter = False ...
self.selected_countries = set() self.min_cost = None self.max_cost = None self.temp_selected_statuses = set() self.temp_selected_countries = set() self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_column = None self.current_page = ...
self.selected_statuses = set()
e and (new_min_cost > new_max_cost) ): self.min_cost = new_max_cost self.max_cost = new_min_cost else: self.min_cost = new_min_cost self.max_cost = new_max_cost self.show_costs_filter = False self.current_page = 1 @rx.event...
self.min_cost = None self.max_cost = None self.temp_selected_statuses = set() self.temp_selected_countries = set() self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() ...
self.selected_countries = set()
x_cost) ): self.min_cost = new_max_cost self.max_cost = new_min_cost else: self.min_cost = new_min_cost self.max_cost = new_max_cost self.show_costs_filter = False self.current_page = 1 @rx.event def reset_status_filter(self): ...
self.max_cost = None self.temp_selected_statuses = set() self.temp_selected_countries = set() self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_...
self.min_cost = None
self.min_cost = new_max_cost self.max_cost = new_min_cost else: self.min_cost = new_min_cost self.max_cost = new_max_cost self.show_costs_filter = False self.current_page = 1 @rx.event def reset_status_filter(self): """Reset the status filte...
self.temp_selected_statuses = set() self.temp_selected_countries = set() self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): ...
self.max_cost = None
t self.max_cost = new_min_cost else: self.min_cost = new_min_cost self.max_cost = new_max_cost self.show_costs_filter = False self.current_page = 1 @rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selec...
self.temp_selected_countries = set() self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): self.show_status_filter = False s...
self.temp_selected_statuses = set()
else: self.min_cost = new_min_cost self.max_cost = new_max_cost self.show_costs_filter = False self.current_page = 1 @rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set() @rx.event def ...
self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): self.show_status_filter = False self.show_country_filter = False self....
self.temp_selected_countries = set()
min_cost self.max_cost = new_max_cost self.show_costs_filter = False self.current_page = 1 @rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset ...
self.temp_max_cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): self.show_status_filter = False self.show_country_filter = False self.show_costs_filter = False @rx.e...
self.temp_min_cost_str = ""
new_max_cost self.show_costs_filter = False self.current_page = 1 @rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset the country filter.""" self....
self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): self.show_status_filter = False self.show_country_filter = False self.show_costs_filter = False @rx.event def download_csv(self): ...
self.temp_max_cost_str = ""
s_filter = False self.current_page = 1 @rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set() ...
self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): self.show_status_filter = False self.show_country_filter = False self.show_costs_filter = False @rx.event def download_csv(self): """Download the filtered an...
self.sort_column = None
rrent_page = 1 @rx.event def reset_status_filter(self): """Reset the status filter.""" self.temp_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set() @rx.event def reset_costs_f...
self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): self.show_status_filter = False self.show_country_filter = False self.show_costs_filter = False @rx.event def download_csv(self): """Download the filtered and sorted data as CSV.""" ...
self.current_page = 1
et the status filter.""" self.temp_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set() @rx.event def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str...
@rx.event def download_csv(self): """Download the filtered and sorted data as CSV.""" if not self.filtered_and_sorted_data: return rx.toast("No data to export.", duration=3000) df = pd.DataFrame(self.filtered_and_sorted_data) column_mapping = { "owner": ...
def close_filter_dropdowns(self): self.show_status_filter = False self.show_country_filter = False self.show_costs_filter = False
_selected_statuses = set() @rx.event def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set() @rx.event def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None ...
self.show_country_filter = False self.show_costs_filter = False @rx.event def download_csv(self): """Download the filtered and sorted data as CSV.""" if not self.filtered_and_sorted_data: return rx.toast("No data to export.", duration=3000) df = pd.DataFrame...
self.show_status_filter = False
t def reset_country_filter(self): """Reset the country filter.""" self.temp_selected_countries = set() @rx.event def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None self.show_...
self.show_costs_filter = False @rx.event def download_csv(self): """Download the filtered and sorted data as CSV.""" if not self.filtered_and_sorted_data: return rx.toast("No data to export.", duration=3000) df = pd.DataFrame(self.filtered_and_sorted_data) c...
self.show_country_filter = False
"""Reset the country filter.""" self.temp_selected_countries = set() @rx.event def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None self.show_costs_filter = False self.current...
@rx.event def download_csv(self): """Download the filtered and sorted data as CSV.""" if not self.filtered_and_sorted_data: return rx.toast("No data to export.", duration=3000) df = pd.DataFrame(self.filtered_and_sorted_data) column_mapping = { "owner": ...
self.show_costs_filter = False
temp_selected_countries = set() @rx.event def reset_costs_filter(self): self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None self.show_costs_filter = False self.current_page = 1 @rx.event def reset_all_filters...
def download_csv(self): """Download the filtered and sorted data as CSV.""" if not self.filtered_and_sorted_data: return rx.toast("No data to export.", duration=3000) df = pd.DataFrame(self.filtered_and_sorted_data) column_mapping = { "owner": "Owner", ...
f.temp_min_cost_str = "" self.temp_max_cost_str = "" self.min_cost = None self.max_cost = None self.show_costs_filter = False self.current_page = 1 @rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" ...
df = pd.DataFrame(self.filtered_and_sorted_data) column_mapping = { "owner": "Owner", "status": "Status", "country": "Country", "stability": "Stability (%)", "costs": "Costs ($)", "last_edited": "Last Edited", } df_...
if not self.filtered_and_sorted_data: return rx.toast("No data to export.", duration=3000)
= None self.show_costs_filter = False self.current_page = 1 @rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_statuses = set() self.selected_countries = set() self.min_cost = None ...
column_mapping = { "owner": "Owner", "status": "Status", "country": "Country", "stability": "Stability (%)", "costs": "Costs ($)", "last_edited": "Last Edited", } df_display_cols = [key for key in column_mapping if key in d...
df = pd.DataFrame(self.filtered_and_sorted_data)
lf.current_page = 1 @rx.event def reset_all_filters(self): """Reset all active filters and search.""" self.search_owner = "" self.selected_statuses = set() self.selected_countries = set() self.min_cost = None self.max_cost = None self.temp_selected_status...
df_display_cols = [key for key in column_mapping if key in df.columns] df_display = df[df_display_cols] df_display = df_display.rename(columns=column_mapping) stream = io.StringIO() df_display.to_csv(stream, index=False) return rx.download( data=stream.getval...
column_mapping = { "owner": "Owner", "status": "Status", "country": "Country", "stability": "Stability (%)", "costs": "Costs ($)", "last_edited": "Last Edited", }
= None self.max_cost = None self.temp_selected_statuses = set() self.temp_selected_countries = set() self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def ...
df_display = df[df_display_cols] df_display = df_display.rename(columns=column_mapping) stream = io.StringIO() df_display.to_csv(stream, index=False) return rx.download( data=stream.getvalue(), filename="retail_data_export.csv", )
df_display_cols = [key for key in column_mapping if key in df.columns]
self.temp_selected_countries = set() self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): self.show_status_filter = False s...
df_display = df_display.rename(columns=column_mapping) stream = io.StringIO() df_display.to_csv(stream, index=False) return rx.download( data=stream.getvalue(), filename="retail_data_export.csv", )
df_display = df[df_display_cols]
et() self.temp_min_cost_str = "" self.temp_max_cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): self.show_status_filter = False self.show_country_filter = False s...
stream = io.StringIO() df_display.to_csv(stream, index=False) return rx.download( data=stream.getvalue(), filename="retail_data_export.csv", )
df_display = df_display.rename(columns=column_mapping)
cost_str = "" self.sort_column = None self.current_page = 1 self.close_filter_dropdowns() @rx.event def close_filter_dropdowns(self): self.show_status_filter = False self.show_country_filter = False self.show_costs_filter = False @rx.event def download_c...
df_display.to_csv(stream, index=False) return rx.download( data=stream.getvalue(), filename="retail_data_export.csv", )
stream = io.StringIO()
from retention_dashboard.components.layout import layout def index() -> rx.Component: """The main page of the app.""" return layout() app = rx.App(theme=rx.theme(appearance="light")) app.add_page(index, route="/")
import reflex as rx
import reflex as rx TooltipPropValue = Union[str, int, float, dict, bool] TOOLTIP_PROPS: Dict[str, Dict[str, TooltipPropValue]] = { "content_style": { "background": "white", "borderColor": "#E8E8E8", "borderRadius": "0.75rem", "boxShadow": "0px 24px 12px 0px rgba(28, 32, 36, 0.02)...
from typing import Dict, List, Union
from typing import Dict, List, Union
TooltipPropValue = Union[str, int, float, dict, bool] TOOLTIP_PROPS: Dict[str, Dict[str, TooltipPropValue]] = { "content_style": { "background": "white", "borderColor": "#E8E8E8", "borderRadius": "0.75rem", "boxShadow": "0px 24px 12px 0px rgba(28, 32, 36, 0.02), 0px 8px 8px 0px rgb...
import reflex as rx
from typing import Dict, List, Union import reflex as rx
TOOLTIP_PROPS: Dict[str, Dict[str, TooltipPropValue]] = { "content_style": { "background": "white", "borderColor": "#E8E8E8", "borderRadius": "0.75rem", "boxShadow": "0px 24px 12px 0px rgba(28, 32, 36, 0.02), 0px 8px 8px 0px rgba(28, 32, 36, 0.02), 0px 2px 6px 0px rgba(28, 32, 36, 0...
TooltipPropValue = Union[str, int, float, dict, bool]
from typing import Dict, List, Union import reflex as rx TooltipPropValue = Union[str, int, float, dict, bool] TOOLTIP_PROPS: Dict[str, Dict[str, TooltipPropValue]] = { "content_style": { "background": "white", "borderColor": "#E8E8E8", "borderRadius": "0.75rem", "boxShadow": "0px ...
def donut_chart( data: rx.Var[List[ChartDataItem]], data_key: str, name_key: str, title: str, total_value: rx.Var[int], percentage: rx.Var[float], ) -> rx.Component: """Creates a reusable donut chart component.""" return rx.el.div( rx.el.p( title, class...
ChartDataItem = Dict[str, Union[str, int, float]]
from retention_dashboard.components.retention import retention_component from retention_dashboard.components.workflow import workflow_component from retention_dashboard.states.dashboard_state import DashboardState def nav_button(text: str, is_active: rx.Var[bool]) -> rx.Component: """Creates a navigation button...
import reflex as rx
import reflex as rx
from retention_dashboard.components.workflow import workflow_component from retention_dashboard.states.dashboard_state import DashboardState def nav_button(text: str, is_active: rx.Var[bool]) -> rx.Component: """Creates a navigation button.""" return rx.el.button( text, on_click=lambda: Dashb...
from retention_dashboard.components.retention import retention_component
import reflex as rx from retention_dashboard.components.retention import retention_component
from retention_dashboard.states.dashboard_state import DashboardState def nav_button(text: str, is_active: rx.Var[bool]) -> rx.Component: """Creates a navigation button.""" return rx.el.button( text, on_click=lambda: DashboardState.set_active_tab(text), class_name=rx.cond( ...
from retention_dashboard.components.workflow import workflow_component
import reflex as rx from retention_dashboard.components.retention import retention_component from retention_dashboard.components.workflow import workflow_component
def nav_button(text: str, is_active: rx.Var[bool]) -> rx.Component: """Creates a navigation button.""" return rx.el.button( text, on_click=lambda: DashboardState.set_active_tab(text), class_name=rx.cond( is_active, "px-4 py-2 text-sm font-medium text-blue-700 b...
from retention_dashboard.states.dashboard_state import DashboardState
from retention_dashboard.states.retention_state import ( RetentionState, RetentionWeekData, ) def retention_cell( week_data: rx.Var[RetentionWeekData], index: rx.Var[int] ) -> rx.Component: """Renders a single cell in the retention table.""" percentage = week_data["value"] count = week_data[...
import reflex as rx
import reflex as rx
def retention_cell( week_data: rx.Var[RetentionWeekData], index: rx.Var[int] ) -> rx.Component: """Renders a single cell in the retention table.""" percentage = week_data["value"] count = week_data["count"] base_classes = "p-3 text-center " color_class = rx.cond( percentage.is_not_non...
from retention_dashboard.states.retention_state import ( RetentionState, RetentionWeekData, )
import reflex as rx from retention_dashboard.states.retention_state import ( RetentionState, RetentionWeekData, ) def retention_cell( week_data: rx.Var[RetentionWeekData], index: rx.Var[int] ) -> rx.Component: """Renders a single cell in the retention table."""
count = week_data["count"] base_classes = "p-3 text-center " color_class = rx.cond( percentage.is_not_none(), rx.cond( percentage >= 80, "bg-blue-600 text-white rounded-lg", rx.cond( percentage >= 60, "bg-blue-500 text-whit...
percentage = week_data["value"]
import reflex as rx from retention_dashboard.states.retention_state import ( RetentionState, RetentionWeekData, ) def retention_cell( week_data: rx.Var[RetentionWeekData], index: rx.Var[int] ) -> rx.Component: """Renders a single cell in the retention table.""" percentage = week_data["value"] ...
base_classes = "p-3 text-center " color_class = rx.cond( percentage.is_not_none(), rx.cond( percentage >= 80, "bg-blue-600 text-white rounded-lg", rx.cond( percentage >= 60, "bg-blue-500 text-white rounded-lg", ...
count = week_data["count"]
import reflex as rx from retention_dashboard.states.retention_state import ( RetentionState, RetentionWeekData, ) def retention_cell( week_data: rx.Var[RetentionWeekData], index: rx.Var[int] ) -> rx.Component: """Renders a single cell in the retention table.""" percentage = week_data["value"] ...
color_class = rx.cond( percentage.is_not_none(), rx.cond( percentage >= 80, "bg-blue-600 text-white rounded-lg", rx.cond( percentage >= 60, "bg-blue-500 text-white rounded-lg", rx.cond( percentag...
base_classes = "p-3 text-center "
from retention_dashboard.components.charts import donut_chart from retention_dashboard.states.workflow_state import WorkflowState def workflow_component() -> rx.Component: """The Workflow tab UI.""" return rx.el.div( rx.el.h2( "Workflow", class_name="text-2xl font-semibold te...
import reflex as rx
import reflex as rx
from retention_dashboard.states.workflow_state import WorkflowState def workflow_component() -> rx.Component: """The Workflow tab UI.""" return rx.el.div( rx.el.h2( "Workflow", class_name="text-2xl font-semibold text-gray-800 mb-2", ), rx.el.p( "Ana...
from retention_dashboard.components.charts import donut_chart
import reflex as rx from retention_dashboard.components.charts import donut_chart
def workflow_component() -> rx.Component: """The Workflow tab UI.""" return rx.el.div( rx.el.h2( "Workflow", class_name="text-2xl font-semibold text-gray-800 mb-2", ), rx.el.p( "Analyze case testing efficiency and simulate cost impacts across depart...
from retention_dashboard.states.workflow_state import WorkflowState
import reflex as rx class DashboardState(rx.State): """State to manage the active tab in the dashboard.""" active_tab: Literal["Support", "Retention", "Workflow", "Agents"] = "Retention" @rx.event def set_active_tab( self, tab: Literal["Support", "Retention", "Workflow", "Agents"],...
from typing import Literal
from typing import Literal
class DashboardState(rx.State): """State to manage the active tab in the dashboard.""" active_tab: Literal["Support", "Retention", "Workflow", "Agents"] = "Retention" @rx.event def set_active_tab( self, tab: Literal["Support", "Retention", "Workflow", "Agents"], ): """Se...
import reflex as rx
from typing import Literal import reflex as rx class DashboardState(rx.State): """State to manage the active tab in the dashboard.""" active_tab: Literal["Support", "Retention", "Workflow", "Agents"] = "Retention" @rx.event def set_active_tab( self, tab: Literal["Support", "Retentio...
self.active_tab = tab
import reflex as rx from retention_dashboard.states.data import retention_data_raw class RetentionWeekData(TypedDict): value: Optional[float] count: Optional[int] class RetentionCohortData(TypedDict): cohort: str initial_customers: int weeks: List[RetentionWeekData] class RetentionState(rx....
from typing import List, Optional, TypedDict
from typing import List, Optional, TypedDict
from retention_dashboard.states.data import retention_data_raw class RetentionWeekData(TypedDict): value: Optional[float] count: Optional[int] class RetentionCohortData(TypedDict): cohort: str initial_customers: int weeks: List[RetentionWeekData] class RetentionState(rx.State): """State ...
import reflex as rx
from typing import List, Optional, TypedDict import reflex as rx
class RetentionWeekData(TypedDict): value: Optional[float] count: Optional[int] class RetentionCohortData(TypedDict): cohort: str initial_customers: int weeks: List[RetentionWeekData] class RetentionState(rx.State): """State for the Cohort Retention tab.""" column_headers: list[str] ...
from retention_dashboard.states.data import retention_data_raw
from typing import List, Optional, TypedDict import reflex as rx from retention_dashboard.states.data import retention_data_raw
class RetentionCohortData(TypedDict): cohort: str initial_customers: int weeks: List[RetentionWeekData] class RetentionState(rx.State): """State for the Cohort Retention tab.""" column_headers: list[str] = [ "Cohort", "Week 0", "Week 1", "Week 2", "Week ...
class RetentionWeekData(TypedDict): value: Optional[float] count: Optional[int]
from typing import List, Optional, TypedDict import reflex as rx from retention_dashboard.states.data import retention_data_raw class RetentionWeekData(TypedDict): value: Optional[float] count: Optional[int]
class RetentionState(rx.State): """State for the Cohort Retention tab.""" column_headers: list[str] = [ "Cohort", "Week 0", "Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6", "Week 7", "Week 8", "Week 9", ] ...
class RetentionCohortData(TypedDict): cohort: str initial_customers: int weeks: List[RetentionWeekData]
dDict import reflex as rx from retention_dashboard.states.data import retention_data_raw class RetentionWeekData(TypedDict): value: Optional[float] count: Optional[int] class RetentionCohortData(TypedDict): cohort: str initial_customers: int weeks: List[RetentionWeekData] class RetentionStat...
return "bg-gray-100"
elif percentage >= 20: return "bg-blue-300" elif percentage > 0: return "bg-blue-200"
import retention_data_raw class RetentionWeekData(TypedDict): value: Optional[float] count: Optional[int] class RetentionCohortData(TypedDict): cohort: str initial_customers: int weeks: List[RetentionWeekData] class RetentionState(rx.State): """State for the Cohort Retention tab.""" ...
return "bg-gray-100"
elif percentage > 0: return "bg-blue-200"
from typing import Dict, List, TypedDict
class ChartData(TypedDict): name: str value: int percentage: float fill: str class WorkflowState(rx.State): """State for the Workflow tab.""" test_quota: int = 34 departments: List[str] = [ "Customer Service", "Technical Support", "Billing Support", "Cla...
import reflex as rx
from typing import Dict, List, TypedDict import reflex as rx
class WorkflowState(rx.State): """State for the Workflow tab.""" test_quota: int = 34 departments: List[str] = [ "Customer Service", "Technical Support", "Billing Support", "Claims Processing", "Account Management", "Sales Support", ] excluded_depa...
class ChartData(TypedDict): name: str value: int percentage: float fill: str
completed_cases_data: list[ChartData] = [ { "name": "Completed", "value": 11327, "percentage": 100.0, "fill": "#3b82f6", } ] test_results_data_tested: list[ChartData] = [ { "name": "Tested", "value": 3874, ...
@rx.event def toggle_department(self, dept_name: str): """Toggles the exclusion status of a department.""" self.excluded_departments[dept_name] = not self.excluded_departments[dept_name]
def set_test_quota(self, value: str): """Sets the test quota value from the slider.""" self.test_quota = int(value)
"name": "Tested", "value": 3874, "percentage": 34.2, "fill": "#3b82f6", } ] test_results_data_untested: list[ChartData] = [ { "name": "Untested", "value": 7453, "percentage": 65.8, "fill": "#d1d5db", } ...
self.excluded_departments[dept_name] = not self.excluded_departments[dept_name]
from .backend.backend import State from .views.email import email_gen_ui from .views.navbar import navbar from .views.table import main_table def index() -> rx.Component: return rx.vstack( navbar(), rx.flex( rx.box(main_table(), width=["100%", "100%", "100%", "60%"]), ema...
import reflex as rx
import reflex as rx
from .views.email import email_gen_ui from .views.navbar import navbar from .views.table import main_table def index() -> rx.Component: return rx.vstack( navbar(), rx.flex( rx.box(main_table(), width=["100%", "100%", "100%", "60%"]), email_gen_ui(), spacing="6"...
from .backend.backend import State
import reflex as rx from .backend.backend import State
from .views.navbar import navbar from .views.table import main_table def index() -> rx.Component: return rx.vstack( navbar(), rx.flex( rx.box(main_table(), width=["100%", "100%", "100%", "60%"]), email_gen_ui(), spacing="6", width="100%", ...
from .views.email import email_gen_ui
import reflex as rx from .backend.backend import State from .views.email import email_gen_ui
from .views.table import main_table def index() -> rx.Component: return rx.vstack( navbar(), rx.flex( rx.box(main_table(), width=["100%", "100%", "100%", "60%"]), email_gen_ui(), spacing="6", width="100%", flex_direction=["column", "colu...
from .views.navbar import navbar
import reflex as rx from .backend.backend import State from .views.email import email_gen_ui from .views.navbar import navbar
def index() -> rx.Component: return rx.vstack( navbar(), rx.flex( rx.box(main_table(), width=["100%", "100%", "100%", "60%"]), email_gen_ui(), spacing="6", width="100%", flex_direction=["column", "column", "column", "row"], ), ...
from .views.table import main_table
import os
import reflex as rx from sqlmodel import asc, desc, func, or_, select from .models import Customer products: dict[str, dict] = { "T-shirt": { "description": "A plain white t-shirt made of 100% cotton.", "price": 10.99, }, "Jeans": { "description": "A pair of blue denim jeans with ...
import openai
import os import openai
from sqlmodel import asc, desc, func, or_, select from .models import Customer products: dict[str, dict] = { "T-shirt": { "description": "A plain white t-shirt made of 100% cotton.", "price": 10.99, }, "Jeans": { "description": "A pair of blue denim jeans with a straight leg fit."...
import reflex as rx
import os import openai import reflex as rx
from .models import Customer products: dict[str, dict] = { "T-shirt": { "description": "A plain white t-shirt made of 100% cotton.", "price": 10.99, }, "Jeans": { "description": "A pair of blue denim jeans with a straight leg fit.", "price": 24.99, }, "Hoodie": { ...
from sqlmodel import asc, desc, func, or_, select
import os import openai import reflex as rx from sqlmodel import asc, desc, func, or_, select
products: dict[str, dict] = { "T-shirt": { "description": "A plain white t-shirt made of 100% cotton.", "price": 10.99, }, "Jeans": { "description": "A pair of blue denim jeans with a straight leg fit.", "price": 24.99, }, "Hoodie": { "description": "A black...
from .models import Customer
"price": 24.99, }, "Hoodie": { "description": "A black hoodie made of a cotton and polyester blend.", "price": 34.99, }, "Cardigan": { "description": "A grey cardigan with a V-neck and long sleeves.", "price": 36.99, }, "Joggers": { "description": "A...
def get_openai_client(): global _client if _client is None: _client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"]) return _client class State(rx.State): """The app state.""" current_user: Customer = Customer() users: list[Customer] = [] products: dict[str, str] = {} ...
_client = None
.99, }, "Hoodie": { "description": "A black hoodie made of a cotton and polyester blend.", "price": 34.99, }, "Cardigan": { "description": "A grey cardigan with a V-neck and long sleeves.", "price": 36.99, }, "Joggers": { "description": "A pair of black jo...
class State(rx.State): """The app state.""" current_user: Customer = Customer() users: list[Customer] = [] products: dict[str, str] = {} email_content_data: str = ( "Click 'Generate Email' to generate a personalized sales email." ) gen_response = False tone: str = "😊 Formal"...
def get_openai_client(): global _client if _client is None: _client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"]) return _client
": "A black hoodie made of a cotton and polyester blend.", "price": 34.99, }, "Cardigan": { "description": "A grey cardigan with a V-neck and long sleeves.", "price": 36.99, }, "Joggers": { "description": "A pair of black joggers made of a cotton and polyester blend.", ...
return _client class State(rx.State): """The app state.""" current_user: Customer = Customer() users: list[Customer] = [] products: dict[str, str] = {} email_content_data: str = ( "Click 'Generate Email' to generate a personalized sales email." ) gen_response = False ton...
if _client is None: _client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"])
cotton and polyester blend.", "price": 34.99, }, "Cardigan": { "description": "A grey cardigan with a V-neck and long sleeves.", "price": 36.99, }, "Joggers": { "description": "A pair of black joggers made of a cotton and polyester blend.", "price": 44.99, },...
return _client class State(rx.State): """The app state.""" current_user: Customer = Customer() users: list[Customer] = [] products: dict[str, str] = {} email_content_data: str = ( "Click 'Generate Email' to generate a personalized sales email." ) gen_response = False ton...
_client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"])
black dress made of 100% polyester.", "price": 49.99}, "Jacket": { "description": "A navy blue jacket made of 100% cotton.", "price": 55.99, }, "Skirt": { "description": "A brown skirt made of a cotton and polyester blend.", "price": 29.99, }, "Shorts": { "des...
tone: str = "😊 Formal" length: int = 1000 search_value: str = "" sort_value: str = "" sort_reverse: bool = False @rx.event def set_tone(self, value: str): self.tone = value @rx.event def set_length(self, value: list[int | float]): self.length = int(value[0]) ...
gen_response = False
Skirt": { "description": "A brown skirt made of a cotton and polyester blend.", "price": 29.99, }, "Shorts": { "description": "A pair of black shorts made of a cotton and polyester blend.", "price": 19.99, }, "Sweater": { "description": "A white sweater with a cre...
@rx.event def set_length(self, value: list[int | float]): self.length = int(value[0]) def load_entries(self) -> list[Customer]: """Get all users from the database.""" with rx.session() as session: query = select(Customer) if self.search_value: ...
def set_tone(self, value: str): self.tone = value
n skirt made of a cotton and polyester blend.", "price": 29.99, }, "Shorts": { "description": "A pair of black shorts made of a cotton and polyester blend.", "price": 19.99, }, "Sweater": { "description": "A white sweater with a crew neck and long sleeves.", "pric...
@rx.event def set_length(self, value: list[int | float]): self.length = int(value[0]) def load_entries(self) -> list[Customer]: """Get all users from the database.""" with rx.session() as session: query = select(Customer) if self.search_value: ...
self.tone = value
r blend.", "price": 29.99, }, "Shorts": { "description": "A pair of black shorts made of a cotton and polyester blend.", "price": 19.99, }, "Sweater": { "description": "A white sweater with a crew neck and long sleeves.", "price": 39.99, }, } _client = None ...
def load_entries(self) -> list[Customer]: """Get all users from the database.""" with rx.session() as session: query = select(Customer) if self.search_value: search_value = f"%{str(self.search_value).lower()}%" query = query.where( ...
def set_length(self, value: list[int | float]): self.length = int(value[0])
{ "description": "A pair of black shorts made of a cotton and polyester blend.", "price": 19.99, }, "Sweater": { "description": "A white sweater with a crew neck and long sleeves.", "price": 39.99, }, } _client = None def get_openai_client(): global _client if _cli...
def load_entries(self) -> list[Customer]: """Get all users from the database.""" with rx.session() as session: query = select(Customer) if self.search_value: search_value = f"%{str(self.search_value).lower()}%" query = query.where( ...
self.length = int(value[0])
ater with a crew neck and long sleeves.", "price": 39.99, }, } _client = None def get_openai_client(): global _client if _client is None: _client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"]) return _client class State(rx.State): """The app state.""" current_user: ...
if self.search_value: search_value = f"%{str(self.search_value).lower()}%" query = query.where( or_( *[ getattr(Customer, field).ilike(search_value) for field in Customer.get_...
query = select(Customer)
s.", "price": 39.99, }, } _client = None def get_openai_client(): global _client if _client is None: _client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"]) return _client class State(rx.State): """The app state.""" current_user: Customer = Customer() users: list...
if self.sort_value: sort_column = getattr(Customer, self.sort_value) if self.sort_value == "salary": order = desc(sort_column) if self.sort_reverse else asc(sort_column) else: order = ( desc(fun...
if self.search_value: search_value = f"%{str(self.search_value).lower()}%" query = query.where( or_( *[ getattr(Customer, field).ilike(search_value) for field in Customer.get_fields() ...
_client = None def get_openai_client(): global _client if _client is None: _client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"]) return _client class State(rx.State): """The app state.""" current_user: Customer = Customer() users: list[Customer] = [] products: dict[str...
query = query.where( or_( *[ getattr(Customer, field).ilike(search_value) for field in Customer.get_fields() ], ) ) if self.sort_v...
search_value = f"%{str(self.search_value).lower()}%"
_client is None: _client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"]) return _client class State(rx.State): """The app state.""" current_user: Customer = Customer() users: list[Customer] = [] products: dict[str, str] = {} email_content_data: str = ( "Click 'Generate ...
if self.sort_value: sort_column = getattr(Customer, self.sort_value) if self.sort_value == "salary": order = desc(sort_column) if self.sort_reverse else asc(sort_column) else: order = ( desc(fun...
query = query.where( or_( *[ getattr(Customer, field).ilike(search_value) for field in Customer.get_fields() ], ) )
r = ( "Click 'Generate Email' to generate a personalized sales email." ) gen_response = False tone: str = "😊 Formal" length: int = 1000 search_value: str = "" sort_value: str = "" sort_reverse: bool = False @rx.event def set_tone(self, value: str): self.tone = value...
self.users = session.exec(query).all() def sort_values(self, sort_value: str): self.sort_value = sort_value self.load_entries() def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries() def filter_values(self, search_value): ...
if self.sort_value: sort_column = getattr(Customer, self.sort_value) if self.sort_value == "salary": order = desc(sort_column) if self.sort_reverse else asc(sort_column) else: order = ( desc(func.lower(sort_c...
' to generate a personalized sales email." ) gen_response = False tone: str = "😊 Formal" length: int = 1000 search_value: str = "" sort_value: str = "" sort_reverse: bool = False @rx.event def set_tone(self, value: str): self.tone = value @rx.event def set_length(s...
if self.sort_value == "salary": order = desc(sort_column) if self.sort_reverse else asc(sort_column) else: order = ( desc(func.lower(sort_column)) if self.sort_reverse else as...
sort_column = getattr(Customer, self.sort_value)
= False tone: str = "😊 Formal" length: int = 1000 search_value: str = "" sort_value: str = "" sort_reverse: bool = False @rx.event def set_tone(self, value: str): self.tone = value @rx.event def set_length(self, value: list[int | float]): self.length = int(value[0...
query = query.order_by(order) self.users = session.exec(query).all() def sort_values(self, sort_value: str): self.sort_value = sort_value self.load_entries() def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries() ...
if self.sort_value == "salary": order = desc(sort_column) if self.sort_reverse else asc(sort_column) else: order = ( desc(func.lower(sort_column)) if self.sort_reverse else asc(func.lower(sort...
= 1000 search_value: str = "" sort_value: str = "" sort_reverse: bool = False @rx.event def set_tone(self, value: str): self.tone = value @rx.event def set_length(self, value: list[int | float]): self.length = int(value[0]) def load_entries(self) -> list[Customer]: ...
else: order = ( desc(func.lower(sort_column)) if self.sort_reverse else asc(func.lower(sort_column)) ) query = query.order_by(order) self.users = session.exec(que...
order = desc(sort_column) if self.sort_reverse else asc(sort_column)
f set_tone(self, value: str): self.tone = value @rx.event def set_length(self, value: list[int | float]): self.length = int(value[0]) def load_entries(self) -> list[Customer]: """Get all users from the database.""" with rx.session() as session: query = select(Cu...
query = query.order_by(order) self.users = session.exec(query).all() def sort_values(self, sort_value: str): self.sort_value = sort_value self.load_entries() def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries() ...
order = ( desc(func.lower(sort_column)) if self.sort_reverse else asc(func.lower(sort_column)) )
"""Get all users from the database.""" with rx.session() as session: query = select(Customer) if self.search_value: search_value = f"%{str(self.search_value).lower()}%" query = query.where( or_( *[ ...
self.users = session.exec(query).all() def sort_values(self, sort_value: str): self.sort_value = sort_value self.load_entries() def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries() def filter_values(self, search_value): ...
query = query.order_by(order)
.""" with rx.session() as session: query = select(Customer) if self.search_value: search_value = f"%{str(self.search_value).lower()}%" query = query.where( or_( *[ getattr(Customer, fi...
def sort_values(self, sort_value: str): self.sort_value = sort_value self.load_entries() def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries() def filter_values(self, search_value): self.search_value = search_value self.load_...
self.users = session.exec(query).all()
query = select(Customer) if self.search_value: search_value = f"%{str(self.search_value).lower()}%" query = query.where( or_( *[ getattr(Customer, field).ilike(search_value) ...
def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries() def filter_values(self, search_value): self.search_value = search_value self.load_entries() def get_user(self, user: Customer): self.current_user = user def add_customer_to_d...
def sort_values(self, sort_value: str): self.sort_value = sort_value self.load_entries()