ckanext-marinerg 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. ckanext_marinerg-0.1.0/PKG-INFO +200 -0
  2. ckanext_marinerg-0.1.0/README.md +178 -0
  3. ckanext_marinerg-0.1.0/ckanext/__init__.py +1 -0
  4. ckanext_marinerg-0.1.0/ckanext/marinerg/__init__.py +1 -0
  5. ckanext_marinerg-0.1.0/ckanext/marinerg/actions.py +322 -0
  6. ckanext_marinerg-0.1.0/ckanext/marinerg/assets/css/marinerg-theme.css +200 -0
  7. ckanext_marinerg-0.1.0/ckanext/marinerg/assets/webassets.yml +4 -0
  8. ckanext_marinerg-0.1.0/ckanext/marinerg/metrics.py +113 -0
  9. ckanext_marinerg-0.1.0/ckanext/marinerg/models.py +87 -0
  10. ckanext_marinerg-0.1.0/ckanext/marinerg/oidc_plugin.py +41 -0
  11. ckanext_marinerg-0.1.0/ckanext/marinerg/oidc_roles.py +122 -0
  12. ckanext_marinerg-0.1.0/ckanext/marinerg/plugin.py +97 -0
  13. ckanext_marinerg-0.1.0/ckanext/marinerg/profile.py +381 -0
  14. ckanext_marinerg-0.1.0/ckanext/marinerg/public/marinerg/images/bg_waves.jpg +0 -0
  15. ckanext_marinerg-0.1.0/ckanext/marinerg/public/marinerg/images/favicon-32x32.png +0 -0
  16. ckanext_marinerg-0.1.0/ckanext/marinerg/public/marinerg/images/logo.svg +1 -0
  17. ckanext_marinerg-0.1.0/ckanext/marinerg/public/marinerg/images/marinerg_background.png +0 -0
  18. ckanext_marinerg-0.1.0/ckanext/marinerg/public/marinerg/licenses.json +223 -0
  19. ckanext_marinerg-0.1.0/ckanext/marinerg/registry/controlled-metadata.yaml +148 -0
  20. ckanext_marinerg-0.1.0/ckanext/marinerg/registry/euroscivoc_cache.yaml +23 -0
  21. ckanext_marinerg-0.1.0/ckanext/marinerg/registry/gcmd_keyword_cache.yaml +32 -0
  22. ckanext_marinerg-0.1.0/ckanext/marinerg/registry/nerc_cache/EPL.yaml +72 -0
  23. ckanext_marinerg-0.1.0/ckanext/marinerg/registry/nerc_cache/L10.yaml +45 -0
  24. ckanext_marinerg-0.1.0/ckanext/marinerg/registry/source_repository_cache.yaml +14 -0
  25. ckanext_marinerg-0.1.0/ckanext/marinerg/registry/spdx_cache.yaml +137 -0
  26. ckanext_marinerg-0.1.0/ckanext/marinerg/schemas/dataset.yaml +473 -0
  27. ckanext_marinerg-0.1.0/ckanext/marinerg/signposting.py +210 -0
  28. ckanext_marinerg-0.1.0/ckanext/marinerg/templates/base.html +11 -0
  29. ckanext_marinerg-0.1.0/ckanext/marinerg/templates/header.html +7 -0
  30. ckanext_marinerg-0.1.0/ckanext/marinerg/templates/home/snippets/promoted.html +39 -0
  31. ckanext_marinerg-0.1.0/ckanext/marinerg/templates/scheming/display_snippets/link.html +3 -0
  32. ckanext_marinerg-0.1.0/ckanext/marinerg/templates/scheming/form_snippets/facility_picker.html +135 -0
  33. ckanext_marinerg-0.1.0/ckanext/marinerg/templates/scheming/form_snippets/zenodo_doi.html +124 -0
  34. ckanext_marinerg-0.1.0/ckanext/marinerg/validators.py +167 -0
  35. ckanext_marinerg-0.1.0/ckanext_marinerg.egg-info/PKG-INFO +200 -0
  36. ckanext_marinerg-0.1.0/ckanext_marinerg.egg-info/SOURCES.txt +50 -0
  37. ckanext_marinerg-0.1.0/ckanext_marinerg.egg-info/dependency_links.txt +1 -0
  38. ckanext_marinerg-0.1.0/ckanext_marinerg.egg-info/entry_points.txt +7 -0
  39. ckanext_marinerg-0.1.0/ckanext_marinerg.egg-info/requires.txt +5 -0
  40. ckanext_marinerg-0.1.0/ckanext_marinerg.egg-info/top_level.txt +1 -0
  41. ckanext_marinerg-0.1.0/pyproject.toml +108 -0
  42. ckanext_marinerg-0.1.0/setup.cfg +4 -0
  43. ckanext_marinerg-0.1.0/tests/test_actions.py +361 -0
  44. ckanext_marinerg-0.1.0/tests/test_fetch_scripts.py +375 -0
  45. ckanext_marinerg-0.1.0/tests/test_generate_registry.py +181 -0
  46. ckanext_marinerg-0.1.0/tests/test_metrics.py +46 -0
  47. ckanext_marinerg-0.1.0/tests/test_models.py +129 -0
  48. ckanext_marinerg-0.1.0/tests/test_oidc_roles.py +39 -0
  49. ckanext_marinerg-0.1.0/tests/test_profile.py +825 -0
  50. ckanext_marinerg-0.1.0/tests/test_signposting.py +248 -0
  51. ckanext_marinerg-0.1.0/tests/test_validators.py +144 -0
  52. ckanext_marinerg-0.1.0/tests/test_zenodo.py +267 -0
