Skip to content

feat: add REST API for biomapper2#57

Merged
UncertainSpin merged 3 commits intomainfrom
feature/rest-api
Mar 29, 2026
Merged

feat: add REST API for biomapper2#57
UncertainSpin merged 3 commits intomainfrom
feature/rest-api

Conversation

@trentleslie
Copy link
Copy Markdown
Collaborator

Summary

  • Implements a FastAPI-based REST API exposing biomapper2 mapping functionality
  • Adds deployment infrastructure (systemd service, GitHub Actions workflow)
  • Currently live at https://biomapper.expertintheloop.io

Endpoints

Mapping

Method Endpoint Description
POST /api/v1/map/entity Single entity mapping
POST /api/v1/map/batch Batch entity mapping
POST /api/v1/map/dataset File upload mapping
POST /api/v1/map/dataset/stream NDJSON streaming

Discovery

Method Endpoint Description
GET /api/v1/health Health check
GET /api/v1/entity-types List supported entity types
GET /api/v1/annotators List available annotators
GET /api/v1/vocabularies List supported vocabularies

Files Changed

  • src/biomapper2/api/ - New API package (routes, models, auth)
  • deploy/ - Systemd service and deployment docs
  • .github/workflows/deploy-api.yml - Auto-deploy workflow
  • tests/test_api.py - 16 API tests (all passing)

Test plan

  • All 16 API tests passing locally
  • Production deployment verified at https://biomapper.expertintheloop.io
  • Health endpoint confirms mapper initialized
  • Entity mapping endpoint returns valid KG IDs

🤖 Generated with Claude Code

trentleslie and others added 3 commits February 17, 2026 11:58
Implements a FastAPI-based REST API exposing biomapper2 mapping functionality:

- POST /api/v1/map/entity - single entity mapping
- POST /api/v1/map/batch - batch entity mapping
- POST /api/v1/map/dataset - file upload mapping
- POST /api/v1/map/dataset/stream - NDJSON streaming
- GET /api/v1/health - health check
- GET /api/v1/entity-types - list supported types
- GET /api/v1/annotators - list available annotators
- GET /api/v1/vocabularies - list supported vocabularies

Includes optional API key authentication, Mapper singleton via lifespan,
systemd service unit, and GitHub Actions deployment workflow.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Support multiple API keys via comma-separated BIOMAPPER2_API_KEYS env var,
with fallback to single BIOMAPPER_API_KEY for backward compatibility.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The Kestrel API's disease name mapping precision varies between runs.
Lower threshold matches current behavior; TODO remains for future improvement.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@amykglen
Copy link
Copy Markdown
Member

thanks @trentleslie, this is awesome! I scanned the PR and it looks good to me, but wondering if @UncertainSpin wants to take a look? I'm guessing there may be some overlap with pydantic models he's been working on(?)

@UncertainSpin UncertainSpin merged commit a7779f3 into main Mar 29, 2026
2 checks passed
@trentleslie trentleslie deleted the feature/rest-api branch April 13, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants