dicogis.export.catalog_record module

Catalog record: what a metadata catalog gets to know about a dataset.

Pivot between the metadatasets and the catalog formats, and the single list of the fields managed by DicoGIS: each format serializes it, and completing a record already in a catalog relies on it too. It holds no absolute path unless asked to: a catalog is made to be read by people who have no business knowing the local file tree.

class dicogis.export.catalog_record.CatalogRecord(identifier, title, abstract, language, metadata_date, spatial_representation, keywords=(), date_created=None, date_revised=None, bbox_wgs84=None, crs_codes=(), formats=(), contact_organisation=None, contact_email=None, original_path=None)

Bases: object

A metadata record, independent of the format it ends up in.

identifier

stable identifier, see MetaDataset.uuid

title

title of the dataset

abstract

description of the dataset, never empty

language

language of the record, as an ISO 639-2/B code

metadata_date

date of the record itself

spatial_representation

“vector” or “grid”

keywords

unique keywords

date_created

creation date of the dataset, if known

date_revised

last revision date of the dataset, if known

bbox_wgs84

(west, south, east, north) in degrees, if known

crs_codes

unique CRS, as “registry:code”

formats

names of the formats of the dataset

contact_organisation

organisation to contact about the metadata

contact_email

email address to contact about the metadata

original_path

location of the dataset, only if asked for

__init__(identifier, title, abstract, language, metadata_date, spatial_representation, keywords=(), date_created=None, date_revised=None, bbox_wgs84=None, crs_codes=(), formats=(), contact_organisation=None, contact_email=None, original_path=None)
abstract: str
bbox_wgs84: tuple[float, float, float, float] | None = None
contact_email: str | None = None
contact_organisation: str | None = None
crs_codes: tuple[str, ...] = ()
date_created: date | None = None
date_revised: date | None = None
formats: tuple[str, ...] = ()
classmethod from_metadataset(metadataset, settings=None)

Build the record of a dataset. A flat database makes one record, covering all its layers.

Parameters:
Raises:

ValueError – if the dataset has no name or no location to be identified by

Return type:

CatalogRecord

Returns:

catalog record

identifier: str
keywords: tuple[str, ...] = ()
language: str
metadata_date: date
original_path: str | None = None
spatial_representation: Literal['vector', 'grid']
title: str
class dicogis.export.catalog_record.CatalogRecordSettings(language='eng', contact_organisation=None, contact_email=None, include_original_path=False)

Bases: object

What a catalog record needs on top of the metadataset.

language

language of the record, as an ISO 639-2/B code

contact_organisation

organisation to contact about the metadata

contact_email

email address to contact about the metadata

include_original_path

publish the location of the dataset

__init__(language='eng', contact_organisation=None, contact_email=None, include_original_path=False)
contact_email: str | None = None
contact_organisation: str | None = None
classmethod from_environment(language=None, include_original_path=None)

Build the settings, from the environment for what isn’t given.

Parameters:
  • language (str | tuple | None) – language in any form normalize_language_code() understands

  • include_original_path (bool | None) – publish the location of the dataset. Defaults to the DICOGIS_ISO_INCLUDE_ORIGINAL_PATH environment variable.

Return type:

CatalogRecordSettings

Returns:

settings

include_original_path: bool = False
language: str = 'eng'