-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
110 lines (90 loc) · 2.98 KB
/
app.py
File metadata and controls
110 lines (90 loc) · 2.98 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import streamlit as st
import app_graph
from app_helper_functions import get_data_version
import app_processing
import app_search
import app_analysis
import app_workflows
import app_pathviewer
import pandas as pd
import os
import logging
import warnings
# Suppress Streamlit warnings
logging.getLogger("streamlit").setLevel(
logging.CRITICAL
) # prevent spam during multiprocessing functions
# Suppress specific Streamlit warnings
warnings.filterwarnings("ignore", category=UserWarning, module="streamlit")
# Suppress Streamlit warnings
logging.getLogger("streamlit.runtime.scriptrunner_utils").setLevel(logging.CRITICAL)
logging.getLogger("streamlit.runtime.caching.cache_data_api").setLevel(logging.CRITICAL)
st.set_page_config(page_title="GraphViewer App", page_icon="📊", layout="wide")
# Sidebar
# st.sidebar.title("Navigation")
# selection = st.sidebar.selectbox(
# "Go to", ["Data Processing", "Search RefID", "Graph Viewer"]
# )
if "selection" not in st.session_state:
st.session_state["selection"] = "Search RefID"
# Use buttons instead of radio for navigation with icons
st.sidebar.title("Navigation")
# Add custom CSS to left-justify button text
st.sidebar.markdown(
"""
<style>
div.stButton > button {
text-align: left;
justify-content: flex-start;
}
</style>
""",
unsafe_allow_html=True,
)
# Dictionary mapping selections to their titles with icons
page_options = {
"Data Processing": "🗄️ Data Processing",
"Search RefID": "🔍 Search ReferenceIDs",
"Graph Viewer": "📊 Graph Viewer",
"Analysis": "👨💻 Analysis",
"Prozess Viewer": "🔀 Prozess Viewer",
"Path Viewer": "🏞 Path Viewer",
}
# Create a button for each page
for page_key, page_title in page_options.items():
if st.sidebar.button(page_title, use_container_width=True):
st.session_state["selection"] = page_key
selection = st.session_state["selection"]
if "cwd" not in st.session_state:
# Get the directory where the current file (app.py) is located
app_dir = os.path.dirname(os.path.abspath(__file__))
st.session_state["cwd"] = app_dir
if "file_versions" not in st.session_state or not st.session_state["file_versions"]:
_, _, _ = get_data_version()
# --- used in sub-pages---
@st.cache_data
def load_data(file_path, csv=False):
if csv:
df = pd.read_csv(file_path) # evtl. index_col=[0]
else:
df = pd.read_excel(file_path)
return df
# Main Content
if selection == "Data Processing":
st.title("🗄️ Data Processing")
app_processing.show()
elif selection == "Graph Viewer":
# st.title("Organisationen")
app_graph.show()
elif selection == "Search RefID":
st.title("🔍 Search ReferenceIDs")
app_search.show()
elif selection == "Analysis":
st.title("👨💻 Analysis")
app_analysis.show()
elif selection == "Prozess Viewer":
st.title("🔀 Prozess Viewer")
app_workflows.show()
elif selection == "Path Viewer":
st.title("🏞 Path Viewer")
app_pathviewer.show()