Moving Physical DB to github storage repository
Browse files- .gitignore +1 -1
- Changelog.md +8 -0
- app.py +1 -1
- apps/import_physical_db.py +7 -68
- utils/utils_vars.py +4 -1
.gitignore
CHANGED
|
@@ -3,5 +3,5 @@
|
|
| 3 |
/__pycache__
|
| 4 |
__pycache__
|
| 5 |
/data2
|
| 6 |
-
|
| 7 |
# /physical_db
|
|
|
|
| 3 |
/__pycache__
|
| 4 |
__pycache__
|
| 5 |
/data2
|
| 6 |
+
/physical_db/physical_database.csv
|
| 7 |
# /physical_db
|
Changelog.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
| 1 |
|
| 2 |
# CHANGELOGS
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
## [0.2.1] - 2024-09-30
|
| 5 |
|
| 6 |
- improve lac plot for 2G and 3G
|
|
|
|
| 1 |
|
| 2 |
# CHANGELOGS
|
| 3 |
|
| 4 |
+
## [0.2.3] - 2024-09-30
|
| 5 |
+
|
| 6 |
+
- Moving physical database to github storage repository
|
| 7 |
+
|
| 8 |
+
## [0.2.2] - 2024-09-30
|
| 9 |
+
|
| 10 |
+
- Add invunit summary
|
| 11 |
+
|
| 12 |
## [0.2.1] - 2024-09-30
|
| 13 |
|
| 14 |
- improve lac plot for 2G and 3G
|
app.py
CHANGED
|
@@ -15,7 +15,7 @@ pages = {
|
|
| 15 |
"Apps": [
|
| 16 |
st.Page("apps/database_page.py", title="Generate Databases"),
|
| 17 |
st.Page("apps/core_dump_page.py", title="Parse dump core"),
|
| 18 |
-
st.Page("apps/import_physical_db.py", title="Physical Database
|
| 19 |
st.Page("apps/gps_converter.py", title="GPS Converter"),
|
| 20 |
st.Page("apps/distance.py", title="Distance Calculator"),
|
| 21 |
],
|
|
|
|
| 15 |
"Apps": [
|
| 16 |
st.Page("apps/database_page.py", title="Generate Databases"),
|
| 17 |
st.Page("apps/core_dump_page.py", title="Parse dump core"),
|
| 18 |
+
st.Page("apps/import_physical_db.py", title="Physical Database Verification"),
|
| 19 |
st.Page("apps/gps_converter.py", title="GPS Converter"),
|
| 20 |
st.Page("apps/distance.py", title="Distance Calculator"),
|
| 21 |
],
|
apps/import_physical_db.py
CHANGED
|
@@ -3,75 +3,14 @@ import os
|
|
| 3 |
import pandas as pd
|
| 4 |
import streamlit as st
|
| 5 |
|
| 6 |
-
|
| 7 |
-
physical_db_folder = "physical_db"
|
| 8 |
-
physical_db_file = os.path.join(physical_db_folder, "physical_database.csv")
|
| 9 |
-
|
| 10 |
-
# Ensure the folder exists
|
| 11 |
-
if not os.path.exists(physical_db_folder):
|
| 12 |
-
os.makedirs(physical_db_folder)
|
| 13 |
|
| 14 |
# Streamlit app title
|
| 15 |
-
st.title("Physical Database
|
| 16 |
-
|
| 17 |
-
# Step 1: Upload a new CSV file
|
| 18 |
-
uploaded_file = st.file_uploader(
|
| 19 |
-
"Upload a CSV file of new physical database", type="csv"
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
if uploaded_file is not None:
|
| 23 |
-
# Step 2: Check if the file contains the required columns
|
| 24 |
-
df = pd.read_csv(uploaded_file)
|
| 25 |
-
required_columns = [
|
| 26 |
-
"CODE",
|
| 27 |
-
"sector",
|
| 28 |
-
"Code_Sector",
|
| 29 |
-
"Azimut",
|
| 30 |
-
"Longitude",
|
| 31 |
-
"Latitude",
|
| 32 |
-
"Hauteur",
|
| 33 |
-
]
|
| 34 |
-
|
| 35 |
-
if not all(col in df.columns for col in required_columns):
|
| 36 |
-
st.error(
|
| 37 |
-
f"Error: The file must contain the following columns: {', '.join(required_columns)}"
|
| 38 |
-
)
|
| 39 |
-
elif len(df) <= 500:
|
| 40 |
-
st.error("Error: The file must contain more than 500 rows.")
|
| 41 |
-
else:
|
| 42 |
-
st.success(
|
| 43 |
-
"File successfully validated. Click on the Save button to save the new physical database file."
|
| 44 |
-
)
|
| 45 |
-
|
| 46 |
-
# Display the DataFrame
|
| 47 |
-
st.write(df)
|
| 48 |
-
|
| 49 |
-
# Step 6: Add button to save the new file
|
| 50 |
-
if st.button("Save the new physical database file", type="primary"):
|
| 51 |
-
# Step 4: Remove everything in the folder physical_db/
|
| 52 |
-
for file in os.listdir(physical_db_folder):
|
| 53 |
-
os.remove(os.path.join(physical_db_folder, file))
|
| 54 |
-
|
| 55 |
-
# Step 5: Rename and save the new file
|
| 56 |
-
df.to_csv(physical_db_file, index=False)
|
| 57 |
-
st.success(f"New physical database saved Successfully.")
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
# # Step 7: Add button to download the existing physical_database.csv file
|
| 61 |
-
# if os.path.exists(physical_db_file):
|
| 62 |
-
# st.subheader("Download the existing physical_database.csv file")
|
| 63 |
-
# with open(physical_db_file, "rb") as f:
|
| 64 |
-
# st.download_button(
|
| 65 |
-
# label="Download physical_database.csv",
|
| 66 |
-
# data=f,
|
| 67 |
-
# file_name="physical_database.csv",
|
| 68 |
-
# )
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
if st.button("Show actual physical database"):
|
| 74 |
-
df_existing = pd.read_csv(physical_db_file)
|
| 75 |
st.dataframe(df_existing)
|
| 76 |
-
|
| 77 |
-
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
import streamlit as st
|
| 5 |
|
| 6 |
+
url = "https://raw.githubusercontent.com/DavMelchi/STORAGE/refs/heads/main/physical_db/physical_database.csv"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Streamlit app title
|
| 9 |
+
st.title("Physical Database Verification")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
if st.button("Show actual physical database"):
|
| 12 |
+
try:
|
| 13 |
+
df_existing = pd.read_csv(url)
|
|
|
|
|
|
|
| 14 |
st.dataframe(df_existing)
|
| 15 |
+
except FileNotFoundError:
|
| 16 |
+
st.warning("No physical_database.csv file with the url")
|
utils/utils_vars.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import numpy as np
|
| 2 |
import pandas as pd
|
| 3 |
|
|
|
|
|
|
|
| 4 |
|
| 5 |
def get_physical_db():
|
| 6 |
"""
|
|
@@ -11,7 +13,8 @@ def get_physical_db():
|
|
| 11 |
Returns:
|
| 12 |
pd.DataFrame: A DataFrame containing the filtered columns.
|
| 13 |
"""
|
| 14 |
-
physical = pd.read_csv(r"./physical_db/physical_database.csv")
|
|
|
|
| 15 |
physical = physical[["Code_Sector", "Azimut", "Longitude", "Latitude", "Hauteur"]]
|
| 16 |
return physical
|
| 17 |
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
+
url = "https://raw.githubusercontent.com/DavMelchi/STORAGE/refs/heads/main/physical_db/physical_database.csv"
|
| 5 |
+
|
| 6 |
|
| 7 |
def get_physical_db():
|
| 8 |
"""
|
|
|
|
| 13 |
Returns:
|
| 14 |
pd.DataFrame: A DataFrame containing the filtered columns.
|
| 15 |
"""
|
| 16 |
+
# physical = pd.read_csv(r"./physical_db/physical_database.csv")
|
| 17 |
+
physical = pd.read_csv(url)
|
| 18 |
physical = physical[["Code_Sector", "Azimut", "Longitude", "Latitude", "Hauteur"]]
|
| 19 |
return physical
|
| 20 |
|