Update app.py
Browse files
app.py
CHANGED
|
@@ -103,3 +103,52 @@ st.altair_chart(chart, use_container_width=True)
|
|
| 103 |
st.header("🧾 Latest Structures Table")
|
| 104 |
latest_df = df.sort_values("release_date", ascending=False).head(20)
|
| 105 |
st.dataframe(latest_df[["id", "release_date", "method", "resolution", "institution"]].reset_index(drop=True))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
st.header("🧾 Latest Structures Table")
|
| 104 |
latest_df = df.sort_values("release_date", ascending=False).head(20)
|
| 105 |
st.dataframe(latest_df[["id", "release_date", "method", "resolution", "institution"]].reset_index(drop=True))
|
| 106 |
+
|
| 107 |
+
# ------------------ VISUALIZATION 6 ------------------ #
|
| 108 |
+
st.header("📈 Submissions Over Time by Method")
|
| 109 |
+
method_trend = df.groupby(["year", "method"]).size().reset_index(name="count")
|
| 110 |
+
trend_chart = alt.Chart(method_trend).mark_line(point=True).encode(
|
| 111 |
+
x="year:O", y="count:Q", color="method:N", tooltip=["year", "method", "count"]
|
| 112 |
+
).properties(height=300)
|
| 113 |
+
st.altair_chart(trend_chart, use_container_width=True)
|
| 114 |
+
|
| 115 |
+
# ------------------ VISUALIZATION 7 ------------------ #
|
| 116 |
+
st.header("📦 Method Usage Distribution")
|
| 117 |
+
method_dist = df["method"].value_counts().reset_index()
|
| 118 |
+
method_dist.columns = ["method", "count"]
|
| 119 |
+
pie_chart = alt.Chart(method_dist).mark_arc().encode(
|
| 120 |
+
theta="count:Q", color="method:N", tooltip=["method", "count"]
|
| 121 |
+
)
|
| 122 |
+
st.altair_chart(pie_chart, use_container_width=True)
|
| 123 |
+
|
| 124 |
+
# ------------------ VISUALIZATION 8 ------------------ #
|
| 125 |
+
st.header("🎯 Resolution Distribution by Method")
|
| 126 |
+
box_data = df.dropna(subset=["resolution"])
|
| 127 |
+
box = alt.Chart(box_data).mark_boxplot().encode(
|
| 128 |
+
x="method:N", y="resolution:Q", color="method:N"
|
| 129 |
+
)
|
| 130 |
+
st.altair_chart(box, use_container_width=True)
|
| 131 |
+
|
| 132 |
+
# ------------------ VISUALIZATION 9 ------------------ #
|
| 133 |
+
st.header("🔍 Compare Two Entries")
|
| 134 |
+
entry_ids = df["id"].tolist()
|
| 135 |
+
col1, col2 = st.columns(2)
|
| 136 |
+
entry1 = col1.selectbox("Select Entry 1", entry_ids, index=0)
|
| 137 |
+
entry2 = col2.selectbox("Select Entry 2", entry_ids, index=1)
|
| 138 |
+
info1 = df[df["id"] == entry1].iloc[0]
|
| 139 |
+
info2 = df[df["id"] == entry2].iloc[0]
|
| 140 |
+
|
| 141 |
+
col1.subheader(f"Entry: {entry1}")
|
| 142 |
+
col1.write(info1)
|
| 143 |
+
col2.subheader(f"Entry: {entry2}")
|
| 144 |
+
col2.write(info2)
|
| 145 |
+
|
| 146 |
+
# ------------------ VISUALIZATION 10 ------------------ #
|
| 147 |
+
st.header("📅 Monthly Submissions (Last 12 Months)")
|
| 148 |
+
df["month"] = pd.to_datetime(df["release_date"]).dt.to_period("M").astype(str)
|
| 149 |
+
last_year_df = df[df["release_date"] >= (pd.to_datetime("today") - pd.DateOffset(months=12))]
|
| 150 |
+
monthly = last_year_df.groupby("month").size().reset_index(name="count")
|
| 151 |
+
month_chart = alt.Chart(monthly).mark_bar().encode(
|
| 152 |
+
x="month:O", y="count:Q", tooltip=["month", "count"]
|
| 153 |
+
).properties(height=300)
|
| 154 |
+
st.altair_chart(month_chart, use_container_width=True)
|