Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -716,7 +716,7 @@ def layout(**kwargs):
|
|
716 |
dmc.TabsList(mx="auto",grow=True,
|
717 |
children=[
|
718 |
dmc.TabsTab("Marché de l'emploi", leftSection=DashIconify(icon="tabler:graph"), value="1"),
|
719 |
-
dmc.TabsTab("Statistiques de l'emploi", leftSection=DashIconify(icon="tabler:chart-pie"), value="2"),
|
720 |
dmc.TabsTab("Savoir-faire, Savoirs et Contexte des métiers", leftSection=DashIconify(icon="tabler:ikosaedr"), value="3"),
|
721 |
]
|
722 |
),
|
@@ -789,12 +789,12 @@ def layout(**kwargs):
|
|
789 |
]
|
790 |
)
|
791 |
, value="1"),
|
792 |
-
dmc.TabsPanel(
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
dmc.TabsPanel(
|
799 |
children=[
|
800 |
dmc.Button("Afficher les savoirs des métiers", mt=10, ml="auto", id="loading-skills", leftSection=DashIconify(icon="tabler:ikosaedr")),
|
@@ -1272,97 +1272,97 @@ def update_tableau(selectedData, array_value, theme):
|
|
1272 |
|
1273 |
return create_tableau(df_FT, theme)
|
1274 |
|
1275 |
-
clientside_callback(
|
1276 |
-
"""
|
1277 |
-
function updateLoadingState(n_clicks) {
|
1278 |
-
return true
|
1279 |
-
}
|
1280 |
-
""",
|
1281 |
-
Output("loading-button", "loading", allow_duplicate=True),
|
1282 |
-
Input("loading-button", "n_clicks"),
|
1283 |
-
prevent_initial_call=True,
|
1284 |
-
)
|
1285 |
-
|
1286 |
-
|
1287 |
-
Output("clicked-output", "children"),
|
1288 |
-
Output("clicked-output-tabs", "children"),
|
1289 |
-
Output("loading-button", "loading"),
|
1290 |
-
Input("loading-button", "n_clicks"),
|
1291 |
-
Input(component_id='framework-multi-select', component_property='value'),
|
1292 |
-
Input("mantine-provider", "forceColorScheme"),
|
1293 |
-
prevent_initial_call=True,
|
1294 |
-
)
|
1295 |
-
def load_from_stats(n_clicks, array_value, theme):
|
1296 |
-
if theme == "dark":
|
1297 |
-
template = "plotly_dark"
|
1298 |
-
paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
1299 |
-
plot_bgcolor = 'rgba(36, 36, 36, 1)'
|
1300 |
-
style_header = {
|
1301 |
-
'fontFamily': "'Inter', sans-serif",
|
1302 |
-
'fontSize': '10px',
|
1303 |
-
'backgroundColor': 'rgb(30, 30, 30)',
|
1304 |
-
'color': 'white'
|
1305 |
-
}
|
1306 |
-
style_data={
|
1307 |
-
'fontFamily': "'Inter', sans-serif",
|
1308 |
-
'fontSize': '10px',
|
1309 |
-
'backgroundColor': 'rgb(50, 50, 50)',
|
1310 |
-
'color': 'white'
|
1311 |
-
}
|
1312 |
-
else:
|
1313 |
-
template = "ggplot2"
|
1314 |
-
paper_bgcolor = 'rgba(255, 255, 255, 1)'
|
1315 |
-
plot_bgcolor = 'rgba(255, 255, 255, 1)'
|
1316 |
-
style_header = {
|
1317 |
-
'fontFamily': "'Inter', sans-serif",
|
1318 |
-
'fontSize': '10px',
|
1319 |
-
'backgroundColor': 'transparent',
|
1320 |
-
'color': 'black'
|
1321 |
-
}
|
1322 |
-
style_data={
|
1323 |
-
'fontFamily': "'Inter', sans-serif",
|
1324 |
-
'fontSize': '10px',
|
1325 |
-
'backgroundColor': 'transparent',
|
1326 |
-
'color': 'black'
|
1327 |
-
}
|
1328 |
-
children = []
|
1329 |
-
children_tabs = []
|
1330 |
-
for num_value in array_value:
|
1331 |
-
table = datavisualisation_chiffres_cles_emplois("https://dataemploi.pole-emploi.fr/metier/chiffres-cles/NAT/FR/" + num_value)
|
1332 |
-
array_label_rome = searchByRome(num_value)
|
1333 |
-
df_demandeur = htmlToDataframe(table[0])
|
1334 |
-
df_demandeur = df_demandeur.sort_values(by=['Indicateur'])
|
1335 |
-
print(df_demandeur)
|
1336 |
-
fig_demandeur = px.histogram(df_demandeur, x='Indicateur', y='Valeur', height=800, template=template, title="Demandeurs d'emploi et offres d'emploi du code ROME : " + array_label_rome[0]['label'], color='Indicateur', labels={'Valeur':'Nombre'}, text_auto=True).update_layout(font=dict(size=9),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,autosize=True)
|
1337 |
-
children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_demandeur)),type="default")), span=6),)
|
1338 |
-
children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label("Demandeurs d'emploi et offres d'emploi du code ROME : " + array_label_rome[0]['label']),dash_table.DataTable(data=df_demandeur.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_demandeur.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1339 |
-
if len(table[1]) > 0:
|
1340 |
-
df_salaire = htmlToDataframe(table[1])
|
1341 |
-
df_salaire = df_salaire.sort_values(by=['salaire'])
|
1342 |
-
fig_salaire = px.histogram(df_salaire, x='emploi', y='salaire', height=600, template=template, barmode='group', title="Salaires médians du code ROME : " + array_label_rome[0]['label'], color='categorie', text_auto=True).update_layout(font=dict(size=9),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,autosize=True)
|
1343 |
-
children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_salaire)),type="default")), span=6),)
|
1344 |
-
children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label("Salaires médians du code ROME : " + array_label_rome[0]['label']),dash_table.DataTable(data=df_salaire.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_salaire.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1345 |
-
df_difficulte = htmlToDataframe(table[2])
|
1346 |
-
if len(df_difficulte) == 0:
|
1347 |
-
title = "Aucune donnée difficulté de recrutement renseignée!"
|
1348 |
-
else:
|
1349 |
-
title = "Difficulté de recrutement du code ROME : " + array_label_rome[0]['label']
|
1350 |
-
df_difficulte = df_difficulte.sort_values(by=['Valeur'])
|
1351 |
-
fig_difficulte = px.histogram(df_difficulte, x='Indicateur', y='Valeur', height=600, template=template, title=title, color='Indicateur', labels={'Valeur':'Pourcentage'}, text_auto=True).update_layout(font=dict(size=9),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,autosize=True)
|
1352 |
-
children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_difficulte)),type="default")), span=6))
|
1353 |
-
children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label(title),dash_table.DataTable(data=df_difficulte.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_difficulte.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1354 |
-
df_repartitionContrat = htmlToDataframe(table[3])
|
1355 |
-
df_repartitionContrat = df_repartitionContrat.sort_values(by=['Valeur'])
|
1356 |
-
fig_repartitionContrat = px.pie(df_repartitionContrat, names='Indicateur', values='Valeur', color='Indicateur', template=template, title="Répartition des embauches du métier : type de contrat du code ROME : " + array_label_rome[0]['label'], labels={'Valeur':'pourcentage'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor)
|
1357 |
-
children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_repartitionContrat)),type="default")), span=6))
|
1358 |
-
children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label("Répartition des embauches du métier : type de contrat du code ROME : " + array_label_rome[0]['label']),dash_table.DataTable(data=df_repartitionContrat.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_repartitionContrat.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1359 |
-
df_repartitionEntreprise = htmlToDataframe(table[4])
|
1360 |
-
df_repartitionEntreprise = df_repartitionEntreprise.sort_values(by=['Valeur'])
|
1361 |
-
fig_repartitionEntreprise = px.pie(df_repartitionEntreprise, names='Indicateur', values='Valeur', color='Indicateur', template=template, title="Répartition des embauches du métier : type entreprise du code ROME : " + array_label_rome[0]['label'], labels={'Valeur':'pourcentage'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor)
|
1362 |
-
children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_repartitionEntreprise)),type="default")), span=6))
|
1363 |
-
children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label("Répartition des embauches du métier : type entreprise du code ROME : " + array_label_rome[0]['label']),dash_table.DataTable(data=df_repartitionEntreprise.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_repartitionEntreprise.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1364 |
-
|
1365 |
-
return dmc.Grid(children=children), dmc.Grid(children=children_tabs), False
|
1366 |
|
1367 |
clientside_callback(
|
1368 |
"""
|
|
|
716 |
dmc.TabsList(mx="auto",grow=True,
|
717 |
children=[
|
718 |
dmc.TabsTab("Marché de l'emploi", leftSection=DashIconify(icon="tabler:graph"), value="1"),
|
719 |
+
#dmc.TabsTab("Statistiques de l'emploi", leftSection=DashIconify(icon="tabler:chart-pie"), value="2"),
|
720 |
dmc.TabsTab("Savoir-faire, Savoirs et Contexte des métiers", leftSection=DashIconify(icon="tabler:ikosaedr"), value="3"),
|
721 |
]
|
722 |
),
|
|
|
789 |
]
|
790 |
)
|
791 |
, value="1"),
|
792 |
+
#dmc.TabsPanel(
|
793 |
+
# children=[
|
794 |
+
# dmc.Button("Afficher les statistiques des métiers", mt=10, ml="auto", id="loading-button", leftSection=DashIconify(icon="tabler:chart-pie")),
|
795 |
+
# html.Div(id="clicked-output"),
|
796 |
+
# html.Div(id="clicked-output-tabs"),
|
797 |
+
# ], value="2"),
|
798 |
dmc.TabsPanel(
|
799 |
children=[
|
800 |
dmc.Button("Afficher les savoirs des métiers", mt=10, ml="auto", id="loading-skills", leftSection=DashIconify(icon="tabler:ikosaedr")),
|
|
|
1272 |
|
1273 |
return create_tableau(df_FT, theme)
|
1274 |
|
1275 |
+
#clientside_callback(
|
1276 |
+
# """
|
1277 |
+
# function updateLoadingState(n_clicks) {
|
1278 |
+
# return true
|
1279 |
+
# }
|
1280 |
+
# """,
|
1281 |
+
# Output("loading-button", "loading", allow_duplicate=True),
|
1282 |
+
# Input("loading-button", "n_clicks"),
|
1283 |
+
# prevent_initial_call=True,
|
1284 |
+
#)
|
1285 |
+
|
1286 |
+
#@callback(
|
1287 |
+
# Output("clicked-output", "children"),
|
1288 |
+
# Output("clicked-output-tabs", "children"),
|
1289 |
+
# Output("loading-button", "loading"),
|
1290 |
+
# Input("loading-button", "n_clicks"),
|
1291 |
+
# Input(component_id='framework-multi-select', component_property='value'),
|
1292 |
+
# Input("mantine-provider", "forceColorScheme"),
|
1293 |
+
# prevent_initial_call=True,
|
1294 |
+
#)
|
1295 |
+
#def load_from_stats(n_clicks, array_value, theme):
|
1296 |
+
# if theme == "dark":
|
1297 |
+
# template = "plotly_dark"
|
1298 |
+
# paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
1299 |
+
# plot_bgcolor = 'rgba(36, 36, 36, 1)'
|
1300 |
+
# style_header = {
|
1301 |
+
# 'fontFamily': "'Inter', sans-serif",
|
1302 |
+
# 'fontSize': '10px',
|
1303 |
+
# 'backgroundColor': 'rgb(30, 30, 30)',
|
1304 |
+
# 'color': 'white'
|
1305 |
+
# }
|
1306 |
+
# style_data={
|
1307 |
+
# 'fontFamily': "'Inter', sans-serif",
|
1308 |
+
# 'fontSize': '10px',
|
1309 |
+
# 'backgroundColor': 'rgb(50, 50, 50)',
|
1310 |
+
# 'color': 'white'
|
1311 |
+
# }
|
1312 |
+
# else:
|
1313 |
+
# template = "ggplot2"
|
1314 |
+
# paper_bgcolor = 'rgba(255, 255, 255, 1)'
|
1315 |
+
# plot_bgcolor = 'rgba(255, 255, 255, 1)'
|
1316 |
+
# style_header = {
|
1317 |
+
# 'fontFamily': "'Inter', sans-serif",
|
1318 |
+
# 'fontSize': '10px',
|
1319 |
+
# 'backgroundColor': 'transparent',
|
1320 |
+
# 'color': 'black'
|
1321 |
+
# }
|
1322 |
+
# style_data={
|
1323 |
+
# 'fontFamily': "'Inter', sans-serif",
|
1324 |
+
# 'fontSize': '10px',
|
1325 |
+
# 'backgroundColor': 'transparent',
|
1326 |
+
# 'color': 'black'
|
1327 |
+
# }
|
1328 |
+
# children = []
|
1329 |
+
# children_tabs = []
|
1330 |
+
# for num_value in array_value:
|
1331 |
+
# table = datavisualisation_chiffres_cles_emplois("https://dataemploi.pole-emploi.fr/metier/chiffres-cles/NAT/FR/" + num_value)
|
1332 |
+
# array_label_rome = searchByRome(num_value)
|
1333 |
+
# df_demandeur = htmlToDataframe(table[0])
|
1334 |
+
# df_demandeur = df_demandeur.sort_values(by=['Indicateur'])
|
1335 |
+
# print(df_demandeur)
|
1336 |
+
# fig_demandeur = px.histogram(df_demandeur, x='Indicateur', y='Valeur', height=800, template=template, title="Demandeurs d'emploi et offres d'emploi du code ROME : " + array_label_rome[0]['label'], color='Indicateur', labels={'Valeur':'Nombre'}, text_auto=True).update_layout(font=dict(size=9),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,autosize=True)
|
1337 |
+
# children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_demandeur)),type="default")), span=6),)
|
1338 |
+
# children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label("Demandeurs d'emploi et offres d'emploi du code ROME : " + array_label_rome[0]['label']),dash_table.DataTable(data=df_demandeur.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_demandeur.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1339 |
+
# if len(table[1]) > 0:
|
1340 |
+
# df_salaire = htmlToDataframe(table[1])
|
1341 |
+
# df_salaire = df_salaire.sort_values(by=['salaire'])
|
1342 |
+
# fig_salaire = px.histogram(df_salaire, x='emploi', y='salaire', height=600, template=template, barmode='group', title="Salaires médians du code ROME : " + array_label_rome[0]['label'], color='categorie', text_auto=True).update_layout(font=dict(size=9),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,autosize=True)
|
1343 |
+
# children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_salaire)),type="default")), span=6),)
|
1344 |
+
# children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label("Salaires médians du code ROME : " + array_label_rome[0]['label']),dash_table.DataTable(data=df_salaire.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_salaire.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1345 |
+
# df_difficulte = htmlToDataframe(table[2])
|
1346 |
+
# if len(df_difficulte) == 0:
|
1347 |
+
# title = "Aucune donnée difficulté de recrutement renseignée!"
|
1348 |
+
# else:
|
1349 |
+
# title = "Difficulté de recrutement du code ROME : " + array_label_rome[0]['label']
|
1350 |
+
# df_difficulte = df_difficulte.sort_values(by=['Valeur'])
|
1351 |
+
# fig_difficulte = px.histogram(df_difficulte, x='Indicateur', y='Valeur', height=600, template=template, title=title, color='Indicateur', labels={'Valeur':'Pourcentage'}, text_auto=True).update_layout(font=dict(size=9),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,autosize=True)
|
1352 |
+
# children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_difficulte)),type="default")), span=6))
|
1353 |
+
# children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label(title),dash_table.DataTable(data=df_difficulte.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_difficulte.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1354 |
+
# df_repartitionContrat = htmlToDataframe(table[3])
|
1355 |
+
# df_repartitionContrat = df_repartitionContrat.sort_values(by=['Valeur'])
|
1356 |
+
# fig_repartitionContrat = px.pie(df_repartitionContrat, names='Indicateur', values='Valeur', color='Indicateur', template=template, title="Répartition des embauches du métier : type de contrat du code ROME : " + array_label_rome[0]['label'], labels={'Valeur':'pourcentage'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor)
|
1357 |
+
# children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_repartitionContrat)),type="default")), span=6))
|
1358 |
+
# children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label("Répartition des embauches du métier : type de contrat du code ROME : " + array_label_rome[0]['label']),dash_table.DataTable(data=df_repartitionContrat.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_repartitionContrat.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1359 |
+
# df_repartitionEntreprise = htmlToDataframe(table[4])
|
1360 |
+
# df_repartitionEntreprise = df_repartitionEntreprise.sort_values(by=['Valeur'])
|
1361 |
+
# fig_repartitionEntreprise = px.pie(df_repartitionEntreprise, names='Indicateur', values='Valeur', color='Indicateur', template=template, title="Répartition des embauches du métier : type entreprise du code ROME : " + array_label_rome[0]['label'], labels={'Valeur':'pourcentage'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor)
|
1362 |
+
# children.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=(dcc.Graph(figure=fig_repartitionEntreprise)),type="default")), span=6))
|
1363 |
+
# children_tabs.append(dmc.GridCol(html.Div(dcc.Loading(id="loadingPlot",children=[dbc.Label("Répartition des embauches du métier : type entreprise du code ROME : " + array_label_rome[0]['label']),dash_table.DataTable(data=df_repartitionEntreprise.to_dict('records'),sort_action='native', columns=[{'id': c, 'name': c} for c in df_repartitionEntreprise.columns],page_action='native', page_current= 0,page_size= 10,style_header=style_header,style_data=style_data,style_table={'overflowX': 'auto'},style_cell={'overflow': 'hidden','textOverflow': 'ellipsis','maxWidth': 0,})],type="default")), span=12),)
|
1364 |
+
#
|
1365 |
+
# return dmc.Grid(children=children), dmc.Grid(children=children_tabs), False
|
1366 |
|
1367 |
clientside_callback(
|
1368 |
"""
|