Commit
·
64a89a0
1
Parent(s):
96396c3
Pytorch V0.16
Browse files
app.py
CHANGED
@@ -10,19 +10,21 @@ def get_data():
|
|
10 |
if response.status_code == 200:
|
11 |
data = response.json()
|
12 |
records = data.get("records", [])
|
|
|
|
|
|
|
13 |
cleaned_data = []
|
14 |
for record in records:
|
15 |
fields = record.get("fields", {})
|
16 |
-
point_geo = fields.get("
|
17 |
-
if isinstance(point_geo,
|
18 |
-
lat = point_geo
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
fields["longitude"] = lon
|
23 |
-
cleaned_data.append(fields)
|
24 |
return cleaned_data
|
25 |
else:
|
|
|
26 |
return []
|
27 |
|
28 |
def display_organisations_engagees(data):
|
|
|
10 |
if response.status_code == 200:
|
11 |
data = response.json()
|
12 |
records = data.get("records", [])
|
13 |
+
if not records:
|
14 |
+
st.error("Aucun enregistrement trouvé dans les données de l'API.")
|
15 |
+
return []
|
16 |
cleaned_data = []
|
17 |
for record in records:
|
18 |
fields = record.get("fields", {})
|
19 |
+
point_geo = fields.get("geolocalisation")
|
20 |
+
if point_geo and isinstance(point_geo, list) and len(point_geo) == 2:
|
21 |
+
lat, lon = point_geo
|
22 |
+
fields["latitude"] = lat
|
23 |
+
fields["longitude"] = lon
|
24 |
+
cleaned_data.append(fields)
|
|
|
|
|
25 |
return cleaned_data
|
26 |
else:
|
27 |
+
st.error(f"Échec de la récupération des données de l'API. Statut: {response.status_code}")
|
28 |
return []
|
29 |
|
30 |
def display_organisations_engagees(data):
|