This CKAN plugin provides following endpoints to support NDP users submitting new datasets to Prekan, as well as modifying/deleting datasets that have already been submitted. Users must use a valid Keycloak token as a Bearer token to access these endpoints. Submitted datasets are not formally transferred to the NDP catalog until they have been reviewed.
-
Create a new dataset in Prekan by submitting a JSON string with the fields specified in this link: https://docs.ckan.org/en/2.10/api/#ckan.logic.action.create.package_create
-
Update a dataset in Prekan by submitting a JSON string with the fields specified in this link: https://docs.ckan.org/en/2.10/api/#ckan.logic.action.create.package_update
-
Delete a dataset in Prekan by submitting a JSON string with the fields specified in this link: https://docs.ckan.org/en/2.10/api/#ckan.logic.action.create.package_delete
Deleting a dataset does not physically remove the dataset entirely. The dataset is simply marked as deleted in Prekan so that it no longer appears in the list of datasets and in search results. To actually delete a dataset call package_purge as an administrator.
-
Purge a dataset in Prekan by submitting a JSON string with the fields specified in this link: https://docs.ckan.org/en/2.10/api/#ckan.logic.action.delete.dataset_purge
Please note that the admin privilege is required to invoke this endpoint.
-
List all datasets submitted by the current user that have not yet been reviewed.
-
List all datasets submitted by the current user that have been reviewed.
This plugin creates a new Prekan account for the user, if the information in the Keycloak token used by the user does not have a corresponding account in Prekan.
The plugin also creates a new Prekan organization if the dataset belongs to an organization that does not exist in Prekan.
When a user includes the organization to which the dataset belongs in a request for the dataset, the user will be added to that organization as an editor.
Only users with admin or review identities can use the following endpoints:
-
Approve a dataset in Prekan by submitting a JSON string with the fields specified in this link: https://docs.ckan.org/en/2.10/api/#ckan.logic.action.delete.dataset_purge
This endpoint copies the specified dataset to the production CKAN catalog. The correspondence between the dataset and its creator and the organization it belongs to is also copied to the production CKAN's catalog. After a successful copy operation, the dataset in Prekan is marked as deleted, and associate the reviewer name, the review time and the review result “approved” to the dataset.
-
Reject a dataset in Prekan by submitting a JSON string with the fields specified in this link: https://docs.ckan.org/en/2.10/api/#ckan.logic.action.delete.dataset_purge
This endpoint will make the specified dataset as deleted in Prekan, and the reviewer name, the review time and the review result “rejected” are assoicated to the dataset.
-
List all datasets that have not yet been reviewed.
Compatibility with core CKAN versions:
CKAN version | Compatible? |
---|---|
2.6 and earlier | not tested |
2.7 | yes |
2.8 | yes |
2.9 | yes |
- "yes"
- "not tested" - I can't think of a reason why it wouldn't work
- "not yet" - there is an intention to get it working
- "no"
To install ckanext-ndpcatalogadditions:
-
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
-
Clone the source and install it on the virtualenv
git clone https://github.com/SDSC/ckanext-ndpcatalogadditions.git cd ckanext-ndpcatalogadditions pip install -e . pip install -r requirements.txt
-
Add
ndpcatalogadditions
to theckan.plugins
setting in your CKAN config file (by default the config file is located at/etc/ckan/default/ckan.ini
). -
Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
To install ckanext-ndpcatalogadditions for development, activate your CKAN virtualenv and do:
git clone https://github.com/SDSC/ckanext-ndpcatalogadditions.git
cd ckanext-ndpcatalogadditions
python setup.py develop
pip install -r dev-requirements.txt
To run the tests, do:
pytest --ckan-ini=test.ini
If ckanext-ndpcatalogadditions should be available on PyPI you can follow these steps to publish a new version:
-
Update the version number in the
setup.py
file. See PEP 440 for how to choose version numbers. -
Make sure you have the latest version of necessary packages:
pip install --upgrade setuptools wheel twine
-
Create a source and binary distributions of the new version:
python setup.py sdist bdist_wheel && twine check dist/*
Fix any errors you get.
-
Upload the source distribution to PyPI:
twine upload dist/*
-
Commit any outstanding changes:
git commit -a git push
-
Tag the new release of the project on GitHub with the version number from the
setup.py
file. For example if the version number insetup.py
is 0.0.1 then do:git tag 0.0.1 git push --tags