fairdm.core.project.plugins#
Registered pages for a project: overview, datasets and export.
Module Contents#
Classes#
The project’s own page and the root of its collection. |
|
List the datasets that belong to the project. |
|
Page for exporting the project’s data. |
Functions#
Return whether the request’s user may view a project. |
API#
- project_is_visible(request, obj)#
Return whether the request’s user may view a project.
A public project is always visible, a private one only with
project.view_project. A registered page resolves its record past filtered managers and relies on the page to gate itself, so without this check a private project would be readable by anyone holding its address. It is set asOverview.check.Args: request: The current request. obj: The project, or
Nonewhen no record has been resolved.Returns: True when the page may be shown.
- class Overview(**kwargs)#
Bases:
fairdm.contrib.plugins.mixins.PrivateRecordNotFoundMixin,fairdm.core.plugins.RecordOverviewPluginThe project’s own page and the root of its collection.
The editing pages are the shared ones in :mod:
fairdm.core.editing, reached from the Manage menu.PrivateRecordNotFoundMixinmakes a private project answer a stranger with a 404, since a 403 or a sign-in redirect would confirm the record exists.The page is a landing page, read by someone deciding whether the data is usable to them, someone who has to cite the project and the team keeping the record complete. Everything on it is derived from the project’s own records. A visitor’s counts are taken over the project’s public datasets only, and the samples and measurements beneath them; a member of the team sees everything, with the private share called out.
Attributes: dataset_preview: How many datasets the page lists before it hands over to the Datasets page. lead_roles: The addresses of the roles that name the people a visitor should see first, in this order.
Initialization
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- url_path#
None
- model#
None
- check#
‘staticmethod(…)’
- template_name#
‘project/project_detail.html’
- dataset_preview#
5
- lead_roles#
None
- get_context_data(**kwargs)#
Add the project and everything the overview page draws.
The datasets counted are the project’s public ones for a visitor and every one for the team, and the samples and measurements are those beneath them.
Provide the keys every overview page has, which the shared skeleton and cards read.
Args: page: The page context gathered so far.
Returns: The record, its icon, the header’s people, the People, Identifiers and citation cards, the Details rows and, for the team, the readiness checklist.
- get_descriptions()#
List the project’s descriptions in the order of the project description types.
The abstract comes first. Each entry’s
typeis the type’s address.
- get_progress()#
Work out the project’s start, its end and how far through it today is, in whole years.
Returns: The start and end as recorded and as dates, the percentage elapsed, the year the project is in and a label saying where it stands.
- get_team()#
Name the leads and the contact person, and count everyone else.
Returns: The leads, the contact person, the other contributors, the counts of people and organisations, and who a would-be collaborator writes to: the contact person, else the first lead.
- get_counts(datasets, samples, measurements, can_manage)#
Count the figures in the strip and describe each in a line.
Args: datasets: The datasets the viewer may see. samples: The samples beneath them. measurements: The measurements beneath them. can_manage: Whether the viewer is on the project’s team.
Returns: The three counts, each with its description.
- get_datasets_preview(datasets)#
List the most recently updated datasets with their record counts.
Args: datasets: The datasets the viewer may see.
Returns: The first
dataset_previewrows and how many more there are.
- get_licenses(datasets)#
Summarise the licences the project’s public datasets carry.
Args: datasets: The datasets the viewer may see.
Returns: The licences with how many datasets carry each, most common first, and how many public datasets carry none.
- get_citation_details()#
Write the project’s citation: Creators (Year). Title. Publisher. Identifier.
Returns: The citation text, the link it ends with, whether that link is a DOI and how many creators it names.
- get_readiness(page)#
List the metadata a harvester or a reuser looks for, and whether the project has it.
Each item comes from DataCite’s required and recommended properties or from what the FAIR principles ask of a record. Items with nowhere to fix them yet carry no link.
Args: page: The page context gathered so far.
Returns: The items, how many are done, the total and the percentage.
- get_details(licenses)#
List the rows of the Details card: organisation, status, licences and dates.
Args: licenses: The licence summary from :meth:
get_licenses.Returns: The rows, for :class:
c-card.details.
- class DatasetList(**kwargs)#
Bases:
fairdm.contrib.plugins.mixins.PrivateRecordNotFoundMixin,fairdm.contrib.plugins.Plugin,fairdm.core.dataset.views.DatasetListViewList the datasets that belong to the project.
Initialization
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- page_title#
‘_(…)’
- check#
‘staticmethod(…)’
- get_queryset(*args, **kwargs)#
Limit to the project’s datasets.
- get_lookup_kwargs() dict#
Return no lookup kwargs, as the queryset is already scoped to the project.
- class ProjectExportView(**kwargs)#
Bases:
fairdm.contrib.plugins.mixins.PrivateRecordNotFoundMixin,fairdm.contrib.plugins.Plugin,fairdm.views.FairDMTemplateViewPage for exporting the project’s data.
Initialization
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- page_title#
‘_(…)’
- check#
‘staticmethod(…)’
- page_icon#
‘export’