papers.models module

This module defines most of the models used in the platform.

  • Paper represents a (deduplicated) paper.

    The sources it has been discovered from are witnessed by two types of records:

    • OaiRecord instances are created by OAI-PMH sources, or metadata sources not originally in OAI-PMH but wrapped in this format by proaixy. They indicate the availability of the paper in repositories. They link to an OaiSource object that indicates what data source we have got this record from.

    Multiple OaiRecord can (and typically are) associated with a paper, when the metadata they contain yield the same paper fingerprint. These records are stored inside the Paper object in a JSON field.

  • Researcher represents a researcher profile (a physical person).

    This person has a cannonical Name, but can also be associated with other names through a NameVariant relation (indicating a confidence value for the association of the name with this reseracher).

  • Researchers can be organized into Department instances, which belong to an Institution.

class papers.models.Department(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A department in an institution. Each Researcher is affiliated with exactly one department. :param name: the full name of the department

Parameters:
  • id (AutoField) – Id
  • name (CharField) – Name
  • institution_id (ForeignKey) – Institution
  • stats_id (ForeignKey) – Stats
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Department.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Department.breadcrumbs()[source]
Department.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Department.institution

The institution it belongs to

Department.institution_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Department.name

The full name of the department

Department.object_id

Criteria to use in the search view to filter on this department

Department.objects = <django.db.models.manager.Manager object>
Department.researcher_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Department.sorted_researchers

List of Researcher in this department sorted by last name (prefetches their stats as well)

Department.stats

AccessStatistics about the papers authored in this department

Department.stats_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Department.update_stats()[source]

Refreshes the department-level access statistics for that department.

Department.url

The URL of the main page (list of researchers) for this department.

class papers.models.Institution(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A university or research institute.

Parameters:
  • id (AutoField) – Id
  • name (CharField) – Name
  • identifiers (ArrayField) – Identifiers
  • country (CountryField) – Country
  • coords (PointField) – Coords
  • stats_id (ForeignKey) – Stats
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Institution.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Institution.breadcrumbs()[source]
Institution.coords

Coordinates

Institution.country

Country code

classmethod Institution.create(dct)[source]

Given a dictionary representing an institution, as returned by OrcidProfile.institution, save the institution in the DB (or return an existing duplicate).

The dictionary should contain ‘name’ and ‘country’ values, and possibly an identifier (such as a Ringgold one).

Returns None if the institution is invalid (invalid country code, name too long…)

Institution.department_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Institution.get_country_display(*moreargs, **morekwargs)
Institution.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Institution.identifiers

A list of identifiers for the institution (eg: ringgold-2167 for MIT)

Institution.merge(i)[source]

Merges another institution into self

Institution.name

The full name of the institution

Institution.object_id

Criteria to use in the search view to filter on this department

Institution.objects = <django.db.models.manager.Manager object>
Institution.researcher_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Institution.slug
Institution.sorted_departments

Departments belonging to this institution, sorted by name.

Institution.sorted_researchers

List of Researcher who are directly affiliated to this institution, without department.

sorted by last name (prefetches their stats as well)
Institution.stats

AccessStatistics about the papers authored in this institution.

Institution.stats_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Institution.update_coords(sleep_time=5)[source]

Attempts to fetch the position of the institution via OpenStreetMap Nominatim.

Institution.update_stats()[source]

Refreshes the institution-level access statistics.

Institution.url

The URL of the main page (list of departments for this institution).

class papers.models.Name(id, first, last, full, best_confidence)[source]

Bases: django.db.models.base.Model, papers.baremodels.BareName

Parameters:
  • id (AutoField) – Id
  • first (CharField) – First
  • last (CharField) – Last
  • full (CharField) – Full
  • best_confidence (FloatField) – Best confidence
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Name.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Name.best_confidence

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Name.first

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod Name.from_bare(bare_name)[source]

Calls lookup_name for the given bare_name, if it is indeed bare..

Name.full

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod Name.get_or_create(first, last)[source]

Replacement for the regular get_or_create, so that the full name is built based on first and last

Name.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Name.is_known

Does this name belong to at least one known Researcher?

Name.last

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod Name.lookup_name(author_name)[source]

Lookup a name (pair of (first,last)) in the model. If there is already such a name in the database, returns it, otherwise creates one properly.

In addition to get_or_create, this looks for relevant researchers whose name might match this one.

Name.namevariant_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Name.object_id

Criteria to use in the search view to filter on this name

Name.objects = <django.db.models.manager.Manager object>
Name.researcher_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Name.save_if_not_saved()[source]

Used to save unsaved names after lookup

class papers.models.NameVariant(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A NameVariant is a binary relation between names and researchers. When present, it indicates that a given name is a possible name for the researcher. The confidence that papers with that name are authored by the given researcher is indicated by a confidence score.

Parameters:
  • id (AutoField) – Id
  • name_id (ForeignKey) – Name
  • researcher_id (ForeignKey) – Researcher
  • confidence (FloatField) – Confidence
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception NameVariant.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

NameVariant.confidence

The similarity score between this name and one of the reference names for this researcher

NameVariant.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

NameVariant.name

The Name that is part of the relation

NameVariant.name_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

NameVariant.objects = <django.db.models.manager.Manager object>
NameVariant.researcher

The Researcher to which the name is attributed

NameVariant.researcher_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class papers.models.OaiRecord(id, source, about, identifier, splash_url, pdf_url, description, keywords, contributors, pubtype, journal_title, container, journal, publisher, publisher_name, issue, volume, pages, pubdate, doi, last_update, priority)[source]

Bases: django.db.models.base.Model, papers.baremodels.BareOaiRecord

Parameters:
  • id (AutoField) – Id
  • source_id (ForeignKey) – Source
  • about_id (ForeignKey) – About
  • identifier (CharField) – Identifier
  • splash_url (URLField) – Splash url
  • pdf_url (URLField) – Pdf url
  • description (TextField) – Description
  • keywords (TextField) – Keywords
  • contributors (CharField) – Contributors
  • pubtype (CharField) – Pubtype
  • journal_title (CharField) – Journal title
  • container (CharField) – Container
  • journal_id (ForeignKey) – Journal
  • publisher_id (ForeignKey) – Publisher
  • publisher_name (CharField) – Publisher name
  • issue (CharField) – Issue
  • volume (CharField) – Volume
  • pages (CharField) – Pages
  • pubdate (DateField) – Pubdate
  • doi (CharField) – Doi
  • last_update (DateTimeField) – Last update
  • priority (IntegerField) – Priority
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OaiRecord.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OaiRecord.about

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

OaiRecord.about_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.container

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.contributors

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.depositrecord_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

OaiRecord.description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.doi

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod OaiRecord.find_duplicate_records(paper, splash_url, pdf_url)[source]

Finds duplicate OAI records. These duplicates can have a different identifier, or slightly different urls (for instance https:// instead of http://).

Parameters:
  • paper – the Paper the record is about
  • splash_url – the splash url of the target record (link to the metadata page)
  • pdf_url – the url of the PDF, if known (otherwise None)
OaiRecord.get_next_by_last_update(*moreargs, **morekwargs)
OaiRecord.get_previous_by_last_update(*moreargs, **morekwargs)
OaiRecord.get_pubtype_display(*moreargs, **morekwargs)
OaiRecord.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.identifier

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.issue

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.journal

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

OaiRecord.journal_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.journal_title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.keywords

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.last_update

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod OaiRecord.new(**kwargs)[source]

Creates a new OAI record by checking first for duplicates and updating them if necessary.

OaiRecord.objects = <django.db.models.manager.Manager object>
OaiRecord.pages

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.pdf_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.priority

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.pubdate

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.publisher

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

OaiRecord.publisher_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.publisher_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.pubtype

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.source

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

OaiRecord.source_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.splash_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiRecord.update_priority()[source]
OaiRecord.volume

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class papers.models.OaiSource(id, identifier, name, oa, priority, default_pubtype, last_status_update)[source]

Bases: caching.base.CachingMixin, django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • identifier (CharField) – Identifier
  • name (CharField) – Name
  • oa (BooleanField) – Oa
  • priority (IntegerField) – Priority
  • default_pubtype (CharField) – Default pubtype
  • last_status_update (DateTimeField) – Last status update
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OaiSource.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OaiSource.default_pubtype

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiSource.get_default_pubtype_display(*moreargs, **morekwargs)
OaiSource.get_next_by_last_status_update(*moreargs, **morekwargs)
OaiSource.get_previous_by_last_status_update(*moreargs, **morekwargs)
OaiSource.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiSource.identifier

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiSource.last_status_update

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiSource.name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiSource.natural_key()[source]
OaiSource.oa

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiSource.oairecord_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

OaiSource.objects = <papers.models.OaiSourceManager object>
OaiSource.priority

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OaiSource.repository_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class papers.models.OaiSourceManager[source]

Bases: caching.base.CachingManager

get_by_natural_key(identifier)[source]
class papers.models.Paper(id, title, fingerprint, date_last_ask, pubdate, authors_list, last_modified, visible, last_annotation, doctype, oa_status, pdf_url, task)[source]

Bases: django.db.models.base.Model, papers.baremodels.BarePaper

Parameters:
  • id (AutoField) – Id
  • title (CharField) – Title
  • fingerprint (CharField) – Fingerprint
  • date_last_ask (DateField) – Date last ask
  • pubdate (DateField) – Pubdate
  • authors_list (JSONField) – Authors list
  • last_modified (DateTimeField) – Last modified
  • visible (BooleanField) – Visible
  • last_annotation (CharField) – Last annotation
  • doctype (CharField) – Doctype
  • oa_status (CharField) – Oa status
  • pdf_url (URLField) – Pdf url
  • task (CharField) – Task
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Paper.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Paper.add_author(author, position=None)[source]

Add an author at the end of the authors list by default or at the specified position.

The change is not commited to the database (you need to call save() afterwards).

Parameters:position – add the author at that index.
Paper.add_oairecord(oairecord)[source]

Adds a record (possibly bare) to the paper, by saving it in the database

Paper.already_asked_for_upload()[source]
Paper.author_name_pairs()[source]

The authors’ names, represented as (first,last) pairs.

Paper.authors

The author sorted as they should appear. Their names are pre-fetched.

Paper.authors_list

Full list of authors for this paper

Paper.breadcrumbs()[source]

Returns the navigation path to the paper, for display as breadcrumbs in the template.

Paper.cache_oairecords()[source]

Fetches once the cache for child OaiRecords. The reason why we’re not doing this explicitly in self.oairecords is that sometimes we need fresh oairecords and so caching is not always desirable.

Paper.can_be_asked_for_upload()[source]
Paper.can_be_deposited(user)[source]

Returns true when this paper can be deposited in at least one repository configured on this Dissemin instance.

Paper.combined_status

The combined status of the paper (availability and policy)

Paper.consolidate_metadata(wait=True)[source]

Tries to find an abstract for the paper, if none is available yet, possibly by fetching it from Zotero via doi-cache.

classmethod Paper.create_by_doi(doi, bare=False)[source]

Creates a paper given a DOI

classmethod Paper.create_by_hal_id(id, bare=False)[source]

Creates a paper given a HAL id (e.g. hal-01227383)

classmethod Paper.create_by_oai_id(id, metadataPrefix=u'base_dc', bare=False)[source]

Creates a paper by its OAI identifier.

Paper.date_last_ask

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Paper.depositrecord_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Paper.doctype

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod Paper.find_by_fingerprint(fp)[source]
Paper.fingerprint

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod Paper.from_bare(paper)[source]

Saves a paper to the database if it is not already present. The clustering algorithm is run to decide what authors should be attributed to the paper.

Returns:the Paper instance created from the bare paper supplied.
classmethod Paper.get_by_doi(doi)[source]

Finds the paper associated to that DOI (if any)

Paper.get_doctype_display(*moreargs, **morekwargs)
Paper.get_next_by_last_modified(*moreargs, **morekwargs)
Paper.get_next_by_pubdate(*moreargs, **morekwargs)
classmethod Paper.get_or_create(title, author_names, pubdate, visible=True, affiliations=None)[source]

Creates an (initially) bare paper and saves it to the database.

Returns:the corresponding Paper instance.
Paper.get_previous_by_last_modified(*moreargs, **morekwargs)
Paper.get_previous_by_pubdate(*moreargs, **morekwargs)
Paper.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Paper.invalidate_cache()[source]

Invalidate the HTML cache for all the publications of this researcher.

Paper.is_deposited
Paper.is_owned_by(user)[source]

Is this user one of the owners of that paper?

Paper.last_annotation

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Paper.last_modified

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Paper.merge(paper)[source]

Merges another paper into self. This deletes the other paper. We do our best to unify all the metadata parts, but of course there will always be some mistakes as there is no way to find out which metadata part is best in general.

Parameters:paper – The second paper to merge and delete.
Paper.oa_status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Paper.oairecord_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Paper.oairecords

The list of OAI records associated with this paper, returned as a queryset.

Paper.objects = <django.db.models.manager.Manager object>
Paper.owners

Returns the list of users that own this papers (listed as authors and identified as such).

Paper.pdf_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Paper.pubdate

Approximate publication date. For instance if we only know it is in 2014 we’ll put 2014-01-01

Paper.publications

The list of publications associated with this paper, returned as a queryset.

Paper.recompute_fingerprint_and_merge_if_needed()[source]

Recomputes the fingerprint based on the new values of the paper’s attributes, checks whether there is already another paper with the same fingerprint, and if so merge them.

Paper.researcher_ids

The list of researcher ids associated with this paper, returned as a list.

Paper.researchers

The list of researchers associated with this paper, returned as a list of Researcher instances.

Paper.set_researcher(position, researcher_id)[source]

Sets the researcher_id for the author at the given position (0-indexed). researcher_id can be set to None to unaffiliate an author with a researcher.

Paper.status_helptext()[source]

Helptext displayed next to the paper logo

Paper.successful_deposits()[source]
Paper.task

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Paper.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Paper.update_author_stats()[source]

Updates the statistics of all researchers identified for this paper

Paper.update_authors(new_authors, save_now=True)[source]

Improves the current list of authors by considering a new list of author names. Missing authors are added, and names are unified. If affiliations are provided, they will replace the old ones if they are more informative.

Parameters:authors – list of BareAuthor instances (the order matters)
Paper.update_availability(cached_oairecords=[])[source]

Updates the Paper‘s own pdf_url field based on its sources (OaiRecord).

This uses a non-trivial logic, hence it is useful to keep this result cached in the database row.

Parameters:cached_oairecords – if the list of oairecords to be considered is already available to the caller, it can pass it to this function to save a db query
Paper.update_index()[source]

Updates Haystack’s index for this paper

Paper.update_visible()[source]

Should this paper be shown to users?

Paper.url
Paper.visible

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class papers.models.PaperWorld(*args, **kwargs)[source]

Bases: solo.models.SingletonModel

A singleton to link to a special instance of AccessStatistics for all papers

Parameters:
  • id (AutoField) – Id
  • stats_id (ForeignKey) – Stats
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PaperWorld.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PaperWorld.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PaperWorld.object_id
PaperWorld.objects = <django.db.models.manager.Manager object>
PaperWorld.stats

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

PaperWorld.stats_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PaperWorld.update_stats()[source]

Update the access statistics for all papers

class papers.models.Researcher(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A model to represent a researcher

Parameters:
  • id (AutoField) – Id
  • name_id (ForeignKey) – Name
  • user_id (ForeignKey) – User
  • department_id (ForeignKey) – Department
  • institution_id (ForeignKey) – Institution
  • email (EmailField) – Email
  • homepage (URLField) – Homepage
  • role (CharField) – Role
  • orcid (CharField) – Orcid
  • empty_orcid_profile (NullBooleanField) – Empty orcid profile
  • last_harvest (DateTimeField) – Last harvest
  • harvester (CharField) – Harvester
  • current_task (CharField) – Current task
  • stats_id (ForeignKey) – Stats
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Researcher.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Researcher.add_name_variant(name, confidence, force_update=False)[source]

Add a name variant with the given confidence and update the best_confidence field of the name accordingly.

Parameters:force_update – set the best_confidence even if the current value is higher.
Researcher.affiliation_form()[source]

Returns a form to change the affiliation of this researcher

Researcher.breadcrumbs()[source]

We include the most detailed affiliation for the researcher

classmethod Researcher.create_by_name(first, last, **kwargs)[source]

Creates a Researcher with the given name. If an ORCID is provided, and a researcher with this ORCID already exists, this researcher will be returned. In any other case, a new researcher will be created.

Researcher.current_task

Current subtask of the harvester

Researcher.department

It can be affiliated to a department

Researcher.department_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Researcher.email

Email address for this researcher

Researcher.empty_orcid_profile

Did we manage to import at least one record from the ORCID profile? (Null if we have not tried)

Researcher.fetch_everything()[source]
Researcher.fetch_everything_if_outdated()[source]
Researcher.get_current_task_display(*moreargs, **morekwargs)
classmethod Researcher.get_or_create_by_orcid(orcid, profile=None, user=None, update=False, instance=u'orcid.org')[source]

Creates (or returns an existing) researcher from its ORCID id.

Parameters:
  • profile – an OrcidProfile object if it has already been fetched from the API (otherwise we will fetch it ourselves)
  • user – an user to associate with the profile.
  • update – refresh researcher attributes even if it already exists
Returns:

a Researcher if everything went well, raises MetadataSourceException otherwise

Researcher.harvester

Task id of the harvester (if any)

Researcher.homepage

URL of the homepage

Researcher.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Researcher.init_from_orcid()[source]
Researcher.institution

Or directly to an institution

Researcher.institution_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Researcher.last_harvest

Last time we harvested publications for this researcher

Researcher.latest_paper

Returns the latest paper authored by this researcher, if any.

Researcher.matching_papers_url

URL of the search page for papers with a matching name

Researcher.name

The preferred Name for this researcher

Researcher.name_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Researcher.name_variants

All the names found in papers that could belong to the researcher. Among these names, at least the preferred name should have confidence 1.0 (other names can have confidence 1.0 if multiple names are known. The other names have been found in publications and are similar to one of these 1.0 confidence name variants.

Researcher.namevariant_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Researcher.object_id

Criteria to use in the search view to filter on this researcher

Researcher.objects = <django.db.models.manager.Manager object>
Researcher.orcid

ORCiD identifier

Researcher.papers

Paper objects for this researcher, sorted by decreasing publication date

Researcher.role

Grade (student, post-doc, professor…)

Researcher.slug
Researcher.stats

Statistics of papers authored by this researcher

Researcher.stats_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Researcher.update_stats()[source]

Update the access statistics for the papers authored by this researcher

Researcher.url
Researcher.user

It can be associated to a user

Researcher.user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

papers.models.create_default_stats()[source]