From b753f7dd006750ee2deb7b08505bf37b4e73e32e Mon Sep 17 00:00:00 2001 From: Farajollahi Date: Thu, 28 May 2026 15:34:36 +0200 Subject: [PATCH] implement all works of author --- service/src/main/inse/works/logic.py | 78 +++++++++++- service/src/main/inse/works/model.py | 5 + service/src/main/inse/works/service.py | 11 ++ .../main/inse/works/test_openalex_logic.py | 73 +++++++++++ service/src/main/inse/works/test_service.py | 42 +++++++ webapp/src/app/api/.openapi-generator/FILES | 21 ++++ webapp/src/app/api/api/persons.service.ts | 11 +- .../app/api/api/persons.serviceInterface.ts | 3 +- webapp/src/app/api/api/works.service.ts | 60 +++++++++ .../src/app/api/api/works.serviceInterface.ts | 9 ++ webapp/src/app/api/model/author.ts | 20 +++ webapp/src/app/api/model/authorship.ts | 34 +++++ webapp/src/app/api/model/award.ts | 23 ++++ webapp/src/app/api/model/biblio.ts | 21 ++++ .../model/citation-normalized-percentile.ts | 20 +++ .../app/api/model/cited-by-percentile-year.ts | 19 +++ webapp/src/app/api/model/count-by-year.ts | 22 ++++ webapp/src/app/api/model/funder.ts | 20 +++ webapp/src/app/api/model/has-content.ts | 19 +++ webapp/src/app/api/model/institution.ts | 23 ++++ webapp/src/app/api/model/keyword.ts | 20 +++ webapp/src/app/api/model/location.ts | 26 ++++ webapp/src/app/api/model/mesh.ts | 22 ++++ webapp/src/app/api/model/models.ts | 21 ++++ webapp/src/app/api/model/open-access.ts | 20 +++ webapp/src/app/api/model/person.ts | 10 ++ webapp/src/app/api/model/source.ts | 28 +++++ .../api/model/sustainable-development-goal.ts | 20 +++ webapp/src/app/api/model/topic-level.ts | 19 +++ webapp/src/app/api/model/topic.ts | 24 ++++ webapp/src/app/api/model/work-ids.ts | 22 ++++ webapp/src/app/api/model/work-list.ts | 23 ++++ webapp/src/app/api/model/work.ts | 118 ++++++++++++++++++ .../person-publications.component.ts | 13 +- .../shared/services/publications.service.ts | 2 +- 35 files changed, 906 insertions(+), 16 deletions(-) create mode 100644 webapp/src/app/api/model/author.ts create mode 100644 webapp/src/app/api/model/authorship.ts create mode 100644 webapp/src/app/api/model/award.ts create mode 100644 webapp/src/app/api/model/biblio.ts create mode 100644 webapp/src/app/api/model/citation-normalized-percentile.ts create mode 100644 webapp/src/app/api/model/cited-by-percentile-year.ts create mode 100644 webapp/src/app/api/model/count-by-year.ts create mode 100644 webapp/src/app/api/model/funder.ts create mode 100644 webapp/src/app/api/model/has-content.ts create mode 100644 webapp/src/app/api/model/institution.ts create mode 100644 webapp/src/app/api/model/keyword.ts create mode 100644 webapp/src/app/api/model/location.ts create mode 100644 webapp/src/app/api/model/mesh.ts create mode 100644 webapp/src/app/api/model/open-access.ts create mode 100644 webapp/src/app/api/model/source.ts create mode 100644 webapp/src/app/api/model/sustainable-development-goal.ts create mode 100644 webapp/src/app/api/model/topic-level.ts create mode 100644 webapp/src/app/api/model/topic.ts create mode 100644 webapp/src/app/api/model/work-ids.ts create mode 100644 webapp/src/app/api/model/work-list.ts create mode 100644 webapp/src/app/api/model/work.ts diff --git a/service/src/main/inse/works/logic.py b/service/src/main/inse/works/logic.py index eb5d6844..752176e4 100644 --- a/service/src/main/inse/works/logic.py +++ b/service/src/main/inse/works/logic.py @@ -28,8 +28,59 @@ async def get_author_works( client: OpenAlexWorksSearchClient | None = None, ) -> model.WorkPage: search_client = client or OpenAlexWorksSearchClient() + data = await _search_author_works_data( + search_client, + author_id, + page, + size, + publication_year=publication_year, + work_type=work_type, + language=language, + ) + + elements, total = _parse_work_search_response(data) + return model.WorkPage(elements=elements, page=page, size=size, total=total) + + +async def get_all_author_works( + author_id: str, + client: OpenAlexWorksSearchClient | None = None, +) -> model.WorkList: + search_client = client or OpenAlexWorksSearchClient() + page = 1 + size = 100 + all_elements: list[model.Work] = [] + total = 0 + + while True: + data = await _search_author_works_data( + search_client, + author_id, + page, + size, + ) + elements, total = _parse_full_work_search_response(data) + all_elements.extend(elements) + + if not elements or len(all_elements) >= total: + break + + page += 1 + + return model.WorkList(elements=all_elements, total=total) + + +async def _search_author_works_data( + search_client: OpenAlexWorksSearchClient, + author_id: str, + page: int, + size: int, + publication_year: list[int] | None = None, + work_type: list[str] | None = None, + language: list[str] | None = None, +) -> dict: try: - data = await search_client.search_author_works( + return await search_client.search_author_works( author_id, page, size, @@ -50,6 +101,8 @@ async def get_author_works( detail="OpenAlex works search request failed.", ) from exc + +def _parse_work_search_response(data: dict) -> tuple[list[model.WorkSummary], int]: hits = data.get("hits", {}) total = hits.get("total", 0) if isinstance(total, dict): @@ -67,7 +120,28 @@ async def get_author_works( detail="OpenAlex works search response could not be parsed.", ) from exc - return model.WorkPage(elements=elements, page=page, size=size, total=total) + return elements, total + + +def _parse_full_work_search_response(data: dict) -> tuple[list[model.Work], int]: + hits = data.get("hits", {}) + total = hits.get("total", 0) + if isinstance(total, dict): + total = total.get("value", 0) + + try: + elements = [ + model.Work.model_validate(hit.get("_source", {})) + for hit in hits.get("hits", []) + ] + except ValidationError as exc: + logger.exception("OpenAlex works search response could not be parsed.") + raise HTTPException( + status_code=HTTP_502_BAD_GATEWAY, + detail="OpenAlex works search response could not be parsed.", + ) from exc + + return elements, total def _to_work_summary(source: dict) -> dict: diff --git a/service/src/main/inse/works/model.py b/service/src/main/inse/works/model.py index a65c4cc5..02c8bf25 100644 --- a/service/src/main/inse/works/model.py +++ b/service/src/main/inse/works/model.py @@ -211,3 +211,8 @@ class WorkPage(BaseModel): page: int = Field(default=1, description="The current page number.") size: int = Field(default=20, description="The requested page size.") total: int = Field(default=0, description="The total number of works.") + + +class WorkList(BaseModel): + elements: List[Work] = Field(default_factory=list, description="All works.") + total: int = Field(default=0, description="The total number of works.") diff --git a/service/src/main/inse/works/service.py b/service/src/main/inse/works/service.py index a4081dd1..82665c20 100644 --- a/service/src/main/inse/works/service.py +++ b/service/src/main/inse/works/service.py @@ -39,3 +39,14 @@ async def get_author_works( work_type=work_type, language=language, ) + + +@router.get("/{author_id}/works/all", + operation_id="getAllAuthorWorks", + response_model=model.WorkList, + summary="Returns all works for an author.") +async def get_all_author_works( + author_id: Annotated[str, Path(description="The author id, for example A5023888391.")], + principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])), +): + return await logic.get_all_author_works(author_id) diff --git a/service/src/main/inse/works/test_openalex_logic.py b/service/src/main/inse/works/test_openalex_logic.py index 646be283..70c6ae6e 100644 --- a/service/src/main/inse/works/test_openalex_logic.py +++ b/service/src/main/inse/works/test_openalex_logic.py @@ -1,3 +1,5 @@ +import json + import httpx import pytest from fastapi import HTTPException @@ -76,6 +78,73 @@ async def test_get_author_works_maps_elasticsearch_response_to_work_page(): assert page.elements[0].topics == ["Machine learning"] +@pytest.mark.anyio +async def test_get_all_author_works_collects_all_pages(): + requested_pages = [] + + def handler(request: httpx.Request) -> httpx.Response: + payload = json_from_request(request) + requested_pages.append(payload["from"] // payload["size"] + 1) + page = requested_pages[-1] + hits = [ + { + "_source": { + "id": f"https://openalex.org/W{page}", + "doi": f"https://doi.org/10.1234/example-{page}", + "title": f"Example work {page}", + "display_name": f"Example work {page}", + "type": "article", + "language": "en", + "publication_year": 2024, + "publication_date": "2024-01-01", + "cited_by_count": page, + "primary_location": { + "is_oa": True, + "source": { + "id": "https://openalex.org/S123", + "display_name": "Example Source", + }, + }, + "authorships": [ + { + "author": { + "id": "https://openalex.org/A5023888391", + "display_name": "Example Author", + }, + }, + ], + "topics": [], + } + } + ] + return httpx.Response( + 200, + json={ + "hits": { + "total": {"value": 2}, + "hits": hits, + }, + }, + ) + + client = OpenAlexWorksSearchClient( + base_url="https://project.nes.uni-due.de/elastic", + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + + works = await logic.get_all_author_works("A5023888391", client=client) + + assert requested_pages == [1, 2] + assert works.total == 2 + assert [work.title for work in works.elements] == ["Example work 1", "Example work 2"] + assert works.elements[0].id == "https://openalex.org/W1" + assert works.elements[0].display_name == "Example work 1" + assert works.elements[0].publication_date == "2024-01-01" + assert works.elements[0].primary_location.is_oa is True + assert works.elements[0].authorships[0].author.id == "https://openalex.org/A5023888391" + + @pytest.mark.anyio async def test_get_author_works_maps_missing_api_key_to_service_unavailable(): client = OpenAlexWorksSearchClient(api_key="") @@ -101,3 +170,7 @@ async def test_get_author_works_maps_elasticsearch_errors_to_bad_gateway(): await logic.get_author_works("A5023888391", page=1, size=20, client=client) assert exc.value.status_code == 502 + + +def json_from_request(request: httpx.Request) -> dict: + return json.loads(request.content.decode("utf-8")) diff --git a/service/src/main/inse/works/test_service.py b/service/src/main/inse/works/test_service.py index a2474868..458c337c 100644 --- a/service/src/main/inse/works/test_service.py +++ b/service/src/main/inse/works/test_service.py @@ -64,3 +64,45 @@ def test_get_author_works_returns_page(monkeypatch): "cited_by_count": 42, "topics": ["Machine learning"], } + + +def test_get_all_author_works_returns_list(monkeypatch): + config.settings.auth_disabled = True + + async def fake_get_all_author_works( + author_id: str, + ): + assert author_id == "A5023888391" + return model.WorkList( + elements=[ + model.Work( + id="https://openalex.org/W2741809807", + doi="https://doi.org/10.7717/peerj.4375", + title="Example work", + display_name="Example work", + type="article", + language="en", + publication_year=2023, + cited_by_count=42, + topics=[ + model.Topic( + id="https://openalex.org/T10102", + display_name="Machine learning", + ) + ], + ) + ], + total=1, + ) + + monkeypatch.setattr(logic, "get_all_author_works", fake_get_all_author_works) + + response = client.get("/inse-service/authors/A5023888391/works/all") + + assert response.status_code == 200 + data = response.json() + assert data["total"] == 1 + assert data["elements"][0]["id"] == "https://openalex.org/W2741809807" + assert data["elements"][0]["title"] == "Example work" + assert data["elements"][0]["display_name"] == "Example work" + assert data["elements"][0]["topics"][0]["display_name"] == "Machine learning" diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 391c261c..883e70e7 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -16,18 +16,39 @@ encoder.ts git_push.sh index.ts model/affiliation.ts +model/author.ts +model/authorship.ts +model/award.ts +model/biblio.ts +model/citation-normalized-percentile.ts +model/cited-by-percentile-year.ts +model/count-by-year.ts +model/funder.ts +model/has-content.ts model/http-validation-error.ts +model/institution.ts model/item-create.ts model/item-page.ts model/item.ts +model/keyword.ts +model/location.ts +model/mesh.ts model/models.ts +model/open-access.ts model/person-bio.ts model/person-search-result.ts model/person.ts +model/source.ts +model/sustainable-development-goal.ts +model/topic-level.ts +model/topic.ts model/validation-error-loc-inner.ts model/validation-error.ts +model/work-ids.ts +model/work-list.ts model/work-page.ts model/work-summary.ts +model/work.ts param.ts provide-api.ts variables.ts diff --git a/webapp/src/app/api/api/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index f1c1c23e..cd7c95f2 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -107,19 +107,22 @@ export class PersonsOpenApiService extends BaseService implements PersonsOpenApi * @endpoint get /persons/search * @param authorId OpenAlex author ID (e.g., A5093075883) * @param query Search query (e.g., Arman AND Arzani) + * @param include Comma-separated include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, sources, counts_by_year, works_api_url, dates, cited_by_count_boost * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public searchPersons(authorId?: string, query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersons(authorId?: string, query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersons(authorId?: string, query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersons(authorId?: string, query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersons(authorId?: string, query?: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { let localVarQueryParameters = new HttpParams({encoder: this.encoder}); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, authorId, 'author_id'); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); let localVarHeaders = this.defaultHeaders; diff --git a/webapp/src/app/api/api/persons.serviceInterface.ts b/webapp/src/app/api/api/persons.serviceInterface.ts index ad0fcf59..697a21aa 100644 --- a/webapp/src/app/api/api/persons.serviceInterface.ts +++ b/webapp/src/app/api/api/persons.serviceInterface.ts @@ -38,7 +38,8 @@ export interface PersonsOpenApiServiceInterface { * @endpoint get /persons/search * @param authorId OpenAlex author ID (e.g., A5093075883) * @param query Search query (e.g., Arman AND Arzani) + * @param include Comma-separated include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, sources, counts_by_year, works_api_url, dates, cited_by_count_boost */ - searchPersons(authorId?: string, query?: string, extraHttpRequestParams?: any): Observable; + searchPersons(authorId?: string, query?: string, include?: string, extraHttpRequestParams?: any): Observable; } diff --git a/webapp/src/app/api/api/works.service.ts b/webapp/src/app/api/api/works.service.ts index d4029433..14755026 100644 --- a/webapp/src/app/api/api/works.service.ts +++ b/webapp/src/app/api/api/works.service.ts @@ -19,6 +19,8 @@ import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore +import { WorkList } from '../model/work-list'; +// @ts-ignore import { WorkPage } from '../model/work-page'; // @ts-ignore @@ -40,6 +42,64 @@ export class WorksOpenApiService extends BaseService implements WorksOpenApiServ super(basePath, configuration); } + /** + * Returns all works for an author. + * @endpoint get /authors/{author_id}/works/all + * @param authorId The author id, for example A5023888391. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getAllAuthorWorks(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAllAuthorWorks(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllAuthorWorks(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllAuthorWorks(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getAllAuthorWorks.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/works/all`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + /** * Returns a page of works for an author. * @endpoint get /authors/{author_id}/works diff --git a/webapp/src/app/api/api/works.serviceInterface.ts b/webapp/src/app/api/api/works.serviceInterface.ts index a79775ce..ebf418ac 100644 --- a/webapp/src/app/api/api/works.serviceInterface.ts +++ b/webapp/src/app/api/api/works.serviceInterface.ts @@ -12,6 +12,7 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; import { HTTPValidationError } from '../model/models'; +import { WorkList } from '../model/models'; import { WorkPage } from '../model/models'; @@ -23,6 +24,14 @@ export interface WorksOpenApiServiceInterface { defaultHeaders: HttpHeaders; configuration: Configuration; + /** + * Returns all works for an author. + * + * @endpoint get /authors/{author_id}/works/all + * @param authorId The author id, for example A5023888391. + */ + getAllAuthorWorks(authorId: string, extraHttpRequestParams?: any): Observable; + /** * Returns a page of works for an author. * diff --git a/webapp/src/app/api/model/author.ts b/webapp/src/app/api/model/author.ts new file mode 100644 index 00000000..d7b9c008 --- /dev/null +++ b/webapp/src/app/api/model/author.ts @@ -0,0 +1,20 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface Author { + [key: string]: any | any; + + + id?: string | null; + display_name?: string | null; + orcid?: string | null; +} + diff --git a/webapp/src/app/api/model/authorship.ts b/webapp/src/app/api/model/authorship.ts new file mode 100644 index 00000000..a570a4c1 --- /dev/null +++ b/webapp/src/app/api/model/authorship.ts @@ -0,0 +1,34 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { Author } from './author'; +import { Institution } from './institution'; + + +export interface Authorship { + [key: string]: any | any; + + + author?: Author | null; + /** + * The author\'s institutions. + */ + institutions?: Array; + /** + * The author\'s countries. + */ + countries?: Array; + is_corresponding?: boolean | null; + raw_author_name?: string | null; + /** + * The raw affiliation strings. + */ + raw_affiliation_strings?: Array; +} + diff --git a/webapp/src/app/api/model/award.ts b/webapp/src/app/api/model/award.ts new file mode 100644 index 00000000..d7fa6ea9 --- /dev/null +++ b/webapp/src/app/api/model/award.ts @@ -0,0 +1,23 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface Award { + [key: string]: any | any; + + + id?: string | null; + display_name?: string | null; + funder_award_id?: string | null; + funder_id?: string | null; + funder_display_name?: string | null; + doi?: string | null; +} + diff --git a/webapp/src/app/api/model/biblio.ts b/webapp/src/app/api/model/biblio.ts new file mode 100644 index 00000000..6873bdbc --- /dev/null +++ b/webapp/src/app/api/model/biblio.ts @@ -0,0 +1,21 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface Biblio { + [key: string]: any | any; + + + volume?: string | null; + issue?: string | null; + first_page?: string | null; + last_page?: string | null; +} + diff --git a/webapp/src/app/api/model/citation-normalized-percentile.ts b/webapp/src/app/api/model/citation-normalized-percentile.ts new file mode 100644 index 00000000..9ee140b8 --- /dev/null +++ b/webapp/src/app/api/model/citation-normalized-percentile.ts @@ -0,0 +1,20 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface CitationNormalizedPercentile { + [key: string]: any | any; + + + value?: number | null; + is_in_top_1_percent?: boolean | null; + is_in_top_10_percent?: boolean | null; +} + diff --git a/webapp/src/app/api/model/cited-by-percentile-year.ts b/webapp/src/app/api/model/cited-by-percentile-year.ts new file mode 100644 index 00000000..e79aeea0 --- /dev/null +++ b/webapp/src/app/api/model/cited-by-percentile-year.ts @@ -0,0 +1,19 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface CitedByPercentileYear { + [key: string]: any | any; + + + min?: number | null; + max?: number | null; +} + diff --git a/webapp/src/app/api/model/count-by-year.ts b/webapp/src/app/api/model/count-by-year.ts new file mode 100644 index 00000000..963f2104 --- /dev/null +++ b/webapp/src/app/api/model/count-by-year.ts @@ -0,0 +1,22 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface CountByYear { + [key: string]: any | any; + + + year?: number | null; + /** + * The citation count for the year. + */ + cited_by_count?: number; +} + diff --git a/webapp/src/app/api/model/funder.ts b/webapp/src/app/api/model/funder.ts new file mode 100644 index 00000000..8b6e4665 --- /dev/null +++ b/webapp/src/app/api/model/funder.ts @@ -0,0 +1,20 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface Funder { + [key: string]: any | any; + + + id?: string | null; + display_name?: string | null; + ror?: string | null; +} + diff --git a/webapp/src/app/api/model/has-content.ts b/webapp/src/app/api/model/has-content.ts new file mode 100644 index 00000000..cf15776e --- /dev/null +++ b/webapp/src/app/api/model/has-content.ts @@ -0,0 +1,19 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface HasContent { + [key: string]: any | any; + + + pdf?: boolean | null; + grobid_xml?: boolean | null; +} + diff --git a/webapp/src/app/api/model/institution.ts b/webapp/src/app/api/model/institution.ts new file mode 100644 index 00000000..f274ecb0 --- /dev/null +++ b/webapp/src/app/api/model/institution.ts @@ -0,0 +1,23 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface Institution { + [key: string]: any | any; + + + id?: string | null; + display_name?: string | null; + ror?: string | null; + country_code?: string | null; + type?: string | null; + lineage?: Array | null; +} + diff --git a/webapp/src/app/api/model/keyword.ts b/webapp/src/app/api/model/keyword.ts new file mode 100644 index 00000000..edacf882 --- /dev/null +++ b/webapp/src/app/api/model/keyword.ts @@ -0,0 +1,20 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface Keyword { + [key: string]: any | any; + + + id?: string | null; + display_name?: string | null; + score?: number | null; +} + diff --git a/webapp/src/app/api/model/location.ts b/webapp/src/app/api/model/location.ts new file mode 100644 index 00000000..2daba568 --- /dev/null +++ b/webapp/src/app/api/model/location.ts @@ -0,0 +1,26 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { Source } from './source'; + + +export interface Location { + [key: string]: any | any; + + + is_oa?: boolean | null; + landing_page_url?: string | null; + pdf_url?: string | null; + source?: Source | null; + license?: string | null; + license_id?: string | null; + is_accepted?: boolean | null; + is_published?: boolean | null; +} + diff --git a/webapp/src/app/api/model/mesh.ts b/webapp/src/app/api/model/mesh.ts new file mode 100644 index 00000000..1a9c026d --- /dev/null +++ b/webapp/src/app/api/model/mesh.ts @@ -0,0 +1,22 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface Mesh { + [key: string]: any | any; + + + descriptor_ui?: string | null; + descriptor_name?: string | null; + qualifier_ui?: string | null; + qualifier_name?: string | null; + is_major_topic?: boolean | null; +} + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 89152744..c415b90e 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -1,12 +1,33 @@ export * from './affiliation'; +export * from './author'; +export * from './authorship'; +export * from './award'; +export * from './biblio'; +export * from './citation-normalized-percentile'; +export * from './cited-by-percentile-year'; +export * from './count-by-year'; +export * from './funder'; export * from './http-validation-error'; +export * from './has-content'; +export * from './institution'; export * from './item'; export * from './item-create'; export * from './item-page'; +export * from './keyword'; +export * from './location'; +export * from './mesh'; +export * from './open-access'; export * from './person'; export * from './person-bio'; export * from './person-search-result'; +export * from './source'; +export * from './sustainable-development-goal'; +export * from './topic'; +export * from './topic-level'; export * from './validation-error'; export * from './validation-error-loc-inner'; +export * from './work'; +export * from './work-ids'; +export * from './work-list'; export * from './work-page'; export * from './work-summary'; diff --git a/webapp/src/app/api/model/open-access.ts b/webapp/src/app/api/model/open-access.ts new file mode 100644 index 00000000..0deef04a --- /dev/null +++ b/webapp/src/app/api/model/open-access.ts @@ -0,0 +1,20 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface OpenAccess { + [key: string]: any | any; + + + is_oa?: boolean | null; + oa_url?: string | null; + any_repository_has_fulltext?: boolean | null; +} + diff --git a/webapp/src/app/api/model/person.ts b/webapp/src/app/api/model/person.ts index 4ca23fdc..605a21fe 100644 --- a/webapp/src/app/api/model/person.ts +++ b/webapp/src/app/api/model/person.ts @@ -35,5 +35,15 @@ export interface Person { * Research topics. */ topics?: Array; + topics_full?: Array | null; + topic_share?: Array | null; + summary_stats?: object | null; + ids?: object | null; + last_known_institutions?: Array | null; + sources?: Array | null; + counts_by_year?: Array | null; + works_api_url?: string | null; + dates?: object | null; + cited_by_count_boost?: number | null; } diff --git a/webapp/src/app/api/model/source.ts b/webapp/src/app/api/model/source.ts new file mode 100644 index 00000000..658526b4 --- /dev/null +++ b/webapp/src/app/api/model/source.ts @@ -0,0 +1,28 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface Source { + [key: string]: any | any; + + + id?: string | null; + display_name?: string | null; + issn_l?: string | null; + issn?: Array | null; + is_oa?: boolean | null; + is_in_doaj?: boolean | null; + is_core?: boolean | null; + host_organization?: string | null; + host_organization_name?: string | null; + host_organization_lineage?: Array | null; + type?: string | null; +} + diff --git a/webapp/src/app/api/model/sustainable-development-goal.ts b/webapp/src/app/api/model/sustainable-development-goal.ts new file mode 100644 index 00000000..b0566834 --- /dev/null +++ b/webapp/src/app/api/model/sustainable-development-goal.ts @@ -0,0 +1,20 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface SustainableDevelopmentGoal { + [key: string]: any | any; + + + id?: string | null; + display_name?: string | null; + score?: number | null; +} + diff --git a/webapp/src/app/api/model/topic-level.ts b/webapp/src/app/api/model/topic-level.ts new file mode 100644 index 00000000..7f9ed5dc --- /dev/null +++ b/webapp/src/app/api/model/topic-level.ts @@ -0,0 +1,19 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface TopicLevel { + [key: string]: any | any; + + + id?: string | null; + display_name?: string | null; +} + diff --git a/webapp/src/app/api/model/topic.ts b/webapp/src/app/api/model/topic.ts new file mode 100644 index 00000000..9a8513f4 --- /dev/null +++ b/webapp/src/app/api/model/topic.ts @@ -0,0 +1,24 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { TopicLevel } from './topic-level'; + + +export interface Topic { + [key: string]: any | any; + + + id?: string | null; + display_name?: string | null; + score?: number | null; + subfield?: TopicLevel | null; + field?: TopicLevel | null; + domain?: TopicLevel | null; +} + diff --git a/webapp/src/app/api/model/work-ids.ts b/webapp/src/app/api/model/work-ids.ts new file mode 100644 index 00000000..3c5fba70 --- /dev/null +++ b/webapp/src/app/api/model/work-ids.ts @@ -0,0 +1,22 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface WorkIds { + [key: string]: any | any; + + + openalex?: string | null; + doi?: string | null; + mag?: number | null; + pmid?: string | null; + pmcid?: string | null; +} + diff --git a/webapp/src/app/api/model/work-list.ts b/webapp/src/app/api/model/work-list.ts new file mode 100644 index 00000000..5bb10bbc --- /dev/null +++ b/webapp/src/app/api/model/work-list.ts @@ -0,0 +1,23 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { Work } from './work'; + + +export interface WorkList { + /** + * All works. + */ + elements?: Array; + /** + * The total number of works. + */ + total?: number; +} + diff --git a/webapp/src/app/api/model/work.ts b/webapp/src/app/api/model/work.ts new file mode 100644 index 00000000..bebbc0c6 --- /dev/null +++ b/webapp/src/app/api/model/work.ts @@ -0,0 +1,118 @@ +/** + * My App Service + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { Biblio } from './biblio'; +import { CountByYear } from './count-by-year'; +import { Authorship } from './authorship'; +import { Keyword } from './keyword'; +import { Funder } from './funder'; +import { OpenAccess } from './open-access'; +import { WorkIds } from './work-ids'; +import { Mesh } from './mesh'; +import { SustainableDevelopmentGoal } from './sustainable-development-goal'; +import { HasContent } from './has-content'; +import { Award } from './award'; +import { CitationNormalizedPercentile } from './citation-normalized-percentile'; +import { Topic } from './topic'; +import { CitedByPercentileYear } from './cited-by-percentile-year'; +import { Location } from './location'; + + +export interface Work { + [key: string]: any | any; + + + /** + * The external id of the work. + */ + id: string; + doi?: string | null; + title?: string | null; + display_name?: string | null; + publication_year?: number | null; + publication_date?: string | null; + type?: string | null; + language?: string | null; + /** + * The number of citations. + */ + cited_by_count?: number; + is_retracted?: boolean | null; + is_paratext?: boolean | null; + primary_location?: Location | null; + /** + * The work locations. + */ + locations?: Array; + best_oa_location?: Location | null; + open_access?: OpenAccess | null; + /** + * The authorships. + */ + authorships?: Array; + ids?: WorkIds | null; + biblio?: Biblio | null; + /** + * The inverted abstract index. + */ + abstract_inverted_index?: { [key: string]: Array; }; + /** + * Referenced work ids. + */ + referenced_works?: Array; + /** + * The number of referenced works. + */ + referenced_works_count?: number; + /** + * Related work ids. + */ + related_works?: Array; + /** + * The topics. + */ + topics?: Array; + primary_topic?: Topic | null; + /** + * The keywords. + */ + keywords?: Array; + /** + * The funders. + */ + funders?: Array; + /** + * The awards. + */ + awards?: Array; + fwci?: number | null; + citation_normalized_percentile?: CitationNormalizedPercentile | null; + cited_by_percentile_year?: CitedByPercentileYear | null; + /** + * Citation counts by year. + */ + counts_by_year?: Array; + /** + * Sustainable development goals. + */ + sustainable_development_goals?: Array; + /** + * MeSH terms. + */ + mesh?: Array; + /** + * Indexes containing the work. + */ + indexed_in?: Array; + has_content?: HasContent | null; + content_url?: string | null; + created_date?: string | null; + updated_date?: string | null; +} + diff --git a/webapp/src/app/modules/person-publications/person-publications.component.ts b/webapp/src/app/modules/person-publications/person-publications.component.ts index 9f2a7cb4..5256c2c0 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.ts +++ b/webapp/src/app/modules/person-publications/person-publications.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, inject, OnInit, ViewChild } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { MatIconModule } from '@angular/material/icon'; @@ -35,6 +35,10 @@ import { ChipComponent } from '../../shared/ui/chip/chip.component'; }) export class PersonPublicationsComponent implements OnInit { @ViewChild(MatPaginator) paginator?: MatPaginator; + private route = inject(ActivatedRoute); + private publicationsService = inject(PublicationsService); + public paginationService = inject(PaginationService); + private snackBar = inject(MatSnackBar) displayedColumns: string[] = [ 'title', @@ -85,13 +89,6 @@ export class PersonPublicationsComponent implements OnInit { { value: 'de', label: 'Deutsch' }, ]; - constructor( - private route: ActivatedRoute, - private publicationsService: PublicationsService, - public paginationService: PaginationService, - private snackBar: MatSnackBar, - ) {} - ngOnInit(): void { this.route.parent?.paramMap.subscribe((params) => { this.authorId = params.get('id') ?? ''; diff --git a/webapp/src/app/shared/services/publications.service.ts b/webapp/src/app/shared/services/publications.service.ts index 89878079..3a782229 100644 --- a/webapp/src/app/shared/services/publications.service.ts +++ b/webapp/src/app/shared/services/publications.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { WorkPage, WorksOpenApiService } from '../../api'; +import { WorkList, WorkPage, WorksOpenApiService } from '../../api'; export interface PublicationFilters { publicationYears?: number[]; -- 2.56.1