diff --git a/dashboard/components/navbar.py b/dashboard/components/navbar.py index 4d00210..507a406 100644 --- a/dashboard/components/navbar.py +++ b/dashboard/components/navbar.py @@ -4,7 +4,7 @@ from dash import dcc from dash import html import dash_bootstrap_components as dbc -from utils import t1b1_df, isCurrentTab, Pages, component_ids, state_to_url +from utils import dataviz_df, isCurrentTab, Pages, component_ids, state_to_url def select_company_component(currentTab, state): @@ -37,7 +37,7 @@ def select_company_component(currentTab, state): options=[{ 'label': i, 'value': i - } for i in t1b1_df['company_name']], + } for i in dataviz_df['company_name']], #value='Andros' multi=isCurrentTab(currentTab, Pages.COMPARE), searchable=True, diff --git a/dashboard/data/BDD_for_dataviz.xlsx b/dashboard/data/BDD_for_dataviz.xlsx new file mode 100644 index 0000000..90de7a1 Binary files /dev/null and b/dashboard/data/BDD_for_dataviz.xlsx differ diff --git a/dashboard/data/~$BDD Surcouche pour dataviz_v03.xlsx b/dashboard/data/~$BDD Surcouche pour dataviz_v03.xlsx deleted file mode 100644 index c0e1651..0000000 Binary files a/dashboard/data/~$BDD Surcouche pour dataviz_v03.xlsx and /dev/null differ diff --git a/dashboard/layout/pages/action_suivi.py b/dashboard/layout/pages/action_suivi.py index 7944280..e5e4d7e 100644 --- a/dashboard/layout/pages/action_suivi.py +++ b/dashboard/layout/pages/action_suivi.py @@ -1,5 +1,5 @@ from dash import html -from utils import card_style, t1b3_df +from utils import card_style, dataviz_df from layout.pages.action_suivi_global import action_suivi_global from layout.pages.action_suivi_actuel import action_suivi_actuel diff --git a/dashboard/layout/pages/action_suivi_actuel.py b/dashboard/layout/pages/action_suivi_actuel.py index 627ec5f..cef11dd 100644 --- a/dashboard/layout/pages/action_suivi_actuel.py +++ b/dashboard/layout/pages/action_suivi_actuel.py @@ -4,7 +4,7 @@ import dash_daq as daq from utils import card_style -from utils import t1b2_df +from utils import dataviz_df import plotly.graph_objects as go import plotly.figure_factory as ff @@ -100,7 +100,7 @@ def build_bullet_gauge(engagement, accomplishment, color_accomplishment): def top_left(selected_company): - df = get_filtered_data(t1b2_df, selected_company) + df = get_filtered_data(dataviz_df, selected_company) value = get_data(df, 'direct_score_short_label') color = get_data(df, 'direct_score_hexa_color_code') pic = 'assets/frames/Picto_usine.png' @@ -128,7 +128,7 @@ def generate_topleft_item(selected_company): def top_right(selected_company): - df = get_filtered_data(t1b2_df, selected_company) + df = get_filtered_data(dataviz_df, selected_company) value = get_data(df, 'complete_score_short_label') color = get_data(df, 'complete_score_hexa_color_code') pic = 'assets/frames/Picto_lifecycle.png' @@ -156,7 +156,7 @@ def generate_topright_item(selected_company): def bottom_left(selected_company): - df = get_filtered_data(t1b2_df, selected_company) + df = get_filtered_data(dataviz_df, selected_company) values = [] col_list = ['c1_final_value', 'c1_2_deg_final', 'c1_1_8_deg_final', 'c1_1_5_deg_final'] @@ -219,7 +219,7 @@ def generate_bottomleft_item(selected_company): def bottom_right(selected_company): - df = get_filtered_data(t1b2_df, selected_company) + df = get_filtered_data(dataviz_df, selected_company) values = [] col_list = ['c2_final_value', 'c2_2_deg_final', 'c2_1_8_deg_final', 'c2_1_5_deg_final'] diff --git a/dashboard/layout/pages/action_suivi_global.py b/dashboard/layout/pages/action_suivi_global.py index 258d474..681c0e6 100755 --- a/dashboard/layout/pages/action_suivi_global.py +++ b/dashboard/layout/pages/action_suivi_global.py @@ -1,5 +1,5 @@ from dash import html -from utils import card_style, t1b3_df +from utils import card_style, dataviz_df def get_company_global_information(df_companies_global_information, selected_company): @@ -21,7 +21,7 @@ def get_company_global_information(df_companies_global_information, selected_com def action_suivi_global(selected_company): - company_global_information = get_company_global_information(t1b3_df, selected_company) + company_global_information = get_company_global_information(dataviz_df, selected_company) return html.Div( children=[ html.Div([ diff --git a/dashboard/layout/pages/details.py b/dashboard/layout/pages/details.py index 95f4a2d..881296b 100644 --- a/dashboard/layout/pages/details.py +++ b/dashboard/layout/pages/details.py @@ -1,9 +1,8 @@ # from turtle import back # import pandas as pd from dash import dcc, html -from utils import t1b6_df +from utils import dataviz_df import plotly.express as px -# import plotly.graph_objs as go def get_company_details(df, selected_company): @@ -20,7 +19,7 @@ def get_company_details(df, selected_company): # Generate bar chart def details(selected_company): - df, amount, name, hover = get_company_details(t1b6_df, selected_company) + df, amount, name, hover = get_company_details(dataviz_df, selected_company) fig = px.bar( data_frame = df, x=[1, 1, 1, 1, 1, 1], diff --git a/dashboard/layout/pages/engagements.py b/dashboard/layout/pages/engagements.py index 58ecc12..f3ba6c3 100644 --- a/dashboard/layout/pages/engagements.py +++ b/dashboard/layout/pages/engagements.py @@ -1,27 +1,27 @@ from dash import html import dash_daq as daq -from utils import card_style, t1b5_df +from utils import card_style, dataviz_df def engagements(selected_company): return html.Div(children=[ html.Div('Ses engagements', className="h5"), - html.Div(t1b5_df[t1b5_df['company_name'] == selected_company]['direct_commitments_sentence'], + html.Div(dataviz_df[dataviz_df['company_name'] == selected_company]['direct_commitments_sentence'], className="fst-italic"), html.Div([ - daq.Indicator(color=t1b5_df[t1b5_df['company_name'] == selected_company]['direct_ambition_hexa_color_code'], + daq.Indicator(color=dataviz_df[dataviz_df['company_name'] == selected_company]['direct_ambition_hexa_color_code'], value=True), - html.Div(t1b5_df[t1b5_df['company_name'] == selected_company]['direct_ambition_long_label'], + html.Div(dataviz_df[dataviz_df['company_name'] == selected_company]['direct_ambition_long_label'], className="text-muted"), ], className="d-flex align-items-center gap-2 mt-2 mb-3"), - html.Div(t1b5_df[t1b5_df['company_name'] == selected_company]['complete_commitments_sentence'], + html.Div(dataviz_df[dataviz_df['company_name'] == selected_company]['complete_commitments_sentence'], className="fst-italic"), html.Div([ daq.Indicator( - color=t1b5_df[t1b5_df['company_name'] == selected_company]['complete_ambition_hexa_color_code'], + color=dataviz_df[dataviz_df['company_name'] == selected_company]['complete_ambition_hexa_color_code'], value=True), - html.Div(t1b5_df[t1b5_df['company_name'] == selected_company]['complete_ambition_long_label'], + html.Div(dataviz_df[dataviz_df['company_name'] == selected_company]['complete_ambition_long_label'], className="text-muted"), ], className="d-flex align-items-center gap-2 mt-2"), diff --git a/dashboard/layout/pages/infos.py b/dashboard/layout/pages/infos.py index 4fff2d0..092562a 100644 --- a/dashboard/layout/pages/infos.py +++ b/dashboard/layout/pages/infos.py @@ -1,7 +1,7 @@ # Libraries import from dash import html -from utils import card_style, t1b7_df +from utils import card_style, dataviz_df import flag import ast @@ -9,29 +9,29 @@ def infos(selected_company): - top_brands = ast.literal_eval(t1b7_df[t1b7_df['company_name'] == selected_company]['top_brands'].values[0]) + top_brands = ast.literal_eval(dataviz_df[dataviz_df['company_name'] == selected_company]['top_brands'].values[0]) return html.Div( children=[ html.Div([ html.Div([ - html.Img(src=t1b7_df[t1b7_df['company_name'] == selected_company]['brand_logo'].values[0], + html.Img(src=dataviz_df[dataviz_df['company_name'] == selected_company]['brand_logo'].values[0], className="w-100 img-thumbnail"), ], className="col", style={"maxWidth": "110px"}), html.Div([ html.Div(selected_company + " " + - flag.flag(t1b7_df[t1b7_df['company_name'] == selected_company]['country_flag'].values[0]), + flag.flag(dataviz_df[dataviz_df['company_name'] == selected_company]['country_flag'].values[0]), className="h3"), - #html.Div('Sector: ' + t1b7_df[t1b7_df['company_name'] == selected_company]['sector'].values[0], #English version - html.Div('Secteur : ' + t1b7_df[t1b7_df['company_name'] == selected_company]['sector'].values[0], #French version + #html.Div('Sector: ' + dataviz_df[dataviz_df['company_name'] == selected_company]['sector'].values[0], #English version + html.Div('Secteur : ' + dataviz_df[dataviz_df['company_name'] == selected_company]['sector'].values[0], #French version className="text-muted text-nowrap"), html.Div([ - #'Revenue: ' + t1b7_df[t1b7_df['company_name'] == selected_company]['revenue'].values[0].round( #English version - 'C.A : ' + t1b7_df[t1b7_df['company_name'] == selected_company]['revenue'].values[0].round( #French version + #'Revenue: ' + dataviz_df[dataviz_df['company_name'] == selected_company]['revenue'].values[0].round( #English version + 'C.A : ' + dataviz_df[dataviz_df['company_name'] == selected_company]['revenue'].values[0].round( #French version decimals=1).astype(str) + ' B (' + - t1b7_df[t1b7_df['company_name'] == selected_company]['revenue_year'].values[0].astype(str) + ')' + dataviz_df[dataviz_df['company_name'] == selected_company]['revenue_year'].values[0].astype(str) + ')' ], className="text-muted text-nowrap") ], @@ -40,8 +40,8 @@ def infos(selected_company): className="row"), #html.Div('Main brands:', className="h5 mt-3"), #English version html.Div('Principales marques :', className="h5 mt-3"), #French version - #dash_table.DataTable({'test' : t1b7_df[t1b7_df['company_name']==selected_company]['top_brands'].values[0]}) - #html.Code(tabulate(t1b7_df[t1b7_df['company_name']==selected_company]['top_brands'].values[0], tablefmt='html')) + #dash_table.DataTable({'test' : dataviz_df[dataviz_df['company_name']==selected_company]['top_brands'].values[0]}) + #html.Code(tabulate(dataviz_df[dataviz_df['company_name']==selected_company]['top_brands'].values[0], tablefmt='html')) html.Ul( [html.Li(i, className="list-group-item") for i in top_brands], className="list-group p-0", diff --git a/dashboard/layout/pages/reduction_rate.py b/dashboard/layout/pages/reduction_rate.py index df97361..f0afd52 100644 --- a/dashboard/layout/pages/reduction_rate.py +++ b/dashboard/layout/pages/reduction_rate.py @@ -2,7 +2,7 @@ import dash_bootstrap_components as dbc import plotly.graph_objects as go -from utils import t2b2_df, card_style +from utils import dataviz_df, card_style def get_filtered_data(df, selected_companies): @@ -62,7 +62,7 @@ def build_lollipop_chart(accomplishment, color_accomplishment, companies_names, def chart_left(selected_companies): - df = get_filtered_data(t2b2_df, selected_companies) + df = get_filtered_data(dataviz_df, selected_companies) df = df.sort_values(by='direct_level').reset_index(drop=True) accomplishment = get_data(df, 'direct_level') color_accomplishment = get_data(df, 'direct_score_hexa_color_code') @@ -72,7 +72,7 @@ def chart_left(selected_companies): def chart_right(selected_companies): - df = get_filtered_data(t2b2_df, selected_companies) + df = get_filtered_data(dataviz_df, selected_companies) df = df.sort_values(by='complete_level').reset_index(drop=True) accomplishment = get_data(df, 'complete_level') color_accomplishment = get_data(df, 'complete_score_hexa_color_code') diff --git a/dashboard/layout/pages/sector_compare.py b/dashboard/layout/pages/sector_compare.py index 32a43b4..714db30 100644 --- a/dashboard/layout/pages/sector_compare.py +++ b/dashboard/layout/pages/sector_compare.py @@ -1,7 +1,7 @@ from dash import html -from utils import t1b4_df, card_style +from utils import dataviz_df, card_style -df_t1b4 = t1b4_df +df_t1b4 = dataviz_df printable_columns = [ 'company_name', 'global_score_logo_path', 'direct_score_short_label', 'complete_score_short_label', diff --git a/dashboard/utils.py b/dashboard/utils.py index c831372..e9d7f35 100644 --- a/dashboard/utils.py +++ b/dashboard/utils.py @@ -45,11 +45,13 @@ def state_to_url(*state): return f'?{state}' -t1b1_df = pd.read_csv('data/t1b1.csv') -t1b2_df = pd.read_csv('data/t1b2.csv') -t1b3_df = pd.read_csv('data/t1b3.csv') -t1b4_df = pd.read_csv('data/t1b4.csv') -t1b5_df = pd.read_csv('data/t1b5.csv') -t1b6_df = pd.read_csv('data/t1b6.csv', sep=';') -t1b7_df = pd.read_csv('data/t1b1-7.csv') -t2b2_df = pd.read_csv('data/t2b2.csv') +# t1b1_df = pd.read_csv('data/t1b1.csv') +# t1b2_df = pd.read_csv('data/t1b2.csv') +# t1b3_df = pd.read_csv('data/t1b3.csv') +# t1b4_df = pd.read_csv('data/t1b4.csv') +# t1b5_df = pd.read_csv('data/t1b5.csv') +# t1b6_df = pd.read_csv('data/t1b6.csv', sep=';') +# t1b7_df = pd.read_csv('data/t1b1-7.csv') +# t2b2_df = pd.read_csv('data/t2b2.csv') + +dataviz_df = pd.read_excel('data/BDD_for_dataviz.xlsx', sheet_name='Sheet1') \ No newline at end of file