add author comparison feature with yearly works visualization

This commit is contained in:
Steven Tischer
2026-07-13 07:19:33 +02:00
parent 64ccedf44d
commit 7775400a3f
13 changed files with 421 additions and 3 deletions
+8
View File
@@ -141,6 +141,13 @@ def _yearly_works_query(
"execution_hint": "map",
},
"aggs": {
"author_name": {
"terms": {
"field": "authorships.author.display_name.keyword",
"size": 1,
"execution_hint": "map",
},
},
"to_work": {
"reverse_nested": {},
"aggs": {
@@ -207,6 +214,7 @@ async def yearly_works_for_authors(
results.append(
AuthorYearlyWorks(
author_id=author_bucket.get("key", ""),
display_name=_display_name_from_bucket(author_bucket),
years=years,
)
)
+1
View File
@@ -137,6 +137,7 @@ class YearCount(BaseModel):
class AuthorYearlyWorks(BaseModel):
author_id: str = Field(description="The OpenAlex ID of the author.")
display_name: str = Field(description="The name of the author.")
years: List[YearCount] = Field(
description="Per-year count of the author's works on the topic, newest year first.",
)