Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dashboard/components/navbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down
Binary file added dashboard/data/BDD_for_dataviz.xlsx
Binary file not shown.
Binary file removed dashboard/data/~$BDD Surcouche pour dataviz_v03.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion dashboard/layout/pages/action_suivi.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions dashboard/layout/pages/action_suivi_actuel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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']

Expand Down Expand Up @@ -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']

Expand Down
4 changes: 2 additions & 2 deletions dashboard/layout/pages/action_suivi_global.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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([
Expand Down
5 changes: 2 additions & 3 deletions dashboard/layout/pages/details.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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],
Expand Down
14 changes: 7 additions & 7 deletions dashboard/layout/pages/engagements.py
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down
22 changes: 11 additions & 11 deletions dashboard/layout/pages/infos.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
# Libraries import

from dash import html
from utils import card_style, t1b7_df
from utils import card_style, dataviz_df
import flag
import ast

# Bloc title


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")
],
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions dashboard/layout/pages/reduction_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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')
Expand All @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions dashboard/layout/pages/sector_compare.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
18 changes: 10 additions & 8 deletions dashboard/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')