Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ st.markdown("""
|
|
44 |
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
|
45 |
}
|
46 |
header[data-testid="stHeader"] {
|
47 |
-
background-color:
|
48 |
}
|
49 |
section[data-testid="stSidebar"] > div:first-child {
|
50 |
background-color: #1A1A1A !important;
|
@@ -223,34 +223,55 @@ if fetch_data:
|
|
223 |
height=240
|
224 |
)
|
225 |
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
""", unsafe_allow_html=True)
|
241 |
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
# Render collapsible green completeness table in sidebar
|
246 |
-
with st.sidebar.expander("π Field Completeness Breakdown", expanded=True):
|
247 |
-
st.dataframe(
|
248 |
-
completeness_table.style.background_gradient(cmap="Greens").format("{:.1f}%"),
|
249 |
-
use_container_width=True,
|
250 |
-
height=240
|
251 |
-
)
|
252 |
-
|
253 |
-
|
254 |
# Utility functions for deeper metadata quality analysis
|
255 |
def is_incomplete(value):
|
256 |
return pd.isna(value) or value in ["", "N/A", "null", None]
|
@@ -309,7 +330,7 @@ if fetch_data:
|
|
309 |
incomplete_mask = metadata_df.map(is_incomplete).any(axis=1)
|
310 |
incomplete_records = metadata_df[incomplete_mask]
|
311 |
|
312 |
-
st.subheader("
|
313 |
|
314 |
incomplete_with_desc = incomplete_records[incomplete_records['description'].notnull()]
|
315 |
reference_df = metadata_df[metadata_df['subject'].notnull() & metadata_df['description'].notnull()]
|
|
|
44 |
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
|
45 |
}
|
46 |
header[data-testid="stHeader"] {
|
47 |
+
background-color: #1A1A1A !important;
|
48 |
}
|
49 |
section[data-testid="stSidebar"] > div:first-child {
|
50 |
background-color: #1A1A1A !important;
|
|
|
223 |
height=240
|
224 |
)
|
225 |
|
226 |
+
# ------------------- Helpful Resources -------------------
|
227 |
+
st.sidebar.markdown("""
|
228 |
+
<div class="sidebar-section">
|
229 |
+
<h3>π Helpful Resources</h3>
|
230 |
+
<div class="sidebar-links">
|
231 |
+
<ul style='padding-left: 1em'>
|
232 |
+
<li><a href="https://www.loc.gov/apis/" target="_blank">LOC API Info</a></li>
|
233 |
+
<li><a href="https://www.loc.gov/" target="_blank">Library of Congress Homepage</a></li>
|
234 |
+
<li><a href="https://www.loc.gov/collections/" target="_blank">LOC Digital Collections</a></li>
|
235 |
+
<li><a href="https://www.loc.gov/marc/" target="_blank">MARC Metadata Standards</a></li>
|
236 |
+
<li><a href="https://labs.loc.gov/about-labs/digital-strategy/" target="_blank">LOC Digital Strategy</a></li>
|
237 |
+
</ul>
|
238 |
+
</div>
|
239 |
+
</div>
|
240 |
+
""", unsafe_allow_html=True)
|
241 |
+
|
242 |
+
|
243 |
+
|
244 |
+
|
245 |
+
# Render collapsible green completeness table in sidebar
|
246 |
+
with st.sidebar.expander("π Field Completeness Breakdown", expanded=True):
|
247 |
+
st.dataframe(
|
248 |
+
completeness_table.style.background_gradient(cmap="Greens").format("{:.1f}%"),
|
249 |
+
use_container_width=True,
|
250 |
+
height=240
|
251 |
+
)
|
252 |
+
|
253 |
+
with st.sidebar.expander("π Helpful Resources", expanded=False):
|
254 |
+
st.markdown("""
|
255 |
+
<style>
|
256 |
+
.sidebar-links a {
|
257 |
+
color: lightgray !important;
|
258 |
+
text-decoration: none !important;
|
259 |
+
}
|
260 |
+
.sidebar-links a:hover {
|
261 |
+
text-decoration: underline !important;
|
262 |
+
}
|
263 |
+
</style>
|
264 |
+
<div class="sidebar-links">
|
265 |
+
<ul style='padding-left: 1em'>
|
266 |
+
<li><a href="https://www.loc.gov/apis/" target="_blank">LOC API Info</a></li>
|
267 |
+
<li><a href="https://www.loc.gov/" target="_blank">Library of Congress Homepage</a></li>
|
268 |
+
<li><a href="https://www.loc.gov/collections/" target="_blank">LOC Digital Collections</a></li>
|
269 |
+
<li><a href="https://www.loc.gov/marc/" target="_blank">MARC Metadata Standards</a></li>
|
270 |
+
<li><a href="https://labs.loc.gov/about-labs/digital-strategy/" target="_blank">LOC Digital Strategy</a></li>
|
271 |
+
</ul>
|
272 |
+
</div>
|
273 |
""", unsafe_allow_html=True)
|
274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
# Utility functions for deeper metadata quality analysis
|
276 |
def is_incomplete(value):
|
277 |
return pd.isna(value) or value in ["", "N/A", "null", None]
|
|
|
330 |
incomplete_mask = metadata_df.map(is_incomplete).any(axis=1)
|
331 |
incomplete_records = metadata_df[incomplete_mask]
|
332 |
|
333 |
+
st.subheader("Suggested Metadata Enhancements")
|
334 |
|
335 |
incomplete_with_desc = incomplete_records[incomplete_records['description'].notnull()]
|
336 |
reference_df = metadata_df[metadata_df['subject'].notnull() & metadata_df['description'].notnull()]
|