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 *