Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +22 -6
src/streamlit_app.py
CHANGED
|
@@ -378,19 +378,19 @@ with tab1:
|
|
| 378 |
try:
|
| 379 |
import re
|
| 380 |
import urllib.parse
|
| 381 |
-
|
| 382 |
# Parse the URL
|
| 383 |
parsed = urllib.parse.urlparse(openalex_url)
|
| 384 |
query_params = urllib.parse.parse_qs(parsed.query)
|
| 385 |
-
|
| 386 |
# Build API URL - OpenAlex API format
|
| 387 |
api_url = "https://api.openalex.org/works"
|
| 388 |
-
|
| 389 |
# Extract filter parameter
|
| 390 |
if 'filter' in query_params:
|
| 391 |
filter_value = query_params['filter'][0]
|
| 392 |
api_url = f"{api_url}?filter={filter_value}"
|
| 393 |
-
|
| 394 |
# Add per-page parameter
|
| 395 |
separator = '&' if '?' in api_url else '?'
|
| 396 |
api_url = f"{api_url}{separator}per-page=200"
|
|
@@ -418,7 +418,7 @@ with tab1:
|
|
| 418 |
import urllib.request
|
| 419 |
req = urllib.request.Request(page_url)
|
| 420 |
req.add_header('User-Agent', 'Mozilla/5.0 (mailto:your@email.com)')
|
| 421 |
-
|
| 422 |
with urllib.request.urlopen(req) as response:
|
| 423 |
data = json.loads(response.read().decode())
|
| 424 |
results = data.get('results', [])
|
|
@@ -552,9 +552,25 @@ if st.session_state.works:
|
|
| 552 |
with col5:
|
| 553 |
sort_by = st.selectbox(
|
| 554 |
"Sort By",
|
| 555 |
-
["Count", "Average Citations", "Median Citations"
|
| 556 |
help="How to sort the results"
|
| 557 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
|
| 559 |
# Search button
|
| 560 |
if st.button("🔍 Search Authors", type="primary"):
|
|
|
|
| 378 |
try:
|
| 379 |
import re
|
| 380 |
import urllib.parse
|
| 381 |
+
|
| 382 |
# Parse the URL
|
| 383 |
parsed = urllib.parse.urlparse(openalex_url)
|
| 384 |
query_params = urllib.parse.parse_qs(parsed.query)
|
| 385 |
+
|
| 386 |
# Build API URL - OpenAlex API format
|
| 387 |
api_url = "https://api.openalex.org/works"
|
| 388 |
+
|
| 389 |
# Extract filter parameter
|
| 390 |
if 'filter' in query_params:
|
| 391 |
filter_value = query_params['filter'][0]
|
| 392 |
api_url = f"{api_url}?filter={filter_value}"
|
| 393 |
+
|
| 394 |
# Add per-page parameter
|
| 395 |
separator = '&' if '?' in api_url else '?'
|
| 396 |
api_url = f"{api_url}{separator}per-page=200"
|
|
|
|
| 418 |
import urllib.request
|
| 419 |
req = urllib.request.Request(page_url)
|
| 420 |
req.add_header('User-Agent', 'Mozilla/5.0 (mailto:your@email.com)')
|
| 421 |
+
|
| 422 |
with urllib.request.urlopen(req) as response:
|
| 423 |
data = json.loads(response.read().decode())
|
| 424 |
results = data.get('results', [])
|
|
|
|
| 552 |
with col5:
|
| 553 |
sort_by = st.selectbox(
|
| 554 |
"Sort By",
|
| 555 |
+
["Count", "Average Citations", "Median Citations"],
|
| 556 |
help="How to sort the results"
|
| 557 |
)
|
| 558 |
+
|
| 559 |
+
# Additional display options
|
| 560 |
+
st.markdown("**Display Options:**")
|
| 561 |
+
col6, col7 = st.columns(2)
|
| 562 |
+
with col6:
|
| 563 |
+
link_type = st.selectbox(
|
| 564 |
+
"Link Author Names To",
|
| 565 |
+
["None", "ORCID", "OpenAlex"],
|
| 566 |
+
help="Make author names clickable links"
|
| 567 |
+
)
|
| 568 |
+
with col7:
|
| 569 |
+
link_topics = st.checkbox(
|
| 570 |
+
"Link Topics to OpenAlex",
|
| 571 |
+
value=True,
|
| 572 |
+
help="Make topic names clickable"
|
| 573 |
+
)
|
| 574 |
|
| 575 |
# Search button
|
| 576 |
if st.button("🔍 Search Authors", type="primary"):
|