Overview plugins#
An overview page’s numbers, lists and cards are worked out by a plugin registered as the first tab of the record. This page lists those plugin classes, their attributes and methods, the context each provides and the helper functions they share. It does not describe the template blocks that draw the context, which Overview page blocks covers, or how to register a plugin, which Plugins covers.
Classes#
Class |
Module |
Registered on |
Template |
|---|---|---|---|
|
|
Base class. A tab with the label “Overview” and the page title taken from the record’s string form. |
|
|
|
Base class of the four core overview plugins. |
|
|
|
Base class of the sample and measurement overviews. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Each core Overview has url_path = None, so the overview sits at the record’s own address.
RecordOverviewPlugin#
It holds what every record overview works out the same way. A portal changes one piece of a page by subclassing a record’s Overview and overriding one attribute or method.
Attributes#
Attribute |
Default |
What it sets |
|---|---|---|
|
|
How many faces the People card draws before it counts the rest. |
|
|
The identifier types that link to doi.org. A value links only when it starts with |
Methods#
Method |
Returns |
|---|---|
|
The context with |
|
The record’s credits, people first and then organizations, each in the order set on the Contributors tab, each with its real contributor and roles loaded. |
|
The set of the addresses of the roles held on one credit. |
|
The contributors of every entry in |
|
One dictionary per credit, in the order of |
|
What the People card shows: |
|
One dictionary per identifier: |
|
The citation as text: |
|
One dictionary per step that has a date, a person or a note, with |
|
A row for |
|
A dictionary of |
|
A dictionary of |
from fairdm.core.plugins import RecordOverviewPlugin
class Summary(RecordOverviewPlugin):
people_shown = 8
TypedOverviewPlugin#
It subclasses RecordOverviewPlugin for the records portals subclass: samples and measurements.
Attribute |
Default |
What it sets |
|---|---|---|
|
|
The core model the records share. A subclass that names it opens a record only for a user the base model’s |
|
|
The template used when no type has one. |
Method |
Returns |
|---|---|
|
For each concrete class from the record’s own type up to |
|
A dictionary of |
|
Raises a 404, so the address never confirms the record exists. |
Project Overview#
Attribute |
Default |
What it sets |
|---|---|---|
|
|
Datasets listed before the page hands over to the Datasets tab. |
|
The addresses of the project leader and project manager roles |
The roles that name the people a visitor sees first. |
Method |
Returns |
|---|---|
|
The descriptions the project has text for, in the vocabulary’s order. |
|
The start and end dates, |
|
|
|
The counts of datasets, samples and measurements, each with a |
|
|
|
|
|
|
|
The checklist: |
|
The rows of the Details card. |
|
The entries every overview provides. |
Context entries: project, can_manage, descriptions, timeline (from get_progress()), team, funding, counts, datasets_preview, licenses, composition_chart, growth_chart, citation, json_ld, api_url, urls, and for the team readiness, plus the shared entries.
project_is_visible(request, obj) in the same module is the plugin’s check: a public project is visible to all and a private one to holders of project.view_project.
Dataset Overview#
Attribute |
Default |
What it sets |
|---|---|---|
|
a set of field names |
Fields every record carries that say nothing about its data, left out of |
Method |
Returns |
|---|---|
|
|
|
The descriptions the dataset has text for, in the vocabulary’s order. |
|
|
|
The timeline’s steps, in the order they happened. |
|
|
|
|
|
One dictionary per registered type the dataset holds, with |
|
The counts of samples and measurements, each with a |
|
The project and how many other datasets in it the viewer may see, or |
|
|
|
The schema.org |
|
The checklist: |
|
The rows of the Details card. |
|
The entries every overview provides. |
Context entries: dataset, can_manage, access, descriptions, dates, team, literature, data_types, counts, composition_chart, growth_chart, project_info, api_url, urls, citation, json_ld, lifecycle, and for the team, while the dataset’s data is not public, readiness, plus the shared entries.
dataset_is_visible(request, obj) is the plugin’s check.
Sample Overview#
Attribute |
Default |
What it sets |
|---|---|---|
|
a list of steps |
The steps of a sample’s history, each |
|
a dictionary |
The badge colour of each custody status. |
|
a dictionary |
What each status means for re-examining the specimen. |
|
|
Measurements listed before the rest are counted. |
Method |
Returns |
|---|---|
|
|
|
The measurements the viewer may see: |
|
|
|
A caption such as “1 parent · 2 subsamples”, or “None recorded”. |
|
|
|
The rows of the Details card. |
Context entries: sample, record, can_manage, sample_type, status, lifecycle, notes, measurements, relations, location, project, counts, citation, identifiers, api_url, type_info, people and details.
Measurement Overview#
Attribute |
Default |
What it sets |
|---|---|---|
|
a list of steps |
The steps of how a measurement was made, each |
|
|
Rows in the list of other measurements on the same sample. |
Method |
Returns |
|---|---|
|
A dictionary with |
|
The sample’s status |
|
The other measurements on the same sample that the viewer may see: |
|
|
|
The rows of the Details card. |
|
The measurement’s name, else its portal ID. |
Context entries: measurement, record, record_title, can_manage, measurement_type, result, type_info, procedure, notes, sample, sample_type, sample_status, sample_visible, effective_location (from Measurement.effective_location_for(user), with point, elevation, uncertainty and source), other_dataset, siblings, project, citation, identifiers, api_url, people and details.
Contributor Overview#
One plugin serves the person page and the organization page and chooses the template by is_organization. It does not subclass RecordOverviewPlugin.
Attribute |
Default |
What it sets |
|---|---|---|
|
|
Faces in the Frequent collaborators card. |
|
|
Projects, and datasets, listed in each record card. |
|
|
Places in the Members card, the “+n” entry included. |
Method |
Returns |
|---|---|
|
A Projects or Datasets card’s data, active records first and then the most recently updated, cut to |
|
A checklist shaped for |
|
|
|
The person page’s context. |
|
The organization page’s context. |
Person context entries: person, is_self, can_edit, update_url, is_unclaimed, is_inactive, affiliations, primary_organization, location_text, orcid_verified, portal_roles, people, counts (with project and dataset), projects, datasets, roles, member_since, and, for the person themselves, readiness.
Organization context entries: organization, can_manage, can_edit, update_url, is_member, members, projects, datasets, org_counts, hierarchy, location_text, has_map, and, for the people who keep the record, readiness.
Models supply the data: Person.get_affiliation_history(), Person.get_profile_completeness(), Organization.get_current_memberships(), Organization.get_hierarchy(), Organization.get_public_projects(), Organization.get_public_datasets(), Organization.get_record_completeness(), Organization.is_managed_by(user) and Organization.is_editable_by(user).
Helper functions#
fairdm.core.overview:
Function |
Returns |
|---|---|
|
Creators in citation style: |
|
One creator: surname and first initial, or the contributor’s string form when there is no first and last name. |
|
|
|
A plain date from a partial date, or |
|
A partial date as a day, a month and year, or a year, as it was recorded. |
|
The text with its first letter capitalised and the rest untouched. |
|
A URL, or |
fairdm.contrib.contributors.profiles:
Function |
Returns |
|---|---|
|
|
|
|
|
The items with active ones first, each group most recently updated first. |
|
The items with |
Visibility methods#
A sample or measurement overview decides who may open a record through the base model’s manager, never the type’s own. fairdm.core.managers.RecordVisibilityMixin gives a queryset these methods:
Method |
Keeps |
|---|---|
|
The records whose own dataset is published. |
|
The records in a dataset that is public and published, and those the user holds at least the view level on, on the record or from its dataset or that dataset’s project. |
|
The records the user holds at least that level on. |
SampleQuerySet and MeasurementQuerySet have all three. A queryset of your own for a record with a dataset foreign key can use the mixin. See How access to a record is decided.