@@ -0,0 +1,200 @@
1
+ Metadata-Version: 2.4
2
+ Name: ckanext-marinerg
3
+ Version: 0.1.0
4
+ Summary: CKAN extension for the MARINERG-i data catalogue: marine metadata schema, Zenodo prefill, facility/equipment picker, and DCAT-AP export.
5
+ Author-email: Irish Centre for High End Computing <james.grogan@ichec.ie>
6
+ License: AGPL-3.0-or-later
7
+ Project-URL: Repository, https://git.ichec.ie/marinerg-i/ckanext-marinerg
8
+ Project-URL: Homepage, https://git.ichec.ie/marinerg-i/ckanext-marinerg
9
+ Keywords: CKAN,Marine Renewable Energy,Data Catalogue,EOSC,DCAT
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Framework :: Paste
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: ckanext-scheming
18
+ Requires-Dist: PyYAML
19
+ Requires-Dist: requests
20
+ Requires-Dist: pydantic>=2.0
21
+ Requires-Dist: prometheus-client>=0.20
22
+
23
+ # ckanext-marinerg
24
+
25
+ CKAN extension for the MARINERG-i data catalogue. Part of the MARINERG-i e-infrastructure — a Distributed Research Infrastructure supporting Marine Renewable Energy (MRE) test facilities across the EU.
26
+
27
+ Companion to the [data-access-service](https://git.ichec.ie/marinerg-i/data-access-service) repo, which contains the Docker compose stack, Django facility service, and planning documents.
28
+
29
+ ---
30
+
31
+ ## Features
32
+
33
+ ### Marine metadata schema
34
+
35
+ Custom CKAN scheming fields on top of the standard dataset form:
36
+
37
+ | Field | Description |
38
+ |---|---|
39
+ | `zenodo_doi` | DOI entry with "Prefill from Zenodo" button |
40
+ | `publication_date` | `YYYY-MM-DD` |
41
+ | `visibility` | `public` / `private` / `restricted` — controlled vocab |
42
+ | `access_scope` | `open` / `org_members` / `on_request` — controlled vocab |
43
+ | `data_mode` | `Raw` / `Provisional` / `Delayed-mode` / `Mixed` — MARINERG-i vocab |
44
+ | `source_kind` | `zenodo` / `datacite` / `manual` / `synthetic` — MARINERG-i vocab |
45
+ | `feature_type` | CF DSG feature type — MARINERG-i SKOS vocab |
46
+ | `processing_level` | EMODnet EPL level (L0–L4) — NERC NVS EPL vocab |
47
+ | `coordinate_reference_system` | EPSG code or `CUSTOM` — NERC NVS L10 vocab |
48
+ | `site` | Named test site / location |
49
+ | `time_coverage_start` / `time_coverage_end` | Data collection period |
50
+ | `facility_ref` | Stable facility PID — ROR URI preferred, portal URL fallback |
51
+ | `facility_name` | Display name of selected facility |
52
+ | `equipment_name` | Name of selected equipment |
53
+
54
+ ### Zenodo prefill
55
+
56
+ Server-side CKAN action (`marinerg_zenodo_prefill`) triggered by DOI entry. Fetches DataCite/InvenioRDM metadata from Zenodo using an optional API key held in CKAN server config and pre-populates the creation form. Handles both the current InvenioRDM format and the legacy Zenodo API format.
57
+
58
+ ### Facility/equipment picker
59
+
60
+ Two-dropdown form widget that calls the Django facility service to populate contextual selections. Resolves each facility to a stable PID (ROR URI preferred; portal URL fallback) — internal Django API URLs are never written to dataset records.
61
+
62
+ ### Controlled vocabulary validators
63
+
64
+ All controlled fields are validated at submission time against `registry/controlled-metadata.yaml`, which is auto-generated from the LinkML schema (`schema/marinerg_dataset.linkml.yaml`). Values not in the registry are rejected. Each code has a corresponding concept URI emitted in RDF export.
65
+
66
+ Vocabulary sources:
67
+ - `processing_level` → NERC NVS EPL (cached in `registry/nerc_cache/EPL.yaml`)
68
+ - `coordinate_reference_system` → NERC NVS L10 (cached in `registry/nerc_cache/L10.yaml`)
69
+ - `feature_type`, `access_scope`, `data_mode`, `source_kind`, `visibility` → MARINERG-i SKOS vocab
70
+ - `euroscivoc` → EuroSciVoc (EU Science Vocabulary; cached in `registry/euroscivoc_cache.yaml`)
71
+ - `gcmd_keyword` → NASA GCMD Science Keywords (cached in `registry/gcmd_keyword_cache.yaml`)
72
+ - `source_repository` → re3data registry (cached in `registry/source_repository_cache.yaml`)
73
+ - `license_id` → SPDX 3.x (cached in `registry/spdx_cache.yaml`; served via `licenses_group_url`)
74
+
75
+ The EOSC-vocabulary label caches are refreshed from their authorities with
76
+ `python scripts/fetch_eosc_vocabs.py` (URIs stay single-sourced in the LinkML schema).
77
+
78
+ ### DCAT-AP 3.0 RDF export
79
+
80
+ `ckanext-dcat` is installed; `MarinergDCATProfile` stacks on `euro_dcat_ap_3`. Custom mappings:
81
+
82
+ - `visibility` → `dct:accessRights` (EU Publications Office vocab)
83
+ - `facility_ref` / `facility_name` → `dct:publisher` (ROR URI as `foaf:homepage`)
84
+ - `author` → `dct:creator`; `author_email` → `dcat:contactPoint` (restricted datasets only)
85
+ - `zenodo_doi` → `dct:identifier` + `adms:identifier` (the DOI is the dataset's sole identity; no `owl:sameAs`)
86
+ - `publication_date` → `dct:issued`
87
+ - `feature_type` → `dcat:theme` (MARINERG-i concept URI)
88
+ - `euroscivoc` → `dcat:theme` (EuroSciVoc concept URIs); `gcmd_keyword` → `dct:subject` (GCMD concept URIs)
89
+ - `source_repository` → `dct:source` (re3data repository URI)
90
+ - `processing_level` → `dqv:hasQualityAnnotation` with NERC EPL concept URI
91
+ - `coordinate_reference_system` → `dct:conformsTo` (NERC L10 URI or Literal)
92
+ - `site` → `dct:spatial`; `time_coverage_start/end` → `dct:temporal`
93
+
94
+ Endpoints: `/catalog.rdf`, `/catalog.ttl`, `/catalog.n3`, `/catalog.jsonld` and per-dataset equivalents.
95
+
96
+ ### FAIR Signposting
97
+
98
+ Dataset landing pages (`/dataset/<name>`) carry a typed HTTP `Link` header (FAIR
99
+ Signposting Profile), added by an `IBlueprint` app-wide `after_request` hook
100
+ (`signposting.py`):
101
+
102
+ - `cite-as` → the DOI (canonical citation)
103
+ - `describedby` → the `.ttl` / `.jsonld` / `.rdf` DCAT serialisations (with media types)
104
+ - `type` → `dcat:Dataset` + `schema.org/Dataset`
105
+ - `author` → ORCiD URI (when recorded), `license` → licence URL, `item` → each distribution
106
+
107
+ Machine-navigable without OAI-PMH or SPARQL; assessed by F-UJI and expected by EOSC
108
+ harvesters. Ref: `../data-access-service/docs/eosc-roadmap.md` §2.9.
109
+
110
+ ### CKAN theming
111
+
112
+ Custom header (MARINERG-i logo), colour scheme (`--marinerg-primary: #003964`), favicon, background imagery.
113
+
114
+ ---
115
+
116
+ ## Planned
117
+
118
+ - **Keycloak SSO** — `ckanext-oidc-pkce` against ICHEC Keycloak; JIT user creation; group membership from JWT claims
119
+ - **NERC P01 parameters** — discipline-filtered allowlist; instrument/parameter linking
120
+ - **SeaDataNet device categories (L05)** — upgrade `equipment_name` from free text to controlled picker
121
+ - **DataCite export** — same schema and vocab registry; DOI registration
122
+ - **OAI-PMH endpoint** — for EOSC/B2FIND harvesting
123
+ - **MARINERG-i VO** — EOSC Virtual Organisation for consortium-level access policies
124
+
125
+ ---
126
+
127
+ ## Local development
128
+
129
+ This repo is a sibling of `data-access-service/`. The CKAN dev stack lives there:
130
+
131
+ ```sh
132
+ cd ../data-access-service/infra/ckan
133
+ docker compose -f compose.yml -f compose.local.yml up -d --build
134
+ # CKAN at http://localhost:5001 (port 5000 is owned by Docker Desktop's gvproxy)
135
+ # Login: ckan_admin / ckan_admin
136
+ ```
137
+
138
+ `compose.local.yml` mounts this repo into the container at `/srv/app/src/ckanext-marinerg`. Python and template changes are live immediately. Only dependency changes need a rebuild.
139
+
140
+ ### Facility service
141
+
142
+ The facility/equipment picker calls the Django facility service. For local dev it should be running on port 8000. The CKAN image has `http://host.docker.internal:8000` baked in at build time — Docker resolves this to the Mac host from inside the container.
143
+
144
+ ### Running tests
145
+
146
+ ```sh
147
+ python -m venv .venv
148
+ .venv/bin/pip install -e ".[test]"
149
+ .venv/bin/python -m pytest tests/ -v
150
+ ```
151
+
152
+ All tests run without a CKAN installation — `conftest.py` stubs `ckan.plugins.toolkit` so pure action/model/validator logic can be tested directly.
153
+
154
+ ### Linting and formatting
155
+
156
+ ```sh
157
+ tox -e format_check # check (CI)
158
+ tox -e format_apply # apply
159
+ tox -e style # flake8
160
+ tox -e type # mypy
161
+ tox -e registry # check controlled-metadata.yaml is in sync with the LinkML schema
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Vocabulary cache scripts
167
+
168
+ Run these manually (or on a schedule in CI) to update pinned snapshots. Commit the diff after reviewing.
169
+
170
+ ```sh
171
+ # NERC NVS collections (EPL processing levels, L10 CRS)
172
+ python scripts/fetch_nerc_vocabs.py
173
+
174
+ # SPDX license list
175
+ python scripts/fetch_spdx_licenses.py
176
+
177
+ # Regenerate controlled-metadata.yaml from the LinkML schema (also run by `tox -e registry`)
178
+ python scripts/generate_registry.py
179
+ ```
180
+
181
+ ---
182
+
183
+ ## CKAN config keys
184
+
185
+ Baked into `ckan.ini` at image build time via `RUN ckan config-tool` in `data-access-service/infra/ckan/Dockerfile`. Do not rely on runtime env vars — `prerun.py` only writes `ckan.plugins`.
186
+
187
+ | Key | Default | Purpose |
188
+ |---|---|---|
189
+ | `scheming.dataset_schemas` | — | Path to the marine dataset schema |
190
+ | `ckanext.dcat.rdf.profiles` | `euro_dcat_ap_3 marinerg_dcat` | RDF profile stack |
191
+ | `marinerg.zenodo_api_key` | `""` | Zenodo API key for prefill (optional) |
192
+ | `marinerg.facility_api_url` | `http://host.docker.internal:8000` | Django facility service base URL |
193
+ | `marinerg.facility_api_token` | `""` | Token for authenticated facility API access |
194
+ | `marinerg.portal_base_url` | `http://localhost:5001` | Fallback facility PID base when no ROR ID |
195
+
196
+ ---
197
+
198
+ ## Licence
199
+
200
+ Copyright ICHEC. GNU AGPL v3 or later.
@@ -0,0 +1,178 @@
1
+ # ckanext-marinerg
2
+
3
+ CKAN extension for the MARINERG-i data catalogue. Part of the MARINERG-i e-infrastructure — a Distributed Research Infrastructure supporting Marine Renewable Energy (MRE) test facilities across the EU.
4
+
5
+ Companion to the [data-access-service](https://git.ichec.ie/marinerg-i/data-access-service) repo, which contains the Docker compose stack, Django facility service, and planning documents.
6
+
7
+ ---
8
+
9
+ ## Features
10
+
11
+ ### Marine metadata schema
12
+
13
+ Custom CKAN scheming fields on top of the standard dataset form:
14
+
15
+ | Field | Description |
16
+ |---|---|
17
+ | `zenodo_doi` | DOI entry with "Prefill from Zenodo" button |
18
+ | `publication_date` | `YYYY-MM-DD` |
19
+ | `visibility` | `public` / `private` / `restricted` — controlled vocab |
20
+ | `access_scope` | `open` / `org_members` / `on_request` — controlled vocab |
21
+ | `data_mode` | `Raw` / `Provisional` / `Delayed-mode` / `Mixed` — MARINERG-i vocab |
22
+ | `source_kind` | `zenodo` / `datacite` / `manual` / `synthetic` — MARINERG-i vocab |
23
+ | `feature_type` | CF DSG feature type — MARINERG-i SKOS vocab |
24
+ | `processing_level` | EMODnet EPL level (L0–L4) — NERC NVS EPL vocab |
25
+ | `coordinate_reference_system` | EPSG code or `CUSTOM` — NERC NVS L10 vocab |
26
+ | `site` | Named test site / location |
27
+ | `time_coverage_start` / `time_coverage_end` | Data collection period |
28
+ | `facility_ref` | Stable facility PID — ROR URI preferred, portal URL fallback |
29
+ | `facility_name` | Display name of selected facility |
30
+ | `equipment_name` | Name of selected equipment |
31
+
32
+ ### Zenodo prefill
33
+
34
+ Server-side CKAN action (`marinerg_zenodo_prefill`) triggered by DOI entry. Fetches DataCite/InvenioRDM metadata from Zenodo using an optional API key held in CKAN server config and pre-populates the creation form. Handles both the current InvenioRDM format and the legacy Zenodo API format.
35
+
36
+ ### Facility/equipment picker
37
+
38
+ Two-dropdown form widget that calls the Django facility service to populate contextual selections. Resolves each facility to a stable PID (ROR URI preferred; portal URL fallback) — internal Django API URLs are never written to dataset records.
39
+
40
+ ### Controlled vocabulary validators
41
+
42
+ All controlled fields are validated at submission time against `registry/controlled-metadata.yaml`, which is auto-generated from the LinkML schema (`schema/marinerg_dataset.linkml.yaml`). Values not in the registry are rejected. Each code has a corresponding concept URI emitted in RDF export.
43
+
44
+ Vocabulary sources:
45
+ - `processing_level` → NERC NVS EPL (cached in `registry/nerc_cache/EPL.yaml`)
46
+ - `coordinate_reference_system` → NERC NVS L10 (cached in `registry/nerc_cache/L10.yaml`)
47
+ - `feature_type`, `access_scope`, `data_mode`, `source_kind`, `visibility` → MARINERG-i SKOS vocab
48
+ - `euroscivoc` → EuroSciVoc (EU Science Vocabulary; cached in `registry/euroscivoc_cache.yaml`)
49
+ - `gcmd_keyword` → NASA GCMD Science Keywords (cached in `registry/gcmd_keyword_cache.yaml`)
50
+ - `source_repository` → re3data registry (cached in `registry/source_repository_cache.yaml`)
51
+ - `license_id` → SPDX 3.x (cached in `registry/spdx_cache.yaml`; served via `licenses_group_url`)
52
+
53
+ The EOSC-vocabulary label caches are refreshed from their authorities with
54
+ `python scripts/fetch_eosc_vocabs.py` (URIs stay single-sourced in the LinkML schema).
55
+
56
+ ### DCAT-AP 3.0 RDF export
57
+
58
+ `ckanext-dcat` is installed; `MarinergDCATProfile` stacks on `euro_dcat_ap_3`. Custom mappings:
59
+
60
+ - `visibility` → `dct:accessRights` (EU Publications Office vocab)
61
+ - `facility_ref` / `facility_name` → `dct:publisher` (ROR URI as `foaf:homepage`)
62
+ - `author` → `dct:creator`; `author_email` → `dcat:contactPoint` (restricted datasets only)
63
+ - `zenodo_doi` → `dct:identifier` + `adms:identifier` (the DOI is the dataset's sole identity; no `owl:sameAs`)
64
+ - `publication_date` → `dct:issued`
65
+ - `feature_type` → `dcat:theme` (MARINERG-i concept URI)
66
+ - `euroscivoc` → `dcat:theme` (EuroSciVoc concept URIs); `gcmd_keyword` → `dct:subject` (GCMD concept URIs)
67
+ - `source_repository` → `dct:source` (re3data repository URI)
68
+ - `processing_level` → `dqv:hasQualityAnnotation` with NERC EPL concept URI
69
+ - `coordinate_reference_system` → `dct:conformsTo` (NERC L10 URI or Literal)
70
+ - `site` → `dct:spatial`; `time_coverage_start/end` → `dct:temporal`
71
+
72
+ Endpoints: `/catalog.rdf`, `/catalog.ttl`, `/catalog.n3`, `/catalog.jsonld` and per-dataset equivalents.
73
+
74
+ ### FAIR Signposting
75
+
76
+ Dataset landing pages (`/dataset/<name>`) carry a typed HTTP `Link` header (FAIR
77
+ Signposting Profile), added by an `IBlueprint` app-wide `after_request` hook
78
+ (`signposting.py`):
79
+
80
+ - `cite-as` → the DOI (canonical citation)
81
+ - `describedby` → the `.ttl` / `.jsonld` / `.rdf` DCAT serialisations (with media types)
82
+ - `type` → `dcat:Dataset` + `schema.org/Dataset`
83
+ - `author` → ORCiD URI (when recorded), `license` → licence URL, `item` → each distribution
84
+
85
+ Machine-navigable without OAI-PMH or SPARQL; assessed by F-UJI and expected by EOSC
86
+ harvesters. Ref: `../data-access-service/docs/eosc-roadmap.md` §2.9.
87
+
88
+ ### CKAN theming
89
+
90
+ Custom header (MARINERG-i logo), colour scheme (`--marinerg-primary: #003964`), favicon, background imagery.
91
+
92
+ ---
93
+
94
+ ## Planned
95
+
96
+ - **Keycloak SSO** — `ckanext-oidc-pkce` against ICHEC Keycloak; JIT user creation; group membership from JWT claims
97
+ - **NERC P01 parameters** — discipline-filtered allowlist; instrument/parameter linking
98
+ - **SeaDataNet device categories (L05)** — upgrade `equipment_name` from free text to controlled picker
99
+ - **DataCite export** — same schema and vocab registry; DOI registration
100
+ - **OAI-PMH endpoint** — for EOSC/B2FIND harvesting
101
+ - **MARINERG-i VO** — EOSC Virtual Organisation for consortium-level access policies
102
+
103
+ ---
104
+
105
+ ## Local development
106
+
107
+ This repo is a sibling of `data-access-service/`. The CKAN dev stack lives there:
108
+
109
+ ```sh
110
+ cd ../data-access-service/infra/ckan
111
+ docker compose -f compose.yml -f compose.local.yml up -d --build
112
+ # CKAN at http://localhost:5001 (port 5000 is owned by Docker Desktop's gvproxy)
113
+ # Login: ckan_admin / ckan_admin
114
+ ```
115
+
116
+ `compose.local.yml` mounts this repo into the container at `/srv/app/src/ckanext-marinerg`. Python and template changes are live immediately. Only dependency changes need a rebuild.
117
+
118
+ ### Facility service
119
+
120
+ The facility/equipment picker calls the Django facility service. For local dev it should be running on port 8000. The CKAN image has `http://host.docker.internal:8000` baked in at build time — Docker resolves this to the Mac host from inside the container.
121
+
122
+ ### Running tests
123
+
124
+ ```sh
125
+ python -m venv .venv
126
+ .venv/bin/pip install -e ".[test]"
127
+ .venv/bin/python -m pytest tests/ -v
128
+ ```
129
+
130
+ All tests run without a CKAN installation — `conftest.py` stubs `ckan.plugins.toolkit` so pure action/model/validator logic can be tested directly.
131
+
132
+ ### Linting and formatting
133
+
134
+ ```sh
135
+ tox -e format_check # check (CI)
136
+ tox -e format_apply # apply
137
+ tox -e style # flake8
138
+ tox -e type # mypy
139
+ tox -e registry # check controlled-metadata.yaml is in sync with the LinkML schema
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Vocabulary cache scripts
145
+
146
+ Run these manually (or on a schedule in CI) to update pinned snapshots. Commit the diff after reviewing.
147
+
148
+ ```sh
149
+ # NERC NVS collections (EPL processing levels, L10 CRS)
150
+ python scripts/fetch_nerc_vocabs.py
151
+
152
+ # SPDX license list
153
+ python scripts/fetch_spdx_licenses.py
154
+
155
+ # Regenerate controlled-metadata.yaml from the LinkML schema (also run by `tox -e registry`)
156
+ python scripts/generate_registry.py
157
+ ```
158
+
159
+ ---
160
+
161
+ ## CKAN config keys
162
+
163
+ Baked into `ckan.ini` at image build time via `RUN ckan config-tool` in `data-access-service/infra/ckan/Dockerfile`. Do not rely on runtime env vars — `prerun.py` only writes `ckan.plugins`.
164
+
165
+ | Key | Default | Purpose |
166
+ |---|---|---|
167
+ | `scheming.dataset_schemas` | — | Path to the marine dataset schema |
168
+ | `ckanext.dcat.rdf.profiles` | `euro_dcat_ap_3 marinerg_dcat` | RDF profile stack |
169
+ | `marinerg.zenodo_api_key` | `""` | Zenodo API key for prefill (optional) |
170
+ | `marinerg.facility_api_url` | `http://host.docker.internal:8000` | Django facility service base URL |
171
+ | `marinerg.facility_api_token` | `""` | Token for authenticated facility API access |
172
+ | `marinerg.portal_base_url` | `http://localhost:5001` | Fallback facility PID base when no ROR ID |
173
+
174
+ ---
175
+
176
+ ## Licence
177
+
178
+ Copyright ICHEC. GNU AGPL v3 or later.
@@ -0,0 +1 @@
1
+ __import__("pkg_resources").declare_namespace(__name__)
@@ -0,0 +1 @@
1
+ # ckanext-marinerg: MARINERG-i CKAN extension