File size: 1,536 Bytes
14035fd 6eaa3dc 8846627 9edd269 8846627 6eaa3dc 8846627 6eaa3dc 8846627 6eaa3dc 8846627 684911e 8846627 684911e 8846627 9edd269 8846627 9edd269 8846627 684911e 8846627 |
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 48 49 50 |
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import streamlit as st
import pandas as pd
from utils.load_data import load_logs
from utils.visualize import plot_usage
from utils.report import generate_pdf
from models.anomaly import detect_anomalies
from utils.amc import upcoming_amc_devices
st.set_page_config(page_title="LabOps Dashboard", layout="wide")
st.title("π Multi-Device LabOps Dashboard")
uploaded_files = st.file_uploader("Upload Device Logs (CSV)", accept_multiple_files=True)
if uploaded_files:
df = load_logs(uploaded_files)
st.subheader("π Uploaded Logs")
st.dataframe(df.head())
st.subheader("π Daily Usage Chart")
st.pyplot(plot_usage(df))
st.subheader("π¨ Detected Anomalies")
try:
anomalies = detect_anomalies(df)
st.dataframe(anomalies)
except Exception as e:
st.error(f"Failed to compute anomalies: {e}")
st.subheader("π Upcoming AMC Devices")
if "amc_expiry" in df.columns:
try:
amc_df = upcoming_amc_devices(df)
st.dataframe(amc_df)
except Exception as e:
st.error(f"Failed to process AMC dates: {e}")
else:
st.info("Column `amc_expiry` not found in uploaded data.")
if st.button("π Generate PDF Report"):
try:
generate_pdf(df)
st.success("β
PDF report generated and saved to /tmp/labops_report.pdf")
except Exception as e:
st.error(f"Failed to generate PDF: {e}")
|