Merge branch 'dev' into feat/ranking
This commit is contained in:
@@ -5,12 +5,18 @@ index_org_patents.py — Build the org_patents Elasticsearch index for one insti
|
||||
Fetches all OpenAlex authors affiliated with the institution, searches EPO/USPTO for
|
||||
patents matched via institution assignee and/or author name (match_type: "institution",
|
||||
"name", or "both"), deletes existing documents for the institution, and reindexes.
|
||||
Every inventor-name match counts outright only if the assignee is the institution
|
||||
itself; everything else (a personal-assignee match or a third-party assignee) only
|
||||
counts if the patent's primary IPC/CPC classification also maps to OpenAlex research
|
||||
topics that appear on the author's own profile — applied regardless of how common the
|
||||
name looks in our local OpenAlex data, since a name can appear unique there while
|
||||
still being common globally in EPO/USPTO.
|
||||
|
||||
Usage:
|
||||
python scripts/index_org_patents.py --institution-id <OpenAlex-ID>
|
||||
python scripts/patents/index_org_patents.py --institution-id <OpenAlex-ID>
|
||||
|
||||
Example (University of Duisburg-Essen):
|
||||
python scripts/index_org_patents.py --institution-id I62318514
|
||||
python scripts/patents/index_org_patents.py --institution-id I62318514
|
||||
|
||||
Requires src/main/inse/.env with PATENT_ELASTICSEARCH_URL/API_KEY (and OpenAlex ES
|
||||
credentials for author lookup). Runtime scales with author count (~30-40 min for UDE's
|
||||
@@ -27,11 +33,12 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
current_dir = Path(__file__).resolve().parent
|
||||
sys.path.insert(0, str(current_dir.parent / "src" / "main"))
|
||||
service_dir = current_dir.parent.parent
|
||||
sys.path.insert(0, str(service_dir / "src" / "main"))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv(dotenv_path=current_dir.parent / "src" / "main" / "inse" / ".env")
|
||||
load_dotenv(dotenv_path=service_dir / "src" / "main" / "inse" / ".env")
|
||||
|
||||
from inse.patents.org.logic import index_org_patents_for_institution
|
||||
|
||||
@@ -43,7 +50,7 @@ async def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Build the org_patents index for one institution.",
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
epilog="Example: python scripts/index_org_patents.py --institution-id I62318514",
|
||||
epilog="Example: python scripts/patents/index_org_patents.py --institution-id I62318514",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--institution-id",
|
||||
|
||||
Reference in New Issue
Block a user