Metadata-Version: 2.4
Name: marinerg-schema
Version: 0.2.0
Summary: MARINERG-i dataset metadata model (LinkML) and its generated controlled-vocabulary registry.
Author-email: Irish Centre for High End Computing <james.grogan@ichec.ie>
License: MIT
Project-URL: Repository, https://git.ichec.ie/marinerg-i/marinerg-schema
Project-URL: Homepage, https://git.ichec.ie/marinerg-i/marinerg-schema
Keywords: Marine Renewable Energy,Metadata,LinkML,DCAT,EOSC
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyYAML
Dynamic: license-file

# marinerg-schema

The MARINERG-i dataset metadata model, as a package.

[`marinerg_dataset.linkml.yaml`](src/marinerg_schema/data/marinerg_dataset.linkml.yaml)
(LinkML) defines the marine metadata fields and their controlled vocabularies. Everything else
in the estate is a projection of it: the CKAN catalogue's form and validators, and the facility
client's pre-publication checks.

It is a package because it has more than one consumer. It used to live inside the CKAN
extension, and each consumer kept its own copy — a hand-written field list in `marinerg-data`,
enum values restated in CKAN's form schema. Copies drift silently, and these had: the field list
was three fields behind.

## Install

```sh
pip install marinerg-schema
```

## Use

```python
from marinerg_schema import permitted_values, concept_uri, dataset_slots
from marinerg_schema.ckan import field_names

permitted_values("processing_level")   # frozenset({'L0', 'L1', 'L2', 'L3', 'L4'})
concept_uri("processing_level", "L1")  # 'http://vocab.nerc.ac.uk/collection/EPL/current/L1/'
dataset_slots()                        # the model's fields, in model order
field_names()                          # the keys a CKAN dataset takes top-level
```

`registry_path()` returns the generated registry YAML for consumers that want a file rather
than the API.

## Consumers

| Repo | What it takes |
|---|---|
| [`ckanext-marinerg`](https://git.ichec.ie/marinerg-i/ckanext-marinerg) | Vocabularies for its validators and RDF export; its form schema is gated against the model |
| [`marinerg-data`](https://git.ichec.ie/marinerg-i/marinerg-data) | Vocabularies to check a bundle before a DOI is minted; the CKAN field set to build a package |

## Predecessor

This model succeeds the MaRINET2 metadata schemas at
[github.com/Marinet2/metadata-schema](https://github.com/Marinet2/metadata-schema) (2020,
registered at [FAIRsharing bsg-s001497](https://fairsharing.org/bsg-s001497/)) — the dataset
schema here, and MaRINET2's datastream schema by
[`marinerg-data`](https://git.ichec.ie/marinerg-i/marinerg-data)'s run-manifest schema.

A successor, not a replacement: MaRINET2's schemas are the consortium-familiar backbone, and
`"Marinet2 NetCDF 0.1"` stays a declared value in the `conventions` list. That repository is
outside this group and still reads as current guidance, so a status banner there and a successor
relation on its FAIRsharing record have to be requested from its owners.

## Change the model

Edit the LinkML file, then regenerate the registry — never hand-edit it:

```sh
uv run python -m marinerg_schema
uv run python -m marinerg_schema --check   # what CI runs
```

A vocabulary change is a release: cut one, then move the consumers' pins. `version:` inside the
LinkML file is the *model's* version and moves independently of the package's.

## Develop

```sh
uv sync --group dev
uv run pytest
uv run ruff check src tests
uv run mypy src
```

The package floor is Python 3.10 — CKAN 2.11's runtime — even though the client that also
consumes it needs 3.11. Ruff targets 3.10 for the same reason.

## Licence

Copyright ICHEC. MIT — see [`LICENSE`](LICENSE).
