Update modules/data_analysis/data_analysis_app.py
Browse files
modules/data_analysis/data_analysis_app.py
CHANGED
@@ -13,19 +13,18 @@ class DataAnalysisApp:
|
|
13 |
def __init__(self):
|
14 |
self.data = None
|
15 |
self.file_path = None
|
16 |
-
|
17 |
-
def render(self):
|
18 |
-
"""عرض واجهة تحليل البيانات"""
|
19 |
-
st.title("تحليل البيانات")
|
20 |
-
self.run()
|
21 |
-
|
22 |
-
# تهيئة حالة الجلسة
|
23 |
if 'analysis_data' not in st.session_state:
|
24 |
st.session_state.analysis_data = {
|
25 |
'uploaded_files': {},
|
26 |
'analysis_results': {},
|
27 |
'ai_insights': {}
|
28 |
}
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
def run(self):
|
31 |
st.title("تحليل البيانات المتقدم")
|
@@ -111,7 +110,7 @@ class DataAnalysisApp:
|
|
111 |
st.error(f"خطأ في تحميل الملف {file.name}: {str(e)}")
|
112 |
|
113 |
# عرض الملفات المحملة
|
114 |
-
if st.session_state.analysis_data['uploaded_files']:
|
115 |
st.subheader("الملفات المحملة")
|
116 |
for filename, file_info in st.session_state.analysis_data['uploaded_files'].items():
|
117 |
with st.expander(f"📄 {filename}"):
|
@@ -130,7 +129,7 @@ class DataAnalysisApp:
|
|
130 |
def _render_statistical_analysis(self):
|
131 |
st.header("التحليل الإحصائي")
|
132 |
|
133 |
-
if not st.session_state.analysis_data['uploaded_files']:
|
134 |
st.info("الرجاء تحميل البيانات أولاً")
|
135 |
return
|
136 |
|
@@ -162,7 +161,7 @@ class DataAnalysisApp:
|
|
162 |
def _render_visualization(self):
|
163 |
st.header("التحليل المرئي")
|
164 |
|
165 |
-
if not st.session_state.analysis_data['uploaded_files']:
|
166 |
st.info("الرجاء تحميل البيانات أولاً")
|
167 |
return
|
168 |
|
@@ -229,7 +228,7 @@ class DataAnalysisApp:
|
|
229 |
def _render_ai_analysis(self):
|
230 |
st.header("تحليل الذكاء الاصطناعي")
|
231 |
|
232 |
-
if not st.session_state.analysis_data['uploaded_files']:
|
233 |
st.info("الرجاء تحميل البيانات أولاً")
|
234 |
return
|
235 |
|
@@ -266,7 +265,7 @@ class DataAnalysisApp:
|
|
266 |
def _render_reports(self):
|
267 |
st.header("التقارير")
|
268 |
|
269 |
-
if not st.session_state.analysis_data['uploaded_files']:
|
270 |
st.info("الرجاء تحميل البيانات أولاً")
|
271 |
return
|
272 |
|
|
|
13 |
def __init__(self):
|
14 |
self.data = None
|
15 |
self.file_path = None
|
16 |
+
# تهيئة حالة الجلسة في البداية
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
if 'analysis_data' not in st.session_state:
|
18 |
st.session_state.analysis_data = {
|
19 |
'uploaded_files': {},
|
20 |
'analysis_results': {},
|
21 |
'ai_insights': {}
|
22 |
}
|
23 |
+
|
24 |
+
def render(self):
|
25 |
+
"""عرض واجهة تحليل البيانات"""
|
26 |
+
st.title("تحليل البيانات")
|
27 |
+
self.run()
|
28 |
|
29 |
def run(self):
|
30 |
st.title("تحليل البيانات المتقدم")
|
|
|
110 |
st.error(f"خطأ في تحميل الملف {file.name}: {str(e)}")
|
111 |
|
112 |
# عرض الملفات المحملة
|
113 |
+
if 'uploaded_files' in st.session_state.analysis_data and st.session_state.analysis_data['uploaded_files']:
|
114 |
st.subheader("الملفات المحملة")
|
115 |
for filename, file_info in st.session_state.analysis_data['uploaded_files'].items():
|
116 |
with st.expander(f"📄 {filename}"):
|
|
|
129 |
def _render_statistical_analysis(self):
|
130 |
st.header("التحليل الإحصائي")
|
131 |
|
132 |
+
if 'uploaded_files' not in st.session_state.analysis_data or not st.session_state.analysis_data['uploaded_files']:
|
133 |
st.info("الرجاء تحميل البيانات أولاً")
|
134 |
return
|
135 |
|
|
|
161 |
def _render_visualization(self):
|
162 |
st.header("التحليل المرئي")
|
163 |
|
164 |
+
if 'uploaded_files' not in st.session_state.analysis_data or not st.session_state.analysis_data['uploaded_files']:
|
165 |
st.info("الرجاء تحميل البيانات أولاً")
|
166 |
return
|
167 |
|
|
|
228 |
def _render_ai_analysis(self):
|
229 |
st.header("تحليل الذكاء الاصطناعي")
|
230 |
|
231 |
+
if 'uploaded_files' not in st.session_state.analysis_data or not st.session_state.analysis_data['uploaded_files']:
|
232 |
st.info("الرجاء تحميل البيانات أولاً")
|
233 |
return
|
234 |
|
|
|
265 |
def _render_reports(self):
|
266 |
st.header("التقارير")
|
267 |
|
268 |
+
if 'uploaded_files' not in st.session_state.analysis_data or not st.session_state.analysis_data['uploaded_files']:
|
269 |
st.info("الرجاء تحميل البيانات أولاً")
|
270 |
return
|
271 |
|