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..dfd58667 100644 --- a/webapp/src/app/modules/compare-authors/compare-authors.component.html +++ b/webapp/src/app/modules/compare-authors/compare-authors.component.html @@ -87,7 +87,8 @@

Themenprofil

- Verteilung und Breite der Themen über alle Publikationen + Verteilung und Breite der Themen + über alle Publikationen

@if (profileLoading()) { @@ -103,24 +104,12 @@ [options]="subfieldChart()" class="profile-chart profile-chart-wide"> -
-
-

Themen-Fokus

-

- Publikationen zum Suchthema im Verhältnis zu allen Publikationen – - und wie viele es als Primärthema tragen -

-
-
-
-

Themenbreite

-

- Einzigartige Primärthemen, Subfields und Fields über alle - Publikationen (Primärthema) -

-
-
-
+

Themenbreite

+

+ Einzigartige Primärthemen, Subfields und Fields über alle + Publikationen (Primärthema) +

+

Themenlandschaft

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(() => { - const profiles = this.orderedProfiles(); - if (profiles.length === 0) return {}; - - const pct = (part: number, whole: number) => - whole > 0 ? Math.round((part / whole) * 1000) / 10 : 0; - - return { - tooltip: { - trigger: 'axis', - axisPointer: { type: 'shadow' }, - formatter: (params: any) => { - const lines = params.map( - (p: any) => - `${p.marker} ${p.seriesName}: ${p.data.value} % (${p.data.part} von ${p.data.whole} Werken)`, - ); - return `${params[0]?.name ?? ''}
${lines.join('
')}`; - }, - }, - legend: { top: 0, textStyle: { color: this.chartTheme.colors().text } }, - grid: { left: 16, right: 40, top: 32, bottom: 8, containLabel: true }, - xAxis: { - type: 'value', - max: 100, - axisLabel: { formatter: '{value} %' }, - }, - yAxis: { - type: 'category', - inverse: true, - data: profiles.map((p) => p.display_name), - axisLabel: this.authorAxisLabel(profiles), - }, - series: [ - { - name: 'Anteil am Gesamtwerk', - type: 'bar', - itemStyle: { color: '#2563eb' }, - label: { show: true, position: 'right', formatter: '{c} %' }, - data: profiles.map((p) => ({ - value: pct(p.matched_works, p.works_total), - part: p.matched_works, - whole: p.works_total, - })), - }, - { - name: 'davon Primärthema', - type: 'bar', - itemStyle: { color: '#7c3aed' }, - label: { show: true, position: 'right', formatter: '{c} %' }, - data: profiles.map((p) => ({ - value: pct(p.primary_topic_matches, p.matched_works), - part: p.primary_topic_matches, - whole: p.matched_works, - })), - }, - ], - } as EChartsOption; - }); - - // chart 3: topic breadth — how many distinct (sub)fields the author publishes in + // chart 2: topic breadth — how many distinct (sub)fields the author publishes in readonly breadthChart = computed(() => { const profiles = this.orderedProfiles(); if (profiles.length === 0) return {};