SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 89963927 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add citedby impact factor calculation for journal

parent 6d792d98
No related branches found
No related tags found
No related merge requests found
......@@ -158,6 +158,23 @@ class Journal(models.Model):
deltat += (pub.latest_citedby_update.date() - pub.publication_date).days
return (ncites * 365.25/deltat)
def citedby_impact_factor(self, year):
"""
Computes the impact factor for a given year YYYY, from Crossref cited-by data.
This is defined as the total number of citations in year YYYY
for all papers published in years YYYY-1 and YYYY-2, divided
by the number of papers published in year YYYY.
"""
publications = self.get_publications().filter(
models.Q(publication_date__year=year-1) | models.Q(publication_date__year=year-2))
nrpub = publications.count()
if nrpub == 0:
return 0
ncites = 0
for pub in publications:
if pub.citedby and pub.latest_citedby_update:
ncites += len(pub.citedby)
return ncites/nrpub
class Volume(models.Model):
"""
......
......@@ -42,6 +42,9 @@
{% if journal %}
<h2>Results:</h2>
{% if year %}
<h3>Impact factor (Cited-by) for {{ year }}: {{ citedby_impact_factor }}</h3>
{% endif %}
<table class="table">
<tr>
<th>DOI label</th>
......
......@@ -22,6 +22,7 @@ def statistics(request, journal_doi_label=None, volume_nr=None, issue_nr=None, y
context['journal'] = journal
if year:
context['year'] = year
context['citedby_impact_factor'] = journal.citedby_impact_factor(year)
submissions = Submission.objects.filter(
submitted_to_journal=journal_doi_label).originally_submitted(
datetime.date(int(year), 1, 1), datetime.date(int(year), 12, 31))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment