Spaces:
Runtime error
Runtime error
File size: 2,881 Bytes
11a6f69 4b8f61c c220020 4b8f61c 11a6f69 c220020 11a6f69 c220020 6793fbd 2bdfb42 0401dee bd47db1 4b8f61c c220020 4b8f61c 2bdfb42 c220020 4b8f61c c220020 4b8f61c 2bdfb42 c0b1335 c220020 4b8f61c 6b6ad95 4b8f61c c220020 4b8f61c |
1 2 3 4 5 6 7 8 9 10 11 12 13 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 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 96 |
import os
from dash import dcc, html
import pandas as pd
import dash_bootstrap_components as dbc
from app import app
from dotenv import load_dotenv
from helpers.processor import Processor
from helpers.models import S3Config
from helpers.s3 import S3Client
from global_vars import BUCKET_NAME
load_dotenv()
# Initialisation des clients
s3_config = S3Config(
bucket_name=BUCKET_NAME,
endpoint_url=os.getenv("AWS_ENDPOINT_URL_S3"),
access_key=os.getenv("AWS_ACCESS_KEY_ID"),
secret_key=os.getenv("AWS_SECRET_ACCESS_KEY")
)
s3_client = S3Client(config=s3_config)
processor = Processor()
# Initialisation de l'application Dash avec Bootstrap
# Chargement des données
df = processor.get_contribution_data(s3_client)
# Layout du tableau de bord
layout = dbc.Container(
[
html.H1("Contribution Dashboard", className="text-center mt-4 mb-4"),
dbc.Row(
[
dbc.Col(
[
html.Label("Sélectionnez un Chapitre :"),
dcc.Dropdown(
id="chapter-dropdown-contrib",
options=[{"label": "Tous les chapitres", "value": "all"}],
value="all",
placeholder="Sélectionnez un chapitre",
),
],
width=4,
),
dbc.Col(
[
html.Label("Sélectionnez une Page :"),
dcc.Dropdown(
id="page-dropdown-contrib",
options=[{"label": "Toutes les pages", "value": "all"}],
value="all",
placeholder="Sélectionnez une page",
),
],
width=4,
),
dbc.Col(
[
html.Label("Mode d'affichage :"),
dcc.RadioItems(
id="mode-radio",
options=[
{"label": "Nombre", "value": "count"},
{"label": "Pourcentage", "value": "percentage"},
],
value="count",
inline=True,
),
],
width=4,
),
],
className="mb-4",
),
dbc.Row([dbc.Col(dcc.Loading(dcc.Graph(id="contributions-graph")), width=12)]),
dbc.Row(
[
dbc.Col(
html.Div(id="data-summary", className="text-center mt-3"), width=12
)
]
),
],
fluid=True,
)
from .callbacks import *
|