|
import pandas as pd |
|
import plotly.express as px |
|
import streamlit as st |
|
|
|
from process_kpi.process_gsm_capacity import GsmCapacity, analyze_gsm_data |
|
from utils.convert_to_excel import ( |
|
convert_dfs, |
|
convert_gsm_dfs, |
|
) |
|
|
|
st.title(" π GSM Capacity Analysis") |
|
doc_col, image_col = st.columns(2) |
|
|
|
with doc_col: |
|
st.write( |
|
""" |
|
The report should be run with a minimum of 3 days of data. |
|
- Daily Aggregated |
|
- Site level |
|
- Exported in CSV format. |
|
""" |
|
) |
|
|
|
with image_col: |
|
st.image("./assets/gsm_capacity.png", width=250) |
|
|
|
file1, file2, file3 = st.columns(3) |
|
|
|
with file1: |
|
uploaded_dump = st.file_uploader("Upload Dump file in xlsb format", type="xlsb") |
|
with file2: |
|
uploaded_daily_report = st.file_uploader( |
|
"Upload Daily Report in CSV format", type="csv" |
|
) |
|
with file3: |
|
uploaded_bh_report = st.file_uploader( |
|
"Upload Busy Hour Report in CSV format", type="csv" |
|
) |
|
|
|
|
|
col1, col2 = st.columns(2) |
|
|
|
threshold_col1, threshold_col2 = st.columns(2) |
|
threshold_col3, threshold_col4 = st.columns(2) |
|
|
|
if ( |
|
uploaded_dump is not None |
|
and uploaded_daily_report is not None |
|
and uploaded_bh_report is not None |
|
): |
|
|
|
with col1: |
|
number_of_kpi_days = st.number_input( |
|
"Number of days for analysis", |
|
min_value=3, |
|
max_value=30, |
|
value=7, |
|
) |
|
with col2: |
|
number_of_threshold_days = st.number_input( |
|
"Number of days for threshold", |
|
min_value=1, |
|
max_value=30, |
|
value=3, |
|
) |
|
|
|
with threshold_col1: |
|
availability_threshold = st.number_input( |
|
"Availability Threshold", min_value=1, max_value=100, value=95 |
|
) |
|
with threshold_col2: |
|
tch_abis_fails_threshold = st.number_input( |
|
"TCH ABIS Fails Threshold", min_value=0, value=10 |
|
) |
|
with threshold_col3: |
|
sddch_blocking_threshold = st.number_input( |
|
"SDDCH Blocking Threshold", min_value=0.1, value=0.5 |
|
) |
|
with threshold_col4: |
|
tch_blocking_threshold = st.number_input( |
|
"TCH Blocking Threshold", min_value=0.1, value=0.5 |
|
) |
|
|
|
if st.button("Analyze Data", type="primary"): |
|
dfs = analyze_gsm_data( |
|
dump_path=uploaded_dump, |
|
daily_report_path=uploaded_daily_report, |
|
bh_report_path=uploaded_bh_report, |
|
number_of_kpi_days=number_of_kpi_days, |
|
number_of_threshold_days=number_of_threshold_days, |
|
availability_threshold=availability_threshold, |
|
tch_abis_fails_threshold=tch_abis_fails_threshold, |
|
sddch_blocking_threshold=sddch_blocking_threshold, |
|
tch_blocking_threshold=tch_blocking_threshold, |
|
) |
|
|
|
if dfs is not None: |
|
gsm_analysis_df = dfs[0] |
|
bh_kpi_df = dfs[1] |
|
GsmCapacity.final_results = convert_gsm_dfs( |
|
[gsm_analysis_df, bh_kpi_df], ["GSM_Analysis", "BH_KPI_Analysis"] |
|
) |
|
|
|
|
|
|
|
|
|
|
|
if GsmCapacity.final_results is not None: |
|
st.download_button( |
|
on_click="ignore", |
|
type="primary", |
|
label="Download the Analysis Report", |
|
data=GsmCapacity.final_results, |
|
file_name="GSM_Analysis_Report.xlsx", |
|
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
|
) |
|
|
|
st.write(gsm_analysis_df) |
|
|