fairdm.core.dataset.plugins#

Registered page for a dataset: its overview.

Module Contents#

Classes#

Overview

The dataset’s own page and the root of its collection.

Functions#

dataset_is_visible

Return whether the request’s user may view a dataset.

Data#

API#

DATASET_SETTINGS#

‘getattr(…)’

dataset_is_visible(request, obj)#

Return whether the request’s user may view a dataset.

A public dataset is always visible, a private one only with dataset.view_dataset. The plugin lookup reads through Dataset.all_objects so a private dataset’s owner can still open it, which is why this check is needed. It is set as Overview.check.

Args: request: The current request. obj: The dataset, or None when 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.RecordOverviewPlugin

The dataset’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.

A dataset is the unit a portal cites and distributes. Its page answers a reuser’s questions: what it is, whether its data is published, what it holds and how it grew, when each step of its life happened, how to cite it and who made it. Two gates decide what a visitor sees. Visibility governs the page and published governs the records, so a public, unpublished dataset shows its description, its counts and its charts to everyone. The page lists no record. Nothing here is written for a particular portal’s types.

Attributes: bookkeeping_fields: Fields every record carries that say nothing about its data.

Initialization

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

url_path#

None

model#

None

check#

‘staticmethod(…)’

template_name#

‘dataset/dataset_detail.html’

bookkeeping_fields#

None

get_context_data(**kwargs)#

Add the dataset and everything the overview page draws.

get_shared_context(page)#

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 citation, People, Identifiers and Details cards, the timeline and, for the team, the readiness checklist.

get_details(project_info)#

List the Details rows: the project, the licence and when the dataset last changed.

Args: project_info: The project the viewer may see with its other datasets, or None.

Returns: The rows as c-card.details draws them.

get_lifecycle(dates)#

List the dataset’s key dates in the order they happened.

Args: dates: The dataset’s dates as returned by :meth:get_dates.

Returns: The steps as c-card.timeline draws them.

get_access()#

Name the dataset’s access state, in the words the page uses for it everywhere.

Returns: The state (private, public or published) and its label.

get_descriptions()#

List the dataset’s descriptions in the order of the dataset description types.

Returns: One entry per description type the dataset has text for, type being the type’s address.

get_dates()#

Read the dataset’s recorded dates, each with the precision it was recorded at.

Returns: The collection start and end and the available, submitted, published and withdrawn dates, each None when not recorded, and the withdrawal written out as recorded.

get_team()#

Gather the dataset’s creators, and whether anyone is credited as its contact person.

Returns: The creators, whether a contact person is credited, and how many contributions the dataset has.

get_literature()#

List the related publications, worded from the publication’s side.

DataCite relation types read from the dataset’s side (“dataset IsDescribedBy paper”), which is backwards for a visitor looking at the paper. Each is restated from the paper’s side, and the relations a reuser cares most about come first.

Returns: The publications as items, each with its relation, its DOI and its year.

get_record_types(samples, measurements)#

List the registered sample and measurement types the dataset holds, largest first.

A type the registry no longer holds is left out. The figures, the readiness checklist and the variableMeasured list of the page’s schema.org description read this.

Args: samples: The dataset’s samples. measurements: The dataset’s measurements.

Returns: One entry per type with its kind, its label and the labels of its fields.

get_counts(samples, measurements, data_types)#

Count the dataset’s samples and measurements and the types each spans.

Args: samples: The dataset’s samples. measurements: The dataset’s measurements. data_types: The types the dataset holds, from :meth:get_record_types.

Returns: The counts, each with a short description of how many types it spans.

get_project_info()#

Find the parent project when the viewer may see it.

Nothing ties a dataset’s visibility to its project’s, so a public dataset can sit in a private project that must not be named.

Returns: The project and how many other datasets in it the viewer may see, or None.

get_citation_details(page)#

Cite the dataset’s own data publication when it has one, else DataCite’s form.

The year of the built citation is the Published date, else the Available date, else the year the dataset was added.

Args: page: The page context gathered so far.

Returns: The citation text and link and whether it has_doi, from_reference and how many creators it names.

get_schema_org(page)#

Describe the dataset as schema.org Dataset, the shape harvesters read.

It names the variables measured and never their values, so it carries nothing a visitor could not read on the page.

Args: page: The page context gathered so far.

Returns: The description, ready to be serialised into the page head.

get_readiness(page)#

List what has to be in place before the dataset is published, and whether it is yet.

Items come from DataCite’s mandatory and recommended properties and from what a formal publication would need to submit the record unaided. 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 percentage, whether every required one is, and how many required ones are missing.