generated models for EU projects horizon_europe programm indexes

This commit is contained in:
2026-06-22 23:57:04 +02:00
parent ee7bd7ba05
commit 6ae5f3e620
10 changed files with 1206 additions and 0 deletions
@@ -0,0 +1,103 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index 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, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class HEUDeliverable(BaseModel):
"""
HEUDeliverable
""" # noqa: E501
collection: Optional[StrictStr] = None
content_update_date: Optional[datetime] = Field(default=None, alias="contentUpdateDate")
deliverable_type: Optional[StrictStr] = Field(default=None, alias="deliverableType")
description: Optional[StrictStr] = None
project_acronym: Optional[StrictStr] = Field(default=None, alias="projectAcronym")
project_id: Optional[StrictStr] = Field(default=None, alias="projectID")
rcn: Optional[StrictStr] = None
url: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["collection", "contentUpdateDate", "deliverableType", "description", "projectAcronym", "projectID", "rcn", "url"]
model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(to_jsonable_python(self.to_dict()))
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of HEUDeliverable 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 HEUDeliverable from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"collection": obj.get("collection"),
"contentUpdateDate": obj.get("contentUpdateDate"),
"deliverableType": obj.get("deliverableType"),
"description": obj.get("description"),
"projectAcronym": obj.get("projectAcronym"),
"projectID": obj.get("projectID"),
"rcn": obj.get("rcn"),
"url": obj.get("url")
})
return _obj
@@ -0,0 +1,98 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index 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, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class HEUEurosciVoc(BaseModel):
"""
HEUEurosciVoc
""" # noqa: E501
code: Optional[StrictStr] = None
description: Optional[StrictStr] = None
id: Optional[StrictStr] = None
path: Optional[StrictStr] = None
project_id: Optional[StrictStr] = Field(default=None, alias="projectID")
title: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["code", "description", "id", "path", "projectID", "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 HEUEurosciVoc 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 HEUEurosciVoc from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"code": obj.get("code"),
"description": obj.get("description"),
"id": obj.get("id"),
"path": obj.get("path"),
"projectID": obj.get("projectID"),
"title": obj.get("title")
})
return _obj
@@ -0,0 +1,96 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index 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, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class HEULegalBasis(BaseModel):
"""
HEULegalBasis
""" # noqa: E501
id: Optional[StrictStr] = None
legal_basis: Optional[StrictStr] = Field(default=None, alias="legalBasis")
project_id: Optional[StrictStr] = Field(default=None, alias="projectID")
title: Optional[StrictStr] = None
unique_programme_part: Optional[StrictStr] = Field(default=None, alias="uniqueProgrammePart")
__properties: ClassVar[List[str]] = ["id", "legalBasis", "projectID", "title", "uniqueProgrammePart"]
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 HEULegalBasis 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 HEULegalBasis from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"id": obj.get("id"),
"legalBasis": obj.get("legalBasis"),
"projectID": obj.get("projectID"),
"title": obj.get("title"),
"uniqueProgrammePart": obj.get("uniqueProgrammePart")
})
return _obj
@@ -0,0 +1,139 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index 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, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class HEUOrganization(BaseModel):
"""
HEUOrganization
""" # noqa: E501
sme: Optional[StrictBool] = Field(default=None, alias="SME")
active: Optional[StrictBool] = None
activity_type: Optional[StrictStr] = Field(default=None, alias="activityType")
city: Optional[StrictStr] = None
contact_form: Optional[StrictStr] = Field(default=None, alias="contactForm")
content_update_date: Optional[datetime] = Field(default=None, alias="contentUpdateDate")
country: Optional[StrictStr] = None
ec_contribution: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="ecContribution")
end_of_participation: Optional[StrictBool] = Field(default=None, alias="endOfParticipation")
geolocation: Optional[StrictStr] = None
id: Optional[StrictStr] = None
name: Optional[StrictStr] = None
net_ec_contribution: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="netEcContribution")
nuts_code: Optional[StrictStr] = Field(default=None, alias="nutsCode")
order: Optional[StrictInt] = None
organisation_id: Optional[StrictStr] = Field(default=None, alias="organisationID")
organization_url: Optional[StrictStr] = Field(default=None, alias="organizationURL")
post_code: Optional[StrictStr] = Field(default=None, alias="postCode")
project_acronym: Optional[StrictStr] = Field(default=None, alias="projectAcronym")
project_id: Optional[StrictStr] = Field(default=None, alias="projectID")
rcn: Optional[StrictStr] = None
role: Optional[StrictStr] = None
short_name: Optional[StrictStr] = Field(default=None, alias="shortName")
street: Optional[StrictStr] = None
total_cost: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="totalCost")
vat_number: Optional[StrictStr] = Field(default=None, alias="vatNumber")
__properties: ClassVar[List[str]] = ["SME", "active", "activityType", "city", "contactForm", "contentUpdateDate", "country", "ecContribution", "endOfParticipation", "geolocation", "id", "name", "netEcContribution", "nutsCode", "order", "organisationID", "organizationURL", "postCode", "projectAcronym", "projectID", "rcn", "role", "shortName", "street", "totalCost", "vatNumber"]
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 HEUOrganization 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 HEUOrganization from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"SME": obj.get("SME"),
"active": obj.get("active"),
"activityType": obj.get("activityType"),
"city": obj.get("city"),
"contactForm": obj.get("contactForm"),
"contentUpdateDate": obj.get("contentUpdateDate"),
"country": obj.get("country"),
"ecContribution": obj.get("ecContribution"),
"endOfParticipation": obj.get("endOfParticipation"),
"geolocation": obj.get("geolocation"),
"id": obj.get("id"),
"name": obj.get("name"),
"netEcContribution": obj.get("netEcContribution"),
"nutsCode": obj.get("nutsCode"),
"order": obj.get("order"),
"organisationID": obj.get("organisationID"),
"organizationURL": obj.get("organizationURL"),
"postCode": obj.get("postCode"),
"projectAcronym": obj.get("projectAcronym"),
"projectID": obj.get("projectID"),
"rcn": obj.get("rcn"),
"role": obj.get("role"),
"shortName": obj.get("shortName"),
"street": obj.get("street"),
"totalCost": obj.get("totalCost"),
"vatNumber": obj.get("vatNumber")
})
return _obj
@@ -0,0 +1,131 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index 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 date, datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class HEUProject(BaseModel):
"""
HEUProject
""" # noqa: E501
acronym: Optional[StrictStr] = None
content_update_date: Optional[datetime] = Field(default=None, alias="contentUpdateDate")
ec_max_contribution: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="ecMaxContribution")
ec_signature_date: Optional[date] = Field(default=None, alias="ecSignatureDate")
end_date: Optional[date] = Field(default=None, alias="endDate")
framework_programme: Optional[StrictStr] = Field(default=None, alias="frameworkProgramme")
funding_scheme: Optional[StrictStr] = Field(default=None, alias="fundingScheme")
grant_doi: Optional[StrictStr] = Field(default=None, alias="grantDoi")
human_validated: Optional[StrictBool] = Field(default=None, alias="humanValidated")
id: Optional[StrictStr] = None
keywords: Optional[StrictStr] = None
legal_basis: Optional[StrictStr] = Field(default=None, alias="legalBasis")
master_call: Optional[StrictStr] = Field(default=None, alias="masterCall")
nature: Optional[StrictStr] = None
objective: Optional[StrictStr] = None
rcn: Optional[StrictStr] = None
start_date: Optional[date] = Field(default=None, alias="startDate")
status: Optional[StrictStr] = None
sub_call: Optional[StrictStr] = Field(default=None, alias="subCall")
title: Optional[StrictStr] = None
topics: Optional[StrictStr] = None
total_cost: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="totalCost")
__properties: ClassVar[List[str]] = ["acronym", "contentUpdateDate", "ecMaxContribution", "ecSignatureDate", "endDate", "frameworkProgramme", "fundingScheme", "grantDoi", "humanValidated", "id", "keywords", "legalBasis", "masterCall", "nature", "objective", "rcn", "startDate", "status", "subCall", "title", "topics", "totalCost"]
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 HEUProject 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 HEUProject from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"acronym": obj.get("acronym"),
"contentUpdateDate": obj.get("contentUpdateDate"),
"ecMaxContribution": obj.get("ecMaxContribution"),
"ecSignatureDate": obj.get("ecSignatureDate"),
"endDate": obj.get("endDate"),
"frameworkProgramme": obj.get("frameworkProgramme"),
"fundingScheme": obj.get("fundingScheme"),
"grantDoi": obj.get("grantDoi"),
"humanValidated": obj.get("humanValidated"),
"id": obj.get("id"),
"keywords": obj.get("keywords"),
"legalBasis": obj.get("legalBasis"),
"masterCall": obj.get("masterCall"),
"nature": obj.get("nature"),
"objective": obj.get("objective"),
"rcn": obj.get("rcn"),
"startDate": obj.get("startDate"),
"status": obj.get("status"),
"subCall": obj.get("subCall"),
"title": obj.get("title"),
"topics": obj.get("topics"),
"totalCost": obj.get("totalCost")
})
return _obj
@@ -0,0 +1,214 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index API - Extended Models
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from datetime import date, datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
# Import all the base models
from inse.models.projects_eu_cordis.horizon_europe.heu_project import HEUProject
from inse.models.projects_eu_cordis.horizon_europe.heu_organization import HEUOrganization
from inse.models.projects_eu_cordis.horizon_europe.heu_publication import HEUPublication
from inse.models.projects_eu_cordis.horizon_europe.heu_deliverable import HEUDeliverable
from inse.models.projects_eu_cordis.horizon_europe.heu_report_summary import HEUReportSummary
from inse.models.projects_eu_cordis.horizon_europe.heu_topic import HEUTopic
from inse.models.projects_eu_cordis.horizon_europe.heu_web_link import HEUWebLink
from inse.models.projects_eu_cordis.horizon_europe.heu_eurosci_voc import HEUEurosciVoc
from inse.models.projects_eu_cordis.horizon_europe.heu_legal_basis import HEULegalBasis
class HEUProjectDetails(BaseModel):
"""
Comprehensive Horizon Europe Project model combining all related entities.
This model extends the base HEUProject with all associated data.
"""
# Project core information (flattened from HEUProject)
acronym: Optional[StrictStr] = None
content_update_date: Optional[datetime] = Field(default=None, alias="contentUpdateDate")
ec_max_contribution: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="ecMaxContribution")
ec_signature_date: Optional[date] = Field(default=None, alias="ecSignatureDate")
end_date: Optional[date] = Field(default=None, alias="endDate")
framework_programme: Optional[StrictStr] = Field(default=None, alias="frameworkProgramme")
funding_scheme: Optional[StrictStr] = Field(default=None, alias="fundingScheme")
grant_doi: Optional[StrictStr] = Field(default=None, alias="grantDoi")
human_validated: Optional[StrictBool] = Field(default=None, alias="humanValidated")
id: Optional[StrictStr] = None
keywords: Optional[StrictStr] = None
legal_basis: Optional[StrictStr] = Field(default=None, alias="legalBasis")
master_call: Optional[StrictStr] = Field(default=None, alias="masterCall")
nature: Optional[StrictStr] = None
objective: Optional[StrictStr] = None
rcn: Optional[StrictStr] = None
start_date: Optional[date] = Field(default=None, alias="startDate")
status: Optional[StrictStr] = None
sub_call: Optional[StrictStr] = Field(default=None, alias="subCall")
title: Optional[StrictStr] = None
topics: Optional[StrictStr] = None
total_cost: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="totalCost")
# Related entities (collections)
organizations: Optional[List[HEUOrganization]] = Field(default=None, description="Organizations participating in the project")
publications: Optional[List[HEUPublication]] = Field(default=None, description="Publications related to the project")
deliverables: Optional[List[HEUDeliverable]] = Field(default=None, description="Deliverables of the project")
report_summaries: Optional[List[HEUReportSummary]] = Field(default=None, alias="reportSummaries", description="Report summaries for the project")
topics_list: Optional[List[HEUTopic]] = Field(default=None, alias="topicsList", description="Topics associated with the project")
web_links: Optional[List[HEUWebLink]] = Field(default=None, alias="webLinks", description="Web links related to the project")
eurosci_voc: Optional[List[HEUEurosciVoc]] = Field(default=None, alias="eurosciVoc", description="EuroSciVoc classifications")
legal_basis_list: Optional[List[HEULegalBasis]] = Field(default=None, alias="legalBasisList", description="Legal basis information")
# Project statistics (aggregated)
organization_count: Optional[int] = Field(default=None, alias="organizationCount")
publication_count: Optional[int] = Field(default=None, alias="publicationCount")
deliverable_count: Optional[int] = Field(default=None, alias="deliverableCount")
__properties: ClassVar[List[str]] = [
"acronym", "contentUpdateDate", "ecMaxContribution", "ecSignatureDate",
"endDate", "frameworkProgramme", "fundingScheme", "grantDoi",
"humanValidated", "id", "keywords", "legalBasis", "masterCall",
"nature", "objective", "rcn", "startDate", "status", "subCall",
"title", "topics", "totalCost",
"organizations", "publications", "deliverables", "reportSummaries",
"topicsList", "webLinks", "eurosciVoc", "legalBasisList",
"organizationCount", "publicationCount", "deliverableCount"
]
model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
populate_by_name=True,
)
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 HEUProjectDetailed 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."""
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 HEUProjectDetailed from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
# Project core fields
"acronym": obj.get("acronym"),
"contentUpdateDate": obj.get("contentUpdateDate"),
"ecMaxContribution": obj.get("ecMaxContribution"),
"ecSignatureDate": obj.get("ecSignatureDate"),
"endDate": obj.get("endDate"),
"frameworkProgramme": obj.get("frameworkProgramme"),
"fundingScheme": obj.get("fundingScheme"),
"grantDoi": obj.get("grantDoi"),
"humanValidated": obj.get("humanValidated"),
"id": obj.get("id"),
"keywords": obj.get("keywords"),
"legalBasis": obj.get("legalBasis"),
"masterCall": obj.get("masterCall"),
"nature": obj.get("nature"),
"objective": obj.get("objective"),
"rcn": obj.get("rcn"),
"startDate": obj.get("startDate"),
"status": obj.get("status"),
"subCall": obj.get("subCall"),
"title": obj.get("title"),
"topics": obj.get("topics"),
"totalCost": obj.get("totalCost"),
# Related entities
"organizations": [HEUOrganization.from_dict(org) for org in obj.get("organizations", [])] if obj.get("organizations") else None,
"publications": [HEUPublication.from_dict(pub) for pub in obj.get("publications", [])] if obj.get("publications") else None,
"deliverables": [HEUDeliverable.from_dict(deliv) for deliv in obj.get("deliverables", [])] if obj.get("deliverables") else None,
"reportSummaries": [HEUReportSummary.from_dict(report) for report in obj.get("reportSummaries", [])] if obj.get("reportSummaries") else None,
"topicsList": [HEUTopic.from_dict(topic) for topic in obj.get("topicsList", [])] if obj.get("topicsList") else None,
"webLinks": [HEUWebLink.from_dict(link) for link in obj.get("webLinks", [])] if obj.get("webLinks") else None,
"eurosciVoc": [HEUEurosciVoc.from_dict(voc) for voc in obj.get("eurosciVoc", [])] if obj.get("eurosciVoc") else None,
"legalBasisList": [HEULegalBasis.from_dict(lb) for lb in obj.get("legalBasisList", [])] if obj.get("legalBasisList") else None,
# Statistics
"organizationCount": len(obj.get("organizations", [])) if obj.get("organizations") else 0,
"publicationCount": len(obj.get("publications", [])) if obj.get("publications") else 0,
"deliverableCount": len(obj.get("deliverables", [])) if obj.get("deliverables") else 0,
})
return _obj
@classmethod
def from_project_with_relations(
cls,
project: HEUProject,
organizations: Optional[List[HEUOrganization]] = None,
publications: Optional[List[HEUPublication]] = None,
deliverables: Optional[List[HEUDeliverable]] = None,
report_summaries: Optional[List[HEUReportSummary]] = None,
topics_list: Optional[List[HEUTopic]] = None,
web_links: Optional[List[HEUWebLink]] = None,
eurosci_voc: Optional[List[HEUEurosciVoc]] = None,
legal_basis_list: Optional[List[HEULegalBasis]] = None,
) -> Self:
"""
Factory method to create a detailed project from a base project and its relations.
Args:
project: The base HEUProject object
organizations: List of organizations participating in the project
publications: List of publications related to the project
deliverables: List of deliverables of the project
report_summaries: List of report summaries
topics_list: List of topics associated with the project
web_links: List of web links
eurosci_voc: List of EuroSciVoc classifications
legal_basis_list: List of legal basis information
Returns:
HEUProjectDetailed instance
"""
project_dict = project.to_dict() if project else {}
return cls(
**project_dict,
organizations=organizations or [],
publications=publications or [],
deliverables=deliverables or [],
reportSummaries=report_summaries or [],
topicsList=topics_list or [],
webLinks=web_links or [],
eurosciVoc=eurosci_voc or [],
legalBasisList=legal_basis_list or [],
organizationCount=len(organizations) if organizations else 0,
publicationCount=len(publications) if publications else 0,
deliverableCount=len(deliverables) if deliverables else 0,
)
@@ -0,0 +1,123 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index 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, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class HEUPublication(BaseModel):
"""
HEUPublication
""" # noqa: E501
authors: Optional[StrictStr] = None
collection: Optional[StrictStr] = None
content_update_date: Optional[datetime] = Field(default=None, alias="contentUpdateDate")
doi: Optional[StrictStr] = None
id: Optional[StrictStr] = None
is_published_as: Optional[StrictStr] = Field(default=None, alias="isPublishedAs")
journal_number: Optional[StrictStr] = Field(default=None, alias="journalNumber")
journal_title: Optional[StrictStr] = Field(default=None, alias="journalTitle")
project_acronym: Optional[StrictStr] = Field(default=None, alias="projectAcronym")
project_id: Optional[StrictStr] = Field(default=None, alias="projectID")
published_pages: Optional[StrictStr] = Field(default=None, alias="publishedPages")
published_year: Optional[StrictInt] = Field(default=None, alias="publishedYear")
publisher: Optional[StrictStr] = None
qa_processed_doi: Optional[StrictStr] = Field(default=None, alias="qaProcessedDoi")
rcn: Optional[StrictStr] = None
repository_url: Optional[StrictStr] = Field(default=None, alias="repositoryUrl")
title: Optional[StrictStr] = None
volume: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["authors", "collection", "contentUpdateDate", "doi", "id", "isPublishedAs", "journalNumber", "journalTitle", "projectAcronym", "projectID", "publishedPages", "publishedYear", "publisher", "qaProcessedDoi", "rcn", "repositoryUrl", "title", "volume"]
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 HEUPublication 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 HEUPublication from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"authors": obj.get("authors"),
"collection": obj.get("collection"),
"contentUpdateDate": obj.get("contentUpdateDate"),
"doi": obj.get("doi"),
"id": obj.get("id"),
"isPublishedAs": obj.get("isPublishedAs"),
"journalNumber": obj.get("journalNumber"),
"journalTitle": obj.get("journalTitle"),
"projectAcronym": obj.get("projectAcronym"),
"projectID": obj.get("projectID"),
"publishedPages": obj.get("publishedPages"),
"publishedYear": obj.get("publishedYear"),
"publisher": obj.get("publisher"),
"qaProcessedDoi": obj.get("qaProcessedDoi"),
"rcn": obj.get("rcn"),
"repositoryUrl": obj.get("repositoryUrl"),
"title": obj.get("title"),
"volume": obj.get("volume")
})
return _obj
@@ -0,0 +1,101 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index 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, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class HEUReportSummary(BaseModel):
"""
HEUReportSummary
""" # noqa: E501
attachments: Optional[StrictStr] = None
content_update_date: Optional[datetime] = Field(default=None, alias="contentUpdateDate")
id: Optional[StrictStr] = None
project_acronym: Optional[StrictStr] = Field(default=None, alias="projectAcronym")
project_id: Optional[StrictStr] = Field(default=None, alias="projectID")
rcn: Optional[StrictStr] = None
title: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["attachments", "contentUpdateDate", "id", "projectAcronym", "projectID", "rcn", "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 HEUReportSummary 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 HEUReportSummary from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"attachments": obj.get("attachments"),
"contentUpdateDate": obj.get("contentUpdateDate"),
"id": obj.get("id"),
"projectAcronym": obj.get("projectAcronym"),
"projectID": obj.get("projectID"),
"rcn": obj.get("rcn"),
"title": obj.get("title")
})
return _obj
@@ -0,0 +1,94 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index 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, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class HEUTopic(BaseModel):
"""
HEUTopic
""" # noqa: E501
id: Optional[StrictStr] = None
project_id: Optional[StrictStr] = Field(default=None, alias="projectID")
title: Optional[StrictStr] = None
topic: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["id", "projectID", "title", "topic"]
model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(to_jsonable_python(self.to_dict()))
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of HEUTopic 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 HEUTopic from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"id": obj.get("id"),
"projectID": obj.get("projectID"),
"title": obj.get("title"),
"topic": obj.get("topic")
})
return _obj
@@ -0,0 +1,107 @@
# coding: utf-8
"""
CORDIS Horizon Europe Multi-Index 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, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class HEUWebLink(BaseModel):
"""
HEUWebLink
""" # noqa: E501
archived_date: Optional[datetime] = Field(default=None, alias="archivedDate")
available_languages: Optional[StrictStr] = Field(default=None, alias="availableLanguages")
id: Optional[StrictStr] = None
link_id: Optional[StrictStr] = Field(default=None, alias="linkId")
project_id: Optional[StrictStr] = Field(default=None, alias="projectID")
represents: Optional[StrictStr] = None
source: Optional[StrictStr] = None
status: Optional[StrictStr] = None
type: Optional[StrictStr] = None
url: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["archivedDate", "availableLanguages", "id", "linkId", "projectID", "represents", "source", "status", "type", "url"]
model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(to_jsonable_python(self.to_dict()))
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of HEUWebLink 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 HEUWebLink from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"archivedDate": obj.get("archivedDate"),
"availableLanguages": obj.get("availableLanguages"),
"id": obj.get("id"),
"linkId": obj.get("linkId"),
"projectID": obj.get("projectID"),
"represents": obj.get("represents"),
"source": obj.get("source"),
"status": obj.get("status"),
"type": obj.get("type"),
"url": obj.get("url")
})
return _obj