fairdm.core.sample.plugins#

Registered pages for a sample: its overview.

Module Contents#

Classes#

Overview

The sample’s own page, drawn from sample/sample_overview.html, which reads only the base Sample model. A sample type adds its own content with <app_label>/<model_name>_overview.html; see :class:TypedOverviewPlugin.

API#

class Overview(**kwargs)#

Bases: fairdm.core.plugins.TypedOverviewPlugin

The sample’s own page, drawn from sample/sample_overview.html, which reads only the base Sample model. A sample type adds its own content with <app_label>/<model_name>_overview.html; see :class:TypedOverviewPlugin.

A physical sample is best understood through its history: collected, prepared, stored, perhaps destroyed. The sample vocabularies already describe that history three ways (a date type, a contributor role and a description type for each step), so the page puts them back together as one timeline instead of three unrelated lists.

Attributes: lifecycle: Each step in a sample’s history as its date type, the contributor role that performs it, the description type that explains it and what the page calls it. The order is the order a specimen usually moves through; dated steps are then sorted by their dates. status_variants: The theme colour each custody status carries. Only “destroyed” is a warning to a reuser; the rest report where the specimen is. status_meanings: What each status means to someone hoping to re-examine the specimen. measurements_shown: How many measurements are listed before the rest are counted.

Initialization

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

fieldsets: list[tuple[str | None, dict[str, Any]]]#

[]

base_model#

None

fallback_template#

‘sample/sample_overview.html’

lifecycle#

[(), (), (), (), (), (), ()]

status_variants#

None

status_meanings#

None

measurements_shown#

10

get_context_data(**kwargs)#

Add the sample and everything the overview page draws.

get_status()#

Read the sample’s custody status as the page shows it.

Returns: The address of the stored status, its label, the badge colour, what it means for re-examining the specimen and whether the specimen is destroyed.

get_details(project, status)#

Write the Details card’s entries: where the sample sits, its licence, status and dates.

Args: project: The parent project, or None when there is none or the viewer may not see it. status: The sample’s status, from :meth:get_status.

Returns: The entries for :class:c-card.details.

get_citation_details(entries, dates, identifiers)#

Write the citation, in DataCite’s form for a physical object.

Args: entries: The record’s credits, from :meth:get_credits. dates: The sample’s dates, by type. identifiers: The sample’s identifiers, from :meth:get_identifiers.

Returns: The card’s title and text, with a note when the sample has no IGSN.

get_measurements()#

Read the measurements made on this sample, most recent first.

A measurement can belong to a different dataset than its sample, which is how one team measures another team’s specimens. Each is shown only if the viewer may see its own dataset, and being on the sample’s dataset team opens nothing else.

Returns: The measurements shown, how many the viewer may see and how many are left over.

Read the sample’s parents and subsamples.

Either may sit in another dataset, so each is checked against its own dataset. One the viewer may not see is described, never named or linked, and is counted in hidden.

Returns: The visible relations, all together and split into parents and subsamples, and how many the viewer may not see.

get_relations_summary(relations)#

Say how many parents and subsamples are shown, for the figure’s caption.

Args: relations: The relations, from :meth:get_related_samples.

Returns: For example “1 parent · 2 subsamples”, or “None recorded”.