Tutorial#

Here we will show the basic commands for working with pygscholar. When you install pygscholar you will get access to the scholar command which you can use in the terminal. In this tutorial we are running the commands from a notebook and therefore all commands starts with a !. However if you are using a terminal, then you should not use the ! in front of the command.

The help option#

To see all the available options, you can type

$ scholar --help
!scholar --help
                                                                                
 Usage: scholar [OPTIONS] COMMAND [ARGS]...                                     
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --version                                            Show version            
 --license                                            Show license            
 --install-completion        [bash|zsh|fish|powershe  Install completion for  
                             ll|pwsh]                 the specified shell.    
                                                      [default: None]         
 --show-completion           [bash|zsh|fish|powershe  Show completion for the 
                             ll|pwsh]                 specified shell, to     
                                                      copy it or customize    
                                                      the installation.       
                                                      [default: None]         
 --help                                               Show this message and   
                                                      exit.                   
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
 add-author                       Add new author                              
 list-author-publications         List authors publications                   
 list-authors                     List all authors                            
 list-department-publications     List department publications                
 list-new-dep-publications        List new publications for the department    
 post-slack-new-dep-publications  Post new publications for the department to 
                                  Slack                                       
 remove-author                    Remove author                               
 search-author                    Search for authors                          
╰──────────────────────────────────────────────────────────────────────────────╯

This will list all the available options with a message explaining the different sub-commands. For each sub-command you can also use the --help option, e.g

$ scholar add-author --help
!scholar add-author --help
                                                                                
 Usage: scholar add-author [OPTIONS] NAME                                       
                                                                                
 Add new author                                                                 
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
 *    name      TEXT  [default: None] [required]                              
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --scholar-id        TEXT                                                     
 --cache-dir         TEXT  [default: /home/runner/.pygscholar]                
 --help                    Show this message and exit.                        
╰──────────────────────────────────────────────────────────────────────────────╯

Adding an author to your database#

The way pygscholar works is that you need to add authors to a database in order for pygscholar to find them. First we can try to list all the authors in our database using the command

$ scholar list-authors
!scholar list-authors
       Authors       
┏━━━━━━┳━━━━━━━━━━━━┓
┃ Name  Scholar ID ┃
┡━━━━━━╇━━━━━━━━━━━━┩
└──────┴────────────┘

Now we could try to add an author to the database by using the command

$ scholar add-author <name of author>

e.g

$ scholar add-author 'Henrik Finsberg'
!scholar add-author 'Henrik Finsberg'
Cache dir /home/runner/.pygscholar does not exist. Creating...
2023-01-10 09:04:23 [info     ] Get author info for Henrik Finsberg
Successfully added author with name Henrik Nicolay Finsberg and scholar id NDPIHoEAAAAJ

You can now try to list the authors again

!scholar list-authors
Henrik Nicolay Finsberg
                 Authors                  
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃                    Name  Scholar ID   ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ Henrik Nicolay Finsberg  NDPIHoEAAAAJ │
└─────────────────────────┴──────────────┘

As we can see, we didn’t type the full name (i.e Henrik Nicolay Finsberg), but the program was still able to find the correct author. Sometimes there are more than one person with the same name, in which case you can use the Scholar ID to specify which person you mean. We can first use the command

$ scholar search-author

to search for an author. This would be equivalent of searching for an author at Google Scholar. Let us say that we want to add a person with surname ‘Sundnes’ that we know work at Simula Research Laboratory. We can then search for Sundnes

$ scholar search-author 'Sundnes'
!scholar search-author 'Sundnes'
                      Search results for author 'Sundnes'                       
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ Name                   Scholar ID    Affiliation                 Cited by ┃
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ Joakim Sundnes         YfOpQUcAAAAJ  Simula Research Laboratory  2471     │
│ Anders Sundnes Løvlie  UhP1dScAAAAJ  IT University of            451      │
│                                      Copenhagen                           │
│ Tomas Sundnes Drønen   9VMwxKAAAAAJ  VID vitenskapelige          173      │
│                                      høgskole                             │
│ Frode Sundnes          4T4561wAAAAJ  Norwegian Institute for     78       │
│                                      Water Research                       │
└───────────────────────┴──────────────┴────────────────────────────┴──────────┘

We see that, the person we are looking for is Joakim Sundnes, so we could go ahead an add this author, or we could use the Scholar ID as follows

$ scholar add-author 'Sundnes' --scholar-id=YfOpQUcAAAAJ
!scholar add-author 'Sundnes' --scholar-id=YfOpQUcAAAAJ
2023-01-10 09:04:30 [info     ] Get author info for Sundnes
Successfully added author with name Joakim Sundnes and scholar id YfOpQUcAAAAJ

