File size: 1,549 Bytes
a631fd0
d0661bd
d2c8f3c
 
0527fa6
 
854dede
0527fa6
 
d2c8f3c
 
 
 
bda553e
d2c8f3c
bda553e
9ee810a
d2c8f3c
0527fa6
 
bda553e
0527fa6
d2c8f3c
 
10118ca
 
 
 
 
 
 
 
 
9ee810a
0527fa6
a631fd0
 
 
 
 
 
 
f3a6502
0527fa6
 
10118ca
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

import streamlit as st
import pandas as pd
import requests
import folium
from streamlit_folium import folium_static

def get_data():
    url = "https://opendata.bordeaux-metropole.fr/api/records/1.0/search/?dataset=met_etablissement_rse&q=&rows=100"
    response = requests.get(url)
    if response.status_code == 200:
        data = response.json()
        records = data.get("records", [])
        return [record["fields"] for record in records], data.get("nhits", 0)
    else:
        return [], 0

def display_organisations_engagees():
    st.markdown("## OPEN DATA RSE")
    st.markdown("### Découvrez les organisations engagées RSE de la métropole de Bordeaux")
    
    data, _ = get_data()
    if data:
        df = pd.DataFrame(data)
        df = df.rename(columns={
            "nom_courant_denomination": "Nom",
            "commune": "Commune",
            "libelle_section_naf": "Section NAF",
            "tranche_effectif_entreprise": "Effectif",
            "action_rse": "Action RSE"
        })
        df = df[["Nom", "Commune", "Section NAF", "Effectif", "Action RSE"]]
        st.dataframe(df, width=None, height=None)

def main():
    st.sidebar.title("Navigation")
    app_mode = st.sidebar.radio("Choose a page", ["Home", "Organisations Engagées"])
    
    if app_mode == "Home":
        st.header("Welcome to the RSE Data Explorer!")
        st.markdown("Please select a page on the left.")
    elif app_mode == "Organisations Engagées":
        display_organisations_engagees()

if __name__ == "__main__":
    main()