|
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") |
|
anomalies = detect_anomalies(df) |
|
st.dataframe(anomalies) |
|
|
|
st.subheader("π Upcoming AMC Devices") |
|
if "amc_expiry" in df.columns: |
|
amc_df = upcoming_amc_devices(df) |
|
st.dataframe(amc_df) |
|
else: |
|
st.warning("AMC expiry column (`amc_expiry`) not found in uploaded data.") |
|
|
|
if st.button("π Generate PDF Report"): |
|
generate_pdf(df) |
|
st.success("PDF report generated and saved.") |
|
|