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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def diagnose_network(
|
| 4 |
+
availability, comcase, module_stolen, site_dismantle, blacksite, force_majeure,
|
| 5 |
+
trans_alarm, trans_pl, trans_tnl, ul_interference, vswr,
|
| 6 |
+
rsrp, prb, max_user, active_user_max, ping_pong,
|
| 7 |
+
cssr, profile, simcard, ue, it_problem, core
|
| 8 |
+
):
|
| 9 |
+
root_cause, sub_root_cause, action = "", "", ""
|
| 10 |
+
|
| 11 |
+
rsrp = int(rsrp)
|
| 12 |
+
prb = int(prb)
|
| 13 |
+
max_user = int(max_user)
|
| 14 |
+
active_user_max = int(active_user_max)
|
| 15 |
+
|
| 16 |
+
if availability == "Not Safe":
|
| 17 |
+
if comcase == "Not Safe":
|
| 18 |
+
root_cause = "Availability"
|
| 19 |
+
sub_root_cause = "Comcase"
|
| 20 |
+
action = "Recovery"
|
| 21 |
+
elif module_stolen == "Not Safe":
|
| 22 |
+
root_cause = "Availability"
|
| 23 |
+
sub_root_cause = "Module Stolen"
|
| 24 |
+
action = "Recovery"
|
| 25 |
+
elif site_dismantle == "Not Safe":
|
| 26 |
+
root_cause = "Availability"
|
| 27 |
+
sub_root_cause = "Site Dismantle"
|
| 28 |
+
action = "Percepatan Relokasi"
|
| 29 |
+
elif blacksite == "Not Safe":
|
| 30 |
+
root_cause = "Availability"
|
| 31 |
+
sub_root_cause = "Blacksite"
|
| 32 |
+
action = "Optimization"
|
| 33 |
+
elif force_majeure == "Not Safe":
|
| 34 |
+
root_cause = "Availability"
|
| 35 |
+
sub_root_cause = "Force Majeure"
|
| 36 |
+
action = "Troubleshoot"
|
| 37 |
+
else:
|
| 38 |
+
root_cause = "Availability"
|
| 39 |
+
sub_root_cause = "Availability Problem"
|
| 40 |
+
action = "Troubleshoot"
|
| 41 |
+
|
| 42 |
+
elif trans_alarm == "Not Safe":
|
| 43 |
+
root_cause = "Quality"
|
| 44 |
+
sub_root_cause = "Trans Alarm"
|
| 45 |
+
action = "Troubleshoot"
|
| 46 |
+
|
| 47 |
+
elif trans_pl == "Not Safe":
|
| 48 |
+
root_cause = "Quality"
|
| 49 |
+
sub_root_cause = "Trans Packet Loss"
|
| 50 |
+
action = "Troubleshoot"
|
| 51 |
+
|
| 52 |
+
elif trans_tnl == "Not Safe":
|
| 53 |
+
root_cause = "Quality"
|
| 54 |
+
sub_root_cause = "Trans TNL"
|
| 55 |
+
action = "Troubleshoot"
|
| 56 |
+
|
| 57 |
+
elif ul_interference == "Not Safe":
|
| 58 |
+
root_cause = "Quality"
|
| 59 |
+
sub_root_cause = "High UL Interference"
|
| 60 |
+
action = "Troubleshoot"
|
| 61 |
+
|
| 62 |
+
elif vswr == "Not Safe":
|
| 63 |
+
root_cause = "Quality"
|
| 64 |
+
sub_root_cause = "High VSWR"
|
| 65 |
+
action = "Troubleshoot"
|
| 66 |
+
|
| 67 |
+
elif rsrp < -105:
|
| 68 |
+
root_cause = "Coverage"
|
| 69 |
+
sub_root_cause = "Low Coverage"
|
| 70 |
+
action = "Optimization"
|
| 71 |
+
|
| 72 |
+
elif prb > 90:
|
| 73 |
+
if max_user > 150:
|
| 74 |
+
root_cause = "Capacity"
|
| 75 |
+
sub_root_cause = "High Max User"
|
| 76 |
+
action = "Optimization"
|
| 77 |
+
elif active_user_max > 20:
|
| 78 |
+
root_cause = "Capacity"
|
| 79 |
+
sub_root_cause = "High Active User"
|
| 80 |
+
action = "Optimization"
|
| 81 |
+
else:
|
| 82 |
+
root_cause = "Capacity"
|
| 83 |
+
sub_root_cause = "High PRB"
|
| 84 |
+
action = "Optimization"
|
| 85 |
+
|
| 86 |
+
elif ping_pong == "yes":
|
| 87 |
+
root_cause = "Quality"
|
| 88 |
+
sub_root_cause = "No Dominant Coverage"
|
| 89 |
+
action = "Optimization"
|
| 90 |
+
|
| 91 |
+
elif cssr == "Not Safe":
|
| 92 |
+
root_cause = "Quality"
|
| 93 |
+
sub_root_cause = "Performance Problem"
|
| 94 |
+
action = "Optimization"
|
| 95 |
+
|
| 96 |
+
elif profile == "Not Safe":
|
| 97 |
+
root_cause = "Quality"
|
| 98 |
+
sub_root_cause = "Profile Problem"
|
| 99 |
+
action = "Escalated to HQ"
|
| 100 |
+
|
| 101 |
+
elif simcard == "Not Safe":
|
| 102 |
+
root_cause = "Quality"
|
| 103 |
+
sub_root_cause = "Profile Problem"
|
| 104 |
+
action = "User Education"
|
| 105 |
+
|
| 106 |
+
elif ue == "Not Safe":
|
| 107 |
+
root_cause = "Quality"
|
| 108 |
+
sub_root_cause = "UE Problem"
|
| 109 |
+
action = "User Education"
|
| 110 |
+
|
| 111 |
+
elif it_problem == "Not Safe":
|
| 112 |
+
root_cause = "Quality"
|
| 113 |
+
sub_root_cause = "IT Problem"
|
| 114 |
+
action = "Escalated to HQ"
|
| 115 |
+
|
| 116 |
+
elif core == "Not Safe":
|
| 117 |
+
root_cause = "Quality"
|
| 118 |
+
sub_root_cause = "Core Problem"
|
| 119 |
+
action = "Troubleshoot"
|
| 120 |
+
|
| 121 |
+
else:
|
| 122 |
+
root_cause = "Quality"
|
| 123 |
+
sub_root_cause = "Quality (Network Normal)"
|
| 124 |
+
action = "Optimization"
|
| 125 |
+
|
| 126 |
+
return f"Root Cause: {root_cause}\nSub Root Cause: {sub_root_cause}\nAction: {action}"
|
| 127 |
+
|
| 128 |
+
with gr.Blocks() as demo:
|
| 129 |
+
gr.Markdown("## 🛠️ Network Issue Diagnoser")
|
| 130 |
+
|
| 131 |
+
with gr.Row():
|
| 132 |
+
with gr.Column():
|
| 133 |
+
availability = gr.Radio(["Safe", "Not Safe"], label="Availability", value="Safe")
|
| 134 |
+
comcase = gr.Radio(["Safe", "Not Safe"], label="Comcase", value="Safe")
|
| 135 |
+
module_stolen = gr.Radio(["Safe", "Not Safe"], label="Module Stolen", value="Safe")
|
| 136 |
+
site_dismantle = gr.Radio(["Safe", "Not Safe"], label="Site Dismantle", value="Safe")
|
| 137 |
+
blacksite = gr.Radio(["Safe", "Not Safe"], label="Blacksite", value="Safe")
|
| 138 |
+
force_majeure = gr.Radio(["Safe", "Not Safe"], label="Force Majeure", value="Safe")
|
| 139 |
+
trans_alarm = gr.Radio(["Safe", "Not Safe"], label="Trans Alarm", value="Safe")
|
| 140 |
+
trans_pl = gr.Radio(["Safe", "Not Safe"], label="Trans Packet Loss", value="Safe")
|
| 141 |
+
trans_tnl = gr.Radio(["Safe", "Not Safe"], label="Trans TNL", value="Safe")
|
| 142 |
+
ul_interference = gr.Radio(["Safe", "Not Safe"], label="UL Interference", value="Safe")
|
| 143 |
+
vswr = gr.Radio(["Safe", "Not Safe"], label="VSWR", value="Safe")
|
| 144 |
+
|
| 145 |
+
with gr.Column():
|
| 146 |
+
rsrp = gr.Textbox(label="RSRP (e.g. -90)", value="-100")
|
| 147 |
+
prb = gr.Textbox(label="PRB Usage (%)", value="80")
|
| 148 |
+
max_user = gr.Textbox(label="Max User", value="100")
|
| 149 |
+
active_user_max = gr.Textbox(label="Active User Max", value="10")
|
| 150 |
+
ping_pong = gr.Radio(["No", "Yes"], label="Ping Pong", value="No")
|
| 151 |
+
cssr = gr.Radio(["Safe", "Not Safe"], label="CSSR", value="Safe")
|
| 152 |
+
profile = gr.Radio(["Safe", "Not Safe"], label="Profile", value="Safe")
|
| 153 |
+
simcard = gr.Radio(["Safe", "Not Safe"], label="Simcard", value="Safe")
|
| 154 |
+
ue = gr.Radio(["Safe", "Not Safe"], label="UE", value="Safe")
|
| 155 |
+
it_problem = gr.Radio(["Safe", "Not Safe"], label="IT Problem", value="Safe")
|
| 156 |
+
core = gr.Radio(["Safe", "Not Safe"], label="Core", value="Safe")
|
| 157 |
+
|
| 158 |
+
submit = gr.Button("Diagnose")
|
| 159 |
+
output = gr.Textbox(label="📋 Diagnosis Result")
|
| 160 |
+
|
| 161 |
+
submit.click(
|
| 162 |
+
diagnose_network,
|
| 163 |
+
inputs=[
|
| 164 |
+
availability, comcase, module_stolen, site_dismantle, blacksite, force_majeure,
|
| 165 |
+
trans_alarm, trans_pl, trans_tnl, ul_interference, vswr,
|
| 166 |
+
rsrp, prb, max_user, active_user_max, ping_pong,
|
| 167 |
+
cssr, profile, simcard, ue, it_problem, core
|
| 168 |
+
],
|
| 169 |
+
outputs=output
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio
|