Skip to content

Commit

Permalink
Fix for annotations in the journal filter
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrotsmnrd committed Aug 28, 2024
1 parent 0f6a0b1 commit 95c0dcf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions web/dashboard/main_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ def __init__(self, datasets, **params):

self.journal_select_picker = SelectPicker.from_param(
self.param.filter_journal,
annotations=self.get_col_values_with_count("journal"),
annotations={
row[0]: row[1]
for row in self.raw_data.journal.value_counts().reset_index().values
},
update_title_callback=lambda select_picker,
values,
options: self.new_picker_title("journals", select_picker, values, options),
Expand Down Expand Up @@ -230,7 +233,13 @@ def did_change_extraction_tool(self):
self.filter_pubdate = (self.raw_data.year.min(), self.raw_data.year.max())

## filter_journal
self.param.filter_journal.objects = self.raw_data.journal.unique()

self.param.filter_journal.objects = (
self.raw_data.journal.value_counts().index.to_list()
)
# If we don't want to sort the journals by number of paper,
# but by alphabetical order, we can use this instead:
# self.param.filter_journal.objects = self.raw_data.journal.unique()

## affiliation country
countries_with_count = self.get_col_values_with_count("affiliation_country")
Expand Down

0 comments on commit 95c0dcf

Please sign in to comment.