This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
NameRes (Name Resolver) is a biomedical entity name resolution service that maps lexical strings to CURIEs from vocabularies/ontologies. It is part of the NCATS Translator ecosystem. The API is built with FastAPI and backed by Apache Solr.
# Load test data into Solr first (requires Solr running)
./data-loading/setup-and-load-solr.sh tests/data/test-synonyms.json
# Run all tests
python -m pytest tests/
# Run a single test
python -m pytest tests/test_service.py::test_function_name# Start full stack (Solr + API)
docker-compose up
# Run API directly (requires Solr already running)
uvicorn api.server:app --host 0.0.0.0 --port 2433# Download synonyms, start Solr, load data (production)
cd data-loading && make all
# Individual steps
make start-solr-backup
make check-solr-backup
make stop-solrpip install -r requirements.txt- Client sends query to FastAPI endpoint on port 2433
api/server.pyconstructs Solr query parametershttpxasync client queries the Solr instance (default:localhost:8983)- Results are scored, normalized, and returned as JSON
api/server.py- Core FastAPI application (~717 lines): all endpoints, Pydantic models, Solr query construction, environment configapi/apidocs.py- Custom OpenAPI schema constructionapi/resources/.openapi.yml- OpenAPI 3.0.2 spec with service metadatamain.py/main.sh- WSGI/ASGI entry points (port 2433)tests/test_service.py- Integration tests using FastAPITestClienttests/data/test-synonyms.json- Test dataset for Solr
SOLR_HOST/SOLR_PORT- Solr connection (default:localhost:8983)LOGLEVEL- Logging levelSERVER_ROOT- API root path prefixMATURITY_VALUE/LOCATION_VALUE- TRAPI metadata fields
GET/POST /lookup- Primary name-to-CURIE lookup with scoringPOST /bulk-lookup- Batch queries viaNameResQuerymodelGET /reverse-lookup- CURIE-to-names lookupPOST /synonyms- Get synonyms for a list of CURIEsPOST /lookup-curies- Filter existing CURIEs with type subsettingGET /status- Health check with Solr document counts
Solr documents contain: curie, preferred_name, names (synonym list), and biolink type information. Lookup results are LookupResult objects with scoring fields. Results are conflated using GeneProtein and DrugChemical conflation rules.
- Stateless API container - Python 3.11.5/FastAPI
- Persistent Solr 9.1 - Data in volume-mounted
./data/solr - Data loading - Separate pipeline in
data-loading/(Makefile-driven, also has Kubernetes configs) - CI/CD - GitHub Actions: runs tests on push, publishes Docker image to GitHub Packages on release
documentation/API.md- Endpoint referencedocumentation/Deployment.md- Docker/Kubernetes deployment guidedocumentation/Scoring.md- Scoring algorithm detailsdocumentation/NameResolution.ipynb- Interactive usage examples