This service takes lexical strings and attempts to map them to identifiers (curies) from a vocabulary or ontology.
The lookup is not exact, but includes partial matches.
Multiple results may be returned representing possible conceptual matches, but all of the identifiers have been correctly normalized using the NodeNormalization service.
See the documentation notebook for examples of use.
NameRes requires an Apache Solr database and the NameRes frontend running in Python. The easiest way to set this up is by using the Docker Compose setup included in this file, although you will need either (1) a set of synonyms files generated by Babel to load into Solr, or (2) a Solr database backup to load into Solr. The following instructions will work whichever of the two approaches you need to follow.
The simplest way to run NameRes locally is by using a Solr backup from another NameRes instance or from Translator.
- Make sure you have Docker installed; this should come with Docker Compose.
- Create the local directory where your Solr data will be stored -- by default, this is
./data/solr
in this directory, but you can change this in docker-compose.yml. This directory will need to have a maximum storage of approx 400G: 104G of the downloaded file (which can be deleted once decompressed), 147G of uncompressed backup (both of which can be deleted once restored) and 147G of Apache Solr databases. - Download the Solr backup URL you want to use into your Solr data directory. It should be approximately 104G in size.
- Uncompress the Solr backup file. It should produce a
var/solr/data/snapshot.backup
directory in the Solr data (by default,./data/solr/var/solr/data/snapshot.backup
). You can delete the downloaded file (snapshot.backup.tar.gz
) once it has been decompressed. - Check the docker-compose.yml file to ensure that it is
as you expect.
- By default, the Docker Compose file will use the latest released version of NameRes
as the frontend. To use the source code in this repository, you will need to change
the build instructions for the
nameres
service in the Docker Compose file.
- By default, the Docker Compose file will use the latest released version of NameRes
as the frontend. To use the source code in this repository, you will need to change
the build instructions for the
- Start the Solr and NameRes pods by running
docker-compose up
. By default, Docker Compose will download and start the relevant pods and show you logs from both sources. You may pressCtrl+C
to stop the pods. - Look for a line similar to
Uvicorn running on http://0.0.0.0:2433 (Press CTRL+C to quit)
, which tells you where NameRes is running.- By default, the web frontend (http://0.0.0.0:2433/docs) defaults to using the NameRes RENCI Dev — you will need to change the "Servers" setting to use your local NameRes instance.
- Note that looking up http://0.0.0.0:2433/status will give you an error (
Expected core not found.
). This is because the Solr database and indexes have not yet been loaded.
- Run the Solr restore script using
bash
, i.e.bash solr-restore/restore.sh
. This script assumes that the Solr pod is available onlocalhost:8983
and contains avar/solr/data/snapshot.backup
directory with the data to restore. - Look for the script to end properly (
Solr restore complete!
). Look up http://localhost:2433/status to ensure that the database has been loaded as expected, and use http://localhost:2433/docs (after changing the server) to try some test queries to make sure NameRes is working properly. - You can now delete the uncompressed database backup in
$SOLR_DATA/var
to save disk space.
The best way to do this is by using the data-loading Docker image.
Currently, NameRes is only packaged as a Docker image (see Dockerfile), but you can also run it directly via Uvicorn.
$ python -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ bash main.sh
Helm charts can be found at https://github.com/helxplatform/translator-devops/helm/name-lookup.
curl -X POST "http://localhost:2433/lookup?string=oxycod&offset=0&limit=10" -H "accept: application/json"
NameRes can be configured by setting environmental variables:
SOLR_HOST
andSOLR_PORT
: Hostname and port for the Solr database containing NameRes information.SERVER_NAME
: The name of this server (defaults toinfores:sri-name-resolver
)SERVER_ROOT
: The server root (defaults to/
)MATURITY_VALUE
: How mature is this NameRes (defaults tomaturity
, e.g.development
)LOCATION_VALUE
: Where is this NameRes setup (defaults tolocation
, e.g.RENCI
)OTEL_ENABLED
: Turn on Open TELemetry (default:'false'
) -- only'true'
will turn this on.JAEGER_HOST
andJAEGER_PORT
: Hostname and port for the Jaegar instance to provide telemetry to.JAEGER_SERVICE_NAME
: The name of this service (defaults to the value ofSERVER_NAME
)