Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/components/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def render_status_table(status_df: pd.DataFrame):

# Prepare display data
display_cols = [
"Cluster",
"Site",
"cluster",
"site_name",
"DeploymentID",
"Country",
"status",
"last_recorded",
"total_recordings",
"days_since_last",
]

Expand All @@ -40,12 +40,13 @@ def render_status_table(status_df: pd.DataFrame):

# Rename columns for better display
column_rename = {
"site_name": "Site",
"cluster": "Cluster",
"DeploymentID": "Device ID",
"last_recorded": "Last Recording",
"total_recordings": "Total recordings",
"days_since_last": "Days Since Last",
"status": "Status",
}

table_data = table_data.rename(columns=column_rename)

# Style function for better visual appeal
Expand Down
39 changes: 18 additions & 21 deletions src/map_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,30 +168,27 @@ def render_status_tab(
# Filters for status table
filtered_data, _ = render_complete_filters(device_data, key_prefix="status")

if not filtered_data.empty:
# Display options
col1, col2, col3 = st.columns(3)
col1, col2, col3 = st.columns(3)

with col2:
sort_by = st.selectbox(
"Sort by",
["device_name", "Country", "status", "last_file", "total_recordings"],
index=2, # Default to status
)
with col3:
ascending = st.checkbox("Ascending order", value=False)
with col2:
sort_by = st.selectbox(
"Sort by",
["device_name", "Country", "status", "last_file", "total_recordings"],
index=2,
)
with col3:
ascending = st.checkbox("Ascending order", value=False)

# Sort and display table
sorted_data = filtered_data.sort_values(by=sort_by, ascending=ascending)
render_status_table(sorted_data)
# Sort and display table
sorted_data = filtered_data.sort_values(by=sort_by, ascending=ascending)
render_status_table(sorted_data)

# Summary statistics
render_info_section_header(
"📊 Summary Statistics", level="h4", style_class="map-summary-header"
)
render_summary_table(filtered_data)

# Summary statistics
render_info_section_header(
"📊 Summary Statistics", level="h4", style_class="map-summary-header"
)
render_summary_table(filtered_data)
else:
st.warning("⚠️ No devices match the current filter criteria.")


def render_activity_tab(data_service: DataService):
Expand Down
Loading