While harvesting Metdata from different Chemistry Repositories, Each dataset has a relation between their corresponding datasets.(ontology mapping)
This is used by DataCite Schema to provide hierarical relation between the samples.
For Example:
In Chemtion Repository they relationship between sample -> Reaction is provided in metadata field "hasPart".
To provide these corrresponding smaple links to the HOME repository, we use this plugin in CKAN, to display hyperlink of the dataset.
In this Plugin Extension, you will also find database models for interacting by decalring models through SQLAlchemy model registration.
This plugin provides model classmethods for :
- Create Row Entry
- Get Related Values by Package ID (Related Sources and Related as variable)
- Get Alternate Names by Package ID
Database Migration is done, to establibsh new tables within the CKAN PostgreSQL database. For more information please check offical documenation: https://docs.ckan.org/en/2.9/extensions/best-practices.html
Compatibility with core CKAN versions:
CKAN version | Compatible? |
---|---|
2.8 & eariler | not tested |
2.9 | yes |
NOTE: If you are creating your own migration tables then, Please follow official documentation preciesly. (https://docs.ckan.org/en/2.9/extensions/best-practices.html)
You can copy migration python file and version control files, after creating migration is done. if you are using different table names & column names, please name them using "lower_cases" instead of CamelCase.
To install ckanext-related_resources:
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/bhavin2897/ckanext-related_resources.git
cd ckanext-related_resources
pip install -e .
pip install -r requirements.txt
Add related_resources
to the ckan.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 upgrade ckan database, for the tables you have created:
ckan -c /etc/ckan/default/ckan.ini db upgrade -p related_resources
You will get a message Upgrading DB: SUCCESS
.
Later, check the database list of tables for the ckan user to see the table for the migrated/generated table.
To Use the database Model in external plugins, import it as one module
from ckanext.related_resources.models.related_resources import RelatedResources
None at present
To install ckanext-related_resources for development, activate your CKAN virtualenv and do:
git clone https://github.com/bhavin2897/ckanext-related_resources.git
cd ckanext-related_resources
python setup.py develop
pip install -r dev-requirements.txt
Restart Server if you are using Supervisor and Nginx
sudo service supervisor reload
sudo service nginx reload
To upgrade ckan database, for the tables you have created:
ckan -c /etc/ckan/default/ckan.ini db upgrade -p related_resources
You will get a message Upgrading DB: SUCCESS
.
Later, check the database list of tables for the ckan user to see the table for the migrated/generated table.
To run the tests, do:
pytest --ckan-ini=test.ini
If ckanext-related_resources 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