Update pages/1_Home.py
Browse files- pages/1_Home.py +46 -52
pages/1_Home.py
CHANGED
@@ -1,68 +1,62 @@
|
|
1 |
# /home/user/app/pages/1_Home.py
|
2 |
import streamlit as st
|
3 |
from config.settings import settings
|
4 |
-
from pathlib import Path
|
5 |
-
from assets.logo import get_logo_path
|
6 |
from services.logger import app_logger
|
7 |
|
8 |
-
# Page config should be set only once per app, usually in the main app.py.
|
9 |
-
# If set here, it might override or conflict. Generally, avoid in sub-pages unless necessary
|
10 |
-
# and ensure it's compatible with the main app.py's layout.
|
11 |
-
# For consistency, let's assume app.py sets the global layout.
|
12 |
-
# st.set_page_config(page_title=f"Home - {settings.APP_TITLE}", layout="wide")
|
13 |
-
|
14 |
# --- Authentication Check ---
|
15 |
if not st.session_state.get("authenticated_user_id"):
|
16 |
-
st.warning("Please log in to access
|
17 |
-
# Redirect to the main app page (which handles login)
|
18 |
-
# Make sure 'app.py' is the correct name of your main script.
|
19 |
try:
|
20 |
st.switch_page("app.py")
|
21 |
-
except st.errors.StreamlitAPIException
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
st.error("Redirection error. Please go to the login page manually.")
|
28 |
-
st.stop() # Stop script execution if not authenticated
|
29 |
|
30 |
# --- Page Content ---
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
st.title(f"Welcome to {settings.APP_TITLE}, {authenticated_username}!")
|
35 |
st.markdown(f"""
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
**
|
41 |
-
- **
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
actual medical decision-making without verification by qualified medical professionals.*
|
52 |
""")
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
app_logger.warning(f"Could not display logo on Home page from path '{logo_path_str}': {e}")
|
63 |
-
# else: # No need to log again if get_logo_path already logged it
|
64 |
-
# app_logger.warning(f"Home page logo path from get_logo_path() does not exist: {logo_path_str}")
|
65 |
-
elif settings.APP_TITLE: # Fallback to text if no logo
|
66 |
-
st.caption(f"Image: {settings.APP_TITLE} Logo")
|
67 |
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# /home/user/app/pages/1_Home.py
|
2 |
import streamlit as st
|
3 |
from config.settings import settings
|
4 |
+
from pathlib import Path
|
5 |
+
from assets.logo import get_logo_path
|
6 |
from services.logger import app_logger
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# --- Authentication Check ---
|
9 |
if not st.session_state.get("authenticated_user_id"):
|
10 |
+
st.warning("Please log in to access this page.")
|
|
|
|
|
11 |
try:
|
12 |
st.switch_page("app.py")
|
13 |
+
except st.errors.StreamlitAPIException:
|
14 |
+
st.info("Please navigate to the main login page.")
|
15 |
+
st.stop()
|
16 |
+
|
17 |
+
authenticated_username = st.session_state.get("authenticated_username", "User")
|
18 |
+
app_logger.info(f"User '{authenticated_username}' accessed Home page.")
|
|
|
|
|
19 |
|
20 |
# --- Page Content ---
|
21 |
+
st.title(f"Dashboard - {settings.APP_TITLE}")
|
22 |
+
st.subheader(f"Welcome, {authenticated_username}!")
|
23 |
|
|
|
24 |
st.markdown(f"""
|
25 |
+
This application is designed to assist healthcare professionals by leveraging AI for insights and information retrieval.
|
26 |
+
Please remember the following:
|
27 |
+
- **Purpose:** This tool is for informational and educational support.
|
28 |
+
- **Not a Substitute:** It is NOT a diagnostic tool and does NOT replace your clinical judgment or patient consultation.
|
29 |
+
- **PHI:** **Do NOT enter real Patient Health Information (PHI) into this demonstration system.**
|
30 |
+
- **Simulation:** Features involving 'Quantum' aspects are currently simulated for illustrative purposes.
|
31 |
+
""")
|
32 |
+
st.markdown(settings.MAIN_DISCLAIMER_SHORT, unsafe_allow_html=True) # Short reminder
|
33 |
+
|
34 |
+
st.markdown("---")
|
35 |
+
st.header("Key Features")
|
36 |
+
st.markdown("""
|
37 |
+
- **AI-Powered Consultation (`Consult` page):** Engage with an AI assistant. You can provide (simulated) patient context to guide the conversation.
|
38 |
+
- **Consultation Reports (`Reports` page):** Review and download summaries of your AI consultation sessions.
|
39 |
+
- **Secure User Authentication:** Your interactions within this demo are tied to your account.
|
|
|
40 |
""")
|
41 |
|
42 |
+
st.markdown("---")
|
43 |
+
st.header("How to Get Started")
|
44 |
+
st.markdown("""
|
45 |
+
1. Familiarize yourself with the disclaimers and capabilities outlined here.
|
46 |
+
2. Navigate to the **`Consult`** page to start a new session with the AI.
|
47 |
+
* You will be prompted to provide optional (simulated) patient context.
|
48 |
+
3. Use the **`Reports`** page to view and download past consultation summaries.
|
49 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
st.markdown("---")
|
52 |
+
# Display Logo
|
53 |
+
# logo_path_str = get_logo_path() # Already done in app.py sidebar, might be redundant here unless desired
|
54 |
+
# if logo_path_str:
|
55 |
+
# logo_file = Path(logo_path_str)
|
56 |
+
# if logo_file.exists():
|
57 |
+
# try:
|
58 |
+
# st.image(str(logo_file), width=120, caption=f"{settings.APP_TITLE} - Demo")
|
59 |
+
# except Exception as e:
|
60 |
+
# app_logger.warning(f"Could not display logo on Home page: {e}")
|
61 |
+
|
62 |
+
st.caption(f"Version 0.1.0 (Demonstration) | {settings.APP_TITLE}")
|