File size: 7,647 Bytes
776eb13 e01b0f6 776eb13 0aed83e 76c84b4 0aed83e 76c84b4 e01b0f6 76c84b4 e01b0f6 76c84b4 e01b0f6 776eb13 0aed83e 76c84b4 776eb13 e01b0f6 0aed83e 76c84b4 0aed83e e01b0f6 76c84b4 e01b0f6 0aed83e 76c84b4 0aed83e e01b0f6 76c84b4 e01b0f6 76c84b4 e01b0f6 0aed83e 76c84b4 0aed83e e01b0f6 76c84b4 e01b0f6 0aed83e 76c84b4 0aed83e 776eb13 e01b0f6 776eb13 e01b0f6 776eb13 0aed83e 76c84b4 0aed83e 776eb13 e01b0f6 776eb13 e01b0f6 0aed83e 76c84b4 0aed83e 76c84b4 e01b0f6 0aed83e e01b0f6 76c84b4 e01b0f6 76c84b4 e01b0f6 76c84b4 e01b0f6 76c84b4 e01b0f6 0aed83e e01b0f6 76c84b4 e01b0f6 76c84b4 e01b0f6 0aed83e e01b0f6 776eb13 0aed83e 776eb13 0aed83e 76c84b4 0aed83e 776eb13 0aed83e 76c84b4 0aed83e 76c84b4 776eb13 0aed83e 776eb13 0aed83e 76c84b4 0aed83e 76c84b4 0aed83e 76c84b4 0aed83e 76c84b4 7fa480d 76c84b4 7fa480d 0aed83e 7fa480d 76c84b4 0aed83e 76c84b4 0aed83e 76c84b4 0aed83e 76c84b4 0aed83e 76c84b4 0aed83e 76c84b4 776eb13 | 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | import gradio as gr
import re
# ============================================
# KPI Extraction
# ============================================
def extract_value(text, key):
pattern = rf"{key}\s*=\s*(-?\d+\.?\d*)"
match = re.search(pattern, text, re.IGNORECASE)
if match:
return float(match.group(1))
return None
# ============================================
# Main Analysis Logic
# ============================================
def analyze_ul_interference(vendor, data):
findings = []
causes = []
actions = []
severity = "LOW"
condition = "NORMAL"
ul_sinr = extract_value(data, "UL SINR")
rtwp = extract_value(data, "RTWP")
ul_prb = extract_value(data, "UL PRB")
dl_prb = extract_value(data, "DL PRB")
bler = extract_value(data, "PUSCH BLER")
cqi = extract_value(data, "CQI")
# ============================================
# UL SINR
# ============================================
if ul_sinr is not None:
if ul_sinr < -5:
findings.append(f"Critical UL SINR degradation ({ul_sinr} dB)")
severity = "HIGH"
elif ul_sinr < 0:
findings.append(f"Poor UL SINR detected ({ul_sinr} dB)")
severity = "MEDIUM"
# ============================================
# RTWP
# ============================================
if rtwp is not None:
if rtwp > -95:
findings.append(f"Severe RTWP elevation ({rtwp} dBm)")
severity = "HIGH"
elif rtwp > -100:
findings.append(f"Elevated RTWP/noise floor ({rtwp} dBm)")
severity = "MEDIUM"
# ============================================
# BLER
# ============================================
if bler is not None:
if bler > 30:
findings.append(f"Critical PUSCH BLER ({bler}%)")
severity = "HIGH"
elif bler > 15:
findings.append(f"Elevated PUSCH BLER ({bler}%)")
# ============================================
# CQI
# ============================================
if cqi is not None:
if cqi < 5:
findings.append(f"Low CQI detected ({cqi})")
# ============================================
# PRB
# ============================================
congestion = False
interference = False
if ul_prb is not None:
if ul_prb > 85:
findings.append(f"High UL PRB utilization ({ul_prb}%)")
congestion = True
# ============================================
# Classification Logic
# ============================================
if (
ul_sinr is not None and ul_sinr < 0 and
rtwp is not None and rtwp > -100 and
bler is not None and bler > 15
):
interference = True
# ============================================
# Interference Condition
# ============================================
if interference:
condition = "LIKELY UL INTERFERENCE"
causes = [
"External uplink interference",
"Passive Intermodulation (PIM)",
"Overshooting sector",
"Feeder or jumper degradation",
"Radio hardware impairment"
]
actions = [
"Review RTWP trend history",
"Compare neighboring sector RTWP",
"Inspect feeder and jumper path",
"Validate antenna alignment",
"Perform spectrum sweep",
"Review recent maintenance activity"
]
# ============================================
# Congestion Condition
# ============================================
elif congestion:
condition = "LIKELY CAPACITY CONGESTION"
causes = [
"High uplink traffic demand",
"Sector loading imbalance",
"Subscriber concentration",
"Limited uplink scheduling capacity"
]
actions = [
"Review busy-hour utilization",
"Evaluate load balancing",
"Assess scheduler efficiency",
"Review carrier utilization"
]
# ============================================
# Normal Condition
# ============================================
else:
condition = "NO MAJOR UL IMPAIRMENT DETECTED"
actions = [
"Continue KPI monitoring"
]
# ============================================
# Markdown Formatting
# ============================================
findings_md = "### Findings\n\n" + "\n".join(
[f"- {x}" for x in findings]
)
causes_md = "### Likely Causes\n\n" + "\n".join(
[f"- {x}" for x in causes]
)
actions_md = "### Recommended Actions\n\n" + "\n".join(
[f"- {x}" for x in actions]
)
assessment_md = """
### Engineering Assessment
Analysis completed using LTE/5G uplink KPI and PM counter thresholds.
"""
return (
condition,
severity,
vendor,
findings_md,
causes_md,
actions_md,
assessment_md
)
# ============================================
# Example Inputs
# ============================================
examples = [
[
"Ericsson",
"""UL SINR = -8
PUSCH BLER = 41
RTWP = -94
UL PRB = 72
DL PRB = 35
CQI = 3"""
],
[
"Nokia",
"""UL SINR = 4
PUSCH BLER = 5
RTWP = -108
UL PRB = 96
DL PRB = 92
CQI = 11"""
],
[
"Samsung",
"""UL SINR = -2
PUSCH BLER = 18
RTWP = -99
UL PRB = 88
DL PRB = 81
CQI = 6"""
]
]
# ============================================
# UI
# ============================================
with gr.Blocks(theme=gr.themes.Default()) as demo:
gr.Markdown("""
# UL Interference Analyzer
AI-assisted LTE and 5G uplink interference analysis using KPI and PM counter indicators.
""")
vendor = gr.Dropdown(
choices=["Ericsson", "Nokia", "Samsung"],
value="Ericsson",
label="RAN Vendor",
container=False
)
data_input = gr.Textbox(
lines=10,
label="Paste KPI / PM Counter Data"
)
analyze_btn = gr.Button(
"Analyze",
variant="primary"
)
# ============================================
# Top Status Row
# ============================================
with gr.Row():
condition_box = gr.Textbox(
label="Condition",
interactive=False
)
severity_box = gr.Textbox(
label="Severity",
interactive=False
)
vendor_box = gr.Textbox(
label="Vendor",
interactive=False
)
# ============================================
# Main Analysis Panels
# ============================================
with gr.Row():
findings_box = gr.Markdown()
causes_box = gr.Markdown()
actions_box = gr.Markdown()
assessment_box = gr.Markdown()
# ============================================
# Examples
# ============================================
gr.Examples(
examples=examples,
inputs=[vendor, data_input]
)
# ============================================
# Button Action
# ============================================
analyze_btn.click(
fn=analyze_ul_interference,
inputs=[vendor, data_input],
outputs=[
condition_box,
severity_box,
vendor_box,
findings_box,
causes_box,
actions_box,
assessment_box
]
)
demo.launch() |