Files
smartguide/service/README.md
T
khaltiandClaude Sonnet 5 807a32eb5a
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev Build queued...
fix(patents): fix moved script's path resolution and stop gating org_patents identity checks behind the now-loosened is_ambiguous_name so a locally-unique name can't bypass institution/topic verification
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 00:03:18 +02:00

2.1 KiB
Raw Blame History

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: fetches its OpenAlex authors, searches EPO/USPTO for patents matched via institution assignee and/or inventor name, and reindexes. Each patent is tagged with a match_type (institution, name, or both, the latter being highest confidence). Every inventor-name match counts outright only if the assignee is the institution itself; everything else matched on name alone — a personal-assignee match or a third-party assignee (e.g. an industry partner on a co-invented patent) — only counts if the patent's primary IPC/CPC classification also maps to OpenAlex research topics that appear on the author's own profile. This applies regardless of how common the name looks in our local OpenAlex data — a name can appear unique there while still being common globally in EPO/USPTO, so a bare name match alone is never a strong enough signal on its own.

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

Example — University of Duisburg-Essen:

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

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

Runtime: ~30–40 minutes for large institutions (author count is the main driver). Re-running is safe — existing documents for the institution are deleted (via search + _bulk delete-by-id, not _delete_by_query, which the patent-cluster API key rejects) before reindexing, so stale documents don't linger.

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.