Files
smartguide/service

Service

Python REST API using FastAPI, packaged as a Docker container. The build is automated using Gradle.

Building

To build the container: ./gradlew :service:build

Development

To launch the service with hot-reload: ./gradlew :service:serve

This mounts the source directory into the container and enables uvicorn hot-reloading. Press ENTER to stop.

Testing

Run tests: ./gradlew :service:test

Scripts

index_org_patents.py

Builds the org_patents Elasticsearch index for a given institution. This pre-indexes all patents linked to an institution (via institution assignee and author name matching) so they can be browsed efficiently in the app.

python scripts/index_org_patents.py --institution-id <OpenAlex-ID>

Example — University of Duisburg-Essen:

python scripts/index_org_patents.py --institution-id I62318514

The OpenAlex institution ID appears in the app URL, e.g. /institution/I62318514/overview.

Runtime: ~10–30 minutes for large institutions (UDE has ~76,000 patents). Re-running is safe — existing entries are replaced.

Note: This script is intended to be integrated into an Admin Panel in a later sprint, so that organisation admins can trigger the indexing as a background job via the UI.