Declare category / variable / derivation / is_canonical / NERC ids on measurement types that already exist
Source: R/registry.R
declare_measurement_fields.RdSix descriptive columns, none of them an ingest's own definition:
category— one of the registered categories (metadata/category.csv: Physical Oceanography, Nutrients & Chemistry, Carbonate System, Productivity & Pigments, Meteorology & Sea State, …), read by the CalCOFI Explorer's Browse tab (explorer UI plan D14).variable— the crosswalk that says which types measure the same thing comparably across datasets (temperaturefor the bottle'stemperatureand the CTD'stemperature_ave), which the explorer carried insrc/variables.tsas a stopgap.derivation— free text saying how a derived type was produced (the_cruise_corrvs_sta_corrdistinction, or that a pre-QCr_*type is "interpolated to standard depth and carries no quality code by design").is_canonical— whether the type reaches the defaultobs/ctd_thinselection; a provider-confirmed fact like "the bottle'sr_*series are interpolated, so they are not canonical" belongs here, not in an ingest's own literal.nerc_p01— the NERC BODC Parameter Usage Vocabulary (P01) concept URI that a DwC/OBIS eMoF export emits asmeasurementTypeID.units_nerc_p06— the NERC P06 unit concept URI, emitted asmeasurementUnitID.
Usage
declare_measurement_fields(
fields,
path,
categories = NULL,
overwrite = FALSE,
quiet = FALSE
)Arguments
- fields
data.frame with
measurement_typeand at least one ofcategory,variable,derivation,is_canonical,nerc_p01,units_nerc_p06(declarable_measurement_fields()).NAleaves that field as it is.- path
path to
metadata/measurement_type.csv- categories
the allowed
categoryvalues — thecategorycolumn ofmetadata/category.csv;NULLskips the check (not recommended)- overwrite
allow replacing a value that is already declared (default FALSE)
- quiet
suppress the summary message
Details
The two vocabulary columns are validated against
nerc_uri_prefixes(): a value must be a full concept URI in the right
collection (.../collection/P01/current/<CODE>/). They are filled only on
an exact vocabulary match — a concept every one of whose stated facets
(quantity, matrix, phase, method) the registry or the dataset's documented
protocol actually supplies. A generic concept is an exact match at coarser
specificity (TEMPPR01, Temperature of the water body); a concept that
adds a facet nobody recorded is not. So an empty cell means "no concept says
exactly this", never "not looked at", and inventing one to fill the column is
the same mistake as inventing a bound to quiet
check_measurement_bounds().
Like declare_measurement_bounds() this changes only these columns,
only on rows that already exist, refuses an unknown measurement_type, and
writes with na = "". A registry predating a column gains it.
See also
build_coverage(), which puts category/variable onto
coverage.json's variables[].