Adding MRBTS and MAL. Compare MAL vs TCH ins BTS
Browse files- README.md +2 -0
- apps/database_page.py +26 -5
- queries/process_all_db.py +8 -3
- queries/process_gsm.py +18 -1
- queries/process_mal.py +86 -0
- queries/process_mrbts.py +41 -0
- queries/process_small_bts.py +18 -0
- queries/process_trx.py +18 -16
- utils/check_sheet_exist.py +5 -1
- utils/utils_vars.py +3 -1
README.md
CHANGED
@@ -41,6 +41,8 @@ You can access the hosted version of the app at [https://davmelchi-db-query.hf.s
|
|
41 |
- [x] Add Core dump checking App
|
42 |
- [x] Add site config band in database
|
43 |
- [x] Add TRX database
|
|
|
|
|
44 |
- [ ] Add dashboards for each database (Count of NE)
|
45 |
- [ ] Add the ability to select columns
|
46 |
- [ ] Error handling
|
|
|
41 |
- [x] Add Core dump checking App
|
42 |
- [x] Add site config band in database
|
43 |
- [x] Add TRX database
|
44 |
+
- [x] Add MRBTS with code
|
45 |
+
- [x] Check TCH from MAL sheet
|
46 |
- [ ] Add dashboards for each database (Count of NE)
|
47 |
- [ ] Add the ability to select columns
|
48 |
- [ ] Error handling
|
apps/database_page.py
CHANGED
@@ -6,10 +6,9 @@ import streamlit as st
|
|
6 |
from queries.process_all_db import process_all_tech_db
|
7 |
from queries.process_gsm import process_gsm_data_to_excel
|
8 |
from queries.process_lte import process_lte_data_to_excel
|
9 |
-
from queries.
|
10 |
-
|
11 |
-
|
12 |
-
)
|
13 |
from queries.process_trx import process_trx_with_bts_name_data_to_excel
|
14 |
from queries.process_wcdma import process_wcdma_data_to_excel
|
15 |
from utils.check_sheet_exist import Technology, execute_checks_sheets_exist
|
@@ -50,6 +49,12 @@ def download_button(database_type):
|
|
50 |
elif database_type == "TRX":
|
51 |
data = UtilsVars.final_trx_database
|
52 |
file_name = f"TRX database_{datetime.now()}.xlsx"
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
st.download_button(
|
54 |
type="primary",
|
55 |
label=f"Download {database_type} Database File",
|
@@ -82,15 +87,17 @@ if uploaded_file is not None:
|
|
82 |
and Technology.lte == False
|
83 |
and Technology.neighbors == False
|
84 |
and Technology.trx == False
|
|
|
85 |
):
|
86 |
st.error(
|
87 |
"""
|
88 |
Uploaded file does not contain required sheets for any technology.
|
89 |
-
"gsm": ["BTS", "BCF", "TRX"],
|
90 |
"wcdma": ["WCEL", "WBTS", "WNCEL"],
|
91 |
"lte": ["LNBTS", "LNCEL", "LNCEL_FDD", "LNCEL_TDD"],
|
92 |
"neighbors": ["ADCE", "ADJS", "ADJI", "ADJG", "ADJW", "BTS", "WCEL"],
|
93 |
"trx": ["TRX", "BTS"],
|
|
|
94 |
"""
|
95 |
)
|
96 |
|
@@ -137,6 +144,20 @@ if uploaded_file is not None:
|
|
137 |
process_trx_with_bts_name_data_to_excel, "TRX"
|
138 |
),
|
139 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
except Exception as e:
|
142 |
st.error(f"Error: {e}")
|
|
|
6 |
from queries.process_all_db import process_all_tech_db
|
7 |
from queries.process_gsm import process_gsm_data_to_excel
|
8 |
from queries.process_lte import process_lte_data_to_excel
|
9 |
+
from queries.process_mal import process_mal_data_to_excel
|
10 |
+
from queries.process_mrbts import process_mrbts_data_to_excel
|
11 |
+
from queries.process_neighbors import process_neighbors_data_to_excel
|
|
|
12 |
from queries.process_trx import process_trx_with_bts_name_data_to_excel
|
13 |
from queries.process_wcdma import process_wcdma_data_to_excel
|
14 |
from utils.check_sheet_exist import Technology, execute_checks_sheets_exist
|
|
|
49 |
elif database_type == "TRX":
|
50 |
data = UtilsVars.final_trx_database
|
51 |
file_name = f"TRX database_{datetime.now()}.xlsx"
|
52 |
+
elif database_type == "MRBTS":
|
53 |
+
data = UtilsVars.final_mrbts_database
|
54 |
+
file_name = f"MRBTS database_{datetime.now()}.xlsx"
|
55 |
+
elif database_type == "MAL":
|
56 |
+
data = UtilsVars.final_mal_database
|
57 |
+
file_name = f"MAL database_{datetime.now()}.xlsx"
|
58 |
st.download_button(
|
59 |
type="primary",
|
60 |
label=f"Download {database_type} Database File",
|
|
|
87 |
and Technology.lte == False
|
88 |
and Technology.neighbors == False
|
89 |
and Technology.trx == False
|
90 |
+
and Technology.mrbts == False
|
91 |
):
|
92 |
st.error(
|
93 |
"""
|
94 |
Uploaded file does not contain required sheets for any technology.
|
95 |
+
"gsm": ["BTS", "BCF", "TRX","MAL"],
|
96 |
"wcdma": ["WCEL", "WBTS", "WNCEL"],
|
97 |
"lte": ["LNBTS", "LNCEL", "LNCEL_FDD", "LNCEL_TDD"],
|
98 |
"neighbors": ["ADCE", "ADJS", "ADJI", "ADJG", "ADJW", "BTS", "WCEL"],
|
99 |
"trx": ["TRX", "BTS"],
|
100 |
+
"mrbts": ["MRBTS"],
|
101 |
"""
|
102 |
)
|
103 |
|
|
|
144 |
process_trx_with_bts_name_data_to_excel, "TRX"
|
145 |
),
|
146 |
)
|
147 |
+
if Technology.mrbts == True:
|
148 |
+
with col7:
|
149 |
+
st.button(
|
150 |
+
"Generate MRBTS",
|
151 |
+
on_click=lambda: process_database(
|
152 |
+
process_mrbts_data_to_excel, "MRBTS"
|
153 |
+
),
|
154 |
+
)
|
155 |
|
156 |
+
if Technology.mal == True:
|
157 |
+
with col8:
|
158 |
+
st.button(
|
159 |
+
"Generate MAL",
|
160 |
+
on_click=lambda: process_database(process_mal_data_to_excel, "MAL"),
|
161 |
+
)
|
162 |
except Exception as e:
|
163 |
st.error(f"Error: {e}")
|
queries/process_all_db.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
from queries.process_gsm import process_gsm_data
|
2 |
from queries.process_lte import process_lte_data
|
3 |
-
from queries.
|
|
|
|
|
4 |
from queries.process_wcdma import process_wcdma_data
|
5 |
from utils.convert_to_excel import convert_dfs
|
6 |
from utils.utils_vars import UtilsVars
|
@@ -11,8 +13,11 @@ def process_all_tech_db(filepath: str):
|
|
11 |
process_gsm_data(filepath)
|
12 |
process_wcdma_data(filepath)
|
13 |
process_lte_data(filepath)
|
14 |
-
|
|
|
|
|
15 |
|
16 |
UtilsVars.final_all_database = convert_dfs(
|
17 |
-
UtilsVars.all_db_dfs,
|
|
|
18 |
)
|
|
|
1 |
from queries.process_gsm import process_gsm_data
|
2 |
from queries.process_lte import process_lte_data
|
3 |
+
from queries.process_mal import process_mal_with_bts_name
|
4 |
+
from queries.process_mrbts import process_mrbts_data
|
5 |
+
from queries.process_trx import process_trx_with_bts_name
|
6 |
from queries.process_wcdma import process_wcdma_data
|
7 |
from utils.convert_to_excel import convert_dfs
|
8 |
from utils.utils_vars import UtilsVars
|
|
|
13 |
process_gsm_data(filepath)
|
14 |
process_wcdma_data(filepath)
|
15 |
process_lte_data(filepath)
|
16 |
+
process_trx_with_bts_name(filepath)
|
17 |
+
process_mrbts_data(filepath)
|
18 |
+
process_mal_with_bts_name(filepath)
|
19 |
|
20 |
UtilsVars.final_all_database = convert_dfs(
|
21 |
+
UtilsVars.all_db_dfs,
|
22 |
+
["GSM", "WCDMA", "LTE_FDD", "LTE_TDD", "TRX", "MRBTS", "MAL"],
|
23 |
)
|
queries/process_gsm.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import pandas as pd
|
2 |
|
|
|
3 |
from queries.process_trx import process_trx_data
|
4 |
from utils.config_band import config_band
|
5 |
from utils.convert_to_excel import convert_dfs, save_dataframe
|
@@ -8,6 +9,7 @@ from utils.utils_vars import UtilsVars
|
|
8 |
BTS_COLUMNS = [
|
9 |
"ID_BCF",
|
10 |
"ID_BTS",
|
|
|
11 |
"BSC",
|
12 |
"BCF",
|
13 |
"BTS",
|
@@ -54,6 +56,13 @@ BCF_COLUMNS = [
|
|
54 |
]
|
55 |
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
def process_gsm_data(file_path: str):
|
58 |
"""
|
59 |
Process data from the specified file path.
|
@@ -75,6 +84,7 @@ def process_gsm_data(file_path: str):
|
|
75 |
df_bts["code"] = df_bts["name"].str.split("_").str[0].astype(int)
|
76 |
df_bts["Region"] = df_bts["name"].str.split("_").str[1]
|
77 |
df_bts["ID_BTS"] = df_bts[["BSC", "BCF", "BTS"]].astype(str).apply("_".join, axis=1)
|
|
|
78 |
df_bts["BSIC"] = (
|
79 |
df_bts[["bsIdentityCodeNCC", "bsIdentityCodeBCC"]]
|
80 |
.astype(str)
|
@@ -117,13 +127,20 @@ def process_gsm_data(file_path: str):
|
|
117 |
# Process TRX data
|
118 |
df_trx = process_trx_data(file_path)
|
119 |
|
|
|
|
|
|
|
120 |
# create band dataframe
|
121 |
df_band = config_band(df_bts)
|
122 |
|
123 |
# Merge dataframes
|
124 |
-
df_bts_bcf = pd.merge(
|
125 |
df_2g = pd.merge(df_bts_bcf, df_trx, on="ID_BTS", how="left")
|
126 |
df_2g = pd.merge(df_2g, df_band, on="code", how="left")
|
|
|
|
|
|
|
|
|
127 |
|
128 |
df_physical_db = UtilsVars.physisal_db
|
129 |
df_2g = pd.merge(df_2g, df_physical_db, on="Code_Sector", how="left")
|
|
|
1 |
import pandas as pd
|
2 |
|
3 |
+
from queries.process_mal import process_mal_data
|
4 |
from queries.process_trx import process_trx_data
|
5 |
from utils.config_band import config_band
|
6 |
from utils.convert_to_excel import convert_dfs, save_dataframe
|
|
|
9 |
BTS_COLUMNS = [
|
10 |
"ID_BCF",
|
11 |
"ID_BTS",
|
12 |
+
"ID_MAL",
|
13 |
"BSC",
|
14 |
"BCF",
|
15 |
"BTS",
|
|
|
56 |
]
|
57 |
|
58 |
|
59 |
+
def compare_trx_tch_versus_mal(tch1, tch2):
|
60 |
+
# Split the strings by commas, convert to sets, and compare
|
61 |
+
set1 = set(str(tch1).split(",")) if isinstance(tch1, str) else set()
|
62 |
+
set2 = set(str(tch2).split(",")) if isinstance(tch2, str) else set()
|
63 |
+
return set1 == set2
|
64 |
+
|
65 |
+
|
66 |
def process_gsm_data(file_path: str):
|
67 |
"""
|
68 |
Process data from the specified file path.
|
|
|
84 |
df_bts["code"] = df_bts["name"].str.split("_").str[0].astype(int)
|
85 |
df_bts["Region"] = df_bts["name"].str.split("_").str[1]
|
86 |
df_bts["ID_BTS"] = df_bts[["BSC", "BCF", "BTS"]].astype(str).apply("_".join, axis=1)
|
87 |
+
df_bts["ID_MAL"] = df_bts[["BSC", "BTS"]].astype(str).apply("_".join, axis=1)
|
88 |
df_bts["BSIC"] = (
|
89 |
df_bts[["bsIdentityCodeNCC", "bsIdentityCodeBCC"]]
|
90 |
.astype(str)
|
|
|
127 |
# Process TRX data
|
128 |
df_trx = process_trx_data(file_path)
|
129 |
|
130 |
+
# Process MAL data
|
131 |
+
df_mal = process_mal_data(file_path)
|
132 |
+
|
133 |
# create band dataframe
|
134 |
df_band = config_band(df_bts)
|
135 |
|
136 |
# Merge dataframes
|
137 |
+
df_bts_bcf = pd.merge(df_bcf, df_bts, on="ID_BCF", how="left")
|
138 |
df_2g = pd.merge(df_bts_bcf, df_trx, on="ID_BTS", how="left")
|
139 |
df_2g = pd.merge(df_2g, df_band, on="code", how="left")
|
140 |
+
df_2g = pd.merge(df_2g, df_mal, on="ID_MAL", how="left")
|
141 |
+
df_2g["TRX_TCH_VS_MAL"] = df_2g.apply(
|
142 |
+
lambda row: compare_trx_tch_versus_mal(row["TRX_TCH"], row["MAL_TCH"]), axis=1
|
143 |
+
)
|
144 |
|
145 |
df_physical_db = UtilsVars.physisal_db
|
146 |
df_2g = pd.merge(df_2g, df_physical_db, on="Code_Sector", how="left")
|
queries/process_mal.py
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
|
3 |
+
from queries.process_small_bts import process_small_bts_data
|
4 |
+
from utils.convert_to_excel import convert_dfs
|
5 |
+
from utils.utils_vars import UtilsVars
|
6 |
+
|
7 |
+
MAL_COLUMNS = [
|
8 |
+
"ID_MAL",
|
9 |
+
"MAL_TCH",
|
10 |
+
"number_mal_tch",
|
11 |
+
]
|
12 |
+
|
13 |
+
|
14 |
+
MAL_BTS_COLUMNS = [
|
15 |
+
"ID_MAL",
|
16 |
+
"code",
|
17 |
+
"name",
|
18 |
+
"MAL_TCH",
|
19 |
+
"number_mal_tch",
|
20 |
+
]
|
21 |
+
|
22 |
+
|
23 |
+
def process_mal_data(file_path: str):
|
24 |
+
"""
|
25 |
+
Process data from the specified file path.
|
26 |
+
|
27 |
+
Args:
|
28 |
+
file_path (str): The path to the file.
|
29 |
+
"""
|
30 |
+
# Read the specific sheet into a DataFrame
|
31 |
+
df_mal = pd.read_excel(
|
32 |
+
file_path,
|
33 |
+
sheet_name="MAL",
|
34 |
+
engine="calamine",
|
35 |
+
skiprows=[0],
|
36 |
+
)
|
37 |
+
|
38 |
+
df_mal.columns = df_mal.columns.str.replace(r"[ ]", "", regex=True)
|
39 |
+
|
40 |
+
df_mal["ID_MAL"] = df_mal[["BSC", "MAL"]].astype(str).apply("_".join, axis=1)
|
41 |
+
|
42 |
+
df_mal["frequency"] = df_mal["frequency"].str.replace("List;", "")
|
43 |
+
df_mal["MAL_TCH"] = df_mal["frequency"].str.replace(";", ",")
|
44 |
+
df_mal["number_mal_tch"] = df_mal["MAL_TCH"].apply(
|
45 |
+
lambda x: len(str(x).split(",")) if isinstance(x, str) else 0
|
46 |
+
)
|
47 |
+
|
48 |
+
df_mal = df_mal[MAL_COLUMNS]
|
49 |
+
|
50 |
+
# UtilsVars.all_db_dfs.append(df_mal)
|
51 |
+
# save_dataframe(df_mal, "MAL")
|
52 |
+
return df_mal
|
53 |
+
|
54 |
+
|
55 |
+
def process_mal_with_bts_name(file_path: str):
|
56 |
+
"""
|
57 |
+
Process data from the specified file path and merge it with the BTS data to get
|
58 |
+
the BTS name associated with each MAL.
|
59 |
+
|
60 |
+
Args:
|
61 |
+
file_path (str): The path to the file.
|
62 |
+
|
63 |
+
Returns:
|
64 |
+
pd.DataFrame: A DataFrame with the MAL data and the BTS name associated with
|
65 |
+
each MAL.
|
66 |
+
"""
|
67 |
+
mal_df = process_mal_data(file_path=file_path)
|
68 |
+
df_bts = process_small_bts_data(file_path=file_path)
|
69 |
+
|
70 |
+
df_mal_bts_name = pd.merge(mal_df, df_bts, on="ID_MAL", how="left")
|
71 |
+
df_mal_bts_name = df_mal_bts_name[MAL_BTS_COLUMNS]
|
72 |
+
|
73 |
+
UtilsVars.all_db_dfs.append(df_mal_bts_name)
|
74 |
+
return df_mal_bts_name
|
75 |
+
|
76 |
+
|
77 |
+
def process_mal_data_to_excel(file_path: str):
|
78 |
+
"""
|
79 |
+
Process data from the specified file path and save it to a excel file.
|
80 |
+
|
81 |
+
Args:
|
82 |
+
file_path (str): The path to the file.
|
83 |
+
"""
|
84 |
+
mal_df = process_mal_with_bts_name(file_path)
|
85 |
+
|
86 |
+
UtilsVars.final_mal_database = convert_dfs([mal_df], ["MAL"])
|
queries/process_mrbts.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
|
3 |
+
from utils.convert_to_excel import convert_dfs
|
4 |
+
from utils.extract_code import extract_code_from_mrbts
|
5 |
+
from utils.utils_vars import UtilsVars
|
6 |
+
|
7 |
+
|
8 |
+
def process_mrbts_data(file_path: str) -> pd.DataFrame:
|
9 |
+
"""
|
10 |
+
Process data from the specified file path.
|
11 |
+
|
12 |
+
Args:
|
13 |
+
file_path (str): The path to the file.
|
14 |
+
"""
|
15 |
+
dfs = pd.read_excel(
|
16 |
+
file_path,
|
17 |
+
sheet_name=["MRBTS"],
|
18 |
+
engine="calamine",
|
19 |
+
skiprows=[0],
|
20 |
+
)
|
21 |
+
|
22 |
+
df_mrbts = dfs["MRBTS"]
|
23 |
+
df_mrbts.columns = df_mrbts.columns.str.replace(r"[ ]", "", regex=True)
|
24 |
+
|
25 |
+
df_mrbts = df_mrbts[df_mrbts["MRBTS"].apply(lambda x: str(x).isnumeric())]
|
26 |
+
df_mrbts["CODE"] = df_mrbts["MRBTS"].apply(extract_code_from_mrbts)
|
27 |
+
df_mrbts = df_mrbts[["MRBTS", "CODE", "name", "btsName"]]
|
28 |
+
|
29 |
+
UtilsVars.all_db_dfs.append(df_mrbts)
|
30 |
+
return df_mrbts
|
31 |
+
|
32 |
+
|
33 |
+
def process_mrbts_data_to_excel(file_path: str) -> None:
|
34 |
+
"""
|
35 |
+
Process data from the specified file path and save it to a excel file.
|
36 |
+
|
37 |
+
Args:
|
38 |
+
file_path (str): The path to the file.
|
39 |
+
"""
|
40 |
+
mrbts_df = process_mrbts_data(file_path)
|
41 |
+
UtilsVars.final_mrbts_database = convert_dfs([mrbts_df], ["MRBTS"])
|
queries/process_small_bts.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
|
3 |
+
|
4 |
+
def process_small_bts_data(file_path: str):
|
5 |
+
dfs = pd.read_excel(
|
6 |
+
file_path,
|
7 |
+
sheet_name=["BTS"],
|
8 |
+
engine="calamine",
|
9 |
+
skiprows=[0],
|
10 |
+
)
|
11 |
+
df_bts = dfs["BTS"]
|
12 |
+
df_bts.columns = df_bts.columns.str.replace(r"[ ]", "", regex=True)
|
13 |
+
df_bts["code"] = df_bts["name"].str.split("_").str[0].astype(int)
|
14 |
+
df_bts["ID_BTS"] = df_bts[["BSC", "BCF", "BTS"]].astype(str).apply("_".join, axis=1)
|
15 |
+
df_bts["ID_MAL"] = df_bts[["BSC", "BTS"]].astype(str).apply("_".join, axis=1)
|
16 |
+
df_bts = df_bts[["ID_BTS", "ID_MAL", "code", "name"]]
|
17 |
+
|
18 |
+
return df_bts
|
queries/process_trx.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import pandas as pd
|
2 |
|
|
|
3 |
from utils.convert_to_excel import convert_dfs, save_dataframe
|
4 |
from utils.utils_vars import UtilsVars
|
5 |
|
@@ -7,7 +8,7 @@ TRX_COLUMNS = [
|
|
7 |
"ID_BTS",
|
8 |
"trxRfPower",
|
9 |
"BCCH",
|
10 |
-
"
|
11 |
"number_trx_per_cell",
|
12 |
"number_trx_per_site",
|
13 |
]
|
@@ -98,13 +99,13 @@ def process_trx_data(file_path: str):
|
|
98 |
tch = tch.pivot_table(
|
99 |
index="ID_BTS",
|
100 |
values="initialFrequency",
|
101 |
-
aggfunc=lambda x: "
|
102 |
)
|
103 |
|
104 |
tch = tch.reset_index()
|
105 |
|
106 |
# rename the columns
|
107 |
-
tch.columns = ["ID_BTS", "
|
108 |
|
109 |
df_gsm_trx = pd.merge(bcch, tch, on="ID_BTS", how="left")
|
110 |
# rename "initialFrequency" to "BCCH"
|
@@ -114,23 +115,24 @@ def process_trx_data(file_path: str):
|
|
114 |
return df_gsm_trx
|
115 |
|
116 |
|
117 |
-
def
|
118 |
|
119 |
df_gsm_trx = process_brute_trx_data(file_path=file_path).copy()
|
120 |
df_gsm_trx.drop(["name"], axis=1, inplace=True)
|
121 |
|
122 |
# Process TRX data
|
123 |
-
dfs = pd.read_excel(
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
)
|
129 |
-
df_bts = dfs["BTS"]
|
130 |
-
df_bts
|
131 |
-
df_bts
|
132 |
-
df_bts["
|
133 |
-
df_bts = df_bts[["
|
|
|
134 |
|
135 |
df_trx_bts_name = pd.merge(df_gsm_trx, df_bts, on="ID_BTS", how="left")
|
136 |
df_trx_bts_name = df_trx_bts_name[TRX_BTS_COLUMNS]
|
@@ -147,5 +149,5 @@ def process_trx_with_bts_name_data_to_excel(file_path: str):
|
|
147 |
Args:
|
148 |
file_path (str): The path to the file.
|
149 |
"""
|
150 |
-
trx_bts_name =
|
151 |
UtilsVars.final_trx_database = convert_dfs([trx_bts_name], ["TRX"])
|
|
|
1 |
import pandas as pd
|
2 |
|
3 |
+
from queries.process_small_bts import process_small_bts_data
|
4 |
from utils.convert_to_excel import convert_dfs, save_dataframe
|
5 |
from utils.utils_vars import UtilsVars
|
6 |
|
|
|
8 |
"ID_BTS",
|
9 |
"trxRfPower",
|
10 |
"BCCH",
|
11 |
+
"TRX_TCH",
|
12 |
"number_trx_per_cell",
|
13 |
"number_trx_per_site",
|
14 |
]
|
|
|
99 |
tch = tch.pivot_table(
|
100 |
index="ID_BTS",
|
101 |
values="initialFrequency",
|
102 |
+
aggfunc=lambda x: ",".join(map(str, x)),
|
103 |
)
|
104 |
|
105 |
tch = tch.reset_index()
|
106 |
|
107 |
# rename the columns
|
108 |
+
tch.columns = ["ID_BTS", "TRX_TCH"]
|
109 |
|
110 |
df_gsm_trx = pd.merge(bcch, tch, on="ID_BTS", how="left")
|
111 |
# rename "initialFrequency" to "BCCH"
|
|
|
115 |
return df_gsm_trx
|
116 |
|
117 |
|
118 |
+
def process_trx_with_bts_name(file_path: str):
|
119 |
|
120 |
df_gsm_trx = process_brute_trx_data(file_path=file_path).copy()
|
121 |
df_gsm_trx.drop(["name"], axis=1, inplace=True)
|
122 |
|
123 |
# Process TRX data
|
124 |
+
# dfs = pd.read_excel(
|
125 |
+
# file_path,
|
126 |
+
# sheet_name=["BTS"],
|
127 |
+
# engine="calamine",
|
128 |
+
# skiprows=[0],
|
129 |
+
# )
|
130 |
+
# df_bts = dfs["BTS"]
|
131 |
+
df_bts = process_small_bts_data(file_path=file_path)
|
132 |
+
# df_bts.columns = df_bts.columns.str.replace(r"[ ]", "", regex=True)
|
133 |
+
# df_bts["code"] = df_bts["name"].str.split("_").str[0].astype(int)
|
134 |
+
# df_bts["ID_BTS"] = df_bts[["BSC", "BCF", "BTS"]].astype(str).apply("_".join, axis=1)
|
135 |
+
# df_bts = df_bts[["ID_BTS", "code", "name"]]
|
136 |
|
137 |
df_trx_bts_name = pd.merge(df_gsm_trx, df_bts, on="ID_BTS", how="left")
|
138 |
df_trx_bts_name = df_trx_bts_name[TRX_BTS_COLUMNS]
|
|
|
149 |
Args:
|
150 |
file_path (str): The path to the file.
|
151 |
"""
|
152 |
+
trx_bts_name = process_trx_with_bts_name(file_path)
|
153 |
UtilsVars.final_trx_database = convert_dfs([trx_bts_name], ["TRX"])
|
utils/check_sheet_exist.py
CHANGED
@@ -7,15 +7,19 @@ class Technology:
|
|
7 |
lte = False
|
8 |
neighbors = False
|
9 |
trx = False
|
|
|
|
|
10 |
|
11 |
|
12 |
# Dictionary of sheet groups to check
|
13 |
sheets_to_check = {
|
14 |
-
"gsm": ["BTS", "BCF", "TRX"],
|
15 |
"neighbors": ["ADCE", "ADJS", "ADJI", "ADJG", "ADJW", "BTS", "WCEL"],
|
16 |
"wcdma": ["WCEL", "WBTS", "WNCEL"],
|
17 |
"lte": ["LNBTS", "LNCEL", "LNCEL_FDD", "LNCEL_TDD"],
|
18 |
"trx": ["TRX", "BTS"],
|
|
|
|
|
19 |
}
|
20 |
|
21 |
|
|
|
7 |
lte = False
|
8 |
neighbors = False
|
9 |
trx = False
|
10 |
+
mrbts = False
|
11 |
+
mal = False
|
12 |
|
13 |
|
14 |
# Dictionary of sheet groups to check
|
15 |
sheets_to_check = {
|
16 |
+
"gsm": ["BTS", "BCF", "TRX", "MAL"],
|
17 |
"neighbors": ["ADCE", "ADJS", "ADJI", "ADJG", "ADJW", "BTS", "WCEL"],
|
18 |
"wcdma": ["WCEL", "WBTS", "WNCEL"],
|
19 |
"lte": ["LNBTS", "LNCEL", "LNCEL_FDD", "LNCEL_TDD"],
|
20 |
"trx": ["TRX", "BTS"],
|
21 |
+
"mrbts": ["MRBTS"],
|
22 |
+
"mal": ["MAL", "BTS"],
|
23 |
}
|
24 |
|
25 |
|
utils/utils_vars.py
CHANGED
@@ -22,7 +22,7 @@ class UtilsVars:
|
|
22 |
oml_band_frequence = {1: "OML BAND GSM 1800", 0: "OML BAND GSM 900"}
|
23 |
gsm_band = {1: "G1800", 0: "G900"}
|
24 |
configuration_schema = {1: "EGPRS 1800", 0: "EGPRS 900"}
|
25 |
-
channeltype_mapping = {4: "BCCH", 3: "
|
26 |
porteuse_mapping = {
|
27 |
3004: "OML UTRA Band VIII",
|
28 |
3006: "OML UTRA Band VIII",
|
@@ -41,6 +41,8 @@ class UtilsVars:
|
|
41 |
final_gsm_database = ""
|
42 |
final_wcdma_database = ""
|
43 |
final_trx_database = ""
|
|
|
|
|
44 |
all_db_dfs = []
|
45 |
final_all_database = ""
|
46 |
neighbors_database = ""
|
|
|
22 |
oml_band_frequence = {1: "OML BAND GSM 1800", 0: "OML BAND GSM 900"}
|
23 |
gsm_band = {1: "G1800", 0: "G900"}
|
24 |
configuration_schema = {1: "EGPRS 1800", 0: "EGPRS 900"}
|
25 |
+
channeltype_mapping = {4: "BCCH", 3: "TRX_TCH"}
|
26 |
porteuse_mapping = {
|
27 |
3004: "OML UTRA Band VIII",
|
28 |
3006: "OML UTRA Band VIII",
|
|
|
41 |
final_gsm_database = ""
|
42 |
final_wcdma_database = ""
|
43 |
final_trx_database = ""
|
44 |
+
final_mrbts_database = ""
|
45 |
+
final_mal_database = ""
|
46 |
all_db_dfs = []
|
47 |
final_all_database = ""
|
48 |
neighbors_database = ""
|