From 16d99d7dca06bea02c17f6b5c91adfdda8cfea1f Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Fri, 29 May 2026 19:07:08 +0200 Subject: [PATCH] Full refactor --- service/src/main/inse/logic.py | 100 +++---- service/src/main/inse/model.py | 36 --- service/src/main/inse/models/__init__.py | 128 +++++++++ service/src/main/inse/models/author.py | 166 +++++++++++ .../inse/models/author_affiliations_inner.py | 99 +++++++ .../models/author_counts_by_year_inner.py | 93 ++++++ service/src/main/inse/models/author_ids.py | 105 +++++++ .../inse/models/author_parsed_longest_name.py | 97 +++++++ .../main/inse/models/author_summary_stats.py | 93 ++++++ .../main/inse/models/author_topics_inner.py | 93 ++++++ .../main/inse/models/authors_list_response.py | 113 ++++++++ service/src/main/inse/models/authorship.py | 123 ++++++++ .../main/inse/models/autocomplete_response.py | 103 +++++++ .../inse/models/autocomplete_response_meta.py | 91 ++++++ .../autocomplete_response_results_inner.py | 101 +++++++ service/src/main/inse/models/award.py | 99 +++++++ service/src/main/inse/models/award_full.py | 140 +++++++++ .../src/main/inse/models/award_full_funder.py | 93 ++++++ .../main/inse/models/awards_list_response.py | 103 +++++++ service/src/main/inse/models/concept.py | 124 ++++++++ service/src/main/inse/models/concept_ids.py | 95 +++++++ .../inse/models/concepts_list_response.py | 103 +++++++ service/src/main/inse/models/continent.py | 116 ++++++++ service/src/main/inse/models/continent_ids.py | 91 ++++++ .../inse/models/continents_list_response.py | 103 +++++++ .../inse/models/countries_list_response.py | 103 +++++++ service/src/main/inse/models/country.py | 126 ++++++++ .../src/main/inse/models/country_continent.py | 91 ++++++ service/src/main/inse/models/country_ids.py | 95 +++++++ .../src/main/inse/models/dehydrated_author.py | 93 ++++++ .../src/main/inse/models/dehydrated_funder.py | 93 ++++++ .../inse/models/dehydrated_institution.py | 99 +++++++ .../src/main/inse/models/dehydrated_source.py | 109 +++++++ service/src/main/inse/models/domain.py | 131 +++++++++ .../main/inse/models/domain_fields_inner.py | 91 ++++++ service/src/main/inse/models/domain_ids.py | 93 ++++++ .../main/inse/models/domains_list_response.py | 103 +++++++ service/src/main/inse/models/error.py | 91 ++++++ .../main/inse/models/fields_list_response.py | 103 +++++++ service/src/main/inse/models/funder.py | 132 +++++++++ service/src/main/inse/models/funder_ids.py | 97 +++++++ .../main/inse/models/funders_list_response.py | 113 ++++++++ .../inse/models/get_changefile200_response.py | 103 +++++++ .../models/get_changefile200_response_meta.py | 92 ++++++ ...et_changefile200_response_results_inner.py | 97 +++++++ ...efile200_response_results_inner_formats.py | 99 +++++++ ...00_response_results_inner_formats_jsonl.py | 93 ++++++ ..._response_results_inner_formats_parquet.py | 93 ++++++ .../src/main/inse/models/group_by_result.py | 93 ++++++ service/src/main/inse/models/institution.py | 158 +++++++++++ .../src/main/inse/models/institution_geo.py | 101 +++++++ .../src/main/inse/models/institution_ids.py | 99 +++++++ .../src/main/inse/models/institution_type.py | 102 +++++++ .../models/institution_types_list_response.py | 103 +++++++ .../inse/models/institutions_list_response.py | 113 ++++++++ service/src/main/inse/models/keyword.py | 102 +++++++ .../inse/models/keywords_list_response.py | 113 ++++++++ service/src/main/inse/models/language.py | 102 +++++++ .../inse/models/languages_list_response.py | 103 +++++++ service/src/main/inse/models/license.py | 106 +++++++ .../inse/models/licenses_list_response.py | 103 +++++++ .../models/list_changefiles200_response.py | 103 +++++++ .../list_changefiles200_response_meta.py | 89 ++++++ ...t_changefiles200_response_results_inner.py | 92 ++++++ service/src/main/inse/models/location.py | 119 ++++++++ service/src/main/inse/models/meta.py | 101 +++++++ service/src/main/inse/models/model_field.py | 137 +++++++++ service/src/main/inse/models/open_access.py | 105 +++++++ service/src/main/inse/models/publisher.py | 132 +++++++++ service/src/main/inse/models/publisher_ids.py | 93 ++++++ .../inse/models/publisher_parent_publisher.py | 91 ++++++ .../inse/models/publishers_list_response.py | 113 ++++++++ .../main/inse/models/rate_limit_response.py | 95 +++++++ .../models/rate_limit_response_rate_limit.py | 118 ++++++++ ..._response_rate_limit_endpoint_costs_usd.py | 99 +++++++ service/src/main/inse/models/sdg.py | 114 ++++++++ service/src/main/inse/models/sdg_ids.py | 93 ++++++ .../main/inse/models/sdgs_list_response.py | 103 +++++++ service/src/main/inse/models/source.py | 154 ++++++++++ service/src/main/inse/models/source_ids.py | 99 +++++++ service/src/main/inse/models/source_type.py | 102 +++++++ .../inse/models/source_types_list_response.py | 103 +++++++ .../main/inse/models/sources_list_response.py | 113 ++++++++ service/src/main/inse/models/subfield.py | 143 ++++++++++ .../src/main/inse/models/subfield_domain.py | 91 ++++++ .../src/main/inse/models/subfield_field.py | 91 ++++++ .../inse/models/subfields_list_response.py | 103 +++++++ .../models/text_classification_response.py | 103 +++++++ .../text_classification_response_meta.py | 89 ++++++ service/src/main/inse/models/topic.py | 130 +++++++++ service/src/main/inse/models/topic_domain.py | 91 ++++++ service/src/main/inse/models/topic_field.py | 91 ++++++ service/src/main/inse/models/topic_ids.py | 91 ++++++ .../src/main/inse/models/topic_subfield.py | 91 ++++++ .../main/inse/models/topics_list_response.py | 113 ++++++++ service/src/main/inse/models/work.py | 268 ++++++++++++++++++ service/src/main/inse/models/work_biblio.py | 95 +++++++ .../work_citation_normalized_percentile.py | 93 ++++++ .../models/work_cited_by_percentile_year.py | 91 ++++++ .../inse/models/work_counts_by_year_inner.py | 91 ++++++ .../src/main/inse/models/work_has_content.py | 91 ++++++ service/src/main/inse/models/work_ids.py | 120 ++++++++ service/src/main/inse/models/work_keyword.py | 93 ++++++ .../src/main/inse/models/work_mesh_inner.py | 97 +++++++ service/src/main/inse/models/work_page.py | 15 + ...ork_sustainable_development_goals_inner.py | 93 ++++++ service/src/main/inse/models/work_topic.py | 111 ++++++++ .../src/main/inse/models/work_topic_domain.py | 91 ++++++ .../src/main/inse/models/work_topic_field.py | 91 ++++++ .../main/inse/models/work_topic_subfield.py | 91 ++++++ service/src/main/inse/models/work_type.py | 104 +++++++ .../inse/models/work_types_list_response.py | 103 +++++++ .../main/inse/models/works_list_response.py | 113 ++++++++ service/src/main/inse/service.py | 5 +- service/src/main/inse/works/logic.py | 101 +++---- service/src/main/inse/works/model.py | 218 -------------- service/src/main/inse/works/service.py | 7 +- .../main/inse/works/test_openalex_logic.py | 16 +- service/src/main/inse/works/test_service.py | 60 ++-- webapp/src/app/api/.openapi-generator/FILES | 48 ++-- webapp/src/app/api/api/persons.service.ts | 12 +- .../app/api/api/persons.serviceInterface.ts | 4 +- webapp/src/app/api/api/works.service.ts | 12 +- .../src/app/api/api/works.serviceInterface.ts | 4 +- .../api/model/author-affiliations-inner.ts | 20 ++ .../api/model/author-counts-by-year-inner.ts | 20 ++ webapp/src/app/api/model/author-ids.ts | 20 ++ .../api/model/author-parsed-longest-name.ts | 22 ++ .../src/app/api/model/author-summary-stats.ts | 21 ++ .../src/app/api/model/author-topics-inner.ts | 20 ++ webapp/src/app/api/model/author.ts | 29 +- .../app/api/model/authors-list-response.ts | 23 ++ webapp/src/app/api/model/authorship.ts | 28 +- webapp/src/app/api/model/award.ts | 6 +- webapp/src/app/api/model/cost-usd.ts | 17 ++ webapp/src/app/api/model/dehydrated-author.ts | 20 ++ webapp/src/app/api/model/dehydrated-funder.ts | 20 ++ .../app/api/model/dehydrated-institution.ts | 23 ++ webapp/src/app/api/model/dehydrated-source.ts | 28 ++ webapp/src/app/api/model/fwci.ts | 17 ++ webapp/src/app/api/model/group-by-result.ts | 20 ++ webapp/src/app/api/model/location.ts | 11 +- webapp/src/app/api/model/meta.ts | 25 ++ .../app/api/model/model2-yr-mean-citedness.ts | 14 + webapp/src/app/api/model/models.ts | 48 ++-- webapp/src/app/api/model/open-access.ts | 7 +- webapp/src/app/api/model/score.ts | 14 + webapp/src/app/api/model/topic-domain.ts | 19 ++ webapp/src/app/api/model/topic-field.ts | 19 ++ webapp/src/app/api/model/topic-ids.ts | 19 ++ webapp/src/app/api/model/topic-subfield.ts | 19 ++ webapp/src/app/api/model/topic.ts | 26 +- webapp/src/app/api/model/value.ts | 14 + webapp/src/app/api/model/work-biblio.ts | 21 ++ .../work-citation-normalized-percentile.ts | 21 ++ .../model/work-cited-by-percentile-year.ts | 19 ++ .../api/model/work-counts-by-year-inner.ts | 19 ++ webapp/src/app/api/model/work-has-content.ts | 19 ++ webapp/src/app/api/model/work-ids.ts | 6 +- webapp/src/app/api/model/work-keyword.ts | 21 ++ webapp/src/app/api/model/work-mesh-inner.ts | 22 ++ webapp/src/app/api/model/work-page.ts | 22 +- ...ork-sustainable-development-goals-inner.ts | 21 ++ webapp/src/app/api/model/work-topic-domain.ts | 19 ++ webapp/src/app/api/model/work-topic-field.ts | 19 ++ .../src/app/api/model/work-topic-subfield.ts | 19 ++ webapp/src/app/api/model/work-topic.ts | 27 ++ webapp/src/app/api/model/work.ts | 119 +++----- .../src/app/api/model/works-list-response.ts | 23 ++ .../person-interesting.component.ts | 6 +- .../person-publications.component.html | 4 +- .../person-publications.component.ts | 4 +- .../app/modules/person/person.component.html | 2 + .../app/modules/person/person.component.ts | 12 +- .../shared/services/publications.service.ts | 2 +- 175 files changed, 12714 insertions(+), 601 deletions(-) create mode 100644 service/src/main/inse/models/__init__.py create mode 100644 service/src/main/inse/models/author.py create mode 100644 service/src/main/inse/models/author_affiliations_inner.py create mode 100644 service/src/main/inse/models/author_counts_by_year_inner.py create mode 100644 service/src/main/inse/models/author_ids.py create mode 100644 service/src/main/inse/models/author_parsed_longest_name.py create mode 100644 service/src/main/inse/models/author_summary_stats.py create mode 100644 service/src/main/inse/models/author_topics_inner.py create mode 100644 service/src/main/inse/models/authors_list_response.py create mode 100644 service/src/main/inse/models/authorship.py create mode 100644 service/src/main/inse/models/autocomplete_response.py create mode 100644 service/src/main/inse/models/autocomplete_response_meta.py create mode 100644 service/src/main/inse/models/autocomplete_response_results_inner.py create mode 100644 service/src/main/inse/models/award.py create mode 100644 service/src/main/inse/models/award_full.py create mode 100644 service/src/main/inse/models/award_full_funder.py create mode 100644 service/src/main/inse/models/awards_list_response.py create mode 100644 service/src/main/inse/models/concept.py create mode 100644 service/src/main/inse/models/concept_ids.py create mode 100644 service/src/main/inse/models/concepts_list_response.py create mode 100644 service/src/main/inse/models/continent.py create mode 100644 service/src/main/inse/models/continent_ids.py create mode 100644 service/src/main/inse/models/continents_list_response.py create mode 100644 service/src/main/inse/models/countries_list_response.py create mode 100644 service/src/main/inse/models/country.py create mode 100644 service/src/main/inse/models/country_continent.py create mode 100644 service/src/main/inse/models/country_ids.py create mode 100644 service/src/main/inse/models/dehydrated_author.py create mode 100644 service/src/main/inse/models/dehydrated_funder.py create mode 100644 service/src/main/inse/models/dehydrated_institution.py create mode 100644 service/src/main/inse/models/dehydrated_source.py create mode 100644 service/src/main/inse/models/domain.py create mode 100644 service/src/main/inse/models/domain_fields_inner.py create mode 100644 service/src/main/inse/models/domain_ids.py create mode 100644 service/src/main/inse/models/domains_list_response.py create mode 100644 service/src/main/inse/models/error.py create mode 100644 service/src/main/inse/models/fields_list_response.py create mode 100644 service/src/main/inse/models/funder.py create mode 100644 service/src/main/inse/models/funder_ids.py create mode 100644 service/src/main/inse/models/funders_list_response.py create mode 100644 service/src/main/inse/models/get_changefile200_response.py create mode 100644 service/src/main/inse/models/get_changefile200_response_meta.py create mode 100644 service/src/main/inse/models/get_changefile200_response_results_inner.py create mode 100644 service/src/main/inse/models/get_changefile200_response_results_inner_formats.py create mode 100644 service/src/main/inse/models/get_changefile200_response_results_inner_formats_jsonl.py create mode 100644 service/src/main/inse/models/get_changefile200_response_results_inner_formats_parquet.py create mode 100644 service/src/main/inse/models/group_by_result.py create mode 100644 service/src/main/inse/models/institution.py create mode 100644 service/src/main/inse/models/institution_geo.py create mode 100644 service/src/main/inse/models/institution_ids.py create mode 100644 service/src/main/inse/models/institution_type.py create mode 100644 service/src/main/inse/models/institution_types_list_response.py create mode 100644 service/src/main/inse/models/institutions_list_response.py create mode 100644 service/src/main/inse/models/keyword.py create mode 100644 service/src/main/inse/models/keywords_list_response.py create mode 100644 service/src/main/inse/models/language.py create mode 100644 service/src/main/inse/models/languages_list_response.py create mode 100644 service/src/main/inse/models/license.py create mode 100644 service/src/main/inse/models/licenses_list_response.py create mode 100644 service/src/main/inse/models/list_changefiles200_response.py create mode 100644 service/src/main/inse/models/list_changefiles200_response_meta.py create mode 100644 service/src/main/inse/models/list_changefiles200_response_results_inner.py create mode 100644 service/src/main/inse/models/location.py create mode 100644 service/src/main/inse/models/meta.py create mode 100644 service/src/main/inse/models/model_field.py create mode 100644 service/src/main/inse/models/open_access.py create mode 100644 service/src/main/inse/models/publisher.py create mode 100644 service/src/main/inse/models/publisher_ids.py create mode 100644 service/src/main/inse/models/publisher_parent_publisher.py create mode 100644 service/src/main/inse/models/publishers_list_response.py create mode 100644 service/src/main/inse/models/rate_limit_response.py create mode 100644 service/src/main/inse/models/rate_limit_response_rate_limit.py create mode 100644 service/src/main/inse/models/rate_limit_response_rate_limit_endpoint_costs_usd.py create mode 100644 service/src/main/inse/models/sdg.py create mode 100644 service/src/main/inse/models/sdg_ids.py create mode 100644 service/src/main/inse/models/sdgs_list_response.py create mode 100644 service/src/main/inse/models/source.py create mode 100644 service/src/main/inse/models/source_ids.py create mode 100644 service/src/main/inse/models/source_type.py create mode 100644 service/src/main/inse/models/source_types_list_response.py create mode 100644 service/src/main/inse/models/sources_list_response.py create mode 100644 service/src/main/inse/models/subfield.py create mode 100644 service/src/main/inse/models/subfield_domain.py create mode 100644 service/src/main/inse/models/subfield_field.py create mode 100644 service/src/main/inse/models/subfields_list_response.py create mode 100644 service/src/main/inse/models/text_classification_response.py create mode 100644 service/src/main/inse/models/text_classification_response_meta.py create mode 100644 service/src/main/inse/models/topic.py create mode 100644 service/src/main/inse/models/topic_domain.py create mode 100644 service/src/main/inse/models/topic_field.py create mode 100644 service/src/main/inse/models/topic_ids.py create mode 100644 service/src/main/inse/models/topic_subfield.py create mode 100644 service/src/main/inse/models/topics_list_response.py create mode 100644 service/src/main/inse/models/work.py create mode 100644 service/src/main/inse/models/work_biblio.py create mode 100644 service/src/main/inse/models/work_citation_normalized_percentile.py create mode 100644 service/src/main/inse/models/work_cited_by_percentile_year.py create mode 100644 service/src/main/inse/models/work_counts_by_year_inner.py create mode 100644 service/src/main/inse/models/work_has_content.py create mode 100644 service/src/main/inse/models/work_ids.py create mode 100644 service/src/main/inse/models/work_keyword.py create mode 100644 service/src/main/inse/models/work_mesh_inner.py create mode 100644 service/src/main/inse/models/work_page.py create mode 100644 service/src/main/inse/models/work_sustainable_development_goals_inner.py create mode 100644 service/src/main/inse/models/work_topic.py create mode 100644 service/src/main/inse/models/work_topic_domain.py create mode 100644 service/src/main/inse/models/work_topic_field.py create mode 100644 service/src/main/inse/models/work_topic_subfield.py create mode 100644 service/src/main/inse/models/work_type.py create mode 100644 service/src/main/inse/models/work_types_list_response.py create mode 100644 service/src/main/inse/models/works_list_response.py delete mode 100644 service/src/main/inse/works/model.py create mode 100644 webapp/src/app/api/model/author-affiliations-inner.ts create mode 100644 webapp/src/app/api/model/author-counts-by-year-inner.ts create mode 100644 webapp/src/app/api/model/author-ids.ts create mode 100644 webapp/src/app/api/model/author-parsed-longest-name.ts create mode 100644 webapp/src/app/api/model/author-summary-stats.ts create mode 100644 webapp/src/app/api/model/author-topics-inner.ts create mode 100644 webapp/src/app/api/model/authors-list-response.ts create mode 100644 webapp/src/app/api/model/cost-usd.ts create mode 100644 webapp/src/app/api/model/dehydrated-author.ts create mode 100644 webapp/src/app/api/model/dehydrated-funder.ts create mode 100644 webapp/src/app/api/model/dehydrated-institution.ts create mode 100644 webapp/src/app/api/model/dehydrated-source.ts create mode 100644 webapp/src/app/api/model/fwci.ts create mode 100644 webapp/src/app/api/model/group-by-result.ts create mode 100644 webapp/src/app/api/model/meta.ts create mode 100644 webapp/src/app/api/model/model2-yr-mean-citedness.ts create mode 100644 webapp/src/app/api/model/score.ts create mode 100644 webapp/src/app/api/model/topic-domain.ts create mode 100644 webapp/src/app/api/model/topic-field.ts create mode 100644 webapp/src/app/api/model/topic-ids.ts create mode 100644 webapp/src/app/api/model/topic-subfield.ts create mode 100644 webapp/src/app/api/model/value.ts create mode 100644 webapp/src/app/api/model/work-biblio.ts create mode 100644 webapp/src/app/api/model/work-citation-normalized-percentile.ts create mode 100644 webapp/src/app/api/model/work-cited-by-percentile-year.ts create mode 100644 webapp/src/app/api/model/work-counts-by-year-inner.ts create mode 100644 webapp/src/app/api/model/work-has-content.ts create mode 100644 webapp/src/app/api/model/work-keyword.ts create mode 100644 webapp/src/app/api/model/work-mesh-inner.ts create mode 100644 webapp/src/app/api/model/work-sustainable-development-goals-inner.ts create mode 100644 webapp/src/app/api/model/work-topic-domain.ts create mode 100644 webapp/src/app/api/model/work-topic-field.ts create mode 100644 webapp/src/app/api/model/work-topic-subfield.ts create mode 100644 webapp/src/app/api/model/work-topic.ts create mode 100644 webapp/src/app/api/model/works-list-response.ts diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index d98c878f..e93966f6 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -23,6 +23,15 @@ from . import config from .integrations import elasticsearch from .integrations import llm +from inse.models.author import Author +from inse.models.authors_list_response import AuthorsListResponse +from inse.models.meta import Meta +from inse.models.topic import Topic +from inse.models.topic_subfield import TopicSubfield +from inse.models.topic_field import TopicField +from inse.models.topic_domain import TopicDomain + + logger = logging.getLogger(__name__) topic_cache_filename: str = "topic_hierarchy_cache.json" @@ -136,13 +145,13 @@ def build_topic_cache(page_size: int = 200, return taxonomy_cache -def get_topics_from_cache(topic_names: List[str]) -> List[model.Topic]: +def get_topics_from_cache(topic_names: List[str]) -> List[Topic]: """ Given a list of topic names, retrieves their hierarchy information from the cache and returns a list of Topic models. Arguments: topic_names (List[str]): A list of topic names to retrieve. Returns: - List[model.Topic]: A list of Topic models. + List[Topic]: A list of Topic models. """ cache = _load_topic_cache() topics = [] @@ -150,13 +159,16 @@ def get_topics_from_cache(topic_names: List[str]) -> List[model.Topic]: data = cache.get(name) if not data: continue - topics.append(model.Topic( + subfield_name = data.get("subfield", "") + field_name = data.get("field", "") + domain_name = data.get("domain", "") + topics.append(Topic( id=data.get("topic_id", ""), display_name=name, - count=data.get("count", 1), - subfield=data.get("subfield", ""), - field=data.get("field", ""), - domain=data.get("domain", "") + works_count=data.get("count", 1), + subfield=TopicSubfield(display_name=subfield_name) if subfield_name else None, + var_field=TopicField(display_name=field_name) if field_name else None, + domain=TopicDomain(display_name=domain_name) if domain_name else None )) return topics @@ -202,7 +214,7 @@ def count_topic_hierarchy(topic_names: List[str]) -> dict: ### persons def search_persons(author_id: Optional[str] = None, query: Optional[str] = None, - include: Optional[set[str]] = None) -> model.PersonSearchResult: + include: Optional[set[str]] = None) -> AuthorsListResponse: if author_id: query_field = "_id" query_value = author_id @@ -210,7 +222,7 @@ def search_persons(author_id: Optional[str] = None, query: Optional[str] = None, query_field = "display_name" query_value = query else: - return "Either author_id or query must be provided" + return AuthorsListResponse(results=[], meta=Meta(count=0)) data = elasticsearch.search( index="openalex-authors", @@ -218,67 +230,36 @@ def search_persons(author_id: Optional[str] = None, query: Optional[str] = None, query_value=query_value ) - include_set = {tag.strip().lower() for tag in include} if include else set() - persons = [] + authors = [] for hit in data.get("hits", {}).get("hits", []): source = hit.get("_source", {}) + source_copy = dict(source) + source_copy["id"] = source_copy.get("id") or hit.get("_id", "") - affiliations = [] - for aff in source.get("affiliations", []): - institution = aff.get("institution", {}) - affiliations.append(model.Affiliation( - institution=institution.get("display_name", ""), - country_code=institution.get("country_code", "") - )) + # Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated) + ids = source_copy.get("ids") + if isinstance(ids, dict): + ids_copy = dict(ids) + for str_field in ["openalex", "orcid", "scopus"]: + val = ids_copy.get(str_field) + if val is not None and not isinstance(val, str): + ids_copy[str_field] = str(val) + source_copy["ids"] = ids_copy - topics = [t.get("display_name", "") for t in source.get("topics", [])] + author = Author.from_dict(source_copy) + if author: + authors.append(author) - person_data = { - "id": hit.get("_id", ""), - "name": source.get("display_name", ""), - "works_count": source.get("works_count", 0), - "cited_by_count": source.get("cited_by_count", 0), - "affiliations": affiliations, - "topics": topics - } - - # Include optional fields based on the include_set - if "topics_full" in include_set: - person_data["topics_full"] = source.get("topics", []) - if "topic_share" in include_set: - person_data["topic_share"] = source.get("topic_share", []) - if "summary_stats" in include_set: - person_data["summary_stats"] = source.get("summary_stats") - if "ids" in include_set: - person_data["ids"] = source.get("ids") - if "last_known_institutions" in include_set: - person_data["last_known_institutions"] = source.get("last_known_institutions", []) - if "sources" in include_set: - person_data["sources"] = source.get("sources", []) - if "counts_by_year" in include_set: - person_data["counts_by_year"] = source.get("counts_by_year", []) - if "works_api_url" in include_set: - person_data["works_api_url"] = source.get("works_api_url") - if "dates" in include_set: - person_data["dates"] = { - "created_date": source.get("created_date"), - "updated_date": source.get("updated_date") - } - if "cited_by_count_boost" in include_set: - person_data["cited_by_count_boost"] = source.get("cited_by_count_boost") - - persons.append(model.Person(**person_data)) - - return model.PersonSearchResult(persons=persons) + return AuthorsListResponse(results=authors, meta=Meta(count=len(authors))) def generate_person_bio(author_id: str) -> str: search_result = search_persons(author_id=author_id) - if not search_result.persons: + if not search_result.results: return "No person found." - if len(search_result.persons) > 1: + if len(search_result.results) > 1: return "Multiple persons found, cannot generate bio." - person = search_result.persons[0] + person = search_result.results[0] person_json = json.dumps(person.model_dump()) system_prompt = "Erstelle eine Beschreibung der Person in 3-5 Sätzen. Gebe nur die Beschreibung zurück, ohne Einleitung oder Schluss." @@ -287,3 +268,4 @@ def generate_person_bio(author_id: str) -> str: return llm.call(system_prompt=system_prompt, user_prompt=user_prompt) + diff --git a/service/src/main/inse/model.py b/service/src/main/inse/model.py index 6c798a1c..aaac61b1 100644 --- a/service/src/main/inse/model.py +++ b/service/src/main/inse/model.py @@ -36,44 +36,8 @@ class Page(BaseModel, Generic[T]): class ItemPage(Page[Item]): pass -class Topic(BaseModel): - id: str = Field(description="The openalex topic id.") - display_name: str = Field(description="The topic name.") - count: int = Field(description="The number of works associated with the topic.") - subfield: str = Field(description="The subfield of the topic.") - field: str = Field(description="The field of the topic.") - domain: str = Field(description="The domain of the topic.") - -class TopicShare(Topic): - count: float = Field(description="Share value (0..1) for this topic.") - class PersonBio(BaseModel): bio: str = Field(description="The generated biography.") -class Affiliation(BaseModel): - institution: str = Field(description="Institution name.") - country_code: Optional[str] = Field(default=None, description="Country code.") - -class Person(BaseModel): - id: str = Field(description="The person id.") - name: str = Field(description="The person name.") - works_count: int = Field(description="Number of works.") - cited_by_count: int = Field(description="Number of citations.") - affiliations: List[Affiliation] = Field(default=[], description="Affiliations.") - topics: List[str] = Field(default=[], description="Research topics.") - # Optional detailed information - topics_full: Optional[List[dict]] = Field(default=None, description="Detailed topics with hierarchy.") - topic_share: Optional[List[dict]] = Field(default=None, description="Topic share distribution.") - summary_stats: Optional[dict] = Field(default=None, description="Summary statistics.") - ids: Optional[dict] = Field(default=None, description="External identifiers.") - last_known_institutions: Optional[List[dict]] = Field(default=None, description="Last known institutions.") - sources: Optional[List[dict]] = Field(default=None, description="Sources list.") - counts_by_year: Optional[List[dict]] = Field(default=None, description="Counts by year.") - works_api_url: Optional[str] = Field(default=None, description="Works API URL.") - dates: Optional[dict] = Field(default=None, description="Created and updated dates.") - cited_by_count_boost: Optional[int] = Field(default=None, description="Cited by count boost.") - -class PersonSearchResult(BaseModel): - persons: List[Person] = Field(default=[], description="List of found persons.") diff --git a/service/src/main/inse/models/__init__.py b/service/src/main/inse/models/__init__.py new file mode 100644 index 00000000..046bf20e --- /dev/null +++ b/service/src/main/inse/models/__init__.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +# flake8: noqa +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +# import models into model package +from inse.models.author import Author +from inse.models.author_affiliations_inner import AuthorAffiliationsInner +from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner +from inse.models.author_ids import AuthorIds +from inse.models.author_parsed_longest_name import AuthorParsedLongestName +from inse.models.author_summary_stats import AuthorSummaryStats +from inse.models.author_topics_inner import AuthorTopicsInner +from inse.models.authors_list_response import AuthorsListResponse +from inse.models.authorship import Authorship +from inse.models.autocomplete_response import AutocompleteResponse +from inse.models.autocomplete_response_meta import AutocompleteResponseMeta +from inse.models.autocomplete_response_results_inner import AutocompleteResponseResultsInner +from inse.models.award import Award +from inse.models.award_full import AwardFull +from inse.models.award_full_funder import AwardFullFunder +from inse.models.awards_list_response import AwardsListResponse +from inse.models.concept import Concept +from inse.models.concept_ids import ConceptIds +from inse.models.concepts_list_response import ConceptsListResponse +from inse.models.continent import Continent +from inse.models.continent_ids import ContinentIds +from inse.models.continents_list_response import ContinentsListResponse +from inse.models.countries_list_response import CountriesListResponse +from inse.models.country import Country +from inse.models.country_continent import CountryContinent +from inse.models.country_ids import CountryIds +from inse.models.dehydrated_author import DehydratedAuthor +from inse.models.dehydrated_funder import DehydratedFunder +from inse.models.dehydrated_institution import DehydratedInstitution +from inse.models.dehydrated_source import DehydratedSource +from inse.models.domain import Domain +from inse.models.domain_fields_inner import DomainFieldsInner +from inse.models.domain_ids import DomainIds +from inse.models.domains_list_response import DomainsListResponse +from inse.models.error import Error +from inse.models.fields_list_response import FieldsListResponse +from inse.models.funder import Funder +from inse.models.funder_ids import FunderIds +from inse.models.funders_list_response import FundersListResponse +from inse.models.get_changefile200_response import GetChangefile200Response +from inse.models.get_changefile200_response_meta import GetChangefile200ResponseMeta +from inse.models.get_changefile200_response_results_inner import GetChangefile200ResponseResultsInner +from inse.models.get_changefile200_response_results_inner_formats import GetChangefile200ResponseResultsInnerFormats +from inse.models.get_changefile200_response_results_inner_formats_jsonl import GetChangefile200ResponseResultsInnerFormatsJsonl +from inse.models.get_changefile200_response_results_inner_formats_parquet import GetChangefile200ResponseResultsInnerFormatsParquet +from inse.models.group_by_result import GroupByResult +from inse.models.institution import Institution +from inse.models.institution_geo import InstitutionGeo +from inse.models.institution_ids import InstitutionIds +from inse.models.institution_type import InstitutionType +from inse.models.institution_types_list_response import InstitutionTypesListResponse +from inse.models.institutions_list_response import InstitutionsListResponse +from inse.models.keyword import Keyword +from inse.models.keywords_list_response import KeywordsListResponse +from inse.models.language import Language +from inse.models.languages_list_response import LanguagesListResponse +from inse.models.license import License +from inse.models.licenses_list_response import LicensesListResponse +from inse.models.list_changefiles200_response import ListChangefiles200Response +from inse.models.list_changefiles200_response_meta import ListChangefiles200ResponseMeta +from inse.models.list_changefiles200_response_results_inner import ListChangefiles200ResponseResultsInner +from inse.models.location import Location +from inse.models.meta import Meta +from inse.models.model_field import ModelField +from inse.models.open_access import OpenAccess +from inse.models.publisher import Publisher +from inse.models.publisher_ids import PublisherIds +from inse.models.publisher_parent_publisher import PublisherParentPublisher +from inse.models.publishers_list_response import PublishersListResponse +from inse.models.rate_limit_response import RateLimitResponse +from inse.models.rate_limit_response_rate_limit import RateLimitResponseRateLimit +from inse.models.rate_limit_response_rate_limit_endpoint_costs_usd import RateLimitResponseRateLimitEndpointCostsUsd +from inse.models.sdg import Sdg +from inse.models.sdg_ids import SdgIds +from inse.models.sdgs_list_response import SdgsListResponse +from inse.models.source import Source +from inse.models.source_ids import SourceIds +from inse.models.source_type import SourceType +from inse.models.source_types_list_response import SourceTypesListResponse +from inse.models.sources_list_response import SourcesListResponse +from inse.models.subfield import Subfield +from inse.models.subfield_domain import SubfieldDomain +from inse.models.subfield_field import SubfieldField +from inse.models.subfields_list_response import SubfieldsListResponse +from inse.models.text_classification_response import TextClassificationResponse +from inse.models.text_classification_response_meta import TextClassificationResponseMeta +from inse.models.topic import Topic +from inse.models.topic_domain import TopicDomain +from inse.models.topic_field import TopicField +from inse.models.topic_ids import TopicIds +from inse.models.topic_subfield import TopicSubfield +from inse.models.topics_list_response import TopicsListResponse +from inse.models.work import Work +from inse.models.work_biblio import WorkBiblio +from inse.models.work_citation_normalized_percentile import WorkCitationNormalizedPercentile +from inse.models.work_cited_by_percentile_year import WorkCitedByPercentileYear +from inse.models.work_counts_by_year_inner import WorkCountsByYearInner +from inse.models.work_has_content import WorkHasContent +from inse.models.work_ids import WorkIds +from inse.models.work_keyword import WorkKeyword +from inse.models.work_mesh_inner import WorkMeshInner +from inse.models.work_sustainable_development_goals_inner import WorkSustainableDevelopmentGoalsInner +from inse.models.work_topic import WorkTopic +from inse.models.work_topic_domain import WorkTopicDomain +from inse.models.work_topic_field import WorkTopicField +from inse.models.work_topic_subfield import WorkTopicSubfield +from inse.models.work_type import WorkType +from inse.models.work_types_list_response import WorkTypesListResponse +from inse.models.works_list_response import WorksListResponse +from inse.models.work_page import WorkPage + + diff --git a/service/src/main/inse/models/author.py b/service/src/main/inse/models/author.py new file mode 100644 index 00000000..daf271e8 --- /dev/null +++ b/service/src/main/inse/models/author.py @@ -0,0 +1,166 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.author_affiliations_inner import AuthorAffiliationsInner +from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner +from inse.models.author_ids import AuthorIds +from inse.models.author_parsed_longest_name import AuthorParsedLongestName +from inse.models.author_summary_stats import AuthorSummaryStats +from inse.models.work_topic import WorkTopic +from inse.models.dehydrated_institution import DehydratedInstitution +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Author(BaseModel): + """ + A person who creates scholarly works + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this author.") + orcid: Optional[StrictStr] = Field(default=None, description="The ORCID ID for this author. This is the Canonical External ID for authors.") + display_name: Optional[StrictStr] = Field(default=None, description="The name of the author as a single string.") + display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Other ways this author's name has been displayed.") + longest_name: Optional[StrictStr] = Field(default=None, description="The longest name variant found for this author across all their works.") + parsed_longest_name: Optional[AuthorParsedLongestName] = None + works_count: Optional[StrictInt] = Field(default=None, description="The number of works this author has created.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="The total number of works that cite a work this author has created.") + summary_stats: Optional[AuthorSummaryStats] = None + affiliations: Optional[List[AuthorAffiliationsInner]] = Field(default=None, description="List of affiliations this author has claimed in their publications. Each object has:") + last_known_institutions: Optional[List[DehydratedInstitution]] = Field(default=None, description="This author's last known institutional affiliations. Each item is a dehydrated Institution object.") + topics: Optional[List[WorkTopic]] = None + counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.") + ids: Optional[AuthorIds] = None + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that will get you a list of all this author's works.") + created_date: Optional[date] = Field(default=None, description="When this author was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this author was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "orcid", "display_name", "display_name_alternatives", "longest_name", "parsed_longest_name", "works_count", "cited_by_count", "summary_stats", "affiliations", "last_known_institutions", "topics", "counts_by_year", "ids", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Author from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of parsed_longest_name + if self.parsed_longest_name: + _dict['parsed_longest_name'] = self.parsed_longest_name.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary_stats + if self.summary_stats: + _dict['summary_stats'] = self.summary_stats.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in affiliations (list) + _items = [] + if self.affiliations: + for _item_affiliations in self.affiliations: + if _item_affiliations: + _items.append(_item_affiliations.to_dict()) + _dict['affiliations'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in last_known_institutions (list) + _items = [] + if self.last_known_institutions: + for _item_last_known_institutions in self.last_known_institutions: + if _item_last_known_institutions: + _items.append(_item_last_known_institutions.to_dict()) + _dict['last_known_institutions'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in topics (list) + _items = [] + if self.topics: + for _item_topics in self.topics: + if _item_topics: + _items.append(_item_topics.to_dict()) + _dict['topics'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list) + _items = [] + if self.counts_by_year: + for _item_counts_by_year in self.counts_by_year: + if _item_counts_by_year: + _items.append(_item_counts_by_year.to_dict()) + _dict['counts_by_year'] = _items + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Author from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "orcid": obj.get("orcid"), + "display_name": obj.get("display_name"), + "display_name_alternatives": obj.get("display_name_alternatives"), + "longest_name": obj.get("longest_name"), + "parsed_longest_name": AuthorParsedLongestName.from_dict(obj["parsed_longest_name"]) if obj.get("parsed_longest_name") is not None else None, + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "summary_stats": AuthorSummaryStats.from_dict(obj["summary_stats"]) if obj.get("summary_stats") is not None else None, + "affiliations": [AuthorAffiliationsInner.from_dict(_item) for _item in obj["affiliations"]] if obj.get("affiliations") is not None else None, + "last_known_institutions": [DehydratedInstitution.from_dict(_item) for _item in obj["last_known_institutions"]] if obj.get("last_known_institutions") is not None else None, + "topics": [WorkTopic.from_dict(_item) for _item in obj["topics"]] if obj.get("topics") is not None else None, + "counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None, + "ids": AuthorIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/author_affiliations_inner.py b/service/src/main/inse/models/author_affiliations_inner.py new file mode 100644 index 00000000..289e91e5 --- /dev/null +++ b/service/src/main/inse/models/author_affiliations_inner.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" +OpenAlex API + +The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + +The version of the OpenAPI document: 1.0.0 +Contact: support@openalex.org +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.dehydrated_institution import DehydratedInstitution +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + + +class AuthorAffiliationsInner(BaseModel): + """ + AuthorAffiliationsInner + """ # noqa: E501 + + institution: Optional[DehydratedInstitution] = Field( + default=None, + description="[Dehydrated institution](/api-reference/institutions#the-dehydratedinstitution-object)", + ) + years: Optional[List[StrictInt]] = None + __properties: ClassVar[List[str]] = ["institution", "years"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthorAffiliationsInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of institution + if self.institution: + _dict["institution"] = self.institution.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthorAffiliationsInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "institution": DehydratedInstitution.from_dict(obj["institution"]) + if obj.get("institution") is not None + else None, + "years": obj.get("years"), + } + ) + return _obj diff --git a/service/src/main/inse/models/author_counts_by_year_inner.py b/service/src/main/inse/models/author_counts_by_year_inner.py new file mode 100644 index 00000000..1c6152f0 --- /dev/null +++ b/service/src/main/inse/models/author_counts_by_year_inner.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AuthorCountsByYearInner(BaseModel): + """ + AuthorCountsByYearInner + """ # noqa: E501 + year: Optional[StrictInt] = None + works_count: Optional[StrictInt] = None + cited_by_count: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["year", "works_count", "cited_by_count"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthorCountsByYearInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthorCountsByYearInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "year": obj.get("year"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count") + }) + return _obj + + diff --git a/service/src/main/inse/models/author_ids.py b/service/src/main/inse/models/author_ids.py new file mode 100644 index 00000000..70853b20 --- /dev/null +++ b/service/src/main/inse/models/author_ids.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AuthorIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + orcid: Optional[StrictStr] = None + scopus: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "orcid", "scopus"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthorIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthorIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + openalex_val = obj.get("openalex") + if openalex_val is not None and not isinstance(openalex_val, str): + openalex_val = str(openalex_val) + + orcid_val = obj.get("orcid") + if orcid_val is not None and not isinstance(orcid_val, str): + orcid_val = str(orcid_val) + + scopus_val = obj.get("scopus") + if scopus_val is not None and not isinstance(scopus_val, str): + scopus_val = str(scopus_val) + + _obj = cls.model_validate({ + "openalex": openalex_val, + "orcid": orcid_val, + "scopus": scopus_val + }) + return _obj + + diff --git a/service/src/main/inse/models/author_parsed_longest_name.py b/service/src/main/inse/models/author_parsed_longest_name.py new file mode 100644 index 00000000..d84b4cd5 --- /dev/null +++ b/service/src/main/inse/models/author_parsed_longest_name.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AuthorParsedLongestName(BaseModel): + """ + The longest name parsed into its component parts. + """ # noqa: E501 + first: Optional[StrictStr] = Field(default=None, description="First name (lowercased).") + middle: Optional[StrictStr] = Field(default=None, description="Middle name or initial (lowercased).") + last: Optional[StrictStr] = Field(default=None, description="Last name (lowercased).") + suffix: Optional[StrictStr] = Field(default=None, description="Name suffix (e.g., Jr., III).") + nickname: Optional[StrictStr] = Field(default=None, description="Nickname, if any.") + __properties: ClassVar[List[str]] = ["first", "middle", "last", "suffix", "nickname"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthorParsedLongestName from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthorParsedLongestName from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "first": obj.get("first"), + "middle": obj.get("middle"), + "last": obj.get("last"), + "suffix": obj.get("suffix"), + "nickname": obj.get("nickname") + }) + return _obj + + diff --git a/service/src/main/inse/models/author_summary_stats.py b/service/src/main/inse/models/author_summary_stats.py new file mode 100644 index 00000000..4a00d974 --- /dev/null +++ b/service/src/main/inse/models/author_summary_stats.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AuthorSummaryStats(BaseModel): + """ + Citation metrics: + """ # noqa: E501 + var_2yr_mean_citedness: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="2yr_mean_citedness") + h_index: Optional[StrictInt] = None + i10_index: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["2yr_mean_citedness", "h_index", "i10_index"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthorSummaryStats from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthorSummaryStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "2yr_mean_citedness": obj.get("2yr_mean_citedness"), + "h_index": obj.get("h_index"), + "i10_index": obj.get("i10_index") + }) + return _obj + + diff --git a/service/src/main/inse/models/author_topics_inner.py b/service/src/main/inse/models/author_topics_inner.py new file mode 100644 index 00000000..e9471d9f --- /dev/null +++ b/service/src/main/inse/models/author_topics_inner.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AuthorTopicsInner(BaseModel): + """ + AuthorTopicsInner + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + count: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "count"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthorTopicsInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthorTopicsInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "count": obj.get("count") + }) + return _obj + + diff --git a/service/src/main/inse/models/authors_list_response.py b/service/src/main/inse/models/authors_list_response.py new file mode 100644 index 00000000..263fc762 --- /dev/null +++ b/service/src/main/inse/models/authors_list_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.author import Author +from inse.models.group_by_result import GroupByResult +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AuthorsListResponse(BaseModel): + """ + AuthorsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Author]] = None + group_by: Optional[List[GroupByResult]] = None + __properties: ClassVar[List[str]] = ["meta", "results", "group_by"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthorsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in group_by (list) + _items = [] + if self.group_by: + for _item_group_by in self.group_by: + if _item_group_by: + _items.append(_item_group_by.to_dict()) + _dict['group_by'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthorsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Author.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/authorship.py b/service/src/main/inse/models/authorship.py new file mode 100644 index 00000000..ec3fcd6b --- /dev/null +++ b/service/src/main/inse/models/authorship.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.dehydrated_author import DehydratedAuthor +from inse.models.dehydrated_institution import DehydratedInstitution +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Authorship(BaseModel): + """ + Author and their affiliation for a work + """ # noqa: E501 + author_position: Optional[StrictStr] = Field(default=None, description="Position in author list") + author: Optional[DehydratedAuthor] = Field(default=None, description="[Dehydrated author](/api-reference/authors#the-dehydratedauthor-object)") + institutions: Optional[List[DehydratedInstitution]] = Field(default=None, description="[Dehydrated institutions](/api-reference/institutions#the-dehydratedinstitution-object)") + countries: Optional[List[StrictStr]] = Field(default=None, description="Country codes of affiliations") + is_corresponding: Optional[StrictBool] = Field(default=None, description="Whether this is the corresponding author") + raw_author_name: Optional[StrictStr] = Field(default=None, description="Author name as it appears in the work") + raw_affiliation_strings: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["author_position", "author", "institutions", "countries", "is_corresponding", "raw_author_name", "raw_affiliation_strings"] + + @field_validator('author_position') + def author_position_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['first', 'middle', 'last']): + raise ValueError("must be one of enum values ('first', 'middle', 'last')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Authorship from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of author + if self.author: + _dict['author'] = self.author.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in institutions (list) + _items = [] + if self.institutions: + for _item_institutions in self.institutions: + if _item_institutions: + _items.append(_item_institutions.to_dict()) + _dict['institutions'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Authorship from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "author_position": obj.get("author_position"), + "author": DehydratedAuthor.from_dict(obj["author"]) if obj.get("author") is not None else None, + "institutions": [DehydratedInstitution.from_dict(_item) for _item in obj["institutions"]] if obj.get("institutions") is not None else None, + "countries": obj.get("countries"), + "is_corresponding": obj.get("is_corresponding"), + "raw_author_name": obj.get("raw_author_name"), + "raw_affiliation_strings": obj.get("raw_affiliation_strings") + }) + return _obj + + diff --git a/service/src/main/inse/models/autocomplete_response.py b/service/src/main/inse/models/autocomplete_response.py new file mode 100644 index 00000000..fc5f3d61 --- /dev/null +++ b/service/src/main/inse/models/autocomplete_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.autocomplete_response_meta import AutocompleteResponseMeta +from inse.models.autocomplete_response_results_inner import AutocompleteResponseResultsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AutocompleteResponse(BaseModel): + """ + AutocompleteResponse + """ # noqa: E501 + meta: Optional[AutocompleteResponseMeta] = None + results: Optional[List[AutocompleteResponseResultsInner]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AutocompleteResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AutocompleteResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": AutocompleteResponseMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [AutocompleteResponseResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/autocomplete_response_meta.py b/service/src/main/inse/models/autocomplete_response_meta.py new file mode 100644 index 00000000..ca195725 --- /dev/null +++ b/service/src/main/inse/models/autocomplete_response_meta.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AutocompleteResponseMeta(BaseModel): + """ + AutocompleteResponseMeta + """ # noqa: E501 + count: Optional[StrictInt] = None + db_response_time_ms: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["count", "db_response_time_ms"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AutocompleteResponseMeta from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AutocompleteResponseMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "db_response_time_ms": obj.get("db_response_time_ms") + }) + return _obj + + diff --git a/service/src/main/inse/models/autocomplete_response_results_inner.py b/service/src/main/inse/models/autocomplete_response_results_inner.py new file mode 100644 index 00000000..ae2d0b35 --- /dev/null +++ b/service/src/main/inse/models/autocomplete_response_results_inner.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AutocompleteResponseResultsInner(BaseModel): + """ + AutocompleteResponseResultsInner + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + hint: Optional[StrictStr] = None + cited_by_count: Optional[StrictInt] = None + works_count: Optional[StrictInt] = None + entity_type: Optional[StrictStr] = None + external_id: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "hint", "cited_by_count", "works_count", "entity_type", "external_id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AutocompleteResponseResultsInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AutocompleteResponseResultsInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "hint": obj.get("hint"), + "cited_by_count": obj.get("cited_by_count"), + "works_count": obj.get("works_count"), + "entity_type": obj.get("entity_type"), + "external_id": obj.get("external_id") + }) + return _obj + + diff --git a/service/src/main/inse/models/award.py b/service/src/main/inse/models/award.py new file mode 100644 index 00000000..7b376d84 --- /dev/null +++ b/service/src/main/inse/models/award.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Award(BaseModel): + """ + Award + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + funder_award_id: Optional[StrictStr] = None + funder_id: Optional[StrictStr] = None + funder_display_name: Optional[StrictStr] = None + doi: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "funder_award_id", "funder_id", "funder_display_name", "doi"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Award from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Award from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "funder_award_id": obj.get("funder_award_id"), + "funder_id": obj.get("funder_id"), + "funder_display_name": obj.get("funder_display_name"), + "doi": obj.get("doi") + }) + return _obj + + diff --git a/service/src/main/inse/models/award_full.py b/service/src/main/inse/models/award_full.py new file mode 100644 index 00000000..b9362b8e --- /dev/null +++ b/service/src/main/inse/models/award_full.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from inse.models.award_full_funder import AwardFullFunder +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AwardFull(BaseModel): + """ + Research grant or funding award + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this award.") + display_name: Optional[StrictStr] = Field(default=None, description="The name of the award, if available.") + description: Optional[StrictStr] = Field(default=None, description="A description of the award, if available.") + funder_award_id: Optional[StrictStr] = Field(default=None, description="The funder's internal ID for this award.") + funder: Optional[AwardFullFunder] = None + funded_outputs: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs of works funded by this award (first 100).") + funded_outputs_count: Optional[StrictInt] = Field(default=None, description="Total number of works funded by this award.") + amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The funding amount, if available.") + currency: Optional[StrictStr] = Field(default=None, description="The currency of the funding amount, if available.") + funding_type: Optional[StrictStr] = Field(default=None, description="The type of funding, if available.") + funder_scheme: Optional[StrictStr] = Field(default=None, description="The funder's scheme or program, if available.") + start_date: Optional[date] = Field(default=None, description="Start date of the award (ISO 8601), if available.") + end_date: Optional[date] = Field(default=None, description="End date of the award (ISO 8601), if available.") + start_year: Optional[StrictInt] = Field(default=None, description="Start year of the award, if available.") + end_year: Optional[StrictInt] = Field(default=None, description="End year of the award, if available.") + landing_page_url: Optional[StrictStr] = Field(default=None, description="URL to the award's landing page, if available.") + doi: Optional[StrictStr] = Field(default=None, description="DOI for this award, if available.") + provenance: Optional[StrictStr] = Field(default=None, description="The source of this award data.") + lead_investigator: Optional[Dict[str, Any]] = Field(default=None, description="The lead investigator for this award, if available.") + co_lead_investigator: Optional[Dict[str, Any]] = Field(default=None, description="The co-lead investigator, if available.") + investigators: Optional[List[Any]] = Field(default=None, description="List of investigators on this award, if available.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works funded by this award.") + created_date: Optional[date] = Field(default=None, description="When this award was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this award was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "funder_award_id", "funder", "funded_outputs", "funded_outputs_count", "amount", "currency", "funding_type", "funder_scheme", "start_date", "end_date", "start_year", "end_year", "landing_page_url", "doi", "provenance", "lead_investigator", "co_lead_investigator", "investigators", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AwardFull from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of funder + if self.funder: + _dict['funder'] = self.funder.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AwardFull from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "description": obj.get("description"), + "funder_award_id": obj.get("funder_award_id"), + "funder": AwardFullFunder.from_dict(obj["funder"]) if obj.get("funder") is not None else None, + "funded_outputs": obj.get("funded_outputs"), + "funded_outputs_count": obj.get("funded_outputs_count"), + "amount": obj.get("amount"), + "currency": obj.get("currency"), + "funding_type": obj.get("funding_type"), + "funder_scheme": obj.get("funder_scheme"), + "start_date": obj.get("start_date"), + "end_date": obj.get("end_date"), + "start_year": obj.get("start_year"), + "end_year": obj.get("end_year"), + "landing_page_url": obj.get("landing_page_url"), + "doi": obj.get("doi"), + "provenance": obj.get("provenance"), + "lead_investigator": obj.get("lead_investigator"), + "co_lead_investigator": obj.get("co_lead_investigator"), + "investigators": obj.get("investigators"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/award_full_funder.py b/service/src/main/inse/models/award_full_funder.py new file mode 100644 index 00000000..d49607a6 --- /dev/null +++ b/service/src/main/inse/models/award_full_funder.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AwardFullFunder(BaseModel): + """ + The [funder](/api-reference/funders) of this award + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + doi: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "doi"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AwardFullFunder from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AwardFullFunder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "doi": obj.get("doi") + }) + return _obj + + diff --git a/service/src/main/inse/models/awards_list_response.py b/service/src/main/inse/models/awards_list_response.py new file mode 100644 index 00000000..f2a3b207 --- /dev/null +++ b/service/src/main/inse/models/awards_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.award_full import AwardFull +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AwardsListResponse(BaseModel): + """ + AwardsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[AwardFull]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AwardsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AwardsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [AwardFull.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/concept.py b/service/src/main/inse/models/concept.py new file mode 100644 index 00000000..caff472a --- /dev/null +++ b/service/src/main/inse/models/concept.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.concept_ids import ConceptIds +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Concept(BaseModel): + """ + Legacy research area taxonomy (deprecated) + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this concept.") + display_name: Optional[StrictStr] = Field(default=None, description="The name of the concept.") + description: Optional[StrictStr] = Field(default=None, description="A description of this concept.") + level: Optional[StrictInt] = Field(default=None, description="The hierarchical level (0 = top level, higher = more specific).") + wikidata: Optional[StrictStr] = Field(default=None, description="The Wikidata ID for this concept.") + ids: Optional[ConceptIds] = None + image_url: Optional[StrictStr] = Field(default=None, description="URL for an image representing this concept.") + image_thumbnail_url: Optional[StrictStr] = Field(default=None, description="Smaller version of `image_url`.") + works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this concept.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works tagged with this concept.") + ancestors: Optional[List[Any]] = Field(default=None, description="Parent concepts in the hierarchy.") + related_concepts: Optional[List[Any]] = Field(default=None, description="Related concepts with similarity scores.") + counts_by_year: Optional[List[Any]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this concept.") + created_date: Optional[date] = Field(default=None, description="When this concept was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this concept was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "level", "wikidata", "ids", "image_url", "image_thumbnail_url", "works_count", "cited_by_count", "ancestors", "related_concepts", "counts_by_year", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Concept from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Concept from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "description": obj.get("description"), + "level": obj.get("level"), + "wikidata": obj.get("wikidata"), + "ids": ConceptIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "image_url": obj.get("image_url"), + "image_thumbnail_url": obj.get("image_thumbnail_url"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "ancestors": obj.get("ancestors"), + "related_concepts": obj.get("related_concepts"), + "counts_by_year": obj.get("counts_by_year"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/concept_ids.py b/service/src/main/inse/models/concept_ids.py new file mode 100644 index 00000000..090a8c3f --- /dev/null +++ b/service/src/main/inse/models/concept_ids.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ConceptIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + wikidata: Optional[StrictStr] = None + wikipedia: Optional[StrictStr] = None + mag: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["openalex", "wikidata", "wikipedia", "mag"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConceptIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConceptIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "wikidata": obj.get("wikidata"), + "wikipedia": obj.get("wikipedia"), + "mag": obj.get("mag") + }) + return _obj + + diff --git a/service/src/main/inse/models/concepts_list_response.py b/service/src/main/inse/models/concepts_list_response.py new file mode 100644 index 00000000..7607e403 --- /dev/null +++ b/service/src/main/inse/models/concepts_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.concept import Concept +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ConceptsListResponse(BaseModel): + """ + ConceptsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Concept]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConceptsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConceptsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Concept.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/continent.py b/service/src/main/inse/models/continent.py new file mode 100644 index 00000000..9b9299a5 --- /dev/null +++ b/service/src/main/inse/models/continent.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.continent_ids import ContinentIds +from inse.models.domain_fields_inner import DomainFieldsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Continent(BaseModel): + """ + Geographic continent (7 total) + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this continent (uses Wikidata Q-IDs).") + display_name: Optional[StrictStr] = Field(default=None, description="The name of the continent.") + description: Optional[StrictStr] = Field(default=None, description="A brief description of the continent.") + display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this continent.") + countries: Optional[List[DomainFieldsInner]] = Field(default=None, description="The countries within this continent. Each object has `id` and `display_name`.") + ids: Optional[ContinentIds] = None + created_date: Optional[date] = Field(default=None, description="When this continent was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this continent was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "display_name_alternatives", "countries", "ids", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Continent from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in countries (list) + _items = [] + if self.countries: + for _item_countries in self.countries: + if _item_countries: + _items.append(_item_countries.to_dict()) + _dict['countries'] = _items + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Continent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "description": obj.get("description"), + "display_name_alternatives": obj.get("display_name_alternatives"), + "countries": [DomainFieldsInner.from_dict(_item) for _item in obj["countries"]] if obj.get("countries") is not None else None, + "ids": ContinentIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/continent_ids.py b/service/src/main/inse/models/continent_ids.py new file mode 100644 index 00000000..087bda24 --- /dev/null +++ b/service/src/main/inse/models/continent_ids.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ContinentIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + wikidata: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "wikidata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ContinentIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ContinentIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "wikidata": obj.get("wikidata") + }) + return _obj + + diff --git a/service/src/main/inse/models/continents_list_response.py b/service/src/main/inse/models/continents_list_response.py new file mode 100644 index 00000000..efe0e1ab --- /dev/null +++ b/service/src/main/inse/models/continents_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.continent import Continent +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ContinentsListResponse(BaseModel): + """ + ContinentsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Continent]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ContinentsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ContinentsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Continent.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/countries_list_response.py b/service/src/main/inse/models/countries_list_response.py new file mode 100644 index 00000000..0979819b --- /dev/null +++ b/service/src/main/inse/models/countries_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.country import Country +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CountriesListResponse(BaseModel): + """ + CountriesListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Country]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CountriesListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CountriesListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Country.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/country.py b/service/src/main/inse/models/country.py new file mode 100644 index 00000000..6fc8bc2d --- /dev/null +++ b/service/src/main/inse/models/country.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.country_continent import CountryContinent +from inse.models.country_ids import CountryIds +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Country(BaseModel): + """ + Geographic country + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this country.") + display_name: Optional[StrictStr] = Field(default=None, description="The full name of the country.") + country_code: Optional[StrictStr] = Field(default=None, description="ISO 3166-1 alpha-2 country code.") + description: Optional[StrictStr] = Field(default=None, description="A brief description of the country.") + display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this country.") + continent: Optional[CountryContinent] = None + is_global_south: Optional[StrictBool] = Field(default=None, description="Whether this country is part of the Global South.") + ids: Optional[CountryIds] = None + works_count: Optional[StrictInt] = Field(default=None, description="The number of works with authors affiliated with institutions in this country.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works from this country.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works from authors in this country.") + authors_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all authors with affiliations in this country.") + institutions_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all institutions in this country.") + created_date: Optional[date] = Field(default=None, description="When this country was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this country was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "country_code", "description", "display_name_alternatives", "continent", "is_global_south", "ids", "works_count", "cited_by_count", "works_api_url", "authors_api_url", "institutions_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Country from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of continent + if self.continent: + _dict['continent'] = self.continent.to_dict() + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Country from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "country_code": obj.get("country_code"), + "description": obj.get("description"), + "display_name_alternatives": obj.get("display_name_alternatives"), + "continent": CountryContinent.from_dict(obj["continent"]) if obj.get("continent") is not None else None, + "is_global_south": obj.get("is_global_south"), + "ids": CountryIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "authors_api_url": obj.get("authors_api_url"), + "institutions_api_url": obj.get("institutions_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/country_continent.py b/service/src/main/inse/models/country_continent.py new file mode 100644 index 00000000..80f1319c --- /dev/null +++ b/service/src/main/inse/models/country_continent.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CountryContinent(BaseModel): + """ + The [continent](/api-reference/continents) + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CountryContinent from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CountryContinent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/country_ids.py b/service/src/main/inse/models/country_ids.py new file mode 100644 index 00000000..0f1b3998 --- /dev/null +++ b/service/src/main/inse/models/country_ids.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CountryIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + iso: Optional[StrictStr] = None + wikidata: Optional[StrictStr] = None + wikipedia: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "iso", "wikidata", "wikipedia"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CountryIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CountryIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "iso": obj.get("iso"), + "wikidata": obj.get("wikidata"), + "wikipedia": obj.get("wikipedia") + }) + return _obj + + diff --git a/service/src/main/inse/models/dehydrated_author.py b/service/src/main/inse/models/dehydrated_author.py new file mode 100644 index 00000000..9749c67e --- /dev/null +++ b/service/src/main/inse/models/dehydrated_author.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DehydratedAuthor(BaseModel): + """ + [Dehydrated Author](/api-reference/authors#the-dehydratedauthor-object) — reduced-field version used in nested contexts + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + orcid: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "orcid"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DehydratedAuthor from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DehydratedAuthor from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "orcid": obj.get("orcid") + }) + return _obj + + diff --git a/service/src/main/inse/models/dehydrated_funder.py b/service/src/main/inse/models/dehydrated_funder.py new file mode 100644 index 00000000..4a43cd35 --- /dev/null +++ b/service/src/main/inse/models/dehydrated_funder.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DehydratedFunder(BaseModel): + """ + [Dehydrated Funder](/api-reference/funders) — reduced-field version used in nested contexts + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + ror: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "ror"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DehydratedFunder from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DehydratedFunder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "ror": obj.get("ror") + }) + return _obj + + diff --git a/service/src/main/inse/models/dehydrated_institution.py b/service/src/main/inse/models/dehydrated_institution.py new file mode 100644 index 00000000..8ecf0b25 --- /dev/null +++ b/service/src/main/inse/models/dehydrated_institution.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DehydratedInstitution(BaseModel): + """ + [Dehydrated Institution](/api-reference/institutions#the-dehydratedinstitution-object) — reduced-field version used in nested contexts + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + ror: Optional[StrictStr] = None + country_code: Optional[StrictStr] = Field(default=None, description="[Country](/api-reference/countries) code") + type: Optional[StrictStr] = Field(default=None, description="The [institution type](/api-reference/institution-types)") + lineage: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "ror", "country_code", "type", "lineage"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DehydratedInstitution from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DehydratedInstitution from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "ror": obj.get("ror"), + "country_code": obj.get("country_code"), + "type": obj.get("type"), + "lineage": obj.get("lineage") + }) + return _obj + + diff --git a/service/src/main/inse/models/dehydrated_source.py b/service/src/main/inse/models/dehydrated_source.py new file mode 100644 index 00000000..1174194f --- /dev/null +++ b/service/src/main/inse/models/dehydrated_source.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DehydratedSource(BaseModel): + """ + [Dehydrated Source](/api-reference/sources#the-dehydratedsource-object) — reduced-field version used in nested contexts + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + issn_l: Optional[StrictStr] = None + issn: Optional[List[StrictStr]] = None + is_oa: Optional[StrictBool] = None + is_in_doaj: Optional[StrictBool] = None + is_core: Optional[StrictBool] = None + host_organization: Optional[StrictStr] = None + host_organization_name: Optional[StrictStr] = None + host_organization_lineage: Optional[List[StrictStr]] = None + type: Optional[StrictStr] = Field(default=None, description="The [source type](/api-reference/source-types)") + __properties: ClassVar[List[str]] = ["id", "display_name", "issn_l", "issn", "is_oa", "is_in_doaj", "is_core", "host_organization", "host_organization_name", "host_organization_lineage", "type"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DehydratedSource from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DehydratedSource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "issn_l": obj.get("issn_l"), + "issn": obj.get("issn"), + "is_oa": obj.get("is_oa"), + "is_in_doaj": obj.get("is_in_doaj"), + "is_core": obj.get("is_core"), + "host_organization": obj.get("host_organization"), + "host_organization_name": obj.get("host_organization_name"), + "host_organization_lineage": obj.get("host_organization_lineage"), + "type": obj.get("type") + }) + return _obj + + diff --git a/service/src/main/inse/models/domain.py b/service/src/main/inse/models/domain.py new file mode 100644 index 00000000..ca17c260 --- /dev/null +++ b/service/src/main/inse/models/domain.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.domain_fields_inner import DomainFieldsInner +from inse.models.domain_ids import DomainIds +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Domain(BaseModel): + """ + Top-level category in the topic hierarchy (4 total) + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this domain.") + display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the domain.") + description: Optional[StrictStr] = Field(default=None, description="A description of this domain.") + display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this domain.") + fields: Optional[List[DomainFieldsInner]] = Field(default=None, description="The fields within this domain. Each object has `id` and `display_name`.") + siblings: Optional[List[DomainFieldsInner]] = Field(default=None, description="Other domains at the same level. Each object has `id` and `display_name`.") + ids: Optional[DomainIds] = None + works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with topics in this domain.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works in this domain.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this domain.") + created_date: Optional[date] = Field(default=None, description="When this domain was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this domain was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "display_name_alternatives", "fields", "siblings", "ids", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Domain from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in fields (list) + _items = [] + if self.fields: + for _item_fields in self.fields: + if _item_fields: + _items.append(_item_fields.to_dict()) + _dict['fields'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in siblings (list) + _items = [] + if self.siblings: + for _item_siblings in self.siblings: + if _item_siblings: + _items.append(_item_siblings.to_dict()) + _dict['siblings'] = _items + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Domain from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "description": obj.get("description"), + "display_name_alternatives": obj.get("display_name_alternatives"), + "fields": [DomainFieldsInner.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None, + "siblings": [DomainFieldsInner.from_dict(_item) for _item in obj["siblings"]] if obj.get("siblings") is not None else None, + "ids": DomainIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/domain_fields_inner.py b/service/src/main/inse/models/domain_fields_inner.py new file mode 100644 index 00000000..5f5db6c6 --- /dev/null +++ b/service/src/main/inse/models/domain_fields_inner.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DomainFieldsInner(BaseModel): + """ + DomainFieldsInner + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DomainFieldsInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DomainFieldsInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/domain_ids.py b/service/src/main/inse/models/domain_ids.py new file mode 100644 index 00000000..30aba687 --- /dev/null +++ b/service/src/main/inse/models/domain_ids.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DomainIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + wikidata: Optional[StrictStr] = None + wikipedia: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "wikidata", "wikipedia"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DomainIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DomainIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "wikidata": obj.get("wikidata"), + "wikipedia": obj.get("wikipedia") + }) + return _obj + + diff --git a/service/src/main/inse/models/domains_list_response.py b/service/src/main/inse/models/domains_list_response.py new file mode 100644 index 00000000..6c06770b --- /dev/null +++ b/service/src/main/inse/models/domains_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.domain import Domain +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DomainsListResponse(BaseModel): + """ + DomainsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Domain]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DomainsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DomainsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Domain.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/error.py b/service/src/main/inse/models/error.py new file mode 100644 index 00000000..bbde186c --- /dev/null +++ b/service/src/main/inse/models/error.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Error(BaseModel): + """ + Error + """ # noqa: E501 + error: Optional[StrictStr] = Field(default=None, description="Error type") + message: Optional[StrictStr] = Field(default=None, description="Human-readable error message") + __properties: ClassVar[List[str]] = ["error", "message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "error": obj.get("error"), + "message": obj.get("message") + }) + return _obj + + diff --git a/service/src/main/inse/models/fields_list_response.py b/service/src/main/inse/models/fields_list_response.py new file mode 100644 index 00000000..0fd847e4 --- /dev/null +++ b/service/src/main/inse/models/fields_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.meta import Meta +from inse.models.model_field import ModelField +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class FieldsListResponse(BaseModel): + """ + FieldsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[ModelField]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FieldsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FieldsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [ModelField.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/funder.py b/service/src/main/inse/models/funder.py new file mode 100644 index 00000000..e717a36b --- /dev/null +++ b/service/src/main/inse/models/funder.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner +from inse.models.funder_ids import FunderIds +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Funder(BaseModel): + """ + An organization that funds research + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this funder.") + display_name: Optional[StrictStr] = Field(default=None, description="The primary name of the funder.") + alternate_titles: Optional[List[StrictStr]] = Field(default=None, description="A list of alternate titles for this funder.") + country_code: Optional[StrictStr] = Field(default=None, description="ISO two-letter country code where this funder is located.") + description: Optional[StrictStr] = Field(default=None, description="A short description from Wikidata.") + homepage_url: Optional[StrictStr] = Field(default=None, description="URL for this funder's primary homepage.") + image_url: Optional[StrictStr] = Field(default=None, description="URL for an image representing this funder (usually from Wikimedia).") + image_thumbnail_url: Optional[StrictStr] = Field(default=None, description="Smaller version of `image_url`.") + grants_count: Optional[StrictInt] = Field(default=None, description="The number of grants linked to this funder.") + works_count: Optional[StrictInt] = Field(default=None, description="The number of works linked to this funder.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works linked to this funder.") + ids: Optional[FunderIds] = None + counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.") + works_api_url: Optional[StrictStr] = None + created_date: Optional[date] = Field(default=None, description="When this funder was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this funder was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "alternate_titles", "country_code", "description", "homepage_url", "image_url", "image_thumbnail_url", "grants_count", "works_count", "cited_by_count", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Funder from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list) + _items = [] + if self.counts_by_year: + for _item_counts_by_year in self.counts_by_year: + if _item_counts_by_year: + _items.append(_item_counts_by_year.to_dict()) + _dict['counts_by_year'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Funder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "alternate_titles": obj.get("alternate_titles"), + "country_code": obj.get("country_code"), + "description": obj.get("description"), + "homepage_url": obj.get("homepage_url"), + "image_url": obj.get("image_url"), + "image_thumbnail_url": obj.get("image_thumbnail_url"), + "grants_count": obj.get("grants_count"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "ids": FunderIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None, + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/funder_ids.py b/service/src/main/inse/models/funder_ids.py new file mode 100644 index 00000000..96bbb040 --- /dev/null +++ b/service/src/main/inse/models/funder_ids.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class FunderIds(BaseModel): + """ + External identifiers for this funder: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + ror: Optional[StrictStr] = None + wikidata: Optional[StrictStr] = None + crossref: Optional[StrictStr] = None + doi: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "ror", "wikidata", "crossref", "doi"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FunderIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FunderIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "ror": obj.get("ror"), + "wikidata": obj.get("wikidata"), + "crossref": obj.get("crossref"), + "doi": obj.get("doi") + }) + return _obj + + diff --git a/service/src/main/inse/models/funders_list_response.py b/service/src/main/inse/models/funders_list_response.py new file mode 100644 index 00000000..b93e6f29 --- /dev/null +++ b/service/src/main/inse/models/funders_list_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.funder import Funder +from inse.models.group_by_result import GroupByResult +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class FundersListResponse(BaseModel): + """ + FundersListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Funder]] = None + group_by: Optional[List[GroupByResult]] = None + __properties: ClassVar[List[str]] = ["meta", "results", "group_by"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FundersListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in group_by (list) + _items = [] + if self.group_by: + for _item_group_by in self.group_by: + if _item_group_by: + _items.append(_item_group_by.to_dict()) + _dict['group_by'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FundersListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Funder.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/get_changefile200_response.py b/service/src/main/inse/models/get_changefile200_response.py new file mode 100644 index 00000000..bedd8aec --- /dev/null +++ b/service/src/main/inse/models/get_changefile200_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.get_changefile200_response_meta import GetChangefile200ResponseMeta +from inse.models.get_changefile200_response_results_inner import GetChangefile200ResponseResultsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetChangefile200Response(BaseModel): + """ + GetChangefile200Response + """ # noqa: E501 + meta: Optional[GetChangefile200ResponseMeta] = None + results: Optional[List[GetChangefile200ResponseResultsInner]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetChangefile200Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetChangefile200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": GetChangefile200ResponseMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [GetChangefile200ResponseResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/get_changefile200_response_meta.py b/service/src/main/inse/models/get_changefile200_response_meta.py new file mode 100644 index 00000000..2fce5545 --- /dev/null +++ b/service/src/main/inse/models/get_changefile200_response_meta.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetChangefile200ResponseMeta(BaseModel): + """ + GetChangefile200ResponseMeta + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="Number of entity types with changes") + var_date: Optional[date] = Field(default=None, description="The changefile date", alias="date") + __properties: ClassVar[List[str]] = ["count", "date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseMeta from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "date": obj.get("date") + }) + return _obj + + diff --git a/service/src/main/inse/models/get_changefile200_response_results_inner.py b/service/src/main/inse/models/get_changefile200_response_results_inner.py new file mode 100644 index 00000000..b58fd49f --- /dev/null +++ b/service/src/main/inse/models/get_changefile200_response_results_inner.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.get_changefile200_response_results_inner_formats import GetChangefile200ResponseResultsInnerFormats +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetChangefile200ResponseResultsInner(BaseModel): + """ + GetChangefile200ResponseResultsInner + """ # noqa: E501 + entity: Optional[StrictStr] = Field(default=None, description="The entity type (e.g., works, authors, institutions)") + records: Optional[StrictInt] = Field(default=None, description="Number of created or modified records") + formats: Optional[GetChangefile200ResponseResultsInnerFormats] = None + __properties: ClassVar[List[str]] = ["entity", "records", "formats"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseResultsInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of formats + if self.formats: + _dict['formats'] = self.formats.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseResultsInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "entity": obj.get("entity"), + "records": obj.get("records"), + "formats": GetChangefile200ResponseResultsInnerFormats.from_dict(obj["formats"]) if obj.get("formats") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/get_changefile200_response_results_inner_formats.py b/service/src/main/inse/models/get_changefile200_response_results_inner_formats.py new file mode 100644 index 00000000..7f05dc40 --- /dev/null +++ b/service/src/main/inse/models/get_changefile200_response_results_inner_formats.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.get_changefile200_response_results_inner_formats_jsonl import GetChangefile200ResponseResultsInnerFormatsJsonl +from inse.models.get_changefile200_response_results_inner_formats_parquet import GetChangefile200ResponseResultsInnerFormatsParquet +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetChangefile200ResponseResultsInnerFormats(BaseModel): + """ + GetChangefile200ResponseResultsInnerFormats + """ # noqa: E501 + jsonl: Optional[GetChangefile200ResponseResultsInnerFormatsJsonl] = None + parquet: Optional[GetChangefile200ResponseResultsInnerFormatsParquet] = None + __properties: ClassVar[List[str]] = ["jsonl", "parquet"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseResultsInnerFormats from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of jsonl + if self.jsonl: + _dict['jsonl'] = self.jsonl.to_dict() + # override the default output from pydantic by calling `to_dict()` of parquet + if self.parquet: + _dict['parquet'] = self.parquet.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseResultsInnerFormats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "jsonl": GetChangefile200ResponseResultsInnerFormatsJsonl.from_dict(obj["jsonl"]) if obj.get("jsonl") is not None else None, + "parquet": GetChangefile200ResponseResultsInnerFormatsParquet.from_dict(obj["parquet"]) if obj.get("parquet") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/get_changefile200_response_results_inner_formats_jsonl.py b/service/src/main/inse/models/get_changefile200_response_results_inner_formats_jsonl.py new file mode 100644 index 00000000..09f3ceed --- /dev/null +++ b/service/src/main/inse/models/get_changefile200_response_results_inner_formats_jsonl.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetChangefile200ResponseResultsInnerFormatsJsonl(BaseModel): + """ + GetChangefile200ResponseResultsInnerFormatsJsonl + """ # noqa: E501 + size_bytes: Optional[StrictInt] = Field(default=None, description="File size in bytes") + size_display: Optional[StrictStr] = Field(default=None, description="Human-readable file size") + url: Optional[StrictStr] = Field(default=None, description="Download URL for gzipped JSONL file") + __properties: ClassVar[List[str]] = ["size_bytes", "size_display", "url"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseResultsInnerFormatsJsonl from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseResultsInnerFormatsJsonl from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "size_bytes": obj.get("size_bytes"), + "size_display": obj.get("size_display"), + "url": obj.get("url") + }) + return _obj + + diff --git a/service/src/main/inse/models/get_changefile200_response_results_inner_formats_parquet.py b/service/src/main/inse/models/get_changefile200_response_results_inner_formats_parquet.py new file mode 100644 index 00000000..fc295753 --- /dev/null +++ b/service/src/main/inse/models/get_changefile200_response_results_inner_formats_parquet.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetChangefile200ResponseResultsInnerFormatsParquet(BaseModel): + """ + GetChangefile200ResponseResultsInnerFormatsParquet + """ # noqa: E501 + size_bytes: Optional[StrictInt] = Field(default=None, description="File size in bytes") + size_display: Optional[StrictStr] = Field(default=None, description="Human-readable file size") + url: Optional[StrictStr] = Field(default=None, description="Download URL for Parquet file") + __properties: ClassVar[List[str]] = ["size_bytes", "size_display", "url"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseResultsInnerFormatsParquet from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetChangefile200ResponseResultsInnerFormatsParquet from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "size_bytes": obj.get("size_bytes"), + "size_display": obj.get("size_display"), + "url": obj.get("url") + }) + return _obj + + diff --git a/service/src/main/inse/models/group_by_result.py b/service/src/main/inse/models/group_by_result.py new file mode 100644 index 00000000..a41bfff4 --- /dev/null +++ b/service/src/main/inse/models/group_by_result.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GroupByResult(BaseModel): + """ + GroupByResult + """ # noqa: E501 + key: Optional[StrictStr] = Field(default=None, description="The group key value") + key_display_name: Optional[StrictStr] = Field(default=None, description="Human-readable name for the key") + count: Optional[StrictInt] = Field(default=None, description="Number of results in this group") + __properties: ClassVar[List[str]] = ["key", "key_display_name", "count"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupByResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupByResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "key_display_name": obj.get("key_display_name"), + "count": obj.get("count") + }) + return _obj + + diff --git a/service/src/main/inse/models/institution.py b/service/src/main/inse/models/institution.py new file mode 100644 index 00000000..5e22bc1b --- /dev/null +++ b/service/src/main/inse/models/institution.py @@ -0,0 +1,158 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner +from inse.models.author_summary_stats import AuthorSummaryStats +from inse.models.institution_geo import InstitutionGeo +from inse.models.institution_ids import InstitutionIds +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Institution(BaseModel): + """ + A university, research organization, or other affiliation + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this institution.") + ror: Optional[StrictStr] = Field(default=None, description="The ROR ID for this institution. This is the Canonical External ID for institutions.") + display_name: Optional[StrictStr] = Field(default=None, description="The primary name of the institution.") + country_code: Optional[StrictStr] = Field(default=None, description="ISO two-letter country code where this institution is located.") + type: Optional[StrictStr] = Field(default=None, description="The institution's primary type (ROR vocabulary): `Education`, `Healthcare`, `Company`, `Archive`, `Nonprofit`, `Government`, `Facility`, `Other`.") + homepage_url: Optional[StrictStr] = Field(default=None, description="URL for the institution's primary homepage.") + image_url: Optional[StrictStr] = Field(default=None, description="URL for an image representing this institution (usually from Wikimedia).") + image_thumbnail_url: Optional[StrictStr] = Field(default=None, description="Smaller version of `image_url`.") + display_name_acronyms: Optional[List[StrictStr]] = Field(default=None, description="Acronyms or initialisms for this institution.") + display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Other names people may use for this institution.") + works_count: Optional[StrictInt] = Field(default=None, description="The number of works created by authors affiliated with this institution.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works from authors affiliated with this institution.") + summary_stats: Optional[AuthorSummaryStats] = None + geo: Optional[InstitutionGeo] = None + lineage: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs including this institution and any parent institutions.") + ids: Optional[InstitutionIds] = None + counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that will get you a list of all works affiliated with this institution.") + created_date: Optional[date] = Field(default=None, description="When this institution was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this institution was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "ror", "display_name", "country_code", "type", "homepage_url", "image_url", "image_thumbnail_url", "display_name_acronyms", "display_name_alternatives", "works_count", "cited_by_count", "summary_stats", "geo", "lineage", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other']): + raise ValueError("must be one of enum values ('education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Institution from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of summary_stats + if self.summary_stats: + _dict['summary_stats'] = self.summary_stats.to_dict() + # override the default output from pydantic by calling `to_dict()` of geo + if self.geo: + _dict['geo'] = self.geo.to_dict() + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list) + _items = [] + if self.counts_by_year: + for _item_counts_by_year in self.counts_by_year: + if _item_counts_by_year: + _items.append(_item_counts_by_year.to_dict()) + _dict['counts_by_year'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Institution from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ror": obj.get("ror"), + "display_name": obj.get("display_name"), + "country_code": obj.get("country_code"), + "type": obj.get("type"), + "homepage_url": obj.get("homepage_url"), + "image_url": obj.get("image_url"), + "image_thumbnail_url": obj.get("image_thumbnail_url"), + "display_name_acronyms": obj.get("display_name_acronyms"), + "display_name_alternatives": obj.get("display_name_alternatives"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "summary_stats": AuthorSummaryStats.from_dict(obj["summary_stats"]) if obj.get("summary_stats") is not None else None, + "geo": InstitutionGeo.from_dict(obj["geo"]) if obj.get("geo") is not None else None, + "lineage": obj.get("lineage"), + "ids": InstitutionIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None, + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/institution_geo.py b/service/src/main/inse/models/institution_geo.py new file mode 100644 index 00000000..5b2b7781 --- /dev/null +++ b/service/src/main/inse/models/institution_geo.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class InstitutionGeo(BaseModel): + """ + Location information: + """ # noqa: E501 + city: Optional[StrictStr] = None + geonames_city_id: Optional[StrictStr] = None + region: Optional[StrictStr] = None + country_code: Optional[StrictStr] = None + country: Optional[StrictStr] = None + latitude: Optional[Union[StrictFloat, StrictInt]] = None + longitude: Optional[Union[StrictFloat, StrictInt]] = None + __properties: ClassVar[List[str]] = ["city", "geonames_city_id", "region", "country_code", "country", "latitude", "longitude"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InstitutionGeo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InstitutionGeo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "geonames_city_id": obj.get("geonames_city_id"), + "region": obj.get("region"), + "country_code": obj.get("country_code"), + "country": obj.get("country"), + "latitude": obj.get("latitude"), + "longitude": obj.get("longitude") + }) + return _obj + + diff --git a/service/src/main/inse/models/institution_ids.py b/service/src/main/inse/models/institution_ids.py new file mode 100644 index 00000000..4e4f363d --- /dev/null +++ b/service/src/main/inse/models/institution_ids.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class InstitutionIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + ror: Optional[StrictStr] = None + mag: Optional[StrictInt] = None + grid: Optional[StrictStr] = None + wikipedia: Optional[StrictStr] = None + wikidata: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "ror", "mag", "grid", "wikipedia", "wikidata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InstitutionIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InstitutionIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "ror": obj.get("ror"), + "mag": obj.get("mag"), + "grid": obj.get("grid"), + "wikipedia": obj.get("wikipedia"), + "wikidata": obj.get("wikidata") + }) + return _obj + + diff --git a/service/src/main/inse/models/institution_type.py b/service/src/main/inse/models/institution_type.py new file mode 100644 index 00000000..0a2e4291 --- /dev/null +++ b/service/src/main/inse/models/institution_type.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class InstitutionType(BaseModel): + """ + Type of institution + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + works_count: Optional[StrictInt] = None + cited_by_count: Optional[StrictInt] = None + works_api_url: Optional[StrictStr] = None + created_date: Optional[date] = None + updated_date: Optional[datetime] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InstitutionType from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InstitutionType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/institution_types_list_response.py b/service/src/main/inse/models/institution_types_list_response.py new file mode 100644 index 00000000..d94fb4c8 --- /dev/null +++ b/service/src/main/inse/models/institution_types_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.institution_type import InstitutionType +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class InstitutionTypesListResponse(BaseModel): + """ + InstitutionTypesListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[InstitutionType]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InstitutionTypesListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InstitutionTypesListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [InstitutionType.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/institutions_list_response.py b/service/src/main/inse/models/institutions_list_response.py new file mode 100644 index 00000000..164954e2 --- /dev/null +++ b/service/src/main/inse/models/institutions_list_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.group_by_result import GroupByResult +from inse.models.institution import Institution +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class InstitutionsListResponse(BaseModel): + """ + InstitutionsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Institution]] = None + group_by: Optional[List[GroupByResult]] = None + __properties: ClassVar[List[str]] = ["meta", "results", "group_by"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InstitutionsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in group_by (list) + _items = [] + if self.group_by: + for _item_group_by in self.group_by: + if _item_group_by: + _items.append(_item_group_by.to_dict()) + _dict['group_by'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InstitutionsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Institution.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/keyword.py b/service/src/main/inse/models/keyword.py new file mode 100644 index 00000000..a436b4b6 --- /dev/null +++ b/service/src/main/inse/models/keyword.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Keyword(BaseModel): + """ + A keyword identified from works' topics + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this keyword.") + display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the keyword.") + works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this keyword.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="The total citations to works tagged with this keyword.") + works_api_url: Optional[StrictStr] = None + created_date: Optional[date] = Field(default=None, description="When this keyword was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this keyword was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Keyword from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Keyword from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/keywords_list_response.py b/service/src/main/inse/models/keywords_list_response.py new file mode 100644 index 00000000..7fe1430a --- /dev/null +++ b/service/src/main/inse/models/keywords_list_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.group_by_result import GroupByResult +from inse.models.keyword import Keyword +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class KeywordsListResponse(BaseModel): + """ + KeywordsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Keyword]] = None + group_by: Optional[List[GroupByResult]] = None + __properties: ClassVar[List[str]] = ["meta", "results", "group_by"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of KeywordsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in group_by (list) + _items = [] + if self.group_by: + for _item_group_by in self.group_by: + if _item_group_by: + _items.append(_item_group_by.to_dict()) + _dict['group_by'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of KeywordsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Keyword.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/language.py b/service/src/main/inse/models/language.py new file mode 100644 index 00000000..a983c074 --- /dev/null +++ b/service/src/main/inse/models/language.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Language(BaseModel): + """ + Language of scholarly works + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this language (uses ISO 639-1 codes).") + display_name: Optional[StrictStr] = Field(default=None, description="The name of the language.") + works_count: Optional[StrictInt] = Field(default=None, description="The number of works written in this language.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works in this language.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works in this language.") + created_date: Optional[date] = Field(default=None, description="When this language was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this language was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Language from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Language from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/languages_list_response.py b/service/src/main/inse/models/languages_list_response.py new file mode 100644 index 00000000..5b859c16 --- /dev/null +++ b/service/src/main/inse/models/languages_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.language import Language +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LanguagesListResponse(BaseModel): + """ + LanguagesListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Language]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LanguagesListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LanguagesListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Language.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/license.py b/service/src/main/inse/models/license.py new file mode 100644 index 00000000..7083e2ec --- /dev/null +++ b/service/src/main/inse/models/license.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class License(BaseModel): + """ + Open access license + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + url: Optional[StrictStr] = None + description: Optional[StrictStr] = None + works_count: Optional[StrictInt] = None + cited_by_count: Optional[StrictInt] = None + works_api_url: Optional[StrictStr] = None + created_date: Optional[date] = None + updated_date: Optional[datetime] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "url", "description", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of License from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of License from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "url": obj.get("url"), + "description": obj.get("description"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/licenses_list_response.py b/service/src/main/inse/models/licenses_list_response.py new file mode 100644 index 00000000..78e2e79b --- /dev/null +++ b/service/src/main/inse/models/licenses_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.license import License +from inse.models.meta import Meta +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LicensesListResponse(BaseModel): + """ + LicensesListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[License]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LicensesListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LicensesListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [License.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/list_changefiles200_response.py b/service/src/main/inse/models/list_changefiles200_response.py new file mode 100644 index 00000000..80c6633c --- /dev/null +++ b/service/src/main/inse/models/list_changefiles200_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.list_changefiles200_response_meta import ListChangefiles200ResponseMeta +from inse.models.list_changefiles200_response_results_inner import ListChangefiles200ResponseResultsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ListChangefiles200Response(BaseModel): + """ + ListChangefiles200Response + """ # noqa: E501 + meta: Optional[ListChangefiles200ResponseMeta] = None + results: Optional[List[ListChangefiles200ResponseResultsInner]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListChangefiles200Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListChangefiles200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": ListChangefiles200ResponseMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [ListChangefiles200ResponseResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/list_changefiles200_response_meta.py b/service/src/main/inse/models/list_changefiles200_response_meta.py new file mode 100644 index 00000000..53a11886 --- /dev/null +++ b/service/src/main/inse/models/list_changefiles200_response_meta.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ListChangefiles200ResponseMeta(BaseModel): + """ + ListChangefiles200ResponseMeta + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="Number of available changefile dates") + __properties: ClassVar[List[str]] = ["count"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListChangefiles200ResponseMeta from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListChangefiles200ResponseMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count") + }) + return _obj + + diff --git a/service/src/main/inse/models/list_changefiles200_response_results_inner.py b/service/src/main/inse/models/list_changefiles200_response_results_inner.py new file mode 100644 index 00000000..2f25c3e7 --- /dev/null +++ b/service/src/main/inse/models/list_changefiles200_response_results_inner.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ListChangefiles200ResponseResultsInner(BaseModel): + """ + ListChangefiles200ResponseResultsInner + """ # noqa: E501 + var_date: Optional[date] = Field(default=None, description="The changefile date (YYYY-MM-DD)", alias="date") + url: Optional[StrictStr] = Field(default=None, description="URL to get details and download links for this date") + __properties: ClassVar[List[str]] = ["date", "url"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListChangefiles200ResponseResultsInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListChangefiles200ResponseResultsInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "date": obj.get("date"), + "url": obj.get("url") + }) + return _obj + + diff --git a/service/src/main/inse/models/location.py b/service/src/main/inse/models/location.py new file mode 100644 index 00000000..01a51fd3 --- /dev/null +++ b/service/src/main/inse/models/location.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.dehydrated_source import DehydratedSource +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Location(BaseModel): + """ + Where a work is hosted + """ # noqa: E501 + is_oa: Optional[StrictBool] = Field(default=None, description="Whether this location provides open access") + landing_page_url: Optional[StrictStr] = Field(default=None, description="URL to the landing page") + pdf_url: Optional[StrictStr] = Field(default=None, description="Direct URL to PDF") + source: Optional[DehydratedSource] = Field(default=None, description="[Dehydrated source](/api-reference/sources#the-dehydratedsource-object)") + license: Optional[StrictStr] = Field(default=None, description="The [license](/api-reference/licenses) (e.g., cc-by)") + license_id: Optional[StrictStr] = None + version: Optional[StrictStr] = Field(default=None, description="Version of the work at this location") + is_accepted: Optional[StrictBool] = None + is_published: Optional[StrictBool] = None + __properties: ClassVar[List[str]] = ["is_oa", "landing_page_url", "pdf_url", "source", "license", "license_id", "version", "is_accepted", "is_published"] + + @field_validator('version') + def version_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['publishedVersion', 'acceptedVersion', 'submittedVersion']): + raise ValueError("must be one of enum values ('publishedVersion', 'acceptedVersion', 'submittedVersion')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Location from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Location from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "is_oa": obj.get("is_oa"), + "landing_page_url": obj.get("landing_page_url"), + "pdf_url": obj.get("pdf_url"), + "source": DehydratedSource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "license": obj.get("license"), + "license_id": obj.get("license_id"), + "version": obj.get("version"), + "is_accepted": obj.get("is_accepted"), + "is_published": obj.get("is_published") + }) + return _obj + + diff --git a/service/src/main/inse/models/meta.py b/service/src/main/inse/models/meta.py new file mode 100644 index 00000000..833e3d79 --- /dev/null +++ b/service/src/main/inse/models/meta.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Meta(BaseModel): + """ + Metadata about the query results + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="Total number of results matching the query") + db_response_time_ms: Optional[StrictInt] = Field(default=None, description="Database response time in milliseconds") + page: Optional[StrictInt] = Field(default=None, description="Current page number") + per_page: Optional[StrictInt] = Field(default=None, description="Number of results per page") + next_cursor: Optional[StrictStr] = Field(default=None, description="Cursor for the next page (when using cursor pagination)") + groups_count: Optional[StrictInt] = Field(default=None, description="Number of groups when using group_by") + cost_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Cost of this request in USD") + __properties: ClassVar[List[str]] = ["count", "db_response_time_ms", "page", "per_page", "next_cursor", "groups_count", "cost_usd"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Meta from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Meta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "db_response_time_ms": obj.get("db_response_time_ms"), + "page": obj.get("page"), + "per_page": obj.get("per_page"), + "next_cursor": obj.get("next_cursor"), + "groups_count": obj.get("groups_count"), + "cost_usd": obj.get("cost_usd") + }) + return _obj + + diff --git a/service/src/main/inse/models/model_field.py b/service/src/main/inse/models/model_field.py new file mode 100644 index 00000000..c6fb8a0f --- /dev/null +++ b/service/src/main/inse/models/model_field.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.domain_fields_inner import DomainFieldsInner +from inse.models.domain_ids import DomainIds +from inse.models.work_topic_domain import WorkTopicDomain +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ModelField(BaseModel): + """ + Second-level category in the topic hierarchy (26 total) + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this field.") + display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the field.") + description: Optional[StrictStr] = Field(default=None, description="A description of this field.") + display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this field.") + domain: Optional[WorkTopicDomain] = None + subfields: Optional[List[DomainFieldsInner]] = Field(default=None, description="The subfields within this field. Each object has `id` and `display_name`.") + siblings: Optional[List[DomainFieldsInner]] = Field(default=None, description="Other fields at the same level. Each object has `id` and `display_name`.") + ids: Optional[DomainIds] = None + works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with topics in this field.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works in this field.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this field.") + created_date: Optional[date] = Field(default=None, description="When this field was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this field was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "display_name_alternatives", "domain", "subfields", "siblings", "ids", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModelField from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of domain + if self.domain: + _dict['domain'] = self.domain.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in subfields (list) + _items = [] + if self.subfields: + for _item_subfields in self.subfields: + if _item_subfields: + _items.append(_item_subfields.to_dict()) + _dict['subfields'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in siblings (list) + _items = [] + if self.siblings: + for _item_siblings in self.siblings: + if _item_siblings: + _items.append(_item_siblings.to_dict()) + _dict['siblings'] = _items + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModelField from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "description": obj.get("description"), + "display_name_alternatives": obj.get("display_name_alternatives"), + "domain": WorkTopicDomain.from_dict(obj["domain"]) if obj.get("domain") is not None else None, + "subfields": [DomainFieldsInner.from_dict(_item) for _item in obj["subfields"]] if obj.get("subfields") is not None else None, + "siblings": [DomainFieldsInner.from_dict(_item) for _item in obj["siblings"]] if obj.get("siblings") is not None else None, + "ids": DomainIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/open_access.py b/service/src/main/inse/models/open_access.py new file mode 100644 index 00000000..740c89b2 --- /dev/null +++ b/service/src/main/inse/models/open_access.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OpenAccess(BaseModel): + """ + Open access information + """ # noqa: E501 + is_oa: Optional[StrictBool] = Field(default=None, description="Whether this work is open access") + oa_status: Optional[StrictStr] = Field(default=None, description="Open access status") + oa_url: Optional[StrictStr] = Field(default=None, description="Best open access URL") + any_repository_has_fulltext: Optional[StrictBool] = Field(default=None, description="Whether any repository has the full text") + __properties: ClassVar[List[str]] = ["is_oa", "oa_status", "oa_url", "any_repository_has_fulltext"] + + @field_validator('oa_status') + def oa_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['diamond', 'gold', 'hybrid', 'bronze', 'green', 'closed']): + raise ValueError("must be one of enum values ('diamond', 'gold', 'hybrid', 'bronze', 'green', 'closed')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OpenAccess from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OpenAccess from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "is_oa": obj.get("is_oa"), + "oa_status": obj.get("oa_status"), + "oa_url": obj.get("oa_url"), + "any_repository_has_fulltext": obj.get("any_repository_has_fulltext") + }) + return _obj + + diff --git a/service/src/main/inse/models/publisher.py b/service/src/main/inse/models/publisher.py new file mode 100644 index 00000000..68885d35 --- /dev/null +++ b/service/src/main/inse/models/publisher.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner +from inse.models.publisher_ids import PublisherIds +from inse.models.publisher_parent_publisher import PublisherParentPublisher +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Publisher(BaseModel): + """ + An organization that publishes scholarly works + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this publisher.") + display_name: Optional[StrictStr] = Field(default=None, description="The primary name of the publisher.") + alternate_titles: Optional[List[StrictStr]] = Field(default=None, description="Alternate titles for this publisher (including translations).") + country_codes: Optional[List[StrictStr]] = Field(default=None, description="ISO two-letter country codes where the publisher is primarily located.") + hierarchy_level: Optional[StrictInt] = Field(default=None, description="The hierarchy level for this publisher. Level 0 has no parent publishers.") + parent_publisher: Optional[PublisherParentPublisher] = None + lineage: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs including this publisher and any parent publishers.") + works_count: Optional[StrictInt] = Field(default=None, description="The number of works published by this publisher.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works linked to this publisher.") + sources_api_url: Optional[StrictStr] = Field(default=None, description="A URL that will get you a list of all sources published by this publisher.") + ids: Optional[PublisherIds] = None + counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.") + created_date: Optional[date] = Field(default=None, description="When this publisher was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this publisher was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "alternate_titles", "country_codes", "hierarchy_level", "parent_publisher", "lineage", "works_count", "cited_by_count", "sources_api_url", "ids", "counts_by_year", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Publisher from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of parent_publisher + if self.parent_publisher: + _dict['parent_publisher'] = self.parent_publisher.to_dict() + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list) + _items = [] + if self.counts_by_year: + for _item_counts_by_year in self.counts_by_year: + if _item_counts_by_year: + _items.append(_item_counts_by_year.to_dict()) + _dict['counts_by_year'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Publisher from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "alternate_titles": obj.get("alternate_titles"), + "country_codes": obj.get("country_codes"), + "hierarchy_level": obj.get("hierarchy_level"), + "parent_publisher": PublisherParentPublisher.from_dict(obj["parent_publisher"]) if obj.get("parent_publisher") is not None else None, + "lineage": obj.get("lineage"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "sources_api_url": obj.get("sources_api_url"), + "ids": PublisherIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None, + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/publisher_ids.py b/service/src/main/inse/models/publisher_ids.py new file mode 100644 index 00000000..57c2f8b5 --- /dev/null +++ b/service/src/main/inse/models/publisher_ids.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PublisherIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + ror: Optional[StrictStr] = None + wikidata: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "ror", "wikidata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublisherIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublisherIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "ror": obj.get("ror"), + "wikidata": obj.get("wikidata") + }) + return _obj + + diff --git a/service/src/main/inse/models/publisher_parent_publisher.py b/service/src/main/inse/models/publisher_parent_publisher.py new file mode 100644 index 00000000..14412f61 --- /dev/null +++ b/service/src/main/inse/models/publisher_parent_publisher.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PublisherParentPublisher(BaseModel): + """ + OpenAlex ID of the direct parent publisher. Null if `hierarchy_level` is 0. + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublisherParentPublisher from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublisherParentPublisher from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/publishers_list_response.py b/service/src/main/inse/models/publishers_list_response.py new file mode 100644 index 00000000..5b35bc39 --- /dev/null +++ b/service/src/main/inse/models/publishers_list_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.group_by_result import GroupByResult +from inse.models.meta import Meta +from inse.models.publisher import Publisher +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PublishersListResponse(BaseModel): + """ + PublishersListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Publisher]] = None + group_by: Optional[List[GroupByResult]] = None + __properties: ClassVar[List[str]] = ["meta", "results", "group_by"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublishersListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in group_by (list) + _items = [] + if self.group_by: + for _item_group_by in self.group_by: + if _item_group_by: + _items.append(_item_group_by.to_dict()) + _dict['group_by'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublishersListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Publisher.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/rate_limit_response.py b/service/src/main/inse/models/rate_limit_response.py new file mode 100644 index 00000000..50be4eb1 --- /dev/null +++ b/service/src/main/inse/models/rate_limit_response.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.rate_limit_response_rate_limit import RateLimitResponseRateLimit +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RateLimitResponse(BaseModel): + """ + RateLimitResponse + """ # noqa: E501 + api_key: Optional[StrictStr] = None + rate_limit: Optional[RateLimitResponseRateLimit] = None + __properties: ClassVar[List[str]] = ["api_key", "rate_limit"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RateLimitResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of rate_limit + if self.rate_limit: + _dict['rate_limit'] = self.rate_limit.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RateLimitResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "api_key": obj.get("api_key"), + "rate_limit": RateLimitResponseRateLimit.from_dict(obj["rate_limit"]) if obj.get("rate_limit") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/rate_limit_response_rate_limit.py b/service/src/main/inse/models/rate_limit_response_rate_limit.py new file mode 100644 index 00000000..6263afbd --- /dev/null +++ b/service/src/main/inse/models/rate_limit_response_rate_limit.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from inse.models.rate_limit_response_rate_limit_endpoint_costs_usd import RateLimitResponseRateLimitEndpointCostsUsd +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RateLimitResponseRateLimit(BaseModel): + """ + RateLimitResponseRateLimit + """ # noqa: E501 + daily_budget_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Your daily usage allowance in USD") + daily_used_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Amount used today in USD") + daily_remaining_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Remaining daily allowance in USD") + prepaid_balance_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total prepaid balance in USD") + prepaid_remaining_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Remaining prepaid balance in USD") + prepaid_expires_at: Optional[datetime] = Field(default=None, description="When prepaid balance expires") + resets_at: Optional[datetime] = None + resets_in_seconds: Optional[StrictInt] = None + endpoint_costs_usd: Optional[RateLimitResponseRateLimitEndpointCostsUsd] = None + credits_limit: Optional[StrictInt] = Field(default=None, description="Deprecated. Use daily_budget_usd instead.") + credits_used: Optional[StrictInt] = Field(default=None, description="Deprecated. Use daily_used_usd instead.") + credits_remaining: Optional[StrictInt] = Field(default=None, description="Deprecated. Use daily_remaining_usd instead.") + credit_costs: Optional[Dict[str, Any]] = Field(default=None, description="Deprecated. Use endpoint_costs_usd instead.") + __properties: ClassVar[List[str]] = ["daily_budget_usd", "daily_used_usd", "daily_remaining_usd", "prepaid_balance_usd", "prepaid_remaining_usd", "prepaid_expires_at", "resets_at", "resets_in_seconds", "endpoint_costs_usd", "credits_limit", "credits_used", "credits_remaining", "credit_costs"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RateLimitResponseRateLimit from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of endpoint_costs_usd + if self.endpoint_costs_usd: + _dict['endpoint_costs_usd'] = self.endpoint_costs_usd.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RateLimitResponseRateLimit from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "daily_budget_usd": obj.get("daily_budget_usd"), + "daily_used_usd": obj.get("daily_used_usd"), + "daily_remaining_usd": obj.get("daily_remaining_usd"), + "prepaid_balance_usd": obj.get("prepaid_balance_usd"), + "prepaid_remaining_usd": obj.get("prepaid_remaining_usd"), + "prepaid_expires_at": obj.get("prepaid_expires_at"), + "resets_at": obj.get("resets_at"), + "resets_in_seconds": obj.get("resets_in_seconds"), + "endpoint_costs_usd": RateLimitResponseRateLimitEndpointCostsUsd.from_dict(obj["endpoint_costs_usd"]) if obj.get("endpoint_costs_usd") is not None else None, + "credits_limit": obj.get("credits_limit"), + "credits_used": obj.get("credits_used"), + "credits_remaining": obj.get("credits_remaining"), + "credit_costs": obj.get("credit_costs") + }) + return _obj + + diff --git a/service/src/main/inse/models/rate_limit_response_rate_limit_endpoint_costs_usd.py b/service/src/main/inse/models/rate_limit_response_rate_limit_endpoint_costs_usd.py new file mode 100644 index 00000000..432d9b0c --- /dev/null +++ b/service/src/main/inse/models/rate_limit_response_rate_limit_endpoint_costs_usd.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RateLimitResponseRateLimitEndpointCostsUsd(BaseModel): + """ + Cost per request in USD for each endpoint type + """ # noqa: E501 + singleton: Optional[Union[StrictFloat, StrictInt]] = None + list: Optional[Union[StrictFloat, StrictInt]] = None + search: Optional[Union[StrictFloat, StrictInt]] = None + content: Optional[Union[StrictFloat, StrictInt]] = None + semantic: Optional[Union[StrictFloat, StrictInt]] = None + text: Optional[Union[StrictFloat, StrictInt]] = None + __properties: ClassVar[List[str]] = ["singleton", "list", "search", "content", "semantic", "text"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RateLimitResponseRateLimitEndpointCostsUsd from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RateLimitResponseRateLimitEndpointCostsUsd from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "singleton": obj.get("singleton"), + "list": obj.get("list"), + "search": obj.get("search"), + "content": obj.get("content"), + "semantic": obj.get("semantic"), + "text": obj.get("text") + }) + return _obj + + diff --git a/service/src/main/inse/models/sdg.py b/service/src/main/inse/models/sdg.py new file mode 100644 index 00000000..c69fc388 --- /dev/null +++ b/service/src/main/inse/models/sdg.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.sdg_ids import SdgIds +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Sdg(BaseModel): + """ + UN Sustainable Development Goal (17 total) + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this SDG.") + display_name: Optional[StrictStr] = Field(default=None, description="The name of the SDG.") + description: Optional[StrictStr] = Field(default=None, description="The official UN description of this goal.") + ids: Optional[SdgIds] = None + works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this SDG.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works tagged with this SDG.") + image_url: Optional[StrictStr] = Field(default=None, description="URL to the official SDG icon image.") + image_thumbnail_url: Optional[StrictStr] = Field(default=None, description="Smaller version of `image_url`.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this SDG.") + created_date: Optional[date] = Field(default=None, description="When this SDG was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this SDG was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "ids", "works_count", "cited_by_count", "image_url", "image_thumbnail_url", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Sdg from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Sdg from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "description": obj.get("description"), + "ids": SdgIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "image_url": obj.get("image_url"), + "image_thumbnail_url": obj.get("image_thumbnail_url"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/sdg_ids.py b/service/src/main/inse/models/sdg_ids.py new file mode 100644 index 00000000..103d4ccd --- /dev/null +++ b/service/src/main/inse/models/sdg_ids.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SdgIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + un: Optional[StrictStr] = None + wikidata: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "un", "wikidata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SdgIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SdgIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "un": obj.get("un"), + "wikidata": obj.get("wikidata") + }) + return _obj + + diff --git a/service/src/main/inse/models/sdgs_list_response.py b/service/src/main/inse/models/sdgs_list_response.py new file mode 100644 index 00000000..5d8d4631 --- /dev/null +++ b/service/src/main/inse/models/sdgs_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.meta import Meta +from inse.models.sdg import Sdg +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SdgsListResponse(BaseModel): + """ + SdgsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Sdg]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SdgsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SdgsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Sdg.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/source.py b/service/src/main/inse/models/source.py new file mode 100644 index 00000000..8d89286d --- /dev/null +++ b/service/src/main/inse/models/source.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner +from inse.models.author_summary_stats import AuthorSummaryStats +from inse.models.source_ids import SourceIds +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Source(BaseModel): + """ + A journal, repository, or other venue for scholarly works + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this source.") + issn_l: Optional[StrictStr] = Field(default=None, description="The ISSN-L (linking ISSN) for this source. This is the Canonical External ID for sources.") + issn: Optional[List[StrictStr]] = Field(default=None, description="All ISSNs used by this source. Many publications have multiple ISSNs.") + display_name: Optional[StrictStr] = Field(default=None, description="The name of the source.") + type: Optional[StrictStr] = Field(default=None, description="The type of source: `journal`, `repository`, `conference`, `ebook platform`, `book series`, `metadata`, or `other`.") + host_organization: Optional[StrictStr] = Field(default=None, description="The host organization as an OpenAlex ID. This will be an Institution ID if the source is a repository, or a Publisher ID if it's a journal/conference.") + host_organization_name: Optional[StrictStr] = Field(default=None, description="The display_name of the host organization.") + host_organization_lineage: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs of parent publishers (only for publisher-hosted sources).") + is_oa: Optional[StrictBool] = Field(default=None, description="Whether this is currently a fully open-access source.") + is_in_doaj: Optional[StrictBool] = Field(default=None, description="Whether this journal is listed in the Directory of Open Access Journals.") + works_count: Optional[StrictInt] = Field(default=None, description="The number of works this source hosts.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works hosted in this source.") + summary_stats: Optional[AuthorSummaryStats] = None + apc_usd: Optional[StrictInt] = Field(default=None, description="The source's article processing charge in USD.") + homepage_url: Optional[StrictStr] = Field(default=None, description="The homepage URL for this source.") + ids: Optional[SourceIds] = None + counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that will get you a list of all this source's works.") + created_date: Optional[date] = Field(default=None, description="When this source was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this source was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "issn_l", "issn", "display_name", "type", "host_organization", "host_organization_name", "host_organization_lineage", "is_oa", "is_in_doaj", "works_count", "cited_by_count", "summary_stats", "apc_usd", "homepage_url", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['journal', 'repository', 'conference', 'ebook platform', 'book series']): + raise ValueError("must be one of enum values ('journal', 'repository', 'conference', 'ebook platform', 'book series')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Source from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of summary_stats + if self.summary_stats: + _dict['summary_stats'] = self.summary_stats.to_dict() + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list) + _items = [] + if self.counts_by_year: + for _item_counts_by_year in self.counts_by_year: + if _item_counts_by_year: + _items.append(_item_counts_by_year.to_dict()) + _dict['counts_by_year'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Source from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "issn_l": obj.get("issn_l"), + "issn": obj.get("issn"), + "display_name": obj.get("display_name"), + "type": obj.get("type"), + "host_organization": obj.get("host_organization"), + "host_organization_name": obj.get("host_organization_name"), + "host_organization_lineage": obj.get("host_organization_lineage"), + "is_oa": obj.get("is_oa"), + "is_in_doaj": obj.get("is_in_doaj"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "summary_stats": AuthorSummaryStats.from_dict(obj["summary_stats"]) if obj.get("summary_stats") is not None else None, + "apc_usd": obj.get("apc_usd"), + "homepage_url": obj.get("homepage_url"), + "ids": SourceIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None, + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/source_ids.py b/service/src/main/inse/models/source_ids.py new file mode 100644 index 00000000..b8c7c185 --- /dev/null +++ b/service/src/main/inse/models/source_ids.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SourceIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + issn_l: Optional[StrictStr] = None + issn: Optional[List[StrictStr]] = None + mag: Optional[StrictInt] = None + wikidata: Optional[StrictStr] = None + fatcat: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "issn_l", "issn", "mag", "wikidata", "fatcat"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "issn_l": obj.get("issn_l"), + "issn": obj.get("issn"), + "mag": obj.get("mag"), + "wikidata": obj.get("wikidata"), + "fatcat": obj.get("fatcat") + }) + return _obj + + diff --git a/service/src/main/inse/models/source_type.py b/service/src/main/inse/models/source_type.py new file mode 100644 index 00000000..8811321b --- /dev/null +++ b/service/src/main/inse/models/source_type.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SourceType(BaseModel): + """ + Type of source + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + works_count: Optional[StrictInt] = None + cited_by_count: Optional[StrictInt] = None + works_api_url: Optional[StrictStr] = None + created_date: Optional[date] = None + updated_date: Optional[datetime] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceType from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/source_types_list_response.py b/service/src/main/inse/models/source_types_list_response.py new file mode 100644 index 00000000..95fe9419 --- /dev/null +++ b/service/src/main/inse/models/source_types_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.meta import Meta +from inse.models.source_type import SourceType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SourceTypesListResponse(BaseModel): + """ + SourceTypesListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[SourceType]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceTypesListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceTypesListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [SourceType.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/sources_list_response.py b/service/src/main/inse/models/sources_list_response.py new file mode 100644 index 00000000..c90c9c9f --- /dev/null +++ b/service/src/main/inse/models/sources_list_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.group_by_result import GroupByResult +from inse.models.meta import Meta +from inse.models.source import Source +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SourcesListResponse(BaseModel): + """ + SourcesListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Source]] = None + group_by: Optional[List[GroupByResult]] = None + __properties: ClassVar[List[str]] = ["meta", "results", "group_by"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourcesListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in group_by (list) + _items = [] + if self.group_by: + for _item_group_by in self.group_by: + if _item_group_by: + _items.append(_item_group_by.to_dict()) + _dict['group_by'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourcesListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Source.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/subfield.py b/service/src/main/inse/models/subfield.py new file mode 100644 index 00000000..b5976edb --- /dev/null +++ b/service/src/main/inse/models/subfield.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.domain_fields_inner import DomainFieldsInner +from inse.models.domain_ids import DomainIds +from inse.models.subfield_domain import SubfieldDomain +from inse.models.subfield_field import SubfieldField +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Subfield(BaseModel): + """ + Third-level category in the topic hierarchy (254 total) + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this subfield.") + display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the subfield.") + description: Optional[StrictStr] = Field(default=None, description="A description of this subfield.") + display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this subfield.") + var_field: Optional[SubfieldField] = Field(default=None, alias="field") + domain: Optional[SubfieldDomain] = None + topics: Optional[List[DomainFieldsInner]] = Field(default=None, description="The topics within this subfield. Each object has `id` and `display_name`.") + siblings: Optional[List[DomainFieldsInner]] = Field(default=None, description="Other subfields at the same level (across all fields). Each object has `id` and `display_name`.") + ids: Optional[DomainIds] = None + works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with topics in this subfield.") + cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works in this subfield.") + works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this subfield.") + created_date: Optional[date] = Field(default=None, description="When this subfield was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this subfield was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "display_name_alternatives", "field", "domain", "topics", "siblings", "ids", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Subfield from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of var_field + if self.var_field: + _dict['field'] = self.var_field.to_dict() + # override the default output from pydantic by calling `to_dict()` of domain + if self.domain: + _dict['domain'] = self.domain.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in topics (list) + _items = [] + if self.topics: + for _item_topics in self.topics: + if _item_topics: + _items.append(_item_topics.to_dict()) + _dict['topics'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in siblings (list) + _items = [] + if self.siblings: + for _item_siblings in self.siblings: + if _item_siblings: + _items.append(_item_siblings.to_dict()) + _dict['siblings'] = _items + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Subfield from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "description": obj.get("description"), + "display_name_alternatives": obj.get("display_name_alternatives"), + "field": SubfieldField.from_dict(obj["field"]) if obj.get("field") is not None else None, + "domain": SubfieldDomain.from_dict(obj["domain"]) if obj.get("domain") is not None else None, + "topics": [DomainFieldsInner.from_dict(_item) for _item in obj["topics"]] if obj.get("topics") is not None else None, + "siblings": [DomainFieldsInner.from_dict(_item) for _item in obj["siblings"]] if obj.get("siblings") is not None else None, + "ids": DomainIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/subfield_domain.py b/service/src/main/inse/models/subfield_domain.py new file mode 100644 index 00000000..e3997b3e --- /dev/null +++ b/service/src/main/inse/models/subfield_domain.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SubfieldDomain(BaseModel): + """ + The domain containing this subfield (top level of hierarchy). + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubfieldDomain from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubfieldDomain from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/subfield_field.py b/service/src/main/inse/models/subfield_field.py new file mode 100644 index 00000000..8d8d1c23 --- /dev/null +++ b/service/src/main/inse/models/subfield_field.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SubfieldField(BaseModel): + """ + The field containing this subfield (parent level). + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubfieldField from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubfieldField from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/subfields_list_response.py b/service/src/main/inse/models/subfields_list_response.py new file mode 100644 index 00000000..73b66906 --- /dev/null +++ b/service/src/main/inse/models/subfields_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.meta import Meta +from inse.models.subfield import Subfield +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SubfieldsListResponse(BaseModel): + """ + SubfieldsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Subfield]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubfieldsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubfieldsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Subfield.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/text_classification_response.py b/service/src/main/inse/models/text_classification_response.py new file mode 100644 index 00000000..ea08d0df --- /dev/null +++ b/service/src/main/inse/models/text_classification_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.text_classification_response_meta import TextClassificationResponseMeta +from inse.models.work_topic import WorkTopic +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TextClassificationResponse(BaseModel): + """ + TextClassificationResponse + """ # noqa: E501 + meta: Optional[TextClassificationResponseMeta] = None + results: Optional[List[WorkTopic]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextClassificationResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextClassificationResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": TextClassificationResponseMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [WorkTopic.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/text_classification_response_meta.py b/service/src/main/inse/models/text_classification_response_meta.py new file mode 100644 index 00000000..86c76ee1 --- /dev/null +++ b/service/src/main/inse/models/text_classification_response_meta.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TextClassificationResponseMeta(BaseModel): + """ + TextClassificationResponseMeta + """ # noqa: E501 + count: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["count"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextClassificationResponseMeta from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextClassificationResponseMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count") + }) + return _obj + + diff --git a/service/src/main/inse/models/topic.py b/service/src/main/inse/models/topic.py new file mode 100644 index 00000000..b26c2e76 --- /dev/null +++ b/service/src/main/inse/models/topic.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.topic_domain import TopicDomain +from inse.models.topic_field import TopicField +from inse.models.topic_ids import TopicIds +from inse.models.topic_subfield import TopicSubfield +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Topic(BaseModel): + """ + A research topic automatically assigned to works + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this topic.") + display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the topic.") + description: Optional[StrictStr] = Field(default=None, description="A description of this topic, generated by AI.") + keywords: Optional[List[StrictStr]] = Field(default=None, description="Keywords representing the content of papers in the topic.") + subfield: Optional[TopicSubfield] = None + var_field: Optional[TopicField] = Field(default=None, alias="field") + domain: Optional[TopicDomain] = None + works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this topic.") + cited_by_count: Optional[StrictInt] = None + ids: Optional[TopicIds] = None + works_api_url: Optional[StrictStr] = None + created_date: Optional[date] = None + updated_date: Optional[datetime] = Field(default=None, description="When this topic was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "keywords", "subfield", "field", "domain", "works_count", "cited_by_count", "ids", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Topic from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of subfield + if self.subfield: + _dict['subfield'] = self.subfield.to_dict() + # override the default output from pydantic by calling `to_dict()` of var_field + if self.var_field: + _dict['field'] = self.var_field.to_dict() + # override the default output from pydantic by calling `to_dict()` of domain + if self.domain: + _dict['domain'] = self.domain.to_dict() + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Topic from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "description": obj.get("description"), + "keywords": obj.get("keywords"), + "subfield": TopicSubfield.from_dict(obj["subfield"]) if obj.get("subfield") is not None else None, + "field": TopicField.from_dict(obj["field"]) if obj.get("field") is not None else None, + "domain": TopicDomain.from_dict(obj["domain"]) if obj.get("domain") is not None else None, + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "ids": TopicIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/topic_domain.py b/service/src/main/inse/models/topic_domain.py new file mode 100644 index 00000000..75546c88 --- /dev/null +++ b/service/src/main/inse/models/topic_domain.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TopicDomain(BaseModel): + """ + The domain (highest level) containing this topic: + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TopicDomain from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TopicDomain from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/topic_field.py b/service/src/main/inse/models/topic_field.py new file mode 100644 index 00000000..939f5016 --- /dev/null +++ b/service/src/main/inse/models/topic_field.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TopicField(BaseModel): + """ + The field (second level) containing this topic: + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TopicField from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TopicField from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/topic_ids.py b/service/src/main/inse/models/topic_ids.py new file mode 100644 index 00000000..b4de5f84 --- /dev/null +++ b/service/src/main/inse/models/topic_ids.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TopicIds(BaseModel): + """ + External identifiers: + """ # noqa: E501 + openalex: Optional[StrictStr] = None + wikipedia: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "wikipedia"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TopicIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TopicIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "openalex": obj.get("openalex"), + "wikipedia": obj.get("wikipedia") + }) + return _obj + + diff --git a/service/src/main/inse/models/topic_subfield.py b/service/src/main/inse/models/topic_subfield.py new file mode 100644 index 00000000..0dc545bc --- /dev/null +++ b/service/src/main/inse/models/topic_subfield.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TopicSubfield(BaseModel): + """ + The subfield (third level) containing this topic: + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TopicSubfield from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TopicSubfield from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/topics_list_response.py b/service/src/main/inse/models/topics_list_response.py new file mode 100644 index 00000000..5cd3d5bf --- /dev/null +++ b/service/src/main/inse/models/topics_list_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.group_by_result import GroupByResult +from inse.models.meta import Meta +from inse.models.topic import Topic +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TopicsListResponse(BaseModel): + """ + TopicsListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Topic]] = None + group_by: Optional[List[GroupByResult]] = None + __properties: ClassVar[List[str]] = ["meta", "results", "group_by"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TopicsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in group_by (list) + _items = [] + if self.group_by: + for _item_group_by in self.group_by: + if _item_group_by: + _items.append(_item_group_by.to_dict()) + _dict['group_by'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TopicsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Topic.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/work.py b/service/src/main/inse/models/work.py new file mode 100644 index 00000000..a116b540 --- /dev/null +++ b/service/src/main/inse/models/work.py @@ -0,0 +1,268 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from inse.models.authorship import Authorship +from inse.models.award import Award +from inse.models.dehydrated_funder import DehydratedFunder +from inse.models.location import Location +from inse.models.open_access import OpenAccess +from inse.models.work_biblio import WorkBiblio +from inse.models.work_citation_normalized_percentile import WorkCitationNormalizedPercentile +from inse.models.work_cited_by_percentile_year import WorkCitedByPercentileYear +from inse.models.work_counts_by_year_inner import WorkCountsByYearInner +from inse.models.work_has_content import WorkHasContent +from inse.models.work_ids import WorkIds +from inse.models.work_keyword import WorkKeyword +from inse.models.work_mesh_inner import WorkMeshInner +from inse.models.work_sustainable_development_goals_inner import WorkSustainableDevelopmentGoalsInner +from inse.models.work_topic import WorkTopic +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Work(BaseModel): + """ + A scholarly document (article, book, dataset, thesis, etc.) + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this work.") + doi: Optional[StrictStr] = Field(default=None, description="The DOI for the work. This is the Canonical External ID for works.") + title: Optional[StrictStr] = Field(default=None, description="The title of this work.") + display_name: Optional[StrictStr] = Field(default=None, description="Same as `title`. Included for consistency with other entities.") + publication_year: Optional[StrictInt] = Field(default=None, description="The year this work was published.") + publication_date: Optional[date] = Field(default=None, description="The day when this work was published (ISO 8601 format).") + type: Optional[StrictStr] = Field(default=None, description="The type of the work. Common values: `article`, `book`, `dataset`, `preprint`, `dissertation`, `book-chapter`.") + language: Optional[StrictStr] = Field(default=None, description="[Language](/api-reference/languages) in ISO 639-1 format") + cited_by_count: Optional[StrictInt] = Field(default=None, description="The number of citations to this work.") + is_retracted: Optional[StrictBool] = Field(default=None, description="True if this work has been retracted (from Retraction Watch database).") + is_paratext: Optional[StrictBool] = Field(default=None, description="True if this work is paratext (e.g., front cover, table of contents).") + primary_location: Optional[Location] = Field(default=None, description="A Location object with the primary location of this work (closest to the version of record). Includes `source`, `landing_page_url`, `pdf_url`, `is_oa`, `license`, and `version`.") + locations: Optional[List[Location]] = Field(default=None, description="List of Location objects describing all unique places where this work lives.") + best_oa_location: Optional[Location] = Field(default=None, description="A Location object with the best available open access location for this work.") + open_access: Optional[OpenAccess] = Field(default=None, description="Information about the access status of this work:") + authorships: Optional[List[Authorship]] = Field(default=None, description="List of Authorship objects representing authors and their institutions. Limited to the first 100 authors. Each authorship includes `author`, `institutions`, `author_position`, `is_corresponding`, and other fields.") + ids: Optional[WorkIds] = None + biblio: Optional[WorkBiblio] = None + abstract_inverted_index: Optional[Dict[str, Any]] = Field(default=None, description="The abstract as an inverted index (word positions). OpenAlex doesn't include plaintext abstracts due to legal constraints. Use the `has_abstract` filter to get works with or without abstracts.") + referenced_works: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs for works that this work cites.") + referenced_works_count: Optional[StrictInt] = Field(default=None, description="The number of works that this work cites.") + related_works: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs for works related to this work (computed algorithmically).") + topics: Optional[List[WorkTopic]] = Field(default=None, description="List of up to 3 Topics for this work, each with a relevance score.") + primary_topic: Optional[WorkTopic] = Field(default=None, description="The top ranked Topic for this work, with `id`, `display_name`, `score`, and hierarchy (`subfield`, `field`, `domain`).") + keywords: Optional[List[WorkKeyword]] = Field(default=None, description="Keywords identified based on the work's topics, with relevance scores.") + funders: Optional[List[DehydratedFunder]] = Field(default=None, description="Dehydrated Funder objects representing the funders of this work.") + awards: Optional[List[Award]] = Field(default=None, description="Dehydrated Award objects representing grants associated with this work.") + fwci: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Field-weighted Citation Impact, calculated as citations received / citations expected.") + citation_normalized_percentile: Optional[WorkCitationNormalizedPercentile] = None + cited_by_percentile_year: Optional[WorkCitedByPercentileYear] = None + counts_by_year: Optional[List[WorkCountsByYearInner]] = Field(default=None, description="`cited_by_count` for each of the last ten years.") + sustainable_development_goals: Optional[List[WorkSustainableDevelopmentGoalsInner]] = Field(default=None, description="UN Sustainable Development Goals relevant to this work, with prediction scores.") + mesh: Optional[List[WorkMeshInner]] = Field(default=None, description="MeSH tags for works found in PubMed.") + indexed_in: Optional[List[StrictStr]] = Field(default=None, description="Sources this work is indexed in. Values: `arxiv`, `crossref`, `doaj`, `pubmed`.") + has_content: Optional[WorkHasContent] = None + content_url: Optional[StrictStr] = Field(default=None, description="URL for downloading full-text content. Only present when `has_content.pdf` or `has_content.grobid_xml` is true.") + created_date: Optional[date] = Field(default=None, description="When this work was added to OpenAlex (ISO 8601 date).") + updated_date: Optional[datetime] = Field(default=None, description="When this work was last updated (ISO 8601 datetime).") + __properties: ClassVar[List[str]] = ["id", "doi", "title", "display_name", "publication_year", "publication_date", "type", "language", "cited_by_count", "is_retracted", "is_paratext", "primary_location", "locations", "best_oa_location", "open_access", "authorships", "ids", "biblio", "abstract_inverted_index", "referenced_works", "referenced_works_count", "related_works", "topics", "primary_topic", "keywords", "funders", "awards", "fwci", "citation_normalized_percentile", "cited_by_percentile_year", "counts_by_year", "sustainable_development_goals", "mesh", "indexed_in", "has_content", "content_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Work from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of primary_location + if self.primary_location: + _dict['primary_location'] = self.primary_location.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in locations (list) + _items = [] + if self.locations: + for _item_locations in self.locations: + if _item_locations: + _items.append(_item_locations.to_dict()) + _dict['locations'] = _items + # override the default output from pydantic by calling `to_dict()` of best_oa_location + if self.best_oa_location: + _dict['best_oa_location'] = self.best_oa_location.to_dict() + # override the default output from pydantic by calling `to_dict()` of open_access + if self.open_access: + _dict['open_access'] = self.open_access.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in authorships (list) + _items = [] + if self.authorships: + for _item_authorships in self.authorships: + if _item_authorships: + _items.append(_item_authorships.to_dict()) + _dict['authorships'] = _items + # override the default output from pydantic by calling `to_dict()` of ids + if self.ids: + _dict['ids'] = self.ids.to_dict() + # override the default output from pydantic by calling `to_dict()` of biblio + if self.biblio: + _dict['biblio'] = self.biblio.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in topics (list) + _items = [] + if self.topics: + for _item_topics in self.topics: + if _item_topics: + _items.append(_item_topics.to_dict()) + _dict['topics'] = _items + # override the default output from pydantic by calling `to_dict()` of primary_topic + if self.primary_topic: + _dict['primary_topic'] = self.primary_topic.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in keywords (list) + _items = [] + if self.keywords: + for _item_keywords in self.keywords: + if _item_keywords: + _items.append(_item_keywords.to_dict()) + _dict['keywords'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in funders (list) + _items = [] + if self.funders: + for _item_funders in self.funders: + if _item_funders: + _items.append(_item_funders.to_dict()) + _dict['funders'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in awards (list) + _items = [] + if self.awards: + for _item_awards in self.awards: + if _item_awards: + _items.append(_item_awards.to_dict()) + _dict['awards'] = _items + # override the default output from pydantic by calling `to_dict()` of citation_normalized_percentile + if self.citation_normalized_percentile: + _dict['citation_normalized_percentile'] = self.citation_normalized_percentile.to_dict() + # override the default output from pydantic by calling `to_dict()` of cited_by_percentile_year + if self.cited_by_percentile_year: + _dict['cited_by_percentile_year'] = self.cited_by_percentile_year.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list) + _items = [] + if self.counts_by_year: + for _item_counts_by_year in self.counts_by_year: + if _item_counts_by_year: + _items.append(_item_counts_by_year.to_dict()) + _dict['counts_by_year'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in sustainable_development_goals (list) + _items = [] + if self.sustainable_development_goals: + for _item_sustainable_development_goals in self.sustainable_development_goals: + if _item_sustainable_development_goals: + _items.append(_item_sustainable_development_goals.to_dict()) + _dict['sustainable_development_goals'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in mesh (list) + _items = [] + if self.mesh: + for _item_mesh in self.mesh: + if _item_mesh: + _items.append(_item_mesh.to_dict()) + _dict['mesh'] = _items + # override the default output from pydantic by calling `to_dict()` of has_content + if self.has_content: + _dict['has_content'] = self.has_content.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Work from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "doi": obj.get("doi"), + "title": obj.get("title"), + "display_name": obj.get("display_name"), + "publication_year": obj.get("publication_year"), + "publication_date": obj.get("publication_date"), + "type": obj.get("type"), + "language": obj.get("language"), + "cited_by_count": obj.get("cited_by_count"), + "is_retracted": obj.get("is_retracted"), + "is_paratext": obj.get("is_paratext"), + "primary_location": Location.from_dict(obj["primary_location"]) if obj.get("primary_location") is not None else None, + "locations": [Location.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None, + "best_oa_location": Location.from_dict(obj["best_oa_location"]) if obj.get("best_oa_location") is not None else None, + "open_access": OpenAccess.from_dict(obj["open_access"]) if obj.get("open_access") is not None else None, + "authorships": [Authorship.from_dict(_item) for _item in obj["authorships"]] if obj.get("authorships") is not None else None, + "ids": WorkIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None, + "biblio": WorkBiblio.from_dict(obj["biblio"]) if obj.get("biblio") is not None else None, + "abstract_inverted_index": obj.get("abstract_inverted_index"), + "referenced_works": obj.get("referenced_works"), + "related_works": obj.get("related_works"), + "topics": [WorkTopic.from_dict(_item) for _item in obj["topics"]] if obj.get("topics") is not None else None, + "primary_topic": WorkTopic.from_dict(obj["primary_topic"]) if obj.get("primary_topic") is not None else None, + "keywords": [WorkKeyword.from_dict(_item) for _item in obj["keywords"]] if obj.get("keywords") is not None else None, + "funders": [DehydratedFunder.from_dict(_item) for _item in obj["funders"]] if obj.get("funders") is not None else None, + "awards": [Award.from_dict(_item) for _item in obj["awards"]] if obj.get("awards") is not None else None, + "fwci": obj.get("fwci"), + "citation_normalized_percentile": WorkCitationNormalizedPercentile.from_dict(obj["citation_normalized_percentile"]) if obj.get("citation_normalized_percentile") is not None else None, + "cited_by_percentile_year": WorkCitedByPercentileYear.from_dict(obj["cited_by_percentile_year"]) if obj.get("cited_by_percentile_year") is not None else None, + "counts_by_year": [WorkCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None, + "sustainable_development_goals": [WorkSustainableDevelopmentGoalsInner.from_dict(_item) for _item in obj["sustainable_development_goals"]] if obj.get("sustainable_development_goals") is not None else None, + "mesh": [WorkMeshInner.from_dict(_item) for _item in obj["mesh"]] if obj.get("mesh") is not None else None, + "indexed_in": obj.get("indexed_in"), + "has_content": WorkHasContent.from_dict(obj["has_content"]) if obj.get("has_content") is not None else None, + "content_url": obj.get("content_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_biblio.py b/service/src/main/inse/models/work_biblio.py new file mode 100644 index 00000000..8d0c7506 --- /dev/null +++ b/service/src/main/inse/models/work_biblio.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkBiblio(BaseModel): + """ + Bibliographic info: `volume`, `issue`, `first_page`, `last_page`. + """ # noqa: E501 + volume: Optional[StrictStr] = None + issue: Optional[StrictStr] = None + first_page: Optional[StrictStr] = None + last_page: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["volume", "issue", "first_page", "last_page"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkBiblio from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkBiblio from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "volume": obj.get("volume"), + "issue": obj.get("issue"), + "first_page": obj.get("first_page"), + "last_page": obj.get("last_page") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_citation_normalized_percentile.py b/service/src/main/inse/models/work_citation_normalized_percentile.py new file mode 100644 index 00000000..bf72a965 --- /dev/null +++ b/service/src/main/inse/models/work_citation_normalized_percentile.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkCitationNormalizedPercentile(BaseModel): + """ + Percentile of citation count normalized by work type, year, and subfield. Includes `value`, `is_in_top_1_percent`, `is_in_top_10_percent`. + """ # noqa: E501 + value: Optional[Union[StrictFloat, StrictInt]] = None + is_in_top_1_percent: Optional[StrictBool] = None + is_in_top_10_percent: Optional[StrictBool] = None + __properties: ClassVar[List[str]] = ["value", "is_in_top_1_percent", "is_in_top_10_percent"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkCitationNormalizedPercentile from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkCitationNormalizedPercentile from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "value": obj.get("value"), + "is_in_top_1_percent": obj.get("is_in_top_1_percent"), + "is_in_top_10_percent": obj.get("is_in_top_10_percent") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_cited_by_percentile_year.py b/service/src/main/inse/models/work_cited_by_percentile_year.py new file mode 100644 index 00000000..6a0a3aab --- /dev/null +++ b/service/src/main/inse/models/work_cited_by_percentile_year.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkCitedByPercentileYear(BaseModel): + """ + Percentile rank compared to other works published in the same year. Contains `min` and `max`. + """ # noqa: E501 + min: Optional[StrictInt] = None + max: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["min", "max"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkCitedByPercentileYear from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkCitedByPercentileYear from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "min": obj.get("min"), + "max": obj.get("max") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_counts_by_year_inner.py b/service/src/main/inse/models/work_counts_by_year_inner.py new file mode 100644 index 00000000..592a8684 --- /dev/null +++ b/service/src/main/inse/models/work_counts_by_year_inner.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkCountsByYearInner(BaseModel): + """ + WorkCountsByYearInner + """ # noqa: E501 + year: Optional[StrictInt] = None + cited_by_count: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["year", "cited_by_count"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkCountsByYearInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkCountsByYearInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "year": obj.get("year"), + "cited_by_count": obj.get("cited_by_count") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_has_content.py b/service/src/main/inse/models/work_has_content.py new file mode 100644 index 00000000..cf2e07d7 --- /dev/null +++ b/service/src/main/inse/models/work_has_content.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkHasContent(BaseModel): + """ + Information about downloadable full-text content: + """ # noqa: E501 + pdf: Optional[StrictBool] = None + grobid_xml: Optional[StrictBool] = None + __properties: ClassVar[List[str]] = ["pdf", "grobid_xml"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkHasContent from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkHasContent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pdf": obj.get("pdf"), + "grobid_xml": obj.get("grobid_xml") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_ids.py b/service/src/main/inse/models/work_ids.py new file mode 100644 index 00000000..f4478c3e --- /dev/null +++ b/service/src/main/inse/models/work_ids.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkIds(BaseModel): + """ + External identifiers: `openalex`, `doi`, `mag`, `pmid`, `pmcid`. + """ # noqa: E501 + openalex: Optional[StrictStr] = None + doi: Optional[StrictStr] = None + mag: Optional[StrictInt] = None + pmid: Optional[StrictStr] = None + pmcid: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["openalex", "doi", "mag", "pmid", "pmcid"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkIds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + mag_val = obj.get("mag") + if mag_val is not None: + try: + mag_val = int(mag_val) + except (ValueError, TypeError): + pass + + openalex_val = obj.get("openalex") + if openalex_val is not None and not isinstance(openalex_val, str): + openalex_val = str(openalex_val) + + doi_val = obj.get("doi") + if doi_val is not None and not isinstance(doi_val, str): + doi_val = str(doi_val) + + pmid_val = obj.get("pmid") + if pmid_val is not None and not isinstance(pmid_val, str): + pmid_val = str(pmid_val) + + pmcid_val = obj.get("pmcid") + if pmcid_val is not None and not isinstance(pmcid_val, str): + pmcid_val = str(pmcid_val) + + _obj = cls.model_validate({ + "openalex": openalex_val, + "doi": doi_val, + "mag": mag_val, + "pmid": pmid_val, + "pmcid": pmcid_val + }) + return _obj + + diff --git a/service/src/main/inse/models/work_keyword.py b/service/src/main/inse/models/work_keyword.py new file mode 100644 index 00000000..55feaab6 --- /dev/null +++ b/service/src/main/inse/models/work_keyword.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkKeyword(BaseModel): + """ + WorkKeyword + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + score: Optional[Union[StrictFloat, StrictInt]] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "score"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkKeyword from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkKeyword from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "score": obj.get("score") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_mesh_inner.py b/service/src/main/inse/models/work_mesh_inner.py new file mode 100644 index 00000000..73d67064 --- /dev/null +++ b/service/src/main/inse/models/work_mesh_inner.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkMeshInner(BaseModel): + """ + WorkMeshInner + """ # noqa: E501 + descriptor_ui: Optional[StrictStr] = None + descriptor_name: Optional[StrictStr] = None + qualifier_ui: Optional[StrictStr] = None + qualifier_name: Optional[StrictStr] = None + is_major_topic: Optional[StrictBool] = None + __properties: ClassVar[List[str]] = ["descriptor_ui", "descriptor_name", "qualifier_ui", "qualifier_name", "is_major_topic"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkMeshInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkMeshInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "descriptor_ui": obj.get("descriptor_ui"), + "descriptor_name": obj.get("descriptor_name"), + "qualifier_ui": obj.get("qualifier_ui"), + "qualifier_name": obj.get("qualifier_name"), + "is_major_topic": obj.get("is_major_topic") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_page.py b/service/src/main/inse/models/work_page.py new file mode 100644 index 00000000..6cd51282 --- /dev/null +++ b/service/src/main/inse/models/work_page.py @@ -0,0 +1,15 @@ +from typing import List + +from pydantic import BaseModel, Field + +from inse.models.work import Work + + +class WorkPage(BaseModel): + total: int = Field(description="Total number of works matching the query") + elements: List[Work] = Field(description="List of works on the current page") + offset: int = Field(description="Offset of the current page") + size: int = Field(description="Size of the current page") + last_page: bool = Field( + description="Indicates if the current page is the last page" + ) diff --git a/service/src/main/inse/models/work_sustainable_development_goals_inner.py b/service/src/main/inse/models/work_sustainable_development_goals_inner.py new file mode 100644 index 00000000..8ebe17d0 --- /dev/null +++ b/service/src/main/inse/models/work_sustainable_development_goals_inner.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkSustainableDevelopmentGoalsInner(BaseModel): + """ + WorkSustainableDevelopmentGoalsInner + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + score: Optional[Union[StrictFloat, StrictInt]] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "score"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkSustainableDevelopmentGoalsInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkSustainableDevelopmentGoalsInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "score": obj.get("score") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_topic.py b/service/src/main/inse/models/work_topic.py new file mode 100644 index 00000000..ac9a6c3d --- /dev/null +++ b/service/src/main/inse/models/work_topic.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from inse.models.work_topic_domain import WorkTopicDomain +from inse.models.work_topic_field import WorkTopicField +from inse.models.work_topic_subfield import WorkTopicSubfield +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkTopic(BaseModel): + """ + WorkTopic + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + score: Optional[Union[StrictFloat, StrictInt]] = None + subfield: Optional[WorkTopicSubfield] = None + var_field: Optional[WorkTopicField] = Field(default=None, alias="field") + domain: Optional[WorkTopicDomain] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "score", "subfield", "field", "domain"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkTopic from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of subfield + if self.subfield: + _dict['subfield'] = self.subfield.to_dict() + # override the default output from pydantic by calling `to_dict()` of var_field + if self.var_field: + _dict['field'] = self.var_field.to_dict() + # override the default output from pydantic by calling `to_dict()` of domain + if self.domain: + _dict['domain'] = self.domain.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkTopic from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "score": obj.get("score"), + "subfield": WorkTopicSubfield.from_dict(obj["subfield"]) if obj.get("subfield") is not None else None, + "field": WorkTopicField.from_dict(obj["field"]) if obj.get("field") is not None else None, + "domain": WorkTopicDomain.from_dict(obj["domain"]) if obj.get("domain") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/work_topic_domain.py b/service/src/main/inse/models/work_topic_domain.py new file mode 100644 index 00000000..0ce6021e --- /dev/null +++ b/service/src/main/inse/models/work_topic_domain.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkTopicDomain(BaseModel): + """ + The parent [domain](/api-reference/domains) + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkTopicDomain from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkTopicDomain from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_topic_field.py b/service/src/main/inse/models/work_topic_field.py new file mode 100644 index 00000000..a62147ab --- /dev/null +++ b/service/src/main/inse/models/work_topic_field.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkTopicField(BaseModel): + """ + The parent [field](/api-reference/fields) + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkTopicField from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkTopicField from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_topic_subfield.py b/service/src/main/inse/models/work_topic_subfield.py new file mode 100644 index 00000000..96af42a8 --- /dev/null +++ b/service/src/main/inse/models/work_topic_subfield.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkTopicSubfield(BaseModel): + """ + The parent [subfield](/api-reference/subfields) + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkTopicSubfield from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkTopicSubfield from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_type.py b/service/src/main/inse/models/work_type.py new file mode 100644 index 00000000..5377ada0 --- /dev/null +++ b/service/src/main/inse/models/work_type.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkType(BaseModel): + """ + Type of scholarly work + """ # noqa: E501 + id: Optional[StrictStr] = None + display_name: Optional[StrictStr] = None + description: Optional[StrictStr] = None + works_count: Optional[StrictInt] = None + cited_by_count: Optional[StrictInt] = None + works_api_url: Optional[StrictStr] = None + created_date: Optional[date] = None + updated_date: Optional[datetime] = None + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkType from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "description": obj.get("description"), + "works_count": obj.get("works_count"), + "cited_by_count": obj.get("cited_by_count"), + "works_api_url": obj.get("works_api_url"), + "created_date": obj.get("created_date"), + "updated_date": obj.get("updated_date") + }) + return _obj + + diff --git a/service/src/main/inse/models/work_types_list_response.py b/service/src/main/inse/models/work_types_list_response.py new file mode 100644 index 00000000..bdd7e251 --- /dev/null +++ b/service/src/main/inse/models/work_types_list_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.meta import Meta +from inse.models.work_type import WorkType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkTypesListResponse(BaseModel): + """ + WorkTypesListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[WorkType]] = None + __properties: ClassVar[List[str]] = ["meta", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkTypesListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkTypesListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [WorkType.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/models/works_list_response.py b/service/src/main/inse/models/works_list_response.py new file mode 100644 index 00000000..3c2af748 --- /dev/null +++ b/service/src/main/inse/models/works_list_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + OpenAlex API + + The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works. + + The version of the OpenAPI document: 1.0.0 + Contact: support@openalex.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from inse.models.group_by_result import GroupByResult +from inse.models.meta import Meta +from inse.models.work import Work +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorksListResponse(BaseModel): + """ + WorksListResponse + """ # noqa: E501 + meta: Optional[Meta] = None + results: Optional[List[Work]] = None + group_by: Optional[List[GroupByResult]] = None + __properties: ClassVar[List[str]] = ["meta", "results", "group_by"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorksListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in group_by (list) + _items = [] + if self.group_by: + for _item_group_by in self.group_by: + if _item_group_by: + _items.append(_item_group_by.to_dict()) + _dict['group_by'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorksListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, + "results": [Work.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None + }) + return _obj + + diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index 22a16a19..96225866 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -24,6 +24,9 @@ from . import security from . import util from .works import service as works_service +from inse.models.authors_list_response import AuthorsListResponse + + logger = logging.getLogger(__name__) ### startup @@ -154,7 +157,7 @@ def count_topic_hierarchy( @app.get('/persons/search', operation_id='searchPersons', - response_model=model.PersonSearchResult, + response_model=AuthorsListResponse, summary='Searches for persons by ID or name.', response_model_exclude_none=True, tags=[ 'Persons' ]) diff --git a/service/src/main/inse/works/logic.py b/service/src/main/inse/works/logic.py index 752176e4..81a78b0f 100644 --- a/service/src/main/inse/works/logic.py +++ b/service/src/main/inse/works/logic.py @@ -11,7 +11,10 @@ from pydantic import ValidationError from starlette.status import HTTP_502_BAD_GATEWAY from starlette.status import HTTP_503_SERVICE_UNAVAILABLE -from . import model +from inse.models.work import Work +from inse.models.work_page import WorkPage +from inse.models.works_list_response import WorksListResponse +from inse.models.meta import Meta from .search_client import MissingApiKeyError from .search_client import OpenAlexWorksSearchClient @@ -26,7 +29,7 @@ async def get_author_works( work_type: list[str] | None = None, language: list[str] | None = None, client: OpenAlexWorksSearchClient | None = None, -) -> model.WorkPage: +) -> WorkPage: search_client = client or OpenAlexWorksSearchClient() data = await _search_author_works_data( search_client, @@ -38,18 +41,27 @@ async def get_author_works( language=language, ) - elements, total = _parse_work_search_response(data) - return model.WorkPage(elements=elements, page=page, size=size, total=total) + elements, total = _parse_full_work_search_response(data) + offset = (page - 1) * size + last_page = offset + len(elements) >= total + + return WorkPage( + total=total, + elements=elements, + offset=offset, + size=size, + last_page=last_page, + ) async def get_all_author_works( author_id: str, client: OpenAlexWorksSearchClient | None = None, -) -> model.WorkList: +) -> WorksListResponse: search_client = client or OpenAlexWorksSearchClient() page = 1 size = 100 - all_elements: list[model.Work] = [] + all_elements: list[Work] = [] total = 0 while True: @@ -67,7 +79,10 @@ async def get_all_author_works( page += 1 - return model.WorkList(elements=all_elements, total=total) + return WorksListResponse( + results=all_elements, + meta=Meta(count=total), + ) async def _search_author_works_data( @@ -102,17 +117,42 @@ async def _search_author_works_data( ) from exc -def _parse_work_search_response(data: dict) -> tuple[list[model.WorkSummary], int]: +def _parse_full_work_search_response(data: dict) -> tuple[list[Work], int]: hits = data.get("hits", {}) total = hits.get("total", 0) if isinstance(total, dict): total = total.get("value", 0) try: - elements = [ - model.WorkSummary.model_validate(_to_work_summary(hit.get("_source", {}))) - for hit in hits.get("hits", []) - ] + elements = [] + for hit in hits.get("hits", []): + source = hit.get("_source", {}) + if source: + source_copy = dict(source) + if not source_copy.get("title") and source_copy.get("display_name"): + source_copy["title"] = source_copy["display_name"] + elif not source_copy.get("display_name") and source_copy.get("title"): + source_copy["display_name"] = source_copy["title"] + + # Resilient sanitization of IDs to protect against model regeneration type conflicts + ids = source_copy.get("ids") + if isinstance(ids, dict): + ids_copy = dict(ids) + mag = ids_copy.get("mag") + if mag is not None: + try: + ids_copy["mag"] = int(mag) + except (ValueError, TypeError): + pass + for str_field in ["openalex", "doi", "pmid", "pmcid"]: + val = ids_copy.get(str_field) + if val is not None and not isinstance(val, str): + ids_copy[str_field] = str(val) + source_copy["ids"] = ids_copy + + work = Work.from_dict(source_copy) + if work is not None: + elements.append(work) except ValidationError as exc: logger.exception("OpenAlex works search response could not be parsed.") raise HTTPException( @@ -121,40 +161,3 @@ def _parse_work_search_response(data: dict) -> tuple[list[model.WorkSummary], in ) from exc 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: - return { - "doi": source.get("doi"), - "title": source.get("title") or source.get("display_name"), - "type": source.get("type"), - "language": source.get("language"), - "publication_year": source.get("publication_year"), - "cited_by_count": source.get("cited_by_count") or 0, - "topics": [ - topic["display_name"] - for topic in source.get("topics") or [] - if topic.get("display_name") - ], - } diff --git a/service/src/main/inse/works/model.py b/service/src/main/inse/works/model.py deleted file mode 100644 index 02c8bf25..00000000 --- a/service/src/main/inse/works/model.py +++ /dev/null @@ -1,218 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - Pydantic models for publication works. -""" -from typing import List -from typing import Optional - -from pydantic import BaseModel -from pydantic import ConfigDict -from pydantic import Field - - -class OpenAlexModel(BaseModel): - model_config = ConfigDict(extra="allow") - - -class Source(OpenAlexModel): - id: Optional[str] = Field(default=None, description="The source id.") - display_name: Optional[str] = Field(default=None, description="The source display name.") - issn_l: Optional[str] = Field(default=None, description="The linking ISSN.") - issn: Optional[List[str]] = Field(default=None, description="The ISSNs of the source.") - is_oa: Optional[bool] = Field(default=None, description="Whether the source is open access.") - is_in_doaj: Optional[bool] = Field(default=None, description="Whether the source is in DOAJ.") - is_core: Optional[bool] = Field(default=None, description="Whether the source is a core source.") - host_organization: Optional[str] = Field(default=None, description="The host organization id.") - host_organization_name: Optional[str] = Field(default=None, description="The host organization name.") - host_organization_lineage: Optional[List[str]] = Field(default=None, description="The host organization lineage.") - type: Optional[str] = Field(default=None, description="The source type.") - - -class Location(OpenAlexModel): - is_oa: Optional[bool] = Field(default=None, description="Whether this location is open access.") - landing_page_url: Optional[str] = Field(default=None, description="The landing page URL.") - pdf_url: Optional[str] = Field(default=None, description="The PDF URL.") - source: Optional[Source] = Field(default=None, description="The publication source.") - license: Optional[str] = Field(default=None, description="The license label.") - license_id: Optional[str] = Field(default=None, description="The license id.") - is_accepted: Optional[bool] = Field(default=None, description="Whether this manuscript is accepted.") - is_published: Optional[bool] = Field(default=None, description="Whether this manuscript is published.") - - -class OpenAccess(OpenAlexModel): - is_oa: Optional[bool] = Field(default=None, description="Whether the work is open access.") - oa_url: Optional[str] = Field(default=None, description="The open access URL.") - any_repository_has_fulltext: Optional[bool] = Field(default=None, description="Whether a repository has full text.") - - -class Author(OpenAlexModel): - id: Optional[str] = Field(default=None, description="The author id.") - display_name: Optional[str] = Field(default=None, description="The display name of the author.") - orcid: Optional[str] = Field(default=None, description="The optional ORCID of the author.") - - -class Institution(OpenAlexModel): - id: Optional[str] = Field(default=None, description="The institution id.") - display_name: Optional[str] = Field(default=None, description="The institution display name.") - ror: Optional[str] = Field(default=None, description="The ROR id.") - country_code: Optional[str] = Field(default=None, description="The country code.") - type: Optional[str] = Field(default=None, description="The institution type.") - lineage: Optional[List[str]] = Field(default=None, description="The institution lineage.") - - -class Authorship(OpenAlexModel): - author: Optional[Author] = Field(default=None, description="The author.") - institutions: List[Institution] = Field(default_factory=list, description="The author's institutions.") - countries: List[str] = Field(default_factory=list, description="The author's countries.") - is_corresponding: Optional[bool] = Field(default=None, description="Whether this author is corresponding.") - raw_author_name: Optional[str] = Field(default=None, description="The raw author name.") - raw_affiliation_strings: List[str] = Field(default_factory=list, description="The raw affiliation strings.") - - -class WorkIds(OpenAlexModel): - openalex: Optional[str] = Field(default=None, description="The OpenAlex id.") - doi: Optional[str] = Field(default=None, description="The DOI.") - mag: Optional[int] = Field(default=None, description="The MAG id.") - pmid: Optional[str] = Field(default=None, description="The PubMed id.") - pmcid: Optional[str] = Field(default=None, description="The PubMed Central id.") - - -class Biblio(OpenAlexModel): - volume: Optional[str] = Field(default=None, description="The volume.") - issue: Optional[str] = Field(default=None, description="The issue.") - first_page: Optional[str] = Field(default=None, description="The first page.") - last_page: Optional[str] = Field(default=None, description="The last page.") - - -class TopicLevel(OpenAlexModel): - id: Optional[str] = Field(default=None, description="The topic level id.") - display_name: Optional[str] = Field(default=None, description="The topic level display name.") - - -class Topic(OpenAlexModel): - id: Optional[str] = Field(default=None, description="The topic id.") - display_name: Optional[str] = Field(default=None, description="The topic display name.") - score: Optional[float] = Field(default=None, description="The topic score.") - subfield: Optional[TopicLevel] = Field(default=None, description="The topic subfield.") - field: Optional[TopicLevel] = Field(default=None, description="The topic field.") - domain: Optional[TopicLevel] = Field(default=None, description="The topic domain.") - - -class Keyword(OpenAlexModel): - id: Optional[str] = Field(default=None, description="The keyword id.") - display_name: Optional[str] = Field(default=None, description="The keyword display name.") - score: Optional[float] = Field(default=None, description="The keyword score.") - - -class Funder(OpenAlexModel): - id: Optional[str] = Field(default=None, description="The funder id.") - display_name: Optional[str] = Field(default=None, description="The funder display name.") - ror: Optional[str] = Field(default=None, description="The ROR id.") - - -class Award(OpenAlexModel): - id: Optional[str] = Field(default=None, description="The award id.") - display_name: Optional[str] = Field(default=None, description="The award display name.") - funder_award_id: Optional[str] = Field(default=None, description="The funder award id.") - funder_id: Optional[str] = Field(default=None, description="The funder id.") - funder_display_name: Optional[str] = Field(default=None, description="The funder display name.") - doi: Optional[str] = Field(default=None, description="The award DOI.") - - -class CitationNormalizedPercentile(OpenAlexModel): - value: Optional[float] = Field(default=None, description="The normalized citation percentile.") - is_in_top_1_percent: Optional[bool] = Field(default=None, description="Whether the work is in the top 1 percent.") - is_in_top_10_percent: Optional[bool] = Field(default=None, description="Whether the work is in the top 10 percent.") - - -class CitedByPercentileYear(OpenAlexModel): - min: Optional[int] = Field(default=None, description="The minimum percentile year.") - max: Optional[int] = Field(default=None, description="The maximum percentile year.") - - -class CountByYear(OpenAlexModel): - year: Optional[int] = Field(default=None, description="The year.") - cited_by_count: int = Field(default=0, description="The citation count for the year.") - - -class SustainableDevelopmentGoal(OpenAlexModel): - id: Optional[str] = Field(default=None, description="The sustainable development goal id.") - display_name: Optional[str] = Field(default=None, description="The sustainable development goal display name.") - score: Optional[float] = Field(default=None, description="The sustainable development goal score.") - - -class Mesh(OpenAlexModel): - descriptor_ui: Optional[str] = Field(default=None, description="The descriptor UI.") - descriptor_name: Optional[str] = Field(default=None, description="The descriptor name.") - qualifier_ui: Optional[str] = Field(default=None, description="The qualifier UI.") - qualifier_name: Optional[str] = Field(default=None, description="The qualifier name.") - is_major_topic: Optional[bool] = Field(default=None, description="Whether this is a major topic.") - - -class HasContent(OpenAlexModel): - pdf: Optional[bool] = Field(default=None, description="Whether PDF content exists.") - grobid_xml: Optional[bool] = Field(default=None, description="Whether GROBID XML content exists.") - - -class Work(OpenAlexModel): - id: str = Field(description="The external id of the work.") - doi: Optional[str] = Field(default=None, description="The optional DOI of the work.") - title: Optional[str] = Field(default=None, description="The title of the work.") - display_name: Optional[str] = Field(default=None, description="The display name of the work.") - publication_year: Optional[int] = Field(default=None, description="The publication year.") - publication_date: Optional[str] = Field(default=None, description="The publication date.") - type: Optional[str] = Field(default=None, description="The work type.") - language: Optional[str] = Field(default=None, description="The work language.") - cited_by_count: int = Field(default=0, description="The number of citations.") - is_retracted: Optional[bool] = Field(default=None, description="Whether the work is retracted.") - is_paratext: Optional[bool] = Field(default=None, description="Whether the work is paratext.") - primary_location: Optional[Location] = Field(default=None, description="The primary location.") - locations: List[Location] = Field(default_factory=list, description="The work locations.") - best_oa_location: Optional[Location] = Field(default=None, description="The best open access location.") - open_access: Optional[OpenAccess] = Field(default=None, description="Open access information.") - authorships: List[Authorship] = Field(default_factory=list, description="The authorships.") - ids: Optional[WorkIds] = Field(default=None, description="External ids.") - biblio: Optional[Biblio] = Field(default=None, description="Bibliographic information.") - abstract_inverted_index: dict[str, List[int]] = Field(default_factory=dict, description="The inverted abstract index.") - referenced_works: List[str] = Field(default_factory=list, description="Referenced work ids.") - referenced_works_count: int = Field(default=0, description="The number of referenced works.") - related_works: List[str] = Field(default_factory=list, description="Related work ids.") - topics: List[Topic] = Field(default_factory=list, description="The topics.") - primary_topic: Optional[Topic] = Field(default=None, description="The primary topic.") - keywords: List[Keyword] = Field(default_factory=list, description="The keywords.") - funders: List[Funder] = Field(default_factory=list, description="The funders.") - awards: List[Award] = Field(default_factory=list, description="The awards.") - fwci: Optional[float] = Field(default=None, description="The field weighted citation impact.") - citation_normalized_percentile: Optional[CitationNormalizedPercentile] = Field(default=None, description="The normalized citation percentile.") - cited_by_percentile_year: Optional[CitedByPercentileYear] = Field(default=None, description="The cited by percentile year.") - counts_by_year: List[CountByYear] = Field(default_factory=list, description="Citation counts by year.") - sustainable_development_goals: List[SustainableDevelopmentGoal] = Field(default_factory=list, description="Sustainable development goals.") - mesh: List[Mesh] = Field(default_factory=list, description="MeSH terms.") - indexed_in: List[str] = Field(default_factory=list, description="Indexes containing the work.") - has_content: Optional[HasContent] = Field(default=None, description="Available content flags.") - content_url: Optional[str] = Field(default=None, description="The content URL.") - created_date: Optional[str] = Field(default=None, description="The creation date.") - updated_date: Optional[str] = Field(default=None, description="The last update timestamp.") - - -class WorkSummary(BaseModel): - doi: Optional[str] = Field(default=None, description="The optional DOI of the work.") - title: Optional[str] = Field(default=None, description="The title of the work.") - type: Optional[str] = Field(default=None, description="The work type.") - language: Optional[str] = Field(default=None, description="The work language.") - publication_year: Optional[int] = Field(default=None, description="The publication year.") - cited_by_count: int = Field(default=0, description="The number of citations.") - topics: List[str] = Field(default_factory=list, description="The display names of the work topics.") - - -class WorkPage(BaseModel): - elements: List[WorkSummary] = Field(default_factory=list, description="The works on this page.") - 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 82665c20..f86836e2 100644 --- a/service/src/main/inse/works/service.py +++ b/service/src/main/inse/works/service.py @@ -12,7 +12,8 @@ from fastapi import Query from .. import security from . import logic -from . import model +from inse.models.work_page import WorkPage +from inse.models.works_list_response import WorksListResponse router = APIRouter(prefix="/authors", tags=["Works"]) @@ -20,7 +21,7 @@ router = APIRouter(prefix="/authors", tags=["Works"]) @router.get("/{author_id}/works", operation_id="getAuthorWorks", - response_model=model.WorkPage, + response_model=WorkPage, summary="Returns a page of works for an author.") async def get_author_works( author_id: Annotated[str, Path(description="The author id, for example A5023888391.")], @@ -43,7 +44,7 @@ async def get_author_works( @router.get("/{author_id}/works/all", operation_id="getAllAuthorWorks", - response_model=model.WorkList, + response_model=WorksListResponse, 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.")], diff --git a/service/src/main/inse/works/test_openalex_logic.py b/service/src/main/inse/works/test_openalex_logic.py index 70c6ae6e..711061b2 100644 --- a/service/src/main/inse/works/test_openalex_logic.py +++ b/service/src/main/inse/works/test_openalex_logic.py @@ -75,7 +75,7 @@ async def test_get_author_works_maps_elasticsearch_response_to_work_page(): assert page.elements[0].language == "en" assert page.elements[0].publication_year == 2023 assert page.elements[0].cited_by_count == 42 - assert page.elements[0].topics == ["Machine learning"] + assert page.elements[0].topics[0].display_name == "Machine learning" @pytest.mark.anyio @@ -136,13 +136,13 @@ async def test_get_all_author_works_collects_all_pages(): 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" + assert works.meta.count == 2 + assert [work.title for work in works.results] == ["Example work 1", "Example work 2"] + assert works.results[0].id == "https://openalex.org/W1" + assert works.results[0].display_name == "Example work 1" + assert str(works.results[0].publication_date) == "2024-01-01" + assert works.results[0].primary_location.is_oa is True + assert works.results[0].authorships[0].author.id == "https://openalex.org/A5023888391" @pytest.mark.anyio diff --git a/service/src/main/inse/works/test_service.py b/service/src/main/inse/works/test_service.py index 458c337c..1543c8b4 100644 --- a/service/src/main/inse/works/test_service.py +++ b/service/src/main/inse/works/test_service.py @@ -2,7 +2,11 @@ from fastapi.testclient import TestClient from inse import config from inse.works import logic -from inse.works import model +from inse.models.work import Work +from inse.models.work_page import WorkPage +from inse.models.works_list_response import WorksListResponse +from inse.models.meta import Meta +from inse.models.work_topic import WorkTopic from inse.main import app @@ -26,21 +30,29 @@ def test_get_author_works_returns_page(monkeypatch): assert publication_year == [2023, 2024] assert work_type == ["article"] assert language == ["en"] - return model.WorkPage( + + offset = (page - 1) * size + return WorkPage( elements=[ - model.WorkSummary( + Work( doi="https://doi.org/10.7717/peerj.4375", title="Example work", type="article", language="en", publication_year=2023, cited_by_count=42, - topics=["Machine learning"], + topics=[ + WorkTopic( + id="https://openalex.org/T10102", + display_name="Machine learning", + ) + ], ) ], - page=page, + offset=offset, size=size, total=1, + last_page=True, ) monkeypatch.setattr(logic, "get_author_works", fake_get_author_works) @@ -52,18 +64,16 @@ def test_get_author_works_returns_page(monkeypatch): assert response.status_code == 200 data = response.json() - assert data["page"] == 2 + assert data["offset"] == 5 assert data["size"] == 5 assert data["total"] == 1 - assert data["elements"][0] == { - "doi": "https://doi.org/10.7717/peerj.4375", - "title": "Example work", - "type": "article", - "language": "en", - "publication_year": 2023, - "cited_by_count": 42, - "topics": ["Machine learning"], - } + assert data["elements"][0]["doi"] == "https://doi.org/10.7717/peerj.4375" + assert data["elements"][0]["title"] == "Example work" + assert data["elements"][0]["type"] == "article" + assert data["elements"][0]["language"] == "en" + assert data["elements"][0]["publication_year"] == 2023 + assert data["elements"][0]["cited_by_count"] == 42 + assert data["elements"][0]["topics"][0]["display_name"] == "Machine learning" def test_get_all_author_works_returns_list(monkeypatch): @@ -73,9 +83,9 @@ def test_get_all_author_works_returns_list(monkeypatch): author_id: str, ): assert author_id == "A5023888391" - return model.WorkList( - elements=[ - model.Work( + return WorksListResponse( + results=[ + Work( id="https://openalex.org/W2741809807", doi="https://doi.org/10.7717/peerj.4375", title="Example work", @@ -85,14 +95,14 @@ def test_get_all_author_works_returns_list(monkeypatch): publication_year=2023, cited_by_count=42, topics=[ - model.Topic( + WorkTopic( id="https://openalex.org/T10102", display_name="Machine learning", ) ], ) ], - total=1, + meta=Meta(count=1), ) monkeypatch.setattr(logic, "get_all_author_works", fake_get_all_author_works) @@ -101,8 +111,8 @@ def test_get_all_author_works_returns_list(monkeypatch): 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" + assert data["meta"]["count"] == 1 + assert data["results"][0]["id"] == "https://openalex.org/W2741809807" + assert data["results"][0]["title"] == "Example work" + assert data["results"][0]["display_name"] == "Example work" + assert data["results"][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 883e70e7..5546f4a0 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -15,40 +15,52 @@ configuration.ts encoder.ts git_push.sh index.ts -model/affiliation.ts +model/author-affiliations-inner.ts +model/author-counts-by-year-inner.ts +model/author-ids.ts +model/author-parsed-longest-name.ts +model/author-summary-stats.ts model/author.ts +model/authors-list-response.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/cost-usd.ts +model/dehydrated-author.ts +model/dehydrated-funder.ts +model/dehydrated-institution.ts +model/dehydrated-source.ts +model/fwci.ts +model/group-by-result.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/meta.ts +model/model2-yr-mean-citedness.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/score.ts model/validation-error-loc-inner.ts model/validation-error.ts +model/value.ts +model/work-biblio.ts +model/work-citation-normalized-percentile.ts +model/work-cited-by-percentile-year.ts +model/work-counts-by-year-inner.ts +model/work-has-content.ts model/work-ids.ts -model/work-list.ts +model/work-keyword.ts +model/work-mesh-inner.ts model/work-page.ts -model/work-summary.ts +model/work-sustainable-development-goals-inner.ts +model/work-topic-domain.ts +model/work-topic-field.ts +model/work-topic-subfield.ts +model/work-topic.ts model/work.ts +model/works-list-response.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 cd7c95f2..92865f67 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -16,12 +16,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; +// @ts-ignore +import { AuthorsListResponse } from '../model/authors-list-response'; // @ts-ignore import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore import { PersonBio } from '../model/person-bio'; -// @ts-ignore -import { PersonSearchResult } from '../model/person-search-result'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -111,9 +111,9 @@ export class PersonsOpenApiService extends BaseService implements PersonsOpenApi * @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, 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?: '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}); @@ -151,7 +151,7 @@ export class PersonsOpenApiService extends BaseService implements PersonsOpenApi let localVarPath = `/persons/search`; const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, diff --git a/webapp/src/app/api/api/persons.serviceInterface.ts b/webapp/src/app/api/api/persons.serviceInterface.ts index 697a21aa..3a899295 100644 --- a/webapp/src/app/api/api/persons.serviceInterface.ts +++ b/webapp/src/app/api/api/persons.serviceInterface.ts @@ -11,9 +11,9 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; +import { AuthorsListResponse } from '../model/models'; import { HTTPValidationError } from '../model/models'; import { PersonBio } from '../model/models'; -import { PersonSearchResult } from '../model/models'; import { Configuration } from '../configuration'; @@ -40,6 +40,6 @@ export interface PersonsOpenApiServiceInterface { * @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, include?: 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 14755026..b1a0a152 100644 --- a/webapp/src/app/api/api/works.service.ts +++ b/webapp/src/app/api/api/works.service.ts @@ -19,9 +19,9 @@ 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 +import { WorksListResponse } from '../model/works-list-response'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -49,9 +49,9 @@ export class WorksOpenApiService extends BaseService implements WorksOpenApiServ * @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?: '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.'); @@ -87,7 +87,7 @@ export class WorksOpenApiService extends BaseService implements WorksOpenApiServ 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}`, + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, diff --git a/webapp/src/app/api/api/works.serviceInterface.ts b/webapp/src/app/api/api/works.serviceInterface.ts index ebf418ac..5622ac20 100644 --- a/webapp/src/app/api/api/works.serviceInterface.ts +++ b/webapp/src/app/api/api/works.serviceInterface.ts @@ -12,8 +12,8 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; import { HTTPValidationError } from '../model/models'; -import { WorkList } from '../model/models'; import { WorkPage } from '../model/models'; +import { WorksListResponse } from '../model/models'; import { Configuration } from '../configuration'; @@ -30,7 +30,7 @@ export interface WorksOpenApiServiceInterface { * @endpoint get /authors/{author_id}/works/all * @param authorId The author id, for example A5023888391. */ - getAllAuthorWorks(authorId: string, extraHttpRequestParams?: any): Observable; + getAllAuthorWorks(authorId: string, extraHttpRequestParams?: any): Observable; /** * Returns a page of works for an author. diff --git a/webapp/src/app/api/model/author-affiliations-inner.ts b/webapp/src/app/api/model/author-affiliations-inner.ts new file mode 100644 index 00000000..003f4cf7 --- /dev/null +++ b/webapp/src/app/api/model/author-affiliations-inner.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. + */ +import { DehydratedInstitution } from './dehydrated-institution'; + + +/** + * AuthorAffiliationsInner + */ +export interface AuthorAffiliationsInner { + institution?: DehydratedInstitution | null; + years?: Array | null; +} + diff --git a/webapp/src/app/api/model/author-counts-by-year-inner.ts b/webapp/src/app/api/model/author-counts-by-year-inner.ts new file mode 100644 index 00000000..5368c79d --- /dev/null +++ b/webapp/src/app/api/model/author-counts-by-year-inner.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. + */ + + +/** + * AuthorCountsByYearInner + */ +export interface AuthorCountsByYearInner { + year?: number | null; + works_count?: number | null; + cited_by_count?: number | null; +} + diff --git a/webapp/src/app/api/model/author-ids.ts b/webapp/src/app/api/model/author-ids.ts new file mode 100644 index 00000000..82726e12 --- /dev/null +++ b/webapp/src/app/api/model/author-ids.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. + */ + + +/** + * External identifiers: + */ +export interface AuthorIds { + openalex?: string | null; + orcid?: string | null; + scopus?: string | null; +} + diff --git a/webapp/src/app/api/model/author-parsed-longest-name.ts b/webapp/src/app/api/model/author-parsed-longest-name.ts new file mode 100644 index 00000000..438eb665 --- /dev/null +++ b/webapp/src/app/api/model/author-parsed-longest-name.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. + */ + + +/** + * The longest name parsed into its component parts. + */ +export interface AuthorParsedLongestName { + first?: string | null; + middle?: string | null; + last?: string | null; + suffix?: string | null; + nickname?: string | null; +} + diff --git a/webapp/src/app/api/model/author-summary-stats.ts b/webapp/src/app/api/model/author-summary-stats.ts new file mode 100644 index 00000000..2817c816 --- /dev/null +++ b/webapp/src/app/api/model/author-summary-stats.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. + */ +import { Model2YrMeanCitedness } from './model2-yr-mean-citedness'; + + +/** + * Citation metrics: + */ +export interface AuthorSummaryStats { + '2yr_mean_citedness'?: Model2YrMeanCitedness | null; + h_index?: number | null; + i10_index?: number | null; +} + diff --git a/webapp/src/app/api/model/author-topics-inner.ts b/webapp/src/app/api/model/author-topics-inner.ts new file mode 100644 index 00000000..10ab7fbb --- /dev/null +++ b/webapp/src/app/api/model/author-topics-inner.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. + */ + + +/** + * AuthorTopicsInner + */ +export interface AuthorTopicsInner { + id?: string | null; + display_name?: string | null; + count?: number | null; +} + diff --git a/webapp/src/app/api/model/author.ts b/webapp/src/app/api/model/author.ts index d7b9c008..6df6beb6 100644 --- a/webapp/src/app/api/model/author.ts +++ b/webapp/src/app/api/model/author.ts @@ -7,14 +7,35 @@ * https://openapi-generator.tech * Do not edit the class manually. */ +import { AuthorAffiliationsInner } from './author-affiliations-inner'; +import { AuthorParsedLongestName } from './author-parsed-longest-name'; +import { DehydratedInstitution } from './dehydrated-institution'; +import { AuthorCountsByYearInner } from './author-counts-by-year-inner'; +import { AuthorIds } from './author-ids'; +import { AuthorSummaryStats } from './author-summary-stats'; +import { WorkTopic } from './work-topic'; +/** + * A person who creates scholarly works + */ export interface Author { - [key: string]: any | any; - - id?: string | null; - display_name?: string | null; orcid?: string | null; + display_name?: string | null; + display_name_alternatives?: Array | null; + longest_name?: string | null; + parsed_longest_name?: AuthorParsedLongestName | null; + works_count?: number | null; + cited_by_count?: number | null; + summary_stats?: AuthorSummaryStats | null; + affiliations?: Array | null; + last_known_institutions?: Array | null; + topics?: Array | null; + counts_by_year?: Array | null; + ids?: AuthorIds | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } diff --git a/webapp/src/app/api/model/authors-list-response.ts b/webapp/src/app/api/model/authors-list-response.ts new file mode 100644 index 00000000..3b0661d3 --- /dev/null +++ b/webapp/src/app/api/model/authors-list-response.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 { Meta } from './meta'; +import { Author } from './author'; +import { GroupByResult } from './group-by-result'; + + +/** + * AuthorsListResponse + */ +export interface AuthorsListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; +} + diff --git a/webapp/src/app/api/model/authorship.ts b/webapp/src/app/api/model/authorship.ts index a570a4c1..22cf8bc7 100644 --- a/webapp/src/app/api/model/authorship.ts +++ b/webapp/src/app/api/model/authorship.ts @@ -7,28 +7,20 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { Author } from './author'; -import { Institution } from './institution'; +import { DehydratedInstitution } from './dehydrated-institution'; +import { DehydratedAuthor } from './dehydrated-author'; +/** + * Author and their affiliation for a work + */ export interface Authorship { - [key: string]: any | any; - - - author?: Author | null; - /** - * The author\'s institutions. - */ - institutions?: Array; - /** - * The author\'s countries. - */ - countries?: Array; + author_position?: string | null; + author?: DehydratedAuthor | null; + institutions?: Array | null; + countries?: Array | null; is_corresponding?: boolean | null; raw_author_name?: string | null; - /** - * The raw affiliation strings. - */ - raw_affiliation_strings?: Array; + raw_affiliation_strings?: Array | null; } diff --git a/webapp/src/app/api/model/award.ts b/webapp/src/app/api/model/award.ts index d7fa6ea9..0bf6f536 100644 --- a/webapp/src/app/api/model/award.ts +++ b/webapp/src/app/api/model/award.ts @@ -9,10 +9,10 @@ */ +/** + * Award + */ export interface Award { - [key: string]: any | any; - - id?: string | null; display_name?: string | null; funder_award_id?: string | null; diff --git a/webapp/src/app/api/model/cost-usd.ts b/webapp/src/app/api/model/cost-usd.ts new file mode 100644 index 00000000..c84dc651 --- /dev/null +++ b/webapp/src/app/api/model/cost-usd.ts @@ -0,0 +1,17 @@ +/** + * 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. + */ + + +/** + * Cost of this request in USD + */ +export interface CostUsd { +} + diff --git a/webapp/src/app/api/model/dehydrated-author.ts b/webapp/src/app/api/model/dehydrated-author.ts new file mode 100644 index 00000000..bd456cf7 --- /dev/null +++ b/webapp/src/app/api/model/dehydrated-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. + */ + + +/** + * [Dehydrated Author](/api-reference/authors#the-dehydratedauthor-object) — reduced-field version used in nested contexts + */ +export interface DehydratedAuthor { + id?: string | null; + display_name?: string | null; + orcid?: string | null; +} + diff --git a/webapp/src/app/api/model/dehydrated-funder.ts b/webapp/src/app/api/model/dehydrated-funder.ts new file mode 100644 index 00000000..00bac749 --- /dev/null +++ b/webapp/src/app/api/model/dehydrated-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. + */ + + +/** + * [Dehydrated Funder](/api-reference/funders) — reduced-field version used in nested contexts + */ +export interface DehydratedFunder { + id?: string | null; + display_name?: string | null; + ror?: string | null; +} + diff --git a/webapp/src/app/api/model/dehydrated-institution.ts b/webapp/src/app/api/model/dehydrated-institution.ts new file mode 100644 index 00000000..056d348f --- /dev/null +++ b/webapp/src/app/api/model/dehydrated-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. + */ + + +/** + * [Dehydrated Institution](/api-reference/institutions#the-dehydratedinstitution-object) — reduced-field version used in nested contexts + */ +export interface DehydratedInstitution { + 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/dehydrated-source.ts b/webapp/src/app/api/model/dehydrated-source.ts new file mode 100644 index 00000000..b660461e --- /dev/null +++ b/webapp/src/app/api/model/dehydrated-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. + */ + + +/** + * [Dehydrated Source](/api-reference/sources#the-dehydratedsource-object) — reduced-field version used in nested contexts + */ +export interface DehydratedSource { + 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/fwci.ts b/webapp/src/app/api/model/fwci.ts new file mode 100644 index 00000000..92f3f5ba --- /dev/null +++ b/webapp/src/app/api/model/fwci.ts @@ -0,0 +1,17 @@ +/** + * 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. + */ + + +/** + * Field-weighted Citation Impact, calculated as citations received / citations expected. + */ +export interface Fwci { +} + diff --git a/webapp/src/app/api/model/group-by-result.ts b/webapp/src/app/api/model/group-by-result.ts new file mode 100644 index 00000000..bff2f505 --- /dev/null +++ b/webapp/src/app/api/model/group-by-result.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. + */ + + +/** + * GroupByResult + */ +export interface GroupByResult { + key?: string | null; + key_display_name?: string | null; + count?: number | null; +} + diff --git a/webapp/src/app/api/model/location.ts b/webapp/src/app/api/model/location.ts index 2daba568..61ae600d 100644 --- a/webapp/src/app/api/model/location.ts +++ b/webapp/src/app/api/model/location.ts @@ -7,19 +7,20 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { Source } from './source'; +import { DehydratedSource } from './dehydrated-source'; +/** + * Where a work is hosted + */ export interface Location { - [key: string]: any | any; - - is_oa?: boolean | null; landing_page_url?: string | null; pdf_url?: string | null; - source?: Source | null; + source?: DehydratedSource | null; license?: string | null; license_id?: string | null; + version?: string | null; is_accepted?: boolean | null; is_published?: boolean | null; } diff --git a/webapp/src/app/api/model/meta.ts b/webapp/src/app/api/model/meta.ts new file mode 100644 index 00000000..55c05652 --- /dev/null +++ b/webapp/src/app/api/model/meta.ts @@ -0,0 +1,25 @@ +/** + * 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 { CostUsd } from './cost-usd'; + + +/** + * Metadata about the query results + */ +export interface Meta { + count?: number | null; + db_response_time_ms?: number | null; + page?: number | null; + per_page?: number | null; + next_cursor?: string | null; + groups_count?: number | null; + cost_usd?: CostUsd | null; +} + diff --git a/webapp/src/app/api/model/model2-yr-mean-citedness.ts b/webapp/src/app/api/model/model2-yr-mean-citedness.ts new file mode 100644 index 00000000..938cc10e --- /dev/null +++ b/webapp/src/app/api/model/model2-yr-mean-citedness.ts @@ -0,0 +1,14 @@ +/** + * 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 Model2YrMeanCitedness { +} + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index c415b90e..fcd9018e 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -1,33 +1,45 @@ -export * from './affiliation'; export * from './author'; +export * from './author-affiliations-inner'; +export * from './author-counts-by-year-inner'; +export * from './author-ids'; +export * from './author-parsed-longest-name'; +export * from './author-summary-stats'; +export * from './authors-list-response'; 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 './cost-usd'; +export * from './dehydrated-author'; +export * from './dehydrated-funder'; +export * from './dehydrated-institution'; +export * from './dehydrated-source'; +export * from './fwci'; +export * from './group-by-result'; 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 './meta'; +export * from './model2-yr-mean-citedness'; 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 './score'; export * from './validation-error'; export * from './validation-error-loc-inner'; +export * from './value'; export * from './work'; +export * from './work-biblio'; +export * from './work-citation-normalized-percentile'; +export * from './work-cited-by-percentile-year'; +export * from './work-counts-by-year-inner'; +export * from './work-has-content'; export * from './work-ids'; -export * from './work-list'; +export * from './work-keyword'; +export * from './work-mesh-inner'; export * from './work-page'; -export * from './work-summary'; +export * from './work-sustainable-development-goals-inner'; +export * from './work-topic'; +export * from './work-topic-domain'; +export * from './work-topic-field'; +export * from './work-topic-subfield'; +export * from './works-list-response'; diff --git a/webapp/src/app/api/model/open-access.ts b/webapp/src/app/api/model/open-access.ts index 0deef04a..1228cfab 100644 --- a/webapp/src/app/api/model/open-access.ts +++ b/webapp/src/app/api/model/open-access.ts @@ -9,11 +9,12 @@ */ +/** + * Open access information + */ export interface OpenAccess { - [key: string]: any | any; - - is_oa?: boolean | null; + oa_status?: string | null; oa_url?: string | null; any_repository_has_fulltext?: boolean | null; } diff --git a/webapp/src/app/api/model/score.ts b/webapp/src/app/api/model/score.ts new file mode 100644 index 00000000..434ec042 --- /dev/null +++ b/webapp/src/app/api/model/score.ts @@ -0,0 +1,14 @@ +/** + * 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 Score { +} + diff --git a/webapp/src/app/api/model/topic-domain.ts b/webapp/src/app/api/model/topic-domain.ts new file mode 100644 index 00000000..14fe5387 --- /dev/null +++ b/webapp/src/app/api/model/topic-domain.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. + */ + + +/** + * The domain (highest level) containing this topic: + */ +export interface TopicDomain { + id?: string | null; + display_name?: string | null; +} + diff --git a/webapp/src/app/api/model/topic-field.ts b/webapp/src/app/api/model/topic-field.ts new file mode 100644 index 00000000..3fa4cc7a --- /dev/null +++ b/webapp/src/app/api/model/topic-field.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. + */ + + +/** + * The field (second level) containing this topic: + */ +export interface TopicField { + id?: string | null; + display_name?: string | null; +} + diff --git a/webapp/src/app/api/model/topic-ids.ts b/webapp/src/app/api/model/topic-ids.ts new file mode 100644 index 00000000..2397f625 --- /dev/null +++ b/webapp/src/app/api/model/topic-ids.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. + */ + + +/** + * External identifiers: + */ +export interface TopicIds { + openalex?: string | null; + wikipedia?: string | null; +} + diff --git a/webapp/src/app/api/model/topic-subfield.ts b/webapp/src/app/api/model/topic-subfield.ts new file mode 100644 index 00000000..f2d53a84 --- /dev/null +++ b/webapp/src/app/api/model/topic-subfield.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. + */ + + +/** + * The subfield (third level) containing this topic: + */ +export interface TopicSubfield { + 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 index 9a8513f4..22bcc6b8 100644 --- a/webapp/src/app/api/model/topic.ts +++ b/webapp/src/app/api/model/topic.ts @@ -7,18 +7,28 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { TopicLevel } from './topic-level'; +import { TopicDomain } from './topic-domain'; +import { TopicIds } from './topic-ids'; +import { TopicSubfield } from './topic-subfield'; +import { TopicField } from './topic-field'; +/** + * A research topic automatically assigned to works + */ 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; + description?: string | null; + keywords?: Array | null; + subfield?: TopicSubfield | null; + field?: TopicField | null; + domain?: TopicDomain | null; + works_count?: number | null; + cited_by_count?: number | null; + ids?: TopicIds | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } diff --git a/webapp/src/app/api/model/value.ts b/webapp/src/app/api/model/value.ts new file mode 100644 index 00000000..9a631ebb --- /dev/null +++ b/webapp/src/app/api/model/value.ts @@ -0,0 +1,14 @@ +/** + * 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 Value { +} + diff --git a/webapp/src/app/api/model/work-biblio.ts b/webapp/src/app/api/model/work-biblio.ts new file mode 100644 index 00000000..ba9738b4 --- /dev/null +++ b/webapp/src/app/api/model/work-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. + */ + + +/** + * Bibliographic info: `volume`, `issue`, `first_page`, `last_page`. + */ +export interface WorkBiblio { + volume?: string | null; + issue?: string | null; + first_page?: string | null; + last_page?: string | null; +} + diff --git a/webapp/src/app/api/model/work-citation-normalized-percentile.ts b/webapp/src/app/api/model/work-citation-normalized-percentile.ts new file mode 100644 index 00000000..aea594e2 --- /dev/null +++ b/webapp/src/app/api/model/work-citation-normalized-percentile.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. + */ +import { Value } from './value'; + + +/** + * Percentile of citation count normalized by work type, year, and subfield. Includes `value`, `is_in_top_1_percent`, `is_in_top_10_percent`. + */ +export interface WorkCitationNormalizedPercentile { + value?: Value | null; + is_in_top_1_percent?: boolean | null; + is_in_top_10_percent?: boolean | null; +} + diff --git a/webapp/src/app/api/model/work-cited-by-percentile-year.ts b/webapp/src/app/api/model/work-cited-by-percentile-year.ts new file mode 100644 index 00000000..3abf8bb7 --- /dev/null +++ b/webapp/src/app/api/model/work-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. + */ + + +/** + * Percentile rank compared to other works published in the same year. Contains `min` and `max`. + */ +export interface WorkCitedByPercentileYear { + min?: number | null; + max?: number | null; +} + diff --git a/webapp/src/app/api/model/work-counts-by-year-inner.ts b/webapp/src/app/api/model/work-counts-by-year-inner.ts new file mode 100644 index 00000000..b1499145 --- /dev/null +++ b/webapp/src/app/api/model/work-counts-by-year-inner.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. + */ + + +/** + * WorkCountsByYearInner + */ +export interface WorkCountsByYearInner { + year?: number | null; + cited_by_count?: number | null; +} + diff --git a/webapp/src/app/api/model/work-has-content.ts b/webapp/src/app/api/model/work-has-content.ts new file mode 100644 index 00000000..ea03940a --- /dev/null +++ b/webapp/src/app/api/model/work-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. + */ + + +/** + * Information about downloadable full-text content: + */ +export interface WorkHasContent { + pdf?: boolean | null; + grobid_xml?: boolean | null; +} + diff --git a/webapp/src/app/api/model/work-ids.ts b/webapp/src/app/api/model/work-ids.ts index 3c5fba70..383d1e47 100644 --- a/webapp/src/app/api/model/work-ids.ts +++ b/webapp/src/app/api/model/work-ids.ts @@ -9,10 +9,10 @@ */ +/** + * External identifiers: `openalex`, `doi`, `mag`, `pmid`, `pmcid`. + */ export interface WorkIds { - [key: string]: any | any; - - openalex?: string | null; doi?: string | null; mag?: number | null; diff --git a/webapp/src/app/api/model/work-keyword.ts b/webapp/src/app/api/model/work-keyword.ts new file mode 100644 index 00000000..7318fee9 --- /dev/null +++ b/webapp/src/app/api/model/work-keyword.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. + */ +import { Score } from './score'; + + +/** + * WorkKeyword + */ +export interface WorkKeyword { + id?: string | null; + display_name?: string | null; + score?: Score | null; +} + diff --git a/webapp/src/app/api/model/work-mesh-inner.ts b/webapp/src/app/api/model/work-mesh-inner.ts new file mode 100644 index 00000000..fe60a544 --- /dev/null +++ b/webapp/src/app/api/model/work-mesh-inner.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. + */ + + +/** + * WorkMeshInner + */ +export interface WorkMeshInner { + 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/work-page.ts b/webapp/src/app/api/model/work-page.ts index a9073803..d6ebb3b0 100644 --- a/webapp/src/app/api/model/work-page.ts +++ b/webapp/src/app/api/model/work-page.ts @@ -7,25 +7,29 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { WorkSummary } from './work-summary'; +import { Work } from './work'; export interface WorkPage { /** - * The works on this page. + * Total number of works matching the query */ - elements?: Array; + total: number; /** - * The current page number. + * List of works on the current page */ - page?: number; + elements: Array; /** - * The requested page size. + * Offset of the current page */ - size?: number; + offset: number; /** - * The total number of works. + * Size of the current page */ - total?: number; + size: number; + /** + * Indicates if the current page is the last page + */ + last_page: boolean; } diff --git a/webapp/src/app/api/model/work-sustainable-development-goals-inner.ts b/webapp/src/app/api/model/work-sustainable-development-goals-inner.ts new file mode 100644 index 00000000..0675868c --- /dev/null +++ b/webapp/src/app/api/model/work-sustainable-development-goals-inner.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. + */ +import { Score } from './score'; + + +/** + * WorkSustainableDevelopmentGoalsInner + */ +export interface WorkSustainableDevelopmentGoalsInner { + id?: string | null; + display_name?: string | null; + score?: Score | null; +} + diff --git a/webapp/src/app/api/model/work-topic-domain.ts b/webapp/src/app/api/model/work-topic-domain.ts new file mode 100644 index 00000000..3780d292 --- /dev/null +++ b/webapp/src/app/api/model/work-topic-domain.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. + */ + + +/** + * The parent [domain](/api-reference/domains) + */ +export interface WorkTopicDomain { + id?: string | null; + display_name?: string | null; +} + diff --git a/webapp/src/app/api/model/work-topic-field.ts b/webapp/src/app/api/model/work-topic-field.ts new file mode 100644 index 00000000..162c6363 --- /dev/null +++ b/webapp/src/app/api/model/work-topic-field.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. + */ + + +/** + * The parent [field](/api-reference/fields) + */ +export interface WorkTopicField { + id?: string | null; + display_name?: string | null; +} + diff --git a/webapp/src/app/api/model/work-topic-subfield.ts b/webapp/src/app/api/model/work-topic-subfield.ts new file mode 100644 index 00000000..71b90a6c --- /dev/null +++ b/webapp/src/app/api/model/work-topic-subfield.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. + */ + + +/** + * The parent [subfield](/api-reference/subfields) + */ +export interface WorkTopicSubfield { + id?: string | null; + display_name?: string | null; +} + diff --git a/webapp/src/app/api/model/work-topic.ts b/webapp/src/app/api/model/work-topic.ts new file mode 100644 index 00000000..339c739d --- /dev/null +++ b/webapp/src/app/api/model/work-topic.ts @@ -0,0 +1,27 @@ +/** + * 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 { Score } from './score'; +import { WorkTopicDomain } from './work-topic-domain'; +import { WorkTopicSubfield } from './work-topic-subfield'; +import { WorkTopicField } from './work-topic-field'; + + +/** + * WorkTopic + */ +export interface WorkTopic { + id?: string | null; + display_name?: string | null; + score?: Score | null; + subfield?: WorkTopicSubfield | null; + field?: WorkTopicField | null; + domain?: WorkTopicDomain | null; +} + diff --git a/webapp/src/app/api/model/work.ts b/webapp/src/app/api/model/work.ts index bebbc0c6..68251bd9 100644 --- a/webapp/src/app/api/model/work.ts +++ b/webapp/src/app/api/model/work.ts @@ -7,31 +7,29 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { Biblio } from './biblio'; -import { CountByYear } from './count-by-year'; +import { DehydratedFunder } from './dehydrated-funder'; 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 { WorkSustainableDevelopmentGoalsInner } from './work-sustainable-development-goals-inner'; +import { WorkTopic } from './work-topic'; +import { WorkCountsByYearInner } from './work-counts-by-year-inner'; +import { WorkKeyword } from './work-keyword'; +import { WorkCitationNormalizedPercentile } from './work-citation-normalized-percentile'; import { Award } from './award'; -import { CitationNormalizedPercentile } from './citation-normalized-percentile'; -import { Topic } from './topic'; -import { CitedByPercentileYear } from './cited-by-percentile-year'; +import { Fwci } from './fwci'; +import { WorkMeshInner } from './work-mesh-inner'; +import { WorkCitedByPercentileYear } from './work-cited-by-percentile-year'; +import { WorkHasContent } from './work-has-content'; import { Location } from './location'; +import { WorkBiblio } from './work-biblio'; +/** + * A scholarly document (article, book, dataset, thesis, etc.) + */ export interface Work { - [key: string]: any | any; - - - /** - * The external id of the work. - */ - id: string; + id?: string | null; doi?: string | null; title?: string | null; display_name?: string | null; @@ -39,78 +37,33 @@ export interface Work { publication_date?: string | null; type?: string | null; language?: string | null; - /** - * The number of citations. - */ - cited_by_count?: number; + cited_by_count?: number | null; is_retracted?: boolean | null; is_paratext?: boolean | null; primary_location?: Location | null; - /** - * The work locations. - */ - locations?: Array; + locations?: Array | null; best_oa_location?: Location | null; open_access?: OpenAccess | null; - /** - * The authorships. - */ - authorships?: Array; + authorships?: Array | null; 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; + biblio?: WorkBiblio | null; + abstract_inverted_index?: object | null; + referenced_works?: Array | null; + referenced_works_count?: number | null; + related_works?: Array | null; + topics?: Array | null; + primary_topic?: WorkTopic | null; + keywords?: Array | null; + funders?: Array | null; + awards?: Array | null; + fwci?: Fwci | null; + citation_normalized_percentile?: WorkCitationNormalizedPercentile | null; + cited_by_percentile_year?: WorkCitedByPercentileYear | null; + counts_by_year?: Array | null; + sustainable_development_goals?: Array | null; + mesh?: Array | null; + indexed_in?: Array | null; + has_content?: WorkHasContent | null; content_url?: string | null; created_date?: string | null; updated_date?: string | null; diff --git a/webapp/src/app/api/model/works-list-response.ts b/webapp/src/app/api/model/works-list-response.ts new file mode 100644 index 00000000..6d6ced7f --- /dev/null +++ b/webapp/src/app/api/model/works-list-response.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 { Meta } from './meta'; +import { Work } from './work'; +import { GroupByResult } from './group-by-result'; + + +/** + * WorksListResponse + */ +export interface WorksListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; +} + diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.ts b/webapp/src/app/modules/person-interesting/person-interesting.component.ts index 763f810b..1f7c1966 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.ts +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.ts @@ -1,6 +1,6 @@ import { Component, input, computed } from '@angular/core'; -import { Topic } from '../../api'; +import { WorkTopic } from '../../api'; interface InterestTag { label: string; @@ -14,7 +14,7 @@ interface InterestTag { styleUrl: './person-interesting.component.scss', }) export class PersonInterestingComponent { - readonly topics = input(null); + readonly topics = input(null); readonly tags = computed(() => { const topicsList = this.topics() ?? []; @@ -24,7 +24,7 @@ export class PersonInterestingComponent { const label = (topic.subfield?.display_name ?? '').trim(); if (!label) continue; - const score = typeof topic.score === 'number' ? topic.score : 0; + const score = typeof topic.score === 'number' ? (topic.score as number) : 0; grouped.set(label, (grouped.get(label) ?? 0) + score); } diff --git a/webapp/src/app/modules/person-publications/person-publications.component.html b/webapp/src/app/modules/person-publications/person-publications.component.html index a3e9a1e8..0570bd3c 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.html +++ b/webapp/src/app/modules/person-publications/person-publications.component.html @@ -93,9 +93,9 @@ Themen
- @for (topic of (publication.topics ?? []).slice(0, 3); track topic) { + @for (topic of (publication.topics ?? []).slice(0, 3); track topic.id) { - {{ topic }} + {{ topic.display_name }} } @empty { - 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 5256c2c0..828105bc 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.ts +++ b/webapp/src/app/modules/person-publications/person-publications.component.ts @@ -10,7 +10,7 @@ import { MatButtonModule } from '@angular/material/button'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatSelectModule } from '@angular/material/select'; -import { WorkSummary } from '../../api'; +import { Work } from '../../api'; import { PublicationsService } from '../../shared/services/publications.service'; import { PaginationService } from '../../shared/services/pagination.service'; import { createLoadError } from '../../shared/utils/errorHandler'; @@ -48,7 +48,7 @@ export class PersonPublicationsComponent implements OnInit { 'topics', 'citations', ]; - publications: WorkSummary[] = []; + publications: Work[] = []; total = 0; loading = false; authorId = ''; diff --git a/webapp/src/app/modules/person/person.component.html b/webapp/src/app/modules/person/person.component.html index 0378513a..310a0fe8 100644 --- a/webapp/src/app/modules/person/person.component.html +++ b/webapp/src/app/modules/person/person.component.html @@ -29,12 +29,14 @@ mail anna.becker@uni-due.de
+ @if (openAlexId()) {
person {{ openAlexId() }}
} + @if (orcid()) {
verified diff --git a/webapp/src/app/modules/person/person.component.ts b/webapp/src/app/modules/person/person.component.ts index f8f6ebe6..f69f429f 100644 --- a/webapp/src/app/modules/person/person.component.ts +++ b/webapp/src/app/modules/person/person.component.ts @@ -5,7 +5,7 @@ import { MatTabsModule } from '@angular/material/tabs'; import { ActivatedRoute, RouterModule, RouterOutlet } from '@angular/router'; import { Subscription, map, of, switchMap } from 'rxjs'; -import { Person, PersonsOpenApiService, Topic } from '../../api'; +import { Author, PersonsOpenApiService, WorkTopic } from '../../api'; import { PersonInterestingComponent } from '../person-interesting/person-interesting.component'; const PERSON_INCLUDE_TAGS = @@ -39,24 +39,24 @@ export class PersonComponent implements OnInit, OnDestroy { } return this.personsApi.searchPersons(id, undefined, PERSON_INCLUDE_TAGS).pipe( - map((result) => result.persons?.[0] ?? null), + map((result) => result.results?.[0] ?? null), ); }), ), { initialValue: null }, ); readonly displayName = computed( - () => this.person()?.name ?? 'Unbekannte Person', + () => this.person()?.display_name ?? 'Unbekannte Person', ); readonly initials = computed(() => this.buildInitials(this.displayName())); readonly primaryAffiliation = computed( () => this.person()?.affiliations?.[0] ?? null, ); readonly institution = computed( - () => this.primaryAffiliation()?.institution ?? 'Unbekannte Institution', + () => this.primaryAffiliation()?.institution?.display_name ?? 'Unbekannte Institution', ); readonly countryCode = computed( - () => this.primaryAffiliation()?.country_code ?? null, + () => this.primaryAffiliation()?.institution?.country_code ?? null, ); readonly worksCount = computed(() => this.person()?.works_count ?? null); readonly citedByCount = computed(() => this.person()?.cited_by_count ?? null); @@ -68,7 +68,7 @@ export class PersonComponent implements OnInit, OnDestroy { readonly openAlexId = computed(() => this.person()?.id ?? null); readonly topicsFull = computed( - () => (this.person()?.topics_full ?? []) as Topic[], + () => this.person()?.topics ?? [], ); links = [ diff --git a/webapp/src/app/shared/services/publications.service.ts b/webapp/src/app/shared/services/publications.service.ts index 3a782229..89878079 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 { WorkList, WorkPage, WorksOpenApiService } from '../../api'; +import { WorkPage, WorksOpenApiService } from '../../api'; export interface PublicationFilters { publicationYears?: number[]; -- 2.56.1