fairdm.core.measurement.plugins#

Plugin pages for measurements.

A measurement has its own page at its permanent address, /measurement/<uuid>/, in the same tabbed detail view as projects, datasets and samples. The overview is its first tab, and a portal adds further tabs by registering plugins against Measurement here or in its own app.

Module Contents#

Classes#

Overview

The measurement’s own page, drawn from measurement/measurement_overview.html, which reads only the base Measurement model and the registry’s description of its type. A measurement 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 measurement’s own page, drawn from measurement/measurement_overview.html, which reads only the base Measurement model and the registry’s description of its type. A measurement type adds its own content with <app_label>/<model_name>_overview.html; see :class:TypedOverviewPlugin.

A reuser asks four things of a single measurement: what the result was, what it was measured on, how it was measured, and whether they can cite and reuse it. The page answers them in that order.

Attributes: procedure_steps: Each step in how a measurement was made: its date type, the contributor role that performs it, the description type that explains it, and what the page calls it. The measurement vocabularies describe the same procedure three ways, so the page puts them back together. siblings_shown: Rows shown in the list of other measurements made on the same sample.

Initialization

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

base_model#

None

fallback_template#

‘measurement/measurement_overview.html’

url_path#

None

procedure_steps#

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

siblings_shown#

8

get_page_title()#

Title the page with the measurement’s name, or its portal ID when it has none.

get_breadcrumbs()#

Name the measurement in the trail by its portal ID when it has no name.

Returns: The trail, with the measurement’s own entry reading as its portal ID when unnamed.

get_context_data(**kwargs)#

Add the measurement and everything the overview page draws.

get_result()#

Read the value, when the measurement’s type declares one.

Measurement.get_value is part of the base model’s contract: a type that defines value (and optionally uncertainty) gets its result shown with no template of its own. A type that records its result some other way leaves this empty and fills the overview.result block itself.

Returns: The result’s text, or None when the type declares no value.

get_sample_status()#

Read the sample’s status label and badge colour, as its own page shows them.

Returns: The label and colour, or None when the sample records no status.

get_siblings()#

Read the other measurements made on the same sample, most recent first.

They are the context a single value is read against. Each is shown only if the viewer may see its own dataset.

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

get_citation_details(entries, dates, identifiers, sample)#

Write the citation, and where the measurement has no DOI, a note pointing at its dataset.

Args: entries: The record’s credits, from :meth:get_credits. dates: The measurement’s dates, by type. identifiers: The measurement’s identifiers, from :meth:get_identifiers. sample: The sample it was made on, or None when the viewer may not see it.

Returns: The card’s title and text, with the note and its link when there is no DOI.

get_details(project)#

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

Args: project: The parent project, or None when there is none or the viewer may not see it.

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