Scientometrics metrics for CKAN users. The extension lets you:
- store author identifiers (per source) in user extras (
plugin_extras) - fetch author-level metrics from external providers
- persist fetched metrics in dedicated DB tables
- display selected metrics on the user page
Supported sources (as implemented):
- Google Scholar (author profile metrics)
- Semantic Scholar (author metrics)
- OpenAlex (author metrics)
- User author identifiers are stored in the user
plugin_extrasunderscim: keys like<source>_author_id(e.g.google_scholar_author_id). - Metrics are fetched via per-source extractors and stored in:
scim_user_metric(per user + source)scim_dataset_metric(reserved for dataset metrics; currently only model/migration exist)
- The user page template can render cards for enabled sources using the stored metrics.
Enable the plugin in CKAN config:
ckan.plugins = ... scientometricsConfigure which metric sources are enabled:
ckanext.scientometrics.enabled_metrics = google_scholar semantic_scholar openalex
ckanext.scientometrics.show_on_user_page = trueIn the user edit form, the extension adds extra fields (one per enabled source).
The values are stored under plugin_extras["scim"] as:
google_scholar_author_idsemantic_scholar_author_idopenalex_author_id
The extension provides actions to fetch and store metrics. A typical call:
scim_update_user_metricswith:user_id(id or name)requested_sources(optional list of sources; defaults to enabled sources)
Stored records are keyed by (user_id, source) in scim_user_metric.
To retrieve stored metrics:
scim_get_user_metricswith:user_id
Returns a dict keyed by source, where each value is built from the stored JSON metrics
plus metadata like status and external references (when present).
The extension exposes a CLI command:
ckan scim update-user-metricsOptions:
--user-ids <id>(repeatable): update only specified user IDs--requested-sources <source>(repeatable): update only specified sources
If no --user-ids are provided, it updates all users.
This extension creates two tables:
-
scim_user_metric- unique constraint:
(user_id, source) - stores:
metrics(JSONB)external_id,external_urlstatus- timestamps
extras(JSONB for future metadata)
- unique constraint:
-
scim_dataset_metric- unique constraint:
(package_id, source) - same structure as user metrics table
- unique constraint:
Foreign keys are configured with ondelete="CASCADE".
Compatibility with core CKAN versions:
| CKAN version | Compatible? |
|---|---|
| 2.9 and earlier | no |
| 2.10+ | yes |
(Tests run in CI on a CKAN 2.11 container.)
To install ckanext-scientometrics:
-
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/DataShades/ckanext-scientometrics.git cd ckanext-scientometrics pip install -e . pip install -r requirements.txt
-
Add
scientometricsto theckan.pluginssetting in your CKAN config file (by default/etc/ckan/default/ckan.ini). -
Restart CKAN (eg on Ubuntu + Apache):
sudo service apache2 reload
-
ckanext.scientometrics.enabled_metrics(type: list)- default:
google_scholar semantic_scholar openalex - enabled sources; controls which user fields are shown and which sources can be updated
- default:
-
ckanext.scientometrics.show_on_user_page(type: bool)- default:
true - show metrics cards on the user page
- default:
Example:
ckan.plugins = ... scientometrics
ckanext.scientometrics.enabled_metrics = openalex semantic_scholar
ckanext.scientometrics.show_on_user_page = trueTo install for development:
git clone https://github.com/DataShades/ckanext-scientometrics.git
cd ckanext-scientometrics
pip install -e .
pip install -r dev-requirements.txtTo run tests:
pytest --ckan-ini=test.ini