Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,520 +1,523 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import datetime
|
| 3 |
-
import requests
|
| 4 |
-
from offres_emploi import Api
|
| 5 |
-
from offres_emploi.utils import dt_to_str_iso
|
| 6 |
-
from dash import Dash, html, dcc, callback, Output, Input, dash_table, State, _dash_renderer
|
| 7 |
-
import plotly.express as px
|
| 8 |
-
import dash_mantine_components as dmc
|
| 9 |
-
from dash_iconify import DashIconify
|
| 10 |
-
import pandas as pd
|
| 11 |
-
from dotenv import load_dotenv
|
| 12 |
-
_dash_renderer._set_react_version("18.2.0")
|
| 13 |
-
import plotly.io as pio
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
"
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
{ "ID": "
|
| 46 |
-
{ "ID": "
|
| 47 |
-
|
| 48 |
-
{ "ID": "
|
| 49 |
-
{ "ID": "
|
| 50 |
-
|
| 51 |
-
{ "ID": "
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
{ "ID": "
|
| 56 |
-
{ "ID": "
|
| 57 |
-
{ "ID": "
|
| 58 |
-
{ "ID": "
|
| 59 |
-
{ "ID": "
|
| 60 |
-
{ "ID": "
|
| 61 |
-
{ "ID": "
|
| 62 |
-
{ "ID": "
|
| 63 |
-
{ "ID": "
|
| 64 |
-
{ "ID": "
|
| 65 |
-
{ "ID": "
|
| 66 |
-
{ "ID": "
|
| 67 |
-
{ "ID": "
|
| 68 |
-
{ "ID": "
|
| 69 |
-
{ "ID": "
|
| 70 |
-
{ "ID": "
|
| 71 |
-
{ "ID": "
|
| 72 |
-
{ "ID": "
|
| 73 |
-
{ "ID": "
|
| 74 |
-
{ "ID": "
|
| 75 |
-
{ "ID": "
|
| 76 |
-
{ "ID": "
|
| 77 |
-
{ "ID": "
|
| 78 |
-
{ "ID": "
|
| 79 |
-
{ "ID": "
|
| 80 |
-
{ "ID": "
|
| 81 |
-
{ "ID": "
|
| 82 |
-
{ "ID": "
|
| 83 |
-
{ "ID": "
|
| 84 |
-
{ "ID": "
|
| 85 |
-
{ "ID": "
|
| 86 |
-
{ "ID": "
|
| 87 |
-
{ "ID": "
|
| 88 |
-
{ "ID": "
|
| 89 |
-
{ "ID": "
|
| 90 |
-
{ "ID": "
|
| 91 |
-
{ "ID": "
|
| 92 |
-
{ "ID": "
|
| 93 |
-
{ "ID": "
|
| 94 |
-
{ "ID": "
|
| 95 |
-
{ "ID": "
|
| 96 |
-
{ "ID": "
|
| 97 |
-
{ "ID": "
|
| 98 |
-
{ "ID": "
|
| 99 |
-
{ "ID": "
|
| 100 |
-
{ "ID": "
|
| 101 |
-
{ "ID": "
|
| 102 |
-
{ "ID": "
|
| 103 |
-
{ "ID": "
|
| 104 |
-
{ "ID": "
|
| 105 |
-
{ "ID": "
|
| 106 |
-
{ "ID": "
|
| 107 |
-
{ "ID": "
|
| 108 |
-
{ "ID": "
|
| 109 |
-
{ "ID": "
|
| 110 |
-
{ "ID": "
|
| 111 |
-
{ "ID": "
|
| 112 |
-
{ "ID": "
|
| 113 |
-
{ "ID": "
|
| 114 |
-
{ "ID": "
|
| 115 |
-
{ "ID": "
|
| 116 |
-
{ "ID": "
|
| 117 |
-
{ "ID": "
|
| 118 |
-
{ "ID": "
|
| 119 |
-
{ "ID": "
|
| 120 |
-
{ "ID": "
|
| 121 |
-
{ "ID": "
|
| 122 |
-
{ "ID": "
|
| 123 |
-
{ "ID": "
|
| 124 |
-
{ "ID": "
|
| 125 |
-
{ "ID": "
|
| 126 |
-
{ "ID": "
|
| 127 |
-
{ "ID": "
|
| 128 |
-
{ "ID": "
|
| 129 |
-
{ "ID": "
|
| 130 |
-
{ "ID": "
|
| 131 |
-
{ "ID": "
|
| 132 |
-
{ "ID": "
|
| 133 |
-
{ "ID": "
|
| 134 |
-
{ "ID": "
|
| 135 |
-
{ "ID": "
|
| 136 |
-
{ "ID": "
|
| 137 |
-
{ "ID": "
|
| 138 |
-
{ "ID": "
|
| 139 |
-
{ "ID": "
|
| 140 |
-
{ "ID": "
|
| 141 |
-
{ "ID": "
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
client
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
{"value": "
|
| 219 |
-
{"value": "
|
| 220 |
-
{"value": "
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
), span=
|
| 235 |
-
dmc.GridCol(html.Div(
|
| 236 |
-
dcc.Graph(id="
|
| 237 |
-
), span=6),
|
| 238 |
-
dmc.GridCol(html.Div(
|
| 239 |
-
dcc.Graph(id="
|
| 240 |
-
), span=6),
|
| 241 |
-
dmc.GridCol(html.Div(
|
| 242 |
-
dcc.Graph(id="
|
| 243 |
-
), span=6),
|
| 244 |
-
dmc.GridCol(html.Div(
|
| 245 |
-
dcc.Graph(id="
|
| 246 |
-
), span=6),
|
| 247 |
-
dmc.GridCol(html.Div(
|
| 248 |
-
dcc.Graph(id="
|
| 249 |
-
), span=6),
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
"
|
| 268 |
-
"
|
| 269 |
-
"
|
| 270 |
-
"
|
| 271 |
-
"
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
"
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
"
|
| 285 |
-
#
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
"
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
)
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
)
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
df
|
| 328 |
-
df
|
| 329 |
-
df.drop(df[df['lieuTravail'] == '
|
| 330 |
-
df.drop(df[df['lieuTravail'] == '
|
| 331 |
-
df.drop(df[df['lieuTravail'] == '
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
df_localisation
|
| 339 |
-
df_localisation
|
| 340 |
-
df_localisation[
|
| 341 |
-
df_localisation[
|
| 342 |
-
df_localisation["
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
"
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
"
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
df_comp =
|
| 371 |
-
df_comp =
|
| 372 |
-
df_comp = df_comp.
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
df_comptransversales =
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
template = "
|
| 409 |
-
paper_bgcolor = 'rgba(
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
template = "
|
| 423 |
-
paper_bgcolor = 'rgba(
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
)
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
df
|
| 452 |
-
df
|
| 453 |
-
df.drop(df[df['lieuTravail'] == '
|
| 454 |
-
df.drop(df[df['lieuTravail'] == '
|
| 455 |
-
df.drop(df[df['lieuTravail'] == '
|
| 456 |
-
df
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
)
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
df
|
| 481 |
-
df
|
| 482 |
-
df.drop(df[df['lieuTravail'] == '
|
| 483 |
-
df.drop(df[df['lieuTravail'] == '
|
| 484 |
-
df.drop(df[df['lieuTravail'] == '
|
| 485 |
-
df
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
)
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
df
|
| 511 |
-
df
|
| 512 |
-
df.drop(df[df['lieuTravail'] == '
|
| 513 |
-
df.drop(df[df['lieuTravail'] == '
|
| 514 |
-
df.drop(df[df['lieuTravail'] == '
|
| 515 |
-
df
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import datetime
|
| 3 |
+
import requests
|
| 4 |
+
from offres_emploi import Api
|
| 5 |
+
from offres_emploi.utils import dt_to_str_iso
|
| 6 |
+
from dash import Dash, html, dcc, callback, Output, Input, dash_table, State, _dash_renderer
|
| 7 |
+
import plotly.express as px
|
| 8 |
+
import dash_mantine_components as dmc
|
| 9 |
+
from dash_iconify import DashIconify
|
| 10 |
+
import pandas as pd
|
| 11 |
+
from dotenv import load_dotenv
|
| 12 |
+
_dash_renderer._set_react_version("18.2.0")
|
| 13 |
+
import plotly.io as pio
|
| 14 |
+
from flask import Flask
|
| 15 |
+
|
| 16 |
+
server = Flask(__name__)
|
| 17 |
+
|
| 18 |
+
# Create a customized version of the plotly_dark theme with a modified background color
|
| 19 |
+
custom_plotly_dark_theme = {
|
| 20 |
+
"layout": {
|
| 21 |
+
"paper_bgcolor": "#1E1E1E", # Update the paper background color
|
| 22 |
+
"plot_bgcolor": "#1E1E1E", # Update the plot background color
|
| 23 |
+
"font": {
|
| 24 |
+
"color": "#FFFFFF" # Update the font color
|
| 25 |
+
},
|
| 26 |
+
"xaxis": {
|
| 27 |
+
"gridcolor": "#333333", # Update the x-axis grid color
|
| 28 |
+
"zerolinecolor": "#666666" # Update the x-axis zero line color
|
| 29 |
+
},
|
| 30 |
+
"yaxis": {
|
| 31 |
+
"gridcolor": "#333333", # Update the y-axis grid color
|
| 32 |
+
"zerolinecolor": "#666666" # Update the y-axis zero line color
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
# Apply the customized theme to your Plotly figures
|
| 38 |
+
pio.templates["custom_plotly_dark"] = custom_plotly_dark_theme
|
| 39 |
+
pio.templates.default = "custom_plotly_dark"
|
| 40 |
+
|
| 41 |
+
load_dotenv()
|
| 42 |
+
|
| 43 |
+
def localisation():
|
| 44 |
+
ListCentroids = [
|
| 45 |
+
{ "ID": "01", "Longitude": 5.3245259, "Latitude":46.0666003 },
|
| 46 |
+
{ "ID": "02", "Longitude": 3.5960246, "Latitude": 49.5519632 },
|
| 47 |
+
{ "ID": "03", "Longitude": 3.065278, "Latitude": 46.4002783 },
|
| 48 |
+
{ "ID": "04", "Longitude": 6.2237688, "Latitude": 44.1105837 },
|
| 49 |
+
{ "ID": "05", "Longitude": 6.2018836, "Latitude": 44.6630487 },
|
| 50 |
+
{ "ID": "06", "Longitude": 7.0755745, "Latitude":43.9463082 },
|
| 51 |
+
{ "ID": "07", "Longitude": 4.3497308, "Latitude": 44.7626044 },
|
| 52 |
+
{ "ID": "08", "Longitude": 4.6234893, "Latitude": 49.6473884 },
|
| 53 |
+
{ "ID": "09", "Longitude": 1.6037147, "Latitude": 42.9696091 },
|
| 54 |
+
{ "ID": "10", "Longitude": 4.1394954, "Latitude": 48.2963286 },
|
| 55 |
+
{ "ID": "11", "Longitude": 2.3140163, "Latitude": 43.1111427 },
|
| 56 |
+
{ "ID": "12", "Longitude": 2.7365234, "Latitude": 44.2786323 },
|
| 57 |
+
{ "ID": "13", "Longitude": 5.0515492, "Latitude": 43.5539098 },
|
| 58 |
+
{ "ID": "14", "Longitude": -0.3930779, "Latitude": 49.1024215 },
|
| 59 |
+
{ "ID": "15", "Longitude": 2.6367657, "Latitude": 44.9643217 },
|
| 60 |
+
{ "ID": "16", "Longitude": 0.180475, "Latitude": 45.706264 },
|
| 61 |
+
{ "ID": "17", "Longitude": -0.7082589, "Latitude": 45.7629699 },
|
| 62 |
+
{ "ID": "18", "Longitude": 2.5292424, "Latitude": 47.0926687 },
|
| 63 |
+
{ "ID": "19", "Longitude": 1.8841811, "Latitude": 45.3622055 },
|
| 64 |
+
{ "ID": "2A", "Longitude": 8.9906834, "Latitude": 41.8619761 },
|
| 65 |
+
{ "ID": "2B", "Longitude": 9.275489, "Latitude": 42.372014 },
|
| 66 |
+
{ "ID": "21", "Longitude": 4.7870471, "Latitude": 47.4736746 },
|
| 67 |
+
{ "ID": "22", "Longitude": -2.9227591, "Latitude": 48.408402 },
|
| 68 |
+
{ "ID": "23", "Longitude": 2.0265508, "Latitude": 46.0837382 },
|
| 69 |
+
{ "ID": "24", "Longitude": 0.7140145, "Latitude": 45.1489678 },
|
| 70 |
+
{ "ID": "25", "Longitude": 6.3991355, "Latitude": 47.1879451 },
|
| 71 |
+
{ "ID": "26", "Longitude": 5.1717552, "Latitude": 44.8055408 },
|
| 72 |
+
{ "ID": "27", "Longitude": 0.9488116, "Latitude": 49.1460288 },
|
| 73 |
+
{ "ID": "28", "Longitude": 1.2793491, "Latitude": 48.3330017 },
|
| 74 |
+
{ "ID": "29", "Longitude": -4.1577074, "Latitude": 48.2869945 },
|
| 75 |
+
{ "ID": "30", "Longitude": 4.2650329, "Latitude": 43.9636468 },
|
| 76 |
+
{ "ID": "31", "Longitude": 1.2728958, "Latitude": 43.3671081 },
|
| 77 |
+
{ "ID": "32", "Longitude": 0.4220039, "Latitude": 43.657141 },
|
| 78 |
+
{ "ID": "33", "Longitude": -0.5760716, "Latitude": 44.8406068 },
|
| 79 |
+
{ "ID": "34", "Longitude": 3.4197556, "Latitude": 43.62585 },
|
| 80 |
+
{ "ID": "35", "Longitude": -1.6443812, "Latitude": 48.1801254 },
|
| 81 |
+
{ "ID": "36", "Longitude": 1.6509938, "Latitude": 46.7964222 },
|
| 82 |
+
{ "ID": "37", "Longitude": 0.7085619, "Latitude": 47.2802601 },
|
| 83 |
+
{ "ID": "38", "Longitude": 5.6230772, "Latitude": 45.259805 },
|
| 84 |
+
{ "ID": "39", "Longitude": 5.612871, "Latitude": 46.7398138 },
|
| 85 |
+
{ "ID": "40", "Longitude": -0.8771738, "Latitude": 44.0161251 },
|
| 86 |
+
{ "ID": "41", "Longitude": 1.3989178, "Latitude": 47.5866519 },
|
| 87 |
+
{ "ID": "42", "Longitude": 4.2262355, "Latitude": 45.7451186 },
|
| 88 |
+
{ "ID": "43", "Longitude": 3.8118151, "Latitude": 45.1473029 },
|
| 89 |
+
{ "ID": "44", "Longitude": -1.7642949, "Latitude": 47.4616509 },
|
| 90 |
+
{ "ID": "45", "Longitude": 2.2372695, "Latitude": 47.8631395 },
|
| 91 |
+
{ "ID": "46", "Longitude": 1.5732157, "Latitude": 44.6529284 },
|
| 92 |
+
{ "ID": "47", "Longitude": 0.4788052, "Latitude": 44.4027215 },
|
| 93 |
+
{ "ID": "48", "Longitude": 3.4991239, "Latitude": 44.5191573 },
|
| 94 |
+
{ "ID": "49", "Longitude": -0.5136056, "Latitude": 47.3945201 },
|
| 95 |
+
{ "ID": "50", "Longitude": -1.3203134, "Latitude": 49.0162072 },
|
| 96 |
+
{ "ID": "51", "Longitude": 4.2966555, "Latitude": 48.9479636 },
|
| 97 |
+
{ "ID": "52", "Longitude": 5.1325796, "Latitude": 48.1077196 },
|
| 98 |
+
{ "ID": "53", "Longitude": -0.7073921, "Latitude": 48.1225795 },
|
| 99 |
+
{ "ID": "54", "Longitude": 6.144792, "Latitude": 48.7995163 },
|
| 100 |
+
{ "ID": "55", "Longitude": 5.2888292, "Latitude": 49.0074545 },
|
| 101 |
+
{ "ID": "56", "Longitude": -2.8746938, "Latitude": 47.9239486 },
|
| 102 |
+
{ "ID": "57", "Longitude": 6.5610683, "Latitude": 49.0399233 },
|
| 103 |
+
{ "ID": "58", "Longitude": 3.5544332, "Latitude": 47.1122301 },
|
| 104 |
+
{ "ID": "59", "Longitude": 3.2466616, "Latitude": 50.4765414 },
|
| 105 |
+
{ "ID": "60", "Longitude": 2.4161734, "Latitude": 49.3852913 },
|
| 106 |
+
{ "ID": "61", "Longitude": 0.2248368, "Latitude": 48.5558919 },
|
| 107 |
+
{ "ID": "62", "Longitude": 2.2555152, "Latitude": 50.4646795 },
|
| 108 |
+
{ "ID": "63", "Longitude": 3.1322144, "Latitude": 45.7471805 },
|
| 109 |
+
{ "ID": "64", "Longitude": -0.793633, "Latitude": 43.3390984 },
|
| 110 |
+
{ "ID": "65", "Longitude": 0.1478724, "Latitude": 43.0526238 },
|
| 111 |
+
{ "ID": "66", "Longitude": 2.5239855, "Latitude": 42.5825094 },
|
| 112 |
+
{ "ID": "67", "Longitude": 7.5962225, "Latitude": 48.662515 },
|
| 113 |
+
{ "ID": "68", "Longitude": 7.2656284, "Latitude": 47.8586205 },
|
| 114 |
+
{ "ID": "69", "Longitude": 4.6859896, "Latitude": 45.8714754 },
|
| 115 |
+
{ "ID": "70", "Longitude": 6.1388571, "Latitude": 47.5904191 },
|
| 116 |
+
{ "ID": "71", "Longitude": 4.6394021, "Latitude": 46.5951234 },
|
| 117 |
+
{ "ID": "72", "Longitude": 0.1947322, "Latitude": 48.0041421 },
|
| 118 |
+
{ "ID": "73", "Longitude": 6.4662232, "Latitude": 45.4956055 },
|
| 119 |
+
{ "ID": "74", "Longitude": 6.3609606, "Latitude": 46.1045902 },
|
| 120 |
+
{ "ID": "75", "Longitude": 2.3416082, "Latitude": 48.8626759 },
|
| 121 |
+
{ "ID": "76", "Longitude": 1.025579, "Latitude": 49.6862911 },
|
| 122 |
+
{ "ID": "77", "Longitude": 2.8977309, "Latitude": 48.5957831 },
|
| 123 |
+
{ "ID": "78", "Longitude": 1.8080138, "Latitude": 48.7831982 },
|
| 124 |
+
{ "ID": "79", "Longitude": -0.3159014, "Latitude": 46.5490257 },
|
| 125 |
+
{ "ID": "80", "Longitude": 2.3380595, "Latitude": 49.9783317 },
|
| 126 |
+
{ "ID": "81", "Longitude": 2.2072751, "Latitude": 43.8524305 },
|
| 127 |
+
{ "ID": "82", "Longitude": 1.2649374, "Latitude": 44.1254902 },
|
| 128 |
+
{ "ID": "83", "Longitude": 6.1486127, "Latitude": 43.5007903 },
|
| 129 |
+
{ "ID": "84", "Longitude": 5.065418, "Latitude": 44.0001599 },
|
| 130 |
+
{ "ID": "85", "Longitude": -1.3956692, "Latitude": 46.5929102 },
|
| 131 |
+
{ "ID": "86", "Longitude": 0.4953679, "Latitude": 46.5719095 },
|
| 132 |
+
{ "ID": "87", "Longitude": 1.2500647, "Latitude": 45.9018644 },
|
| 133 |
+
{ "ID": "88", "Longitude": 6.349702, "Latitude": 48.1770451 },
|
| 134 |
+
{ "ID": "89", "Longitude": 3.5634078, "Latitude": 47.8474664 },
|
| 135 |
+
{ "ID": "90", "Longitude": 6.9498114, "Latitude": 47.6184394 },
|
| 136 |
+
{ "ID": "91", "Longitude": 2.2714555, "Latitude": 48.5203114 },
|
| 137 |
+
{ "ID": "92", "Longitude": 2.2407148, "Latitude": 48.835321 },
|
| 138 |
+
{ "ID": "93", "Longitude": 2.4811577, "Latitude": 48.9008719 },
|
| 139 |
+
{ "ID": "94", "Longitude": 2.4549766, "Latitude": 48.7832368 },
|
| 140 |
+
{ "ID": "95", "Longitude": 2.1802056, "Latitude": 49.076488 },
|
| 141 |
+
{ "ID": "974", "Longitude": 55.536384, "Latitude": -21.115141 },
|
| 142 |
+
{ "ID": "973", "Longitude": -53.125782, "Latitude": 3.933889 },
|
| 143 |
+
{ "ID": "972", "Longitude": -61.024174, "Latitude": 14.641528 },
|
| 144 |
+
{ "ID": "971", "Longitude": -61.551, "Latitude": 16.265 }
|
| 145 |
+
]
|
| 146 |
+
|
| 147 |
+
return ListCentroids
|
| 148 |
+
|
| 149 |
+
def connexion_France_Travail():
|
| 150 |
+
client = Api(client_id=os.getenv('POLE_EMPLOI_CLIENT_ID'),
|
| 151 |
+
client_secret=os.getenv('POLE_EMPLOI_CLIENT_SECRET'))
|
| 152 |
+
return client
|
| 153 |
+
|
| 154 |
+
def API_France_Travail(romeListArray):
|
| 155 |
+
client = connexion_France_Travail()
|
| 156 |
+
todayDate = datetime.datetime.today()
|
| 157 |
+
month, year = (todayDate.month-1, todayDate.year) if todayDate.month != 1 else (12, todayDate.year-1)
|
| 158 |
+
start_dt = todayDate.replace(day=1, month=month, year=year)
|
| 159 |
+
end_dt = datetime.datetime.today()
|
| 160 |
+
results = []
|
| 161 |
+
for k in romeListArray:
|
| 162 |
+
if k[0:1] == ' ':
|
| 163 |
+
k = k[1:]
|
| 164 |
+
params = {"motsCles": k.replace('/', '').replace('-', '').replace(',', '').replace(' ', ','),'minCreationDate': dt_to_str_iso(start_dt),'maxCreationDate': dt_to_str_iso(end_dt),'range':'0-149'}
|
| 165 |
+
try:
|
| 166 |
+
search_on_big_data = client.search(params=params)
|
| 167 |
+
results += search_on_big_data["resultats"]
|
| 168 |
+
except:
|
| 169 |
+
print("Il n'y a pas d'offres d'emploi.")
|
| 170 |
+
|
| 171 |
+
results_df = pd.DataFrame(results)
|
| 172 |
+
return results_df
|
| 173 |
+
|
| 174 |
+
theme_toggle = dmc.Tooltip(
|
| 175 |
+
dmc.ActionIcon(
|
| 176 |
+
[
|
| 177 |
+
dmc.Paper(DashIconify(icon="radix-icons:sun", width=25), darkHidden=True),
|
| 178 |
+
dmc.Paper(DashIconify(icon="radix-icons:moon", width=25), lightHidden=True),
|
| 179 |
+
],
|
| 180 |
+
variant="transparent",
|
| 181 |
+
color="yellow",
|
| 182 |
+
id="color-scheme-toggle",
|
| 183 |
+
size="lg",
|
| 184 |
+
ms="auto",
|
| 185 |
+
),
|
| 186 |
+
label="Changez de thème",
|
| 187 |
+
position="left",
|
| 188 |
+
withArrow=True,
|
| 189 |
+
arrowSize=6,
|
| 190 |
+
)
|
| 191 |
+
|
| 192 |
+
styleTitle = {
|
| 193 |
+
"textAlign": "center",
|
| 194 |
+
"color": dmc.DEFAULT_THEME["colors"]["orange"][4]
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
styleToggle = {
|
| 198 |
+
"marginTop":"25px",
|
| 199 |
+
"textAlign": "right",
|
| 200 |
+
}
|
| 201 |
+
app = Dash(server=server, external_stylesheets=dmc.styles.ALL)
|
| 202 |
+
|
| 203 |
+
app.layout = dmc.MantineProvider(
|
| 204 |
+
[
|
| 205 |
+
html.Div(
|
| 206 |
+
children=[
|
| 207 |
+
dmc.Container(
|
| 208 |
+
children=[
|
| 209 |
+
dmc.Grid(
|
| 210 |
+
children=[
|
| 211 |
+
dmc.GridCol(html.Div(
|
| 212 |
+
dmc.MultiSelect(
|
| 213 |
+
label="Selectionnez vos Codes ROME",
|
| 214 |
+
placeholder="Select vos Codes ROME parmi la liste",
|
| 215 |
+
id="framework-multi-select",
|
| 216 |
+
value=['K2105', 'L1101', 'L1202', 'L1507', 'L1508', 'L1509'],
|
| 217 |
+
data=[
|
| 218 |
+
{"value": "K2105", "label": "K2105"},
|
| 219 |
+
{"value": "L1101", "label": "L1101"},
|
| 220 |
+
{"value": "L1202", "label": "L1202"},
|
| 221 |
+
{"value": "L1507", "label": "L1507"},
|
| 222 |
+
{"value": "L1508", "label": "L1508"},
|
| 223 |
+
{"value": "L1509", "label": "L1509"},
|
| 224 |
+
],
|
| 225 |
+
w=600,
|
| 226 |
+
mb=10,
|
| 227 |
+
styles={
|
| 228 |
+
"input": {"borderColor": dmc.DEFAULT_THEME["colors"]["orange"][2]},
|
| 229 |
+
"label": {"color": dmc.DEFAULT_THEME["colors"]["orange"][4]},
|
| 230 |
+
},
|
| 231 |
+
)
|
| 232 |
+
), span=6),
|
| 233 |
+
dmc.GridCol(html.Div(dmc.Title(f"Le marché et les statistiques de l'emploi", order=1, size="30", my="20", style=styleTitle)), span=5),
|
| 234 |
+
dmc.GridCol(html.Div(theme_toggle, style=styleToggle), span=1),
|
| 235 |
+
dmc.GridCol(html.Div(
|
| 236 |
+
dcc.Graph(id="figRepartition",selectedData={'points': [{'hovertext': ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','2A','2B','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','971','972','973','974']}]}),
|
| 237 |
+
), span=6),
|
| 238 |
+
dmc.GridCol(html.Div(
|
| 239 |
+
dcc.Graph(id="figEmplois"),
|
| 240 |
+
), span=6),
|
| 241 |
+
dmc.GridCol(html.Div(
|
| 242 |
+
dcc.Graph(id="figContrats"),
|
| 243 |
+
), span=6),
|
| 244 |
+
dmc.GridCol(html.Div(
|
| 245 |
+
dcc.Graph(id="figExperiences"),
|
| 246 |
+
), span=6),
|
| 247 |
+
dmc.GridCol(html.Div(
|
| 248 |
+
dcc.Graph(id="figCompetences"),
|
| 249 |
+
), span=6),
|
| 250 |
+
dmc.GridCol(html.Div(
|
| 251 |
+
dcc.Graph(id="figTransversales"),
|
| 252 |
+
), span=6),
|
| 253 |
+
],
|
| 254 |
+
gutter="xs",
|
| 255 |
+
)
|
| 256 |
+
],size="xxl",fluid=True
|
| 257 |
+
),
|
| 258 |
+
]
|
| 259 |
+
)
|
| 260 |
+
],
|
| 261 |
+
id="mantine-provider",
|
| 262 |
+
forceColorScheme="dark",
|
| 263 |
+
theme={
|
| 264 |
+
"primaryColor": "indigo",
|
| 265 |
+
"fontFamily": "'Inter', sans-serif",
|
| 266 |
+
"components": {
|
| 267 |
+
"Button": {"defaultProps": {"fw": 400}},
|
| 268 |
+
"Alert": {"styles": {"title": {"fontWeight": 500}}},
|
| 269 |
+
"AvatarGroup": {"styles": {"truncated": {"fontWeight": 500}}},
|
| 270 |
+
"Badge": {"styles": {"root": {"fontWeight": 500}}},
|
| 271 |
+
"Progress": {"styles": {"label": {"fontWeight": 500}}},
|
| 272 |
+
"RingProgress": {"styles": {"label": {"fontWeight": 500}}},
|
| 273 |
+
"CodeHighlightTabs": {"styles": {"file": {"padding": 12}}},
|
| 274 |
+
"Table": {
|
| 275 |
+
"defaultProps": {
|
| 276 |
+
"highlightOnHover": True,
|
| 277 |
+
"withTableBorder": True,
|
| 278 |
+
"verticalSpacing": "sm",
|
| 279 |
+
"horizontalSpacing": "md",
|
| 280 |
+
}
|
| 281 |
+
},
|
| 282 |
+
},
|
| 283 |
+
# add your colors
|
| 284 |
+
"colors": {
|
| 285 |
+
"deepBlue": ["#E9EDFC", "#C1CCF6", "#99ABF0"], # 10 color elements
|
| 286 |
+
},
|
| 287 |
+
"shadows": {
|
| 288 |
+
# other shadows (xs, sm, lg) will be merged from default theme
|
| 289 |
+
"md": "1px 1px 3px rgba(0,0,0,.25)",
|
| 290 |
+
"xl": "5px 5px 3px rgba(0,0,0,.25)",
|
| 291 |
+
},
|
| 292 |
+
"headings": {
|
| 293 |
+
"fontFamily": "Roboto, sans-serif",
|
| 294 |
+
"sizes": {
|
| 295 |
+
"h1": {"fontSize": 30},
|
| 296 |
+
},
|
| 297 |
+
},
|
| 298 |
+
},
|
| 299 |
+
)
|
| 300 |
+
@callback(
|
| 301 |
+
Output("mantine-provider", "forceColorScheme"),
|
| 302 |
+
Input("color-scheme-toggle", "n_clicks"),
|
| 303 |
+
State("mantine-provider", "forceColorScheme"),
|
| 304 |
+
prevent_initial_call=True,
|
| 305 |
+
)
|
| 306 |
+
def switch_theme(_, theme):
|
| 307 |
+
return "dark" if theme == "light" else "light"
|
| 308 |
+
|
| 309 |
+
@callback(
|
| 310 |
+
Output(component_id='figRepartition', component_property='figure'),
|
| 311 |
+
Output(component_id='figCompetences', component_property='figure'),
|
| 312 |
+
Output(component_id='figTransversales', component_property='figure'),
|
| 313 |
+
Input(component_id='framework-multi-select', component_property='value'),
|
| 314 |
+
Input("mantine-provider", "forceColorScheme"),
|
| 315 |
+
)
|
| 316 |
+
def create_repartition(array_value, theme):
|
| 317 |
+
if theme == "dark":
|
| 318 |
+
template = "plotly_dark"
|
| 319 |
+
paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
| 320 |
+
plot_bgcolor = 'rgba(36, 36, 36, 1)'
|
| 321 |
+
else:
|
| 322 |
+
template = "ggplot2"
|
| 323 |
+
paper_bgcolor = 'rgba(255, 255, 255, 1)'
|
| 324 |
+
plot_bgcolor = 'rgba(255, 255, 255, 1)'
|
| 325 |
+
|
| 326 |
+
df_FT = API_France_Travail(array_value)
|
| 327 |
+
df = df_FT[['intitule','typeContratLibelle','experienceLibelle','lieuTravail']].copy()
|
| 328 |
+
df["lieuTravail"] = df["lieuTravail"].apply(lambda x: x['libelle']).apply(lambda x: x[0:3]).apply(lambda x: x.strip())
|
| 329 |
+
df.drop(df[df['lieuTravail'] == 'Fra'].index, inplace = True)
|
| 330 |
+
df.drop(df[df['lieuTravail'] == 'FRA'].index, inplace = True)
|
| 331 |
+
df.drop(df[df['lieuTravail'] == 'Ile'].index, inplace = True)
|
| 332 |
+
df.drop(df[df['lieuTravail'] == 'Mar'].index, inplace = True)
|
| 333 |
+
df.drop(df[df['lieuTravail'] == 'Bou'].index, inplace = True)
|
| 334 |
+
df.drop(df[df['lieuTravail'] == '976'].index, inplace = True)
|
| 335 |
+
|
| 336 |
+
######## localisation ########
|
| 337 |
+
ListCentroids = localisation()
|
| 338 |
+
df_localisation = df.groupby('lieuTravail').size().reset_index(name='obs')
|
| 339 |
+
df_localisation = df_localisation.sort_values(by=['lieuTravail'])
|
| 340 |
+
df_localisation['longitude'] = df_localisation['lieuTravail']
|
| 341 |
+
df_localisation['latitude'] = df_localisation['lieuTravail']
|
| 342 |
+
df_localisation["longitude"] = df_localisation['longitude'].apply(lambda x:[loc['Longitude'] for loc in ListCentroids if loc['ID'] == x]).apply(lambda x:''.join(map(str, x)))
|
| 343 |
+
df_localisation["longitude"] = pd.to_numeric(df_localisation["longitude"], downcast="float")
|
| 344 |
+
df_localisation["latitude"] = df_localisation['latitude'].apply(lambda x:[loc['Latitude'] for loc in ListCentroids if loc['ID'] == x]).apply(lambda x:''.join(map(str, x)))
|
| 345 |
+
df_localisation["latitude"] = pd.to_numeric(df_localisation["latitude"], downcast="float")
|
| 346 |
+
res = requests.get(
|
| 347 |
+
"https://raw.githubusercontent.com/codeforgermany/click_that_hood/main/public/data/france-regions.geojson"
|
| 348 |
+
)
|
| 349 |
+
fig_localisation = px.scatter_mapbox(df_localisation, lat="latitude", lon="longitude", height=600, template=template, title="La répartition géographique des emplois", hover_name="lieuTravail", size="obs").update_layout(
|
| 350 |
+
mapbox={
|
| 351 |
+
"style": "carto-positron",
|
| 352 |
+
"center": {"lon": 2, "lat" : 47},
|
| 353 |
+
"zoom": 4.5,
|
| 354 |
+
"layers": [
|
| 355 |
+
{
|
| 356 |
+
"source": res.json(),
|
| 357 |
+
"type": "line",
|
| 358 |
+
"color": "green",
|
| 359 |
+
"line": {"width": 0},
|
| 360 |
+
}
|
| 361 |
+
],
|
| 362 |
+
},font=dict(size=10),paper_bgcolor=paper_bgcolor,autosize=True,clickmode='event+select'
|
| 363 |
+
)
|
| 364 |
+
|
| 365 |
+
df_FT.dropna(subset=['qualitesProfessionnelles','formations','competences'], inplace=True)
|
| 366 |
+
df_FT["competences"] = df_FT["competences"].apply(lambda x:[str(e['libelle']) for e in x]).apply(lambda x:'; '.join(map(str, x)))
|
| 367 |
+
df_FT["qualitesProfessionnelles"] = df_FT["qualitesProfessionnelles"].apply(lambda x:[str(e['libelle']) + ": " + str(e['description']) for e in x]).apply(lambda x:'; '.join(map(str, x)))
|
| 368 |
+
|
| 369 |
+
######## Compétences professionnelles ########
|
| 370 |
+
df_comp = df_FT
|
| 371 |
+
df_comp['competences'] = df_FT['competences'].str.split(';')
|
| 372 |
+
df_comp = df_comp.explode('competences')
|
| 373 |
+
df_comp = df_comp.groupby('competences').size().reset_index(name='obs')
|
| 374 |
+
df_comp = df_comp.sort_values(by=['obs'])
|
| 375 |
+
df_comp = df_comp.iloc[-20:]
|
| 376 |
+
fig_competences = px.bar(df_comp, x='obs', y='competences', orientation='h', color='obs', height=600, template=template, title="Les principales compétences professionnelles", labels={'obs':'nombre'}, color_continuous_scale="Teal", text_auto=True).update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,autosize=True).update_traces(hovertemplate=df_comp["competences"] + ' <br>Nombre : %{x}', y=[y[:100] + "..." for y in df_comp['competences']], showlegend=False)
|
| 377 |
+
|
| 378 |
+
######## Compétences transversales ########
|
| 379 |
+
df_transversales = df_FT
|
| 380 |
+
df_transversales['qualitesProfessionnelles'] = df_FT['qualitesProfessionnelles'].str.split(';')
|
| 381 |
+
df_comptransversales = df_transversales.explode('qualitesProfessionnelles')
|
| 382 |
+
df_comptransversales = df_comptransversales.groupby('qualitesProfessionnelles').size().reset_index(name='obs')
|
| 383 |
+
df_comptransversales = df_comptransversales.sort_values(by=['obs'])
|
| 384 |
+
df_comptransversales = df_comptransversales.iloc[-20:]
|
| 385 |
+
fig_transversales = px.bar(df_comptransversales, x='obs', y='qualitesProfessionnelles', orientation='h', color='obs', height=600, template=template, title="Les principales compétences transversales", labels={'obs':'nombre'}, color_continuous_scale="Teal", text_auto=True).update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,autosize=True).update_traces(hovertemplate=df_comptransversales["qualitesProfessionnelles"] + ' <br>Nombre : %{x}', y=[y[:80] + "..." for y in df_comptransversales["qualitesProfessionnelles"]], showlegend=False)
|
| 386 |
+
|
| 387 |
+
return fig_localisation, fig_competences, fig_transversales
|
| 388 |
+
|
| 389 |
+
def create_emploi(df, theme):
|
| 390 |
+
if theme == "dark":
|
| 391 |
+
template = "plotly_dark"
|
| 392 |
+
paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
| 393 |
+
plot_bgcolor = 'rgba(36, 36, 36, 1)'
|
| 394 |
+
else:
|
| 395 |
+
template = "ggplot2"
|
| 396 |
+
paper_bgcolor = 'rgba(255, 255, 255, 1)'
|
| 397 |
+
plot_bgcolor = 'rgba(255, 255, 255, 1)'
|
| 398 |
+
######## Emplois ########
|
| 399 |
+
df_intitule = df.groupby('intitule').size().reset_index(name='obs')
|
| 400 |
+
df_intitule = df_intitule.sort_values(by=['obs'])
|
| 401 |
+
df_intitule = df_intitule.iloc[-25:]
|
| 402 |
+
fig_intitule = px.bar(df_intitule, x='obs', y='intitule', height=600, orientation='h', color='obs', template=template, title="Les principaux emplois", labels={'obs':'nombre'}, color_continuous_scale="Teal", text_auto=True).update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor, autosize=True).update_traces(hovertemplate=df_intitule["intitule"] + ' <br>Nombre : %{x}', y=[y[:100] + "..." for y in df_intitule["intitule"]], showlegend=False)
|
| 403 |
+
|
| 404 |
+
return fig_intitule
|
| 405 |
+
|
| 406 |
+
def create_contrat(df, theme):
|
| 407 |
+
if theme == "dark":
|
| 408 |
+
template = "plotly_dark"
|
| 409 |
+
paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
| 410 |
+
else:
|
| 411 |
+
template = "ggplot2"
|
| 412 |
+
paper_bgcolor = 'rgba(255, 255, 255, 1)'
|
| 413 |
+
|
| 414 |
+
######## Types de contrat ########
|
| 415 |
+
df_contrat = df.groupby('typeContratLibelle').size().reset_index(name='obs')
|
| 416 |
+
fig_contrat = px.pie(df_contrat, names='typeContratLibelle', values='obs', color='obs', height=600, template=template, title="Les types de contrat", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor)
|
| 417 |
+
|
| 418 |
+
return fig_contrat
|
| 419 |
+
|
| 420 |
+
def create_experience(df, theme):
|
| 421 |
+
if theme == "dark":
|
| 422 |
+
template = "plotly_dark"
|
| 423 |
+
paper_bgcolor = 'rgba(36, 36, 36, 1)'
|
| 424 |
+
else:
|
| 425 |
+
template = "ggplot2"
|
| 426 |
+
paper_bgcolor = 'rgba(255, 255, 255, 1)'
|
| 427 |
+
######## Expériences professionnelles ########
|
| 428 |
+
df_experience = df.groupby('experienceLibelle').size().reset_index(name='obs')
|
| 429 |
+
fig_experience = px.pie(df_experience, names='experienceLibelle', values='obs', color='obs', height=600, template=template, title="Les expériences professionnelles", labels={'obs':'nombre'}, color_discrete_sequence=px.colors.qualitative.Safe).update_traces(textposition='inside', textinfo='percent+label').update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor)
|
| 430 |
+
|
| 431 |
+
return fig_experience
|
| 432 |
+
|
| 433 |
+
@callback(
|
| 434 |
+
Output(component_id='figEmplois', component_property='figure'),
|
| 435 |
+
Input('figRepartition', 'selectedData'),
|
| 436 |
+
Input(component_id='framework-multi-select', component_property='value'),
|
| 437 |
+
Input("mantine-provider", "forceColorScheme"),
|
| 438 |
+
)
|
| 439 |
+
|
| 440 |
+
def update_emploi(selectedData, array_value, theme):
|
| 441 |
+
options = []
|
| 442 |
+
if selectedData != None:
|
| 443 |
+
if type(selectedData['points'][0]['hovertext']) == str:
|
| 444 |
+
options.append(selectedData['points'][0]['hovertext'])
|
| 445 |
+
else:
|
| 446 |
+
options = selectedData['points'][0]['hovertext']
|
| 447 |
+
else:
|
| 448 |
+
options = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','2A','2B','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','971','972','973','974']
|
| 449 |
+
|
| 450 |
+
df_FT = API_France_Travail(array_value)
|
| 451 |
+
df = df_FT[['intitule','typeContratLibelle','experienceLibelle','lieuTravail']].copy()
|
| 452 |
+
df["lieuTravail"] = df["lieuTravail"].apply(lambda x: x['libelle']).apply(lambda x: x[0:3]).apply(lambda x: x.strip())
|
| 453 |
+
df.drop(df[df['lieuTravail'] == 'Fra'].index, inplace = True)
|
| 454 |
+
df.drop(df[df['lieuTravail'] == 'FRA'].index, inplace = True)
|
| 455 |
+
df.drop(df[df['lieuTravail'] == 'Ile'].index, inplace = True)
|
| 456 |
+
df.drop(df[df['lieuTravail'] == 'Mar'].index, inplace = True)
|
| 457 |
+
df.drop(df[df['lieuTravail'] == 'Bou'].index, inplace = True)
|
| 458 |
+
df.drop(df[df['lieuTravail'] == '976'].index, inplace = True)
|
| 459 |
+
df = df[df['lieuTravail'].isin(options)]
|
| 460 |
+
return create_emploi(df, theme)
|
| 461 |
+
|
| 462 |
+
@callback(
|
| 463 |
+
Output(component_id='figContrats', component_property='figure'),
|
| 464 |
+
Input('figRepartition', 'selectedData'),
|
| 465 |
+
Input(component_id='framework-multi-select', component_property='value'),
|
| 466 |
+
Input("mantine-provider", "forceColorScheme"),
|
| 467 |
+
)
|
| 468 |
+
|
| 469 |
+
def update_contrat(selectedData, array_value, theme):
|
| 470 |
+
options = []
|
| 471 |
+
if selectedData != None:
|
| 472 |
+
if type(selectedData['points'][0]['hovertext']) == str:
|
| 473 |
+
options.append(selectedData['points'][0]['hovertext'])
|
| 474 |
+
else:
|
| 475 |
+
options = selectedData['points'][0]['hovertext']
|
| 476 |
+
else:
|
| 477 |
+
options = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','2A','2B','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','971','972','973','974']
|
| 478 |
+
|
| 479 |
+
df_FT = API_France_Travail(array_value)
|
| 480 |
+
df = df_FT[['intitule','typeContratLibelle','experienceLibelle','lieuTravail']].copy()
|
| 481 |
+
df["lieuTravail"] = df["lieuTravail"].apply(lambda x: x['libelle']).apply(lambda x: x[0:3]).apply(lambda x: x.strip())
|
| 482 |
+
df.drop(df[df['lieuTravail'] == 'Fra'].index, inplace = True)
|
| 483 |
+
df.drop(df[df['lieuTravail'] == 'FRA'].index, inplace = True)
|
| 484 |
+
df.drop(df[df['lieuTravail'] == 'Ile'].index, inplace = True)
|
| 485 |
+
df.drop(df[df['lieuTravail'] == 'Mar'].index, inplace = True)
|
| 486 |
+
df.drop(df[df['lieuTravail'] == 'Bou'].index, inplace = True)
|
| 487 |
+
df.drop(df[df['lieuTravail'] == '976'].index, inplace = True)
|
| 488 |
+
df = df[df['lieuTravail'].isin(options)]
|
| 489 |
+
|
| 490 |
+
return create_contrat(df, theme)
|
| 491 |
+
|
| 492 |
+
@callback(
|
| 493 |
+
Output(component_id='figExperiences', component_property='figure'),
|
| 494 |
+
Input('figRepartition', 'selectedData'),
|
| 495 |
+
Input(component_id='framework-multi-select', component_property='value'),
|
| 496 |
+
Input("mantine-provider", "forceColorScheme"),
|
| 497 |
+
)
|
| 498 |
+
|
| 499 |
+
def update_experience(selectedData, array_value, theme):
|
| 500 |
+
options = []
|
| 501 |
+
if selectedData != None:
|
| 502 |
+
if type(selectedData['points'][0]['hovertext']) == str:
|
| 503 |
+
options.append(selectedData['points'][0]['hovertext'])
|
| 504 |
+
else:
|
| 505 |
+
options = selectedData['points'][0]['hovertext']
|
| 506 |
+
else:
|
| 507 |
+
options = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','2A','2B','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','971','972','973','974']
|
| 508 |
+
|
| 509 |
+
df_FT = API_France_Travail(array_value)
|
| 510 |
+
df = df_FT[['intitule','typeContratLibelle','experienceLibelle','lieuTravail']].copy()
|
| 511 |
+
df["lieuTravail"] = df["lieuTravail"].apply(lambda x: x['libelle']).apply(lambda x: x[0:3]).apply(lambda x: x.strip())
|
| 512 |
+
df.drop(df[df['lieuTravail'] == 'Fra'].index, inplace = True)
|
| 513 |
+
df.drop(df[df['lieuTravail'] == 'FRA'].index, inplace = True)
|
| 514 |
+
df.drop(df[df['lieuTravail'] == 'Ile'].index, inplace = True)
|
| 515 |
+
df.drop(df[df['lieuTravail'] == 'Mar'].index, inplace = True)
|
| 516 |
+
df.drop(df[df['lieuTravail'] == 'Bou'].index, inplace = True)
|
| 517 |
+
df.drop(df[df['lieuTravail'] == '976'].index, inplace = True)
|
| 518 |
+
df = df[df['lieuTravail'].isin(options)]
|
| 519 |
+
|
| 520 |
+
return create_experience(df, theme)
|
| 521 |
+
|
| 522 |
+
if __name__ == '__main__':
|
| 523 |
+
app.run_server(debug=True)
|