Spaces:
Runtime error
Runtime error
Commit
·
f49dec5
1
Parent(s):
46b2e5f
V3_Liste_Map_Stats_ActionsRSE 01
Browse files- ActionsRSE.py +31 -0
- app.py +5 -4
ActionsRSE.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import data_manager
|
| 3 |
+
|
| 4 |
+
def display_actions_rse():
|
| 5 |
+
# Utilisation de data_manager pour récupérer les données
|
| 6 |
+
data, total_hits = data_manager.get_data()
|
| 7 |
+
|
| 8 |
+
if total_hits > 0:
|
| 9 |
+
# Extraction des noms d'entreprises et des secteurs pour les options de filtre
|
| 10 |
+
noms_entreprises = sorted({record.get("nom_entreprise") for record in data})
|
| 11 |
+
secteurs = sorted({record.get("secteur_activite") for record in data})
|
| 12 |
+
|
| 13 |
+
# Interface utilisateur pour les filtres
|
| 14 |
+
entreprises_selectionnees = st.multiselect("Filtre par nom d'entreprise :", noms_entreprises)
|
| 15 |
+
secteurs_selectionnes = st.multiselect("Filtre par secteur d'activité :", secteurs)
|
| 16 |
+
|
| 17 |
+
# Filtrage des actions RSE
|
| 18 |
+
actions_filtrees = [
|
| 19 |
+
record for record in data
|
| 20 |
+
if (record.get("nom_entreprise") in entreprises_selectionnees or not entreprises_selectionnees)
|
| 21 |
+
and (record.get("secteur_activite") in secteurs_selectionnes or not secteurs_selectionnes)
|
| 22 |
+
]
|
| 23 |
+
|
| 24 |
+
# Affichage des actions RSE filtrées
|
| 25 |
+
if actions_filtrees:
|
| 26 |
+
for action in actions_filtrees:
|
| 27 |
+
st.write(f"Entreprise: {action.get('nom_entreprise')}, Action: {action.get('description_action_rse')}")
|
| 28 |
+
else:
|
| 29 |
+
st.write("Aucune action RSE correspondante trouvée.")
|
| 30 |
+
else:
|
| 31 |
+
st.write("Erreur lors de la récupération des données.")
|
app.py
CHANGED
|
@@ -2,12 +2,12 @@ import streamlit as st
|
|
| 2 |
from organisations_engagees import display_organisations_engagees
|
| 3 |
from localisation import display_map
|
| 4 |
from statistiques import main as display_statistics
|
| 5 |
-
|
| 6 |
|
| 7 |
# Main function orchestrating the app UI
|
| 8 |
def main():
|
| 9 |
st.sidebar.title("Open Data RSE Bordeaux Métropole")
|
| 10 |
-
app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "Localisations", "Statistiques"])
|
| 11 |
|
| 12 |
if app_mode == "Organisations engagées":
|
| 13 |
display_organisations_engagees()
|
|
@@ -15,7 +15,8 @@ def main():
|
|
| 15 |
display_map()
|
| 16 |
elif app_mode == "Statistiques":
|
| 17 |
display_statistics()
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
# Après toutes les autres instructions dans votre barre latérale :
|
| 21 |
st.sidebar.markdown("---") # Ajoute une ligne de séparation visuelle
|
|
@@ -25,4 +26,4 @@ def main():
|
|
| 25 |
st.sidebar.markdown("---") # Ajoute une ligne de séparation visuelle
|
| 26 |
|
| 27 |
if __name__ == "__main__":
|
| 28 |
-
main()
|
|
|
|
| 2 |
from organisations_engagees import display_organisations_engagees
|
| 3 |
from localisation import display_map
|
| 4 |
from statistiques import main as display_statistics
|
| 5 |
+
from actionsRSE import display_actions_rse
|
| 6 |
|
| 7 |
# Main function orchestrating the app UI
|
| 8 |
def main():
|
| 9 |
st.sidebar.title("Open Data RSE Bordeaux Métropole")
|
| 10 |
+
app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "Localisations", "Statistiques", "Actions RSE"])
|
| 11 |
|
| 12 |
if app_mode == "Organisations engagées":
|
| 13 |
display_organisations_engagees()
|
|
|
|
| 15 |
display_map()
|
| 16 |
elif app_mode == "Statistiques":
|
| 17 |
display_statistics()
|
| 18 |
+
elif app_mode == "Actions RSE":
|
| 19 |
+
display_actions_rse()
|
| 20 |
|
| 21 |
# Après toutes les autres instructions dans votre barre latérale :
|
| 22 |
st.sidebar.markdown("---") # Ajoute une ligne de séparation visuelle
|
|
|
|
| 26 |
st.sidebar.markdown("---") # Ajoute une ligne de séparation visuelle
|
| 27 |
|
| 28 |
if __name__ == "__main__":
|
| 29 |
+
main()
|