We can now list the authors again

!scholar list-authors
Henrik Nicolay Finsberg
Joakim Sundnes
                 Authors                  
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃                    Name  Scholar ID   ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ Henrik Nicolay Finsberg  NDPIHoEAAAAJ │
│          Joakim Sundnes  YfOpQUcAAAAJ │
└─────────────────────────┴──────────────┘

Listing author publications#

The next command we want to look at is the command

$ scholar list-author-publications

We can take a look at the help section first

!scholar list-author-publications --help
                                                                                
 Usage: scholar list-author-publications [OPTIONS] NAME                         
                                                                                
 List authors publications                                                      
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
 *    name      TEXT  [default: None] [required]                              
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --n                                            INTEGER  [default: 5]         
 --sort-by-citations    --no-sort-by-citati…             [default:            
                                                         sort-by-citations]   
 --add-authors          --no-add-authors                 [default:            
                                                         no-add-authors]      
 --max-age                                      INTEGER  [default: None]      
 --cache-dir                                    TEXT     [default:            
                                                         /home/runner/.pygsc… 
 --help                                                  Show this message    
                                                         and exit.            
╰──────────────────────────────────────────────────────────────────────────────╯

We see that the command takes a name, which is the name of the author. Let us try it on one of the names in the database

!scholar list-author-publications 'Henrik Finsberg'
Could not find author with name 'Henrik Finsberg'. Will use 'Henrik Nicolay Finsberg' instead
2023-01-10 09:04:35 [info     ] Get author info for Henrik Nicolay Finsberg
         Publications for Henrik Nicolay Finsberg (Sorted by citations)         
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ Title                                  Published year  Number of citations ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ Efficient estimation of personalized   2018            33                  │
│ biventricular mechanical function                                          │
│ employing gradient‐based optimization                                      │
│ Improved computational identification  2020            31                  │
│ of drug response using optical                                             │
│ measurements of human stem cell                                            │
│ derived cardiomyocytes in                                                  │
│ microphysiological systems                                                 │
│ Estimating cardiac contraction         2018            24                  │
│ through high resolution data                                               │
│ assimilation of a personalized                                             │
│ mechanical model                                                           │
│ In vivo estimation of elastic          2018            18                  │
│ heterogeneity in an infarcted human                                        │
│ heart                                                                      │
│ High‐resolution data assimilation of   2017            16                  │
│ cardiac mechanics applied to a                                             │
│ dyssynchronous ventricle                                                   │
└───────────────────────────────────────┴────────────────┴─────────────────────┘

We see that it will display the 5 most cited papers, sorted with the most cited paper on top. We can also choose to display only 3 papers (using the --n flag), and we can also choose to not display papers that are more than two years old (using the --max-age flag). Let us also add all the authors on the papers for each row using the --add-authors flag

$ scholar list-author-publications 'Henrik Finsberg' --n=3 --max-age=2 --add-authors
!scholar list-author-publications 'Henrik Finsberg' --n=3 --max-age=2 --add-authors
Could not find author with name 'Henrik Finsberg'. Will use 'Henrik Nicolay Finsberg' instead
2023-01-10 09:04:41 [info     ] Get author info for Henrik Nicolay Finsberg
         Publications for Henrik Nicolay Finsberg (Sorted by citations)         
┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓
┃                                                        Number of          ┃
┃ Title               Authors            Published year  citations          ┃
┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩
│ In vitro safety     Bérénice Charrez   2021            8                  │
│ “clinical trial”    and Verena                                            │
│ of the cardiac      Charwat and Brian                                     │
│ liability of drug   Siemons and                                           │
│ polytherapy         Henrik Finsberg                                       │
│                     and Evan W Miller                                     │
│                     and Andrew G                                          │
│                     Edwards and Kevin                                     │
│                     E Healy                                               │
│ Heart muscle        Bérénice Charrez   2021            7                  │
│ microphysiological  and Verena                                            │
│ system for cardiac  Charwat and Brian                                     │
│ liability           A Siemons and                                         │
│ prediction of       Ishan Goswami and                                     │
│ repurposed          Courtney Sakolish                                     │
│ COVID-19            and Yu-Syuan Luo                                      │
│ therapeutics        and Henrik                                            │
│                     Finsberg and                                          │
│                     Andrew G Edwards                                      │
│                     and Evan W Miller                                     │
│                     and Ivan Rusyn                                        │
│                     and Kevin E Healy                                     │
│ Regional Left       Mohammad Albatat   2022            0                  │
│ Ventricular Fiber   and Henrik                                            │
│ Stress Analysis     Nicolay Finsberg                                      │
│ for Cardiac         and Hermenegild                                       │
│ Resynchronization   Arevalo and                                           │
│ Therapy Response    Joakim Sundnes                                        │
│                     and Jacob                                             │
│                     Bergsland and                                         │
│                     Ilangko                                               │
│                     Balasingham and                                       │
│                     Hans Henrik                                           │
│                     Odland                                                │
└────────────────────┴───────────────────┴────────────────┴────────────────────┘

Listing publications for the whole department#

Our department now consists of two researchers (Henrik Finsberg and Joakim Sundnes), but you could imaging that you have a lot of researchers in your department. It would then be nice to list the most cited papers across the whole department. We can do this with the

$ scholar list-department-publications

command. Let us first loook at the help menu

!scholar list-department-publications --help
                                                                                
 Usage: scholar list-department-publications [OPTIONS]                          
                                                                                
 List department publications                                                   
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --n                                            INTEGER  [default: 5]         
 --sort-by-citations    --no-sort-by-citati…             [default:            
                                                         sort-by-citations]   
 --add-authors          --no-add-authors                 [default:            
                                                         no-add-authors]      
 --max-age                                      INTEGER  [default: None]      
 --cache-dir                                    TEXT     [default:            
                                                         /home/runner/.pygsc… 
 --help                                                  Show this message    
                                                         and exit.            
╰──────────────────────────────────────────────────────────────────────────────╯

Let us list the most cited papers not older than 2 year using the command

$ scholar list-department-publications --max-age=2
!scholar list-department-publications --max-age=2
2023-01-10 09:04:53 [info     ] Get publication for Henrik Nicolay Finsberg with id NDPIHoEAAAAJ
2023-01-10 09:04:53 [info     ] Get author info for Henrik Nicolay Finsberg
2023-01-10 09:04:53 [info     ] Get publication for Joakim Sundnes with id YfOpQUcAAAAJ
2023-01-10 09:04:53 [info     ] Get author info for Joakim Sundnes
               Publications for department (Sorted by citations)                
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ Title                                  Published year  Number of citations ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ Nationwide rollout reveals efficacy    2021            14                  │
│ of epidemic control through digital                                        │
│ contact tracing                                                            │
│ Computational modeling studies of the  2021            12                  │
│ roles of left ventricular geometry,                                        │
│ afterload, and muscle contractility                                        │
│ on myocardial strains in heart                                             │
│ failure with preserved ejection …                                          │
│ In vitro safety “clinical trial” of    2021            8                   │
│ the cardiac liability of drug                                              │
│ polytherapy                                                                │
│ Heart muscle microphysiological        2021            7                   │
│ system for cardiac liability                                               │
│ prediction of repurposed COVID-19                                          │
│ therapeutics                                                               │
│ A Computational Study of the Effects   2021            5                   │
│ of Tachycardia-Induced Remodeling on                                       │
│ Calcium Wave Propagation in Rabbit                                         │
│ Atrial Myocytes                                                            │
└───────────────────────────────────────┴────────────────┴─────────────────────┘

We can also get the 5 most recent publications using the --no-sort-by-citations flag

!scholar list-department-publications --no-sort-by-citations
2023-01-10 09:05:02 [info     ] Get publication for Henrik Nicolay Finsberg with id NDPIHoEAAAAJ
2023-01-10 09:05:02 [info     ] Get author info for Henrik Nicolay Finsberg
2023-01-10 09:05:02 [info     ] Get publication for Joakim Sundnes with id YfOpQUcAAAAJ
2023-01-10 09:05:02 [info     ] Get author info for Joakim Sundnes
                  Publications for department (Sorted by age)                   
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ Title                                  Published year  Number of citations ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ A cell-based framework for modeling    2023            0                   │
│ cardiac mechanics                                                          │
│ Validating the Arrhythmogenic          2022            0                   │
│ Potential of High-, Intermediate-,                                         │
│ and Low-Risk Drugs in a Human-Induced                                      │
│ Pluripotent Stem Cell-Derived Cardiac                                      │
│ Microphysiological System                                                  │
│ Computational models of ventricular    2022            0                   │
│ mechanics and adaptation in response                                       │
│ to right-ventricular pressure                                              │
│ overload                                                                   │
│ Computational cardiac physiology for   2022            0                   │
│ new modelers: Origins, foundations,                                        │
│ and future                                                                 │
│ A computational model of right         2022            0                   │
│ ventricular remodelling in the                                             │
│ presence of pulmonary arterial                                             │
│ hypertension                                                               │
└───────────────────────────────────────┴────────────────┴─────────────────────┘

It is also to possible to list new publications using the command

$ scholar list-new-dep-publications