File size: 1,857 Bytes
57fe85f
 
 
fbf7879
 
 
 
57fe85f
 
 
 
263b2ce
56d8047
bb3e08f
 
57fe85f
 
 
 
bb3e08f
263b2ce
57fe85f
 
56d8047
bb3e08f
 
57fe85f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86110dd
 
 
 
 
57fe85f
 
 
 
 
 
 
 
 
 
 
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
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


# Dictionary of sheet groups to check
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"],
}


def load(file_path):
    # Load the Excel file
    xlsb_file = pd.ExcelFile(file_path, engine="calamine")

    # Get all sheet names in the file
    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]
    if not missing_sheets:
        setattr(Technology, technology_attr, True)
    #     print(getattr(Technology, technology_attr))
    #     print("All sheets exist")
    # else:
    #     print(f"Missing sheets: {missing_sheets}")
    #     print(getattr(Technology, technology_attr))


# Check each technology's sheets
def execute_checks_sheets_exist(file_path):
    for tech_attr, sheets in sheets_to_check.items():
        check_sheets(tech_attr, sheets, file_path)


# execute_checks(
#     r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\AOUT\20240822_7837_22082024_Dump.xml.gz.xlsb"
# )