Skip to main content

ckanext-marinerg

CKAN extension powering the MARINERG-i data catalogue — the data catalogue for the MARINERG-i e-infrastructure, a Distributed Research Infrastructure for Marine Renewable Energy (MRE) test facilities across the EU. On top of stock CKAN it adds a marine metadata schema, controlled-vocabulary validation, Zenodo/DOI prefill, a facility/equipment picker, DCAT-AP 3.0 + FAIR Signposting export, Keycloak OIDC login, and MARINERG-i theming.

Building a similar CKAN integration? This README is a map of how it works and where things live. The exhaustive field list, DCAT mappings, and vocabulary architecture are not repeated here — they are generated from the schema and documented in docs/.

How it works

Everything hangs off a standard CKAN plugin, ckanext/marinerg/plugin.py, which implements a handful of CKAN interfaces:

Interface What it does Code
IConfigurer Registers templates, theme assets, and the scheming dataset schema plugin.py + templates/, assets/
IValidators Rejects values outside the controlled vocabularies at save time validators.py
IActions marinerg_zenodo_prefill, marinerg_facility_list, marinerg_equipment_list actions.py
IBlueprint FAIR Signposting Link headers on dataset pages signposting.py
IClick Maintenance CLI commands cli.py

Two other pieces are registered through CKAN config rather than a plugin interface:

  • DCAT-AP 3.0 exportMarinergDCATProfile (profile.py) stacks on euro_dcat_ap_3 via ckanext.dcat.rdf.profiles, adding /catalog.{rdf,ttl,jsonld} and per-dataset serialisations.
  • Keycloak OIDC — login and role mapping in oidc_plugin.py / oidc_roles.py / oidc_redirect.py.
  • A second small plugin, marinerg_metrics (metrics.py), exposes a Prometheus metrics endpoint.

The metadata model is defined once

schema/marinerg_dataset.linkml.yaml (LinkML) is the single source of truth for the marine metadata fields and their controlled vocabularies. From it, scripts/generate_registry.py produces the controlled-vocabulary registry (ckanext/marinerg/registry/controlled-metadata.yaml) that the validators enforce and the RDF export cites. Edit the schema, then regenerate — never hand-edit the registry. tox -e registry (and CI) fails if the two drift.

Where things live

Path Contents
ckanext/marinerg/plugin.py Plugin entry points / CKAN hooks — start here
ckanext/marinerg/actions.py Zenodo prefill + facility/equipment lookups (calls the Django facility service)
ckanext/marinerg/validators.py Controlled-vocabulary validation
ckanext/marinerg/profile.py DCAT-AP 3.0 RDF mappings
ckanext/marinerg/signposting.py FAIR Signposting Link headers
ckanext/marinerg/oidc_*.py Keycloak OIDC login + role mapping
ckanext/marinerg/templates/ Theme overrides — header, footer, scheming form/display snippets
ckanext/marinerg/assets/ Theme CSS (marinerg-theme.css) + webassets bundle
ckanext/marinerg/public/ Logos, favicon, background imagery
ckanext/marinerg/registry/ Generated vocabulary registry + cached authority labels
schema/ The LinkML metadata model (source of truth)
scripts/ Registry generation + vocabulary-cache refresh scripts
infra/ Local CKAN stack (compose) and the production image (Dockerfile)
docs/ Metadata-model & vocab-architecture references, EOSC roadmap, C4 diagrams
tests/ Pytest suite (stubs CKAN — no CKAN install needed)

Run it locally

cd infra
docker compose -f compose.yml -f compose.local.yml up -d    # or: podman compose ...
# CKAN → http://localhost:5001   (login: ckan_admin / ckan_admin)

compose.local.yml mounts this repo into the container, so Python and template edits are picked up live — restart the ckan service to reload cached Jinja templates; only dependency changes need --build. The facility/equipment picker calls the Django facility service, expected on http://localhost:8000 (the image resolves it as http://host.docker.internal:8000).

Develop

python -m venv .venv && .venv/bin/pip install -e ".[test]"
.venv/bin/python -m pytest tests/ -v     # tests stub ckan.plugins.toolkit — run under plain pytest
tox -e format_check      # Black (format_apply to fix)
tox -e style             # flake8
tox -e type              # mypy
tox -e registry          # fails if the registry has drifted from the LinkML schema
python scripts/generate_registry.py   # regenerate the registry after a schema change

Vocabulary label caches (NERC NVS, SPDX, EuroSciVoc, GCMD, re3data) are pinned snapshots refreshed by the scripts/fetch_* scripts; run them manually and commit the reviewed diff.

Configuration

Marinerg config keys are baked into ckan.ini at image-build time (ckan config-tool in infra/Dockerfile); OIDC credentials and ckan.plugins are the deliberate runtime exceptions.

Key Purpose
marinerg.zenodo_api_key Optional Zenodo API key for DOI prefill
marinerg.facility_api_url Django facility service base URL
marinerg.facility_api_token Token for authenticated facility API access
marinerg.portal_base_url Fallback facility PID base when a facility has no ROR ID

Release

Run a pipeline with RELEASE_FIELD = patch / minor / major. The tag it creates triggers the pipeline that publishes the pip package and the CKAN container image. Pin that image tag in the sibling ../infra repository, then run the infra deploy for the target environment.

Roadmap

NERC P01 parameters · SeaDataNet L05 device categories · DataCite export + DOI registration · OAI-PMH endpoint · MARINERG-i EOSC Virtual Organisation. Detail in docs/eosc-roadmap.md.

Licence

AGPL-3.0-or-later — see LICENSE. Copyright © Irish Centre for High-End Computing (ICHEC).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ckanext_marinerg-0.4.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ckanext_marinerg-0.4.0-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file ckanext_marinerg-0.4.0.tar.gz.

File metadata

  • Download URL: ckanext_marinerg-0.4.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for ckanext_marinerg-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a6092a4e6e2c32e75099ceaf1ea9a561381ade1928c0f30db9712a0e57848751
MD5 2b5b25078186ff04f47ef80e001dc1ce
BLAKE2b-256 e3e98ff7ca987641748ad6fa880ed591bb93a52f5d307031fcac362cead2bc27

See more details on using hashes here.

File details

Details for the file ckanext_marinerg-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ckanext_marinerg-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 455aabc8f271f7e243b356f912c9c28251ddcc500d52cc4f891cf30b959dc816
MD5 ad535c89095d150da432e841658c6b2a
BLAKE2b-256 94d4f32e8d2dee36dc954717e82d230484a4b7073eb72901386da32d4b22d147

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page