fix comments etc.

This commit is contained in:
Philipp Jacoby
2026-02-10 17:57:43 +01:00
parent 3003310be0
commit 8965b04a61
5 changed files with 59 additions and 60 deletions

View File

@@ -104,7 +104,7 @@ try:
else:
st.sidebar.warning("No drugs found")
# OVERVIEW PAGE
# overview page
if page == "Overview":
st.header("Dataset Overview")
@@ -114,7 +114,7 @@ try:
col3.metric("Repurposing Opportunities", f"{len(repurposing):,}")
col4.metric("Analyzed Drugs", f"{len(super_drugs):,}")
# STATISTICS BOXES
# statistics boxes
st.markdown("---")
st.subheader("Key Statistics")
@@ -163,7 +163,7 @@ try:
xaxis_title="Gene",
yaxis_title="Number of Diseases"
)
# Enable chart export
# enable chart export
config = {'displayModeBar': True, 'displaylogo': False}
st.plotly_chart(fig, use_container_width=True, config=config)
@@ -185,7 +185,7 @@ try:
csv = top_diseases.to_csv(index=False).encode('utf-8')
st.download_button("Download Data", csv, "top_diseases.csv", "text/csv")
# HOTSPOT GENES PAGE
# hotspot gene page
elif page == "Hotspot Genes":
st.header("Hotspot Genes - Most Disease Associations")
@@ -215,7 +215,7 @@ try:
csv = filtered_genes.to_csv(index=False).encode('utf-8')
st.download_button("Download Filtered Data", csv, "hotspot_genes.csv", "text/csv")
# DRUG REPURPOSING PAGE
# drug repurposing page
elif page == "Drug Repurposing":
st.header("Drug Repurposing Opportunities")
@@ -250,7 +250,7 @@ try:
csv = filtered.to_csv(index=False).encode('utf-8')
st.download_button("Download", csv, f"repurposing_{selected}.csv", "text/csv")
# POLYPHARMACY RISK PAGE
# polypharmacy risk page
elif page == "Polypharmacy Risk":
st.header("Polypharmacy Risk Analysis")
@@ -285,7 +285,7 @@ try:
csv = filtered_risk.to_csv(index=False).encode('utf-8')
st.download_button("Download Risk Data", csv, "polypharmacy_risk.csv", "text/csv")
# SYMPTOM TRIANGLE PAGE
# symptop triangle page
elif page == "Symptom Triangle":
st.header("Symptom-Disease-Drug Connections")
@@ -314,7 +314,7 @@ try:
csv = top_symptoms.to_csv(index=False).encode('utf-8')
st.download_button("Download Symptom Data", csv, "symptom_triangle.csv", "text/csv")
# SUPER DRUGS PAGE
# super drugs page
elif page == "Super Drugs":
st.header("Super-Drug Score (Best Benefit/Risk Ratio)")
@@ -352,7 +352,7 @@ try:
csv = filtered_super.to_csv(index=False).encode('utf-8')
st.download_button("Download Super Drugs", csv, "super_drugs.csv", "text/csv")
# DRUG CONFLICTS PAGE
# drug conflicts page
elif page == "Drug Conflicts":
st.header("Drug Conflicts - Overlapping Side Effects")
@@ -394,28 +394,28 @@ try:
else:
st.warning("Drug conflicts data not available. Run the ETL script to generate this analysis.")
# NETWORK GRAPH PAGE
# network graph page
elif page == "Network Graph":
st.header("Disease-Gene-Drug Network")
if network_nodes is not None and network_edges is not None:
st.info("Interactive network visualization showing connections between diseases, genes, and drugs")
# Create networkx graph
# create networkx graph
G = nx.Graph()
# Add nodes
# add nodes
for _, row in network_nodes.iterrows():
G.add_node(row['id'], label=row['label'], type=row['type'])
# Add edges
# add edges
for _, row in network_edges.iterrows():
G.add_edge(row['source'], row['target'])
# Create layout
# create layout
pos = nx.spring_layout(G, k=0.5, iterations=50)
# Create edge trace
# create edge trace
edge_x = []
edge_y = []
for edge in G.edges():
@@ -431,7 +431,7 @@ try:
mode='lines'
)
# Create node traces (separate by type for legend)
# create node traces (separate by type for legend)
node_traces = []
color_map = {
'Disease': '#ff4444',
@@ -466,7 +466,7 @@ try:
)
node_traces.append(node_trace)
# Create figure
# create figure
fig = go.Figure(data=[edge_trace] + node_traces,
layout=go.Layout(
title='Disease-Gene-Drug Network',
@@ -488,7 +488,7 @@ try:
else:
st.warning("Network data not available. Run the ETL script to generate this visualization.")
# COMPARE DRUGS PAGE
# compare drugs page
elif page == "Compare Drugs":
st.header("⚖️ Compare Drugs Side-by-Side")
@@ -522,7 +522,7 @@ try:
st.metric("Side Effects", int(drug2_data['num_side_effects']))
st.metric("Super Score", f"{drug2_data['super_score']:.2f}")
# Comparison chart
# comparison chart
comparison_df = pd.DataFrame({
'Metric': ['Diseases Treated', 'Side Effects', 'Super Score'],
drug1: [drug1_data['num_diseases_treated'], drug1_data['num_side_effects'], drug1_data['super_score']],
@@ -539,7 +539,7 @@ try:
config = {'displayModeBar': True, 'displaylogo': False}
st.plotly_chart(fig, use_container_width=True, config=config)
# Winner determination
# winner determination
st.markdown("---")
st.subheader("Recommendation")