INLEXIO commited on
Commit
a8b141c
·
verified ·
1 Parent(s): 4794344

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +22 -10
src/streamlit_app.py CHANGED
@@ -607,7 +607,7 @@ with tab3:
607
  step=100,
608
  help="Maximum number of works to retrieve (Warning: >10,000 may be slow)",
609
  key="api_max_results"
610
- )
611
  api_author_name = st.text_input(
612
  "Author Name",
613
  placeholder="e.g., John Smith",
@@ -626,6 +626,22 @@ with tab3:
626
  help="Search by topic or keyword"
627
  )
628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
629
 
630
  api_max_results = st.number_input(
631
  "Maximum Results",
@@ -669,18 +685,14 @@ with tab3:
669
  if api_max_citations > 0:
670
  filters.append(f'cited_by_count:<{api_max_citations + 1}')
671
 
672
- # Add journal filters
673
  if api_journals:
674
  journal_list = [j.strip() for j in api_journals.split('\n') if j.strip()]
675
  if journal_list:
676
- # URL encode journal names to handle spaces and special characters
677
- import urllib.parse
678
- journal_filters = []
679
- for j in journal_list:
680
- encoded_journal = urllib.parse.quote(j)
681
- journal_filters.append(f'primary_location.source.display_name.search:{encoded_journal}')
682
- # Join with pipe for OR logic, but don't wrap in parentheses for the filter
683
- filters.append('|'.join(journal_filters))
684
 
685
  # Add article/review/letter filter
686
  filters.append('type:article|review|letter')
 
607
  step=100,
608
  help="Maximum number of works to retrieve (Warning: >10,000 may be slow)",
609
  key="api_max_results"
610
+ ):
611
  api_author_name = st.text_input(
612
  "Author Name",
613
  placeholder="e.g., John Smith",
 
626
  help="Search by topic or keyword"
627
  )
628
 
629
+ with col2:
630
+ api_year_from = st.number_input(
631
+ "Publication Year From",
632
+ min_value=1900,
633
+ max_value=2025,
634
+ value=2020,
635
+ help="Start year for publication range"
636
+ )
637
+
638
+ api_year_to = st.number_input(
639
+ "Publication Year To",
640
+ min_value=1900,
641
+ max_value=2025,
642
+ value=2025,
643
+ help="End year for publication range"
644
+ )
645
 
646
  api_max_results = st.number_input(
647
  "Maximum Results",
 
685
  if api_max_citations > 0:
686
  filters.append(f'cited_by_count:<{api_max_citations + 1}')
687
 
688
+ # Add journal filters - use display_name.search with OR
689
  if api_journals:
690
  journal_list = [j.strip() for j in api_journals.split('\n') if j.strip()]
691
  if journal_list:
692
+ # Create OR filter for journals using pipe separator
693
+ # Format: primary_location.source.display_name.search:journal1|journal2|journal3
694
+ journal_search = '|'.join(journal_list)
695
+ filters.append(f'primary_location.source.display_name.search:{journal_search}')
 
 
 
 
696
 
697
  # Add article/review/letter filter
698
  filters.append('type:article|review|letter')