|
import pandas as pd |
|
|
|
|
|
class DumpType: |
|
full_dump = False |
|
|
|
|
|
class Technology: |
|
gsm = False |
|
wcdma = False |
|
lte = False |
|
neighbors = False |
|
trx = False |
|
mrbts = False |
|
mal = False |
|
invunit = False |
|
|
|
|
|
|
|
sheets_to_check = { |
|
"gsm": ["BTS", "BCF", "TRX", "MAL"], |
|
"neighbors": ["ADCE", "ADJS", "ADJI", "ADJG", "ADJW", "BTS", "WCEL"], |
|
"wcdma": ["WCEL", "WBTS", "WNCEL"], |
|
"lte": ["LNBTS", "LNCEL", "LNCEL_FDD", "LNCEL_TDD"], |
|
"trx": ["TRX", "BTS"], |
|
"mrbts": ["MRBTS"], |
|
"mal": ["MAL", "BTS"], |
|
"invunit": ["INVUNIT"], |
|
} |
|
|
|
|
|
def load(file_path): |
|
|
|
xlsb_file = pd.ExcelFile(file_path, engine="calamine") |
|
|
|
|
|
available_sheets = xlsb_file.sheet_names |
|
return available_sheets |
|
|
|
|
|
def check_sheets(technology_attr, sheet_list, file_path): |
|
""" |
|
Check if all sheets in the given sheet_list exist in the Excel file. |
|
|
|
Parameters |
|
---------- |
|
technology_attr : str |
|
The attribute of the Technology class to set. |
|
sheet_list : list[str] |
|
The list of sheet names to check. |
|
|
|
Returns |
|
------- |
|
None |
|
""" |
|
available_sheets = load(file_path) |
|
missing_sheets = [sheet for sheet in sheet_list if sheet not in available_sheets] |
|
available_sheets_in_list = [ |
|
sheet for sheet in sheet_list if sheet in available_sheets |
|
] |
|
if not missing_sheets: |
|
setattr(Technology, technology_attr, True) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def execute_checks_sheets_exist(file_path): |
|
Technology.gsm = False |
|
Technology.wcdma = False |
|
Technology.lte = False |
|
Technology.neighbors = False |
|
Technology.trx = False |
|
Technology.mrbts = False |
|
Technology.invunit = False |
|
Technology.mal = False |
|
DumpType.full_dump = False |
|
for tech_attr, sheets in sheets_to_check.items(): |
|
check_sheets(tech_attr, sheets, file_path) |
|
|
|
|
|
|
|
|
|
|
|
|