125 lines
4.6 KiB
Python
125 lines
4.6 KiB
Python
"""
|
|
"""
|
|
|
|
# --------------------------------------- #
|
|
# imports #
|
|
# --------------------------------------- #
|
|
import streamlit as st
|
|
|
|
import plotly.express as px
|
|
|
|
from BBUtils.logging_handle import logger
|
|
|
|
from request_load_estimator import RequestLoadEstimator
|
|
|
|
# --------------------------------------- #
|
|
# definitions #
|
|
# --------------------------------------- #
|
|
MODULE_LOGGER_HEAD = "start_app -> "
|
|
|
|
APP_VERSION = "99.99.99"
|
|
APP_NAME = "Service Request Complexity Estimator"
|
|
|
|
st.set_page_config(page_title="Service Request Complexity Estimator", page_icon="📊", layout="wide")
|
|
|
|
FOOTER = f"""
|
|
<style>
|
|
.footer {{
|
|
position: fixed;
|
|
left: 0;
|
|
bottom: 0;
|
|
width: 100%;
|
|
background-color: white;
|
|
color: lightgrey;
|
|
text-align: center;
|
|
}}
|
|
</style>
|
|
<div class="footer">
|
|
{APP_NAME} - v{APP_VERSION} - by <a href="https://www.bit-buddy.at" target="_blank">BitBuddySolutions</a>
|
|
</div>
|
|
"""
|
|
# --------------------------------------- #
|
|
# global vars #
|
|
# --------------------------------------- #
|
|
|
|
|
|
# --------------------------------------- #
|
|
# functions #
|
|
# --------------------------------------- #
|
|
@st.cache_resource
|
|
def setup_logging():
|
|
logger.set_logging_level("debug")
|
|
logger.set_cmd_line_logging_output()
|
|
pass
|
|
|
|
|
|
@st.cache_resource
|
|
def get_estimator():
|
|
return RequestLoadEstimator()
|
|
|
|
|
|
# --------------------------------------- #
|
|
# classes #
|
|
# --------------------------------------- #
|
|
|
|
|
|
# --------------------------------------- #
|
|
# main #
|
|
# --------------------------------------- #
|
|
if __name__ == "__main__":
|
|
setup_logging()
|
|
st.header("Service Request Complexity Estimator")
|
|
|
|
st.write("This app is designed to help estimate the complexity of a service request system to avoid problems "
|
|
"within your IT department.")
|
|
|
|
form = st.form(key='complex_form')
|
|
col1, col2, col3, col4 = form.columns(4)
|
|
form.divider()
|
|
dis_col1, dis_col2 = form.columns([5, 1])
|
|
weeks_cycle = col1.number_input("Weeks cycle", min_value=1, max_value=20, value=3)
|
|
add_new_employee = col2.number_input("Add new employees", min_value=0, max_value=50, value=0)
|
|
add_new_applications = col3.number_input("Change number of applications", min_value=-10, max_value=10, value=0)
|
|
add_new_service_desk_employees = col4.number_input("Change number of service desk employees", min_value=-10,
|
|
max_value=10,
|
|
value=0)
|
|
|
|
submit_button = col1.form_submit_button(label='Process')
|
|
|
|
request_estimator = get_estimator()
|
|
|
|
if submit_button:
|
|
request_estimator.set_weeks_cycle(weeks_cycle)
|
|
request_estimator.add_new_applications(add_new_applications)
|
|
request_estimator.add_service_desk_employees(add_new_service_desk_employees)
|
|
request_estimator.add_new_employees(add_new_employee)
|
|
request_estimator.process_weeks()
|
|
|
|
if not request_estimator.data_set.empty:
|
|
fig_requests = px.area(request_estimator.data_set, x="week", y=["nr_of_processed_service_requests"], line_shape="spline")
|
|
|
|
dis_col1.plotly_chart(fig_requests)
|
|
detail_expander = dis_col1.expander("Details")
|
|
detail_expander.dataframe(request_estimator.data_set)
|
|
dis_col2.metric("Company Employees", request_estimator.nr_of_employees, delta=add_new_employee)
|
|
dis_col2.metric("Service Desk Employees", request_estimator.service_desk_employees, delta=add_new_service_desk_employees)
|
|
dis_col2.metric("Nr of Applications", request_estimator.nr_of_applications, delta=add_new_applications)
|
|
dis_col2.metric("Nr of open Service Requests", request_estimator.nr_of_open_service_requests)
|
|
dis_col2.metric("Nr of processed Service Requests", request_estimator.processed_service_requests)
|
|
if request_estimator.personal_available_time > 0:
|
|
st.info(f"Your team has available time of {request_estimator.personal_available_time:.0f} hours.")
|
|
else:
|
|
st.error("Your team has no available time. You are in the cycle of death! Hire new Guys!!!!")
|
|
else:
|
|
form.write(request_estimator.data_set)
|
|
|
|
st.divider()
|
|
|
|
reset_button = st.button("Reset")
|
|
|
|
if reset_button:
|
|
request_estimator.initialize_data()
|
|
st.rerun()
|
|
|
|
st.markdown(FOOTER, unsafe_allow_html=True)
|