DavMelchi commited on
Commit
b9d0cf5
·
0 Parent(s):

initial commit

Browse files
.github/workflows/sync-hf.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync to Hugging Face hub
2
+ on:
3
+ push:
4
+ branches: [main]
5
+
6
+ # to run this workflow manually from the Actions tab
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ sync-to-hub:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ with:
15
+ fetch-depth: 0
16
+ lfs: true
17
+ - name: Push to hub
18
+ env:
19
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
20
+ run: git push --force https://giswqs:[email protected]/spaces/giswqs/solara-geospatial main
.gitignore ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .vscode
124
+ .env
125
+ .venv
126
+ env/
127
+ venv/
128
+ ENV/
129
+ env.bak/
130
+ venv.bak/
131
+
132
+ # Spyder project settings
133
+ .spyderproject
134
+ .spyproject
135
+
136
+ # Rope project settings
137
+ .ropeproject
138
+
139
+ # mkdocs documentation
140
+ /site
141
+ .history/
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ #.idea/
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM jupyter/base-notebook:latest
2
+
3
+ RUN mamba install -c conda-forge geopandas localtileserver -y && \
4
+ fix-permissions "${CONDA_DIR}" && \
5
+ fix-permissions "/home/${NB_USER}"
6
+
7
+ COPY requirements.txt .
8
+ RUN pip install -r requirements.txt
9
+
10
+ ENV PROJ_LIB='/opt/conda/share/proj'
11
+
12
+ USER root
13
+ RUN chown -R ${NB_UID} ${HOME}
14
+ USER ${NB_USER}
15
+
16
+ EXPOSE 8765
17
+
18
+ CMD ["solara", "run", "main.py", "--host=0.0.0.0"]
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 DavMelchi NPO Solutions
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: NPO Tools
3
+ emoji: 🌍
4
+ colorFrom: green
5
+ colorTo: red
6
+ sdk: solara
7
+ pinned: false
8
+ license: mit
9
+ app_port: 8765
10
+ ---
11
+
12
+ ## NPO Tools
13
+
14
+ Apps for generating 2G, 3G, and LTE databases from an Excel dump file. The app reads the dump file and processes the data. The data is then saved to an Excel file. The Excel file is then downloaded.
15
+
16
+ ## How to use
17
+
18
+ 1. Run the app by executing `streamlit run app.py` in the terminal.
19
+ 2. Upload the dump file to the app.
20
+ 3. Click the buttons to generate the databases.
21
+ 4. Download the databases.
22
+
23
+ ## How it works
24
+
25
+ The app reads the dump file and processes the data. The data is then saved to an excel file. The excel file is then downloaded.
26
+
27
+ ## Why
28
+
29
+ The app is a simple way to generate the databases from the dump file. It saves time and effort.
30
+
31
+ ## Hosted Version
32
+
33
+ You can access the hosted version of the app at [https://davmelchi-db-query.hf.space/](https://davmelchi-db-query.hf.space/).
34
+
35
+ ## TODO
36
+
37
+ - [x] check if required sheets exist in the dump file
38
+ - [x] Add a download button for all databases
39
+ - [x] Add option to download Neighbors database
40
+ - [x] Add page to update physical db
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
+ - [x] Add Analitic dashboards for each database (Count of NE)
47
+ - [ ] Improve Dashboard
48
+ - [ ] Add the ability to select columns
49
+ - [ ] Error handling
50
+
main.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import solara
2
+
3
+ from pages.core_dump import core_dump_process
4
+ from pages.line_v import line_v
5
+ from utils.utils import SharedSidebar
6
+
7
+
8
+ @solara.component
9
+ def line():
10
+ with solara.Sidebar():
11
+ SharedSidebar()
12
+ line_v()
13
+
14
+
15
+ @solara.component
16
+ def core_dump():
17
+ # with solara.Sidebar():
18
+ # SharedSidebar()
19
+ core_dump_process()
20
+
21
+
22
+ routes = [
23
+ solara.Route(path="/", component=core_dump, label="Core Dump"),
24
+ solara.Route(path="line_v", component=line, label="Line_v"),
25
+ ]
pages/core_dump.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import solara
2
+
3
+ from processing.process_core_dump import dfs, parse_content
4
+ from utils.custom_grid import AgGrid
5
+ from utils.file_drop_utils import FileDropMultiple
6
+
7
+
8
+ @solara.component
9
+ def SharedSidebar():
10
+ with solara.Card("Dump Core parsing", style={"max-width": "500px"}):
11
+ solara.Markdown(
12
+ f"""
13
+ ### Used this tools to parse core dump.
14
+ *Drop the core dump files in .txt format to see the results*
15
+ """
16
+ )
17
+ with solara.Card(style={"max-width": "500px"}):
18
+ FileDropMultiple(parse_content=parse_content)
19
+
20
+
21
+ @solara.component
22
+ def core_dump_process():
23
+
24
+ with solara.Column() as main:
25
+ with solara.Sidebar():
26
+ SharedSidebar()
27
+ with solara.Card(title="Dump Core Parsed Results"):
28
+ if dfs.gsm_core_infos.value is not None:
29
+ with solara.Card(title="GSM Core Infos"):
30
+ solara.CrossFilterSelect(dfs.gsm_core_infos.value, "LA cell name")
31
+ solara.CrossFilterSlider(dfs.gsm_core_infos.value, "LAC_DECIMAL")
32
+ solara.CrossFilterReport(dfs.gsm_core_infos.value)
33
+ solara.CrossFilterDataFrame(dfs.gsm_core_infos.value)
34
+ AgGrid(df=dfs.gsm_core_infos.value)
35
+ if dfs.wcdma_core_infos.value is not None:
36
+ with solara.Card(title="WCDMA Core Infos"):
37
+ AgGrid(df=dfs.wcdma_core_infos.value)
38
+
39
+ return main
pages/line_v.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import textwrap
2
+ from typing import List, Optional, cast
3
+
4
+ import pandas as pd
5
+ import solara
6
+ from solara.components.file_drop import FileInfo
7
+
8
+ from utils.custom_grid import AgGrid
9
+ from utils.file_drop_utils import FileDropMultiple
10
+
11
+ data_global_cell_id = []
12
+ data_la_cell_name = []
13
+ data_wcdma_service_area_number = []
14
+ data_wcdma_service_area_name = []
15
+
16
+
17
+ class dfs:
18
+ gsm_core_infos = solara.reactive(cast(Optional[pd.DataFrame], None))
19
+ wcdma_core_infos = solara.reactive(cast(Optional[pd.DataFrame], None))
20
+
21
+
22
+ def parse_content(all_files):
23
+
24
+ data_global_cell_id = []
25
+ data_la_cell_name = []
26
+ data_wcdma_service_area_number = []
27
+ data_wcdma_service_area_name = []
28
+
29
+ for file in all_files:
30
+ all_data_global_cell_id = []
31
+ all_data_la_cell_name = []
32
+ all_data_wcdma_service_area_number = []
33
+ all_data_wcdma_service_area_name = []
34
+ content = file.decode("utf-8").splitlines()
35
+
36
+ for line in content:
37
+ if "Global cell ID" in line:
38
+ data_global_cell_id.append([line.split("=")[1].strip()])
39
+ elif "LA cell name" in line:
40
+ data_la_cell_name.append([line.split("=")[1].strip()])
41
+ elif "3G service area number" in line:
42
+ data_wcdma_service_area_number.append([line.split("=")[1].strip()])
43
+ elif "3G service area name" in line:
44
+ data_wcdma_service_area_name.append([line.split("=")[1].strip()])
45
+
46
+ # Append the extracted data for the current file to the overall lists
47
+ all_data_global_cell_id.extend(data_global_cell_id)
48
+ all_data_la_cell_name.extend(data_la_cell_name)
49
+ all_data_wcdma_service_area_number.extend(data_wcdma_service_area_number)
50
+ all_data_wcdma_service_area_name.extend(data_wcdma_service_area_name)
51
+
52
+ # Create a DataFrame from the extracted data
53
+ df_global_cell_id = pd.DataFrame(
54
+ all_data_global_cell_id, columns=["Global cell ID"]
55
+ )
56
+ df_la_cell_name = pd.DataFrame(all_data_la_cell_name, columns=["LA cell name"])
57
+ df_wcdma_service_area_number = pd.DataFrame(
58
+ all_data_wcdma_service_area_number, columns=["3G service area number"]
59
+ )
60
+ df_wcdma_service_area_name = pd.DataFrame(
61
+ all_data_wcdma_service_area_name, columns=["3G service area name"]
62
+ )
63
+
64
+ # add index column df_global_cell_id and df_la_cell_name and dfa_wcdma_service_area_numbera and df_wcdma_service_area_name
65
+ df_global_cell_id.insert(0, "index", range(0, len(df_global_cell_id)))
66
+ df_la_cell_name.insert(0, "index", range(0, len(df_la_cell_name)))
67
+ df_wcdma_service_area_number.insert(
68
+ 0, "index", range(0, len(df_wcdma_service_area_number))
69
+ )
70
+ df_wcdma_service_area_name.insert(
71
+ 0, "index", range(0, len(df_wcdma_service_area_name))
72
+ )
73
+
74
+ # Merge global_cell_id and la_cell_name on index
75
+ df_la_cell_name = df_la_cell_name.merge(df_global_cell_id, on="index")
76
+
77
+ # merge wcdma_service_area_number and wcdma_service_area_name on index
78
+ df_wcdma_service_area_name = df_wcdma_service_area_name.merge(
79
+ df_wcdma_service_area_number, on="index"
80
+ )
81
+
82
+ df_la_cell_name["LAC_ID"] = df_la_cell_name["Global cell ID"].str[5:]
83
+ df_wcdma_service_area_name["LAC_ID"] = df_wcdma_service_area_name[
84
+ "3G service area number"
85
+ ].str[5:]
86
+ df_la_cell_name["LAC"] = df_la_cell_name["LAC_ID"].str[:4]
87
+ df_la_cell_name["Cell ID"] = df_la_cell_name["LAC_ID"].str[4:]
88
+ df_wcdma_service_area_name["LAC"] = df_wcdma_service_area_name["LAC_ID"].str[:4]
89
+ df_wcdma_service_area_name["Cell ID"] = df_wcdma_service_area_name["LAC_ID"].str[4:]
90
+
91
+ # convert LAC to from HEXadecimal to DECimal
92
+ df_la_cell_name["LAC_DECIMAL"] = df_la_cell_name["LAC"].apply(lambda x: int(x, 16))
93
+ df_la_cell_name["Cell_ID_DECIMAL"] = df_la_cell_name["Cell ID"].apply(
94
+ lambda x: int(x, 16)
95
+ )
96
+ df_wcdma_service_area_name["LAC_DECIMAL"] = df_wcdma_service_area_name["LAC"].apply(
97
+ lambda x: int(x, 16)
98
+ )
99
+ df_wcdma_service_area_name["Cell_ID_DECIMAL"] = df_wcdma_service_area_name[
100
+ "Cell ID"
101
+ ].apply(lambda x: int(x, 16))
102
+
103
+ df_la_cell_name = df_la_cell_name.reset_index(drop=True)
104
+
105
+ dfs.gsm_core_infos.value = df_la_cell_name
106
+ dfs.wcdma_core_infos.value = df_wcdma_service_area_name
107
+
108
+ print(df_la_cell_name)
109
+ print(df_wcdma_service_area_name)
110
+
111
+
112
+ @solara.component
113
+ def line_v():
114
+ solara.Title("Dump Core Parsing")
115
+
116
+ # with solara.Sidebar():
117
+ # files = FileDropMultiple()
118
+ # parse_content(all_files=files)
119
+
120
+ with solara.Column() as main:
121
+
122
+ FileDropMultiple(parse_content=parse_content)
123
+
124
+ with solara.Card(title="Dump Core Parsed Results"):
125
+ if dfs.gsm_core_infos.value is not None:
126
+ with solara.Card(title="GSM Core Infos"):
127
+ solara.CrossFilterSelect(dfs.gsm_core_infos.value, "LA cell name")
128
+ solara.CrossFilterSlider(dfs.gsm_core_infos.value, "LAC_DECIMAL")
129
+ solara.CrossFilterReport(dfs.gsm_core_infos.value)
130
+ solara.CrossFilterDataFrame(dfs.gsm_core_infos.value)
131
+ AgGrid(df=dfs.gsm_core_infos.value)
132
+ if dfs.wcdma_core_infos.value is not None:
133
+ with solara.Card(title="WCDMA Core Infos"):
134
+ AgGrid(df=dfs.wcdma_core_infos.value)
135
+
136
+ return main
137
+
138
+ # with solara.AppBar():
139
+ # solara.lab.ThemeToggle()
140
+
141
+
142
+ # @solara.component
143
+ # def Layout(children):
144
+ # route, routes = solara.use_route()
145
+ # dark_effective = solara.lab.use_dark_effective()
146
+ # return solara.AppLayout(children=children, toolbar_dark=dark_effective, color=None)
processing/process_core_dump.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Optional, cast
2
+
3
+ import pandas as pd
4
+ import solara
5
+
6
+ data_global_cell_id = []
7
+ data_la_cell_name = []
8
+ data_wcdma_service_area_number = []
9
+ data_wcdma_service_area_name = []
10
+
11
+
12
+ class dfs:
13
+ gsm_core_infos = solara.reactive(cast(Optional[pd.DataFrame], None))
14
+ wcdma_core_infos = solara.reactive(cast(Optional[pd.DataFrame], None))
15
+
16
+
17
+ def parse_content(all_files):
18
+
19
+ data_global_cell_id = []
20
+ data_la_cell_name = []
21
+ data_wcdma_service_area_number = []
22
+ data_wcdma_service_area_name = []
23
+
24
+ for file in all_files:
25
+ all_data_global_cell_id = []
26
+ all_data_la_cell_name = []
27
+ all_data_wcdma_service_area_number = []
28
+ all_data_wcdma_service_area_name = []
29
+ content = file.decode("utf-8").splitlines()
30
+
31
+ for line in content:
32
+ if "Global cell ID" in line:
33
+ data_global_cell_id.append([line.split("=")[1].strip()])
34
+ elif "LA cell name" in line:
35
+ data_la_cell_name.append([line.split("=")[1].strip()])
36
+ elif "3G service area number" in line:
37
+ data_wcdma_service_area_number.append([line.split("=")[1].strip()])
38
+ elif "3G service area name" in line:
39
+ data_wcdma_service_area_name.append([line.split("=")[1].strip()])
40
+
41
+ # Append the extracted data for the current file to the overall lists
42
+ all_data_global_cell_id.extend(data_global_cell_id)
43
+ all_data_la_cell_name.extend(data_la_cell_name)
44
+ all_data_wcdma_service_area_number.extend(data_wcdma_service_area_number)
45
+ all_data_wcdma_service_area_name.extend(data_wcdma_service_area_name)
46
+
47
+ # Create a DataFrame from the extracted data
48
+ df_global_cell_id = pd.DataFrame(
49
+ all_data_global_cell_id, columns=["Global cell ID"]
50
+ )
51
+ df_la_cell_name = pd.DataFrame(all_data_la_cell_name, columns=["LA cell name"])
52
+ df_wcdma_service_area_number = pd.DataFrame(
53
+ all_data_wcdma_service_area_number, columns=["3G service area number"]
54
+ )
55
+ df_wcdma_service_area_name = pd.DataFrame(
56
+ all_data_wcdma_service_area_name, columns=["3G service area name"]
57
+ )
58
+
59
+ # add index column df_global_cell_id and df_la_cell_name and dfa_wcdma_service_area_numbera and df_wcdma_service_area_name
60
+ df_global_cell_id.insert(0, "index", range(0, len(df_global_cell_id)))
61
+ df_la_cell_name.insert(0, "index", range(0, len(df_la_cell_name)))
62
+ df_wcdma_service_area_number.insert(
63
+ 0, "index", range(0, len(df_wcdma_service_area_number))
64
+ )
65
+ df_wcdma_service_area_name.insert(
66
+ 0, "index", range(0, len(df_wcdma_service_area_name))
67
+ )
68
+
69
+ # Merge global_cell_id and la_cell_name on index
70
+ df_la_cell_name = df_la_cell_name.merge(df_global_cell_id, on="index")
71
+
72
+ # merge wcdma_service_area_number and wcdma_service_area_name on index
73
+ df_wcdma_service_area_name = df_wcdma_service_area_name.merge(
74
+ df_wcdma_service_area_number, on="index"
75
+ )
76
+
77
+ df_la_cell_name["LAC_ID"] = df_la_cell_name["Global cell ID"].str[5:]
78
+ df_wcdma_service_area_name["LAC_ID"] = df_wcdma_service_area_name[
79
+ "3G service area number"
80
+ ].str[5:]
81
+ df_la_cell_name["LAC"] = df_la_cell_name["LAC_ID"].str[:4]
82
+ df_la_cell_name["Cell ID"] = df_la_cell_name["LAC_ID"].str[4:]
83
+ df_wcdma_service_area_name["LAC"] = df_wcdma_service_area_name["LAC_ID"].str[:4]
84
+ df_wcdma_service_area_name["Cell ID"] = df_wcdma_service_area_name["LAC_ID"].str[4:]
85
+
86
+ # convert LAC to from HEXadecimal to DECimal
87
+ df_la_cell_name["LAC_DECIMAL"] = df_la_cell_name["LAC"].apply(lambda x: int(x, 16))
88
+ df_la_cell_name["Cell_ID_DECIMAL"] = df_la_cell_name["Cell ID"].apply(
89
+ lambda x: int(x, 16)
90
+ )
91
+ df_wcdma_service_area_name["LAC_DECIMAL"] = df_wcdma_service_area_name["LAC"].apply(
92
+ lambda x: int(x, 16)
93
+ )
94
+ df_wcdma_service_area_name["Cell_ID_DECIMAL"] = df_wcdma_service_area_name[
95
+ "Cell ID"
96
+ ].apply(lambda x: int(x, 16))
97
+
98
+ df_la_cell_name = df_la_cell_name.reset_index(drop=True)
99
+
100
+ dfs.gsm_core_infos.value = df_la_cell_name
101
+ dfs.wcdma_core_infos.value = df_wcdma_service_area_name
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ solara
2
+ python-calamine
3
+ XlsxWriter
4
+ plotly.express
utils/custom_grid.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import solara
3
+ from ipyaggrid import Grid
4
+
5
+
6
+ @solara.component
7
+ def AgGrid(df: pd.DataFrame, **kwargs):
8
+
9
+ grid_options = {
10
+ "columnDefs": [{"headerName": col, "field": col} for col in df.columns],
11
+ # "enableSorting": True,
12
+ # "enableFilter": True,
13
+ # "editable": True,
14
+ # "resizable": True,
15
+ # "sortable": True,
16
+ }
17
+
18
+ def update_data():
19
+ widget = solara.get_widget(el)
20
+ widget.grid_options = grid_options
21
+ widget.update_grid_data(df.to_dict("records"))
22
+
23
+ el = Grid.element(
24
+ grid_data=df.to_dict("records"),
25
+ grid_options=grid_options,
26
+ quick_filter=True,
27
+ theme="ag-theme-balham",
28
+ columns_fit="auto",
29
+ index=False,
30
+ keep_multiindex=False,
31
+ **kwargs,
32
+ )
33
+
34
+ solara.use_effect(update_data, [df])
35
+
36
+
37
+ @solara.component
38
+ def Page():
39
+ df = solara.use_reactive(
40
+ pd.DataFrame(
41
+ {
42
+ "Nom": ["Alice", "Bob", "Charlie"],
43
+ "Âge": [25, 30, 35],
44
+ "Ville": ["Paris", "Lyon", "Marseille"],
45
+ }
46
+ )
47
+ )
48
+
49
+ AgGrid(
50
+ df=df.value,
51
+ )
utils/file_drop_utils.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, cast
2
+
3
+ import solara
4
+ from solara.components.file_drop import FileInfo
5
+
6
+ # parse_content
7
+
8
+
9
+ @solara.component
10
+ def FileDropMultiple(parse_content: callable):
11
+ content, set_content = solara.use_state(cast(List[bytes], []))
12
+ filename, set_filename = solara.use_state(cast(List[str], []))
13
+ size, set_size = solara.use_state(cast(List[int], []))
14
+
15
+ def on_file(files: List[FileInfo]):
16
+ set_filename([f["name"] for f in files])
17
+ set_size([f["size"] for f in files])
18
+ set_content([f["file_obj"].read() for f in files])
19
+
20
+ solara.FileDropMultiple(
21
+ label="Drag and drop files(s) here.",
22
+ on_file=on_file,
23
+ # lazy=True, # We will only read the first 100 bytes
24
+ # on_total_progress=lambda *args: None,
25
+ )
26
+ if content:
27
+ solara.Info(f"Number of uploaded files: {len(filename)}")
28
+ for f, s, c in zip(filename, size, content):
29
+ solara.Info(f"File {f} has total length: {s}\n")
30
+ parse_content(all_files=content)
31
+ # return content
utils/utils.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import solara
2
+
3
+ selected_template = solara.reactive("plotly")
4
+ def change_theme(e):
5
+ print (selected_template.value)
6
+ templates =["plotly", "plotly_white", "plotly_dark", "ggplot2", "seaborn", "simple_white", "none"]
7
+
8
+
9
+ @solara.component
10
+ def SharedSidebar():
11
+ with solara.Card("Solara + Plotly Graphs", style={"max-width": "500px"}):
12
+ solara.Markdown(
13
+ f"""
14
+ ###This project utilizes the Solara Framework to create interactive graphs using Plotly.
15
+ *The code and examples in this project are based on the Plotly tutorial by Derek Banas.*
16
+ *Please refer to his repository for the original tutorial [here](https://github.com/derekbanas/plotly-tutorial/blob/master/Plotly%20Tut.ipynb)*
17
+ """
18
+ )
19
+ with solara.Card(style={"max-width": "500px"}):
20
+ solara.Select(label="Themes", value=selected_template, values=templates, on_value=change_theme)