ckanext-doi
A CKAN extension for assigning a digital object identifier (DOI) to datasets, using the DataCite DOI service.
Science Score: 62.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
2 of 6 committers (33.3%) from academic institutions -
✓Institutional organization owner
Organization naturalhistorymuseum has institutional domain (www.nhm.ac.uk) -
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.2%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
A CKAN extension for assigning a digital object identifier (DOI) to datasets, using the DataCite DOI service.
Basic Info
Statistics
- Stars: 24
- Watchers: 11
- Forks: 21
- Open Issues: 13
- Releases: 33
Topics
Metadata Files
README.md
ckanext-doi
A CKAN extension for assigning a digital object identifier (DOI) to datasets, using the DataCite DOI service.
Overview
This extension assigns a digital object identifier (DOI) to datasets, using the DataCite DOI service.
When a new dataset is created it is assigned a new DOI. This DOI will be in the format:
https://doi.org/[prefix]/[8 random alphanumeric characters]
If the new dataset is active and public, the DOI and metadata will be registered with DataCite.
If the dataset is draft or private, the DOI will not be registered with DataCite. When the dataset is made active & public, the DOI will be registered. This allows datasets to be embargoed, but still provides a DOI to be referenced in publications.
You will need a DataCite account to use this extension.
DOI Metadata
This extension currently uses DataCite Metadata Schema v4.2.
Dataset package fields and CKAN config settings are mapped to the DataCite Schema with default values, but these can be overwritten by implementing IDoi interface methods.
Required fields
| CKAN Field | DataCite Schema | |-------------------------------|-----------------| | dataset:title | title | | dataset:author | creator | | config:ckanext.doi.publisher | publisher | | dataset:metadata_created.year | publicationYear | | dataset:type | resourceType |
See metadata.py for full mapping details.
Installation
Path variables used below:
- $INSTALL_FOLDER (i.e. where CKAN is installed), e.g. /usr/lib/ckan/default
- $CONFIG_FILE, e.g. /etc/ckan/default/development.ini
Installing from PyPI
shell
pip install ckanext-doi
Installing from source
Clone the repository into the
srcfolder:shell cd $INSTALL_FOLDER/src git clone https://github.com/NaturalHistoryMuseum/ckanext-doi.gitActivate the virtual env:
shell . $INSTALL_FOLDER/bin/activateInstall via pip:
shell pip install $INSTALL_FOLDER/src/ckanext-doi
Installing in editable mode
Installing from a pyproject.toml in editable mode (i.e. pip install -e) requires setuptools>=64; however, CKAN 2.9 requires setuptools==44.1.0. See our CKAN fork for a version of v2.9 that uses an updated setuptools if this functionality is something you need.
Post-install setup
Add 'doi' to the list of plugins in your
$CONFIG_FILE:ini ckan.plugins = ... doiUpgrade the database to create the tables:
shell ckan -c $CONFIG_FILE db upgrade -p doiThis extension will only work if you have signed up for an account with DataCite. You will need a development/test account to use this plugin in test mode, and a live account to mint active DOIs.
Configuration
These are the options that can be specified in your .ini config file.
DateCite Credentials [REQUIRED]
DataCite Repository account credentials are used to register DOIs. A Repository account is administered by a DataCite Member.
| Name | Description | Example |
|--------------------------------|---------------------------------------------------------------------------------------------------------|------------|
| ckanext.doi.account_name | Your DataCite Repository account name | ABC.DEFG |
| ckanext.doi.account_password | Your DataCite Repository account password | |
| ckanext.doi.prefix | The prefix taken from your DataCite Repository account (from your test account if running in test mode) | 10.1234 |
Institution Name [REQUIRED]
You also need to provide the name of the institution publishing the DOIs (e.g. Natural History Museum).
| Name | Description |
|-------------------------|------------------------------------------------|
| ckanext.doi.publisher | The name of the institution publishing the DOI |
Test/Debug Mode [REQUIRED]
If test mode is set to true, the DOIs will use the DataCite test site. The test site uses a separate account, so you must also change your credentials and prefix.
| Name | Description | Options |
|-------------------------|----------------------|------------|
| ckanext.doi.test_mode | Enable dev/test mode | True/False |
Note that the DOIs will still display on your web interface as https://doi.org/YOUR-DOI, but they will not resolve. Log in to your test account to view all your minted test DOIs, or replace https://doi.org/ with https://doi.test.datacite.org/dois/ in a single URL to view a specific DOI.
Other options
| Name | Description | Default |
|--------------------------|--------------------------------------------|-----------------|
| ckanext.doi.site_url | Used to build the link back to the dataset | ckan.site_url |
| ckanext.doi.site_title | Site title to use in the citation | None |
Usage
Commands
doi
delete-dois: delete all DOIs from the database (not datacite).bash ckan -c $CONFIG_FILE doi delete-doisupdate-doi: update the datacite metadata for one or all packages.bash ckan -c $CONFIG_FILE doi update-doi [PACKAGE_ID]
Interfaces
The IDoi interface allows plugins to extend the build_metadata_dict and build_xml_dict
methods.
build_metadata_dict(pkg_dict, metadata_dict, errors)
Breaking changes from v1:
- previously called
build_metadata - new parameter:
errors - new return value: tuple of
metadata_dict,errors
Extracts metadata from a pkg_dict for use in generating datacite DOIs. The base method from this extension is run first, then the metadata dict is passed through all the implementations of this method. After running these, if any of the required values (see above) are still in the errors dict (i.e. they still could not be handled by any other extension), a DOIMetadataException will be thrown.
| Parameter | Description |
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| pkg_dict | The original package dictionary from which the metadata were extracted. |
| metadata_dict | The current metadata dict, created by the ckanext-doi extension and any previous plugins implementing IDoi. |
| errors | A dictionary of metadata keys and errors generated by previous plugins; this method should remove any keys that it successfully processes and overwrites. |
build_xml_dict(metadata_dict, xml_dict)
Breaking changes from v1:
- previously called
metadata_to_xml - parameters rearranged (previously
xml_dict,metadata)
Converts the metadatadict into an xmldict that can be passed to the datacite library's schema42.tostring() and schema42.validate() methods. The base method from this extension is run first, then the xml dict is passed through all the implementations of this method.
| Parameter | Description |
|-----------------|--------------------------------------------------------------------------------------------------------|
| metadata_dict | The original metadata dictionary from which the xml attributes are extracted. |
| xml_dict | The current xml dict, created by the ckanext-doi extension and any previous plugins implementing IDoi. |
Templates
Package citation snippet
html+jinja
{% snippet "doi/snippets/package_citation.html", pkg_dict=g.pkg_dict %}
Resource citation snippet
html+jinja
{% snippet "doi/snippets/resource_citation.html", pkg_dict=g.pkg_dict, res=res %}
Testing
There is a Docker compose configuration available in this repository to make it easier to run tests. The ckan image uses the Dockerfile in the docker/ folder.
To run the tests can be run against ckan 2.9.x and 2.10.x on Python3:
Build the required images:
shell docker compose buildThen run the tests. The root of the repository is mounted into the ckan container as a volume by the Docker compose configuration, so you should only need to rebuild the ckan image if you change the extension's dependencies. ```shell
run tests against ckan 2.9.x
docker compose run latest
# run tests against ckan 2.10.x docker compose run next ```
Note that the tests mock the DataCite API and therefore don't require an internet connection nor your DataCite credentials to run.
Owner
- Name: Natural History Museum
- Login: NaturalHistoryMuseum
- Kind: organization
- Location: London
- Website: https://www.nhm.ac.uk
- Repositories: 171
- Profile: https://github.com/NaturalHistoryMuseum
Citation (CITATION.cff)
cff-version: 1.2.0
title: CKAN Doi extension
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- name: Natural History Museum
city: London
country: GB
alias: NHM
email: data@nhm.ac.uk
repository-code: 'https://github.com/NaturalHistoryMuseum/ckanext-doi'
abstract: A CKAN extension for assigning a digital object identifier (DOI) to datasets, using the DataCite DOI service.
keywords:
- ckan
- ckanext
- doi
license: GPL-3.0-or-later
version: 4.0.3
GitHub Events
Total
- Create event: 11
- Release event: 4
- Issues event: 5
- Watch event: 2
- Delete event: 8
- Member event: 1
- Issue comment event: 9
- Push event: 34
- Pull request event: 19
- Pull request review event: 1
Last Year
- Create event: 11
- Release event: 4
- Issues event: 5
- Watch event: 2
- Delete event: 8
- Member event: 1
- Issue comment event: 9
- Push event: 34
- Pull request event: 19
- Pull request review event: 1
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 217
- Total Committers: 6
- Avg Commits per committer: 36.167
- Development Distribution Score (DDS): 0.585
Top Committers
| Name | Commits | |
|---|---|---|
| Ginger Butcher | a****i@g****m | 90 |
| benscott | b****n@b****k | 87 |
| Josh Humphries | j****s@n****k | 28 |
| github-actions[bot] | g****]@u****m | 7 |
| Francesco Frassinelli | f****i@n****o | 4 |
| Paul | p****e@n****k | 1 |
Committer Domains (Top 20 + Academic)
Packages
- Total packages: 1
-
Total downloads:
- pypi 441 last-month
- Total dependent packages: 2
- Total dependent repositories: 0
- Total versions: 23
- Total maintainers: 1
pypi.org: ckanext-doi
A CKAN extension for assigning a digital object identifier (DOI) to datasets, using the DataCite DOI service.
- Documentation: https://ckanext-doi.readthedocs.io/
- License: GPL-3.0-or-later
-
Latest release: 4.0.3
published 7 months ago
Rankings
Maintainers (1)
Dependencies
- datacite ==1.1.2
- jsonschema ==3.0.0
- xmltodict ==0.12.0
- actions/checkout v3 composite
- commitizen-tools/commitizen-action master composite
- softprops/action-gh-release v1 composite
- actions/checkout v3 composite
- actions/checkout v3 composite
- actions/setup-python v3 composite
- pypa/gh-action-pypi-publish release/v1 composite
- ckan/ckan-solr 2.9
- redis latest
- mkdocs *
- mkdocs-gen-files *
- mkdocs-include-markdown-plugin *
- mkdocs-material *
- mkdocs-section-index *
- mkdocstrings *
- ckantools >=0.3.0
- datacite ==1.1.2
- jsonschema ==3.0.0
- xmltodict ==0.12.0
- actions/checkout v3 composite
- connor-baer/action-sync-branch main composite