ncbo / ncbo_cron

Jobs that run on a regular basis in the NCBO infrastructure
Other
2 stars 6 forks source link

Add a script to import an ontology and its latest_submission from another portal #57

Closed syphax-bouazzouni closed 2 years ago

syphax-bouazzouni commented 2 years ago

Preamble

The is an update/replacement of this : https://github.com/ncbo/virtual_appliance/blob/main/utils/bioportal_ontologies_import.rb

What

This PR adds a script ncbo_ontology_import to import an ontology and its latest_submission with all their data from another portal.

Why

I use it for my testing and debugging, typically when we have a bug in our production environment and we want to reproduce it in our stage/test/local environments

How to

Usage: ncbo_ontology_import [options]
    -o, --ontology ACRONYM           Ontologies acronyms which we want to import (separated by comma)
        --from url                   The ontoportal api url source of the ontology
        --from-api api               An apikey to access the ontoportal api
        --admin-user username        The target admin user that will submit the ontology
    -h, --help                       Display this screen

An example

bin/ncbo_ontology_import --from http://data.agroportal.lirmm.fr/ --from-api your_api_key -o SOSA --admin-user admin
jvendetti commented 2 years ago

Hi @syphax-bouazzouni. Thank you very much for this contribution. @alexskr and I were discussing it today, and if possible we'd prefer not to commit code with API keys. Admittedly, BioPortal is not secure in the regard, e.g., hovering over ontology download links in the Rails application shows the API key. Nevertheless, it would be good to try and follow the best practice of not keeping sensitive data in repositories. We were wondering if you would consider taking out the ncbobioportal API key? A simple change might be to display an error if the end user doesn't provide an API key.

syphax-bouazzouni commented 2 years ago

Hi @jvendetti , thank you for your fast reactivity.

I did what you suggested me (display an error if the end-user doesn't provide an API key) and did a new commit.