add author comparison feature with yearly works visualization
This commit is contained in:
@@ -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,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -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.",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user