diff --git a/service/src/main/inse/ranking/logic.py b/service/src/main/inse/ranking/logic.py index 1340f2ee..808a1bd3 100644 --- a/service/src/main/inse/ranking/logic.py +++ b/service/src/main/inse/ranking/logic.py @@ -410,31 +410,16 @@ async def topic_stats_for_authors( return results -def _primary_topic_match(keywords: list[str], fuzzy: bool) -> dict: - """Matches works whose primary topic is one of the searched topics/keywords.""" - if fuzzy: - return {"terms": {"primary_topic.id": keywords}} - - return { - "bool": { - "should": [ - {"match_phrase": {"primary_topic.display_name": keyword}} - for keyword in keywords - ], - "minimum_should_match": 1, - }, - } - - def _topic_profile_query( author_ids: list[str], - keywords: list[str], - operator: KeywordOperator, publication_types: list[PublicationType], timespan: Timespan | None, - fuzzy: bool = False, ) -> dict: - """Builds the Section 3 query""" + """Builds the Section 3 query. + + Unfiltered by keywords on purpose: the topic profile always describes each + author's complete body of work in the timespan. + """ filters = [_author_filter(author_ids)] @@ -475,14 +460,6 @@ def _topic_profile_query( "to_work": { "reverse_nested": {}, "aggs": { - "matched": { - "filter": _build_keyword_query(keywords, operator, fuzzy), - "aggs": { - "primary_match": { - "filter": _primary_topic_match(keywords, fuzzy), - }, - }, - }, "by_subfield": { "terms": { "field": "primary_topic.subfield.display_name.keyword", @@ -555,11 +532,8 @@ def _topic_profile_query( async def topic_profile_for_authors( author_ids: list[str], - keywords: list[str], - operator: KeywordOperator, publication_types: list[PublicationType], timespan: Timespan | None, - fuzzy: bool = False, ) -> list[AuthorTopicProfile]: if not author_ids: @@ -567,9 +541,7 @@ async def topic_profile_for_authors( response: dict[str, Any] = await elasticsearch.search( index=config.settings.openalex_works_search_index, - body=_topic_profile_query( - author_ids, keywords, operator, publication_types, timespan, fuzzy - ), + body=_topic_profile_query(author_ids, publication_types, timespan), cluster=ESCluster.NES, ) @@ -585,7 +557,6 @@ async def topic_profile_for_authors( for author_bucket in author_buckets: to_work = author_bucket.get("to_work", {}) - matched = to_work.get("matched", {}) subfields = [ SubfieldShare( name=bucket.get("key", ""), @@ -622,8 +593,6 @@ async def topic_profile_for_authors( author_id=author_bucket.get("key", ""), display_name=_display_name_from_bucket(author_bucket), works_total=to_work.get("doc_count", 0), - matched_works=matched.get("doc_count", 0), - primary_topic_matches=matched.get("primary_match", {}).get("doc_count", 0), distinct_topics=to_work.get("distinct_topics", {}).get("value", 0), distinct_subfields=to_work.get("distinct_subfields", {}).get("value", 0), distinct_fields=to_work.get("distinct_fields", {}).get("value", 0), diff --git a/service/src/main/inse/ranking/model.py b/service/src/main/inse/ranking/model.py index 15430231..2f1d7bdf 100644 --- a/service/src/main/inse/ranking/model.py +++ b/service/src/main/inse/ranking/model.py @@ -333,14 +333,7 @@ class AuthorTopicProfile(BaseModel): author_id: str = Field(description="The OpenAlex ID of the author.") display_name: str = Field(description="The name of the author.") works_total: int = Field( - description="All works of the author in the timespan, regardless of the topic filter.", - ) - matched_works: int = Field( - description="Works matching the topic filter (same subset as Section 1).", - ) - primary_topic_matches: int = Field( - description="Matched works where one of the searched topics is the work's " - "primary topic.", + description="All works of the author in the timespan.", ) distinct_topics: int = Field( description="Number of distinct primary topics across all works.", diff --git a/service/src/main/inse/ranking/router.py b/service/src/main/inse/ranking/router.py index a5fc843f..0f28639a 100644 --- a/service/src/main/inse/ranking/router.py +++ b/service/src/main/inse/ranking/router.py @@ -129,22 +129,15 @@ async def topic_stats(request: SelectedAuthorsRequest): @router.post("/topic-profile", response_model=list[AuthorTopicProfile]) async def topic_profile(request: SelectedAuthorsRequest): logger.info( - "topic-profile author_ids=%s keywords=%s operator=%s fuzzy=%s " - "publication_types=%s timespan=%s", + "topic-profile author_ids=%s publication_types=%s timespan=%s", request.author_ids, - request.keywords, - request.operator, - request.fuzzy, request.publication_types, request.timespan, ) return await logic.topic_profile_for_authors( request.author_ids, - request.keywords, - request.operator, request.publication_types, request.timespan, - request.fuzzy, ) # Compare authors table 2 (author-level stats, keyword/time-independent) diff --git a/webapp/src/app/api/model/authorTopicProfile.ts b/webapp/src/app/api/model/authorTopicProfile.ts index 075bc8ec..8c7aa8c7 100644 --- a/webapp/src/app/api/model/authorTopicProfile.ts +++ b/webapp/src/app/api/model/authorTopicProfile.ts @@ -20,17 +20,9 @@ export interface AuthorTopicProfile { */ display_name: string; /** - * All works of the author in the timespan, regardless of the topic filter. + * All works of the author in the timespan. */ works_total: number; - /** - * Works matching the topic filter (same subset as Section 1). - */ - matched_works: number; - /** - * Matched works where one of the searched topics is the work\'s primary topic. - */ - primary_topic_matches: number; /** * Number of distinct primary topics across all works. */ diff --git a/webapp/src/app/modules/compare-authors/compare-authors.component.html b/webapp/src/app/modules/compare-authors/compare-authors.component.html index 9a43a290..cf2eb95a 100644 --- a/webapp/src/app/modules/compare-authors/compare-authors.component.html +++ b/webapp/src/app/modules/compare-authors/compare-authors.component.html @@ -103,24 +103,12 @@ [options]="subfieldChart()" class="profile-chart profile-chart-wide"> -
- Publikationen zum Suchthema im Verhältnis zu allen Publikationen – - und wie viele es als Primärthema tragen -
- -- Einzigartige Primärthemen, Subfields und Fields über alle - Publikationen (Primärthema) -
- -+ Einzigartige Primärthemen, Subfields und Fields über alle + Publikationen (Primärthema) +
+Field → Subfield → Thema
diff --git a/webapp/src/app/modules/compare-authors/compare-authors.component.scss b/webapp/src/app/modules/compare-authors/compare-authors.component.scss index eed11771..824a6f37 100644 --- a/webapp/src/app/modules/compare-authors/compare-authors.component.scss +++ b/webapp/src/app/modules/compare-authors/compare-authors.component.scss @@ -311,18 +311,8 @@ app-chip mat-icon { } } -.chart-grid { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 8px 24px; -} - @media (max-width: 900px) { .compare-layout { padding: 20px 16px 32px; } - - .chart-grid { - grid-template-columns: 1fr; - } } diff --git a/webapp/src/app/modules/compare-authors/compare-authors.component.ts b/webapp/src/app/modules/compare-authors/compare-authors.component.ts index 86c97599..0721460f 100644 --- a/webapp/src/app/modules/compare-authors/compare-authors.component.ts +++ b/webapp/src/app/modules/compare-authors/compare-authors.component.ts @@ -585,67 +585,7 @@ export class CompareAuthorsComponent implements OnInit { } as EChartsOption; }); - // chart 2: topic focus — how much of the complete body of work is on the searched topic - readonly focusChart = computed