feature/keywords-analysis #230

Merged
genja merged 13 commits from feature/keywords-analysis into dev 2026-07-20 01:30:11 +02:00
59 changed files with 4337 additions and 2441 deletions
+4
View File
@@ -58,6 +58,8 @@ from inse.authors.v2.router import router as authors_v2_router
from inse.institutions.v2.router import router as institutions_v2_router
from inse.topics.v2.router import router as topics_v2_router
from inse.projects.dfg_institutions.router import router as dfg_institutions_router
from inse.projects.dfg_persons.router import router as dfg_persons_router
logger = logging.getLogger(__name__)
### startup
@@ -112,6 +114,8 @@ app.include_router(institutions_v2_router)
app.include_router(topics_v2_router)
app.include_router(dashboard_router)
app.include_router(dfg_institutions_router)
app.include_router(dfg_persons_router)
app.include_router(bookmarks_router)
app.add_middleware(
@@ -0,0 +1,157 @@
# coding: utf-8
"""
DFG Institutes API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from inse.models.projects_dfg_v2.institute.dfg_institute_institute import DFGInstituteInstitute
from inse.models.projects_dfg_v2.institute.dfg_institute_projects_inner import DFGInstituteProjectsInner
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class DFGInstitute(BaseModel):
"""
DFGInstitute
""" # noqa: E501
address_city: Optional[StrictStr] = None
address_country_de: Optional[StrictStr] = None
address_country_en: Optional[StrictStr] = None
address_hidden: Optional[StrictBool] = None
address_postal_code_city: Optional[StrictStr] = None
address_street: Optional[StrictStr] = None
aku_id: Optional[StrictInt] = None
fetched_at: Optional[datetime] = None
id: Optional[StrictInt] = None
institute: Optional[DFGInstituteInstitute] = None
institute_category_key: Optional[StrictStr] = None
institute_category_label_de: Optional[StrictStr] = None
institute_category_label_en: Optional[StrictStr] = None
institute_id: Optional[StrictInt] = None
institute_name_de: Optional[StrictStr] = None
institute_name_en: Optional[StrictStr] = None
institute_postal_address: Optional[StrictStr] = None
institute_type_key: Optional[StrictStr] = None
institute_type_label_de: Optional[StrictStr] = None
institute_type_label_en: Optional[StrictStr] = None
is_dissolved: Optional[StrictBool] = None
is_research_device: Optional[StrictBool] = None
link: Optional[StrictStr] = None
page_url: Optional[StrictStr] = None
project_types_order: Optional[StrictStr] = None
projects: Optional[List[DFGInstituteProjectsInner]] = None
root_id: Optional[StrictInt] = None
root_name_de: Optional[StrictStr] = None
root_name_en: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["address_city", "address_country_de", "address_country_en", "address_hidden", "address_postal_code_city", "address_street", "aku_id", "fetched_at", "id", "institute", "institute_category_key", "institute_category_label_de", "institute_category_label_en", "institute_id", "institute_name_de", "institute_name_en", "institute_postal_address", "institute_type_key", "institute_type_label_de", "institute_type_label_en", "is_dissolved", "is_research_device", "link", "page_url", "project_types_order", "projects", "root_id", "root_name_de", "root_name_en"]
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 DFGInstitute 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 institute
if self.institute:
_dict['institute'] = self.institute.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in projects (list)
_items = []
if self.projects:
for _item_projects in self.projects:
if _item_projects:
_items.append(_item_projects.to_dict())
_dict['projects'] = _items
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of DFGInstitute from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"address_city": obj.get("address_city"),
"address_country_de": obj.get("address_country_de"),
"address_country_en": obj.get("address_country_en"),
"address_hidden": obj.get("address_hidden"),
"address_postal_code_city": obj.get("address_postal_code_city"),
"address_street": obj.get("address_street"),
"aku_id": obj.get("aku_id"),
"fetched_at": obj.get("fetched_at"),
"id": obj.get("id"),
"institute": DFGInstituteInstitute.from_dict(obj["institute"]) if obj.get("institute") is not None else None,
"institute_category_key": obj.get("institute_category_key"),
"institute_category_label_de": obj.get("institute_category_label_de"),
"institute_category_label_en": obj.get("institute_category_label_en"),
"institute_id": obj.get("institute_id"),
"institute_name_de": obj.get("institute_name_de"),
"institute_name_en": obj.get("institute_name_en"),
"institute_postal_address": obj.get("institute_postal_address"),
"institute_type_key": obj.get("institute_type_key"),
"institute_type_label_de": obj.get("institute_type_label_de"),
"institute_type_label_en": obj.get("institute_type_label_en"),
"is_dissolved": obj.get("is_dissolved"),
"is_research_device": obj.get("is_research_device"),
"link": obj.get("link"),
"page_url": obj.get("page_url"),
"project_types_order": obj.get("project_types_order"),
"projects": [DFGInstituteProjectsInner.from_dict(_item) for _item in obj["projects"]] if obj.get("projects") is not None else None,
"root_id": obj.get("root_id"),
"root_name_de": obj.get("root_name_de"),
"root_name_en": obj.get("root_name_en")
})
return _obj
@@ -0,0 +1,130 @@
# coding: utf-8
"""
DFG Institutes API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, 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 DFGInstituteInstitute(BaseModel):
"""
DFGInstituteInstitute
""" # noqa: E501
address_city: Optional[StrictStr] = None
address_country_de: Optional[StrictStr] = None
address_country_en: Optional[StrictStr] = None
address_hidden: Optional[StrictBool] = None
address_postal_code_city: Optional[StrictStr] = None
address_street: Optional[StrictStr] = None
aku_id: Optional[StrictInt] = None
institute_category_key: Optional[StrictStr] = None
institute_category_label_de: Optional[StrictStr] = None
institute_category_label_en: Optional[StrictStr] = None
institute_id: Optional[StrictInt] = None
institute_name_de: Optional[StrictStr] = None
institute_name_en: Optional[StrictStr] = None
institute_postal_address: Optional[StrictStr] = None
institute_type_key: Optional[StrictStr] = None
institute_type_label_de: Optional[StrictStr] = None
institute_type_label_en: Optional[StrictStr] = None
is_dissolved: Optional[StrictBool] = None
is_research_device: Optional[StrictBool] = None
root_id: Optional[StrictInt] = None
root_name_de: Optional[StrictStr] = None
root_name_en: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["address_city", "address_country_de", "address_country_en", "address_hidden", "address_postal_code_city", "address_street", "aku_id", "institute_category_key", "institute_category_label_de", "institute_category_label_en", "institute_id", "institute_name_de", "institute_name_en", "institute_postal_address", "institute_type_key", "institute_type_label_de", "institute_type_label_en", "is_dissolved", "is_research_device", "root_id", "root_name_de", "root_name_en"]
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 DFGInstituteInstitute 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 DFGInstituteInstitute from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"address_city": obj.get("address_city"),
"address_country_de": obj.get("address_country_de"),
"address_country_en": obj.get("address_country_en"),
"address_hidden": obj.get("address_hidden"),
"address_postal_code_city": obj.get("address_postal_code_city"),
"address_street": obj.get("address_street"),
"aku_id": obj.get("aku_id"),
"institute_category_key": obj.get("institute_category_key"),
"institute_category_label_de": obj.get("institute_category_label_de"),
"institute_category_label_en": obj.get("institute_category_label_en"),
"institute_id": obj.get("institute_id"),
"institute_name_de": obj.get("institute_name_de"),
"institute_name_en": obj.get("institute_name_en"),
"institute_postal_address": obj.get("institute_postal_address"),
"institute_type_key": obj.get("institute_type_key"),
"institute_type_label_de": obj.get("institute_type_label_de"),
"institute_type_label_en": obj.get("institute_type_label_en"),
"is_dissolved": obj.get("is_dissolved"),
"is_research_device": obj.get("is_research_device"),
"root_id": obj.get("root_id"),
"root_name_de": obj.get("root_name_de"),
"root_name_en": obj.get("root_name_en")
})
return _obj
@@ -0,0 +1,120 @@
# coding: utf-8
"""
DFG Institutes API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, 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 DFGInstituteProjectsInner(BaseModel):
"""
DFGInstituteProjectsInner
""" # noqa: E501
funding_end: Optional[StrictInt] = None
funding_period_de: Optional[StrictStr] = None
funding_period_en: Optional[StrictStr] = None
funding_start: Optional[StrictInt] = None
funding_type_de: Optional[StrictStr] = None
funding_type_en: Optional[StrictStr] = None
funding_type_key: Optional[StrictStr] = None
funding_type_sort: Optional[StrictStr] = None
institute_ref_id: Optional[StrictInt] = None
is_transfer_project: Optional[StrictBool] = None
project_id: Optional[StrictInt] = None
sort_criteria: Optional[StrictStr] = None
sort_year: Optional[StrictStr] = None
status_de: Optional[StrictStr] = None
status_en: Optional[StrictStr] = None
title_de: Optional[StrictStr] = None
title_en: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["funding_end", "funding_period_de", "funding_period_en", "funding_start", "funding_type_de", "funding_type_en", "funding_type_key", "funding_type_sort", "institute_ref_id", "is_transfer_project", "project_id", "sort_criteria", "sort_year", "status_de", "status_en", "title_de", "title_en"]
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 DFGInstituteProjectsInner 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 DFGInstituteProjectsInner from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"funding_end": obj.get("funding_end"),
"funding_period_de": obj.get("funding_period_de"),
"funding_period_en": obj.get("funding_period_en"),
"funding_start": obj.get("funding_start"),
"funding_type_de": obj.get("funding_type_de"),
"funding_type_en": obj.get("funding_type_en"),
"funding_type_key": obj.get("funding_type_key"),
"funding_type_sort": obj.get("funding_type_sort"),
"institute_ref_id": obj.get("institute_ref_id"),
"is_transfer_project": obj.get("is_transfer_project"),
"project_id": obj.get("project_id"),
"sort_criteria": obj.get("sort_criteria"),
"sort_year": obj.get("sort_year"),
"status_de": obj.get("status_de"),
"status_en": obj.get("status_en"),
"title_de": obj.get("title_de"),
"title_en": obj.get("title_en")
})
return _obj
@@ -0,0 +1,159 @@
# coding: utf-8
"""
DFG Persons API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from inse.models.projects_dfg_v2.person.dfg_person_awards_inner import DFGPersonAwardsInner
from inse.models.projects_dfg_v2.person.dfg_person_person import DFGPersonPerson
from inse.models.projects_dfg_v2.person.dfg_person_projects_inner import DFGPersonProjectsInner
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class DFGPerson(BaseModel):
"""
DFGPerson
""" # noqa: E501
address_country_de: Optional[StrictStr] = None
address_country_en: Optional[StrictStr] = None
address_hidden: Optional[StrictBool] = None
address_postal_code_city: Optional[StrictStr] = None
address_street: Optional[StrictStr] = None
aku_id: Optional[StrictInt] = None
award_types_order: Optional[StrictStr] = None
awards: Optional[List[DFGPersonAwardsInner]] = None
fetched_at: Optional[datetime] = None
full_name: Optional[StrictStr] = None
id: Optional[StrictInt] = None
institute_id: Optional[StrictInt] = None
institute_name_de: Optional[StrictStr] = None
institute_name_en: Optional[StrictStr] = None
institute_postal_address: Optional[StrictStr] = None
is_deceased: Optional[StrictBool] = None
link: Optional[StrictStr] = None
orcid_id: Optional[StrictStr] = None
page_url: Optional[StrictStr] = None
person: Optional[DFGPersonPerson] = None
person_id: Optional[StrictInt] = None
project_types_order: Optional[StrictStr] = None
projects: Optional[List[DFGPersonProjectsInner]] = None
root_id: Optional[StrictInt] = None
root_name_de: Optional[StrictStr] = None
root_name_en: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["address_country_de", "address_country_en", "address_hidden", "address_postal_code_city", "address_street", "aku_id", "award_types_order", "awards", "fetched_at", "full_name", "id", "institute_id", "institute_name_de", "institute_name_en", "institute_postal_address", "is_deceased", "link", "orcid_id", "page_url", "person", "person_id", "project_types_order", "projects", "root_id", "root_name_de", "root_name_en"]
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 DFGPerson 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 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 person
if self.person:
_dict['person'] = self.person.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in projects (list)
_items = []
if self.projects:
for _item_projects in self.projects:
if _item_projects:
_items.append(_item_projects.to_dict())
_dict['projects'] = _items
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of DFGPerson from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"address_country_de": obj.get("address_country_de"),
"address_country_en": obj.get("address_country_en"),
"address_hidden": obj.get("address_hidden"),
"address_postal_code_city": obj.get("address_postal_code_city"),
"address_street": obj.get("address_street"),
"aku_id": obj.get("aku_id"),
"award_types_order": obj.get("award_types_order"),
"awards": [DFGPersonAwardsInner.from_dict(_item) for _item in obj["awards"]] if obj.get("awards") is not None else None,
"fetched_at": obj.get("fetched_at"),
"full_name": obj.get("full_name"),
"id": obj.get("id"),
"institute_id": obj.get("institute_id"),
"institute_name_de": obj.get("institute_name_de"),
"institute_name_en": obj.get("institute_name_en"),
"institute_postal_address": obj.get("institute_postal_address"),
"is_deceased": obj.get("is_deceased"),
"link": obj.get("link"),
"orcid_id": obj.get("orcid_id"),
"page_url": obj.get("page_url"),
"person": DFGPersonPerson.from_dict(obj["person"]) if obj.get("person") is not None else None,
"person_id": obj.get("person_id"),
"project_types_order": obj.get("project_types_order"),
"projects": [DFGPersonProjectsInner.from_dict(_item) for _item in obj["projects"]] if obj.get("projects") is not None else None,
"root_id": obj.get("root_id"),
"root_name_de": obj.get("root_name_de"),
"root_name_en": obj.get("root_name_en")
})
return _obj
@@ -0,0 +1,116 @@
# coding: utf-8
"""
DFG Persons API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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 DFGPersonAwardsInner(BaseModel):
"""
DFGPersonAwardsInner
""" # noqa: E501
award_group_key: Optional[StrictStr] = None
award_id: Optional[StrictInt] = None
award_key: Optional[StrictStr] = None
award_label_de: Optional[StrictStr] = None
award_label_en: Optional[StrictStr] = None
person_ref_id: Optional[StrictInt] = None
pseudo_project_id: Optional[StrictInt] = None
sort_criteria: Optional[StrictStr] = None
text_de: Optional[StrictStr] = None
text_en: Optional[StrictStr] = None
title_de: Optional[StrictStr] = None
title_en: Optional[StrictStr] = None
url_de: Optional[StrictStr] = None
url_en: Optional[StrictStr] = None
year: Optional[StrictInt] = None
__properties: ClassVar[List[str]] = ["award_group_key", "award_id", "award_key", "award_label_de", "award_label_en", "person_ref_id", "pseudo_project_id", "sort_criteria", "text_de", "text_en", "title_de", "title_en", "url_de", "url_en", "year"]
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 DFGPersonAwardsInner 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 DFGPersonAwardsInner from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"award_group_key": obj.get("award_group_key"),
"award_id": obj.get("award_id"),
"award_key": obj.get("award_key"),
"award_label_de": obj.get("award_label_de"),
"award_label_en": obj.get("award_label_en"),
"person_ref_id": obj.get("person_ref_id"),
"pseudo_project_id": obj.get("pseudo_project_id"),
"sort_criteria": obj.get("sort_criteria"),
"text_de": obj.get("text_de"),
"text_en": obj.get("text_en"),
"title_de": obj.get("title_de"),
"title_en": obj.get("title_en"),
"url_de": obj.get("url_de"),
"url_en": obj.get("url_en"),
"year": obj.get("year")
})
return _obj
@@ -0,0 +1,120 @@
# coding: utf-8
"""
DFG Persons API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, 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 DFGPersonPerson(BaseModel):
"""
DFGPersonPerson
""" # noqa: E501
address_country_de: Optional[StrictStr] = None
address_country_en: Optional[StrictStr] = None
address_hidden: Optional[StrictBool] = None
address_postal_code_city: Optional[StrictStr] = None
address_street: Optional[StrictStr] = None
aku_id: Optional[StrictInt] = None
full_name: Optional[StrictStr] = None
institute_id: Optional[StrictInt] = None
institute_name_de: Optional[StrictStr] = None
institute_name_en: Optional[StrictStr] = None
institute_postal_address: Optional[StrictStr] = None
is_deceased: Optional[StrictBool] = None
orcid_id: Optional[StrictStr] = None
person_id: Optional[StrictInt] = None
root_id: Optional[StrictInt] = None
root_name_de: Optional[StrictStr] = None
root_name_en: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["address_country_de", "address_country_en", "address_hidden", "address_postal_code_city", "address_street", "aku_id", "full_name", "institute_id", "institute_name_de", "institute_name_en", "institute_postal_address", "is_deceased", "orcid_id", "person_id", "root_id", "root_name_de", "root_name_en"]
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 DFGPersonPerson 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 DFGPersonPerson from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"address_country_de": obj.get("address_country_de"),
"address_country_en": obj.get("address_country_en"),
"address_hidden": obj.get("address_hidden"),
"address_postal_code_city": obj.get("address_postal_code_city"),
"address_street": obj.get("address_street"),
"aku_id": obj.get("aku_id"),
"full_name": obj.get("full_name"),
"institute_id": obj.get("institute_id"),
"institute_name_de": obj.get("institute_name_de"),
"institute_name_en": obj.get("institute_name_en"),
"institute_postal_address": obj.get("institute_postal_address"),
"is_deceased": obj.get("is_deceased"),
"orcid_id": obj.get("orcid_id"),
"person_id": obj.get("person_id"),
"root_id": obj.get("root_id"),
"root_name_de": obj.get("root_name_de"),
"root_name_en": obj.get("root_name_en")
})
return _obj
@@ -0,0 +1,128 @@
# coding: utf-8
"""
DFG Persons API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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 DFGPersonProjectsInner(BaseModel):
"""
DFGPersonProjectsInner
""" # noqa: E501
funding_end: Optional[StrictInt] = None
funding_period_de: Optional[StrictStr] = None
funding_period_en: Optional[StrictStr] = None
funding_start: Optional[StrictInt] = None
funding_type_de: Optional[StrictStr] = None
funding_type_en: Optional[StrictStr] = None
funding_type_key: Optional[StrictStr] = None
participants_de: Optional[StrictStr] = None
participants_en: Optional[StrictStr] = None
person_ref_id: Optional[StrictInt] = None
project_id: Optional[StrictInt] = None
role_key: Optional[StrictStr] = None
role_label_de: Optional[StrictStr] = None
role_label_en: Optional[StrictStr] = None
role_sort: Optional[StrictStr] = None
sort_criteria: Optional[StrictStr] = None
sort_year: Optional[StrictStr] = None
status_de: Optional[StrictStr] = None
status_en: Optional[StrictStr] = None
title_de: Optional[StrictStr] = None
title_en: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["funding_end", "funding_period_de", "funding_period_en", "funding_start", "funding_type_de", "funding_type_en", "funding_type_key", "participants_de", "participants_en", "person_ref_id", "project_id", "role_key", "role_label_de", "role_label_en", "role_sort", "sort_criteria", "sort_year", "status_de", "status_en", "title_de", "title_en"]
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 DFGPersonProjectsInner 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 DFGPersonProjectsInner from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"funding_end": obj.get("funding_end"),
"funding_period_de": obj.get("funding_period_de"),
"funding_period_en": obj.get("funding_period_en"),
"funding_start": obj.get("funding_start"),
"funding_type_de": obj.get("funding_type_de"),
"funding_type_en": obj.get("funding_type_en"),
"funding_type_key": obj.get("funding_type_key"),
"participants_de": obj.get("participants_de"),
"participants_en": obj.get("participants_en"),
"person_ref_id": obj.get("person_ref_id"),
"project_id": obj.get("project_id"),
"role_key": obj.get("role_key"),
"role_label_de": obj.get("role_label_de"),
"role_label_en": obj.get("role_label_en"),
"role_sort": obj.get("role_sort"),
"sort_criteria": obj.get("sort_criteria"),
"sort_year": obj.get("sort_year"),
"status_de": obj.get("status_de"),
"status_en": obj.get("status_en"),
"title_de": obj.get("title_de"),
"title_en": obj.get("title_en")
})
return _obj
@@ -0,0 +1,224 @@
# coding: utf-8
"""
DFG Projects API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from inse.models.projects_dfg_v2.project.dfg_project_fachgebiete_inner import DFGProjectFachgebieteInner
from inse.models.projects_dfg_v2.project.dfg_project_institutions_inner import DFGProjectInstitutionsInner
from inse.models.projects_dfg_v2.project.dfg_project_persons_inner import DFGProjectPersonsInner
from inse.models.projects_dfg_v2.project.dfg_project_project import DFGProjectProject
from inse.models.projects_dfg_v2.project.dfg_project_publications_inner import DFGProjectPublicationsInner
from inse.models.projects_dfg_v2.project.dfg_project_subprojects_inner import DFGProjectSubprojectsInner
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class DFGProject(BaseModel):
"""
DFGProject
""" # noqa: E501
abstract_de: Optional[StrictStr] = None
abstract_en: Optional[StrictStr] = None
equipment_group: Optional[StrictStr] = None
equipment_name: Optional[StrictStr] = None
external_link: Optional[StrictStr] = None
fachgebiete: Optional[List[DFGProjectFachgebieteInner]] = None
fetched_at: Optional[datetime] = None
final_report_abstract_de: Optional[StrictStr] = None
final_report_abstract_en: Optional[StrictStr] = None
funding_end: Optional[StrictInt] = None
funding_period_de: Optional[StrictStr] = None
funding_period_en: Optional[StrictStr] = None
funding_start: Optional[StrictInt] = None
funding_type_de: Optional[StrictStr] = None
funding_type_en: Optional[StrictStr] = None
funding_type_key: Optional[StrictStr] = None
funding_type_sort: Optional[StrictStr] = None
id: Optional[StrictInt] = None
institution_roles_order: Optional[StrictStr] = None
institutions: Optional[List[DFGProjectInstitutionsInner]] = None
international_relation_de: Optional[StrictStr] = None
international_relation_en: Optional[StrictStr] = None
is_transfer_project: Optional[StrictBool] = None
link: Optional[StrictStr] = None
page_url: Optional[StrictStr] = None
parent_project_id: Optional[StrictInt] = None
parent_title_de: Optional[StrictStr] = None
parent_title_en: Optional[StrictStr] = None
person_roles_order: Optional[StrictStr] = None
persons: Optional[List[DFGProjectPersonsInner]] = None
project: Optional[DFGProjectProject] = None
project_id: Optional[StrictInt] = None
project_identifier_de: Optional[StrictStr] = None
project_identifier_en: Optional[StrictStr] = None
publications: Optional[List[DFGProjectPublicationsInner]] = None
subject_area_de: Optional[StrictStr] = None
subject_area_en: Optional[StrictStr] = None
subject_classifications: Optional[DFGProjectFachgebieteInner] = None
subproject_order: Optional[StrictStr] = None
subprojects: Optional[List[DFGProjectSubprojectsInner]] = None
template_type: Optional[StrictStr] = None
title_de: Optional[StrictStr] = None
title_en: Optional[StrictStr] = None
website_html_de: Optional[StrictStr] = None
website_html_en: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["abstract_de", "abstract_en", "equipment_group", "equipment_name", "external_link", "fachgebiete", "fetched_at", "final_report_abstract_de", "final_report_abstract_en", "funding_end", "funding_period_de", "funding_period_en", "funding_start", "funding_type_de", "funding_type_en", "funding_type_key", "funding_type_sort", "id", "institution_roles_order", "institutions", "international_relation_de", "international_relation_en", "is_transfer_project", "link", "page_url", "parent_project_id", "parent_title_de", "parent_title_en", "person_roles_order", "persons", "project", "project_id", "project_identifier_de", "project_identifier_en", "publications", "subject_area_de", "subject_area_en", "subject_classifications", "subproject_order", "subprojects", "template_type", "title_de", "title_en", "website_html_de", "website_html_en"]
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 DFGProject 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 fachgebiete (list)
_items = []
if self.fachgebiete:
for _item_fachgebiete in self.fachgebiete:
if _item_fachgebiete:
_items.append(_item_fachgebiete.to_dict())
_dict['fachgebiete'] = _items
# 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
# override the default output from pydantic by calling `to_dict()` of each item in persons (list)
_items = []
if self.persons:
for _item_persons in self.persons:
if _item_persons:
_items.append(_item_persons.to_dict())
_dict['persons'] = _items
# override the default output from pydantic by calling `to_dict()` of project
if self.project:
_dict['project'] = self.project.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in publications (list)
_items = []
if self.publications:
for _item_publications in self.publications:
if _item_publications:
_items.append(_item_publications.to_dict())
_dict['publications'] = _items
# override the default output from pydantic by calling `to_dict()` of subject_classifications
if self.subject_classifications:
_dict['subject_classifications'] = self.subject_classifications.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in subprojects (list)
_items = []
if self.subprojects:
for _item_subprojects in self.subprojects:
if _item_subprojects:
_items.append(_item_subprojects.to_dict())
_dict['subprojects'] = _items
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of DFGProject from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"abstract_de": obj.get("abstract_de"),
"abstract_en": obj.get("abstract_en"),
"equipment_group": obj.get("equipment_group"),
"equipment_name": obj.get("equipment_name"),
"external_link": obj.get("external_link"),
"fachgebiete": [DFGProjectFachgebieteInner.from_dict(_item) for _item in obj["fachgebiete"]] if obj.get("fachgebiete") is not None else None,
"fetched_at": obj.get("fetched_at"),
"final_report_abstract_de": obj.get("final_report_abstract_de"),
"final_report_abstract_en": obj.get("final_report_abstract_en"),
"funding_end": obj.get("funding_end"),
"funding_period_de": obj.get("funding_period_de"),
"funding_period_en": obj.get("funding_period_en"),
"funding_start": obj.get("funding_start"),
"funding_type_de": obj.get("funding_type_de"),
"funding_type_en": obj.get("funding_type_en"),
"funding_type_key": obj.get("funding_type_key"),
"funding_type_sort": obj.get("funding_type_sort"),
"id": obj.get("id"),
"institution_roles_order": obj.get("institution_roles_order"),
"institutions": [DFGProjectInstitutionsInner.from_dict(_item) for _item in obj["institutions"]] if obj.get("institutions") is not None else None,
"international_relation_de": obj.get("international_relation_de"),
"international_relation_en": obj.get("international_relation_en"),
"is_transfer_project": obj.get("is_transfer_project"),
"link": obj.get("link"),
"page_url": obj.get("page_url"),
"parent_project_id": obj.get("parent_project_id"),
"parent_title_de": obj.get("parent_title_de"),
"parent_title_en": obj.get("parent_title_en"),
"person_roles_order": obj.get("person_roles_order"),
"persons": [DFGProjectPersonsInner.from_dict(_item) for _item in obj["persons"]] if obj.get("persons") is not None else None,
"project": DFGProjectProject.from_dict(obj["project"]) if obj.get("project") is not None else None,
"project_id": obj.get("project_id"),
"project_identifier_de": obj.get("project_identifier_de"),
"project_identifier_en": obj.get("project_identifier_en"),
"publications": [DFGProjectPublicationsInner.from_dict(_item) for _item in obj["publications"]] if obj.get("publications") is not None else None,
"subject_area_de": obj.get("subject_area_de"),
"subject_area_en": obj.get("subject_area_en"),
"subject_classifications": DFGProjectFachgebieteInner.from_dict(obj["subject_classifications"]) if obj.get("subject_classifications") is not None else None,
"subproject_order": obj.get("subproject_order"),
"subprojects": [DFGProjectSubprojectsInner.from_dict(_item) for _item in obj["subprojects"]] if obj.get("subprojects") is not None else None,
"template_type": obj.get("template_type"),
"title_de": obj.get("title_de"),
"title_en": obj.get("title_en"),
"website_html_de": obj.get("website_html_de"),
"website_html_en": obj.get("website_html_en")
})
return _obj
@@ -0,0 +1,102 @@
# coding: utf-8
"""
DFG Projects API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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 DFGProjectFachgebieteInner(BaseModel):
"""
DFGProjectFachgebieteInner
""" # noqa: E501
fach: Optional[StrictStr] = None
fach_code: Optional[StrictStr] = None
fachgebiet: Optional[StrictStr] = None
fachgebiet_code: Optional[StrictStr] = None
fachkollegium: Optional[StrictStr] = None
fachkollegium_code: Optional[StrictStr] = None
wissenschaftsbereich: Optional[StrictStr] = None
wissenschaftsbereich_code: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["fach", "fach_code", "fachgebiet", "fachgebiet_code", "fachkollegium", "fachkollegium_code", "wissenschaftsbereich", "wissenschaftsbereich_code"]
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 DFGProjectFachgebieteInner 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 DFGProjectFachgebieteInner from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"fach": obj.get("fach"),
"fach_code": obj.get("fach_code"),
"fachgebiet": obj.get("fachgebiet"),
"fachgebiet_code": obj.get("fachgebiet_code"),
"fachkollegium": obj.get("fachkollegium"),
"fachkollegium_code": obj.get("fachkollegium_code"),
"wissenschaftsbereich": obj.get("wissenschaftsbereich"),
"wissenschaftsbereich_code": obj.get("wissenschaftsbereich_code")
})
return _obj
@@ -0,0 +1,117 @@
# coding: utf-8
"""
DFG Projects API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, StrictBool, 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 DFGProjectInstitutionsInner(BaseModel):
"""
DFGProjectInstitutionsInner
""" # noqa: E501
dissolution_date: Optional[datetime] = None
has_detail_page: Optional[StrictBool] = None
institute_id: Optional[StrictInt] = None
institute_name_de: Optional[StrictStr] = None
institute_name_en: Optional[StrictStr] = None
is_dissolved: Optional[StrictBool] = None
is_head_display: Optional[StrictBool] = None
project_ref_id: Optional[StrictInt] = None
role_group_label_de: Optional[StrictStr] = None
role_key: Optional[StrictStr] = None
role_label_de: Optional[StrictStr] = None
role_label_en: Optional[StrictStr] = None
role_sort: Optional[StrictStr] = None
sort_criteria: Optional[StrictStr] = None
sort_name: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["dissolution_date", "has_detail_page", "institute_id", "institute_name_de", "institute_name_en", "is_dissolved", "is_head_display", "project_ref_id", "role_group_label_de", "role_key", "role_label_de", "role_label_en", "role_sort", "sort_criteria", "sort_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 DFGProjectInstitutionsInner 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 DFGProjectInstitutionsInner from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"dissolution_date": obj.get("dissolution_date"),
"has_detail_page": obj.get("has_detail_page"),
"institute_id": obj.get("institute_id"),
"institute_name_de": obj.get("institute_name_de"),
"institute_name_en": obj.get("institute_name_en"),
"is_dissolved": obj.get("is_dissolved"),
"is_head_display": obj.get("is_head_display"),
"project_ref_id": obj.get("project_ref_id"),
"role_group_label_de": obj.get("role_group_label_de"),
"role_key": obj.get("role_key"),
"role_label_de": obj.get("role_label_de"),
"role_label_en": obj.get("role_label_en"),
"role_sort": obj.get("role_sort"),
"sort_criteria": obj.get("sort_criteria"),
"sort_name": obj.get("sort_name")
})
return _obj
@@ -0,0 +1,118 @@
# coding: utf-8
"""
DFG Projects API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, 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 DFGProjectPersonsInner(BaseModel):
"""
DFGProjectPersonsInner
""" # noqa: E501
affiliation_de: Optional[StrictStr] = None
affiliation_en: Optional[StrictStr] = None
award_text_de: Optional[StrictStr] = None
award_text_en: Optional[StrictStr] = None
full_name: Optional[StrictStr] = None
is_deceased: Optional[StrictBool] = None
is_head_display: Optional[StrictBool] = None
person_id: Optional[StrictInt] = None
project_ref_id: Optional[StrictInt] = None
role_group_label_de: Optional[StrictStr] = None
role_key: Optional[StrictStr] = None
role_label_de: Optional[StrictStr] = None
role_label_en: Optional[StrictStr] = None
role_sort: Optional[StrictStr] = None
sort_criteria: Optional[StrictStr] = None
sort_name: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["affiliation_de", "affiliation_en", "award_text_de", "award_text_en", "full_name", "is_deceased", "is_head_display", "person_id", "project_ref_id", "role_group_label_de", "role_key", "role_label_de", "role_label_en", "role_sort", "sort_criteria", "sort_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 DFGProjectPersonsInner 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 DFGProjectPersonsInner from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"affiliation_de": obj.get("affiliation_de"),
"affiliation_en": obj.get("affiliation_en"),
"award_text_de": obj.get("award_text_de"),
"award_text_en": obj.get("award_text_en"),
"full_name": obj.get("full_name"),
"is_deceased": obj.get("is_deceased"),
"is_head_display": obj.get("is_head_display"),
"person_id": obj.get("person_id"),
"project_ref_id": obj.get("project_ref_id"),
"role_group_label_de": obj.get("role_group_label_de"),
"role_key": obj.get("role_key"),
"role_label_de": obj.get("role_label_de"),
"role_label_en": obj.get("role_label_en"),
"role_sort": obj.get("role_sort"),
"sort_criteria": obj.get("sort_criteria"),
"sort_name": obj.get("sort_name")
})
return _obj
@@ -0,0 +1,148 @@
# coding: utf-8
"""
DFG Projects API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, 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 DFGProjectProject(BaseModel):
"""
DFGProjectProject
""" # noqa: E501
abstract_de: Optional[StrictStr] = None
abstract_en: Optional[StrictStr] = None
equipment_group: Optional[StrictStr] = None
equipment_name: Optional[StrictStr] = None
external_link: Optional[StrictStr] = None
final_report_abstract_de: Optional[StrictStr] = None
final_report_abstract_en: Optional[StrictStr] = None
funding_end: Optional[StrictInt] = None
funding_period_de: Optional[StrictStr] = None
funding_period_en: Optional[StrictStr] = None
funding_start: Optional[StrictInt] = None
funding_type_de: Optional[StrictStr] = None
funding_type_en: Optional[StrictStr] = None
funding_type_key: Optional[StrictStr] = None
funding_type_sort: Optional[StrictStr] = None
international_relation_de: Optional[StrictStr] = None
international_relation_en: Optional[StrictStr] = None
is_transfer_project: Optional[StrictBool] = None
parent_project_id: Optional[StrictInt] = None
parent_title_de: Optional[StrictStr] = None
parent_title_en: Optional[StrictStr] = None
project_id: Optional[StrictInt] = None
project_identifier_de: Optional[StrictStr] = None
project_identifier_en: Optional[StrictStr] = None
subject_area_de: Optional[StrictStr] = None
subject_area_en: Optional[StrictStr] = None
template_type: Optional[StrictStr] = None
title_de: Optional[StrictStr] = None
title_en: Optional[StrictStr] = None
website_html_de: Optional[StrictStr] = None
website_html_en: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["abstract_de", "abstract_en", "equipment_group", "equipment_name", "external_link", "final_report_abstract_de", "final_report_abstract_en", "funding_end", "funding_period_de", "funding_period_en", "funding_start", "funding_type_de", "funding_type_en", "funding_type_key", "funding_type_sort", "international_relation_de", "international_relation_en", "is_transfer_project", "parent_project_id", "parent_title_de", "parent_title_en", "project_id", "project_identifier_de", "project_identifier_en", "subject_area_de", "subject_area_en", "template_type", "title_de", "title_en", "website_html_de", "website_html_en"]
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 DFGProjectProject 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 DFGProjectProject from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"abstract_de": obj.get("abstract_de"),
"abstract_en": obj.get("abstract_en"),
"equipment_group": obj.get("equipment_group"),
"equipment_name": obj.get("equipment_name"),
"external_link": obj.get("external_link"),
"final_report_abstract_de": obj.get("final_report_abstract_de"),
"final_report_abstract_en": obj.get("final_report_abstract_en"),
"funding_end": obj.get("funding_end"),
"funding_period_de": obj.get("funding_period_de"),
"funding_period_en": obj.get("funding_period_en"),
"funding_start": obj.get("funding_start"),
"funding_type_de": obj.get("funding_type_de"),
"funding_type_en": obj.get("funding_type_en"),
"funding_type_key": obj.get("funding_type_key"),
"funding_type_sort": obj.get("funding_type_sort"),
"international_relation_de": obj.get("international_relation_de"),
"international_relation_en": obj.get("international_relation_en"),
"is_transfer_project": obj.get("is_transfer_project"),
"parent_project_id": obj.get("parent_project_id"),
"parent_title_de": obj.get("parent_title_de"),
"parent_title_en": obj.get("parent_title_en"),
"project_id": obj.get("project_id"),
"project_identifier_de": obj.get("project_identifier_de"),
"project_identifier_en": obj.get("project_identifier_en"),
"subject_area_de": obj.get("subject_area_de"),
"subject_area_en": obj.get("subject_area_en"),
"template_type": obj.get("template_type"),
"title_de": obj.get("title_de"),
"title_en": obj.get("title_en"),
"website_html_de": obj.get("website_html_de"),
"website_html_en": obj.get("website_html_en")
})
return _obj
@@ -0,0 +1,100 @@
# coding: utf-8
"""
DFG Projects API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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 DFGProjectPublicationsInner(BaseModel):
"""
DFGProjectPublicationsInner
""" # noqa: E501
authors_editors: Optional[StrictStr] = None
doi: Optional[StrictStr] = None
project_ref_id: Optional[StrictInt] = None
publication_id: Optional[StrictInt] = None
publication_year: Optional[StrictInt] = None
sort_key: Optional[StrictInt] = None
title: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["authors_editors", "doi", "project_ref_id", "publication_id", "publication_year", "sort_key", "title"]
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 DFGProjectPublicationsInner 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 DFGProjectPublicationsInner from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"authors_editors": obj.get("authors_editors"),
"doi": obj.get("doi"),
"project_ref_id": obj.get("project_ref_id"),
"publication_id": obj.get("publication_id"),
"publication_year": obj.get("publication_year"),
"sort_key": obj.get("sort_key"),
"title": obj.get("title")
})
return _obj
@@ -0,0 +1,130 @@
# coding: utf-8
"""
DFG Projects API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
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, 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 DFGProjectSubprojectsInner(BaseModel):
"""
DFGProjectSubprojectsInner
""" # noqa: E501
funding_end: Optional[StrictInt] = None
funding_period_de: Optional[StrictStr] = None
funding_period_en: Optional[StrictStr] = None
funding_start: Optional[StrictInt] = None
group_label_de: Optional[StrictStr] = None
group_label_en: Optional[StrictStr] = None
is_head_display: Optional[StrictBool] = None
parent_project_id: Optional[StrictInt] = None
person_first_names: Optional[StrictStr] = None
person_id: Optional[StrictInt] = None
person_last_name: Optional[StrictStr] = None
role_group_label_de: Optional[StrictStr] = None
role_key: Optional[StrictStr] = None
role_label_de: Optional[StrictStr] = None
short_title: Optional[StrictStr] = None
sort_criteria: Optional[StrictStr] = None
sort_key: Optional[StrictStr] = None
status_de: Optional[StrictStr] = None
status_en: Optional[StrictStr] = None
subproject_id: Optional[StrictInt] = None
title_de: Optional[StrictStr] = None
title_en: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["funding_end", "funding_period_de", "funding_period_en", "funding_start", "group_label_de", "group_label_en", "is_head_display", "parent_project_id", "person_first_names", "person_id", "person_last_name", "role_group_label_de", "role_key", "role_label_de", "short_title", "sort_criteria", "sort_key", "status_de", "status_en", "subproject_id", "title_de", "title_en"]
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 DFGProjectSubprojectsInner 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 DFGProjectSubprojectsInner from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"funding_end": obj.get("funding_end"),
"funding_period_de": obj.get("funding_period_de"),
"funding_period_en": obj.get("funding_period_en"),
"funding_start": obj.get("funding_start"),
"group_label_de": obj.get("group_label_de"),
"group_label_en": obj.get("group_label_en"),
"is_head_display": obj.get("is_head_display"),
"parent_project_id": obj.get("parent_project_id"),
"person_first_names": obj.get("person_first_names"),
"person_id": obj.get("person_id"),
"person_last_name": obj.get("person_last_name"),
"role_group_label_de": obj.get("role_group_label_de"),
"role_key": obj.get("role_key"),
"role_label_de": obj.get("role_label_de"),
"short_title": obj.get("short_title"),
"sort_criteria": obj.get("sort_criteria"),
"sort_key": obj.get("sort_key"),
"status_de": obj.get("status_de"),
"status_en": obj.get("status_en"),
"subproject_id": obj.get("subproject_id"),
"title_de": obj.get("title_de"),
"title_en": obj.get("title_en")
})
return _obj
@@ -0,0 +1,8 @@
from inse.model import Page
#from inse.models.projects_dfg_v2.institute.dfg_institute import DFGInstitute
from inse.projects.model import DfgInstitutionSummary
class DfgInstitutionSummaryPage(Page[DfgInstitutionSummary]):
"""A paginated response containing a list of institutions."""
pass
@@ -0,0 +1,47 @@
import logging
from typing import Annotated
from fastapi import APIRouter, Query
from inse.projects.dfg_institutions.model import DfgInstitutionSummaryPage
from inse.tags import Tags
from inse.projects.dfg_institutions.service import autocomplete_institutions_for_selector, get_institutions_by_ids
logger = logging.getLogger(__name__)
INSTITUTIONS_DFG_PREFIX = "/api/dfg/institutions"
router = APIRouter(prefix=INSTITUTIONS_DFG_PREFIX, tags=[Tags.DFG_INSTITUTIONS])
@router.get(
"/ids",
operation_id="getDfgInstitutionsByIds",
summary="Returns a list of institutions based on their IDs.",
)
async def get_dfg_institutions(
institution_ids: Annotated[
list[str],
Query(description="A list of institution IDs to retrieve."),
] = [],
) -> DfgInstitutionSummaryPage:
return await get_institutions_by_ids(institution_ids=institution_ids or [])
@router.get(
"/autocomplete/selector",
operation_id="getDfgInstitutionAutocompleteForSelector",
summary="Returns a list of institutions based on a search term for autocomplete functionality.",
)
async def get_dfg_institution_autocomplete(
query: Annotated[
str,
Query(
description="A search term to filter institutions by (partial matches allowed)."
),
] = "",
) -> DfgInstitutionSummaryPage:
return await autocomplete_institutions_for_selector(query=query)
@@ -0,0 +1,200 @@
import logging
from typing import Dict, List, Optional
from inse.integrations import elasticsearch
from inse.model import ESIndex, ESCluster
#from inse.models.projects_dfg_v2.institute.dfg_institute import DFGInstitute
from inse.projects.model import DfgInstitutionSummary
from inse.projects.dfg_institutions.model import DfgInstitutionSummaryPage
logger = logging.getLogger(__name__)
async def search_institutions(
page: int = 0,
size: int = 10,
query: Optional[Dict] = None,
source: Optional[List[str]] = None,
sort: Optional[List[Dict]] = None,
body: Optional[Dict] = None,
) -> DfgInstitutionSummaryPage:
"""Searches for institutions in the DFG Institutes Elasticsearch index based on the provided parameters.
Args:
page (int, optional): The page number to retrieve. Defaults to 0.
size (int, optional): The number of institutions to retrieve per page. Defaults to 10.
query (Optional[Dict], optional): The search query to filter institutions by. Defaults to None.
source (Optional[List[str]], optional): A list of fields to include in the response. Defaults to None.
sort (Optional[List[Dict]], optional): A list of sorting criteria. Defaults to None.
body (Optional[Dict], optional): The request body for the Elasticsearch search query. Defaults to None.
Returns:
DfgInstitutionSummaryPage: A page of institutions matching the search criteria.
"""
response = await elasticsearch.search(
index=ESIndex.PROJECTS_DFG_INSTITUTES,
cluster=ESCluster.INSE,
query=query,
source=source,
size=size,
offset=size * page,
sort=sort,
body=body,
)
hits_block = response.get("hits", {})
hits = hits_block.get("hits", [])
institutions: List[DfgInstitutionSummary] = []
for hit in hits:
_source = hit.get("_source", {})
# Handle nested institute object if present
if "institute" in _source and isinstance(_source["institute"], dict):
# Merge institute fields into top-level if needed
institute_data = _source.pop("institute")
_source.update(institute_data)
institutions.append(DfgInstitutionSummary(**_source)) # type: ignore
return DfgInstitutionSummaryPage(
elements=institutions,
total=hits_block.get("total", {}).get("value", len(institutions)),
page=page,
size=size,
)
async def get_institutions_by_ids(institution_ids: List[str]) -> DfgInstitutionSummaryPage:
"""Retrieves institutions based on a list of institution IDs.
Args:
institution_ids (List[str]): A list of institution IDs to retrieve.
Returns:
DfgInstitutionSummaryPage: A page of institutions matching the provided IDs.
"""
logger.debug(f"Fetching institutions for IDs: {institution_ids}")
if not institution_ids:
return DfgInstitutionSummaryPage(elements=[], total=0, page=0, size=0)
return await search_institutions(
page=0,
size=len(institution_ids),
query={
"terms": {
"id": institution_ids
}
},
source=[
"id",
"institute_name_de",
"institute_name_en",
"address_country_de",
"address_country_en",
"address_street",
"root_id",
"root_name_de",
"root_name_en",
],
)
async def autocomplete_institutions(
query: str, page: int = 0, size: int = 10, source: Optional[List[str]] = None
) -> DfgInstitutionSummaryPage:
"""Autocompletes institutions based on a search term.
Args:
query (str): The search term to autocomplete institutions with.
page (int, optional): The page number to retrieve. Defaults to 0.
size (int, optional): The number of institutions to retrieve per page. Defaults to 10.
source (Optional[List[str]], optional): A list of fields to include in the response. Defaults to None.
Returns:
DfgInstitutionSummaryPage: A page of institutions matching the autocomplete criteria.
"""
logger.debug(f"Autocomplete institutions for query: {query}")
if not query:
return DfgInstitutionSummaryPage(elements=[], total=0, page=0, size=0)
return await search_institutions(
page=page,
size=size,
query={
"bool": {
"should": [
{
"match_phrase_prefix": {
"institute_name_de": {
"query": query,
"max_expansions": 50,
}
}
},
{
"match_phrase_prefix": {
"institute_name_en": {
"query": query,
"max_expansions": 50,
}
}
},
{
"match_phrase_prefix": {
"root_name_de": {
"query": query,
"max_expansions": 50,
}
}
},
{
"match_phrase_prefix": {
"root_name_en": {
"query": query,
"max_expansions": 50,
}
}
},
],
"minimum_should_match": 1,
}
},
source=source or [
"id",
"institute_name_de",
"institute_name_en",
"root_id",
"root_name_de",
"root_name_en",
"address_country_de",
"address_country_en",
],
)
async def autocomplete_institutions_for_selector(
query: str, page: int = 0, size: int = 10
) -> DfgInstitutionSummaryPage:
"""Autocompletes institutions based on a search term for use in a selector component.
Args:
query (str): The search term to filter institutions by (partial matches allowed).
page (int, optional): The page number to retrieve. Defaults to 0.
size (int, optional): The number of institutions to retrieve per page. Defaults to 10.
Returns:
DfgInstitutionSummaryPage: A page of institutions matching the autocomplete criteria.
"""
return await autocomplete_institutions(
query=query,
page=page,
size=size,
source=[
"id",
"institute_name_de",
"institute_name_en",
"root_id",
"root_name_de",
"root_name_en",
"address_country_de",
"address_country_en",
],
)
@@ -0,0 +1,8 @@
from inse.model import Page
#from inse.models.projects_dfg_v2.institute.dfg_institute import DFGInstitute
from inse.projects.model import DfgPersonSummary
class DfgPersonSummaryPage(Page[DfgPersonSummary]):
"""A paginated response containing a list of persons."""
pass
@@ -0,0 +1,47 @@
import logging
from typing import Annotated
from fastapi import APIRouter, Query
from inse.projects.dfg_persons.model import DfgPersonSummaryPage
from inse.tags import Tags
from inse.projects.dfg_persons.service import autocomplete_persons_for_selector, get_persons_by_ids
logger = logging.getLogger(__name__)
INSTITUTIONS_DFG_PREFIX = "/api/dfg/persons"
router = APIRouter(prefix=INSTITUTIONS_DFG_PREFIX, tags=[Tags.DFG_PERSONS])
@router.get(
"/ids",
operation_id="getDfgPersonsByIds",
summary="Returns a list of persons based on their IDs.",
)
async def get_dfg_persons_by_ids(
person_ids: Annotated[
list[str],
Query(description="A list of person IDs to retrieve."),
] = [],
) -> DfgPersonSummaryPage:
return await get_persons_by_ids(person_ids=person_ids or [])
@router.get(
"/autocomplete/selector",
operation_id="getDfgPersonAutocompleteForSelector",
summary="Returns a list of persons based on a search term for autocomplete functionality.",
)
async def get_dfg_person_autocomplete(
query: Annotated[
str,
Query(
description="A search term to filter persons by (partial matches allowed)."
),
] = "",
) -> DfgPersonSummaryPage:
return await autocomplete_persons_for_selector(query=query)
@@ -0,0 +1,244 @@
import logging
from typing import Dict, List, Optional
from inse.integrations import elasticsearch
from inse.model import ESIndex, ESCluster
from inse.projects.model import DfgPersonSummary, DfgInstitutionSummary
from inse.projects.dfg_persons.model import DfgPersonSummaryPage
logger = logging.getLogger(__name__)
async def search_persons(
page: int = 0,
size: int = 10,
query: Optional[Dict] = None,
source: Optional[List[str]] = None,
sort: Optional[List[Dict]] = None,
body: Optional[Dict] = None,
) -> DfgPersonSummaryPage:
"""Searches for persons in the DFG Persons Elasticsearch index.
Args:
page (int, optional): Page number. Defaults to 0.
size (int, optional): Number of results per page. Defaults to 10.
query (Optional[Dict], optional): Elasticsearch query DSL. Defaults to None.
source (Optional[List[str]], optional): Fields to include in response. Defaults to None.
sort (Optional[List[Dict]], optional): Sorting criteria. Defaults to None.
body (Optional[Dict], optional): Full request body. Defaults to None.
Returns:
DfgPersonSummaryPage: Paginated list of persons.
"""
print(query)
response = await elasticsearch.search(
index=ESIndex.PROJECTS_DFG_PERSONS,
cluster=ESCluster.INSE,
query=query,
source=source,
size=size,
offset=size * page,
sort=sort,
body=body,
)
hits_block = response.get("hits", {})
hits = hits_block.get("hits", [])
persons: List[DfgPersonSummary] = []
for hit in hits:
_source = hit.get("_source", {})
# Merge top-level person data with nested `person` object
if "person" in _source and isinstance(_source["person"], dict):
person_data = _source.pop("person")
_source.update(person_data)
# Extract person-level fields
person_id = _source.get("person_id") or _source.get("id")
full_name = _source.get("full_name")
institution = None
if "institute_id" in _source and _source.get("institute_id") is not None:
institution = DfgInstitutionSummary(
institute_name_de=_source.get("institute_name_de"),
institute_name_en=_source.get("institute_name_en"),
root_name_de=_source.get("root_name_de"),
root_name_en=_source.get("root_name_en"),
root_id=_source.get("root_id"),
id=_source.get("institute_id"),
)
# Extract projects (only first 10 or relevant ones)
projects = []
if "projects" in _source and isinstance(_source["projects"], list):
for proj in _source["projects"][:size]: # Limit to avoid bloat
projects.append(
DfgPersonSummary(
person_id=person_id,
project_ref_id=proj.get("project_id"),
full_name=full_name,
role_label_en=proj.get("role_label_en"),
role_label_de=proj.get("role_label_de"),
institution=institution,
)
)
# If no projects, still create a summary
if not projects:
projects.append(
DfgPersonSummary(
person_id=person_id,
project_ref_id=None,
full_name=full_name,
role_label_en=None,
role_label_de=None,
institution=institution,
)
)
# Add all project summaries
persons.extend(projects)
return DfgPersonSummaryPage(
elements=persons,
total=hits_block.get("total", {}).get("value", len(persons)),
page=page,
size=size,
)
async def get_persons_by_ids(person_ids: List[str]) -> DfgPersonSummaryPage:
"""Retrieves persons by their IDs.
Args:
person_ids (List[str]): List of person IDs (as strings).
Returns:
DfgPersonSummaryPage: Page of persons matching the IDs.
"""
logger.debug(f"Fetching persons for IDs: {person_ids}")
if not person_ids:
return DfgPersonSummaryPage(elements=[], total=0, page=0, size=0)
return await search_persons(
page=0,
size=len(person_ids),
query={
"terms": {
"id": person_ids # or "person_id", depending on index mapping
}
},
source=[
"id",
"person_id",
"full_name",
"orcid_id",
"is_deceased",
"institute_name_de",
"institute_name_en",
"institute_id",
"root_name_de",
"root_name_en",
"root_id",
],
)
async def autocomplete_persons(
query: str,
page: int = 0,
size: int = 10,
source: Optional[List[str]] = None,
) -> DfgPersonSummaryPage:
"""Autocomplete persons based on full name or ORCID.
Args:
query (str): Search term.
page (int, optional): Page number. Defaults to 0.
size (int, optional): Results per page. Defaults to 10.
source (Optional[List[str]], optional): Fields to include. Defaults to None.
Returns:
DfgPersonSummaryPage: Matching persons.
"""
logger.debug(f"Autocomplete persons for query: {query}")
if not query:
return DfgPersonSummaryPage(elements=[], total=0, page=0, size=0)
return await search_persons(
page=page,
size=size,
query={
"bool": {
"should": [
{
"match_phrase_prefix": {
"full_name": {
"query": query,
"max_expansions": 50,
"analyzer": "searchabilityAnalyzer"
}
}
},
{
"match_phrase_prefix": {
"orcid_id": {
"query": query,
"max_expansions": 50
}
}
},
],
"minimum_should_match": 1,
}
},
source=source or [
"id",
"person_id",
"full_name",
"orcid_id",
"institute_name_de",
"institute_name_en",
"institute_id",
"root_name_de",
"root_name_en",
"root_id",
"projects",
],
)
async def autocomplete_persons_for_selector(
query: str,
page: int = 0,
size: int = 10,
) -> DfgPersonSummaryPage:
"""Autocomplete persons for use in a selector UI component.
Args:
query (str): Search term.
page (int, optional): Page number. Defaults to 0.
size (int, optional): Results per page. Defaults to 10.
Returns:
DfgPersonSummaryPage: Matching persons with minimal fields.
"""
return await autocomplete_persons(
query=query,
page=page,
size=size,
source=[
"id",
"person_id",
"full_name",
"orcid_id",
"institute_name_de",
"institute_name_en",
"institute_id",
"root_name_de",
"root_name_en",
"root_id",
],
)
+2 -2
View File
@@ -34,7 +34,7 @@ from typing import Union
logger = logging.getLogger(__name__)
async def get_dfg_author_names_by_ids(author_ids: List[str]) -> Optional[List[str]]:
async def get_dfg_author_names_by_ids(author_ids: List[int]) -> Optional[List[str]]:
try:
body = {
"_source": ["id", "full_name"],
@@ -53,7 +53,7 @@ async def get_dfg_author_names_by_ids(author_ids: List[str]) -> Optional[List[st
logger.exception(f"Error fetching author names for ids {author_ids}: {str(e)}")
return []
async def get_dfg_institution_names_by_ids(institution_ids: List[str]) -> Optional[List[str]]:
async def get_dfg_institution_names_by_ids(institution_ids: List[int]) -> Optional[List[str]]:
try:
body = {
"_source": ["id","institute_name_de","institute_name_en"],
+24 -28
View File
@@ -12,6 +12,7 @@ from inse.model import ESIndex
from inse.models.projects_eu_cordis.horizon2020.h2020_project_details import H2020ProjectDetails
from inse.models.projects_eu_cordis.horizon_europe.heu_project_details import HEUProjectDetails
from inse.models.projects_eu_cordis.fp7.fp7_project_details import Fp7ProjectDetails
from inse.models.projects_dfg_v2.project.dfg_project_fachgebiete_inner import DFGProjectFachgebieteInner
from typing import Union
class ProjectType(StrEnum):
@@ -86,17 +87,23 @@ class EuProjectPage(Page):
)
class DfgInstitutionSummary(BaseModel):
"""A summary of a DFG institution."""
id: int
name_de: Optional[str] = None
name_en: Optional[str] = None
institute_name_de: Optional[str] = None
institute_name_en: Optional[str] = None
root_id: Optional[int] = None
root_name_de: Optional[str] = None
root_name_en: Optional[str] = None
address_country_de: Optional[str] = None
address_country_en: Optional[str] = None
class DfgPersonSummary(BaseModel):
person_id: int
project_ref_id: int
orcid_id: Optional[str] = None
project_ref_id: Optional[int] = None
full_name: Optional[str] = None
role_label_en: Optional[str] = None,
role_label_de: Optional[str] = None,
root_institution: Optional[DfgInstitutionSummary] = None,
institution: Optional[DfgInstitutionSummary] = None
@@ -132,14 +139,6 @@ class DfgProjectSummary(BaseModel):
description="The funding end date of the DFG project."
)
root_institutions: List[DfgInstitutionSummary] = Field(
default_factory=list,
description=(
"Root institutions associated with the project "
"(e.g. universities or umbrella organizations)."
),
)
institutions: List[DfgInstitutionSummary] = Field(
default_factory=list,
description="Institutions associated with the project."
@@ -152,6 +151,10 @@ class DfgProjectSummary(BaseModel):
default_factory=list,
description="The persons involved in the DFG project.",
)
subject_classifications: Optional[List[DFGProjectFachgebieteInner]] = Field(
default=None,
description="The subject classifications of the DFG project.",
)
@classmethod
def from_hit(cls, hit: dict) -> "DfgProjectSummary":
source = hit.get("_source", {})
@@ -159,7 +162,6 @@ class DfgProjectSummary(BaseModel):
names = []
institutions = {}
root_institutions = {}
project_persons = []
persons = source.get("persons", [])
@@ -178,35 +180,29 @@ class DfgProjectSummary(BaseModel):
if person.get("institute_id") is not None:
institution = DfgInstitutionSummary(
id=person["institute_id"],
name_de=person.get("institute_name_de"),
name_en=person.get("institute_name_en"),
institute_name_de=person.get("institute_name_de"),
institute_name_en=person.get("institute_name_en"),
address_country_de=person.get("address_country_de"),
address_country_en=person.get("address_country_en"),
root_id=person["root_id"],
root_name_de=person.get("root_name_de"),
root_name_en=person.get("root_name_en"),
)
institutions[person["institute_id"]] = institution
root_institution = None
if person.get("root_id") is not None:
root_institution = DfgInstitutionSummary(
id=person["root_id"],
name_de=person.get("root_name_de"),
name_en=person.get("root_name_en"),
)
root_institutions[person["root_id"]] = root_institution
if person.get("person_id") is not None:
project_persons.append(
DfgPersonSummary(
person_id=person["person_id"],
project_ref_id=person.get("project_ref_id"),
orcid_id=person.get("orcid_id"),
full_name=full_name,
role_label_en=person.get("role_label_en"),
role_label_de=person.get("role_label_de"),
root_institution=root_institution,
institution=institution,
)
)
return cls(
id=hit.get("_id", ""),
link=source.get("link") or source.get("page_url"),
@@ -230,10 +226,10 @@ class DfgProjectSummary(BaseModel):
if source.get("funding_end") is not None
else None
),
root_institutions=list(root_institutions.values()),
institutions=list(institutions.values()),
names=names,
persons=project_persons,
subject_classifications=[DFGProjectFachgebieteInner.from_dict(cls) for cls in source.get('subject_classifications', [])]
)
@@ -625,6 +625,7 @@ async def search_dfg_projects(
"subject_area_de",
"subject_area_en",
"persons",
"subject_classifications",
],
"query": {},
}
@@ -637,7 +638,7 @@ async def search_dfg_projects(
{
"multi_match": {
"query": topic,
"fields": ["title", "title_de", "title_en","abstract_de","abstract_en","subject_area_de","subject_area_en"],
"fields": ["title", "title_de", "title_en","abstract_de","abstract_en","subject_area_de","subject_area_en","subject_classifications.fach","subject_classifications.fachkollegium","subject_classifications.fachgebiet,subject_classifications.fachgebiet_de","subject_classifications.wissenschaftsbereich"],
"type": "phrase_prefix",
"max_expansions": 100,
}
@@ -779,6 +780,7 @@ async def search_dfg_projects(
sort_config = {"id": {"order": sort_direction}}
body["sort"] = [sort_config]
print(body)
response = await elasticsearch.search(
index=ESIndex.PROJECTS_DFG_ALL,
body=body,
@@ -812,6 +814,10 @@ async def search_dfg_projects(
person["institute_name_de"] = institute.get("institute_name_de")
person["institute_name_en"] = institute.get("institute_name_en")
person["address_country_de"] = institute.get("address_country_de")
person["address_country_en"] = institute.get("address_country_en")
return _complete_response_to_dfg_project_page(response, page, size)
@@ -896,6 +902,8 @@ async def get_person_institutes(
"root_name_en",
"institute_name_de",
"institute_name_en",
"address_country_de",
"address_country_en",
],
"query": {
"terms": {
@@ -918,6 +926,8 @@ async def get_person_institutes(
"root_name_en": source.get("root_name_en"),
"institute_name_de": source.get("institute_name_de"),
"institute_name_en": source.get("institute_name_en"),
"address_country_de": source.get("address_country_de"),
"address_country_en": source.get("address_country_en"),
}
return result
+2 -2
View File
@@ -315,9 +315,9 @@ async def get_institution_cordis_eu_projects_funding_over_time(
)
async def get_dfg_projects(
author_id: Annotated[Optional[str], Query(description="The openalex author ID to filter by.")] = None,
author_filter_ids: Annotated[Optional[List[str]], Query(description="The author IDs to filter by.")] = None,
author_filter_ids: Annotated[Optional[List[int]], Query(description="The author IDs to filter by.")] = None,
institution_ids: Annotated[
Optional[List[str]], Query(description="The institution IDs to filter by.")
Optional[List[int]], Query(description="The institution IDs to filter by.")
] = None,
title: Annotated[
Optional[str], Query(description="The title to filter by.")
+2 -2
View File
@@ -149,8 +149,8 @@ async def get_cordis_eu_projects_by_institution_id(
async def get_dfg_projects_by_author_id(
author_id: Optional[str],
author_filter_ids: Optional[List[str]],
institution_ids: Optional[List[str]],
author_filter_ids: Optional[List[int]],
institution_ids: Optional[List[int]],
topics: Optional[List[str]],
title: Optional[str],
funding_years: Optional[List[str]],
@@ -14,7 +14,10 @@ async def test_search_dfg_projects():
assert len(res.elements) > 0
for element in res.elements:
assert element.id is not None
assert any("Wolfgang Ahrens" in name for name in element.names)
assert any(
all(part.lower() in name.lower() for part in "Wolfgang Ahrens".split())
for name in element.names
)
@pytest.mark.anyio
async def test_get_dfg_project_by_id():
@@ -24,5 +27,11 @@ async def test_get_dfg_project_by_id():
assert project is not None
assert project.id == known_id
assert project.title is not None
assert any("Wolfgang Ahrens" in person for person in project.associated_persons)
assert any("Leibniz" in inst for inst in project.institutions)
assert any(
all(part.lower() in person.lower() for part in "Wolfgang Ahrens".split())
for person in project.associated_persons
)
assert any(
"Leibniz" in inst
for inst in project.institutions
)
+3
View File
@@ -19,3 +19,6 @@ class Tags(StrEnum):
INSTITUTIONS_V2 = "Institutions V2"
TOPICS_V2 = "Topics V2"
WORKS_V2 = "Works V2"
DFG_INSTITUTIONS = "DFG Institutions"
DFG_PERSONS = "DFG Persons"
@@ -8,6 +8,8 @@ api/auth.service.ts
api/authorsV2.service.ts
api/bookmarks.service.ts
api/companyConnections.service.ts
api/dFGInstitutions.service.ts
api/dFGPersons.service.ts
api/dashboard.service.ts
api/funding.service.ts
api/iNSEService.service.ts
@@ -74,6 +76,7 @@ model/createOrganizationRequest.ts
model/createPersonBookmark.ts
model/customAuthor.ts
model/customAuthorsListResponse.ts
model/dFGProjectFachgebieteInner.ts
model/dashboardStatisticValue.ts
model/dashboardStatistics.ts
model/dehydratedAuthor.ts
@@ -81,7 +84,9 @@ model/dehydratedFunder.ts
model/dehydratedInstitution.ts
model/dehydratedSource.ts
model/dfgInstitutionSummary.ts
model/dfgInstitutionSummaryPage.ts
model/dfgPersonSummary.ts
model/dfgPersonSummaryPage.ts
model/dfgProjectDetails.ts
model/dfgProjectPage.ts
model/dfgProjectSummary.ts
+5 -1
View File
@@ -6,6 +6,10 @@ export * from './bookmarks.service';
import { BookmarksService } from './bookmarks.service';
export * from './companyConnections.service';
import { CompanyConnectionsService } from './companyConnections.service';
export * from './dFGInstitutions.service';
import { DFGInstitutionsService } from './dFGInstitutions.service';
export * from './dFGPersons.service';
import { DFGPersonsService } from './dFGPersons.service';
export * from './dashboard.service';
import { DashboardService } from './dashboard.service';
export * from './funding.service';
@@ -40,4 +44,4 @@ export * from './works.service';
import { WorksService } from './works.service';
export * from './worksV2.service';
import { WorksV2Service } from './worksV2.service';
export const APIS = [AuthService, AuthorsV2Service, BookmarksService, CompanyConnectionsService, DashboardService, FundingService, INSEServiceService, InstitutionsService, InstitutionsV2Service, KeywordsService, NewsService, OrganizationService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, TopicsV2Service, UniversityRankingsService, WorksService, WorksV2Service];
export const APIS = [AuthService, AuthorsV2Service, BookmarksService, CompanyConnectionsService, DFGInstitutionsService, DFGPersonsService, DashboardService, FundingService, INSEServiceService, InstitutionsService, InstitutionsV2Service, KeywordsService, NewsService, OrganizationService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, TopicsV2Service, UniversityRankingsService, WorksService, WorksV2Service];
@@ -0,0 +1,158 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { DfgInstitutionSummaryPage } from '../model/dfgInstitutionSummaryPage';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
@Injectable({
providedIn: 'root'
})
export class DFGInstitutionsService extends BaseService {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
}
/**
* Returns a list of institutions based on a search term for autocomplete functionality.
* @endpoint get /api/dfg/institutions/autocomplete/selector
* @param query A search term to filter institutions by (partial matches allowed).
* @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 getDfgInstitutionAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgInstitutionSummaryPage>;
public getDfgInstitutionAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
public getDfgInstitutionAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
public getDfgInstitutionAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>query, 'query');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dfg/institutions/autocomplete/selector`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<DfgInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Returns a list of institutions based on their IDs.
* @endpoint get /api/dfg/institutions/ids
* @param institutionIds A list of institution IDs to retrieve.
* @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 getDfgInstitutionsByIds(institutionIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgInstitutionSummaryPage>;
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (institutionIds) {
institutionIds.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'institution_ids');
})
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dfg/institutions/ids`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<DfgInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
@@ -0,0 +1,158 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { DfgPersonSummaryPage } from '../model/dfgPersonSummaryPage';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
@Injectable({
providedIn: 'root'
})
export class DFGPersonsService extends BaseService {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
}
/**
* Returns a list of persons based on a search term for autocomplete functionality.
* @endpoint get /api/dfg/persons/autocomplete/selector
* @param query A search term to filter persons by (partial matches allowed).
* @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 getDfgPersonAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgPersonSummaryPage>;
public getDfgPersonAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgPersonSummaryPage>>;
public getDfgPersonAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgPersonSummaryPage>>;
public getDfgPersonAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>query, 'query');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dfg/persons/autocomplete/selector`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<DfgPersonSummaryPage>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Returns a list of persons based on their IDs.
* @endpoint get /api/dfg/persons/ids
* @param personIds A list of person IDs to retrieve.
* @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 getDfgPersonsByIds(personIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgPersonSummaryPage>;
public getDfgPersonsByIds(personIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgPersonSummaryPage>>;
public getDfgPersonsByIds(personIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgPersonSummaryPage>>;
public getDfgPersonsByIds(personIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (personIds) {
personIds.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'person_ids');
})
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dfg/persons/ids`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<DfgPersonSummaryPage>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
+4 -7
View File
@@ -201,14 +201,13 @@ export class PatentsService extends BaseService {
* @param identifier
* @param prefix
* @param title
* @param fillingDate
* @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 getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PatentEntry>;
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PatentEntry>>;
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PatentEntry>>;
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PatentEntry>;
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PatentEntry>>;
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PatentEntry>>;
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (identifier === null || identifier === undefined) {
throw new Error('Required parameter identifier was null or undefined when calling getPatentByIdOrTitle.');
}
@@ -218,8 +217,6 @@ export class PatentsService extends BaseService {
<any>prefix, 'prefix');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>title, 'title');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>fillingDate, 'filling_date');
let localVarHeaders = this.defaultHeaders;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,25 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* DFGProjectFachgebieteInner
*/
export interface DFGProjectFachgebieteInner {
fach?: string | null;
fach_code?: string | null;
fachgebiet?: string | null;
fachgebiet_code?: string | null;
fachkollegium?: string | null;
fachkollegium_code?: string | null;
wissenschaftsbereich?: string | null;
wissenschaftsbereich_code?: string | null;
}
@@ -8,8 +8,16 @@
* Do not edit the class manually.
*/
/**
* A summary of a DFG institution.
*/
export interface DfgInstitutionSummary {
id: number;
name_de?: string | null;
name_en?: string | null;
institute_name_de?: string | null;
institute_name_en?: string | null;
root_id?: number | null;
root_name_de?: string | null;
root_name_en?: string | null;
address_country_de?: string | null;
address_country_en?: string | null;
}
@@ -0,0 +1,34 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { DfgInstitutionSummary } from './dfgInstitutionSummary';
/**
* A paginated response containing a list of institutions.
*/
export interface DfgInstitutionSummaryPage {
/**
* The elements of the page.
*/
elements?: Array<DfgInstitutionSummary>;
/**
* The page number. (0-based)
*/
page?: number;
/**
* The page size in elements.
*/
size?: number;
/**
* The total number of elements.
*/
total?: number;
}
+2 -2
View File
@@ -11,10 +11,10 @@ import { DfgInstitutionSummary } from './dfgInstitutionSummary';
export interface DfgPersonSummary {
person_id: number;
project_ref_id: number;
orcid_id?: string | null;
project_ref_id?: number | null;
full_name?: string | null;
role_label_en?: string | null;
role_label_de?: string | null;
root_institution?: DfgInstitutionSummary | null;
institution?: DfgInstitutionSummary | null;
}
@@ -0,0 +1,34 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { DfgPersonSummary } from './dfgPersonSummary';
/**
* A paginated response containing a list of persons.
*/
export interface DfgPersonSummaryPage {
/**
* The elements of the page.
*/
elements?: Array<DfgPersonSummary>;
/**
* The page number. (0-based)
*/
page?: number;
/**
* The page size in elements.
*/
size?: number;
/**
* The total number of elements.
*/
total?: number;
}
@@ -8,6 +8,7 @@
* Do not edit the class manually.
*/
import { DfgInstitutionSummary } from './dfgInstitutionSummary';
import { DFGProjectFachgebieteInner } from './dFGProjectFachgebieteInner';
import { DfgPersonSummary } from './dfgPersonSummary';
export interface DfgProjectSummary {
@@ -20,10 +21,6 @@ export interface DfgProjectSummary {
professional_classification?: string | null;
funding_start?: string | null;
funding_end?: string | null;
/**
* Root institutions associated with the project (e.g. universities or umbrella organizations).
*/
root_institutions?: Array<DfgInstitutionSummary>;
/**
* Institutions associated with the project.
*/
@@ -36,4 +33,5 @@ export interface DfgProjectSummary {
* The persons involved in the DFG project.
*/
persons?: Array<DfgPersonSummary>;
subject_classifications?: Array<DFGProjectFachgebieteInner> | null;
}
+3
View File
@@ -43,6 +43,7 @@ export * from './createOrganizationRequest';
export * from './createPersonBookmark';
export * from './customAuthor';
export * from './customAuthorsListResponse';
export * from './dFGProjectFachgebieteInner';
export * from './dashboardStatisticValue';
export * from './dashboardStatistics';
export * from './dehydratedAuthor';
@@ -50,7 +51,9 @@ export * from './dehydratedFunder';
export * from './dehydratedInstitution';
export * from './dehydratedSource';
export * from './dfgInstitutionSummary';
export * from './dfgInstitutionSummaryPage';
export * from './dfgPersonSummary';
export * from './dfgPersonSummaryPage';
export * from './dfgProjectDetails';
export * from './dfgProjectPage';
export * from './dfgProjectSummary';
+6 -4
View File
@@ -41,6 +41,8 @@ import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu-
import { selectedAuthorsResolver } from './resolvers/selected-authors.resolver';
import { authorWorkClassificationPageResolver } from './resolvers/author-work-classification-page.resolver';
import { workClassificationResolver } from './resolvers/work-classification.resolver';
import { selectedDfgAuthorsResolver } from './resolvers/selected-dfg-authors.resolver';
import { selectedDfgInstitutionsResolver } from './resolvers/selected-dfg-institutions.resolver';
export const routes: Routes = [
{
path: '',
@@ -380,10 +382,10 @@ export const routes: Routes = [
resolve: {
dfgProjectPage: dfgProjectsResolver,
personCordisEuProjectPage: personCordisEuProjectPageResolver,
selectedDfgInstitutions: selectedInstitutionsResolver,
selectedDfgAuthors: selectedAuthorsResolver,
selectedEuInstitutions: selectedInstitutionsResolver,
selectedEuAuthors: selectedAuthorsResolver,
selectedDfgInstitutionsPage: selectedDfgInstitutionsResolver,
selectedDfgAuthorsPage: selectedDfgAuthorsResolver,
selectedEuInstitutionsPage: selectedInstitutionsResolver,
selectedEuAuthorsPage: selectedAuthorsResolver,
},
runGuardsAndResolvers: 'always',
},
@@ -214,7 +214,6 @@ export class KeywordsSearchResultsComponent {
this.updateQueryParams(event.checked);
}
updateQueryParams(fuzzy: boolean): void {
console.log('Updating query params with keywords:', fuzzy);
const queryParams = {
fuzzy: fuzzy,
topics: fuzzy ? this.state.topicIds() : null,
@@ -10,7 +10,7 @@
(selectedIndexChange)="onTabChange($event)">
<mat-tab label="DFG">
<app-project-filters
[selectedInstitutions]="selectedDfgInstitutions()"
[selectedInstitutionsPage]="selectedDfgInstitutionsPage()"
[showAuthorFilter]="true"
[showInstitutionFilter]="true" />
<app-dfg-project-table
@@ -19,9 +19,9 @@
[institutionFilterEnabled]="true" />
</mat-tab>
<mat-tab label="EU">
<app-project-filters
[selectedInstitutions]="selectedEuInstitutions()"
[selectedAuthors]="selectedEuAuthors()" />
<!-- <app-project-filters
[selectedInstitutionsPage]="selectedEuInstitutionsPage()"
[selectedAuthorsPage]="selectedEuAuthorsPage()" /> -->
<app-eu-project-table [page]="personCordisEuProjectPage()" />
</mat-tab>
</mat-tab-group>
@@ -1,11 +1,14 @@
import { Component, computed, input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { toSignal } from '@angular/core/rxjs-interop';
import { DfgInstitutionSummaryPage } from '../../api/model/dfgInstitutionSummaryPage';
import {
CordisEuProjectPage,
DfgProjectPage,
Author,
Institution,
AuthorPage,
InstitutionPageV2,
} from '../../api';
import { MatCardModule } from '@angular/material/card';
import { MatTabsModule } from '@angular/material/tabs';
@@ -33,10 +36,10 @@ export class PersonProjectsComponent {
dfgProjectPage = input.required<DfgProjectPage>();
personCordisEuProjectPage = input.required<CordisEuProjectPage>();
selectedDfgInstitutions = input.required<Institution[]>();
selectedDfgAuthors = input.required<Author[]>();
selectedEuInstitutions = input.required<Institution[]>();
selectedEuAuthors = input.required<Author[]>();
selectedDfgInstitutionsPage = input.required<DfgInstitutionSummaryPage>();
selectedDfgAuthorsPage = input.required<AuthorPage>();
selectedEuInstitutionsPage = input.required<InstitutionPageV2>();
selectedEuAuthorsPage = input.required<AuthorPage>();
readonly dfgQueryParamKeys = projectQueryParamKeys;
readonly euQueryParamKeys = euProjectQueryParamKeys;
@@ -35,10 +35,14 @@ export const dfgProjectsResolver: ResolveFn<DfgProjectPage> = (
const topics = route.queryParamMap.getAll(projectQueryParamKeys.topicId);
const years = route.queryParamMap.getAll(projectQueryParamKeys.years);
const institutionIds = route.queryParamMap.getAll(
projectQueryParamKeys.institutionId,
);
const authorIds = route.queryParamMap.getAll(projectQueryParamKeys.authorId);
const institutionIds = route.queryParamMap
.getAll(projectQueryParamKeys.institutionId)
.map((id) => Number(id))
.filter((id) => !isNaN(id));
const authorIds = route.queryParamMap
.getAll(projectQueryParamKeys.authorId)
.map((id) => Number(id))
.filter((id) => !isNaN(id));
console.log(
'RESOLVING',
authorIds,
@@ -0,0 +1,22 @@
import { ResolveFn } from '@angular/router';
import { inject } from '@angular/core';
import { DFGPersonsService } from '../api';
import { DfgPersonSummaryPage } from '../api/model/dfgPersonSummaryPage';
export const selectedDfgAuthorsResolver: ResolveFn<DfgPersonSummaryPage> = (
route,
state,
) => {
const authorIdQueryParamKey =
(route.data['authorIdQueryParamKey'] as string) || 'authorId';
const authorIds = route.queryParamMap.getAll(authorIdQueryParamKey);
if (authorIds.length === 0) {
return { elements: [] };
}
return inject(DFGPersonsService).getDfgPersonsByIds(
authorIds.map((id) => id.trim()).filter((id) => id.length > 0),
);
};
@@ -0,0 +1,17 @@
import { inject } from '@angular/core';
import { ResolveFn } from '@angular/router';
import { DFGInstitutionsService } from '../api';
import { DfgInstitutionSummaryPage } from '../api/model/dfgInstitutionSummaryPage';
export const selectedDfgInstitutionsResolver: ResolveFn<
DfgInstitutionSummaryPage
> = (route, state) => {
const institutionIdQueryParamKey =
(route.data['institutionIdQueryParamKey'] as string) || 'institutionId';
const institutionIds = route.queryParamMap.getAll(institutionIdQueryParamKey);
return inject(DFGInstitutionsService).getDfgInstitutionsByIds(
institutionIds.map((id) => id.trim()).filter((id) => id.length > 0),
);
};
@@ -83,7 +83,9 @@
[attr.aria-label]="getInstitutionTooltipText(institution)"
(click)="filterByInstitution(institution)">
<mat-icon class="institution-icon">apartment</mat-icon>
<span class="institution-name">{{ institution.name_de }}</span>
<span class="institution-name">{{
institution.institute_name_de || institution.institute_name_en
}}</span>
</button>
} @empty {
<span class="empty-text">-</span>
@@ -99,7 +99,7 @@ export class DfgProjectTableComponent implements OnInit {
},
{
id: 'names',
header: 'user',
header: 'Autoren',
type: 'accessor',
accessorKey: 'names',
cellTemplate: this.authorsTmp(),
@@ -229,7 +229,7 @@ export class DfgProjectTableComponent implements OnInit {
}
getProjectInstitutionName(institution: any): string {
return institution.name_de ?? institution.name_en;
return institution.institute_name_de ?? institution.institute_name_en;
}
isInstitutionActive(
@@ -8,7 +8,7 @@
}
<div class="select-area">
@if (showInstitutionFilter()) {
<app-searchable-institution-select
<app-searchable-dfg-institution-select
[label]="institutionLabel()"
[selectedInstitutions]="selectedInstitutions()"
(handleInstitutionSelectChange)="
@@ -22,7 +22,7 @@
(handleYearSelectChange)="handleYearSelectChange($event)" />
}
@if (showAuthorFilter()) {
<app-searchable-author-select
<app-searchable-dfg-author-select
[label]="authorLabel()"
[selectedAuthors]="selectedAuthors()"
(handleAuthorSelectChange)="handleAuthorSelectChange($event)" />
@@ -3,10 +3,19 @@ import { Router } from '@angular/router';
import { toSignal } from '@angular/core/rxjs-interop';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { Author, Institution } from '../../../api';
import { DfgInstitutionSummaryPage } from '../../../api/model/dfgInstitutionSummaryPage';
import { DfgInstitutionSummary } from '../../../api/model/dfgInstitutionSummary';
import {
Author,
AuthorPage,
DfgPersonSummary,
DfgPersonSummaryPage,
Institution,
InstitutionPageV2,
} from '../../../api';
import { QueryParamInputComponent } from '../query-param-input/query-param-input.component';
import { SearchableInstitutionSelectComponent } from '../searchable-institution-select/searchable-institution-select.component';
import { SearchableAuthorSelectComponent } from '../searchable-author-select/searchable-author-select.component';
import { SearchableDfgInstitutionSelectComponent } from '../searchable-dfg-institution-select/searchable-dfg-institution-select.component';
import { SearchableYearSelectComponent } from '../searchable-year-select/searchable-year-select.component';
import { projectQueryParamKeys } from '../../../resolvers/dfg-projects.resolver';
import {
@@ -14,6 +23,7 @@ import {
SelectedFiltersComponent,
} from '../selected-filters/selected-filters.component';
import { map } from 'rxjs/internal/operators/map';
import { SearchableDfgAuthorSelectComponent } from '../searchable-dfg-author-select/searchable-dfg-author-select.component';
@Component({
selector: 'app-project-filters',
@@ -21,8 +31,8 @@ import { map } from 'rxjs/internal/operators/map';
MatButtonModule,
MatIconModule,
QueryParamInputComponent,
SearchableInstitutionSelectComponent,
SearchableAuthorSelectComponent,
SearchableDfgInstitutionSelectComponent,
SearchableDfgAuthorSelectComponent,
SearchableYearSelectComponent,
SelectedFiltersComponent,
],
@@ -35,9 +45,20 @@ export class ProjectFilterComponent {
// Each tab (DFG / EU) passes its OWN key set so they never collide.
queryParamKeys = projectQueryParamKeys;
selectedInstitutions = input<Institution[]>([]);
selectedTopics = input<string[]>([]);
selectedAuthors = input<Author[]>([]);
// selectedAuthorsPage = input<AuthorPage>();
// selectedAuthors = computed<Author[]>(
// () => this.selectedAuthorsPage()?.elements || [],
// );
selectedAuthorsPage = input<DfgPersonSummaryPage>();
selectedAuthors = computed<DfgPersonSummary[]>(
() => this.selectedAuthorsPage()?.elements || [],
);
selectedInstitutionsPage = input<DfgInstitutionSummaryPage>();
selectedInstitutions = computed<DfgInstitutionSummary[]>(
() => this.selectedInstitutionsPage()?.elements || [],
);
showTitleFilter = input<boolean>(true);
showInstitutionFilter = input<boolean>(true);
@@ -72,19 +93,20 @@ export class ProjectFilterComponent {
institutionLabel = computed(() => {
const selected = this.selectedInstitutions().filter((i) =>
this.selectedInstitutionIds().includes(i.id!),
this.selectedInstitutionIds().includes(String(i.id!)),
);
if (selected.length === 0) return 'Institution';
if (selected.length === 1) return selected[0].display_name ?? 'Institution';
if (selected.length === 1)
return selected[0].institute_name_de ?? 'Institution';
return `${selected.length} Institutionen`;
});
authorLabel = computed(() => {
const selected = this.selectedAuthors().filter((a) =>
this.selectedAuthorIds().includes(a.id!),
this.selectedAuthorIds().includes(String(a.person_id!)),
);
if (selected.length === 0) return 'Autor';
if (selected.length === 1) return selected[0].display_name ?? 'Autor';
if (selected.length === 1) return selected[0].full_name ?? 'Autor';
return `${selected.length} Autoren`;
});
@@ -102,16 +124,16 @@ export class ProjectFilterComponent {
queryParamKey: keys.institutionId,
icon: 'apartment',
valueFormatter: (value: string) =>
this.selectedInstitutions().find((i) => i.id === value)
?.display_name ?? value,
this.selectedInstitutions().find((i) => String(i.id) === value)
?.institute_name_de ?? value,
},
{
id: 'authors',
queryParamKey: keys.authorId,
icon: 'person',
valueFormatter: (value: string) =>
this.selectedAuthors().find((a) => a.id === value)?.display_name ??
value,
this.selectedAuthors().find((a) => String(a.person_id) === value)
?.full_name ?? value,
},
];
});
@@ -138,13 +160,15 @@ export class ProjectFilterComponent {
});
}
};
handleInstitutionSelectChange = (institution: Institution): void => {
handleInstitutionSelectChange = (
institution: DfgInstitutionSummary,
): void => {
if (!institution.id) return;
const keys = this.queryParamKeys;
const selectedIds = this.selectedInstitutionIds();
const nextIds = selectedIds.includes(institution.id)
? selectedIds.filter((id) => id !== institution.id)
: [...selectedIds, institution.id];
const nextIds = selectedIds.includes(String(institution.id))
? selectedIds.filter((id) => id !== String(institution.id))
: [...selectedIds, String(institution.id)];
this.router.navigate([], {
queryParams: { [keys.institutionId]: nextIds, [keys.page]: 0 },
@@ -152,13 +176,13 @@ export class ProjectFilterComponent {
});
};
handleAuthorSelectChange = (author: Author): void => {
if (!author.id) return;
handleAuthorSelectChange = (author: DfgPersonSummary): void => {
if (!author.person_id) return;
const keys = this.queryParamKeys;
const selectedIds = this.selectedAuthorIds();
const nextIds = selectedIds.includes(author.id)
? selectedIds.filter((id) => id !== author.id)
: [...selectedIds, author.id];
const nextIds = selectedIds.includes(String(author.person_id))
? selectedIds.filter((id) => id !== String(author.person_id))
: [...selectedIds, String(author.person_id)];
this.router.navigate([], {
queryParams: { [keys.authorId]: nextIds, [keys.page]: 0 },
@@ -0,0 +1,12 @@
<app-searchable-select
inputPlaceholder="Autoren suchen..."
icon="person"
[label]="label()"
selectedLabel="Ausgewählte Autoren"
fetchedLabel="Gefundene Autoren"
[fetchElements]="fetchAuthors"
[selectedElements]="selectedAuthors()"
[getSelectLabel]="getAuthorLabel"
[getSelectValue]="getAuthorValue"
[getSelectDescription]="getAuthorDescription"
(handleSelectChange)="handleAuthorSelectChange.emit($event)" />
@@ -0,0 +1,44 @@
import { Component, inject, input, output } from '@angular/core';
import { DFGPersonsService } from '../../../api';
import { DfgPersonSummaryPage } from '../../../api/model/dfgPersonSummaryPage';
import { DfgPersonSummary } from '../../../api/model/dfgPersonSummary';
import { Observable } from 'rxjs';
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
@Component({
selector: 'app-searchable-dfg-author-select',
imports: [SearchableSelectComponent],
templateUrl: './searchable-dfg-author-select.component.html',
styleUrl: './searchable-dfg-author-select.component.scss',
})
export class SearchableDfgAuthorSelectComponent {
private readonly dfgPersonsService = inject(DFGPersonsService);
label = input<string>('Authoren');
selectedAuthors = input.required<DfgPersonSummary[]>();
handleAuthorSelectChange = output<DfgPersonSummary>();
fetchAuthors = (searchTerm: string): Observable<DfgPersonSummaryPage> => {
return this.dfgPersonsService.getDfgPersonAutocompleteForSelector(
searchTerm,
);
};
getAuthorLabel = (author: DfgPersonSummary): string => {
return author.full_name!;
};
getAuthorValue = (author: DfgPersonSummary): string => {
return String(author.person_id!);
};
getAuthorDescription = (author: DfgPersonSummary): string => {
const orcidId = author.orcid_id ?? 'Unbekannt';
const roleLabel =
(author.role_label_de || author.role_label_en) ?? 'Unbekannt';
const rootInstitution = author.institution?.root_name_de ?? 'Unbekannt';
const institution = author.institution?.institute_name_de ?? 'Unbekannt';
return `ORCID: ${orcidId} - Rolle: ${roleLabel} - Wurzelinstitution: ${rootInstitution} - Institution: ${institution}`;
};
}
@@ -0,0 +1,12 @@
<app-searchable-select
inputPlaceholder="Institution suchen..."
icon="apartment"
[label]="label()"
selectedLabel="Ausgewählte Institutionen"
fetchedLabel="Gefundene Institutionen"
[fetchElements]="fetchInstitutions"
[selectedElements]="selectedInstitutions()"
[getSelectLabel]="getInstitutionLabel"
[getSelectValue]="getInstitutionValue"
[getSelectDescription]="getInstitutionDescription"
(handleSelectChange)="handleInstitutionSelectChange.emit($event)" />
@@ -0,0 +1,43 @@
import { Component, inject, input, output } from '@angular/core';
import { DfgInstitutionSummaryPage } from '../../../api/model/dfgInstitutionSummaryPage';
import { DfgInstitutionSummary } from '../../../api/model/dfgInstitutionSummary';
import { DFGInstitutionsService } from '../../../api';
import { Observable } from 'rxjs';
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
@Component({
selector: 'app-searchable-dfg-institution-select',
imports: [SearchableSelectComponent],
templateUrl: './searchable-dfg-institution-select.component.html',
styleUrl: './searchable-dfg-institution-select.component.scss',
})
export class SearchableDfgInstitutionSelectComponent {
private readonly dfgInstitutionService = inject(DFGInstitutionsService);
label = input<string>('Institutionen');
selectedInstitutions = input.required<DfgInstitutionSummary[]>();
handleInstitutionSelectChange = output<DfgInstitutionSummary>();
fetchInstitutions = (
searchTerm: string,
): Observable<DfgInstitutionSummaryPage> => {
return this.dfgInstitutionService.getDfgInstitutionAutocompleteForSelector(
searchTerm,
);
};
getInstitutionLabel = (institution: DfgInstitutionSummary): string => {
return institution.institute_name_de! || institution.institute_name_en!;
};
getInstitutionValue = (institution: DfgInstitutionSummary): string => {
return Number(institution.id!).toString();
};
getInstitutionDescription = (institution: DfgInstitutionSummary): string => {
return (
institution.root_name_de! + ' (' + institution.address_country_de! + ')'
);
};
}