KJ commited on
Commit ·
2cbf59b
1
Parent(s): 9a51b1c
fx
Browse files
app.py
CHANGED
|
@@ -54,7 +54,7 @@ def get_timestamp_range():
|
|
| 54 |
try:
|
| 55 |
with engine.connect() as conn:
|
| 56 |
result = conn.execute(text("SELECT MIN(timestamp) as min_ts, MAX(timestamp) as max_ts FROM gps_points")).fetchone()
|
| 57 |
-
return result[
|
| 58 |
except Exception as e:
|
| 59 |
st.error(f"Error fetching timestamp range: {e}")
|
| 60 |
return None, None
|
|
@@ -79,7 +79,8 @@ def load_gps_data(from_ts, to_ts):
|
|
| 79 |
WHERE timestamp BETWEEN :from_ts AND :to_ts
|
| 80 |
ORDER BY timestamp
|
| 81 |
""")
|
| 82 |
-
|
|
|
|
| 83 |
return df
|
| 84 |
except Exception as e:
|
| 85 |
st.error(f"Error loading GPS data: {e}")
|
|
|
|
| 54 |
try:
|
| 55 |
with engine.connect() as conn:
|
| 56 |
result = conn.execute(text("SELECT MIN(timestamp) as min_ts, MAX(timestamp) as max_ts FROM gps_points")).fetchone()
|
| 57 |
+
return result[0], result[1] # min_ts, max_ts
|
| 58 |
except Exception as e:
|
| 59 |
st.error(f"Error fetching timestamp range: {e}")
|
| 60 |
return None, None
|
|
|
|
| 79 |
WHERE timestamp BETWEEN :from_ts AND :to_ts
|
| 80 |
ORDER BY timestamp
|
| 81 |
""")
|
| 82 |
+
with engine.connect() as conn:
|
| 83 |
+
df = pd.read_sql(query, conn, params={"from_ts": from_ts, "to_ts": to_ts})
|
| 84 |
return df
|
| 85 |
except Exception as e:
|
| 86 |
st.error(f"Error loading GPS data: {e}")
|