File size: 2,858 Bytes
da14378
 
 
 
f563847
da14378
 
f563847
da14378
f563847
 
 
 
da14378
 
 
f563847
 
 
da14378
f563847
 
 
 
 
 
 
 
 
 
da14378
f563847
 
da14378
 
f563847
da14378
f563847
 
 
 
 
 
da14378
 
 
 
 
f563847
da14378
f563847
 
 
 
 
 
 
 
 
 
 
 
 
da14378
f563847
da14378
f563847
 
 
 
 
da14378
f563847
da14378
 
 
f563847
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import streamlit as st
import pandas as pd
import numpy as np

# Streamlit App Configuration
st.set_page_config(page_title="Maintenance Prediction & Scheduling", layout="wide")

# Sidebar for Navigation and File Upload
st.sidebar.title("Navigation")
view_option = st.sidebar.radio("Choose View:", ["Home", "Upload Data", "Maintenance Schedule", "Equipment Insights"])

st.sidebar.title("Upload Data")
data_upload = st.sidebar.file_uploader("Upload Equipment Data (CSV):", type=["csv"])

# App Title
st.title("Maintenance Prediction & Scheduling App")
st.markdown(
    "This app predicts maintenance needs and schedules activities to minimize downtime for construction equipment like HVAC, elevators, and generators."
)

# Helper Function - Process Uploaded Data
def process_uploaded_data(uploaded_file):
    try:
        data = pd.read_csv(uploaded_file)
        st.success("Data uploaded successfully!")
        st.dataframe(data)
        return data
    except Exception as e:
        st.error(f"Error processing the uploaded file: {e}")
        return None

# Main Views
uploaded_data = None

if view_option == "Home":
    st.image("https://via.placeholder.com/800x400.png?text=Maintenance+Scheduling+App", caption="Welcome Screen")
    st.markdown(
        """
        ### Key Features:
        - Upload site data for analysis.
        - Predict maintenance needs based on historical data.
        - Schedule maintenance tasks and download the schedule.
        """
    )

elif view_option == "Upload Data":
    st.subheader("Upload Equipment Data")
    if data_upload:
        uploaded_data = process_uploaded_data(data_upload)

elif view_option == "Maintenance Schedule":
    st.subheader("Maintenance Schedule")
    if data_upload and uploaded_data is not None:
        st.write("Generating maintenance schedule...")
        # Simulate maintenance schedule
        uploaded_data["Maintenance_Due"] = np.where(uploaded_data["Condition_Score"] < 75, "Yes", "No")
        st.dataframe(uploaded_data[["Equipment_ID", "Equipment_Type", "Maintenance_Due"]])
        st.download_button(
            label="Download Schedule as CSV",
            data=uploaded_data.to_csv(index=False).encode('utf-8'),
            file_name="maintenance_schedule.csv",
            mime="text/csv",
        )
    else:
        st.info("Please upload data in the 'Upload Data' section.")

elif view_option == "Equipment Insights":
    st.subheader("Equipment Insights")
    if data_upload and uploaded_data is not None:
        st.write("Analyzing equipment performance...")
        st.bar_chart(uploaded_data[["Usage_Hours", "Condition_Score"]].set_index(uploaded_data["Equipment_Type"]))
    else:
        st.info("Please upload data in the 'Upload Data' section.")

# Footer
st.markdown("---")
st.markdown("Developed by [Your Name] - Enhancing Maintenance Planning with AI")