Skip to content

Commit 7ddaf9f

Browse files
committed
Merge branch 'master' into update-jupyter-notebook
2 parents 9043eef + 65c6ad8 commit 7ddaf9f

20 files changed

+1317
-328
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020-2024 NCATS Translator SRI team
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 63 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,79 @@ correctly normalized using the [NodeNormalization service](https://nodenormaliza
88

99
See the documentation [notebook](documentation/NameResolution.ipynb) for examples of use.
1010

11-
## Docker setup
12-
13-
`docker-compose up`
14-
15-
## native setup
16-
17-
### Solr database
18-
19-
See instructions in the `data-loading/` directory.
20-
21-
### API
11+
## Setting up NameRes locally
12+
13+
NameRes requires an Apache Solr database and the NameRes frontend running in Python.
14+
The easiest way to set this up is by using the Docker Compose setup included in this
15+
file, although you will need either (1) a set of synonyms files generated by Babel
16+
to load into Solr, or (2) a Solr database backup to load into Solr. The following
17+
instructions will work whichever of the two approaches you need to follow.
18+
19+
### Starting NameRes locally with loading from a Solr backup
20+
21+
The simplest way to run NameRes locally is by using a Solr backup from another NameRes
22+
instance or from Translator.
23+
24+
1. Make sure you have [Docker](https://www.docker.com/) installed; this should come
25+
with [Docker Compose](https://docs.docker.com/compose/install/).
26+
2. Create the local directory where your Solr data will be stored -- by default, this is
27+
`./data/solr` in this directory, but you can change this in
28+
[docker-compose.yml](./docker-compose.yml). This directory will need to have a maximum
29+
storage of approx 400G: 104G of the downloaded file (which can be deleted once decompressed),
30+
147G of uncompressed backup (both of which can be deleted once restored) and 147G of
31+
Apache Solr databases.
32+
3. Download the Solr backup URL you want to use into your Solr data directory. It should be
33+
approximately 104G in size.
34+
4. Uncompress the Solr backup file. It should produce a `var/solr/data/snapshot.backup` directory
35+
in the Solr data (by default, `./data/solr/var/solr/data/snapshot.backup`). You can delete
36+
the downloaded file (`snapshot.backup.tar.gz`) once it has been decompressed.
37+
5. Check the [docker-compose.yml](./docker-compose.yml) file to ensure that it is
38+
as you expect.
39+
* By default, the Docker Compose file will use the latest released version of NameRes
40+
as the frontend. To use the source code in this repository, you will need to change
41+
the build instructions for the `nameres` service in the Docker Compose file.
42+
6. Start the Solr and NameRes pods by running `docker-compose up`. By default, Docker Compose
43+
will download and start the relevant pods and show you logs from both sources. You may
44+
press `Ctrl+C` to stop the pods.
45+
7. Look for a line similar to `Uvicorn running on http://0.0.0.0:2433 (Press CTRL+C to quit)`,
46+
which tells you where NameRes is running.
47+
* By default, the web frontend (http://0.0.0.0:2433/docs) defaults to using the
48+
[NameRes RENCI Dev](https://name-resolution-sri.renci.org/docs) — you will need to
49+
change the "Servers" setting to use your local NameRes instance.
50+
* Note that looking up http://0.0.0.0:2433/status will give you an error (`Expected core not found.`).
51+
This is because the Solr database and indexes have not yet been loaded.
52+
8. Run the Solr restore script using `bash`, i.e. `bash solr-restore/restore.sh`. This script
53+
assumes that the Solr pod is available on `localhost:8983` and contains a
54+
`var/solr/data/snapshot.backup` directory with the data to restore.
55+
9. Look for the script to end properly (`Solr restore complete!`). Look up http://localhost:2433/status
56+
to ensure that the database has been loaded as expected, and use http://localhost:2433/docs (after
57+
changing the server) to try some test queries to make sure NameRes is working properly.
58+
10. You can now delete the uncompressed database backup in `$SOLR_DATA/var` to save disk space.
59+
60+
#### Loading from synonyms files
61+
62+
The best way to do this is by using the [data-loading Docker image](./data-loading/README.md).
63+
64+
### Python packaging
65+
66+
Currently, NameRes is only packaged as a Docker image (see [Dockerfile](./Dockerfile)), but you can
67+
also run it directly via Uvicorn.
2268

2369
```bash
24-
pip install -r requirements.txt
25-
./main.sh
70+
$ python -m venv venv
71+
$ source venv/bin/activate
72+
$ pip install -r requirements.txt
73+
$ bash main.sh
2674
```
2775

2876
### Kubernetes
2977

30-
Helm charts can be found at https://github.com/helxplatform/translator-devops/helm/r3
78+
Helm charts can be found at https://github.com/helxplatform/translator-devops/helm/name-lookup.
3179

3280
## examples
3381

3482
```bash
35-
curl -X POST "http://localhost:6434/lookup?string=oxycod&offset=0&limit=10" -H "accept: application/json"
83+
curl -X POST "http://localhost:2433/lookup?string=oxycod&offset=0&limit=10" -H "accept: application/json"
3684
```
3785

3886
## Configuration

api/resources/openapi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.0.2
22
info:
33
title: Name Resolver
4-
version: 1.3.12
4+
version: 1.6.0
55
email: bizon@renci.org
66
name: Chris Bizon
77
x-id: https://github.com/cbizon

0 commit comments

Comments
 (0)